diff mbox series

[FFmpeg-devel,1/6] avcodec/aac_defines: Make macro more general

Message ID 20210128162646.2811269-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/6] avcodec/aac_defines: Make macro more general | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 28, 2021, 4:26 p.m. UTC
The floating point AAC decoder shares lots of stuff (mainly tables)
with other components; this is not so much true for the fixed point
AAC decoder: There are tables for which the fixed point decoder is the
only user whereas the floating point analogue is shared with other
components. This can be exploited to make the fixed point tables static
and because this has only been done for several KBD tables, the macro is
designed for them. This commit makes it more general.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/aac_defines.h     |  4 ++--
 libavcodec/aacdec_fixed.c    |  4 ++--
 libavcodec/aacdec_template.c | 22 +++++++++++-----------
 3 files changed, 15 insertions(+), 15 deletions(-)

Comments

Lynne Jan. 29, 2021, 8:20 a.m. UTC | #1
Jan 28, 2021, 17:26 by andreas.rheinhardt@gmail.com:

> The floating point AAC decoder shares lots of stuff (mainly tables)
> with other components; this is not so much true for the fixed point
> AAC decoder: There are tables for which the fixed point decoder is the
> only user whereas the floating point analogue is shared with other
> components. This can be exploited to make the fixed point tables static
> and because this has only been done for several KBD tables, the macro is
> designed for them. This commit makes it more general.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>

LGTM, could you push this along with the next AAC patch?
diff mbox series

Patch

diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index 74ac011785..e94475ac54 100644
--- a/libavcodec/aac_defines.h
+++ b/libavcodec/aac_defines.h
@@ -34,7 +34,7 @@ 
 
 #define AAC_RENAME(x)       x ## _fixed
 #define AAC_RENAME_32(x)    x ## _fixed_32
-#define AAC_KBD_RENAME(x)   aac_ ## x ## _fixed
+#define AAC_RENAME2(x)      x ## _fixed
 typedef int                 INTFLOAT;
 typedef unsigned            UINTFLOAT;  ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations.
 typedef int64_t             INT64FLOAT;
@@ -84,7 +84,7 @@  typedef int                 AAC_SIGNE;
 
 #define AAC_RENAME(x)       x
 #define AAC_RENAME_32(x)    x
-#define AAC_KBD_RENAME(x)   ff_aac_ ## x
+#define AAC_RENAME2(x)      ff_ ## x
 typedef float               INTFLOAT;
 typedef float               UINTFLOAT;
 typedef float               INT64FLOAT;
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 4d82b7b1aa..e555dac362 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -86,8 +86,8 @@ 
 #include <math.h>
 #include <string.h>
 
-DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_long_1024))[1024];
-DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_short_128))[128];
+DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_1024))[1024];
+DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128];
 
 static av_always_inline void reset_predict_state(PredictorState *ps)
 {
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index fbe3074071..ea39f547b0 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -1237,8 +1237,8 @@  static av_cold void aac_static_table_init(void)
     AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120);
     ff_aac_float_common_init();
 #else
-    AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_long_1024), 4.0, 1024);
-    AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_short_128), 6.0, 128);
+    AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
+    AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
     AAC_RENAME(ff_init_ff_sine_windows)(10);
     AAC_RENAME(ff_init_ff_sine_windows)( 7);
 #endif
@@ -2644,10 +2644,10 @@  static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
 static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
                                    INTFLOAT *in, IndividualChannelStream *ics)
 {
-    const INTFLOAT *lwindow      = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
-    const INTFLOAT *swindow      = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
-    const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
-    const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+    const INTFLOAT *lwindow      = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
+    const INTFLOAT *swindow      = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
+    const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
+    const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
 
     if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
         ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
@@ -2704,8 +2704,8 @@  static void update_ltp(AACContext *ac, SingleChannelElement *sce)
     IndividualChannelStream *ics = &sce->ics;
     INTFLOAT *saved     = sce->saved;
     INTFLOAT *saved_ltp = sce->coeffs;
-    const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
-    const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+    const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
+    const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
     int i;
 
     if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
@@ -2743,9 +2743,9 @@  static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
     INTFLOAT *in    = sce->coeffs;
     INTFLOAT *out   = sce->ret;
     INTFLOAT *saved = sce->saved;
-    const INTFLOAT *swindow      = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
-    const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
-    const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+    const INTFLOAT *swindow      = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
+    const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
+    const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
     INTFLOAT *buf  = ac->buf_mdct;
     INTFLOAT *temp = ac->temp;
     int i;