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],
205 int lines = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT(src_h, vsub) : src_h;
216 srcp += src_linesize[plane];
218 dstp += dst_linesize[plane];
223 int srcp_linesize = src_linesize[plane] * k;
224 int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
225 for (h = lines; h > 0; h--) {
226 const uint8_t *srcp_above = srcp - src_linesize[plane];
227 const uint8_t *srcp_below = srcp + src_linesize[plane];
228 if (h == lines) srcp_above =
srcp;
229 if (h == 1) srcp_below =
srcp;
231 tinterlace->
lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);
232 dstp += dstp_linesize;
233 srcp += srcp_linesize;
237 srcp, src_linesize[plane]*k, linesize, lines);
251 tinterlace->
cur = tinterlace->
next;
252 tinterlace->
next = picref;
254 cur = tinterlace->
cur;
255 next = tinterlace->
next;
257 if (!tinterlace->
cur)
260 switch (tinterlace->
mode) {
274 inlink->
format, inlink->
w, inlink->
h,
279 inlink->
format, inlink->
w, inlink->
h,
304 inlink->
format, inlink->
w, inlink->
h,
309 inlink->
format, inlink->
w, inlink->
h,
328 inlink->
format, inlink->
w, inlink->
h,
333 (
const uint8_t **)next->data, next->linesize,
334 inlink->
format, inlink->
w, inlink->
h,
335 tff ? FIELD_LOWER :
FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
353 tff = next->top_field_first;
362 out->
pts = cur->
pts + next->pts;
368 inlink->
format, inlink->
w, inlink->
h,
369 tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
373 (
const uint8_t **)next->data, next->linesize,
374 inlink->
format, inlink->
w, inlink->
h,
375 tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
408 .
name =
"tinterlace",
413 .
inputs = tinterlace_inputs,
415 .priv_class = &tinterlace_class,