Mercurial > mplayer.hg
annotate libmpcodecs/vf_flip.c @ 8744:f3c6f022d6b0
10l ;)
author | colin |
---|---|
date | Fri, 03 Jan 2003 18:33:26 +0000 |
parents | 62d00d1c624e |
children | 12741a866acd |
rev | line source |
---|---|
5557 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
5 #include "../config.h" | |
6 #include "../mp_msg.h" | |
7 | |
5607 | 8 #include "mp_image.h" |
5557 | 9 #include "vf.h" |
10 | |
11 #include "../libvo/fastmemcpy.h" | |
12 | |
13 struct vf_priv_s { | |
14 mp_image_t *dmpi; | |
15 }; | |
16 | |
17 //===========================================================================// | |
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 | 26 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
27 if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){ | |
28 // try full DR ! | |
29 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt, | |
30 mpi->type, mpi->flags, mpi->width, mpi->height); | |
31 // set up mpi as a upside-down image of dmpi: | |
32 mpi->planes[0]=vf->priv->dmpi->planes[0]+ | |
33 vf->priv->dmpi->stride[0]*(vf->priv->dmpi->height-1); | |
34 mpi->stride[0]=-vf->priv->dmpi->stride[0]; | |
35 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
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 | 38 mpi->stride[1]=-vf->priv->dmpi->stride[1]; |
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 | 41 mpi->stride[2]=-vf->priv->dmpi->stride[2]; |
42 } | |
43 mpi->flags|=MP_IMGFLAG_DIRECT; | |
8126 | 44 mpi->priv=(void*)vf->priv->dmpi; |
5557 | 45 } |
46 } | |
47 | |
7368 | 48 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
5557 | 49 if(mpi->flags&MP_IMGFLAG_DIRECT){ |
7368 | 50 // we've used DR, so we're ready... |
8126 | 51 return vf_next_put_image(vf,(mp_image_t*)mpi->priv); |
5557 | 52 } |
53 | |
54 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt, | |
5691 | 55 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
5557 | 56 mpi->width, mpi->height); |
57 | |
58 // set up mpi as a upside-down image of dmpi: | |
59 vf->priv->dmpi->planes[0]=mpi->planes[0]+ | |
60 mpi->stride[0]*(mpi->height-1); | |
61 vf->priv->dmpi->stride[0]=-mpi->stride[0]; | |
62 if(vf->priv->dmpi->flags&MP_IMGFLAG_PLANAR){ | |
63 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
|
64 mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1); |
5557 | 65 vf->priv->dmpi->stride[1]=-mpi->stride[1]; |
66 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
|
67 mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1); |
5557 | 68 vf->priv->dmpi->stride[2]=-mpi->stride[2]; |
7258 | 69 } else |
70 vf->priv->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! | |
5557 | 71 |
7368 | 72 return vf_next_put_image(vf,vf->priv->dmpi); |
5557 | 73 } |
74 | |
75 //===========================================================================// | |
76 | |
77 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
|
78 vf->config=config; |
5557 | 79 vf->get_image=get_image; |
80 vf->put_image=put_image; | |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5557
diff
changeset
|
81 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
5557 | 82 vf->priv=malloc(sizeof(struct vf_priv_s)); |
83 return 1; | |
84 } | |
85 | |
86 vf_info_t vf_info_flip = { | |
87 "flip image upside-down", | |
88 "flip", | |
89 "A'rpi", | |
90 "", | |
91 open | |
92 }; | |
93 | |
94 //===========================================================================// |