Go to the documentation of this file.
32 #define SAMPLE_FORMAT float
43 #define EPSILON (1.f / (1 << 22))
45 #define SAMPLE_FORMAT double
56 #define EPSILON (1.0 / (1LL << 51))
59 #define fn3(a,b) a##_##b
60 #define fn2(a,b) fn3(a,b)
61 #define fn(a) fn2(a, SAMPLE_FORMAT)
67 const ftype v1 =
a[0] *
b[0] +
a[1] * v3;
68 const ftype v2 =
b[1] +
a[1] *
b[0] +
a[2] * v3;
70 b[0] =
TWO * v1 -
b[0];
71 b[1] =
TWO * v2 -
b[1];
73 return m[0] *
v0 + m[1] * v1 + m[2] * v2;
82 const ftype dqfactor =
s->dqfactor;
83 const int dftype =
s->dftype;
95 da[0] =
ONE / (
ONE + dg * (dg + k));
106 da[0] =
ONE / (
ONE + dg * (dg + k));
117 da[0] =
ONE / (
ONE + dg * (dg + k));
128 da[0] =
ONE / (
ONE + dg * (dg + k));
148 const ftype makeup =
s->makeup;
149 const ftype ratio =
s->ratio;
152 const ftype release =
s->release_coef;
153 const ftype attack =
s->attack_coef;
154 const ftype tqfactor =
s->tqfactor;
155 const ftype itqfactor =
ONE / tqfactor;
159 const int detection =
s->detection;
160 const int direction =
s->direction;
161 const int tftype =
s->tftype;
162 const int mode =
s->mode;
166 for (
int ch = start; ch < end; ch++) {
170 const ftype threshold = detection == 0 ?
state[5] :
s->threshold;
174 state[5] = threshold;
176 memcpy(fa,
state + 8,
sizeof(fa));
177 memcpy(fm,
state + 11,
sizeof(fm));
179 for (
int n = 0; n <
out->nb_samples; n++) {
180 ftype detect, gain, v, listen;
184 detect =
FABS(detect);
190 if (direction == 0 && detect < threshold) {
191 detect =
CLIP(
ONE + makeup + (threshold - detect) * ratio,
ONE,
range);
193 detect =
ONE / detect;
194 }
else if (direction == 1 && detect > threshold) {
195 detect =
CLIP(
ONE + makeup + (detect - threshold) * ratio,
ONE,
range);
197 detect =
ONE / detect;
212 if (
state[4] != detect) {
213 state[4] = gain = detect;
217 k = itqfactor / gain;
219 fa[0] =
ONE / (
ONE + fg * (fg + k));
224 fm[1] = k * (gain * gain -
ONE);
236 fm[1] = k * (gain -
ONE);
237 fm[2] = gain * gain -
ONE;
248 fm[1] = k * (
ONE - gain) * gain;
249 fm[2] =
ONE - gain * gain;
255 v =
mode == -1 ? listen : v;
256 dst[n] =
ctx->is_disabled ?
src[n] : v;
259 memcpy(
state + 8, fa,
sizeof(fa));
260 memcpy(
state + 11, fm,
sizeof(fm));
This structure describes decoded (raw) audio or video data.
int nb_channels
Number of channels in this layout.
static double get_coef(double x, double sr)
AVChannelLayout ch_layout
Channel layout of the audio data.
static int fn() filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int sample_rate
Sample rate of the audio data.
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
uint8_t ** extended_data
pointers to the data planes/channels.
Used for passing data between threads.
static ftype fn() get_svf(ftype in, const ftype *m, const ftype *a, ftype *b)
static int fn() filter_prepare(AVFilterContext *ctx)