aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/opusdsp.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2024-01-29 04:31:43 +0100
committerLynne <dev@lynne.ee>2024-04-27 11:12:07 +0200
commit134dba9544f4251ebf5fbbae72f2cddc390ac195 (patch)
treece38b2e35ed54bfba205061a518b02766a669fa2 /libavcodec/opusdsp.c
parenta2cdb2f5be065a9da87391e2a5c0ae0051219bad (diff)
downloadffmpeg-134dba9544f4251ebf5fbbae72f2cddc390ac195.tar.gz
opusdsp: add ability to modify deemphasis constant
xHE-AAC relies on the same postfilter mechanism that Opus uses to improve clarity (albeit with a steeper deemphasis filter). The code to apply it is identical, it's still just a simple IIR low-pass filter. This commit makes it possible to use alternative constants.
Diffstat (limited to 'libavcodec/opusdsp.c')
-rw-r--r--libavcodec/opusdsp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/opusdsp.c b/libavcodec/opusdsp.c
index 0764d712e4..e61cc36098 100644
--- a/libavcodec/opusdsp.c
+++ b/libavcodec/opusdsp.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "libavutil/attributes.h"
+#include "libavutil/mem_internal.h"
#include "opusdsp.h"
static void postfilter_c(float *data, int period, float *gains, int len)
@@ -43,10 +44,11 @@ static void postfilter_c(float *data, int period, float *gains, int len)
}
}
-static float deemphasis_c(float *y, float *x, float coeff, int len)
+static float deemphasis_c(float *y, float *x, float coeff, const float *weights, int len)
{
+ const float c = weights[0];
for (int i = 0; i < len; i++)
- coeff = y[i] = x[i] + coeff*CELT_EMPH_COEFF;
+ coeff = y[i] = x[i] + coeff*c;
return coeff;
}