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

kostya subversion at mplayerhq.hu
Sun Aug 17 11:02:18 CEST 2008


Author: kostya
Date: Sun Aug 17 11:02:18 2008
New Revision: 3389

Log:
Since escape codebook is an unsigned codebook as well, use joint calculation for them

Modified:
   aacenc/aacenc.c

Modified: aacenc/aacenc.c
==============================================================================
--- aacenc/aacenc.c	(original)
+++ aacenc/aacenc.c	Sun Aug 17 11:02:18 2008
@@ -382,35 +382,22 @@ static int calculate_band_bits(AACEncCon
     dim = cb < FIRST_PAIR_BT ? 4 : 2;
 
     start2 = start;
-    if(cb == ESC_BT){
+    if(IS_CODEBOOK_UNSIGNED(cb)){
         int coef_abs[2];
         for(w = win; w < win + group_len; w++){
             for(i = start2; i < start2 + size; i += dim){
                 idx = 0;
                 for(j = 0; j < dim; j++){
                     coef_abs[j] = FFABS(cpe->ch[channel].icoefs[i+j]);
-                    idx = idx*17 + FFMIN(coef_abs[j], 16);
+                    idx = idx * range + FFMIN(coef_abs[j], 16);
                 }
                 score += ff_aac_spectral_bits[cb][idx];
-                for(j = 0; j < dim; j++)
+                for(j = 0; j < dim; j++){
                     if(cpe->ch[channel].icoefs[i+j])
                         score++;
-                for(j = 0; j < dim; j++)
-                    if(coef_abs[j] > 15)
+                    if(cb == ESC_BT && coef_abs[j] > 15)
                         score += av_log2(coef_abs[j]) * 2 - 4 + 1;
-            }
-            start2 += 128;
-       }
-    }else if(IS_CODEBOOK_UNSIGNED(cb)){
-        for(w = win; w < win + group_len; w++){
-            for(i = start2; i < start2 + size; i += dim){
-                idx = 0;
-                for(j = 0; j < dim; j++)
-                    idx = idx * range + FFABS(cpe->ch[channel].icoefs[i+j]);
-                score += ff_aac_spectral_bits[cb][idx];
-                for(j = 0; j < dim; j++)
-                     if(cpe->ch[channel].icoefs[i+j])
-                         score++;
+                }
             }
             start2 += 128;
         }



More information about the FFmpeg-soc mailing list