FFmpeg
Loading...
Searching...
No Matches
vf_framerate.c
Go to the documentation of this file.
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/**
25 * @file
26 * filter for upsampling or downsampling a progressive source
27 */
28
29#define DEBUG
30
31#include "libavutil/avassert.h"
32#include "libavutil/imgutils.h"
33#include "libavutil/internal.h"
34#include "libavutil/opt.h"
35#include "libavutil/pixdesc.h"
36
37#include "avfilter.h"
38#include "video.h"
39#include "filters.h"
40#include "framerate.h"
41#include "scene_sad.h"
42
43#define OFFSET(x) offsetof(FrameRateContext, x)
44#define V AV_OPT_FLAG_VIDEO_PARAM
45#define F AV_OPT_FLAG_FILTERING_PARAM
46#define FRAMERATE_FLAG_SCD 01
47
48static const AVOption framerate_options[] = {
49 {"fps", "required output frames per second rate", OFFSET(dest_frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="50"}, 0, INT_MAX, V|F },
50
51 {"interp_start", "point to start linear interpolation", OFFSET(interp_start), AV_OPT_TYPE_INT, {.i64=15}, 0, 255, V|F },
52 {"interp_end", "point to end linear interpolation", OFFSET(interp_end), AV_OPT_TYPE_INT, {.i64=240}, 0, 255, V|F },
53 {"scene", "scene change level", OFFSET(scene_score), AV_OPT_TYPE_DOUBLE, {.dbl=8.2}, 0, 100., V|F },
54
55 {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, .unit = "flags" },
56 {"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
57 {"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
58
59 {NULL}
60};
61
63
64static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
65{
66 FrameRateContext *s = ctx->priv;
67 double ret = 0;
68
69 ff_dlog(ctx, "get_scene_score()\n");
70
71 if (crnt->height == next->height &&
72 crnt->width == next->width) {
73 uint64_t sad;
74 double mafd, diff;
75
76 ff_dlog(ctx, "get_scene_score() process\n");
77 s->sad(crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height, &sad);
78 mafd = (double)sad * 100.0 / (crnt->width * crnt->height) / (1 << s->bitdepth);
79 diff = fabs(mafd - s->prev_mafd);
80 ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
81 s->prev_mafd = mafd;
82 }
83 ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);
84 return ret;
85}
86
87typedef struct ThreadData {
91
92static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
93{
94 FrameRateContext *s = ctx->priv;
95 ThreadData *td = arg;
96 AVFrame *work = s->work;
97 AVFrame *src1 = td->copy_src1;
98 AVFrame *src2 = td->copy_src2;
99 uint16_t src1_factor = td->src1_factor;
100 uint16_t src2_factor = td->src2_factor;
101 int plane;
102
103 for (plane = 0; plane < 4 && src1->data[plane] && src2->data[plane]; plane++) {
104 const int start = (s->height[plane] * job ) / nb_jobs;
105 const int end = (s->height[plane] * (job+1)) / nb_jobs;
106 uint8_t *src1_data = src1->data[plane] + start * src1->linesize[plane];
107 uint8_t *src2_data = src2->data[plane] + start * src2->linesize[plane];
108 uint8_t *dst_data = work->data[plane] + start * work->linesize[plane];
109
110 s->blend(src1_data, src1->linesize[plane], src2_data, src2->linesize[plane],
111 dst_data, work->linesize[plane], s->line_size[plane], end - start,
112 src1_factor, src2_factor, s->blend_factor_max >> 1);
113 }
114
115 return 0;
116}
117
119{
120 FrameRateContext *s = ctx->priv;
121 AVFilterLink *outlink = ctx->outputs[0];
122 double interpolate_scene_score = 0;
123
124 if ((s->flags & FRAMERATE_FLAG_SCD)) {
125 if (s->score >= 0.0)
126 interpolate_scene_score = s->score;
127 else
128 interpolate_scene_score = s->score = get_scene_score(ctx, s->f0, s->f1);
129 ff_dlog(ctx, "blend_frames() interpolate scene score:%f\n", interpolate_scene_score);
130 }
131 // decide if the shot-change detection allows us to blend two frames
132 if (interpolate_scene_score < s->scene_score) {
133 ThreadData td;
134 td.copy_src1 = s->f0;
135 td.copy_src2 = s->f1;
137 td.src1_factor = s->blend_factor_max - td.src2_factor;
138
139 // get work-space for output frame
140 s->work = ff_get_video_buffer(outlink, outlink->w, outlink->h);
141 if (!s->work)
142 return AVERROR(ENOMEM);
143
144 av_frame_copy_props(s->work, s->f0);
145
146 ff_dlog(ctx, "blend_frames() INTERPOLATE to create work frame\n");
148 FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx)));
149 return 1;
150 }
151 return 0;
152}
153
155{
156 FrameRateContext *s = ctx->priv;
157 int64_t work_pts;
158 int64_t interpolate, interpolate8;
159 int ret;
160
161 if (!s->f1)
162 return 0;
163 if (!s->f0 && !s->flush)
164 return 0;
165
166 work_pts = s->start_pts + av_rescale_q(s->n, av_inv_q(s->dest_frame_rate), s->dest_time_base);
167
168 if (work_pts >= s->pts1 && !s->flush)
169 return 0;
170
171 if (!s->f0) {
172 av_assert1(s->flush);
173 s->work = s->f1;
174 s->f1 = NULL;
175 } else {
176 if (work_pts >= s->pts1 + s->delta && s->flush)
177 return 0;
178
179 interpolate = av_rescale(work_pts - s->pts0, s->blend_factor_max, s->delta);
180 interpolate8 = av_rescale(work_pts - s->pts0, 256, s->delta);
181 ff_dlog(ctx, "process_work_frame() interpolate: %"PRId64"/256\n", interpolate8);
182 if (interpolate >= s->blend_factor_max || interpolate8 > s->interp_end) {
183 s->work = av_frame_clone(s->f1);
184 } else if (interpolate <= 0 || interpolate8 < s->interp_start) {
185 s->work = av_frame_clone(s->f0);
186 } else {
188 if (ret < 0)
189 return ret;
190 if (ret == 0)
191 s->work = av_frame_clone(interpolate > (s->blend_factor_max >> 1) ? s->f1 : s->f0);
192 }
193 }
194
195 if (!s->work)
196 return AVERROR(ENOMEM);
197
198 s->work->pts = work_pts;
199 s->n++;
200
201 return 1;
202}
203
205{
206 FrameRateContext *s = ctx->priv;
207 s->start_pts = AV_NOPTS_VALUE;
208 return 0;
209}
210
212{
213 FrameRateContext *s = ctx->priv;
214 av_frame_free(&s->f0);
215 av_frame_free(&s->f1);
216}
217
230
231#define BLEND_FRAME_FUNC(nbits) \
232static void blend_frames##nbits##_c(BLEND_FUNC_PARAMS) \
233{ \
234 int line, pixel; \
235 uint##nbits##_t *dstw = (uint##nbits##_t *)dst; \
236 uint##nbits##_t *src1w = (uint##nbits##_t *)src1; \
237 uint##nbits##_t *src2w = (uint##nbits##_t *)src2; \
238 int bytes = nbits / 8; \
239 width /= bytes; \
240 src1_linesize /= bytes; \
241 src2_linesize /= bytes; \
242 dst_linesize /= bytes; \
243 for (line = 0; line < height; line++) { \
244 for (pixel = 0; pixel < width; pixel++) \
245 dstw[pixel] = ((src1w[pixel] * factor1) + \
246 (src2w[pixel] * factor2) + half) \
247 >> BLEND_FACTOR_DEPTH(nbits); \
248 src1w += src1_linesize; \
249 src2w += src2_linesize; \
250 dstw += dst_linesize; \
251 } \
252}
255
257{
258 if (s->bitdepth == 8) {
259 s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(8);
260 s->blend = blend_frames8_c;
261 } else {
262 s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(16);
263 s->blend = blend_frames16_c;
264 }
265#if ARCH_X86 && HAVE_X86ASM
267#endif
268}
269
270static int config_input(AVFilterLink *inlink)
271{
272 AVFilterContext *ctx = inlink->dst;
273 FrameRateContext *s = ctx->priv;
274 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
275 int plane;
276
277 s->vsub = pix_desc->log2_chroma_h;
278 for (plane = 0; plane < 4; plane++) {
279 s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w, plane);
280 s->height[plane] = inlink->h >> ((plane == 1 || plane == 2) ? s->vsub : 0);
281 }
282
283 s->bitdepth = pix_desc->comp[0].depth;
284
285 s->sad = ff_scene_sad_get_fn(s->bitdepth);
286 if (!s->sad)
287 return AVERROR(EINVAL);
288
289 s->srce_time_base = inlink->time_base;
290
292
293 return 0;
294}
295
297{
298 int ret, status;
299 AVFilterLink *inlink = ctx->inputs[0];
300 AVFilterLink *outlink = ctx->outputs[0];
301 FrameRateContext *s = ctx->priv;
302 AVFrame *inpicref;
303 int64_t pts;
304
305 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
306
307retry:
308 ret = process_work_frame(ctx);
309 if (ret < 0)
310 return ret;
311 else if (ret == 1)
312 return ff_filter_frame(outlink, s->work);
313
314 ret = ff_inlink_consume_frame(inlink, &inpicref);
315 if (ret < 0)
316 return ret;
317
318 if (inpicref) {
319 if (inpicref->flags & AV_FRAME_FLAG_INTERLACED)
320 av_log(ctx, AV_LOG_WARNING, "Interlaced frame found - the output will not be correct.\n");
321
322 if (inpicref->pts == AV_NOPTS_VALUE) {
323 av_log(ctx, AV_LOG_WARNING, "Ignoring frame without PTS.\n");
324 av_frame_free(&inpicref);
325 }
326 }
327
328 if (inpicref) {
329 pts = av_rescale_q(inpicref->pts, s->srce_time_base, s->dest_time_base);
330
331 if (s->f1 && pts == s->pts1) {
332 av_log(ctx, AV_LOG_WARNING, "Ignoring frame with same PTS.\n");
333 av_frame_free(&inpicref);
334 }
335 }
336
337 if (inpicref) {
338 av_frame_free(&s->f0);
339 s->f0 = s->f1;
340 s->pts0 = s->pts1;
341 s->f1 = inpicref;
342 s->pts1 = pts;
343 s->delta = s->pts1 - s->pts0;
344 s->score = -1.0;
345
346 if (s->delta < 0) {
347 av_log(ctx, AV_LOG_WARNING, "PTS discontinuity.\n");
348 s->start_pts = s->pts1;
349 s->n = 0;
350 av_frame_free(&s->f0);
351 }
352
353 if (s->start_pts == AV_NOPTS_VALUE)
354 s->start_pts = s->pts1;
355
356 goto retry;
357 }
358
359 if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
360 if (!s->flush) {
361 s->flush = 1;
362 goto retry;
363 }
364 ff_outlink_set_status(outlink, status, pts);
365 return 0;
366 }
367
368 FF_FILTER_FORWARD_WANTED(outlink, inlink);
369
370 return FFERROR_NOT_READY;
371}
372
373static int config_output(AVFilterLink *outlink)
374{
375 AVFilterContext *ctx = outlink->src;
376 FilterLink *l = ff_filter_link(outlink);
377 FrameRateContext *s = ctx->priv;
378 int exact;
379
380 ff_dlog(ctx, "config_output()\n");
381
382 ff_dlog(ctx,
383 "config_output() input time base:%u/%u (%f)\n",
384 ctx->inputs[0]->time_base.num,ctx->inputs[0]->time_base.den,
385 av_q2d(ctx->inputs[0]->time_base));
386
387 // make sure timebase is small enough to hold the framerate
388
389 exact = av_reduce(&s->dest_time_base.num, &s->dest_time_base.den,
390 av_gcd((int64_t)s->srce_time_base.num * s->dest_frame_rate.num,
391 (int64_t)s->srce_time_base.den * s->dest_frame_rate.den ),
392 (int64_t)s->srce_time_base.den * s->dest_frame_rate.num, INT_MAX);
393
395 "time base:%u/%u -> %u/%u exact:%d\n",
396 s->srce_time_base.num, s->srce_time_base.den,
397 s->dest_time_base.num, s->dest_time_base.den, exact);
398 if (!exact) {
399 av_log(ctx, AV_LOG_WARNING, "Timebase conversion is not exact\n");
400 }
401
402 l->frame_rate = s->dest_frame_rate;
403 outlink->time_base = s->dest_time_base;
404
405 ff_dlog(ctx,
406 "config_output() output time base:%u/%u (%f) w:%d h:%d\n",
407 outlink->time_base.num, outlink->time_base.den,
408 av_q2d(outlink->time_base),
409 outlink->w, outlink->h);
410
411
412 av_log(ctx, AV_LOG_INFO, "fps -> fps:%u/%u scene score:%f interpolate start:%d end:%d\n",
413 s->dest_frame_rate.num, s->dest_frame_rate.den,
414 s->scene_score, s->interp_start, s->interp_end);
415
416 return 0;
417}
418
420 {
421 .name = "default",
422 .type = AVMEDIA_TYPE_VIDEO,
423 .config_props = config_input,
424 },
425};
426
428 {
429 .name = "default",
430 .type = AVMEDIA_TYPE_VIDEO,
431 .config_props = config_output,
432 },
433};
434
436 .p.name = "framerate",
437 .p.description = NULL_IF_CONFIG_SMALL("Upsamples or downsamples progressive source between specified frame rates."),
438 .p.priv_class = &framerate_class,
440 .priv_size = sizeof(FrameRateContext),
441 .init = init,
442 .uninit = uninit,
446 .activate = activate,
447};
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_framerate
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition avassert.h:58
#define V
Definition avdct.c:32
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition avfilter.c:1696
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition avfilter.c:846
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
Main libavfilter public API header.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define s(width, name)
Definition cbs_vp9.c:198
#define ARCH_X86
#define av_clipf
Definition common.h:145
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static __device__ float fabs(float a)
#define F(x)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
void ff_framerate_init_x86(FrameRateContext *s)
void ff_framerate_init(FrameRateContext *s)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition opt.h:314
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define AVERROR(e)
Definition error.h:45
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition frame.h:695
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_INFO
Standard information.
Definition log.h:221
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition rational.c:35
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition rational.h:159
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition mathematics.c:37
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane.
Definition imgutils.c:76
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
const pixel * src2
misc image utilities
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
const char * arg
Definition jacosubdec.c:65
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition filters.h:694
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition filters.h:639
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
Definition scene_sad.c:59
#define av_cold
Definition attributes.h:117
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV444P9
Definition pixfmt.h:544
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV422P9
Definition pixfmt.h:543
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:542
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition pixfmt.h:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition pixfmt.h:283
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition pixfmt.h:86
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition pixfmt.h:87
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition pixfmt.h:85
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548
Scene SAD functions.
int depth
Number of bits in the component.
Definition pixdesc.h:57
An instance of a filter.
Definition avfilter.h:273
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
int width
Definition frame.h:544
int height
Definition frame.h:544
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition frame.h:716
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:517
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition pixdesc.h:105
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition pixdesc.h:89
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
Used for passing data between threads.
Definition dsddec.c:71
AVFrame * copy_src1
AVFrame * copy_src2
uint16_t src1_factor
uint16_t src2_factor
#define ff_dlog(a,...)
#define av_log(a,...)
float framerate
Definition av1_levels.c:29
#define src1
Definition h264pred.c:141
static AVFormatContext * ctx
Definition movenc.c:49
static int64_t pts
static void interpolate(float *out, float v1, float v2, int size)
Definition twinvq.c:85
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_frames(AVFilterContext *ctx, int interpolate)
#define FRAMERATE_FLAG_SCD
static int process_work_frame(AVFilterContext *ctx)
static const AVOption framerate_options[]
static int config_input(AVFilterLink *inlink)
void ff_framerate_init(FrameRateContext *s)
static const AVFilterPad framerate_outputs[]
static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
static const AVFilterPad framerate_inputs[]
#define OFFSET(x)
static int config_output(AVFilterLink *outlink)
#define BLEND_FRAME_FUNC(nbits)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89