9 #include "img_format.h"
13 #include "libvo/fastmemcpy.h"
14 #include "postproc/rgb2rgb.h"
17 //===========================================================================//
19 static int config(struct vf_instance_s
* vf
,
20 int width
, int height
, int d_width
, int d_height
,
21 unsigned int flags
, unsigned int outfmt
){
23 sws_rgb2rgb_init(get_sws_cpuflags());
25 if(vf_next_query_format(vf
,IMGFMT_YUY2
)<=0){
26 printf("yuy2 not supported by next filter/vo :(\n");
30 return vf_next_config(vf
,width
,height
,d_width
,d_height
,flags
,IMGFMT_YUY2
);
33 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
){
36 // hope we'll get DR buffer:
37 dmpi
=vf_get_image(vf
->next
,IMGFMT_YUY2
,
38 MP_IMGTYPE_TEMP
, MP_IMGFLAG_ACCEPT_STRIDE
,
41 if(mpi
->imgfmt
==IMGFMT_422P
)
42 yuv422ptoyuy2(mpi
->planes
[0],mpi
->planes
[1],mpi
->planes
[2], dmpi
->planes
[0],
43 mpi
->w
,mpi
->h
, mpi
->stride
[0],mpi
->stride
[1],dmpi
->stride
[0]);
45 yv12toyuy2(mpi
->planes
[0],mpi
->planes
[1],mpi
->planes
[2], dmpi
->planes
[0],
46 mpi
->w
,mpi
->h
, mpi
->stride
[0],mpi
->stride
[1],dmpi
->stride
[0]);
48 vf_clone_mpi_attributes(dmpi
, mpi
);
50 return vf_next_put_image(vf
,dmpi
);
53 //===========================================================================//
55 static int query_format(struct vf_instance_s
* vf
, unsigned int fmt
){
61 return vf_next_query_format(vf
,IMGFMT_YUY2
) & (~VFCAP_CSP_SUPPORTED_BY_HW
);
66 static int open(vf_instance_t
*vf
, char* args
){
68 vf
->put_image
=put_image
;
69 vf
->query_format
=query_format
;
73 vf_info_t vf_info_yuy2
= {
74 "fast YV12/Y422p -> YUY2 conversion",
82 //===========================================================================//