FFmpeg  4.4.5
avf_ahistogram.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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 
21 #include "libavutil/avassert.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/parseutils.h"
24 #include "avfilter.h"
25 #include "filters.h"
26 #include "formats.h"
27 #include "audio.h"
28 #include "video.h"
29 #include "internal.h"
30 
36 
37 typedef struct AudioHistogramContext {
38  const AVClass *class;
40  int w, h;
42  uint64_t *achistogram;
43  uint64_t *shistogram;
44  int ascale;
45  int scale;
46  float phisto;
48  int apos;
49  int ypos;
50  int slide;
51  int dmode;
52  int dchannels;
53  int count;
56  AVFrame *in[101];
57  int first;
60 
61 #define OFFSET(x) offsetof(AudioHistogramContext, x)
62 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
63 
64 static const AVOption ahistogram_options[] = {
65  { "dmode", "set method to display channels", OFFSET(dmode), AV_OPT_TYPE_INT, {.i64=SINGLE}, 0, NB_DMODES-1, FLAGS, "dmode" },
66  { "single", "all channels use single histogram", 0, AV_OPT_TYPE_CONST, {.i64=SINGLE}, 0, 0, FLAGS, "dmode" },
67  { "separate", "each channel have own histogram", 0, AV_OPT_TYPE_CONST, {.i64=SEPARATE}, 0, 0, FLAGS, "dmode" },
68  { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
69  { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
70  { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
71  { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
72  { "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=LOG}, LINEAR, NB_SCALES-1, FLAGS, "scale" },
73  { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, FLAGS, "scale" },
74  { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, FLAGS, "scale" },
75  { "cbrt", "cubic root", 0, AV_OPT_TYPE_CONST, {.i64=CBRT}, 0, 0, FLAGS, "scale" },
76  { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, "scale" },
77  { "rlog", "reverse logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=RLOG}, 0, 0, FLAGS, "scale" },
78  { "ascale", "set amplitude scale", OFFSET(ascale), AV_OPT_TYPE_INT, {.i64=ALOG}, LINEAR, NB_ASCALES-1, FLAGS, "ascale" },
79  { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=ALOG}, 0, 0, FLAGS, "ascale" },
80  { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=ALINEAR}, 0, 0, FLAGS, "ascale" },
81  { "acount", "how much frames to accumulate", OFFSET(count), AV_OPT_TYPE_INT, {.i64=1}, -1, 100, FLAGS },
82  { "rheight", "set histogram ratio of window height", OFFSET(phisto), AV_OPT_TYPE_FLOAT, {.dbl=0.10}, 0, 1, FLAGS },
83  { "slide", "set sonogram sliding", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=REPLACE}, 0, NB_SLIDES-1, FLAGS, "slide" },
84  { "replace", "replace old rows with new", 0, AV_OPT_TYPE_CONST, {.i64=REPLACE}, 0, 0, FLAGS, "slide" },
85  { "scroll", "scroll from top to bottom", 0, AV_OPT_TYPE_CONST, {.i64=SCROLL}, 0, 0, FLAGS, "slide" },
86  { NULL }
87 };
88 
90 
92 {
95  AVFilterLink *inlink = ctx->inputs[0];
96  AVFilterLink *outlink = ctx->outputs[0];
98  static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE };
99  int ret = AVERROR(EINVAL);
100 
102  if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0 ||
104  (ret = ff_channel_layouts_ref (layouts, &inlink->outcfg.channel_layouts)) < 0)
105  return ret;
106 
108  if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
109  return ret;
110 
112  if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
113  return ret;
114 
115  return 0;
116 }
117 
118 static int config_input(AVFilterLink *inlink)
119 {
120  AVFilterContext *ctx = inlink->dst;
121  AudioHistogramContext *s = ctx->priv;
122 
123  s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
124  s->dchannels = s->dmode == SINGLE ? 1 : inlink->channels;
125  s->shistogram = av_calloc(s->w, s->dchannels * sizeof(*s->shistogram));
126  if (!s->shistogram)
127  return AVERROR(ENOMEM);
128 
129  s->achistogram = av_calloc(s->w, s->dchannels * sizeof(*s->achistogram));
130  if (!s->achistogram)
131  return AVERROR(ENOMEM);
132 
133  return 0;
134 }
135 
136 static int config_output(AVFilterLink *outlink)
137 {
138  AudioHistogramContext *s = outlink->src->priv;
139 
140  outlink->w = s->w;
141  outlink->h = s->h;
142  outlink->sample_aspect_ratio = (AVRational){1,1};
143  outlink->frame_rate = s->frame_rate;
144 
145  s->histogram_h = s->h * s->phisto;
146  s->ypos = s->h * s->phisto;
147 
148  if (s->dmode == SEPARATE) {
149  s->combine_buffer = av_malloc_array(outlink->w * 3, sizeof(*s->combine_buffer));
150  if (!s->combine_buffer)
151  return AVERROR(ENOMEM);
152  }
153 
154  return 0;
155 }
156 
157 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
158 {
159  AVFilterContext *ctx = inlink->dst;
160  AVFilterLink *outlink = ctx->outputs[0];
161  AudioHistogramContext *s = ctx->priv;
162  const int H = s->histogram_h;
163  const int w = s->w;
164  int c, y, n, p, bin;
165  uint64_t acmax = 1;
166  AVFrame *clone;
167 
168  if (!s->out || s->out->width != outlink->w ||
169  s->out->height != outlink->h) {
170  av_frame_free(&s->out);
171  s->out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
172  if (!s->out) {
173  av_frame_free(&in);
174  return AVERROR(ENOMEM);
175  }
176  for (n = H; n < s->h; n++) {
177  memset(s->out->data[0] + n * s->out->linesize[0], 0, w);
178  memset(s->out->data[1] + n * s->out->linesize[0], 127, w);
179  memset(s->out->data[2] + n * s->out->linesize[0], 127, w);
180  memset(s->out->data[3] + n * s->out->linesize[0], 0, w);
181  }
182  }
183 
184  if (s->dmode == SEPARATE) {
185  for (y = 0; y < w; y++) {
186  s->combine_buffer[3 * y ] = 0;
187  s->combine_buffer[3 * y + 1] = 127.5;
188  s->combine_buffer[3 * y + 2] = 127.5;
189  }
190  }
191 
192  for (n = 0; n < H; n++) {
193  memset(s->out->data[0] + n * s->out->linesize[0], 0, w);
194  memset(s->out->data[1] + n * s->out->linesize[0], 127, w);
195  memset(s->out->data[2] + n * s->out->linesize[0], 127, w);
196  memset(s->out->data[3] + n * s->out->linesize[0], 0, w);
197  }
198  s->out->pts = in->pts;
199 
200  s->first = s->frame_count;
201 
202  switch (s->ascale) {
203  case ALINEAR:
204  for (c = 0; c < inlink->channels; c++) {
205  const float *src = (const float *)in->extended_data[c];
206  uint64_t *achistogram = &s->achistogram[(s->dmode == SINGLE ? 0: c) * w];
207 
208  for (n = 0; n < in->nb_samples; n++) {
209  bin = lrint(av_clipf(fabsf(src[n]), 0, 1) * (w - 1));
210 
211  achistogram[bin]++;
212  }
213 
214  if (s->in[s->first] && s->count >= 0) {
215  uint64_t *shistogram = &s->shistogram[(s->dmode == SINGLE ? 0: c) * w];
216  const float *src2 = (const float *)s->in[s->first]->extended_data[c];
217 
218  for (n = 0; n < in->nb_samples; n++) {
219  bin = lrint(av_clipf(fabsf(src2[n]), 0, 1) * (w - 1));
220 
221  shistogram[bin]++;
222  }
223  }
224  }
225  break;
226  case ALOG:
227  for (c = 0; c < inlink->channels; c++) {
228  const float *src = (const float *)in->extended_data[c];
229  uint64_t *achistogram = &s->achistogram[(s->dmode == SINGLE ? 0: c) * w];
230 
231  for (n = 0; n < in->nb_samples; n++) {
232  bin = lrint(av_clipf(1 + log10(fabsf(src[n])) / 6, 0, 1) * (w - 1));
233 
234  achistogram[bin]++;
235  }
236 
237  if (s->in[s->first] && s->count >= 0) {
238  uint64_t *shistogram = &s->shistogram[(s->dmode == SINGLE ? 0: c) * w];
239  const float *src2 = (const float *)s->in[s->first]->extended_data[c];
240 
241  for (n = 0; n < in->nb_samples; n++) {
242  bin = lrint(av_clipf(1 + log10(fabsf(src2[n])) / 6, 0, 1) * (w - 1));
243 
244  shistogram[bin]++;
245  }
246  }
247  }
248  break;
249  }
250 
251  av_frame_free(&s->in[s->frame_count]);
252  s->in[s->frame_count] = in;
253  s->frame_count++;
254  if (s->frame_count > s->count)
255  s->frame_count = 0;
256 
257  for (n = 0; n < w * s->dchannels; n++) {
258  acmax = FFMAX(s->achistogram[n] - s->shistogram[n], acmax);
259  }
260 
261  for (c = 0; c < s->dchannels; c++) {
262  uint64_t *shistogram = &s->shistogram[c * w];
263  uint64_t *achistogram = &s->achistogram[c * w];
264  float yf, uf, vf;
265 
266  if (s->dmode == SEPARATE) {
267  yf = 256.0f / s->dchannels;
268  uf = yf * M_PI;
269  vf = yf * M_PI;
270  uf *= 0.5 * sin((2 * M_PI * c) / s->dchannels);
271  vf *= 0.5 * cos((2 * M_PI * c) / s->dchannels);
272  }
273 
274  for (n = 0; n < w; n++) {
275  double a, aa;
276  int h;
277 
278  a = achistogram[n] - shistogram[n];
279 
280  switch (s->scale) {
281  case LINEAR:
282  aa = a / (double)acmax;
283  break;
284  case SQRT:
285  aa = sqrt(a) / sqrt(acmax);
286  break;
287  case CBRT:
288  aa = cbrt(a) / cbrt(acmax);
289  break;
290  case LOG:
291  aa = log2(a + 1) / log2(acmax + 1);
292  break;
293  case RLOG:
294  aa = 1. - log2(a + 1) / log2(acmax + 1);
295  if (aa == 1.)
296  aa = 0;
297  break;
298  default:
299  av_assert0(0);
300  }
301 
302  h = aa * (H - 1);
303 
304  if (s->dmode == SINGLE) {
305 
306  for (y = H - h; y < H; y++) {
307  s->out->data[0][y * s->out->linesize[0] + n] = 255;
308  s->out->data[3][y * s->out->linesize[0] + n] = 255;
309  }
310 
311  if (s->h - H > 0) {
312  h = aa * 255;
313 
314  s->out->data[0][s->ypos * s->out->linesize[0] + n] = h;
315  s->out->data[1][s->ypos * s->out->linesize[1] + n] = 127;
316  s->out->data[2][s->ypos * s->out->linesize[2] + n] = 127;
317  s->out->data[3][s->ypos * s->out->linesize[3] + n] = 255;
318  }
319  } else if (s->dmode == SEPARATE) {
320  float *out = &s->combine_buffer[3 * n];
321  int old;
322 
323  old = s->out->data[0][(H - h) * s->out->linesize[0] + n];
324  for (y = H - h; y < H; y++) {
325  if (s->out->data[0][y * s->out->linesize[0] + n] != old)
326  break;
327  old = s->out->data[0][y * s->out->linesize[0] + n];
328  s->out->data[0][y * s->out->linesize[0] + n] = yf;
329  s->out->data[1][y * s->out->linesize[1] + n] = 128+uf;
330  s->out->data[2][y * s->out->linesize[2] + n] = 128+vf;
331  s->out->data[3][y * s->out->linesize[3] + n] = 255;
332  }
333 
334  out[0] += aa * yf;
335  out[1] += aa * uf;
336  out[2] += aa * vf;
337  }
338  }
339  }
340 
341  if (s->h - H > 0) {
342  if (s->dmode == SEPARATE) {
343  for (n = 0; n < w; n++) {
344  float *cb = &s->combine_buffer[3 * n];
345 
346  s->out->data[0][s->ypos * s->out->linesize[0] + n] = cb[0];
347  s->out->data[1][s->ypos * s->out->linesize[1] + n] = cb[1];
348  s->out->data[2][s->ypos * s->out->linesize[2] + n] = cb[2];
349  s->out->data[3][s->ypos * s->out->linesize[3] + n] = 255;
350  }
351  }
352 
353  if (s->slide == SCROLL) {
354  for (p = 0; p < 4; p++) {
355  for (y = s->h; y >= H + 1; y--) {
356  memmove(s->out->data[p] + (y ) * s->out->linesize[p],
357  s->out->data[p] + (y-1) * s->out->linesize[p], w);
358  }
359  }
360  }
361 
362  s->ypos++;
363  if (s->slide == SCROLL || s->ypos >= s->h)
364  s->ypos = H;
365  }
366 
367  clone = av_frame_clone(s->out);
368  if (!clone)
369  return AVERROR(ENOMEM);
370 
371  return ff_filter_frame(outlink, clone);
372 }
373 
375 {
376  AVFilterLink *inlink = ctx->inputs[0];
377  AVFilterLink *outlink = ctx->outputs[0];
378  AudioHistogramContext *s = ctx->priv;
379  AVFrame *in;
380  int ret;
381 
382  FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
383 
384  ret = ff_inlink_consume_samples(inlink, s->nb_samples, s->nb_samples, &in);
385  if (ret < 0)
386  return ret;
387  if (ret > 0)
388  return filter_frame(inlink, in);
389 
390  FF_FILTER_FORWARD_STATUS(inlink, outlink);
391  FF_FILTER_FORWARD_WANTED(outlink, inlink);
392 
393  return FFERROR_NOT_READY;
394 }
395 
397 {
398  AudioHistogramContext *s = ctx->priv;
399  int i;
400 
401  av_frame_free(&s->out);
402  av_freep(&s->shistogram);
403  av_freep(&s->achistogram);
404  av_freep(&s->combine_buffer);
405  for (i = 0; i < 101; i++)
406  av_frame_free(&s->in[i]);
407 }
408 
409 static const AVFilterPad ahistogram_inputs[] = {
410  {
411  .name = "default",
412  .type = AVMEDIA_TYPE_AUDIO,
413  .config_props = config_input,
414  },
415  { NULL }
416 };
417 
418 static const AVFilterPad ahistogram_outputs[] = {
419  {
420  .name = "default",
421  .type = AVMEDIA_TYPE_VIDEO,
422  .config_props = config_output,
423  },
424  { NULL }
425 };
426 
428  .name = "ahistogram",
429  .description = NULL_IF_CONFIG_SMALL("Convert input audio to histogram video output."),
430  .uninit = uninit,
431  .query_formats = query_formats,
432  .priv_size = sizeof(AudioHistogramContext),
433  .activate = activate,
436  .priv_class = &ahistogram_class,
437 };
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:925
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define av_cold
Definition: attributes.h:88
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
SlideMode
@ SCROLL
@ REPLACE
@ NB_SLIDES
HistogramMode
@ ACCUMULATE
@ CURRENT
@ NB_HMODES
AmplitudeScale
@ NB_ASCALES
@ ALINEAR
@ ALOG
static const AVOption ahistogram_options[]
AVFilter ff_avf_ahistogram
DisplayScale
@ SQRT
@ RLOG
@ CBRT
@ NB_SCALES
@ LOG
@ LINEAR
DisplayMode
@ SINGLE
@ SEPARATE
@ NB_DMODES
static int query_formats(AVFilterContext *ctx)
AVFILTER_DEFINE_CLASS(ahistogram)
static int config_input(AVFilterLink *inlink)
#define FLAGS
static const AVFilterPad ahistogram_outputs[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
#define OFFSET(x)
static int config_output(AVFilterLink *outlink)
static const AVFilterPad ahistogram_inputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition: avfilter.c:1513
Main libavfilter public API header.
#define s(width, name)
Definition: cbs_vp9.c:257
#define FFMAX(a, b)
Definition: common.h:103
#define av_clipf
Definition: common.h:170
#define NULL
Definition: coverity.c:32
static __device__ float fabsf(float a)
Definition: cuda_runtime.h:181
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition: filters.h:254
#define FF_FILTER_FORWARD_STATUS(inlink, outlink)
Acknowledge the status on an input link and forward it to an output link.
Definition: filters.h:226
#define FFERROR_NOT_READY
Filters implementation helper functions.
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:199
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:436
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add ref as a new reference to formats.
Definition: formats.c:466
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:461
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:421
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:238
@ AV_OPT_TYPE_INT
Definition: opt.h:225
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
#define AVERROR(e)
Definition: error.h:43
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:540
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
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
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
for(j=16;j >0;--j)
int i
Definition: input.c:407
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:117
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
#define log2(x)
Definition: libm.h:404
uint8_t w
Definition: llviddspenc.c:39
#define M_PI
Definition: mathematics.h:52
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:434
AVOptions.
misc parsing utilities
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
formats
Definition: signature.h:48
Describe the class of an AVClass context structure.
Definition: log.h:67
A list of supported channel layouts.
Definition: formats.h:86
An instance of a filter.
Definition: avfilter.h:341
void * priv
private data for use by the filter
Definition: avfilter.h:356
AVFilterFormats * formats
List of supported formats (pixel or sample).
Definition: avfilter.h:445
AVFilterChannelLayouts * channel_layouts
Lists of supported channel layouts, only for audio.
Definition: avfilter.h:455
AVFilterFormats * samplerates
Lists of supported sample rates, only for audio.
Definition: avfilter.h:450
A list of supported formats for one end of a filter link.
Definition: formats.h:65
A filter pad used for either input or output.
Definition: internal.h:54
const char * name
Pad name.
Definition: internal.h:60
Filter definition.
Definition: avfilter.h:145
const char * name
Filter name.
Definition: avfilter.h:149
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
AVOption.
Definition: opt.h:248
Rational number (pair of numerator and denominator).
Definition: rational.h:58
#define cbrt
Definition: tablegen.h:35
#define lrint
Definition: tablegen.h:53
#define av_malloc_array(a, b)
#define av_freep(p)
#define src
Definition: vp8dsp.c:255
FILE * out
Definition: movenc.c:54
AVFormatContext * ctx
Definition: movenc.c:48
@ H
Definition: vf_addroi.c:26
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:215
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:104
static double c[64]