8 #include "img_format.h"
12 #include "libvo/fastmemcpy.h"
18 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
)
23 vf
->priv
->frame
= (vf
->priv
->frame
+1)%4;
25 dmpi
= vf_get_image(vf
->next
, mpi
->imgfmt
,
26 MP_IMGTYPE_STATIC
, MP_IMGFLAG_ACCEPT_STRIDE
|
27 MP_IMGFLAG_PRESERVE
, mpi
->width
, mpi
->height
);
30 // 0/0 1/1 2/2 2/3 3/0
31 switch (vf
->priv
->frame
) {
33 my_memcpy_pic(dmpi
->planes
[0]+dmpi
->stride
[0],
34 mpi
->planes
[0]+mpi
->stride
[0], mpi
->w
, mpi
->h
/2,
35 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
36 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
37 my_memcpy_pic(dmpi
->planes
[1]+dmpi
->stride
[1],
38 mpi
->planes
[1]+mpi
->stride
[1],
39 mpi
->chroma_width
, mpi
->chroma_height
/2,
40 dmpi
->stride
[1]*2, mpi
->stride
[1]*2);
41 my_memcpy_pic(dmpi
->planes
[2]+dmpi
->stride
[2],
42 mpi
->planes
[2]+mpi
->stride
[2],
43 mpi
->chroma_width
, mpi
->chroma_height
/2,
44 dmpi
->stride
[2]*2, mpi
->stride
[2]*2);
46 ret
= vf_next_put_image(vf
, dmpi
, MP_NOPTS_VALUE
);
49 memcpy_pic(dmpi
->planes
[0], mpi
->planes
[0], mpi
->w
, mpi
->h
,
50 dmpi
->stride
[0], mpi
->stride
[0]);
51 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
52 memcpy_pic(dmpi
->planes
[1], mpi
->planes
[1],
53 mpi
->chroma_width
, mpi
->chroma_height
,
54 dmpi
->stride
[1], mpi
->stride
[1]);
55 memcpy_pic(dmpi
->planes
[2], mpi
->planes
[2],
56 mpi
->chroma_width
, mpi
->chroma_height
,
57 dmpi
->stride
[2], mpi
->stride
[2]);
59 return vf_next_put_image(vf
, dmpi
, MP_NOPTS_VALUE
) || ret
;
61 my_memcpy_pic(dmpi
->planes
[0]+dmpi
->stride
[0],
62 mpi
->planes
[0]+mpi
->stride
[0], mpi
->w
, mpi
->h
/2,
63 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
64 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
65 my_memcpy_pic(dmpi
->planes
[1]+dmpi
->stride
[1],
66 mpi
->planes
[1]+mpi
->stride
[1],
67 mpi
->chroma_width
, mpi
->chroma_height
/2,
68 dmpi
->stride
[1]*2, mpi
->stride
[1]*2);
69 my_memcpy_pic(dmpi
->planes
[2]+dmpi
->stride
[2],
70 mpi
->planes
[2]+mpi
->stride
[2],
71 mpi
->chroma_width
, mpi
->chroma_height
/2,
72 dmpi
->stride
[2]*2, mpi
->stride
[2]*2);
74 ret
= vf_next_put_image(vf
, dmpi
, MP_NOPTS_VALUE
);
75 my_memcpy_pic(dmpi
->planes
[0], mpi
->planes
[0], mpi
->w
, mpi
->h
/2,
76 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
77 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
78 my_memcpy_pic(dmpi
->planes
[1], mpi
->planes
[1],
79 mpi
->chroma_width
, mpi
->chroma_height
/2,
80 dmpi
->stride
[1]*2, mpi
->stride
[1]*2);
81 my_memcpy_pic(dmpi
->planes
[2], mpi
->planes
[2],
82 mpi
->chroma_width
, mpi
->chroma_height
/2,
83 dmpi
->stride
[2]*2, mpi
->stride
[2]*2);
91 static int query_format(struct vf_instance_s
* vf
, unsigned int fmt
)
93 /* FIXME - figure out which other formats work */
98 return vf_next_query_format(vf
, fmt
);
103 static int config(struct vf_instance_s
* vf
,
104 int width
, int height
, int d_width
, int d_height
,
105 unsigned int flags
, unsigned int outfmt
)
107 return vf_next_config(vf
,width
,height
,d_width
,d_height
,flags
,outfmt
);
111 static void uninit(struct vf_instance_s
* vf
)
116 static int open(vf_instance_t
*vf
, char* args
)
118 //vf->config = config;
119 vf
->put_image
= put_image
;
120 //vf->query_format = query_format;
122 vf
->default_reqs
= VFCAP_ACCEPT_STRIDE
;
123 vf
->priv
= calloc(1, sizeof(struct vf_priv_s
));
125 if (args
) sscanf(args
, "%d", &vf
->priv
->frame
);
130 const vf_info_t vf_info_telecine
= {