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
118 outlink->
w = inlink->
w;
120 inlink->
h*2 : inlink->
h;
123 uint8_t black[4] = { 16, 128, 128, 16 };
126 black[0] = black[3] = 0;
128 outlink->
w, outlink->
h, outlink->
format, 1);
133 for (i = 0; i < 4 && tinterlace->
black_data[i]; i++) {
148 inlink->
h, outlink->
h);
153 #define FIELD_UPPER 0
154 #define FIELD_LOWER 1
155 #define FIELD_UPPER_AND_LOWER 2
179 int lines = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT(src_h, vsub) : src_h;
189 srcp += src_linesize[plane];
191 dstp += dst_linesize[plane];
196 int srcp_linesize = src_linesize[plane] * k;
197 int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
198 for (h = lines; h > 0; h--) {
199 const uint8_t *srcp_above = srcp - src_linesize[plane];
200 const uint8_t *srcp_below = srcp + src_linesize[plane];
201 if (h == lines) srcp_above =
srcp;
202 if (h == 1) srcp_below =
srcp;
203 for (i = 0; i < linesize; i++) {
207 dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
209 dstp += dstp_linesize;
210 srcp += srcp_linesize;
214 srcp, src_linesize[plane]*k, linesize, lines);
228 tinterlace->
cur = tinterlace->
next;
229 tinterlace->
next = picref;
231 cur = tinterlace->
cur;
232 next = tinterlace->
next;
234 if (!tinterlace->
cur)
237 switch (tinterlace->
mode) {
251 inlink->
format, inlink->
w, inlink->
h,
256 inlink->
format, inlink->
w, inlink->
h,
279 inlink->
format, inlink->
w, inlink->
h,
284 inlink->
format, inlink->
w, inlink->
h,
303 inlink->
format, inlink->
w, inlink->
h,
308 (
const uint8_t **)next->data, next->linesize,
309 inlink->
format, inlink->
w, inlink->
h,
310 tff ? FIELD_LOWER :
FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
325 tff = next->top_field_first;
335 inlink->
format, inlink->
w, inlink->
h,
336 tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
340 (
const uint8_t **)next->data, next->linesize,
341 inlink->
format, inlink->
w, inlink->
h,
342 tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
374 .
name =
"tinterlace",
379 .
inputs = tinterlace_inputs,
381 .priv_class = &tinterlace_class,