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++) {
150 inlink->
h, outlink->
h);
155 #define FIELD_UPPER 0
156 #define FIELD_LOWER 1
157 #define FIELD_UPPER_AND_LOWER 2
181 int lines = plane == 1 || plane == 2 ?
FF_CEIL_RSHIFT(src_h, vsub) : src_h;
191 srcp += src_linesize[plane];
193 dstp += dst_linesize[plane];
198 int srcp_linesize = src_linesize[plane] * k;
199 int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
200 for (h = lines; h > 0; h--) {
201 const uint8_t *srcp_above = srcp - src_linesize[plane];
202 const uint8_t *srcp_below = srcp + src_linesize[plane];
203 if (h == lines) srcp_above =
srcp;
204 if (h == 1) srcp_below =
srcp;
205 for (i = 0; i < linesize; i++) {
209 dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
211 dstp += dstp_linesize;
212 srcp += srcp_linesize;
216 srcp, src_linesize[plane]*k, linesize, lines);
230 tinterlace->
cur = tinterlace->
next;
231 tinterlace->
next = picref;
233 cur = tinterlace->
cur;
234 next = tinterlace->
next;
236 if (!tinterlace->
cur)
239 switch (tinterlace->
mode) {
253 inlink->
format, inlink->
w, inlink->
h,
258 inlink->
format, inlink->
w, inlink->
h,
283 inlink->
format, inlink->
w, inlink->
h,
288 inlink->
format, inlink->
w, inlink->
h,
307 inlink->
format, inlink->
w, inlink->
h,
312 (
const uint8_t **)next->data, next->linesize,
313 inlink->
format, inlink->
w, inlink->
h,
314 tff ? FIELD_LOWER :
FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
329 tff = next->top_field_first;
339 inlink->
format, inlink->
w, inlink->
h,
340 tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
344 (
const uint8_t **)next->data, next->linesize,
345 inlink->
format, inlink->
w, inlink->
h,
346 tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
378 .
name =
"tinterlace",
383 .
inputs = tinterlace_inputs,
385 .priv_class = &tinterlace_class,