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.

574 lines
21KB

  1. /*
  2. * Copyright (C) 2012 Mark Himsley
  3. *
  4. * get_scene_score() Copyright (c) 2011 Stefano Sabatini
  5. * taken from libavfilter/vf_select.c
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. /**
  24. * @file
  25. * filter for upsampling or downsampling a progressive source
  26. */
  27. #define DEBUG
  28. #include "libavutil/avassert.h"
  29. #include "libavutil/imgutils.h"
  30. #include "libavutil/internal.h"
  31. #include "libavutil/opt.h"
  32. #include "libavutil/pixdesc.h"
  33. #include "libavutil/pixelutils.h"
  34. #include "avfilter.h"
  35. #include "internal.h"
  36. #include "video.h"
  37. typedef struct FrameRateContext {
  38. const AVClass *class;
  39. // parameters
  40. AVRational dest_frame_rate; ///< output frames per second
  41. int flags; ///< flags affecting frame rate conversion algorithm
  42. double scene_score; ///< score that denotes a scene change has happened
  43. int interp_start; ///< start of range to apply linear interpolation (same bitdepth as input)
  44. int interp_end; ///< end of range to apply linear interpolation (same bitdepth as input)
  45. int interp_start_param; ///< start of range to apply linear interpolation
  46. int interp_end_param; ///< end of range to apply linear interpolation
  47. int line_size[4]; ///< bytes of pixel data per line for each plane
  48. int vsub;
  49. AVRational srce_time_base; ///< timebase of source
  50. AVRational dest_time_base; ///< timebase of destination
  51. av_pixelutils_sad_fn sad; ///< Sum of the absolute difference function (scene detect only)
  52. double prev_mafd; ///< previous MAFD (scene detect only)
  53. int max;
  54. int bitdepth;
  55. AVFrame *work;
  56. AVFrame *f0; ///< last frame
  57. AVFrame *f1; ///< current frame
  58. int64_t pts0; ///< last frame pts in dest_time_base
  59. int64_t pts1; ///< current frame pts in dest_time_base
  60. int64_t delta; ///< pts1 to pts0 delta
  61. double score; ///< scene change score (f0 to f1)
  62. int flush; ///< 1 if the filter is being flushed
  63. int64_t start_pts; ///< pts of the first output frame
  64. int64_t n; ///< output frame counter
  65. } FrameRateContext;
  66. #define OFFSET(x) offsetof(FrameRateContext, x)
  67. #define V AV_OPT_FLAG_VIDEO_PARAM
  68. #define F AV_OPT_FLAG_FILTERING_PARAM
  69. #define FRAMERATE_FLAG_SCD 01
  70. static const AVOption framerate_options[] = {
  71. {"fps", "required output frames per second rate", OFFSET(dest_frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="50"}, 0, INT_MAX, V|F },
  72. {"interp_start", "point to start linear interpolation", OFFSET(interp_start_param),AV_OPT_TYPE_INT, {.i64=15}, 0, 255, V|F },
  73. {"interp_end", "point to end linear interpolation", OFFSET(interp_end_param), AV_OPT_TYPE_INT, {.i64=240}, 0, 255, V|F },
  74. {"scene", "scene change level", OFFSET(scene_score), AV_OPT_TYPE_DOUBLE, {.dbl=8.2}, 0, INT_MAX, V|F },
  75. {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, "flags" },
  76. {"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, "flags" },
  77. {"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, "flags" },
  78. {NULL}
  79. };
  80. AVFILTER_DEFINE_CLASS(framerate);
  81. static av_always_inline int64_t sad_8x8_16(const uint16_t *src1, ptrdiff_t stride1,
  82. const uint16_t *src2, ptrdiff_t stride2)
  83. {
  84. int sum = 0;
  85. int x, y;
  86. for (y = 0; y < 8; y++) {
  87. for (x = 0; x < 8; x++)
  88. sum += FFABS(src1[x] - src2[x]);
  89. src1 += stride1;
  90. src2 += stride2;
  91. }
  92. return sum;
  93. }
  94. static int64_t scene_sad16(FrameRateContext *s, const uint16_t *p1, int p1_linesize, const uint16_t* p2, int p2_linesize, const int width, const int height)
  95. {
  96. int64_t sad;
  97. int x, y;
  98. for (sad = y = 0; y < height - 7; y += 8) {
  99. for (x = 0; x < width - 7; x += 8) {
  100. sad += sad_8x8_16(p1 + y * p1_linesize + x,
  101. p1_linesize,
  102. p2 + y * p2_linesize + x,
  103. p2_linesize);
  104. }
  105. }
  106. return sad;
  107. }
  108. static int64_t scene_sad8(FrameRateContext *s, uint8_t *p1, int p1_linesize, uint8_t* p2, int p2_linesize, const int width, const int height)
  109. {
  110. int64_t sad;
  111. int x, y;
  112. for (sad = y = 0; y < height - 7; y += 8) {
  113. for (x = 0; x < width - 7; x += 8) {
  114. sad += s->sad(p1 + y * p1_linesize + x,
  115. p1_linesize,
  116. p2 + y * p2_linesize + x,
  117. p2_linesize);
  118. }
  119. }
  120. emms_c();
  121. return sad;
  122. }
  123. static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
  124. {
  125. FrameRateContext *s = ctx->priv;
  126. double ret = 0;
  127. ff_dlog(ctx, "get_scene_score()\n");
  128. if (crnt->height == next->height &&
  129. crnt->width == next->width) {
  130. int64_t sad;
  131. double mafd, diff;
  132. ff_dlog(ctx, "get_scene_score() process\n");
  133. if (s->bitdepth == 8)
  134. sad = scene_sad8(s, crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height);
  135. else
  136. sad = scene_sad16(s, (const uint16_t*)crnt->data[0], crnt->linesize[0] / 2, (const uint16_t*)next->data[0], next->linesize[0] / 2, crnt->width, crnt->height);
  137. mafd = (double)sad * 100.0 / FFMAX(1, (crnt->height & ~7) * (crnt->width & ~7)) / (1 << s->bitdepth);
  138. diff = fabs(mafd - s->prev_mafd);
  139. ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
  140. s->prev_mafd = mafd;
  141. }
  142. ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);
  143. return ret;
  144. }
  145. typedef struct ThreadData {
  146. AVFrame *copy_src1, *copy_src2;
  147. uint16_t src1_factor, src2_factor;
  148. } ThreadData;
  149. static int filter_slice8(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
  150. {
  151. FrameRateContext *s = ctx->priv;
  152. ThreadData *td = arg;
  153. uint16_t src1_factor = td->src1_factor;
  154. uint16_t src2_factor = td->src2_factor;
  155. int plane, line, pixel;
  156. for (plane = 0; plane < 4 && td->copy_src1->data[plane] && td->copy_src2->data[plane]; plane++) {
  157. int cpy_line_width = s->line_size[plane];
  158. uint8_t *cpy_src1_data = td->copy_src1->data[plane];
  159. int cpy_src1_line_size = td->copy_src1->linesize[plane];
  160. uint8_t *cpy_src2_data = td->copy_src2->data[plane];
  161. int cpy_src2_line_size = td->copy_src2->linesize[plane];
  162. int cpy_src_h = (plane > 0 && plane < 3) ? (td->copy_src1->height >> s->vsub) : (td->copy_src1->height);
  163. uint8_t *cpy_dst_data = s->work->data[plane];
  164. int cpy_dst_line_size = s->work->linesize[plane];
  165. const int start = (cpy_src_h * job ) / nb_jobs;
  166. const int end = (cpy_src_h * (job+1)) / nb_jobs;
  167. cpy_src1_data += start * cpy_src1_line_size;
  168. cpy_src2_data += start * cpy_src2_line_size;
  169. cpy_dst_data += start * cpy_dst_line_size;
  170. if (plane <1 || plane >2) {
  171. // luma or alpha
  172. for (line = start; line < end; line++) {
  173. for (pixel = 0; pixel < cpy_line_width; pixel++) {
  174. // integer version of (src1 * src1_factor) + (src2 + src2_factor) + 0.5
  175. // 0.5 is for rounding
  176. // 128 is the integer representation of 0.5 << 8
  177. cpy_dst_data[pixel] = ((cpy_src1_data[pixel] * src1_factor) + (cpy_src2_data[pixel] * src2_factor) + 128) >> 8;
  178. }
  179. cpy_src1_data += cpy_src1_line_size;
  180. cpy_src2_data += cpy_src2_line_size;
  181. cpy_dst_data += cpy_dst_line_size;
  182. }
  183. } else {
  184. // chroma
  185. for (line = start; line < end; line++) {
  186. for (pixel = 0; pixel < cpy_line_width; pixel++) {
  187. // as above
  188. // because U and V are based around 128 we have to subtract 128 from the components.
  189. // 32896 is the integer representation of 128.5 << 8
  190. cpy_dst_data[pixel] = (((cpy_src1_data[pixel] - 128) * src1_factor) + ((cpy_src2_data[pixel] - 128) * src2_factor) + 32896) >> 8;
  191. }
  192. cpy_src1_data += cpy_src1_line_size;
  193. cpy_src2_data += cpy_src2_line_size;
  194. cpy_dst_data += cpy_dst_line_size;
  195. }
  196. }
  197. }
  198. return 0;
  199. }
  200. static int filter_slice16(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
  201. {
  202. FrameRateContext *s = ctx->priv;
  203. ThreadData *td = arg;
  204. uint16_t src1_factor = td->src1_factor;
  205. uint16_t src2_factor = td->src2_factor;
  206. const int half = s->max / 2;
  207. const int uv = (s->max + 1) * half;
  208. const int shift = s->bitdepth;
  209. int plane, line, pixel;
  210. for (plane = 0; plane < 4 && td->copy_src1->data[plane] && td->copy_src2->data[plane]; plane++) {
  211. int cpy_line_width = s->line_size[plane];
  212. const uint16_t *cpy_src1_data = (const uint16_t *)td->copy_src1->data[plane];
  213. int cpy_src1_line_size = td->copy_src1->linesize[plane] / 2;
  214. const uint16_t *cpy_src2_data = (const uint16_t *)td->copy_src2->data[plane];
  215. int cpy_src2_line_size = td->copy_src2->linesize[plane] / 2;
  216. int cpy_src_h = (plane > 0 && plane < 3) ? (td->copy_src1->height >> s->vsub) : (td->copy_src1->height);
  217. uint16_t *cpy_dst_data = (uint16_t *)s->work->data[plane];
  218. int cpy_dst_line_size = s->work->linesize[plane] / 2;
  219. const int start = (cpy_src_h * job ) / nb_jobs;
  220. const int end = (cpy_src_h * (job+1)) / nb_jobs;
  221. cpy_src1_data += start * cpy_src1_line_size;
  222. cpy_src2_data += start * cpy_src2_line_size;
  223. cpy_dst_data += start * cpy_dst_line_size;
  224. if (plane <1 || plane >2) {
  225. // luma or alpha
  226. for (line = start; line < end; line++) {
  227. for (pixel = 0; pixel < cpy_line_width; pixel++)
  228. cpy_dst_data[pixel] = ((cpy_src1_data[pixel] * src1_factor) + (cpy_src2_data[pixel] * src2_factor) + half) >> shift;
  229. cpy_src1_data += cpy_src1_line_size;
  230. cpy_src2_data += cpy_src2_line_size;
  231. cpy_dst_data += cpy_dst_line_size;
  232. }
  233. } else {
  234. // chroma
  235. for (line = start; line < end; line++) {
  236. for (pixel = 0; pixel < cpy_line_width; pixel++) {
  237. cpy_dst_data[pixel] = (((cpy_src1_data[pixel] - half) * src1_factor) + ((cpy_src2_data[pixel] - half) * src2_factor) + uv) >> shift;
  238. }
  239. cpy_src1_data += cpy_src1_line_size;
  240. cpy_src2_data += cpy_src2_line_size;
  241. cpy_dst_data += cpy_dst_line_size;
  242. }
  243. }
  244. }
  245. return 0;
  246. }
  247. static int blend_frames(AVFilterContext *ctx, int interpolate)
  248. {
  249. FrameRateContext *s = ctx->priv;
  250. AVFilterLink *outlink = ctx->outputs[0];
  251. double interpolate_scene_score = 0;
  252. if ((s->flags & FRAMERATE_FLAG_SCD)) {
  253. if (s->score >= 0.0)
  254. interpolate_scene_score = s->score;
  255. else
  256. interpolate_scene_score = s->score = get_scene_score(ctx, s->f0, s->f1);
  257. ff_dlog(ctx, "blend_frames() interpolate scene score:%f\n", interpolate_scene_score);
  258. }
  259. // decide if the shot-change detection allows us to blend two frames
  260. if (interpolate_scene_score < s->scene_score) {
  261. ThreadData td;
  262. td.copy_src1 = s->f0;
  263. td.copy_src2 = s->f1;
  264. td.src2_factor = interpolate;
  265. td.src1_factor = s->max - td.src2_factor;
  266. // get work-space for output frame
  267. s->work = ff_get_video_buffer(outlink, outlink->w, outlink->h);
  268. if (!s->work)
  269. return AVERROR(ENOMEM);
  270. av_frame_copy_props(s->work, s->f0);
  271. ff_dlog(ctx, "blend_frames() INTERPOLATE to create work frame\n");
  272. ctx->internal->execute(ctx, s->bitdepth == 8 ? filter_slice8 : filter_slice16, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
  273. return 1;
  274. }
  275. return 0;
  276. }
  277. static int process_work_frame(AVFilterContext *ctx)
  278. {
  279. FrameRateContext *s = ctx->priv;
  280. int64_t work_pts;
  281. int interpolate;
  282. int ret;
  283. if (!s->f1)
  284. return 0;
  285. if (!s->f0 && !s->flush)
  286. return 0;
  287. work_pts = s->start_pts + av_rescale_q(s->n, av_inv_q(s->dest_frame_rate), s->dest_time_base);
  288. if (work_pts >= s->pts1 && !s->flush)
  289. return 0;
  290. if (!s->f0) {
  291. s->work = av_frame_clone(s->f1);
  292. } else {
  293. if (work_pts >= s->pts1 + s->delta && s->flush)
  294. return 0;
  295. interpolate = av_rescale(work_pts - s->pts0, s->max, s->delta);
  296. ff_dlog(ctx, "process_work_frame() interpolate:%d/%d\n", interpolate, s->max);
  297. if (interpolate > s->interp_end) {
  298. s->work = av_frame_clone(s->f1);
  299. } else if (interpolate < s->interp_start) {
  300. s->work = av_frame_clone(s->f0);
  301. } else {
  302. ret = blend_frames(ctx, interpolate);
  303. if (ret < 0)
  304. return ret;
  305. if (ret == 0)
  306. s->work = av_frame_clone(interpolate > (s->max >> 1) ? s->f1 : s->f0);
  307. }
  308. }
  309. if (!s->work)
  310. return AVERROR(ENOMEM);
  311. s->work->pts = work_pts;
  312. s->n++;
  313. return 1;
  314. }
  315. static av_cold int init(AVFilterContext *ctx)
  316. {
  317. FrameRateContext *s = ctx->priv;
  318. s->start_pts = AV_NOPTS_VALUE;
  319. return 0;
  320. }
  321. static av_cold void uninit(AVFilterContext *ctx)
  322. {
  323. FrameRateContext *s = ctx->priv;
  324. av_frame_free(&s->f0);
  325. av_frame_free(&s->f1);
  326. }
  327. static int query_formats(AVFilterContext *ctx)
  328. {
  329. static const enum AVPixelFormat pix_fmts[] = {
  330. AV_PIX_FMT_YUV410P,
  331. AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUVJ411P,
  332. AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P,
  333. AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P,
  334. AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
  335. AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
  336. AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12,
  337. AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12,
  338. AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12,
  339. AV_PIX_FMT_NONE
  340. };
  341. AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
  342. if (!fmts_list)
  343. return AVERROR(ENOMEM);
  344. return ff_set_common_formats(ctx, fmts_list);
  345. }
  346. static int config_input(AVFilterLink *inlink)
  347. {
  348. AVFilterContext *ctx = inlink->dst;
  349. FrameRateContext *s = ctx->priv;
  350. const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
  351. int plane;
  352. for (plane = 0; plane < 4; plane++) {
  353. s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w,
  354. plane);
  355. }
  356. s->bitdepth = pix_desc->comp[0].depth;
  357. s->vsub = pix_desc->log2_chroma_h;
  358. s->interp_start = s->interp_start_param << (s->bitdepth - 8);
  359. s->interp_end = s->interp_end_param << (s->bitdepth - 8);
  360. s->sad = av_pixelutils_get_sad_fn(3, 3, 2, s); // 8x8 both sources aligned
  361. if (!s->sad)
  362. return AVERROR(EINVAL);
  363. s->srce_time_base = inlink->time_base;
  364. s->max = 1 << (s->bitdepth);
  365. return 0;
  366. }
  367. static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
  368. {
  369. int ret;
  370. AVFilterContext *ctx = inlink->dst;
  371. FrameRateContext *s = ctx->priv;
  372. int64_t pts;
  373. if (inpicref->interlaced_frame)
  374. av_log(ctx, AV_LOG_WARNING, "Interlaced frame found - the output will not be correct.\n");
  375. if (inpicref->pts == AV_NOPTS_VALUE) {
  376. av_log(ctx, AV_LOG_WARNING, "Ignoring frame without PTS.\n");
  377. return 0;
  378. }
  379. pts = av_rescale_q(inpicref->pts, s->srce_time_base, s->dest_time_base);
  380. if (s->f1 && pts == s->pts1) {
  381. av_log(ctx, AV_LOG_WARNING, "Ignoring frame with same PTS.\n");
  382. return 0;
  383. }
  384. av_frame_free(&s->f0);
  385. s->f0 = s->f1;
  386. s->pts0 = s->pts1;
  387. s->f1 = inpicref;
  388. s->pts1 = pts;
  389. s->delta = s->pts1 - s->pts0;
  390. s->score = -1.0;
  391. if (s->delta < 0) {
  392. av_log(ctx, AV_LOG_WARNING, "PTS discontinuity.\n");
  393. s->start_pts = s->pts1;
  394. s->n = 0;
  395. av_frame_free(&s->f0);
  396. }
  397. if (s->start_pts == AV_NOPTS_VALUE)
  398. s->start_pts = s->pts1;
  399. do {
  400. ret = process_work_frame(ctx);
  401. if (ret <= 0)
  402. return ret;
  403. ret = ff_filter_frame(ctx->outputs[0], s->work);
  404. } while (ret >= 0);
  405. return ret;
  406. }
  407. static int config_output(AVFilterLink *outlink)
  408. {
  409. AVFilterContext *ctx = outlink->src;
  410. FrameRateContext *s = ctx->priv;
  411. int exact;
  412. ff_dlog(ctx, "config_output()\n");
  413. ff_dlog(ctx,
  414. "config_output() input time base:%u/%u (%f)\n",
  415. ctx->inputs[0]->time_base.num,ctx->inputs[0]->time_base.den,
  416. av_q2d(ctx->inputs[0]->time_base));
  417. // make sure timebase is small enough to hold the framerate
  418. exact = av_reduce(&s->dest_time_base.num, &s->dest_time_base.den,
  419. av_gcd((int64_t)s->srce_time_base.num * s->dest_frame_rate.num,
  420. (int64_t)s->srce_time_base.den * s->dest_frame_rate.den ),
  421. (int64_t)s->srce_time_base.den * s->dest_frame_rate.num, INT_MAX);
  422. av_log(ctx, AV_LOG_INFO,
  423. "time base:%u/%u -> %u/%u exact:%d\n",
  424. s->srce_time_base.num, s->srce_time_base.den,
  425. s->dest_time_base.num, s->dest_time_base.den, exact);
  426. if (!exact) {
  427. av_log(ctx, AV_LOG_WARNING, "Timebase conversion is not exact\n");
  428. }
  429. outlink->frame_rate = s->dest_frame_rate;
  430. outlink->time_base = s->dest_time_base;
  431. ff_dlog(ctx,
  432. "config_output() output time base:%u/%u (%f) w:%d h:%d\n",
  433. outlink->time_base.num, outlink->time_base.den,
  434. av_q2d(outlink->time_base),
  435. outlink->w, outlink->h);
  436. av_log(ctx, AV_LOG_INFO, "fps -> fps:%u/%u scene score:%f interpolate start:%d end:%d\n",
  437. s->dest_frame_rate.num, s->dest_frame_rate.den,
  438. s->scene_score, s->interp_start, s->interp_end);
  439. return 0;
  440. }
  441. static int request_frame(AVFilterLink *outlink)
  442. {
  443. AVFilterContext *ctx = outlink->src;
  444. FrameRateContext *s = ctx->priv;
  445. int ret;
  446. ff_dlog(ctx, "request_frame()\n");
  447. ret = ff_request_frame(ctx->inputs[0]);
  448. if (ret == AVERROR_EOF && s->f1 && !s->flush) {
  449. s->flush = 1;
  450. ret = process_work_frame(ctx);
  451. if (ret < 0)
  452. return ret;
  453. ret = ret ? ff_filter_frame(ctx->outputs[0], s->work) : AVERROR_EOF;
  454. }
  455. ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", ret);
  456. return ret;
  457. }
  458. static const AVFilterPad framerate_inputs[] = {
  459. {
  460. .name = "default",
  461. .type = AVMEDIA_TYPE_VIDEO,
  462. .config_props = config_input,
  463. .filter_frame = filter_frame,
  464. },
  465. { NULL }
  466. };
  467. static const AVFilterPad framerate_outputs[] = {
  468. {
  469. .name = "default",
  470. .type = AVMEDIA_TYPE_VIDEO,
  471. .request_frame = request_frame,
  472. .config_props = config_output,
  473. },
  474. { NULL }
  475. };
  476. AVFilter ff_vf_framerate = {
  477. .name = "framerate",
  478. .description = NULL_IF_CONFIG_SMALL("Upsamples or downsamples progressive source between specified frame rates."),
  479. .priv_size = sizeof(FrameRateContext),
  480. .priv_class = &framerate_class,
  481. .init = init,
  482. .uninit = uninit,
  483. .query_formats = query_formats,
  484. .inputs = framerate_inputs,
  485. .outputs = framerate_outputs,
  486. .flags = AVFILTER_FLAG_SLICE_THREADS,
  487. };