Go to the documentation of this file.
32 #define FILTER_FC 1100.0
61 const double gain_lf = -60.0 / (
RT60_LF *
fs) * delay_samples;
62 const double gain_hf = -60.0 / (
RT60_HF *
fs) * delay_samples;
64 const double t = tan(w0 / 2.0);
65 const double g_hf =
ff_exp10(gain_hf / 20.0);
66 const double gd =
ff_exp10((gain_lf-gain_hf) / 20.0);
67 const double sgd = sqrt(gd);
69 ap->
len = delay_samples + 1;
73 if (!ap->
mx || !ap->
my)
77 ap->
a1 = (t - sgd) / ap->
a0;
78 ap->
b0 = (gd*t - sgd) / ap->
a0 * g_hf;
79 ap->
b1 = (gd*t + sgd) / ap->
a0 * g_hf;
93 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;
94 const double r = ap->
b1*x + ap->
b0*ap->
mx[i0] + ap->
a1*ap->
mx[i_n2] + ap->
a0*ap->
mx[i_n1] -
95 ap->
a1*ap->
my[i0] - ap->
b0*ap->
my[i_n2] - ap->
b1*ap->
my[i_n1];
99 ap->
p = (ap->
p+1 >= ap->
len) ? 0 : ap->
p+1;
109 double *dst = (
double *)
out->extended_data[ch];
111 const int stages =
s->stages;
114 for (
int n = 0; n < nb_samples; n++) {
116 for (
int i = 1;
i < stages;
i++) {
119 dst[n] =
ap_run(ap, dst[n]);
134 s->nb_channels =
inlink->channels;
139 for (
int i = 0;
i <
inlink->channels;
i++) {
140 for (
int j = 0; j <
s->stages; j++) {
142 (
double)
av_lfg_get(&
s->c) / 0xffffffff * 2.2917e-3 + 0.83333e-3);
163 const int start = (in->
channels * jobnr) / nb_jobs;
164 const int end = (in->
channels * (jobnr+1)) / nb_jobs;
166 for (
int ch = start; ch < end; ch++)
167 s->filter_channel(
ctx, ch, in,
out);
204 for (
int ch = 0; ch <
s->nb_channels; ch++) {
205 for (
int stage = 0; stage <
s->stages; stage++)
213 #define OFFSET(x) offsetof(ADecorrelateContext, x)
214 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
241 .
name =
"adecorrelate",
244 .priv_class = &adecorrelate_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
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
static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
void(* filter_channel)(AVFilterContext *ctx, int channel, AVFrame *in, AVFrame *out)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static const AVFilterPad inputs[]
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
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.
static const AVOption adecorrelate_options[]
APContext(* ap)[MAX_STAGES]
const char * name
Filter name.
A link between two filters.
static double ap_run(APContext *ap, double x)
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
static int config_input(AVFilterLink *inlink)
static int ap_init(APContext *ap, int fs, double delay)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
A filter pad used for either input or output.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
int channels
number of audio channels, only used for audio.
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define fs(width, name, subs,...)
Context structure for the Lagged Fibonacci PRNG.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFILTER_DEFINE_CLASS(adecorrelate)
static void ap_free(APContext *ap)
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
static void filter_channel_dbl(AVFilterContext *ctx, int ch, AVFrame *in, AVFrame *out)
static av_cold void uninit(AVFilterContext *ctx)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
static av_always_inline av_const double round(double x)
uint8_t ** extended_data
pointers to the data planes/channels.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
const AVFilter ff_af_adecorrelate
@ AV_SAMPLE_FMT_DBLP
double, planar
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static const AVFilterPad outputs[]
#define FILTER_OUTPUTS(array)
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)