FFmpeg
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 "internal.h"
39 #include "video.h"
40 #include "filters.h"
41 #include "framerate.h"
42 #include "scene_sad.h"
43 
44 #define OFFSET(x) offsetof(FrameRateContext, x)
45 #define V AV_OPT_FLAG_VIDEO_PARAM
46 #define F AV_OPT_FLAG_FILTERING_PARAM
47 #define FRAMERATE_FLAG_SCD 01
48 
49 static const AVOption framerate_options[] = {
50  {"fps", "required output frames per second rate", OFFSET(dest_frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="50"}, 0, INT_MAX, V|F },
51 
52  {"interp_start", "point to start linear interpolation", OFFSET(interp_start), AV_OPT_TYPE_INT, {.i64=15}, 0, 255, V|F },
53  {"interp_end", "point to end linear interpolation", OFFSET(interp_end), AV_OPT_TYPE_INT, {.i64=240}, 0, 255, V|F },
54  {"scene", "scene change level", OFFSET(scene_score), AV_OPT_TYPE_DOUBLE, {.dbl=8.2}, 0, 100., V|F },
55 
56  {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, .unit = "flags" },
57  {"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
58  {"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
59 
60  {NULL}
61 };
62 
64 
65 static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
66 {
67  FrameRateContext *s = ctx->priv;
68  double ret = 0;
69 
70  ff_dlog(ctx, "get_scene_score()\n");
71 
72  if (crnt->height == next->height &&
73  crnt->width == next->width) {
74  uint64_t sad;
75  double mafd, diff;
76 
77  ff_dlog(ctx, "get_scene_score() process\n");
78  s->sad(crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height, &sad);
79  mafd = (double)sad * 100.0 / (crnt->width * crnt->height) / (1 << s->bitdepth);
80  diff = fabs(mafd - s->prev_mafd);
81  ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
82  s->prev_mafd = mafd;
83  }
84  ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);
85  return ret;
86 }
87 
88 typedef struct ThreadData {
91 } ThreadData;
92 
93 static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
94 {
95  FrameRateContext *s = ctx->priv;
96  ThreadData *td = arg;
97  AVFrame *work = s->work;
98  AVFrame *src1 = td->copy_src1;
99  AVFrame *src2 = td->copy_src2;
100  uint16_t src1_factor = td->src1_factor;
101  uint16_t src2_factor = td->src2_factor;
102  int plane;
103 
104  for (plane = 0; plane < 4 && src1->data[plane] && src2->data[plane]; plane++) {
105  const int start = (s->height[plane] * job ) / nb_jobs;
106  const int end = (s->height[plane] * (job+1)) / nb_jobs;
107  uint8_t *src1_data = src1->data[plane] + start * src1->linesize[plane];
108  uint8_t *src2_data = src2->data[plane] + start * src2->linesize[plane];
109  uint8_t *dst_data = work->data[plane] + start * work->linesize[plane];
110 
111  s->blend(src1_data, src1->linesize[plane], src2_data, src2->linesize[plane],
112  dst_data, work->linesize[plane], s->line_size[plane], end - start,
113  src1_factor, src2_factor, s->blend_factor_max >> 1);
114  }
115 
116  return 0;
117 }
118 
120 {
121  FrameRateContext *s = ctx->priv;
122  AVFilterLink *outlink = ctx->outputs[0];
123  double interpolate_scene_score = 0;
124 
125  if ((s->flags & FRAMERATE_FLAG_SCD)) {
126  if (s->score >= 0.0)
127  interpolate_scene_score = s->score;
128  else
129  interpolate_scene_score = s->score = get_scene_score(ctx, s->f0, s->f1);
130  ff_dlog(ctx, "blend_frames() interpolate scene score:%f\n", interpolate_scene_score);
131  }
132  // decide if the shot-change detection allows us to blend two frames
133  if (interpolate_scene_score < s->scene_score) {
134  ThreadData td;
135  td.copy_src1 = s->f0;
136  td.copy_src2 = s->f1;
137  td.src2_factor = interpolate;
138  td.src1_factor = s->blend_factor_max - td.src2_factor;
139 
140  // get work-space for output frame
141  s->work = ff_get_video_buffer(outlink, outlink->w, outlink->h);
142  if (!s->work)
143  return AVERROR(ENOMEM);
144 
145  av_frame_copy_props(s->work, s->f0);
146 
147  ff_dlog(ctx, "blend_frames() INTERPOLATE to create work frame\n");
149  FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx)));
150  return 1;
151  }
152  return 0;
153 }
154 
156 {
157  FrameRateContext *s = ctx->priv;
158  int64_t work_pts;
159  int64_t interpolate, interpolate8;
160  int ret;
161 
162  if (!s->f1)
163  return 0;
164  if (!s->f0 && !s->flush)
165  return 0;
166 
167  work_pts = s->start_pts + av_rescale_q(s->n, av_inv_q(s->dest_frame_rate), s->dest_time_base);
168 
169  if (work_pts >= s->pts1 && !s->flush)
170  return 0;
171 
172  if (!s->f0) {
173  av_assert1(s->flush);
174  s->work = s->f1;
175  s->f1 = NULL;
176  } else {
177  if (work_pts >= s->pts1 + s->delta && s->flush)
178  return 0;
179 
180  interpolate = av_rescale(work_pts - s->pts0, s->blend_factor_max, s->delta);
181  interpolate8 = av_rescale(work_pts - s->pts0, 256, s->delta);
182  ff_dlog(ctx, "process_work_frame() interpolate: %"PRId64"/256\n", interpolate8);
183  if (interpolate >= s->blend_factor_max || interpolate8 > s->interp_end) {
184  s->work = av_frame_clone(s->f1);
185  } else if (interpolate <= 0 || interpolate8 < s->interp_start) {
186  s->work = av_frame_clone(s->f0);
187  } else {
189  if (ret < 0)
190  return ret;
191  if (ret == 0)
192  s->work = av_frame_clone(interpolate > (s->blend_factor_max >> 1) ? s->f1 : s->f0);
193  }
194  }
195 
196  if (!s->work)
197  return AVERROR(ENOMEM);
198 
199  s->work->pts = work_pts;
200  s->n++;
201 
202  return 1;
203 }
204 
206 {
207  FrameRateContext *s = ctx->priv;
208  s->start_pts = AV_NOPTS_VALUE;
209  return 0;
210 }
211 
213 {
214  FrameRateContext *s = ctx->priv;
215  av_frame_free(&s->f0);
216  av_frame_free(&s->f1);
217 }
218 
219 static const enum AVPixelFormat pix_fmts[] = {
230 };
231 
232 #define BLEND_FRAME_FUNC(nbits) \
233 static void blend_frames##nbits##_c(BLEND_FUNC_PARAMS) \
234 { \
235  int line, pixel; \
236  uint##nbits##_t *dstw = (uint##nbits##_t *)dst; \
237  uint##nbits##_t *src1w = (uint##nbits##_t *)src1; \
238  uint##nbits##_t *src2w = (uint##nbits##_t *)src2; \
239  int bytes = nbits / 8; \
240  width /= bytes; \
241  src1_linesize /= bytes; \
242  src2_linesize /= bytes; \
243  dst_linesize /= bytes; \
244  for (line = 0; line < height; line++) { \
245  for (pixel = 0; pixel < width; pixel++) \
246  dstw[pixel] = ((src1w[pixel] * factor1) + \
247  (src2w[pixel] * factor2) + half) \
248  >> BLEND_FACTOR_DEPTH(nbits); \
249  src1w += src1_linesize; \
250  src2w += src2_linesize; \
251  dstw += dst_linesize; \
252  } \
253 }
256 
258 {
259  if (s->bitdepth == 8) {
260  s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(8);
261  s->blend = blend_frames8_c;
262  } else {
263  s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(16);
264  s->blend = blend_frames16_c;
265  }
266 #if ARCH_X86
268 #endif
269 }
270 
272 {
273  AVFilterContext *ctx = inlink->dst;
274  FrameRateContext *s = ctx->priv;
275  const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
276  int plane;
277 
278  s->vsub = pix_desc->log2_chroma_h;
279  for (plane = 0; plane < 4; plane++) {
280  s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w, plane);
281  s->height[plane] = inlink->h >> ((plane == 1 || plane == 2) ? s->vsub : 0);
282  }
283 
284  s->bitdepth = pix_desc->comp[0].depth;
285 
286  s->sad = ff_scene_sad_get_fn(s->bitdepth == 8 ? 8 : 16);
287  if (!s->sad)
288  return AVERROR(EINVAL);
289 
290  s->srce_time_base = inlink->time_base;
291 
293 
294  return 0;
295 }
296 
298 {
299  int ret, status;
300  AVFilterLink *inlink = ctx->inputs[0];
301  AVFilterLink *outlink = ctx->outputs[0];
302  FrameRateContext *s = ctx->priv;
303  AVFrame *inpicref;
304  int64_t pts;
305 
307 
308 retry:
310  if (ret < 0)
311  return ret;
312  else if (ret == 1)
313  return ff_filter_frame(outlink, s->work);
314 
315  ret = ff_inlink_consume_frame(inlink, &inpicref);
316  if (ret < 0)
317  return ret;
318 
319  if (inpicref) {
320  if (inpicref->flags & AV_FRAME_FLAG_INTERLACED)
321  av_log(ctx, AV_LOG_WARNING, "Interlaced frame found - the output will not be correct.\n");
322 
323  if (inpicref->pts == AV_NOPTS_VALUE) {
324  av_log(ctx, AV_LOG_WARNING, "Ignoring frame without PTS.\n");
325  av_frame_free(&inpicref);
326  }
327  }
328 
329  if (inpicref) {
330  pts = av_rescale_q(inpicref->pts, s->srce_time_base, s->dest_time_base);
331 
332  if (s->f1 && pts == s->pts1) {
333  av_log(ctx, AV_LOG_WARNING, "Ignoring frame with same PTS.\n");
334  av_frame_free(&inpicref);
335  }
336  }
337 
338  if (inpicref) {
339  av_frame_free(&s->f0);
340  s->f0 = s->f1;
341  s->pts0 = s->pts1;
342  s->f1 = inpicref;
343  s->pts1 = pts;
344  s->delta = s->pts1 - s->pts0;
345  s->score = -1.0;
346 
347  if (s->delta < 0) {
348  av_log(ctx, AV_LOG_WARNING, "PTS discontinuity.\n");
349  s->start_pts = s->pts1;
350  s->n = 0;
351  av_frame_free(&s->f0);
352  }
353 
354  if (s->start_pts == AV_NOPTS_VALUE)
355  s->start_pts = s->pts1;
356 
357  goto retry;
358  }
359 
361  if (!s->flush) {
362  s->flush = 1;
363  goto retry;
364  }
365  ff_outlink_set_status(outlink, status, pts);
366  return 0;
367  }
368 
370 
371  return FFERROR_NOT_READY;
372 }
373 
374 static int config_output(AVFilterLink *outlink)
375 {
376  AVFilterContext *ctx = outlink->src;
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  outlink->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 
419 static const AVFilterPad framerate_inputs[] = {
420  {
421  .name = "default",
422  .type = AVMEDIA_TYPE_VIDEO,
423  .config_props = config_input,
424  },
425 };
426 
427 static const AVFilterPad framerate_outputs[] = {
428  {
429  .name = "default",
430  .type = AVMEDIA_TYPE_VIDEO,
431  .config_props = config_output,
432  },
433 };
434 
436  .name = "framerate",
437  .description = NULL_IF_CONFIG_SMALL("Upsamples or downsamples progressive source between specified frame rates."),
438  .priv_size = sizeof(FrameRateContext),
439  .priv_class = &framerate_class,
440  .init = init,
441  .uninit = uninit,
446  .activate = activate,
447 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:112
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
get_scene_score
static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
Definition: vf_framerate.c:65
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:248
src1
const pixel * src1
Definition: h264pred_template.c:421
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
process_work_frame
static int process_work_frame(AVFilterContext *ctx)
Definition: vf_framerate.c:155
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:486
AVFrame::width
int width
Definition: frame.h:446
framerate.h
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
FrameRateContext
Definition: framerate.h:35
AVOption
AVOption.
Definition: opt.h:346
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
activate
static int activate(AVFilterContext *ctx)
Definition: vf_framerate.c:297
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:646
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(framerate)
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
av_gcd
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition: mathematics.c:37
ff_inlink_consume_frame
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:1442
FRAMERATE_FLAG_SCD
#define FRAMERATE_FLAG_SCD
Definition: vf_framerate.c:47
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
BLEND_FACTOR_DEPTH
#define BLEND_FACTOR_DEPTH(n)
Definition: framerate.h:31
pts
static int64_t pts
Definition: transcode_aac.c:644
av_reduce
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
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
AV_PIX_FMT_YUVJ411P
@ 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
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUVJ422P
@ 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
blend_frames
static int blend_frames(AVFilterContext *ctx, int interpolate)
Definition: vf_framerate.c:119
ff_outlink_set_status
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:189
s
#define s(width, name)
Definition: cbs_vp9.c:198
ThreadData::src1_factor
uint16_t src1_factor
Definition: vf_framerate.c:90
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:237
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
filters.h
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:593
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
AV_PIX_FMT_YUVJ444P
@ 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
arg
const char * arg
Definition: jacosubdec.c:67
ff_scene_sad_get_fn
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
Definition: scene_sad.c:59
framerate
float framerate
Definition: av1_levels.c:29
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
AV_PIX_FMT_YUVJ420P
@ 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
work
must be printed separately If there s no standard function for printing the type you the WRITE_1D_FUNC_ARGV macro is a very quick way to create one See libavcodec dv_tablegen c for an example The h file This file should the initialization functions should not do and instead of the variable declarations the generated *_tables h file should be included Since that will be generated in the build the path must be i e not Makefile changes To make the automatic table creation work
Definition: tablegen.txt:66
double
double
Definition: af_crystalizer.c:131
ff_vf_framerate
const AVFilter ff_vf_framerate
Definition: vf_framerate.c:435
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
av_clipf
av_clipf
Definition: af_crystalizer.c:121
BLEND_FRAME_FUNC
#define BLEND_FRAME_FUNC(nbits)
Definition: vf_framerate.c:232
ff_inlink_acknowledge_status
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:1389
scene_sad.h
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:28
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_framerate.c:205
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_framerate.c:219
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
ThreadData::copy_src1
AVFrame * copy_src1
Definition: vf_framerate.c:89
filter_slice
static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
Definition: vf_framerate.c:93
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:165
F
#define F
Definition: vf_framerate.c:46
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
interpolate
static void interpolate(float *out, float v1, float v2, int size)
Definition: twinvq.c:85
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
internal.h
av_image_get_linesize
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
framerate_outputs
static const AVFilterPad framerate_outputs[]
Definition: vf_framerate.c:427
internal.h
src2
const pixel * src2
Definition: h264pred_template.c:422
ff_framerate_init
void ff_framerate_init(FrameRateContext *s)
Definition: vf_framerate.c:257
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:827
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_PIX_FMT_YUVJ440P
@ 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_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
AV_FRAME_FLAG_INTERLACED
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition: frame.h:633
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_framerate.c:271
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
ThreadData::src2_factor
uint16_t src2_factor
Definition: vf_framerate.c:90
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AVFrame::height
int height
Definition: frame.h:446
status
ov_status_e status
Definition: dnn_backend_openvino.c:121
V
#define V
Definition: vf_framerate.c:45
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
avfilter.h
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
framerate_inputs
static const AVFilterPad framerate_inputs[]
Definition: vf_framerate.c:419
OFFSET
#define OFFSET(x)
Definition: vf_framerate.c:44
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_framerate.c:212
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
ff_framerate_init_x86
void ff_framerate_init_x86(FrameRateContext *s)
Definition: vf_framerate_init.c:28
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:234
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
ThreadData::copy_src2
AVFrame * copy_src2
Definition: vf_framerate.c:89
AVFrame::linesize
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:419
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
framerate_options
static const AVOption framerate_options[]
Definition: vf_framerate.c:49
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:134
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_framerate.c:374
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89