diff mbox series

[FFmpeg-devel,v3,06/10] aactab: add deemphasis tables for USAC

Message ID 20240525022813.2292001-7-dev@lynne.ee
State New
Headers show
Series aacdec: add a native xHE-AAC decoder | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Lynne May 25, 2024, 2:27 a.m. UTC
---
 libavcodec/aactab.c | 25 +++++++++++++++++++++++++
 libavcodec/aactab.h |  2 ++
 2 files changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index 3718b81a07..8ce5e43974 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -3377,3 +3377,28 @@  const DECLARE_ALIGNED(32, int, ff_aac_eld_window_480_fixed)[1800] = {
     0xffecff1c, 0xffed391e, 0xffed740c, 0xffedafb1,
     0xffedebe1, 0xffee287d, 0xffee654e, 0xffeea23f,
 };
+
+/* As specified by ISO/IEC 23003 */
+#define USAC_EMPH_COEFF 0.68
+
+DECLARE_ALIGNED(16, const float, ff_aac_deemph_weights)[16] = {
+    USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF*USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+
+    0,
+    USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+
+    0,
+    0,
+    USAC_EMPH_COEFF,
+    USAC_EMPH_COEFF*USAC_EMPH_COEFF,
+
+    0,
+    0,
+    0,
+    USAC_EMPH_COEFF,
+};
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
index e1a2d8b9a1..91262380d4 100644
--- a/libavcodec/aactab.h
+++ b/libavcodec/aactab.h
@@ -64,6 +64,8 @@  DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_480)[1800];
 DECLARE_ALIGNED(32, extern const int,   ff_aac_eld_window_480_fixed)[1800];
 // @}
 
+extern const float ff_aac_deemph_weights[16];
+
 /* Initializes data shared between float decoder and encoder. */
 void ff_aac_float_common_init(void);