[FFmpeg-soc] [soc]: r5531 - in aac-sbr: aacsbr.c aacsbr.h

alexc subversion at mplayerhq.hu
Sun Dec 13 05:24:00 CET 2009


Author: alexc
Date: Sun Dec 13 05:24:00 2009
New Revision: 5531

Log:
Fix the generation and use of s_indexmapped and s_mapped.

Modified:
   aac-sbr/aacsbr.c
   aac-sbr/aacsbr.h

Modified: aac-sbr/aacsbr.c
==============================================================================
--- aac-sbr/aacsbr.c	Sat Dec 12 15:00:06 2009	(r5530)
+++ aac-sbr/aacsbr.c	Sun Dec 13 05:24:00 2009	(r5531)
@@ -1327,6 +1327,7 @@ static void sbr_mapping(AACContext *ac, 
     } else if ((ch_data->bs_frame_class == 2) && (ch_data->bs_pointer > 1)) // VARFIX and bs_pointer > 1
         l_a[1] = ch_data->bs_pointer - 1;
 
+    memset(sbr->s_indexmapped[1], 0, 7*sizeof(sbr->s_indexmapped[1]));
     for (l = 0; l < ch_data->bs_num_env[1]; l++) {
         const unsigned int ilim = sbr->n[ch_data->bs_freq_res[l + 1]];
         uint16_t *table = ch_data->bs_freq_res[l + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
@@ -1343,9 +1344,6 @@ static void sbr_mapping(AACContext *ac, 
                 sbr->q_mapped[l][m - sbr->k[3]] = sbr->noise_facs[ch][k+1][i];
 
         for (i = 0; i < sbr->n[1]; i++) {
-            memset(&sbr->s_indexmapped[l + 1][sbr->f_tablehigh[i] - sbr->k[3]], 0,
-                   (sbr->f_tablehigh[i + 1] - sbr->f_tablehigh[i]) * sizeof(sbr->s_indexmapped[l + 1][0]));
-
             if (ch_data->bs_add_harmonic_flag) {
                 const unsigned int m_midpoint =
                     (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1;
@@ -1367,6 +1365,8 @@ static void sbr_mapping(AACContext *ac, 
                    (table[i + 1] - table[i]) * sizeof(sbr->s_mapped[l][0]));
         }
     }
+
+    memcpy(sbr->s_indexmapped[0], sbr->s_indexmapped[ch_data->bs_num_env[1]], sizeof(sbr->s_indexmapped[0]));
 }
 
 // Estimation of current envelope (14496-3 sp04 p218)
@@ -1430,7 +1430,7 @@ static void sbr_hf_additional_levels(Spe
         for (m = 0; m < sbr->m; m++) {
             const float temp = sbr->e_origmapped[l][m] / (1.0f + sbr->q_mapped[l][m]);
             sbr->q_m[l][m] = sqrtf(temp * sbr->q_mapped[l][m]);
-            sbr->s_m[l][m] = sqrtf(temp * sbr->s_indexmapped[l][m]);
+            sbr->s_m[l][m] = sqrtf(temp * sbr->s_indexmapped[l + 1][m]);
         }
     }
 }

Modified: aac-sbr/aacsbr.h
==============================================================================
--- aac-sbr/aacsbr.h	Sat Dec 12 15:00:06 2009	(r5530)
+++ aac-sbr/aacsbr.h	Sun Dec 13 05:24:00 2009	(r5531)
@@ -155,8 +155,8 @@ typedef struct {
     float              bw_array[2][5];
     float              e_origmapped[7][48];
     float              q_mapped[7][48];
-    float              s_indexmapped[8][48];
-    float              s_mapped[7][48];
+    uint8_t            s_indexmapped[8][48];
+    uint8_t            s_mapped[7][48];
     float              e_curr[7][48];
     float              q_m[7][48];
     float              s_m[7][48];


More information about the FFmpeg-soc mailing list