11 #include "libvo/fastmemcpy.h"
20 //===========================================================================//
22 static int config(struct vf_instance_s
* vf
,
23 int width
, int height
, int d_width
, int d_height
,
24 unsigned int flags
, unsigned int outfmt
){
25 int pixel_stride
= (width
+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one
28 if(mpi
->flags
&MP_IMGFLAG_PLANAR
)
29 pixel_stride
= mpi
->stride
[0];
31 pixel_stride
= 8*mpi
->stride
[0] / mpi
->bpp
;
35 if(vf
->priv
->interleave
){
36 vf
->priv
->height
= 2*height
;
37 vf
->priv
->width
= width
- (pixel_stride
/2);
38 vf
->priv
->stridefactor
=1;
40 vf
->priv
->height
= height
/2;
41 vf
->priv
->width
= width
+ pixel_stride
;
42 vf
->priv
->stridefactor
=4;
44 //printf("hX %d %d %d\n", vf->priv->width,vf->priv->height,vf->priv->stridefactor);
46 return vf_next_config(vf
, vf
->priv
->width
, vf
->priv
->height
,
47 (d_width
*vf
->priv
->stridefactor
)>>1, 2*d_height
/vf
->priv
->stridefactor
, flags
, outfmt
);
50 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
){
51 if(mpi
->flags
&MP_IMGFLAG_DIRECT
){
52 // we've used DR, so we're ready...
53 return vf_next_put_image(vf
,(mp_image_t
*)mpi
->priv
, pts
);
56 vf
->dmpi
=vf_get_image(vf
->next
,mpi
->imgfmt
,
57 MP_IMGTYPE_EXPORT
, MP_IMGFLAG_ACCEPT_STRIDE
,
58 vf
->priv
->width
, vf
->priv
->height
);
60 // set up mpi as a double-stride image of dmpi:
61 vf
->dmpi
->planes
[0]=mpi
->planes
[0];
62 vf
->dmpi
->stride
[0]=(mpi
->stride
[0]*vf
->priv
->stridefactor
)>>1;
63 if(vf
->dmpi
->flags
&MP_IMGFLAG_PLANAR
){
64 vf
->dmpi
->planes
[1]=mpi
->planes
[1];
65 vf
->dmpi
->stride
[1]=(mpi
->stride
[1]*vf
->priv
->stridefactor
)>>1;
66 vf
->dmpi
->planes
[2]=mpi
->planes
[2];
67 vf
->dmpi
->stride
[2]=(mpi
->stride
[2]*vf
->priv
->stridefactor
)>>1;
69 vf
->dmpi
->planes
[1]=mpi
->planes
[1]; // passthru bgr8 palette!!!
71 return vf_next_put_image(vf
,vf
->dmpi
, pts
);
74 //===========================================================================//
76 static void uninit(struct vf_instance_s
* vf
)
81 static int open(vf_instance_t
*vf
, char* args
){
83 vf
->put_image
=put_image
;
85 vf
->default_reqs
=VFCAP_ACCEPT_STRIDE
;
86 vf
->priv
=calloc(1, sizeof(struct vf_priv_s
));
87 vf
->priv
->interleave
= args
&& (*args
== 'i');
91 vf_info_t vf_info_fil
= {
92 "fast (de)interleaver",
94 "Michael Niedermayer",
100 //===========================================================================//