54 int black_linesize[4];
57 #define OFFSET(x) offsetof(TInterlaceContext, x)
58 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
59 #define TINTERLACE_FLAG_VLPF 01
80 #define FULL_SCALE_YUVJ_FORMATS \
81 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
120 outlink->
w = inlink->
w;
122 inlink->
h*2 : inlink->
h;
125 uint8_t black[4] = { 16, 128, 128, 16 };
128 black[0] = black[3] = 0;
130 outlink->
w, outlink->
h, outlink->
format, 1);
135 for (i = 0; i < 4 && tinterlace->
black_data[i]; i++) {
156 inlink->h, outlink->h);
161 #define FIELD_UPPER 0
162 #define FIELD_LOWER 1
163 #define FIELD_UPPER_AND_LOWER 2
187 int lines = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT(src_h, vsub) : src_h;
197 srcp += src_linesize[plane];
199 dstp += dst_linesize[plane];
204 int srcp_linesize = src_linesize[plane] * k;
205 int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
206 for (h = lines; h > 0; h--) {
207 const uint8_t *srcp_above = srcp - src_linesize[plane];
208 const uint8_t *srcp_below = srcp + src_linesize[plane];
209 if (h == lines) srcp_above =
srcp;
210 if (h == 1) srcp_below =
srcp;
211 for (i = 0; i < linesize; i++) {
215 dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
217 dstp += dstp_linesize;
218 srcp += srcp_linesize;
222 srcp, src_linesize[plane]*k, linesize, lines);
236 tinterlace->
cur = tinterlace->
next;
237 tinterlace->
next = picref;
239 cur = tinterlace->
cur;
240 next = tinterlace->
next;
242 if (!tinterlace->
cur)
245 switch (tinterlace->
mode) {
259 inlink->
format, inlink->
w, inlink->
h,
264 inlink->
format, inlink->
w, inlink->
h,
289 inlink->
format, inlink->
w, inlink->
h,
294 inlink->
format, inlink->
w, inlink->
h,
313 inlink->
format, inlink->
w, inlink->
h,
318 (
const uint8_t **)next->data, next->linesize,
319 inlink->
format, inlink->
w, inlink->
h,
320 tff ? FIELD_LOWER :
FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
337 tff = next->top_field_first;
345 out->
pts = cur->
pts + next->pts;
351 inlink->
format, inlink->
w, inlink->
h,
352 tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
356 (
const uint8_t **)next->data, next->linesize,
357 inlink->
format, inlink->
w, inlink->
h,
358 tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
390 .
name =
"tinterlace",
395 .
inputs = tinterlace_inputs,
397 .priv_class = &tinterlace_class,