[FFmpeg-soc] [soc]: r4163 - amr/amrnbfloatdec.c

kmalaussene subversion at mplayerhq.hu
Wed Mar 4 21:25:30 CET 2009


Author: kmalaussene
Date: Wed Mar  4 21:25:29 2009
New Revision: 4163

Log:
Simplify further gain decoding.

Modified:
   amr/amrnbfloatdec.c

Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c	Wed Mar  4 21:13:10 2009	(r4162)
+++ amr/amrnbfloatdec.c	Wed Mar  4 21:25:29 2009	(r4163)
@@ -701,17 +701,14 @@ static void decode_gains(AMRContext *p, 
     if(mode == MODE_122 || mode == MODE_795) {
         p->pitch_gain[4]     = qua_gain_pit [amr_subframe->p_gain];
         fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain];
-    }else if(mode >= MODE_67) {
-        p->pitch_gain[4]     = gains_high[amr_subframe->p_gain][0];
-        fixed_gain_factor = gains_high[amr_subframe->p_gain][1];
-    }else if(mode >= MODE_515) {
-        p->pitch_gain[4]     = gains_low[amr_subframe->p_gain][0];
-        fixed_gain_factor = gains_low[amr_subframe->p_gain][1];
     }else {
-        // gain index is only coded in subframes 0,2
-        const int index = (p->frame.subframe[subframe&2].p_gain << 1) + (subframe&1);
-        p->pitch_gain[4]     = gains_MODE_475[index][0];
-        fixed_gain_factor = gains_MODE_475[index][1];
+        // gain index is only coded in subframes 0,2 for MODE_475
+        const float *gains = mode >= MODE_67  ? gains_high[amr_subframe->p_gain] :
+                             mode >= MODE_515 ? gains_low [amr_subframe->p_gain] :
+                                                gains_MODE_475[(p->frame.subframe[subframe&2].p_gain << 1) + (subframe&1)];
+
+        p->pitch_gain[4]  = gains[0];
+        fixed_gain_factor = gains[1];
     }
 
     // ^g_c = g_c' * ^gamma_gc



More information about the FFmpeg-soc mailing list