FFmpeg
avf_a3dscope.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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"
23 #include "libavutil/opt.h"
24 #include "libavutil/parseutils.h"
25 #include "avfilter.h"
26 #include "filters.h"
27 #include "formats.h"
28 #include "audio.h"
29 #include "video.h"
30 #include "internal.h"
31 
32 typedef struct Audio3dScopeContext {
33  const AVClass *class;
34  int w, h;
35  int size;
36  float fov;
37  float roll;
38  float pitch;
39  float yaw;
40  float zoom[3];
41  float eye[3];
42 
45 
46  float view_matrix[4][4];
47  float projection_matrix[4][4];
48 
51 
52 #define OFFSET(x) offsetof(Audio3dScopeContext, x)
53 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
54 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
55 
56 static const AVOption a3dscope_options[] = {
57  { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
58  { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
59  { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
60  { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
61  { "fov", "set camera FoV", OFFSET(fov), AV_OPT_TYPE_FLOAT, {.dbl=90.f}, 40, 150, TFLAGS },
62  { "roll", "set camera roll",OFFSET(roll), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, -180, 180, TFLAGS },
63  { "pitch","set camera pitch",OFFSET(pitch), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, -180, 180, TFLAGS },
64  { "yaw", "set camera yaw", OFFSET(yaw), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, -180, 180, TFLAGS },
65  { "xzoom","set camera zoom", OFFSET(zoom[0]),AV_OPT_TYPE_FLOAT, {.dbl=1.f}, 0.01, 10, TFLAGS },
66  { "yzoom","set camera zoom", OFFSET(zoom[1]),AV_OPT_TYPE_FLOAT, {.dbl=1.f}, 0.01, 10, TFLAGS },
67  { "zzoom","set camera zoom", OFFSET(zoom[2]),AV_OPT_TYPE_FLOAT, {.dbl=1.f}, 0.01, 10, TFLAGS },
68  { "xpos", "set camera position", OFFSET(eye[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.f},-60.f, 60.f, TFLAGS },
69  { "ypos", "set camera position", OFFSET(eye[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.f},-60.f, 60.f, TFLAGS },
70  { "zpos", "set camera position", OFFSET(eye[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.f},-60.f, 60.f, TFLAGS },
71  { "length","set length", OFFSET(size), AV_OPT_TYPE_INT, {.i64=15}, 1, 60, FLAGS },
72  { NULL }
73 };
74 
75 AVFILTER_DEFINE_CLASS(a3dscope);
76 
78 {
81  AVFilterLink *inlink = ctx->inputs[0];
82  AVFilterLink *outlink = ctx->outputs[0];
84  static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
85  int ret;
86 
88  if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0)
89  return ret;
90 
92  if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
93  return ret;
94 
96  if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
97  return ret;
98 
100  if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
101  return ret;
102 
103  return 0;
104 }
105 
107 {
108  AVFilterContext *ctx = inlink->dst;
109  Audio3dScopeContext *s = ctx->priv;
110 
111  s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
112 
113  return 0;
114 }
115 
116 static int config_output(AVFilterLink *outlink)
117 {
118  Audio3dScopeContext *s = outlink->src->priv;
119 
120  outlink->w = s->w;
121  outlink->h = s->h;
122  outlink->sample_aspect_ratio = (AVRational){1,1};
123  outlink->frame_rate = s->frame_rate;
124  outlink->time_base = av_inv_q(outlink->frame_rate);
125 
126  return 0;
127 }
128 
129 static void projection_matrix(float fov, float a, float near, float far,
130  float matrix[4][4])
131 {
132  float f;
133 
134  memset(matrix, 0, sizeof(*matrix));
135 
136  f = 1.0f / tanf(fov * 0.5f * M_PI / 180.f);
137  matrix[0][0] = f * a;
138  matrix[1][1] = f;
139  matrix[2][2] = -(far + near) / (far - near);
140  matrix[2][3] = -1.f;
141  matrix[3][2] = -(near * far) / (far - near);
142 }
143 
144 static inline void vmultiply(const float v[4], const float m[4][4], float d[4])
145 {
146  d[0] = v[0] * m[0][0] + v[1] * m[1][0] + v[2] * m[2][0] + v[3] * m[3][0];
147  d[1] = v[0] * m[0][1] + v[1] * m[1][1] + v[2] * m[2][1] + v[3] * m[3][1];
148  d[2] = v[0] * m[0][2] + v[1] * m[1][2] + v[2] * m[2][2] + v[3] * m[3][2];
149  d[3] = v[0] * m[0][3] + v[1] * m[1][3] + v[2] * m[2][3] + v[3] * m[3][3];
150 }
151 
152 static void mmultiply(const float m2[4][4], const float m1[4][4], float m[4][4])
153 {
154  vmultiply(m2[0], m1, m[0]);
155  vmultiply(m2[1], m1, m[1]);
156  vmultiply(m2[2], m1, m[2]);
157  vmultiply(m2[3], m1, m[3]);
158 }
159 
160 static float vdot(const float x[3], const float y[3])
161 {
162  return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
163 }
164 
165 static void view_matrix(const float eye[3],
166  const float z[3],
167  const float roll,
168  const float pitch,
169  const float yaw, float m[4][4])
170 {
171  float cr = cosf(roll * M_PI / 180.f);
172  float sr = sinf(roll * M_PI / 180.f);
173  float cp = cosf(pitch * M_PI / 180.f);
174  float sp = sinf(pitch * M_PI / 180.f);
175  float cy = cosf(yaw * M_PI / 180.f);
176  float sy = sinf(yaw * M_PI / 180.f);
177  float t[4][4];
178  float rx[4][4] = {
179  {z[0], 0.f, 0.f, 0.f },
180  { 0.f, cy, -sy, 0.f },
181  { 0.f, sy, cy, 0.f },
182  { 0.f, 0.f, 0.f, 1.f },
183  };
184 
185  float ry[4][4] = {
186  { cp, 0.f, sp, 0.f },
187  { 0.f,z[1], 0.f, 0.f },
188  {-sp, 0.f, cp, 0.f },
189  { 0.f, 0.f, 0.f, 1.f },
190  };
191 
192  float rz[4][4] = {
193  { cr, -sr, 0.f, 0.f },
194  { sr, cr, 0.f, 0.f },
195  { 0.f, 0.f,z[2], 0.f },
196  { 0.f, 0.f, 0.f, 1.f },
197  };
198 
199  memset(m, 0, sizeof(*m));
200 
201  mmultiply(rx, ry, t);
202  mmultiply(rz, t, m);
203 
204  m[3][0] = -vdot(m[0], eye);
205  m[3][1] = -vdot(m[1], eye);
206  m[3][2] = -vdot(m[2], eye);
207 }
208 
209 static void draw_dot(AVFrame *out, unsigned x, unsigned y, float z,
210  int r, int g, int b)
211 {
212  const ptrdiff_t linesize = out->linesize[0];
213  uint8_t *dst;
214 
215  dst = out->data[0] + y * linesize + x * 4;
216  dst[0] = r * z;
217  dst[1] = g * z;
218  dst[2] = b * z;
219  dst[3] = 255 * z;
220 }
221 
223 {
224  AVFilterContext *ctx = inlink->dst;
225  AVFilterLink *outlink = ctx->outputs[0];
226  Audio3dScopeContext *s = ctx->priv;
227  const float half_height = (s->h - 1) * 0.5f;
228  const float half_width = (s->w - 1) * 0.5f;
229  float matrix[4][4];
230  const int w = s->w;
231  const int h = s->h;
232  AVFrame *out;
233 
234  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
235  if (!out) {
236  av_frame_free(&in);
237  return AVERROR(ENOMEM);
238  }
239 
240  s->frames[0] = in;
241 
242  out->sample_aspect_ratio = (AVRational){1,1};
243  for (int y = 0; y < outlink->h; y++)
244  memset(out->data[0] + y * out->linesize[0], 0, outlink->w * 4);
245  out->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);
246 
247  projection_matrix(s->fov, half_width / half_height, 0.1f, 1000000.f, s->projection_matrix);
248  view_matrix(s->eye, s->zoom, s->roll, s->pitch, s->yaw, s->view_matrix);
249  mmultiply(s->projection_matrix, s->view_matrix, matrix);
250 
251  for (int nb_frame = s->size - 1; nb_frame >= 0; nb_frame--) {
252  const float scale = 1.f / s->nb_samples;
253  AVFrame *frame = s->frames[nb_frame];
254  float channels;
255 
256  if (!frame)
257  continue;
258 
259  channels = frame->ch_layout.nb_channels;
260  for (int ch = 0; ch < channels; ch++) {
261  const float *src = (float *)frame->extended_data[ch];
262  const int r = 128.f + 127.f * sinf(ch / (channels - 1) * M_PI);
263  const int g = 128.f + 127.f * ch / (channels - 1);
264  const int b = 128.f + 127.f * cosf(ch / (channels - 1) * M_PI);
265 
266  for (int n = frame->nb_samples - 1, nn = s->nb_samples * nb_frame; n >= 0; n--, nn++) {
267  float v[4] = { src[n], ch - (channels - 1) * 0.5f, -0.1f + -nn * scale, 1.f };
268  float d[4];
269  int x, y;
270 
271  vmultiply(v, matrix, d);
272 
273  d[0] /= d[3];
274  d[1] /= d[3];
275 
276  x = d[0] * half_width + half_width;
277  y = d[1] * half_height + half_height;
278 
279  if (x >= w || y >= h || x < 0 || y < 0)
280  continue;
281 
282  draw_dot(out, x, y, av_clipf(1.f / d[3], 0.f, 1.f),
283  r, g, b);
284  }
285  }
286  }
287 
288  av_frame_free(&s->frames[59]);
289  memmove(&s->frames[1], &s->frames[0], 59 * sizeof(AVFrame *));
290  s->frames[0] = NULL;
291 
292  return ff_filter_frame(outlink, out);
293 }
294 
296 {
297  AVFilterLink *inlink = ctx->inputs[0];
298  AVFilterLink *outlink = ctx->outputs[0];
299  Audio3dScopeContext *s = ctx->priv;
300  AVFrame *in;
301  int ret;
302 
304 
305  ret = ff_inlink_consume_samples(inlink, s->nb_samples, s->nb_samples, &in);
306  if (ret < 0)
307  return ret;
308  if (ret > 0)
309  return filter_frame(inlink, in);
310 
311  if (ff_inlink_queued_samples(inlink) >= s->nb_samples) {
313  return 0;
314  }
315 
318 
319  return FFERROR_NOT_READY;
320 }
321 
323 {
324  Audio3dScopeContext *s = ctx->priv;
325 
326  for (int n = 0; n < 60; n++)
327  av_frame_free(&s->frames[n]);
328 }
329 
331  {
332  .name = "default",
333  .type = AVMEDIA_TYPE_AUDIO,
334  .config_props = config_input,
335  },
336 };
337 
339  {
340  .name = "default",
341  .type = AVMEDIA_TYPE_VIDEO,
342  .config_props = config_output,
343  },
344 };
345 
347  .name = "a3dscope",
348  .description = NULL_IF_CONFIG_SMALL("Convert input audio to 3d scope video output."),
349  .uninit = uninit,
350  .priv_size = sizeof(Audio3dScopeContext),
351  .activate = activate,
355  .priv_class = &a3dscope_class,
356  .process_command = ff_filter_process_command,
357 };
formats
formats
Definition: signature.h:48
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
Audio3dScopeContext::h
int h
Definition: avf_a3dscope.c:34
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
r
const char * r
Definition: vf_curves.c:126
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
out
FILE * out
Definition: movenc.c:54
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: avf_a3dscope.c:322
audio3dscope_inputs
static const AVFilterPad audio3dscope_inputs[]
Definition: avf_a3dscope.c:330
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
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:326
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
matrix
Definition: vc1dsp.c:42
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
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
ff_all_channel_counts
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:566
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
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
Audio3dScopeContext::w
int w
Definition: avf_a3dscope.c:34
AVOption
AVOption.
Definition: opt.h:251
Audio3dScopeContext::yaw
float yaw
Definition: avf_a3dscope.c:39
b
#define b
Definition: input.c:41
audio3dscope_outputs
static const AVFilterPad audio3dscope_outputs[]
Definition: avf_a3dscope.c:338
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
projection_matrix
static void projection_matrix(float fov, float a, float near, float far, float matrix[4][4])
Definition: avf_a3dscope.c:129
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
Audio3dScopeContext::frame_rate
AVRational frame_rate
Definition: avf_a3dscope.c:43
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
mmultiply
static void mmultiply(const float m2[4][4], const float m1[4][4], float m[4][4])
Definition: avf_a3dscope.c:152
formats.h
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:430
cosf
#define cosf(x)
Definition: libm.h:78
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: avf_a3dscope.c:77
config_input
static int config_input(AVFilterLink *inlink)
Definition: avf_a3dscope.c:106
view_matrix
static void view_matrix(const float eye[3], const float z[3], const float roll, const float pitch, const float yaw, float m[4][4])
Definition: avf_a3dscope.c:165
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1389
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:256
g
const char * g
Definition: vf_curves.c:127
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
filters.h
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
ctx
AVFormatContext * ctx
Definition: movenc.c:48
channels
channels
Definition: aptx.h:31
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
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
draw_dot
static void draw_dot(AVFrame *out, unsigned x, unsigned y, float z, int r, int g, int b)
Definition: avf_a3dscope.c:209
Audio3dScopeContext::nb_samples
int nb_samples
Definition: avf_a3dscope.c:44
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
config_output
static int config_output(AVFilterLink *outlink)
Definition: avf_a3dscope.c:116
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
TFLAGS
#define TFLAGS
Definition: avf_a3dscope.c:54
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
Audio3dScopeContext::pitch
float pitch
Definition: avf_a3dscope.c:38
Audio3dScopeContext::frames
AVFrame * frames[60]
Definition: avf_a3dscope.c:49
parseutils.h
a3dscope_options
static const AVOption a3dscope_options[]
Definition: avf_a3dscope.c:56
sinf
#define sinf(x)
Definition: libm.h:419
vmultiply
static void vmultiply(const float v[4], const float m[4][4], float d[4])
Definition: avf_a3dscope.c:144
av_clipf
av_clipf
Definition: af_crystalizer.c:122
f
f
Definition: af_crystalizer.c:122
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
Audio3dScopeContext::view_matrix
float view_matrix[4][4]
Definition: avf_a3dscope.c:46
sp
#define sp
Definition: regdef.h:63
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
size
int size
Definition: twinvq_data.h:10344
FLAGS
#define FLAGS
Definition: avf_a3dscope.c:53
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
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
M_PI
#define M_PI
Definition: mathematics.h:52
OFFSET
#define OFFSET(x)
Definition: avf_a3dscope.c:52
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
Audio3dScopeContext::size
int size
Definition: avf_a3dscope.c:35
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
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
ret
ret
Definition: filter_design.txt:187
Audio3dScopeContext
Definition: avf_a3dscope.c:32
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
Audio3dScopeContext::zoom
float zoom[3]
Definition: avf_a3dscope.c:40
vdot
static float vdot(const float x[3], const float y[3])
Definition: avf_a3dscope.c:160
ff_all_samplerates
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:551
channel_layout.h
Audio3dScopeContext::projection_matrix
float projection_matrix[4][4]
Definition: avf_a3dscope.c:47
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
AVFilterContext
An instance of a filter.
Definition: avfilter.h:415
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
audio.h
AVFilterFormatsConfig::formats
AVFilterFormats * formats
List of supported formats (pixel or sample).
Definition: avfilter.h:519
FF_FILTER_FORWARD_STATUS
FF_FILTER_FORWARD_STATUS(inlink, outlink)
cr
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:240
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
Audio3dScopeContext::eye
float eye[3]
Definition: avf_a3dscope.c:41
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
activate
static int activate(AVFilterContext *ctx)
Definition: avf_a3dscope.c:295
d
d
Definition: ffmpeg_filter.c:156
h
h
Definition: vp9dsp_template.c:2038
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: avf_a3dscope.c:222
Audio3dScopeContext::fov
float fov
Definition: avf_a3dscope.c:36
ff_avf_a3dscope
const AVFilter ff_avf_a3dscope
Definition: avf_a3dscope.c:346
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(a3dscope)
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
Audio3dScopeContext::roll
float roll
Definition: avf_a3dscope.c:37