[FFmpeg-soc] [soc]: r4987 - in amr: amrnbdata.h amrnbdec.c

cmcq subversion at mplayerhq.hu
Sat Aug 8 22:01:15 CEST 2009


Author: cmcq
Date: Sat Aug  8 22:01:15 2009
New Revision: 4987

Log:
Don't bother using a union on AMR frame params, it only saves 4 bytes

Modified:
   amr/amrnbdata.h
   amr/amrnbdec.c

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Sat Aug  8 21:56:44 2009	(r4986)
+++ amr/amrnbdata.h	Sat Aug  8 22:01:15 2009	(r4987)
@@ -99,10 +99,8 @@ typedef struct {
  */
 typedef struct {
     uint16_t lsf[5];           ///< lsf parameters: 5 parameters for MODE_122, only 3 for other modes
-    union {
-        AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
-        AMRNBSIDFrame sid;
-    } info;
+    AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
+    AMRNBSIDFrame sid;
 } AMRNBFrame;
 
 
@@ -113,7 +111,7 @@ typedef struct {
 /** Specify an LSF parameter bit */
 #define AMR_LSF(variable, bit)               AMR_BIT(lsf[variable], bit)
 /** Specify a subframe-specific bit */
-#define AMR_OF(frame_num, variable, bit)     AMR_BIT(info.subframe[frame_num].variable, bit)
+#define AMR_OF(frame_num, variable, bit)     AMR_BIT(subframe[frame_num].variable, bit)
 /** Specify a pitch gain bit */
 #define AMR_PGAIN(frame_num, bit)            AMR_OF(frame_num, p_gain, bit)
 /** Specify a fixed gain bit */
@@ -123,9 +121,9 @@ typedef struct {
 /** Specify a pulse bit */
 #define AMR_PULSES(frame_num, pulse_id, bit) AMR_OF(frame_num, pulses[pulse_id], bit)
 /** Specify an SID reference vector bit */
-#define AMR_SVECTOR(bit)                     AMR_BIT(info.sid.ref_vector, bit)
+#define AMR_SVECTOR(bit)                     AMR_BIT(sid.ref_vector, bit)
 /** Specify an SID energy index bit */
-#define AMR_SENERGY(bit)                     AMR_BIT(info.sid.energy, bit)
+#define AMR_SENERGY(bit)                     AMR_BIT(sid.energy, bit)
 
 static const AMROrder order_MODE_475[95] = {
 AMR_LSF(0, 7), AMR_LSF(0, 6), AMR_LSF(0, 5), AMR_LSF(0, 4),

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Sat Aug  8 21:56:44 2009	(r4986)
+++ amr/amrnbdec.c	Sat Aug  8 22:01:15 2009	(r4987)
@@ -723,8 +723,7 @@ static void decode_gains(AMRContext *p, 
             mode >= MODE_67  ? gains_high[amr_subframe->p_gain] :
             mode >= MODE_515 ? gains_low [amr_subframe->p_gain] :
                 // gain index is only coded in subframes 0,2 for MODE_475
-                gains_MODE_475[(p->frame.info.subframe[subframe & 2].p_gain
-                                                                       << 1) +
+                gains_MODE_475[(p->frame.subframe[subframe & 2].p_gain << 1) +
                                (subframe & 1)];
 
         p->pitch_gain[4]   = gains[0];
@@ -1063,7 +1062,7 @@ static int amrnb_decode_frame(AVCodecCon
         lsp2lpc(p->lsp[i], p->lpc[i]);
 
     for (subframe = 0; subframe < 4; subframe++) {
-        const AMRNBSubframe *amr_subframe = &p->frame.info.subframe[subframe];
+        const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
 
         decode_pitch_vector(p, amr_subframe, subframe);
 


More information about the FFmpeg-soc mailing list