8 #include "img_format.h"
12 #include "libvo/fastmemcpy.h"
20 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
)
24 int flags
= mpi
->fields
;
25 int state
= vf
->priv
->state
;
27 dmpi
= vf_get_image(vf
->next
, mpi
->imgfmt
,
28 MP_IMGTYPE_STATIC
, MP_IMGFLAG_ACCEPT_STRIDE
|
29 MP_IMGFLAG_PRESERVE
, mpi
->width
, mpi
->height
);
34 !(flags
& MP_IMGFIELD_TOP_FIRST
)) ||
36 flags
& MP_IMGFIELD_TOP_FIRST
)) {
37 mp_msg(MSGT_VFILTER
, MSGL_WARN
,
38 "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n",
40 (flags
& MP_IMGFIELD_TOP_FIRST
) != 0,
41 (flags
& MP_IMGFIELD_REPEAT_FIRST
) != 0);
46 ret
= vf_next_put_image(vf
, mpi
, MP_NOPTS_VALUE
);
48 if (flags
& MP_IMGFIELD_REPEAT_FIRST
) {
49 my_memcpy_pic(dmpi
->planes
[0],
50 mpi
->planes
[0], mpi
->w
, mpi
->h
/2,
51 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
52 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
53 my_memcpy_pic(dmpi
->planes
[1],
59 my_memcpy_pic(dmpi
->planes
[2],
69 my_memcpy_pic(dmpi
->planes
[0]+dmpi
->stride
[0],
70 mpi
->planes
[0]+mpi
->stride
[0], mpi
->w
, mpi
->h
/2,
71 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
72 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
73 my_memcpy_pic(dmpi
->planes
[1]+dmpi
->stride
[1],
74 mpi
->planes
[1]+mpi
->stride
[1],
75 mpi
->chroma_width
, mpi
->chroma_height
/2,
76 dmpi
->stride
[1]*2, mpi
->stride
[1]*2);
77 my_memcpy_pic(dmpi
->planes
[2]+dmpi
->stride
[2],
78 mpi
->planes
[2]+mpi
->stride
[2],
79 mpi
->chroma_width
, mpi
->chroma_height
/2,
80 dmpi
->stride
[2]*2, mpi
->stride
[2]*2);
82 ret
= vf_next_put_image(vf
, dmpi
, MP_NOPTS_VALUE
);
84 if (flags
& MP_IMGFIELD_REPEAT_FIRST
) {
85 ret
|= vf_next_put_image(vf
, mpi
, MP_NOPTS_VALUE
);
89 my_memcpy_pic(dmpi
->planes
[0],
90 mpi
->planes
[0], mpi
->w
, mpi
->h
/2,
91 dmpi
->stride
[0]*2, mpi
->stride
[0]*2);
92 if (mpi
->flags
& MP_IMGFLAG_PLANAR
) {
93 my_memcpy_pic(dmpi
->planes
[1],
99 my_memcpy_pic(dmpi
->planes
[2],
102 mpi
->chroma_height
/2,
109 vf
->priv
->state
= state
;
114 static int config(struct vf_instance_s
* vf
,
115 int width
, int height
, int d_width
, int d_height
,
116 unsigned int flags
, unsigned int outfmt
)
118 return vf_next_config(vf
,width
,height
,d_width
,d_height
,flags
,outfmt
);
121 static void uninit(struct vf_instance_s
* vf
)
123 mp_msg(MSGT_VFILTER
, MSGL_INFO
, "softpulldown: %lld frames in, %lld frames out\n", vf
->priv
->in
, vf
->priv
->out
);
127 static int open(vf_instance_t
*vf
, char* args
)
131 vf
->put_image
= put_image
;
133 vf
->default_reqs
= VFCAP_ACCEPT_STRIDE
;
134 vf
->priv
= p
= calloc(1, sizeof(struct vf_priv_s
));
139 const vf_info_t vf_info_softpulldown
= {
140 "mpeg2 soft 3:2 pulldown",
142 "Tobias Diedrich <ranma+mplayer@tdiedrich.de>",