72 #define OFFSET(x) offsetof(AudioVectorScopeContext, x)
73 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
113 if (y >= s->
h || x >= s->
w)
129 int dx =
FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
130 int dy =
FFABS(y1-y0), sy = y0 < y1 ? 1 : -1;
131 int err = (dx>dy ? dx : -dy) / 2, e2;
136 if (x0 == x1 && y0 == y1)
160 for (i = 0; i < s->
h; i++) {
161 for (j = 0; j < s->
w*4; j+=4) {
233 const int hw = s->
hw;
234 const int hh = s->
hh;
237 double zoom = s->
zoom;
250 for (i = 0; i < outlink->
h; i++)
260 switch (insamples->
format) {
262 int16_t *samples = (int16_t *)insamples->
data[0];
265 float sample = samples[i] / (float)INT16_MAX;
272 float *samples = (
float *)insamples->
data[0];
287 int16_t *samples = (int16_t *)insamples->
data[0] + i * 2;
288 float *samplesf = (
float *)insamples->
data[0] + i * 2;
291 switch (insamples->
format) {
293 src[0] = samples[0] / (float)INT16_MAX;
294 src[1] = samples[1] / (float)INT16_MAX;
297 src[0] = samplesf[0];
298 src[1] = samplesf[1];
314 src[0] =
FFSIGN(src[0]) * logf(1 +
FFABS(src[0])) / logf(2);
315 src[1] =
FFSIGN(src[1]) * logf(1 +
FFABS(src[1])) / logf(2);
320 x = ((src[1] - src[0]) * zoom / 2 + 1) * hw;
321 y = (1.0 - (src[0] + src[1]) * zoom / 2) * hh;
323 x = (src[1] * zoom + 1) * hw;
324 y = (src[0] * zoom + 1) * hh;
326 float sx, sy, cx, cy;
330 cx = sx * sqrtf(1 - 0.5 * sy * sy);
331 cy = sy * sqrtf(1 - 0.5 * sx * sx);
332 x = hw + hw *
FFSIGN(cx + cy) * (cx - cy) * .7;
333 y = s->
h - s->
h * fabsf(cx + cy) * .7;
378 .
name =
"avectorscope",
383 .
inputs = audiovectorscope_inputs,
384 .
outputs = audiovectorscope_outputs,
385 .priv_class = &avectorscope_class,
This structure describes decoded (raw) audio or video data.
Main libavfilter public API header.
int max_samples
Maximum number of samples to filter at once.
static void draw_line(AudioVectorScopeContext *s, int x0, int y0, int x1, int y1)
static av_cold void uninit(AVFilterContext *ctx)
int h
agreed upon image height
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_CH_LAYOUT_STEREO
AVFilter ff_avf_avectorscope
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const AVFilterPad audiovectorscope_outputs[]
static double av_q2d(AVRational a)
Convert an AVRational to a double.
A filter pad used for either input or output.
A link between two filters.
int min_samples
Minimum number of samples to filter at once.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
int sample_rate
samples per second
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static int config_input(AVFilterLink *inlink)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
simple assert() macros that are a bit more flexible than ISO C assert().
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
static const AVOption avectorscope_options[]
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
audio channel layout utility functions
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static const AVFilterPad audiovectorscope_inputs[]
AVFilterContext * src
source filter
int partial_buf_size
Size of the partial buffer to allocate.
static const AVFilterPad outputs[]
static void draw_dot(AudioVectorScopeContext *s, unsigned x, unsigned y)
AVFilterFormats * out_samplerates
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
AVFILTER_DEFINE_CLASS(avectorscope)
static int config_output(AVFilterLink *outlink)
A list of supported channel layouts.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
static const AVFilterPad inputs[]
AVSampleFormat
Audio sample formats.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
static av_always_inline float cbrtf(float x)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
offset must point to AVRational
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
offset must point to two consecutive integers
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int query_formats(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
AVFilterContext * dst
dest filter
static enum AVSampleFormat sample_fmts[]
static void fade(AudioVectorScopeContext *s)
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
int nb_samples
number of audio samples (per channel) described by this frame
AVFilterFormats * out_formats