35 #define OFFSET(x) offsetof(TInterlaceContext, x)
36 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
37 #define TINTERLACE_FLAG_VLPF 01
38 #define TINTERLACE_FLAG_EXACT_TB 2
60 #define FULL_SCALE_YUVJ_FORMATS \
61 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
92 for (i = 0; i <
width; i++) {
96 dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
119 outlink->
w = inlink->
w;
121 inlink->
h*2 : inlink->
h;
124 uint8_t black[4] = { 16, 128, 128, 16 };
127 black[0] = black[3] = 0;
129 outlink->
w, outlink->
h, outlink->
format, 1);
134 for (i = 0; i < 4 && tinterlace->
black_data[i]; i++) {
152 }
else if (tinterlace->mode !=
MODE_PAD) {
158 if (!
av_cmp_q(standard_tbs[i], outlink->time_base))
163 outlink->time_base = tinterlace->preout_time_base;
173 inlink->h, outlink->h);
178 #define FIELD_UPPER 0
179 #define FIELD_LOWER 1
180 #define FIELD_UPPER_AND_LOWER 2
193 uint8_t *dst[4],
int dst_linesize[4],
206 int lines = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT(src_h, vsub) : src_h;
207 int cols = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT( w, hsub) : w;
213 srcp += src_linesize[plane];
215 dstp += dst_linesize[plane];
220 int srcp_linesize = src_linesize[plane] * k;
221 int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
222 for (h = lines; h > 0; h--) {
223 const uint8_t *srcp_above = srcp - src_linesize[plane];
224 const uint8_t *srcp_below = srcp + src_linesize[plane];
225 if (h == lines) srcp_above =
srcp;
226 if (h == 1) srcp_below =
srcp;
228 tinterlace->
lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);
229 dstp += dstp_linesize;
230 srcp += srcp_linesize;
234 srcp, src_linesize[plane]*k, cols, lines);
248 tinterlace->
cur = tinterlace->
next;
249 tinterlace->
next = picref;
251 cur = tinterlace->
cur;
252 next = tinterlace->
next;
254 if (!tinterlace->
cur)
257 switch (tinterlace->
mode) {
271 inlink->
format, inlink->
w, inlink->
h,
276 inlink->
format, inlink->
w, inlink->
h,
301 inlink->
format, inlink->
w, inlink->
h,
306 inlink->
format, inlink->
w, inlink->
h,
325 inlink->
format, inlink->
w, inlink->
h,
330 (
const uint8_t **)next->data, next->linesize,
331 inlink->
format, inlink->
w, inlink->
h,
332 tff ? FIELD_LOWER :
FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
350 tff = next->top_field_first;
359 out->
pts = cur->
pts + next->pts;
365 inlink->
format, inlink->
w, inlink->
h,
366 tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
370 (
const uint8_t **)next->data, next->linesize,
371 inlink->
format, inlink->
w, inlink->
h,
372 tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
405 .
name =
"tinterlace",
410 .
inputs = tinterlace_inputs,
412 .priv_class = &tinterlace_class,