[FFmpeg-soc] [soc]: r3056 - aac/aac.c

superdump subversion at mplayerhq.hu
Thu Aug 7 13:30:19 CEST 2008


Author: superdump
Date: Thu Aug  7 13:30:19 2008
New Revision: 3056

Log:
Move loops over a window group inside conditional statements to avoid
unnecessarily rechecking the condition


Modified:
   aac/aac.c

Modified: aac/aac.c
==============================================================================
--- aac/aac.c	(original)
+++ aac/aac.c	Thu Aug  7 13:30:19 2008
@@ -1080,20 +1080,20 @@ static void apply_mid_side_stereo(Channe
     int g, i, k, gp;
     const uint16_t * offsets = ics->swb_offset;
     for (g = 0; g < ics->num_window_groups; g++) {
-        for (gp = 0; gp < ics->group_len[g]; gp++) {
             for (i = 0; i < ics->max_sfb; i++) {
                 if (ms->mask[g][i] &&
                     cpe->ch[0].band_type[g][i] < NOISE_BT && cpe->ch[1].band_type[g][i] < NOISE_BT) {
+        for (gp = 0; gp < ics->group_len[g]; gp++) {
                     for (k = offsets[i]; k < offsets[i+1]; k++) {
-                        float tmp = ch0[k] - ch1[k];
-                        ch0[k] += ch1[k];
-                        ch1[k] = tmp;
+                        float tmp = ch0[gp*128 + k] - ch1[gp*128 + k];
+                        ch0[gp*128 + k] += ch1[gp*128 + k];
+                        ch1[gp*128 + k] = tmp;
                     }
                 }
             }
-            ch0 += 128;
-            ch1 += 128;
         }
+        ch0 += ics->group_len[g]*128;
+        ch1 += ics->group_len[g]*128;
     }
 }
 
@@ -1109,9 +1109,9 @@ static void apply_intensity_stereo(Chann
     int c;
     float scale;
     for (g = 0; g < ics->num_window_groups; g++) {
-        for (gp = 0; gp < ics->group_len[g]; gp++) {
             for (i = 0; i < ics->max_sfb;) {
                 if (sce1->band_type[g][i] == INTENSITY_BT || sce1->band_type[g][i] == INTENSITY_BT2) {
+        for (gp = 0; gp < ics->group_len[g]; gp++) {
                     const int bt_run_end = sce1->band_type_run_end[g][i];
                     while (i < bt_run_end) {
                         c = -1 + 2 * (sce1->band_type[g][i] - 14);
@@ -1119,15 +1119,15 @@ static void apply_intensity_stereo(Chann
                             c *= 1 - 2 * cpe->ms.mask[g][i];
                         scale = c * sce1->sf[g][i];
                         for (k = offsets[i]; k < offsets[i+1]; k++)
-                            coef1[k] = scale * coef0[k];
+                            coef1[gp*128 + k] = scale * coef0[gp*128 + k];
                         i++;
                     }
+        }
                 } else
                     i = sce1->band_type_run_end[g][i];
             }
-            coef0 += 128;
-            coef1 += 128;
-        }
+        coef0 += ics->group_len[g]*128;
+        coef1 += ics->group_len[g]*128;
     }
 }
 



More information about the FFmpeg-soc mailing list