Go to the documentation of this file.
59 #define OFFSET(x) offsetof(StereoToolsContext, x)
60 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
128 s->inv_atan_shape = 1.0 / atan(
s->sc_level);
129 s->phase_cos_coef = cos(
s->phase / 180 *
M_PI);
130 s->phase_sin_coef = sin(
s->phase / 180 *
M_PI);
140 const double *
src = (
const double *)in->
data[0];
141 const double sb =
s->base < 0 ?
s->base * 0.5 :
s->base;
142 const double sbal = 1 +
s->sbal;
143 const double mpan = 1 +
s->mpan;
144 const double slev =
s->slev;
145 const double mlev =
s->mlev;
146 const double balance_in =
s->balance_in;
147 const double balance_out =
s->balance_out;
148 const double level_in =
s->level_in;
149 const double level_out =
s->level_out;
150 const double sc_level =
s->sc_level;
151 const double delay =
s->delay;
152 const int length =
s->length;
153 const int mute_l =
s->mute_l;
154 const int mute_r =
s->mute_r;
155 const int phase_l =
s->phase_l;
156 const int phase_r =
s->phase_r;
160 int nbuf =
inlink->sample_rate * (
fabs(delay) / 1000.);
174 dst = (
double *)
out->data[0];
177 double L =
src[0],
R =
src[1], l,
r, m,
S, gl, gr, gd;
182 gl = 1. -
FFMAX(0., balance_in);
183 gr = 1. +
FFMIN(0., balance_in);
184 switch (
s->bmode_in) {
191 if (balance_in < 0.) {
194 }
else if (balance_in > 0.) {
204 R =
s->inv_atan_shape * atan(
R * sc_level);
205 L =
s->inv_atan_shape * atan(
L * sc_level);
212 l = m * mlev *
FFMIN(1., 2. - mpan) +
S * slev *
FFMIN(1., 2. - sbal);
213 r = m * mlev *
FFMIN(1., mpan) -
S * slev *
FFMIN(1., sbal);
218 l =
L *
FFMIN(1., 2. - sbal);
220 L = 0.5 * (l +
r) * mlev;
221 R = 0.5 * (l -
r) * slev;
224 l =
L * mlev *
FFMIN(1., 2. - mpan) +
R * slev *
FFMIN(1., 2. - sbal);
245 l = m * mlev *
FFMIN(1., 2. - mpan) +
S * slev *
FFMIN(1., 2. - sbal);
246 r = m * mlev *
FFMIN(1., mpan) -
S * slev *
FFMIN(1., sbal);
251 l =
L * mlev *
FFMIN(1., 2. - mpan) +
R * slev *
FFMIN(1., 2. - sbal);
261 l =
L * mlev *
FFMIN(1., 2. - mpan) +
R * slev *
FFMIN(1., 2. - sbal);
275 L *= (2. * (1. - phase_l)) - 1.;
276 R *= (2. * (1. - phase_r)) - 1.;
282 R =
buffer[(
s->pos - (
int)nbuf + 1 + length) % length];
283 }
else if (delay < 0.) {
284 L =
buffer[(
s->pos - (
int)nbuf + length) % length];
287 l =
L + sb *
L - sb *
R;
288 r =
R + sb *
R - sb *
L;
293 l =
L *
s->phase_cos_coef -
R *
s->phase_sin_coef;
294 r =
L *
s->phase_sin_coef +
R *
s->phase_cos_coef;
299 s->pos = (
s->pos + 2) %
s->length;
301 gl = 1. -
FFMAX(0., balance_out);
302 gr = 1. +
FFMIN(0., balance_out);
303 switch (
s->bmode_out) {
310 if (balance_out < 0.) {
313 }
else if (balance_out > 0.) {
326 if (
ctx->is_disabled) {
341 char *res,
int res_len,
int flags)
376 .
name =
"stereotools",
379 .priv_class = &stereotools_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
A list of supported channel layouts.
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
#define AV_CHANNEL_LAYOUT_STEREO
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
#define FILTER_QUERY_FUNC(func)
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A filter pad used for either input or output.
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
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.
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
int nb_samples
number of audio samples (per channel) described by this frame
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
#define FILTER_OUTPUTS(array)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define flags(name, subs,...)
@ AV_SAMPLE_FMT_DBL
double