Browse code

AAC: Reduce depth of vlc_spectral tables to 2

Up to 6% faster overall on i7, no change on A8.

Originally committed as revision 21191 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/01/14 01:46:39
Showing 2 changed files
... ...
@@ -508,17 +508,17 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
508 508
     avccontext->sample_fmt = SAMPLE_FMT_S16;
509 509
     avccontext->frame_size = 1024;
510 510
 
511
-    AAC_INIT_VLC_STATIC( 0, 144);
512
-    AAC_INIT_VLC_STATIC( 1, 114);
513
-    AAC_INIT_VLC_STATIC( 2, 188);
514
-    AAC_INIT_VLC_STATIC( 3, 180);
515
-    AAC_INIT_VLC_STATIC( 4, 172);
516
-    AAC_INIT_VLC_STATIC( 5, 140);
517
-    AAC_INIT_VLC_STATIC( 6, 168);
518
-    AAC_INIT_VLC_STATIC( 7, 114);
519
-    AAC_INIT_VLC_STATIC( 8, 262);
520
-    AAC_INIT_VLC_STATIC( 9, 248);
521
-    AAC_INIT_VLC_STATIC(10, 384);
511
+    AAC_INIT_VLC_STATIC( 0, 304);
512
+    AAC_INIT_VLC_STATIC( 1, 270);
513
+    AAC_INIT_VLC_STATIC( 2, 550);
514
+    AAC_INIT_VLC_STATIC( 3, 300);
515
+    AAC_INIT_VLC_STATIC( 4, 328);
516
+    AAC_INIT_VLC_STATIC( 5, 294);
517
+    AAC_INIT_VLC_STATIC( 6, 306);
518
+    AAC_INIT_VLC_STATIC( 7, 268);
519
+    AAC_INIT_VLC_STATIC( 8, 510);
520
+    AAC_INIT_VLC_STATIC( 9, 366);
521
+    AAC_INIT_VLC_STATIC(10, 462);
522 522
 
523 523
     dsputil_init(&ac->dsp, avccontext);
524 524
 
... ...
@@ -989,7 +989,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
989 989
                         int len = off_len;
990 990
 
991 991
                         do {
992
-                            const int index = get_vlc2(gb, vlc_tab, 6, 3);
992
+                            const int index = get_vlc2(gb, vlc_tab, 8, 2);
993 993
                             unsigned cb_idx;
994 994
 
995 995
                             if (index >= cb_size) {
... ...
@@ -1009,7 +1009,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
1009 1009
                         int len = off_len;
1010 1010
 
1011 1011
                         do {
1012
-                            const int index = get_vlc2(gb, vlc_tab, 6, 3);
1012
+                            const int index = get_vlc2(gb, vlc_tab, 8, 2);
1013 1013
                             unsigned nnz;
1014 1014
                             unsigned cb_idx;
1015 1015
                             uint32_t bits;
... ...
@@ -1033,7 +1033,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
1033 1033
                         int len = off_len;
1034 1034
 
1035 1035
                         do {
1036
-                            const int index = get_vlc2(gb, vlc_tab, 6, 3);
1036
+                            const int index = get_vlc2(gb, vlc_tab, 8, 2);
1037 1037
                             unsigned cb_idx;
1038 1038
 
1039 1039
                             if (index >= cb_size) {
... ...
@@ -1054,7 +1054,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
1054 1054
                         int len = off_len;
1055 1055
 
1056 1056
                         do {
1057
-                            const int index = get_vlc2(gb, vlc_tab, 6, 3);
1057
+                            const int index = get_vlc2(gb, vlc_tab, 8, 2);
1058 1058
                             unsigned nnz;
1059 1059
                             unsigned cb_idx;
1060 1060
                             unsigned sign;
... ...
@@ -1079,7 +1079,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
1079 1079
                         int len = off_len;
1080 1080
 
1081 1081
                         do {
1082
-                            const int index = get_vlc2(gb, vlc_tab, 6, 3);
1082
+                            const int index = get_vlc2(gb, vlc_tab, 8, 2);
1083 1083
                             unsigned nzt, nnz;
1084 1084
                             unsigned cb_idx;
1085 1085
                             uint32_t bits;
... ...
@@ -37,7 +37,7 @@
37 37
 #include <stdint.h>
38 38
 
39 39
 #define AAC_INIT_VLC_STATIC(num, size) \
40
-    INIT_VLC_STATIC(&vlc_spectral[num], 6, ff_aac_spectral_sizes[num], \
40
+    INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
41 41
          ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
42 42
         ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
43 43
         size);