[FFmpeg-soc] [soc]: r1542 - in amr: amrnbfloatdata.h amrnbfloatdec.c

superdump subversion at mplayerhq.hu
Mon Dec 10 16:42:32 CET 2007


Author: superdump
Date: Mon Dec 10 16:42:32 2007
New Revision: 1542

Log:
Correct index used for pitch gain and fixed gain factor in MODE_475


Modified:
   amr/amrnbfloatdata.h
   amr/amrnbfloatdec.c

Modified: amr/amrnbfloatdata.h
==============================================================================
--- amr/amrnbfloatdata.h	(original)
+++ amr/amrnbfloatdata.h	Mon Dec 10 16:42:32 2007
@@ -1841,7 +1841,7 @@ static const float energy_mean[8] = { 33
 static const float energy_pred_fac[4] = { 0.68, 0.58, 0.34, 0.19 };
 
 // gain table for 4.75 kbps mode
-// first index has even/odd indices for even/odd subframes
+// first index has even/odd indices for subframes 0,2/1,3
 // second index is {pitch_gain, fixed_gain_factor}
 static const float gains_MODE_475[512][2] = {
 {0.049561, 0.031250}, {0.033081, 0.034180}, {0.175354, 0.277100}, {0.138306, 0.830566},

Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c	(original)
+++ amr/amrnbfloatdec.c	Mon Dec 10 16:42:32 2007
@@ -1057,6 +1057,7 @@ static int amrnb_decode_frame(AVCodecCon
     int i, subframe;                         // counters
     int index = 0;                           // index counter (different modes
                                              // advance through amr_prms differently)
+    int gains_index_MODE_475 = 0;            // MODE_475 gains index coded every other subframe
     enum Mode speech_mode = MODE_475;        // ???
 
     // decode the bitstream to amr parameters
@@ -1182,8 +1183,13 @@ static int amrnb_decode_frame(AVCodecCon
             p->fixed_gain_factor = gains_low[p->amr_prms[index]][1];
             index++;
         }else {
-            p->pitch_gain[4] =     gains_MODE_475[p->amr_prms[index] + ( (!(subframe&1)) <<1)][0];
-            p->fixed_gain_factor = gains_MODE_475[p->amr_prms[index] + ( (!(subframe&1)) <<1)][1];
+            // gain index is only coded in subframes 0,2
+            if(!(subframe&1)) {
+                gains_index_MODE_475 = p->amr_prms[index]<<1;
+                index++;
+            }
+            p->pitch_gain[4] =     gains_MODE_475[gains_index_MODE_475 + (subframe&1)][0];
+            p->fixed_gain_factor = gains_MODE_475[gains_index_MODE_475 + (subframe&1)][1];
             index++;
         }
 



More information about the FFmpeg-soc mailing list