[FFmpeg-cvslog] aacenc: move the generation of ff_aac_pow34sf_tab[]

Rostislav Pehlivanov git at videolan.org
Tue Jul 21 14:06:47 CEST 2015


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Fri Jul 17 22:20:14 2015 +0100| [331c1e74941dc91a29cfaace64311ea6ce73de75] | committer: Michael Niedermayer

aacenc: move the generation of ff_aac_pow34sf_tab[]

This commit moves the generation of ff_aac_pow34sf_tab[] out of the
encoder and into the table generator. The original commit log for
this table in 2011 actually mentions that it should be moved outside
but this never happened.

This is the first commit which cleans up the encoder a little.

Reviewed-by: Claudio Freire <klaussfreire at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=331c1e74941dc91a29cfaace64311ea6ce73de75
---

 libavcodec/aac_tablegen.c      |    2 ++
 libavcodec/aac_tablegen.h      |    5 ++++-
 libavcodec/aac_tablegen_decl.h |    2 ++
 libavcodec/aaccoder.c          |    1 +
 libavcodec/aacenc.c            |    4 ----
 libavcodec/aacenc.h            |    2 --
 6 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aac_tablegen.c b/libavcodec/aac_tablegen.c
index 33a179f..2d13211 100644
--- a/libavcodec/aac_tablegen.c
+++ b/libavcodec/aac_tablegen.c
@@ -33,5 +33,7 @@ int main(void)
 
     WRITE_ARRAY("const", float, ff_aac_pow2sf_tab);
 
+    WRITE_ARRAY("const", float, ff_aac_pow34sf_tab);
+
     return 0;
 }
diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h
index bf71e59..8b223f9 100644
--- a/libavcodec/aac_tablegen.h
+++ b/libavcodec/aac_tablegen.h
@@ -30,12 +30,15 @@
 #else
 #include "libavutil/mathematics.h"
 float ff_aac_pow2sf_tab[428];
+float ff_aac_pow34sf_tab[428];
 
 av_cold void ff_aac_tableinit(void)
 {
     int i;
-    for (i = 0; i < 428; i++)
+    for (i = 0; i < 428; i++) {
         ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0);
+        ff_aac_pow34sf_tab[i] = pow(ff_aac_pow2sf_tab[i], 3.0/4.0);
+    }
 }
 #endif /* CONFIG_HARDCODED_TABLES */
 
diff --git a/libavcodec/aac_tablegen_decl.h b/libavcodec/aac_tablegen_decl.h
index 5105dae..ef86f85 100644
--- a/libavcodec/aac_tablegen_decl.h
+++ b/libavcodec/aac_tablegen_decl.h
@@ -28,9 +28,11 @@
 #if CONFIG_HARDCODED_TABLES
 #define ff_aac_tableinit()
 extern const float ff_aac_pow2sf_tab[428];
+extern const float ff_aac_pow34sf_tab[428];
 #else
 void ff_aac_tableinit(void);
 extern       float ff_aac_pow2sf_tab[428];
+extern       float ff_aac_pow34sf_tab[428];
 #endif /* CONFIG_HARDCODED_TABLES */
 
 #endif /* AVCODEC_AAC_TABLEGEN_DECL_H */
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 5bdba46..17b14d6 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -39,6 +39,7 @@
 #include "aac.h"
 #include "aacenc.h"
 #include "aactab.h"
+#include "aac_tablegen_decl.h"
 
 /** Frequency in Hz for lower limit of noise substitution **/
 #define NOISE_LOW_LIMIT 4500
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index f05f51b..a3c31de 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -58,7 +58,6 @@
         av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \
     }
 
-float ff_aac_pow34sf_tab[428];
 
 static const uint8_t swb_size_1024_96[] = {
     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8,
@@ -855,9 +854,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 
     ff_aac_tableinit();
 
-    for (i = 0; i < 428; i++)
-        ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i]));
-
     avctx->initial_padding = 1024;
     ff_af_queue_init(avctx, &s->afq);
 
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 966c708..4210455 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -95,8 +95,6 @@ typedef struct AACEncContext {
     } buffer;
 } AACEncContext;
 
-extern float ff_aac_pow34sf_tab[428];
-
 void ff_aac_coder_init_mips(AACEncContext *c);
 
 #endif /* AVCODEC_AACENC_H */



More information about the ffmpeg-cvslog mailing list