aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/opustab.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/opustab.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/opustab.c')
-rw-r--r--libavcodec/opustab.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/opustab.c b/libavcodec/opustab.c
index 2a57511177..47624fe651 100644
--- a/libavcodec/opustab.c
+++ b/libavcodec/opustab.c
@@ -1159,3 +1159,31 @@ const uint32_t * const ff_celt_pvq_u_row[15] = {
celt_pvq_u + 1207, celt_pvq_u + 1226, celt_pvq_u + 1240,
celt_pvq_u + 1248, celt_pvq_u + 1254, celt_pvq_u + 1257
};
+
+/* Deemphasis constant (alpha_p), as specified in RFC6716 as 0.8500061035.
+ * libopus uses a slighly rounded constant, set to 0.85 exactly,
+ * to simplify its fixed-point version, but it's not significant to impact
+ * compliance. */
+#define CELT_EMPH_COEFF 0.8500061035f
+
+DECLARE_ALIGNED(16, const float, ff_opus_deemph_weights)[] = {
+ CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF*CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+
+ 0,
+ CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+
+ 0,
+ 0,
+ CELT_EMPH_COEFF,
+ CELT_EMPH_COEFF*CELT_EMPH_COEFF,
+
+ 0,
+ 0,
+ 0,
+ CELT_EMPH_COEFF,
+};