55 #define OFFSET(x) offsetof(AudioVectorScopeContext, x)
56 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
88 if (y >= s->
h || x >= s->
w)
109 for (i = 0; i < s->
h; i++) {
110 for (j = 0; j < s->
w*4; j+=4) {
185 const int hw = s->
hw;
186 const int hh = s->
hh;
188 const double zoom = s->
zoom;
200 for (i = 0; i < outlink->
h; i++)
207 switch (insamples->
format) {
210 int16_t *
src = (int16_t *)insamples->
data[0] + i * 2;
213 x = ((src[1] - src[0]) * zoom / (
float)(UINT16_MAX) + 1) * hw;
214 y = (1.0 - (src[0] + src[1]) * zoom / (
float)UINT16_MAX) * hh;
216 x = (src[1] * zoom / (float)INT16_MAX + 1) * hw;
217 y = (src[0] * zoom / (float)INT16_MAX + 1) * hh;
219 float sx, sy, cx, cy;
221 sx = src[1] * zoom / (float)INT16_MAX;
222 sy = src[0] * zoom / (float)INT16_MAX;
223 cx = sx * sqrtf(1 - 0.5*sy*sy);
224 cy = sy * sqrtf(1 - 0.5*sx*sx);
225 x = hw + hw *
FFSIGN(cx + cy) * (cx - cy) * .7;
226 y = s->
h - s->
h *
FFABS(cx + cy) * .7;
234 float *
src = (
float *)insamples->
data[0] + i * 2;
237 x = ((src[1] - src[0]) * zoom / 2 + 1) * hw;
238 y = (1.0 - (src[0] + src[1]) * zoom / 2) * hh;
240 x = (src[1] * zoom + 1) * hw;
241 y = (src[0] * zoom + 1) * hh;
243 float sx, sy, cx, cy;
247 cx = sx * sqrtf(1 - 0.5 * sy * sy);
248 cy = sy * sqrtf(1 - 0.5 * sx * sx);
249 x = hw + hw *
FFSIGN(cx + cy) * (cx - cy) * .7;
250 y = s->
h - s->
h *
FFABS(cx + cy) * .7;
290 .
name =
"avectorscope",
295 .
inputs = audiovectorscope_inputs,
296 .
outputs = audiovectorscope_outputs,
297 .priv_class = &avectorscope_class,
This structure describes decoded (raw) audio or video data.
static const AVFilterPad outputs[]
Main libavfilter public API header.
int max_samples
Maximum number of samples to filter at once.
static av_cold void uninit(AVFilterContext *ctx)
int h
agreed upon image height
static enum AVSampleFormat formats[]
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.
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 rational to double.
A filter pad used for either input or output.
A link between two filters.
int width
width and height of the video frame
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; if left to 0/0, will be automatically be cop...
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 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...
AVSampleFormat
Audio sample formats.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
rational number numerator/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.
int nb_samples
number of audio samples (per channel) described by this frame
AVFilterFormats * out_formats