33#define FILTER_FC 1100.0
62 const double gain_lf = -60.0 / (
RT60_LF *
fs) * delay_samples;
63 const double gain_hf = -60.0 / (
RT60_HF *
fs) * delay_samples;
65 const double t = tan(w0 / 2.0);
66 const double g_hf =
ff_exp10(gain_hf / 20.0);
67 const double gd =
ff_exp10((gain_lf-gain_hf) / 20.0);
68 const double sgd = sqrt(gd);
70 ap->
len = delay_samples + 1;
74 if (!ap->
mx || !ap->
my)
78 ap->
a1 = (t - sgd) / ap->
a0;
79 ap->
b0 = (gd*t - sgd) / ap->
a0 * g_hf;
80 ap->
b1 = (gd*t + sgd) / ap->
a0 * g_hf;
94 const int i0 = ((ap->
p < 1) ? ap->
len : ap->
p)-1, i_n1 = ap->
p, i_n2 = (ap->
p+1 >= ap->
len) ? 0 : ap->
p+1;
95 const double r = ap->
b1*x + ap->
b0*ap->
mx[i0] + ap->
a1*ap->
mx[i_n2] + ap->
a0*ap->
mx[i_n1] -
96 ap->
a1*ap->
my[i0] - ap->
b0*ap->
my[i_n2] - ap->
b1*ap->
my[i_n1];
100 ap->
p = (ap->
p+1 >= ap->
len) ? 0 : ap->
p+1;
110 double *
dst = (
double *)
out->extended_data[ch];
112 const int stages =
s->stages;
115 for (
int n = 0; n < nb_samples; n++) {
117 for (
int i = 1;
i < stages;
i++) {
141 for (
int j = 0; j <
s->stages; j++) {
143 (
double)
av_lfg_get(&
s->c) / 0xffffffff * 2.2917e-3 + 0.83333e-3);
167 for (
int ch = start; ch < end; ch++)
168 s->filter_channel(
ctx, ch, in,
out);
205 for (
int ch = 0; ch <
s->nb_channels; ch++) {
206 for (
int stage = 0; stage <
s->stages; stage++)
214#define OFFSET(x) offsetof(ADecorrelateContext, x)
215#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
235 .p.name =
"adecorrelate",
237 .p.priv_class = &adecorrelate_class,
static int fn filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const AVFilterPad inputs[]
static int config_input(AVFilterLink *inlink)
static const AVOption adecorrelate_options[]
static void ap_free(APContext *ap)
static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int config_input(AVFilterLink *inlink)
static void filter_channel_dbl(AVFilterContext *ctx, int ch, AVFrame *in, AVFrame *out)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static av_cold void uninit(AVFilterContext *ctx)
static double ap_run(APContext *ap, double x)
static int ap_init(APContext *ap, int fs, double delay)
const FFFilter ff_af_adecorrelate
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
#define fs(width, name, subs,...)
Public libavutil channel layout APIs header.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
channel
Use these values when setting the channel map with ebur128_set_channel().
internal math functions header
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
@ AV_SAMPLE_FMT_DBLP
double, planar
static av_cold void uninit(AVBitStreamFilterContext *ctx)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_always_inline av_const double round(double x)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
void(* filter_channel)(AVFilterContext *ctx, int channel, AVFrame *in, AVFrame *out)
APContext(* ap)[MAX_STAGES]
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A link between two filters.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
AVChannelLayout ch_layout
Channel layout of the audio data.
uint8_t ** extended_data
pointers to the data planes/channels.
Context structure for the Lagged Fibonacci PRNG.
Used for passing data between threads.
static AVFormatContext * ctx