There is no reason for computing cbrtf at runtime; we have a table for
this.

Yields a negligible speedup.

Signed-off-by: Ganesh Ajjanagadde <gajja...@gmail.com>
---
 libavcodec/aacenc.c              | 2 ++
 libavcodec/aacenc_quantization.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 023260a..11c9272 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -45,6 +45,7 @@
 #include "aacenc.h"
 #include "aacenctab.h"
 #include "aacenc_utils.h"
+#include "cbrt_data.h"
 
 #include "psymodel.h"
 
@@ -897,6 +898,7 @@ alloc_fail:
 static av_cold void aac_encode_init_tables(void)
 {
     ff_aac_tableinit();
+    ff_cbrt_tableinit();
 }
 
 static av_cold int aac_encode_init(AVCodecContext *avctx)
diff --git a/libavcodec/aacenc_quantization.h b/libavcodec/aacenc_quantization.h
index 4250407..29b3c97 100644
--- a/libavcodec/aacenc_quantization.h
+++ b/libavcodec/aacenc_quantization.h
@@ -32,6 +32,7 @@
 #include "aacenc.h"
 #include "aacenctab.h"
 #include "aacenc_utils.h"
+#include "cbrt_data.h"
 
 /**
  * Calculate rate distortion cost for quantizing with given codebook
@@ -105,7 +106,7 @@ static av_always_inline float 
quantize_and_encode_band_cost_template(
                         curbits += 21;
                     } else {
                         int c = av_clip_uintp2(quant(t, Q, ROUNDING), 13);
-                        quantized = c*cbrtf(c)*IQ;
+                        quantized = av_int2float(ff_cbrt_tab[c])*IQ;
                         curbits += av_log2(c)*2 - 4 + 1;
                     }
                 } else {
-- 
2.7.3

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to