You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

592 lines
25KB

  1. /*
  2. * Copyright (c) 2021 Paul B Mahol
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libavutil/common.h"
  21. #include "libavutil/imgutils.h"
  22. #include "libavutil/opt.h"
  23. #include "libavutil/pixdesc.h"
  24. #include "avfilter.h"
  25. #include "formats.h"
  26. #include "internal.h"
  27. #include "video.h"
  28. typedef struct ESTDIFContext {
  29. const AVClass *class;
  30. int mode; ///< 0 is frame, 1 is field
  31. int parity; ///< frame field parity
  32. int deint; ///< which frames to deinterlace
  33. int rslope; ///< best edge slope search radius
  34. int redge; ///< best edge match search radius
  35. int interp; ///< type of interpolation
  36. int linesize[4]; ///< bytes of pixel data per line for each plane
  37. int planewidth[4]; ///< width of each plane
  38. int planeheight[4]; ///< height of each plane
  39. int field; ///< which field are we on, 0 or 1
  40. int eof;
  41. int depth;
  42. int half;
  43. int nb_planes;
  44. int nb_threads;
  45. int64_t pts;
  46. AVFrame *prev;
  47. void (*interpolate)(struct ESTDIFContext *s, uint8_t *dst,
  48. const uint8_t *prev_line, const uint8_t *next_line,
  49. const uint8_t *prev2_line, const uint8_t *next2_line,
  50. const uint8_t *prev3_line, const uint8_t *next3_line,
  51. int x, int width, int rslope, int redge, unsigned half,
  52. int depth, int *K);
  53. unsigned (*mid_8[3])(const uint8_t *const prev,
  54. const uint8_t *const next,
  55. const uint8_t *const prev2,
  56. const uint8_t *const next2,
  57. const uint8_t *const prev3,
  58. const uint8_t *const next3,
  59. int end, int x, int k, int depth);
  60. unsigned (*mid_16[3])(const uint16_t *const prev,
  61. const uint16_t *const next,
  62. const uint16_t *const prev2,
  63. const uint16_t *const next2,
  64. const uint16_t *const prev3,
  65. const uint16_t *const next3,
  66. int end, int x, int k, int depth);
  67. } ESTDIFContext;
  68. #define MAX_R 15
  69. #define S (MAX_R * 2 + 1)
  70. #define OFFSET(x) offsetof(ESTDIFContext, x)
  71. #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
  72. #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }
  73. static const AVOption estdif_options[] = {
  74. { "mode", "specify the mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "mode" },
  75. CONST("frame", "send one frame for each frame", 0, "mode"),
  76. CONST("field", "send one frame for each field", 1, "mode"),
  77. { "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=-1}, -1, 1, FLAGS, "parity" },
  78. CONST("tff", "assume top field first", 0, "parity"),
  79. CONST("bff", "assume bottom field first", 1, "parity"),
  80. CONST("auto", "auto detect parity", -1, "parity"),
  81. { "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "deint" },
  82. CONST("all", "deinterlace all frames", 0, "deint"),
  83. CONST("interlaced", "only deinterlace frames marked as interlaced", 1, "deint"),
  84. { "rslope", "specify the search radius for edge slope tracing", OFFSET(rslope), AV_OPT_TYPE_INT, {.i64=1}, 1, MAX_R, FLAGS, },
  85. { "redge", "specify the search radius for best edge matching", OFFSET(redge), AV_OPT_TYPE_INT, {.i64=2}, 0, MAX_R, FLAGS, },
  86. { "interp", "specify the type of interpolation", OFFSET(interp), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, FLAGS, "interp" },
  87. CONST("2p", "two-point interpolation", 0, "interp"),
  88. CONST("4p", "four-point interpolation", 1, "interp"),
  89. CONST("6p", "six-point interpolation", 2, "interp"),
  90. { NULL }
  91. };
  92. AVFILTER_DEFINE_CLASS(estdif);
  93. static int query_formats(AVFilterContext *ctx)
  94. {
  95. static const enum AVPixelFormat pix_fmts[] = {
  96. AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
  97. AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
  98. AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
  99. AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
  100. AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
  101. AV_PIX_FMT_YUVJ411P,
  102. AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
  103. AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
  104. AV_PIX_FMT_GRAY8,
  105. AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
  106. AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
  107. AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
  108. AV_PIX_FMT_YUV440P10,
  109. AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
  110. AV_PIX_FMT_YUV440P12,
  111. AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
  112. AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
  113. AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
  114. AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA444P16,
  115. AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA422P16,
  116. AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16,
  117. AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
  118. AV_PIX_FMT_NONE
  119. };
  120. AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
  121. if (!fmts_list)
  122. return AVERROR(ENOMEM);
  123. return ff_set_common_formats(ctx, fmts_list);
  124. }
  125. static int config_output(AVFilterLink *outlink)
  126. {
  127. AVFilterContext *ctx = outlink->src;
  128. AVFilterLink *inlink = ctx->inputs[0];
  129. outlink->time_base.num = inlink->time_base.num;
  130. outlink->time_base.den = inlink->time_base.den * 2;
  131. outlink->frame_rate.num = inlink->frame_rate.num * 2;
  132. outlink->frame_rate.den = inlink->frame_rate.den;
  133. return 0;
  134. }
  135. typedef struct ThreadData {
  136. AVFrame *out, *in;
  137. } ThreadData;
  138. #define MIDL(type, ss) \
  139. static unsigned midl_##ss(const type *const prev, \
  140. const type *const next, \
  141. int end, int x, int k) \
  142. { \
  143. return (prev[av_clip(x + k, 0, end)] + \
  144. next[av_clip(x - k, 0, end)] + 1) >> 1; \
  145. }
  146. MIDL(uint8_t, 8)
  147. MIDL(uint16_t, 16)
  148. #define MID2(type, ss) \
  149. static unsigned mid2_##ss(const type *const prev, \
  150. const type *const next, \
  151. const type *const prev2, \
  152. const type *const next2, \
  153. const type *const prev3, \
  154. const type *const next3, \
  155. int end, int x, int k, int depth) \
  156. { \
  157. return (prev[av_clip(x + k, 0, end)] + \
  158. next[av_clip(x - k, 0, end)] + 1) >> 1; \
  159. }
  160. MID2(uint8_t, 8)
  161. MID2(uint16_t, 16)
  162. #define MID4(type, ss) \
  163. static unsigned mid4_##ss(const type *const prev, \
  164. const type *const next, \
  165. const type *const prev2, \
  166. const type *const next2, \
  167. const type *const prev3, \
  168. const type *const next3, \
  169. int end, int x, int k, int depth) \
  170. { \
  171. return av_clip_uintp2_c(( \
  172. 9 * (prev[av_clip(x + k, 0, end)] + \
  173. next[av_clip(x - k, 0, end)]) - \
  174. 1 * (prev2[av_clip(x + k*3, 0, end)] + \
  175. next2[av_clip(x - k*3, 0, end)]) + 8) >> 4, \
  176. depth); \
  177. }
  178. MID4(uint8_t, 8)
  179. MID4(uint16_t, 16)
  180. #define MID6(type, ss) \
  181. static unsigned mid6_##ss(const type *const prev, \
  182. const type *const next, \
  183. const type *const prev2, \
  184. const type *const next2, \
  185. const type *const prev3, \
  186. const type *const next3, \
  187. int end, int x, int k, int depth) \
  188. { \
  189. return av_clip_uintp2_c(( \
  190. 20 * (prev[av_clip(x + k, 0, end)] + \
  191. next[av_clip(x - k, 0, end)]) - \
  192. 5 * (prev2[av_clip(x + k*3, 0, end)] + \
  193. next2[av_clip(x - k*3, 0, end)]) + \
  194. 1 * (prev3[av_clip(x + k*5, 0, end)] + \
  195. next3[av_clip(x - k*5, 0, end)]) + 16) >> 5, \
  196. depth); \
  197. }
  198. MID6(uint8_t, 8)
  199. MID6(uint16_t, 16)
  200. #define DIFF(type, ss) \
  201. static unsigned diff_##ss(const type *const prev, \
  202. const type *const next, \
  203. int end, int x, int k, int j) \
  204. { \
  205. return FFABS(prev[av_clip(x + k + j, 0, end)] - \
  206. next[av_clip(x - k + j, 0, end)]); \
  207. }
  208. DIFF(uint8_t, 8)
  209. DIFF(uint16_t, 16)
  210. #define COST(type, ss) \
  211. static unsigned cost_##ss(const type *const prev, \
  212. const type *const next, \
  213. int end, int x, int k) \
  214. { \
  215. const int m = midl_##ss(prev, next, end, x, k); \
  216. const int p = prev[x]; \
  217. const int n = next[x]; \
  218. \
  219. return FFABS(p - m) + FFABS(n - m); \
  220. }
  221. COST(uint8_t, 8)
  222. COST(uint16_t, 16)
  223. #define INTERPOLATE(type, atype, max, ss) \
  224. static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \
  225. const uint8_t *const pprev_line, \
  226. const uint8_t *const nnext_line, \
  227. const uint8_t *const pprev2_line, \
  228. const uint8_t *const nnext2_line, \
  229. const uint8_t *const pprev3_line, \
  230. const uint8_t *const nnext3_line, \
  231. int x, int width, int rslope, \
  232. int redge, unsigned h, int depth, \
  233. int *K) \
  234. { \
  235. type *dst = (type *)ddst; \
  236. const type *const prev_line = (const type *const)pprev_line; \
  237. const type *const prev2_line = (const type *const)pprev2_line; \
  238. const type *const prev3_line = (const type *const)pprev3_line; \
  239. const type *const next_line = (const type *const)nnext_line; \
  240. const type *const next2_line = (const type *const)nnext2_line; \
  241. const type *const next3_line = (const type *const)nnext3_line; \
  242. const int interp = s->interp; \
  243. const int end = width - 1; \
  244. const atype f = redge + 2; \
  245. atype sd[S], sD[S], di = 0; \
  246. atype dmin = max; \
  247. int k = *K; \
  248. \
  249. for (int i = -rslope; i <= rslope && abs(k) > rslope; i++) { \
  250. atype sum = 0; \
  251. \
  252. for (int j = -redge; j <= redge; j++) { \
  253. sum += diff_##ss(prev_line, next_line, end, x, i, j); \
  254. sum += diff_##ss(prev2_line, prev_line, end, x, i, j); \
  255. sum += diff_##ss(next_line, next2_line, end, x, i, j); \
  256. } \
  257. \
  258. sD[i + rslope] = sum; \
  259. sD[i + rslope] += f * cost_##ss(prev_line, next_line, end, x, i); \
  260. sD[i + rslope] += h * abs(i); \
  261. \
  262. dmin = FFMIN(sD[i + rslope], dmin); \
  263. } \
  264. \
  265. for (int i = -rslope; i <= rslope; i++) { \
  266. atype sum = 0; \
  267. \
  268. for (int j = -redge; j <= redge; j++) { \
  269. sum += diff_##ss(prev_line, next_line, end, x, k + i, j); \
  270. sum += diff_##ss(prev2_line, prev_line, end, x, k + i, j); \
  271. sum += diff_##ss(next_line, next2_line, end, x, k + i, j); \
  272. } \
  273. \
  274. sd[i + rslope] = sum; \
  275. sd[i + rslope] += f * cost_##ss(prev_line, next_line, end, x, k + i); \
  276. sd[i + rslope] += h * abs(k + i); \
  277. \
  278. dmin = FFMIN(sd[i + rslope], dmin); \
  279. } \
  280. \
  281. for (int i = -rslope; i <= rslope && abs(k) > rslope; i++) { \
  282. if (dmin == sD[i + rslope]) { \
  283. di = 1; \
  284. k = i; \
  285. break; \
  286. } \
  287. } \
  288. \
  289. for (int i = -rslope; i <= rslope && !di; i++) { \
  290. if (dmin == sd[i + rslope]) { \
  291. k += i; \
  292. break; \
  293. } \
  294. } \
  295. \
  296. dst[x] = s->mid_##ss[interp](prev_line, next_line, \
  297. prev2_line, next2_line, \
  298. prev3_line, next3_line, \
  299. end, x, k, depth); \
  300. \
  301. *K = k; \
  302. }
  303. INTERPOLATE(uint8_t, unsigned, UINT_MAX, 8)
  304. INTERPOLATE(uint16_t, uint64_t, UINT64_MAX, 16)
  305. static int deinterlace_slice(AVFilterContext *ctx, void *arg,
  306. int jobnr, int nb_jobs)
  307. {
  308. ESTDIFContext *s = ctx->priv;
  309. ThreadData *td = arg;
  310. AVFrame *out = td->out;
  311. AVFrame *in = td->in;
  312. const int rslope = s->rslope;
  313. const int redge = s->redge;
  314. const int half = s->half;
  315. const int depth = s->depth;
  316. const int interlaced = in->interlaced_frame;
  317. const int tff = (s->field == (s->parity == -1 ? interlaced ? in->top_field_first : 1 :
  318. s->parity ^ 1));
  319. for (int plane = 0; plane < s->nb_planes; plane++) {
  320. const uint8_t *src_data = in->data[plane];
  321. uint8_t *dst_data = out->data[plane];
  322. const int linesize = s->linesize[plane];
  323. const int width = s->planewidth[plane];
  324. const int height = s->planeheight[plane];
  325. const int src_linesize = in->linesize[plane];
  326. const int dst_linesize = out->linesize[plane];
  327. const int start = (height * jobnr) / nb_jobs;
  328. const int end = (height * (jobnr+1)) / nb_jobs;
  329. const uint8_t *prev_line, *prev2_line, *next_line, *next2_line, *in_line;
  330. const uint8_t *prev3_line, *next3_line;
  331. uint8_t *out_line;
  332. int y_out;
  333. y_out = start + (tff ^ (start & 1));
  334. in_line = src_data + (y_out * src_linesize);
  335. out_line = dst_data + (y_out * dst_linesize);
  336. while (y_out < end) {
  337. memcpy(out_line, in_line, linesize);
  338. y_out += 2;
  339. in_line += src_linesize * 2;
  340. out_line += dst_linesize * 2;
  341. }
  342. y_out = start + ((!tff) ^ (start & 1));
  343. out_line = dst_data + (y_out * dst_linesize);
  344. for (int y = y_out; y < end; y += 2) {
  345. int y_prev3_in = y - 5;
  346. int y_next3_in = y + 5;
  347. int y_prev2_in = y - 3;
  348. int y_next2_in = y + 3;
  349. int y_prev_in = y - 1;
  350. int y_next_in = y + 1;
  351. int k;
  352. while (y_prev3_in < 0)
  353. y_prev3_in += 2;
  354. while (y_next3_in >= height)
  355. y_next3_in -= 2;
  356. while (y_prev2_in < 0)
  357. y_prev2_in += 2;
  358. while (y_next2_in >= height)
  359. y_next2_in -= 2;
  360. while (y_prev_in < 0)
  361. y_prev_in += 2;
  362. while (y_next_in >= height)
  363. y_next_in -= 2;
  364. prev3_line = src_data + (y_prev3_in * src_linesize);
  365. next3_line = src_data + (y_next3_in * src_linesize);
  366. prev2_line = src_data + (y_prev2_in * src_linesize);
  367. next2_line = src_data + (y_next2_in * src_linesize);
  368. prev_line = src_data + (y_prev_in * src_linesize);
  369. next_line = src_data + (y_next_in * src_linesize);
  370. k = 0;
  371. for (int x = 0; x < width; x++) {
  372. s->interpolate(s, out_line,
  373. prev_line, next_line,
  374. prev2_line, next2_line,
  375. prev3_line, next3_line,
  376. x, width, rslope, redge, half, depth, &k);
  377. }
  378. out_line += 2 * dst_linesize;
  379. }
  380. }
  381. return 0;
  382. }
  383. static int filter(AVFilterContext *ctx, int is_second, AVFrame *in)
  384. {
  385. ESTDIFContext *s = ctx->priv;
  386. AVFilterLink *outlink = ctx->outputs[0];
  387. AVFrame *out;
  388. ThreadData td;
  389. out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
  390. if (!out)
  391. return AVERROR(ENOMEM);
  392. av_frame_copy_props(out, in);
  393. out->interlaced_frame = 0;
  394. out->pts = s->pts;
  395. td.out = out; td.in = in;
  396. ctx->internal->execute(ctx, deinterlace_slice, &td, NULL,
  397. FFMIN(s->planeheight[1] / 2, s->nb_threads));
  398. if (s->mode)
  399. s->field = !s->field;
  400. return ff_filter_frame(outlink, out);
  401. }
  402. static int config_input(AVFilterLink *inlink)
  403. {
  404. AVFilterContext *ctx = inlink->dst;
  405. ESTDIFContext *s = ctx->priv;
  406. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
  407. int ret;
  408. if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
  409. return ret;
  410. s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
  411. s->planeheight[0] = s->planeheight[3] = inlink->h;
  412. s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
  413. s->planewidth[0] = s->planewidth[3] = inlink->w;
  414. if (inlink->h < 3) {
  415. av_log(ctx, AV_LOG_ERROR, "Video of less than 3 lines is not supported\n");
  416. return AVERROR(EINVAL);
  417. }
  418. s->nb_planes = av_pix_fmt_count_planes(inlink->format);
  419. s->nb_threads = ff_filter_get_nb_threads(ctx);
  420. s->depth = desc->comp[0].depth;
  421. s->interpolate = s->depth <= 8 ? interpolate_8 : interpolate_16;
  422. s->mid_8[0] = mid2_8;
  423. s->mid_8[1] = mid4_8;
  424. s->mid_8[2] = mid6_8;
  425. s->mid_16[0] = mid2_16;
  426. s->mid_16[1] = mid4_16;
  427. s->mid_16[2] = mid6_16;
  428. s->half = 1 << (s->depth - 1);
  429. return 0;
  430. }
  431. static int filter_frame(AVFilterLink *inlink, AVFrame *in)
  432. {
  433. AVFilterContext *ctx = inlink->dst;
  434. ESTDIFContext *s = ctx->priv;
  435. int ret;
  436. if (!s->prev) {
  437. s->prev = in;
  438. return 0;
  439. }
  440. if ((s->deint && !in->interlaced_frame) || ctx->is_disabled) {
  441. s->prev->pts *= 2;
  442. ret = ff_filter_frame(ctx->outputs[0], s->prev);
  443. s->prev = in;
  444. return ret;
  445. }
  446. s->pts = s->prev->pts * 2;
  447. ret = filter(ctx, 0, s->prev);
  448. if (ret < 0 || s->mode == 0) {
  449. av_frame_free(&s->prev);
  450. s->prev = in;
  451. return ret;
  452. }
  453. s->pts = s->prev->pts + in->pts;
  454. ret = filter(ctx, 1, s->prev);
  455. av_frame_free(&s->prev);
  456. s->prev = in;
  457. return ret;
  458. }
  459. static int request_frame(AVFilterLink *link)
  460. {
  461. AVFilterContext *ctx = link->src;
  462. ESTDIFContext *s = ctx->priv;
  463. int ret;
  464. if (s->eof)
  465. return AVERROR_EOF;
  466. ret = ff_request_frame(ctx->inputs[0]);
  467. if (ret == AVERROR_EOF && s->prev) {
  468. AVFrame *next = av_frame_clone(s->prev);
  469. if (!next)
  470. return AVERROR(ENOMEM);
  471. next->pts = s->prev->pts + av_rescale_q(1, av_inv_q(ctx->outputs[0]->frame_rate),
  472. ctx->outputs[0]->time_base);
  473. s->eof = 1;
  474. ret = filter_frame(ctx->inputs[0], next);
  475. } else if (ret < 0) {
  476. return ret;
  477. }
  478. return ret;
  479. }
  480. static av_cold void uninit(AVFilterContext *ctx)
  481. {
  482. ESTDIFContext *s = ctx->priv;
  483. av_frame_free(&s->prev);
  484. }
  485. static const AVFilterPad estdif_inputs[] = {
  486. {
  487. .name = "default",
  488. .type = AVMEDIA_TYPE_VIDEO,
  489. .filter_frame = filter_frame,
  490. .config_props = config_input,
  491. },
  492. { NULL }
  493. };
  494. static const AVFilterPad estdif_outputs[] = {
  495. {
  496. .name = "default",
  497. .type = AVMEDIA_TYPE_VIDEO,
  498. .config_props = config_output,
  499. .request_frame = request_frame,
  500. },
  501. { NULL }
  502. };
  503. AVFilter ff_vf_estdif = {
  504. .name = "estdif",
  505. .description = NULL_IF_CONFIG_SMALL("Apply Edge Slope Tracing deinterlace."),
  506. .priv_size = sizeof(ESTDIFContext),
  507. .priv_class = &estdif_class,
  508. .uninit = uninit,
  509. .query_formats = query_formats,
  510. .inputs = estdif_inputs,
  511. .outputs = estdif_outputs,
  512. .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,
  513. .process_command = ff_filter_process_command,
  514. };