9 #include "img_format.h"
14 static void mirror(unsigned char* dst
,unsigned char* src
,int dststride
,int srcstride
,int w
,int h
,int bpp
,unsigned int fmt
){
20 for(x
=0;x
<w
;x
++) dst
[x
]=src
[w
-x
-1];
25 // packed YUV is tricky. U,V are 32bpp while Y is 16bpp:
28 // TODO: optimize this...
29 dst
[x
*4+0]=src
[0+(w2
-x
-1)*4];
30 dst
[x
*4+1]=src
[3+(w2
-x
-1)*4];
31 dst
[x
*4+2]=src
[2+(w2
-x
-1)*4];
32 dst
[x
*4+3]=src
[1+(w2
-x
-1)*4];
37 // packed YUV is tricky. U,V are 32bpp while Y is 16bpp:
40 // TODO: optimize this...
41 dst
[x
*4+0]=src
[2+(w2
-x
-1)*4];
42 dst
[x
*4+1]=src
[1+(w2
-x
-1)*4];
43 dst
[x
*4+2]=src
[0+(w2
-x
-1)*4];
44 dst
[x
*4+3]=src
[3+(w2
-x
-1)*4];
48 for(x
=0;x
<w
;x
++) *((short*)(dst
+x
*2))=*((short*)(src
+(w
-x
-1)*2));
53 dst
[x
*3+0]=src
[0+(w
-x
-1)*3];
54 dst
[x
*3+1]=src
[1+(w
-x
-1)*3];
55 dst
[x
*3+2]=src
[2+(w
-x
-1)*3];
59 for(x
=0;x
<w
;x
++) *((int*)(dst
+x
*4))=*((int*)(src
+(w
-x
-1)*4));
66 //===========================================================================//
68 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
){
71 // hope we'll get DR buffer:
72 dmpi
=vf_get_image(vf
->next
,mpi
->imgfmt
,
73 MP_IMGTYPE_TEMP
, MP_IMGFLAG_ACCEPT_STRIDE
,
76 if(mpi
->flags
&MP_IMGFLAG_PLANAR
){
77 mirror(dmpi
->planes
[0],mpi
->planes
[0],
78 dmpi
->stride
[0],mpi
->stride
[0],
79 dmpi
->w
,dmpi
->h
,1,mpi
->imgfmt
);
80 mirror(dmpi
->planes
[1],mpi
->planes
[1],
81 dmpi
->stride
[1],mpi
->stride
[1],
82 dmpi
->w
>>mpi
->chroma_x_shift
,dmpi
->h
>>mpi
->chroma_y_shift
,1,mpi
->imgfmt
);
83 mirror(dmpi
->planes
[2],mpi
->planes
[2],
84 dmpi
->stride
[2],mpi
->stride
[2],
85 dmpi
->w
>>mpi
->chroma_x_shift
,dmpi
->h
>>mpi
->chroma_y_shift
,1,mpi
->imgfmt
);
87 mirror(dmpi
->planes
[0],mpi
->planes
[0],
88 dmpi
->stride
[0],mpi
->stride
[0],
89 dmpi
->w
,dmpi
->h
,dmpi
->bpp
>>3,mpi
->imgfmt
);
90 dmpi
->planes
[1]=mpi
->planes
[1]; // passthrough rgb8 palette
93 return vf_next_put_image(vf
,dmpi
, pts
);
96 //===========================================================================//
98 static int open(vf_instance_t
*vf
, char* args
){
100 vf
->put_image
=put_image
;
104 const vf_info_t vf_info_mirror
= {
113 //===========================================================================//