11 #include "../libvo/fastmemcpy.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
){
22 return vf_next_config(vf
,width
,height
/2,d_width
,d_height
,flags
,outfmt
);
25 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
){
26 if(mpi
->flags
&MP_IMGFLAG_DIRECT
){
27 // we've used DR, so we're ready...
28 return vf_next_put_image(vf
,(mp_image_t
*)mpi
->priv
);
31 vf
->dmpi
=vf_get_image(vf
->next
,mpi
->imgfmt
,
32 MP_IMGTYPE_EXPORT
, MP_IMGFLAG_ACCEPT_STRIDE
,
33 mpi
->width
, mpi
->height
/2);
35 // set up mpi as a double-stride image of dmpi:
36 vf
->dmpi
->planes
[0]=mpi
->planes
[0]+mpi
->stride
[0]*vf
->priv
->field
;
37 vf
->dmpi
->stride
[0]=2*mpi
->stride
[0];
38 if(vf
->dmpi
->flags
&MP_IMGFLAG_PLANAR
){
39 vf
->dmpi
->planes
[1]=mpi
->planes
[1]+
40 mpi
->stride
[1]*vf
->priv
->field
;
41 vf
->dmpi
->stride
[1]=2*mpi
->stride
[1];
42 vf
->dmpi
->planes
[2]=mpi
->planes
[2]+
43 mpi
->stride
[2]*vf
->priv
->field
;
44 vf
->dmpi
->stride
[2]=2*mpi
->stride
[2];
46 vf
->dmpi
->planes
[1]=mpi
->planes
[1]; // passthru bgr8 palette!!!
48 return vf_next_put_image(vf
,vf
->dmpi
);
51 //===========================================================================//
53 static void uninit(struct vf_instance_s
* vf
)
58 static int open(vf_instance_t
*vf
, char* args
){
60 vf
->put_image
=put_image
;
62 vf
->default_reqs
=VFCAP_ACCEPT_STRIDE
;
63 vf
->priv
=calloc(1, sizeof(struct vf_priv_s
));
64 if (args
) sscanf(args
, "%d", &vf
->priv
->field
);
69 vf_info_t vf_info_field
= {
70 "extract single field",
78 //===========================================================================//