FFmpeg
avf_avectorscope.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 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 /**
22  * @file
23  * audio to video multimedia vectorscope filter
24  */
25 
26 #include "libavutil/avassert.h"
28 #include "libavutil/opt.h"
29 #include "libavutil/parseutils.h"
30 #include "avfilter.h"
31 #include "filters.h"
32 #include "formats.h"
33 #include "audio.h"
34 #include "video.h"
35 #include "internal.h"
36 
42 };
43 
45  DOT,
48 };
49 
51  LIN,
54  LOG,
56 };
57 
58 typedef struct AudioVectorScopeContext {
59  const AVClass *class;
61  int w, h;
62  int hw, hh;
63  int mode;
64  int draw;
65  int scale;
66  int contrast[4];
67  int fade[4];
68  double zoom;
69  int swap;
70  int mirror;
71  unsigned prev_x, prev_y;
75 
76 #define OFFSET(x) offsetof(AudioVectorScopeContext, x)
77 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
78 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
79 
80 static const AVOption avectorscope_options[] = {
81  { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=LISSAJOUS}, 0, MODE_NB-1, TFLAGS, "mode" },
82  { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=LISSAJOUS}, 0, MODE_NB-1, TFLAGS, "mode" },
83  { "lissajous", "", 0, AV_OPT_TYPE_CONST, {.i64=LISSAJOUS}, 0, 0, TFLAGS, "mode" },
84  { "lissajous_xy", "", 0, AV_OPT_TYPE_CONST, {.i64=LISSAJOUS_XY}, 0, 0, TFLAGS, "mode" },
85  { "polar", "", 0, AV_OPT_TYPE_CONST, {.i64=POLAR}, 0, 0, TFLAGS, "mode" },
86  { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
87  { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
88  { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="400x400"}, 0, 0, FLAGS },
89  { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="400x400"}, 0, 0, FLAGS },
90  { "rc", "set red contrast", OFFSET(contrast[0]), AV_OPT_TYPE_INT, {.i64=40}, 0, 255, TFLAGS },
91  { "gc", "set green contrast", OFFSET(contrast[1]), AV_OPT_TYPE_INT, {.i64=160}, 0, 255, TFLAGS },
92  { "bc", "set blue contrast", OFFSET(contrast[2]), AV_OPT_TYPE_INT, {.i64=80}, 0, 255, TFLAGS },
93  { "ac", "set alpha contrast", OFFSET(contrast[3]), AV_OPT_TYPE_INT, {.i64=255}, 0, 255, TFLAGS },
94  { "rf", "set red fade", OFFSET(fade[0]), AV_OPT_TYPE_INT, {.i64=15}, 0, 255, TFLAGS },
95  { "gf", "set green fade", OFFSET(fade[1]), AV_OPT_TYPE_INT, {.i64=10}, 0, 255, TFLAGS },
96  { "bf", "set blue fade", OFFSET(fade[2]), AV_OPT_TYPE_INT, {.i64=5}, 0, 255, TFLAGS },
97  { "af", "set alpha fade", OFFSET(fade[3]), AV_OPT_TYPE_INT, {.i64=5}, 0, 255, TFLAGS },
98  { "zoom", "set zoom factor", OFFSET(zoom), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 10, TFLAGS },
99  { "draw", "set draw mode", OFFSET(draw), AV_OPT_TYPE_INT, {.i64=DOT}, 0, DRAW_NB-1, TFLAGS, "draw" },
100  { "dot", "", 0, AV_OPT_TYPE_CONST, {.i64=DOT} , 0, 0, TFLAGS, "draw" },
101  { "line", "", 0, AV_OPT_TYPE_CONST, {.i64=LINE}, 0, 0, TFLAGS, "draw" },
102  { "scale", "set amplitude scale mode", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=LIN}, 0, SCALE_NB-1, TFLAGS, "scale" },
103  { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LIN}, 0, 0, TFLAGS, "scale" },
104  { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, TFLAGS, "scale" },
105  { "cbrt", "cube root", 0, AV_OPT_TYPE_CONST, {.i64=CBRT}, 0, 0, TFLAGS, "scale" },
106  { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, TFLAGS, "scale" },
107  { "swap", "swap x axis with y axis", OFFSET(swap), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, TFLAGS },
108  { "mirror", "mirror axis", OFFSET(mirror), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, TFLAGS, "mirror" },
109  { "none", "no mirror", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, TFLAGS, "mirror" },
110  { "x", "mirror x", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, TFLAGS, "mirror" },
111  { "y", "mirror y", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, TFLAGS, "mirror" },
112  { "xy", "mirror both", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, TFLAGS, "mirror" },
113  { NULL }
114 };
115 
116 AVFILTER_DEFINE_CLASS(avectorscope);
117 
118 static void draw_dot(AudioVectorScopeContext *s, unsigned x, unsigned y)
119 {
120  const ptrdiff_t linesize = s->outpicref->linesize[0];
121  uint8_t *dst;
122 
123  if (s->zoom > 1) {
124  if (y >= s->h || x >= s->w)
125  return;
126  } else {
127  y = FFMIN(y, s->h - 1);
128  x = FFMIN(x, s->w - 1);
129  }
130 
131  dst = s->outpicref->data[0] + y * linesize + x * 4;
132  dst[0] = FFMIN(dst[0] + s->contrast[0], 255);
133  dst[1] = FFMIN(dst[1] + s->contrast[1], 255);
134  dst[2] = FFMIN(dst[2] + s->contrast[2], 255);
135  dst[3] = FFMIN(dst[3] + s->contrast[3], 255);
136 }
137 
138 static void draw_line(AudioVectorScopeContext *s, int x0, int y0, int x1, int y1)
139 {
140  int dx = FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
141  int dy = FFABS(y1-y0), sy = y0 < y1 ? 1 : -1;
142  int err = (dx>dy ? dx : -dy) / 2, e2;
143 
144  for (;;) {
145  draw_dot(s, x0, y0);
146 
147  if (x0 == x1 && y0 == y1)
148  break;
149 
150  e2 = err;
151 
152  if (e2 >-dx) {
153  err -= dy;
154  x0 += sx;
155  }
156 
157  if (e2 < dy) {
158  err += dx;
159  y0 += sy;
160  }
161  }
162 }
163 
164 static int fade(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
165 {
166  AudioVectorScopeContext *s = ctx->priv;
167  const int linesize = s->outpicref->linesize[0];
168  const int height = s->outpicref->height;
169  const int slice_start = (height * jobnr ) / nb_jobs;
170  const int slice_end = (height * (jobnr+1)) / nb_jobs;
171 
172  if (s->fade[0] == 255 && s->fade[1] == 255 && s->fade[2] == 255) {
173  for (int i = slice_start; i < slice_end; i++)
174  memset(s->outpicref->data[0] + i * linesize, 0, s->outpicref->width * 4);
175  return 0;
176  }
177 
178  if (s->fade[0] || s->fade[1] || s->fade[2]) {
179  uint8_t *d = s->outpicref->data[0] + slice_start * linesize;
180  for (int i = slice_start; i < slice_end; i++) {
181  for (int j = 0; j < s->w*4; j+=4) {
182  if (d[j+0])
183  d[j+0] = FFMAX(d[j+0] - s->fade[0], 0);
184  if (d[j+1])
185  d[j+1] = FFMAX(d[j+1] - s->fade[1], 0);
186  if (d[j+2])
187  d[j+2] = FFMAX(d[j+2] - s->fade[2], 0);
188  if (d[j+3])
189  d[j+3] = FFMAX(d[j+3] - s->fade[3], 0);
190  }
191  d += linesize;
192  }
193  }
194 
195  return 0;
196 }
197 
199 {
202  AVFilterLink *inlink = ctx->inputs[0];
203  AVFilterLink *outlink = ctx->outputs[0];
205  static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
206  int ret;
207 
209  if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0 ||
211  (ret = ff_channel_layouts_ref (layout , &inlink->outcfg.channel_layouts)) < 0)
212  return ret;
213 
215  if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
216  return ret;
217 
219  if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
220  return ret;
221 
222  return 0;
223 }
224 
226 {
227  AVFilterContext *ctx = inlink->dst;
228  AudioVectorScopeContext *s = ctx->priv;
229 
230  s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
231 
232  return 0;
233 }
234 
235 static int config_output(AVFilterLink *outlink)
236 {
237  AudioVectorScopeContext *s = outlink->src->priv;
238 
239  outlink->w = s->w;
240  outlink->h = s->h;
241  outlink->sample_aspect_ratio = (AVRational){1,1};
242  outlink->frame_rate = s->frame_rate;
243  outlink->time_base = av_inv_q(outlink->frame_rate);
244 
245  s->prev_x = s->hw = s->w / 2;
246  s->prev_y = s->hh = s->mode == POLAR ? s->h - 1 : s->h / 2;
247 
248  return 0;
249 }
250 
251 static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
252 {
253  AVFilterContext *ctx = inlink->dst;
254  AVFilterLink *outlink = ctx->outputs[0];
255  const int16_t *samples = (const int16_t *)insamples->data[0];
256  const float *samplesf = (const float *)insamples->data[0];
257  AudioVectorScopeContext *s = ctx->priv;
258  const int hw = s->hw;
259  const int hh = s->hh;
260  AVFrame *clone;
261  unsigned x, y;
262  unsigned prev_x = s->prev_x, prev_y = s->prev_y;
263  double zoom = s->zoom;
264 
265  if (!s->outpicref || s->outpicref->width != outlink->w ||
266  s->outpicref->height != outlink->h) {
267  av_frame_free(&s->outpicref);
268  s->outpicref = ff_get_video_buffer(outlink, outlink->w, outlink->h);
269  if (!s->outpicref) {
270  av_frame_free(&insamples);
271  return AVERROR(ENOMEM);
272  }
273 
274  s->outpicref->sample_aspect_ratio = (AVRational){1,1};
275  for (int i = 0; i < outlink->h; i++)
276  memset(s->outpicref->data[0] + i * s->outpicref->linesize[0], 0, outlink->w * 4);
277  }
278  s->outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
279  s->outpicref->duration = 1;
280 
281  av_frame_make_writable(s->outpicref);
283 
284  if (zoom < 1) {
285  float max = 0;
286 
287  switch (insamples->format) {
288  case AV_SAMPLE_FMT_S16:
289  for (int i = 0; i < insamples->nb_samples * 2; i++) {
290  float sample = samples[i] / (float)INT16_MAX;
291  max = FFMAX(FFABS(sample), max);
292  }
293  break;
294  case AV_SAMPLE_FMT_FLT:
295  for (int i = 0; i < insamples->nb_samples * 2; i++) {
296  max = FFMAX(FFABS(samplesf[i]), max);
297  }
298  break;
299  default:
300  av_assert2(0);
301  }
302 
303  switch (s->scale) {
304  case SQRT:
305  max = sqrtf(max);
306  break;
307  case CBRT:
308  max = cbrtf(max);
309  break;
310  case LOG:
311  max = logf(1 + max) / logf(2);
312  break;
313  }
314 
315  zoom = 1. / max;
316  }
317 
318  for (int i = 0; i < insamples->nb_samples; i++) {
319  float src[2];
320 
321  switch (insamples->format) {
322  case AV_SAMPLE_FMT_S16:
323  src[0] = samples[i*2+0] / (float)INT16_MAX;
324  src[1] = samples[i*2+1] / (float)INT16_MAX;
325  break;
326  case AV_SAMPLE_FMT_FLT:
327  src[0] = samplesf[i*2+0];
328  src[1] = samplesf[i*2+1];
329  break;
330  default:
331  av_assert2(0);
332  }
333 
334  switch (s->scale) {
335  case SQRT:
336  src[0] = FFSIGN(src[0]) * sqrtf(FFABS(src[0]));
337  src[1] = FFSIGN(src[1]) * sqrtf(FFABS(src[1]));
338  break;
339  case CBRT:
340  src[0] = FFSIGN(src[0]) * cbrtf(FFABS(src[0]));
341  src[1] = FFSIGN(src[1]) * cbrtf(FFABS(src[1]));
342  break;
343  case LOG:
344  src[0] = FFSIGN(src[0]) * logf(1 + FFABS(src[0])) / logf(2);
345  src[1] = FFSIGN(src[1]) * logf(1 + FFABS(src[1])) / logf(2);
346  break;
347  }
348 
349  if (s->mirror & 1)
350  src[0] = -src[0];
351 
352  if (s->mirror & 2)
353  src[1] = -src[1];
354 
355  if (s->swap)
356  FFSWAP(float, src[0], src[1]);
357 
358  if (s->mode == LISSAJOUS) {
359  x = ((src[1] - src[0]) * zoom / 2 + 1) * hw;
360  y = (1.0 - (src[0] + src[1]) * zoom / 2) * hh;
361  } else if (s->mode == LISSAJOUS_XY) {
362  x = (src[1] * zoom + 1) * hw;
363  y = (src[0] * zoom + 1) * hh;
364  } else {
365  float sx, sy, cx, cy;
366 
367  sx = src[1] * zoom;
368  sy = src[0] * zoom;
369  cx = sx * sqrtf(1 - 0.5 * sy * sy);
370  cy = sy * sqrtf(1 - 0.5 * sx * sx);
371  x = hw + hw * FFSIGN(cx + cy) * (cx - cy) * .7;
372  y = s->h - s->h * fabsf(cx + cy) * .7;
373  }
374 
375  if (s->draw == DOT) {
376  draw_dot(s, x, y);
377  } else {
378  draw_line(s, x, y, prev_x, prev_y);
379  }
380  prev_x = x;
381  prev_y = y;
382  }
383 
384  s->prev_x = x, s->prev_y = y;
385  av_frame_free(&insamples);
386 
387  clone = av_frame_clone(s->outpicref);
388  if (!clone)
389  return AVERROR(ENOMEM);
390 
391  return ff_filter_frame(outlink, clone);
392 }
393 
395 {
396  AVFilterLink *inlink = ctx->inputs[0];
397  AVFilterLink *outlink = ctx->outputs[0];
398  AudioVectorScopeContext *s = ctx->priv;
399  AVFrame *in;
400  int ret;
401 
403 
404  ret = ff_inlink_consume_samples(inlink, s->nb_samples, s->nb_samples, &in);
405  if (ret < 0)
406  return ret;
407  if (ret > 0)
408  return filter_frame(inlink, in);
409 
410  if (ff_inlink_queued_samples(inlink) >= s->nb_samples) {
412  return 0;
413  }
414 
417 
418  return FFERROR_NOT_READY;
419 }
420 
422 {
423  AudioVectorScopeContext *s = ctx->priv;
424 
425  av_frame_free(&s->outpicref);
426 }
427 
429  {
430  .name = "default",
431  .type = AVMEDIA_TYPE_AUDIO,
432  .config_props = config_input,
433  },
434 };
435 
437  {
438  .name = "default",
439  .type = AVMEDIA_TYPE_VIDEO,
440  .config_props = config_output,
441  },
442 };
443 
445  .name = "avectorscope",
446  .description = NULL_IF_CONFIG_SMALL("Convert input audio to vectorscope video output."),
447  .uninit = uninit,
448  .priv_size = sizeof(AudioVectorScopeContext),
449  .activate = activate,
453  .priv_class = &avectorscope_class,
455  .process_command = ff_filter_process_command,
456 };
AudioVectorScopeContext::draw
int draw
Definition: avf_avectorscope.c:64
formats
formats
Definition: signature.h:48
TFLAGS
#define TFLAGS
Definition: avf_avectorscope.c:78
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:101
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:380
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:369
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1009
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:947
ff_channel_layouts_ref
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:591
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:238
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
zoom
static void zoom(float *u, float *v, float amount)
Definition: vf_xfade.c:1633
DRAW_NB
@ DRAW_NB
Definition: avf_avectorscope.c:47
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:116
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
VectorScopeScale
VectorScopeScale
Definition: avf_avectorscope.c:50
av_frame_make_writable
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:550
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:432
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:251
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
AudioVectorScopeContext::frame_rate
AVRational frame_rate
Definition: avf_avectorscope.c:72
max
#define max(a, b)
Definition: cuda_runtime.h:33
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
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
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:346
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
fade
static int fade(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: avf_avectorscope.c:164
LISSAJOUS_XY
@ LISSAJOUS_XY
Definition: avf_avectorscope.c:39
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:430
AudioVectorScopeContext::hw
int hw
Definition: avf_avectorscope.c:62
FFSIGN
#define FFSIGN(a)
Definition: common.h:65
AudioVectorScopeContext::hh
int hh
Definition: avf_avectorscope.c:62
OFFSET
#define OFFSET(x)
Definition: avf_avectorscope.c:76
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1389
fabsf
static __device__ float fabsf(float a)
Definition: cuda_runtime.h:181
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
LIN
@ LIN
Definition: avf_avectorscope.c:51
CBRT
@ CBRT
Definition: avf_avectorscope.c:53
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
AudioVectorScopeContext::fade
int fade[4]
Definition: avf_avectorscope.c:67
SQRT
@ SQRT
Definition: avf_avectorscope.c:52
float
float
Definition: af_crystalizer.c:122
AudioVectorScopeContext::nb_samples
int nb_samples
Definition: avf_avectorscope.c:73
s
#define s(width, name)
Definition: cbs_vp9.c:256
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
ff_formats_ref
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:596
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2010
AudioVectorScopeContext::contrast
int contrast[4]
Definition: avf_avectorscope.c:66
AudioVectorScopeContext::mode
int mode
Definition: avf_avectorscope.c:63
filters.h
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:474
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
AudioVectorScopeContext::zoom
double zoom
Definition: avf_avectorscope.c:68
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
draw_line
static void draw_line(AudioVectorScopeContext *s, int x0, int y0, int x1, int y1)
Definition: avf_avectorscope.c:138
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
arg
const char * arg
Definition: jacosubdec.c:67
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:64
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_inlink_consume_samples
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:1423
NULL
#define NULL
Definition: coverity.c:32
LOG
@ LOG
Definition: avf_avectorscope.c:54
config_input
static int config_input(AVFilterLink *inlink)
Definition: avf_avectorscope.c:225
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
AudioVectorScopeContext::mirror
int mirror
Definition: avf_avectorscope.c:70
DOT
@ DOT
Definition: avf_avectorscope.c:45
VectorScopeDraw
VectorScopeDraw
Definition: avf_avectorscope.c:44
parseutils.h
AudioVectorScopeContext::prev_x
unsigned prev_x
Definition: avf_avectorscope.c:71
sqrtf
static __device__ float sqrtf(float a)
Definition: cuda_runtime.h:184
ff_add_channel_layout
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:466
LISSAJOUS
@ LISSAJOUS
Definition: avf_avectorscope.c:38
AudioVectorScopeContext::h
int h
Definition: avf_avectorscope.c:61
AudioVectorScopeContext
Definition: avf_avectorscope.c:58
mirror
static void mirror(const float *modifier, float *vec)
Definition: vf_v360.c:4090
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:115
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:301
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
sample
#define sample
Definition: flacdsp_template.c:44
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:412
LINE
@ LINE
Definition: avf_avectorscope.c:46
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:873
height
#define height
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
audiovectorscope_inputs
static const AVFilterPad audiovectorscope_inputs[]
Definition: avf_avectorscope.c:428
draw
static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: avf_showcwt.c:297
AudioVectorScopeContext::swap
int swap
Definition: avf_avectorscope.c:69
internal.h
AudioVectorScopeContext::scale
int scale
Definition: avf_avectorscope.c:65
layout
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 layout
Definition: filter_design.txt:18
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:405
MODE_NB
@ MODE_NB
Definition: avf_avectorscope.c:41
draw_dot
static void draw_dot(AudioVectorScopeContext *s, unsigned x, unsigned y)
Definition: avf_avectorscope.c:118
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
FLAGS
#define FLAGS
Definition: avf_avectorscope.c:77
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:793
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
cbrtf
static av_always_inline float cbrtf(float x)
Definition: libm.h:61
AudioVectorScopeContext::outpicref
AVFrame * outpicref
Definition: avf_avectorscope.c:60
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(avectorscope)
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:55
ff_inlink_queued_samples
int ff_inlink_queued_samples(AVFilterLink *link)
Definition: avfilter.c:1383
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
AVFilter
Filter definition.
Definition: avfilter.h:171
VectorScopeMode
VectorScopeMode
Definition: avf_avectorscope.c:37
ret
ret
Definition: filter_design.txt:187
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
ff_all_samplerates
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:551
channel_layout.h
mode
mode
Definition: ebur128.h:83
config_output
static int config_output(AVFilterLink *outlink)
Definition: avf_avectorscope.c:235
SCALE_NB
@ SCALE_NB
Definition: avf_avectorscope.c:55
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: avf_avectorscope.c:421
ff_avf_avectorscope
const AVFilter ff_avf_avectorscope
Definition: avf_avectorscope.c:444
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
Definition: avf_avectorscope.c:251
AVFilterContext
An instance of a filter.
Definition: avfilter.h:415
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:127
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
POLAR
@ POLAR
Definition: avf_avectorscope.c:40
audio.h
AVFilterFormatsConfig::formats
AVFilterFormats * formats
List of supported formats (pixel or sample).
Definition: avfilter.h:519
avectorscope_options
static const AVOption avectorscope_options[]
Definition: avf_avectorscope.c:80
activate
static int activate(AVFilterContext *ctx)
Definition: avf_avectorscope.c:394
AudioVectorScopeContext::w
int w
Definition: avf_avectorscope.c:61
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: avf_avectorscope.c:198
FF_FILTER_FORWARD_STATUS
FF_FILTER_FORWARD_STATUS(inlink, outlink)
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
AudioVectorScopeContext::prev_y
unsigned prev_y
Definition: avf_avectorscope.c:71
d
d
Definition: ffmpeg_filter.c:156
audiovectorscope_outputs
static const AVFilterPad audiovectorscope_outputs[]
Definition: avf_avectorscope.c:436
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:142
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
ff_filter_set_ready
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition: avfilter.c:199