18 //===========================================================================//
20 static int config(struct vf_instance_s
* vf
,
21 int width
, int height
, int d_width
, int d_height
,
22 unsigned int flags
, unsigned int outfmt
){
23 int pixel_stride
= (width
+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one
26 if(mpi
->flags
&MP_IMGFLAG_PLANAR
)
27 pixel_stride
= mpi
->stride
[0];
29 pixel_stride
= 8*mpi
->stride
[0] / mpi
->bpp
;
33 if(vf
->priv
->interleave
){
34 vf
->priv
->height
= 2*height
;
35 vf
->priv
->width
= width
- (pixel_stride
/2);
36 vf
->priv
->stridefactor
=1;
38 vf
->priv
->height
= height
/2;
39 vf
->priv
->width
= width
+ pixel_stride
;
40 vf
->priv
->stridefactor
=4;
42 //printf("hX %d %d %d\n", vf->priv->width,vf->priv->height,vf->priv->stridefactor);
44 return vf_next_config(vf
, vf
->priv
->width
, vf
->priv
->height
,
45 (d_width
*vf
->priv
->stridefactor
)>>1, 2*d_height
/vf
->priv
->stridefactor
, flags
, outfmt
);
48 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
){
49 if(mpi
->flags
&MP_IMGFLAG_DIRECT
){
50 // we've used DR, so we're ready...
51 return vf_next_put_image(vf
,(mp_image_t
*)mpi
->priv
, pts
);
54 vf
->dmpi
=vf_get_image(vf
->next
,mpi
->imgfmt
,
55 MP_IMGTYPE_EXPORT
, MP_IMGFLAG_ACCEPT_STRIDE
,
56 vf
->priv
->width
, vf
->priv
->height
);
58 // set up mpi as a double-stride image of dmpi:
59 vf
->dmpi
->planes
[0]=mpi
->planes
[0];
60 vf
->dmpi
->stride
[0]=(mpi
->stride
[0]*vf
->priv
->stridefactor
)>>1;
61 if(vf
->dmpi
->flags
&MP_IMGFLAG_PLANAR
){
62 vf
->dmpi
->planes
[1]=mpi
->planes
[1];
63 vf
->dmpi
->stride
[1]=(mpi
->stride
[1]*vf
->priv
->stridefactor
)>>1;
64 vf
->dmpi
->planes
[2]=mpi
->planes
[2];
65 vf
->dmpi
->stride
[2]=(mpi
->stride
[2]*vf
->priv
->stridefactor
)>>1;
67 vf
->dmpi
->planes
[1]=mpi
->planes
[1]; // passthru bgr8 palette!!!
69 return vf_next_put_image(vf
,vf
->dmpi
, pts
);
72 //===========================================================================//
74 static void uninit(struct vf_instance_s
* vf
)
79 static int open(vf_instance_t
*vf
, char* args
){
81 vf
->put_image
=put_image
;
83 vf
->default_reqs
=VFCAP_ACCEPT_STRIDE
;
84 vf
->priv
=calloc(1, sizeof(struct vf_priv_s
));
85 vf
->priv
->interleave
= args
&& (*args
== 'i');
89 const vf_info_t vf_info_fil
= {
90 "fast (de)interleaver",
92 "Michael Niedermayer",
98 //===========================================================================//