[FFmpeg-soc] [soc]: r3340 - aacenc/aacenc.c

kostya subversion at mplayerhq.hu
Sat Aug 16 09:01:18 CEST 2008


Author: kostya
Date: Sat Aug 16 09:01:18 2008
New Revision: 3340

Log:
Factorize out constant part from index calculation in signed codebooks

Modified:
   aacenc/aacenc.c

Modified: aacenc/aacenc.c
==============================================================================
--- aacenc/aacenc.c	(original)
+++ aacenc/aacenc.c	Sat Aug 16 09:01:18 2008
@@ -428,7 +428,9 @@ static int calculate_band_bits(AACEncCon
             for(i = start2; i < start2 + size; i += dim){
                 idx = 0;
                 for(j = 0; j < dim; j++)
-                    idx = idx * range + cpe->ch[channel].icoefs[i+j] + aac_cb_info[cb].maxval;
+                    idx = idx * range + cpe->ch[channel].icoefs[i+j];
+                //it turned out that all signed codebooks use the same offset for index coding
+                idx += 40;
                 score += ff_aac_spectral_bits[cb][idx];
             }
             start2 += 128;
@@ -584,7 +586,9 @@ static void encode_band_coeffs(AACEncCon
         for(i = start; i < start + size; i += dim){
             idx = 0;
             for(j = 0; j < dim; j++)
-                idx = idx * range + cpe->ch[channel].icoefs[i+j] + aac_cb_info[cb].maxval;
+                idx = idx * range + cpe->ch[channel].icoefs[i+j];
+            //it turned out that all signed codebooks use the same offset for index coding
+            idx += 40;
             put_bits(&s->pb, bits[idx], codes[idx]);
         }
     }



More information about the FFmpeg-soc mailing list