annotate libmpcodecs/vf_flip.c @ 7394:e5e2243a3adb

reversed -ss behaviour (you have to use teh same -ss for all passes)
author arpi
date Sat, 14 Sep 2002 10:47:34 +0000
parents a894e99c1e51
children 62d00d1c624e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
1 #include <stdio.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
2 #include <stdlib.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
3 #include <string.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
4
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
5 #include "../config.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
6 #include "../mp_msg.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
7
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
8 #include "mp_image.h"
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
9 #include "vf.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
10
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
11 #include "../libvo/fastmemcpy.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
12
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
13 struct vf_priv_s {
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
14 mp_image_t *dmpi;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
15 };
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
16
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
17 //===========================================================================//
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
18
6137
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
19 static int config(struct vf_instance_s* vf,
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
20 int width, int height, int d_width, int d_height,
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
21 unsigned int flags, unsigned int outfmt){
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
22 flags&=~8; // remove the FLIP flag
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
23 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
24 }
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
25
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
26 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
27 if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
28 // try full DR !
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
29 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
30 mpi->type, mpi->flags, mpi->width, mpi->height);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
31 // set up mpi as a upside-down image of dmpi:
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
32 mpi->planes[0]=vf->priv->dmpi->planes[0]+
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
33 vf->priv->dmpi->stride[0]*(vf->priv->dmpi->height-1);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
34 mpi->stride[0]=-vf->priv->dmpi->stride[0];
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
35 if(mpi->flags&MP_IMGFLAG_PLANAR){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
36 mpi->planes[1]=vf->priv->dmpi->planes[1]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
37 vf->priv->dmpi->stride[1]*((vf->priv->dmpi->height>>mpi->chroma_y_shift)-1);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
38 mpi->stride[1]=-vf->priv->dmpi->stride[1];
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
39 mpi->planes[2]=vf->priv->dmpi->planes[2]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
40 vf->priv->dmpi->stride[2]*((vf->priv->dmpi->height>>mpi->chroma_y_shift)-1);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
41 mpi->stride[2]=-vf->priv->dmpi->stride[2];
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
42 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
43 mpi->flags|=MP_IMGFLAG_DIRECT;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
44 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
45 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
46
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
47 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
48 if(mpi->flags&MP_IMGFLAG_DIRECT){
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
49 // we've used DR, so we're ready...
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
50 return vf_next_put_image(vf,vf->priv->dmpi);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
51 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
52
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
53 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
5691
arpi
parents: 5607
diff changeset
54 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
55 mpi->width, mpi->height);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
56
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
57 // set up mpi as a upside-down image of dmpi:
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
58 vf->priv->dmpi->planes[0]=mpi->planes[0]+
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
59 mpi->stride[0]*(mpi->height-1);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
60 vf->priv->dmpi->stride[0]=-mpi->stride[0];
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
61 if(vf->priv->dmpi->flags&MP_IMGFLAG_PLANAR){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
62 vf->priv->dmpi->planes[1]=mpi->planes[1]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
63 mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
64 vf->priv->dmpi->stride[1]=-mpi->stride[1];
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
65 vf->priv->dmpi->planes[2]=mpi->planes[2]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
66 mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
67 vf->priv->dmpi->stride[2]=-mpi->stride[2];
7258
2a96fbce0848 bgr8 palette fixed
arpi
parents: 6539
diff changeset
68 } else
2a96fbce0848 bgr8 palette fixed
arpi
parents: 6539
diff changeset
69 vf->priv->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
70
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
71 return vf_next_put_image(vf,vf->priv->dmpi);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
72 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
73
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
74 //===========================================================================//
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
75
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
76 static int open(vf_instance_t *vf, char* args){
6137
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
77 vf->config=config;
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
78 vf->get_image=get_image;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
79 vf->put_image=put_image;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5557
diff changeset
80 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
81 vf->priv=malloc(sizeof(struct vf_priv_s));
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
82 return 1;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
83 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
84
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
85 vf_info_t vf_info_flip = {
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
86 "flip image upside-down",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
87 "flip",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
88 "A'rpi",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
89 "",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
90 open
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
91 };
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
92
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
93 //===========================================================================//