[FFmpeg-devel] [PATCH 1/5] AAC: use table for cbrtf(n)*n

Mans Rullgard mans
Mon Jan 11 13:37:45 CET 2010


Up to 10% faster on Cortex-A8.
---
 libavcodec/aac.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavcodec/aac.c b/libavcodec/aac.c
index 2bb05b8..14849d4 100644
--- a/libavcodec/aac.c
+++ b/libavcodec/aac.c
@@ -101,6 +101,7 @@ union float754 {
 static VLC vlc_scalefactors;
 static VLC vlc_spectral[11];
 
+static float cbrt_tab[1<<15];
 
 static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
 {
@@ -555,6 +556,9 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
     ff_init_ff_sine_windows(10);
     ff_init_ff_sine_windows( 7);
 
+    for (i = 0; i < 1<<15; i++)
+        cbrt_tab[i] = cbrtf(i) * i;
+
     return 0;
 }
 
@@ -949,7 +953,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
                                             return -1;
                                         }
                                         n = (1 << n) + get_bits(gb, n);
-                                        coef[coef_tmp_idx + j] *= cbrtf(n) * n;
+                                        coef[coef_tmp_idx + j] *= cbrt_tab[n];
                                     } else
                                         coef[coef_tmp_idx + j] *= vq_ptr[j];
                                 }
-- 
1.6.6




More information about the ffmpeg-devel mailing list