summaryrefslogtreecommitdiff
path: root/libavfilter/af_anlms.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-05-01 20:01:50 +0200
committerPaul B Mahol <onemda@gmail.com>2023-05-01 20:07:06 +0200
commit561746591660b456e092324f03d393d6dd9147b1 (patch)
tree79dccc7c1ea156e7ea92c6f4a8cc4807b3dd63ec /libavfilter/af_anlms.c
parentf09280dfc47298e47a2e2576c8c37d1c8d4b03b2 (diff)
downloadffmpeg-561746591660b456e092324f03d393d6dd9147b1.tar.gz
avfilter/af_anlms: improve documentation and extend option
Diffstat (limited to 'libavfilter/af_anlms.c')
-rw-r--r--libavfilter/af_anlms.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavfilter/af_anlms.c b/libavfilter/af_anlms.c
index a2c854b0b8..5b412b87cc 100644
--- a/libavfilter/af_anlms.c
+++ b/libavfilter/af_anlms.c
@@ -34,6 +34,7 @@ enum OutModes {
DESIRED_MODE,
OUT_MODE,
NOISE_MODE,
+ ERROR_MODE,
NB_OMODES
};
@@ -73,6 +74,7 @@ static const AVOption anlms_options[] = {
{ "d", "desired", 0, AV_OPT_TYPE_CONST, {.i64=DESIRED_MODE}, 0, 0, AT, "mode" },
{ "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AT, "mode" },
{ "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE}, 0, 0, AT, "mode" },
+ { "e", "error", 0, AV_OPT_TYPE_CONST, {.i64=ERROR_MODE}, 0, 0, AT, "mode" },
{ NULL }
};
@@ -102,7 +104,7 @@ static float process_sample(AudioNLMSContext *s, float input, float desired,
const int order = s->order;
const float leakage = s->leakage;
const float mu = s->mu;
- const float a = 1.f - leakage * mu;
+ const float a = 1.f - leakage;
float sum, output, e, norm, b;
int offset = *offsetp;
@@ -116,7 +118,7 @@ static float process_sample(AudioNLMSContext *s, float input, float desired,
norm = s->eps + sum;
b = mu * e / norm;
if (s->anlmf)
- b *= 4.f * e * e;
+ b *= e * e;
memcpy(tmp, delay + offset, order * sizeof(float));
@@ -129,8 +131,9 @@ static float process_sample(AudioNLMSContext *s, float input, float desired,
switch (s->output_mode) {
case IN_MODE: output = input; break;
case DESIRED_MODE: output = desired; break;
- case OUT_MODE: /*output = output;*/ break;
- case NOISE_MODE: output = desired - output; break;
+ case OUT_MODE: output = desired - output; break;
+ case NOISE_MODE: output = input - output; break;
+ case ERROR_MODE: break;
}
return output;
}