9 #include "img_format.h"
13 #include "libvo/fastmemcpy.h"
16 static void mirror(unsigned char* dst
,unsigned char* src
,int dststride
,int srcstride
,int w
,int h
,int bpp
,unsigned int fmt
){
22 for(x
=0;x
<w
;x
++) dst
[x
]=src
[w
-x
-1];
27 // packed YUV is tricky. U,V are 32bpp while Y is 16bpp:
30 // TODO: optimize this...
31 dst
[x
*4+0]=src
[0+(w2
-x
-1)*4];
32 dst
[x
*4+1]=src
[3+(w2
-x
-1)*4];
33 dst
[x
*4+2]=src
[2+(w2
-x
-1)*4];
34 dst
[x
*4+3]=src
[1+(w2
-x
-1)*4];
39 // packed YUV is tricky. U,V are 32bpp while Y is 16bpp:
42 // TODO: optimize this...
43 dst
[x
*4+0]=src
[2+(w2
-x
-1)*4];
44 dst
[x
*4+1]=src
[1+(w2
-x
-1)*4];
45 dst
[x
*4+2]=src
[0+(w2
-x
-1)*4];
46 dst
[x
*4+3]=src
[3+(w2
-x
-1)*4];
50 for(x
=0;x
<w
;x
++) *((short*)(dst
+x
*2))=*((short*)(src
+(w
-x
-1)*2));
55 dst
[x
*3+0]=src
[0+(w
-x
-1)*3];
56 dst
[x
*3+1]=src
[1+(w
-x
-1)*3];
57 dst
[x
*3+2]=src
[2+(w
-x
-1)*3];
61 for(x
=0;x
<w
;x
++) *((int*)(dst
+x
*4))=*((int*)(src
+(w
-x
-1)*4));
68 //===========================================================================//
70 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
){
73 // hope we'll get DR buffer:
74 dmpi
=vf_get_image(vf
->next
,mpi
->imgfmt
,
75 MP_IMGTYPE_TEMP
, MP_IMGFLAG_ACCEPT_STRIDE
,
78 if(mpi
->flags
&MP_IMGFLAG_PLANAR
){
79 mirror(dmpi
->planes
[0],mpi
->planes
[0],
80 dmpi
->stride
[0],mpi
->stride
[0],
81 dmpi
->w
,dmpi
->h
,1,mpi
->imgfmt
);
82 mirror(dmpi
->planes
[1],mpi
->planes
[1],
83 dmpi
->stride
[1],mpi
->stride
[1],
84 dmpi
->w
>>mpi
->chroma_x_shift
,dmpi
->h
>>mpi
->chroma_y_shift
,1,mpi
->imgfmt
);
85 mirror(dmpi
->planes
[2],mpi
->planes
[2],
86 dmpi
->stride
[2],mpi
->stride
[2],
87 dmpi
->w
>>mpi
->chroma_x_shift
,dmpi
->h
>>mpi
->chroma_y_shift
,1,mpi
->imgfmt
);
89 mirror(dmpi
->planes
[0],mpi
->planes
[0],
90 dmpi
->stride
[0],mpi
->stride
[0],
91 dmpi
->w
,dmpi
->h
,dmpi
->bpp
>>3,mpi
->imgfmt
);
92 dmpi
->planes
[1]=mpi
->planes
[1]; // passthrough rgb8 palette
95 return vf_next_put_image(vf
,dmpi
, pts
);
98 //===========================================================================//
100 static int open(vf_instance_t
*vf
, char* args
){
102 vf
->put_image
=put_image
;
106 vf_info_t vf_info_mirror
= {
115 //===========================================================================//