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

cmcq subversion at mplayerhq.hu
Sat Aug 15 22:20:50 CEST 2009


Author: cmcq
Date: Sat Aug 15 22:20:50 2009
New Revision: 5145

Log:
Put a decimal place in mode constants for readability, eg MODE_122 to MODE_12k2
This is purely a search-and-replace so some layout is incorrect

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

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Sat Aug 15 22:14:52 2009	(r5144)
+++ amr/amrnbdata.h	Sat Aug 15 22:20:50 2009	(r5145)
@@ -52,14 +52,14 @@
 
 /** Frame type (Table 1a in 3GPP TS 26.101) */
 enum Mode {
-    MODE_475 = 0,                         ///< 4.75 kbit/s
-    MODE_515,                             ///< 5.15 kbit/s
-    MODE_59,                              ///< 5.90 kbit/s
-    MODE_67,                              ///< 6.70 kbit/s
-    MODE_74,                              ///< 7.40 kbit/s
-    MODE_795,                             ///< 7.95 kbit/s
-    MODE_102,                             ///< 10.2 kbit/s
-    MODE_122,                             ///< 12.2 kbit/s
+    MODE_4k75 = 0,                         ///< 4.75 kbit/s
+    MODE_5k15,                             ///< 5.15 kbit/s
+    MODE_5k9,                              ///< 5.90 kbit/s
+    MODE_6k7,                              ///< 6.70 kbit/s
+    MODE_7k4,                              ///< 7.40 kbit/s
+    MODE_7k95,                             ///< 7.95 kbit/s
+    MODE_10k2,                             ///< 10.2 kbit/s
+    MODE_12k2,                             ///< 12.2 kbit/s
     MODE_DTX,                             ///< silent frame
     N_MODES,                              ///< number of modes
     NO_DATA = 15                          ///< no transmission
@@ -82,15 +82,15 @@ typedef struct AMROrder {
 typedef struct {
     uint16_t p_lag;      ///< index to decode the pitch lag
     uint16_t p_gain;     ///< index to decode the pitch gain
-    uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_122 and MODE_795
-    uint16_t pulses[10]; ///< pulses: 10 for MODE_122, 7 for MODE_102, and index and sign for others
+    uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_12k2 and MODE_7k95
+    uint16_t pulses[10]; ///< pulses: 10 for MODE_12k2, 7 for MODE_10k2, and index and sign for others
 } AMRNBSubframe;
 
 /**
  * AMRNB unpacked data frame
  */
 typedef struct {
-    uint16_t lsf[5];           ///< lsf parameters: 5 parameters for MODE_122, only 3 for other modes
+    uint16_t lsf[5];           ///< lsf parameters: 5 parameters for MODE_12k2, only 3 for other modes
     AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
     uint16_t sid_vector;       ///< index of SID LSF reference vector
     uint16_t sid_energy;       ///< SID frame energy
@@ -118,7 +118,7 @@ typedef struct {
 /** Specify an SID energy index bit */
 #define AMR_SENERGY(bit)                     AMR_BIT(sid_energy, bit)
 
-static const AMROrder order_MODE_475[95] = {
+static const AMROrder order_MODE_4k75[95] = {
  AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4),
  AMR_LSF  (  0, 3), AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0),
  AMR_LSF  (  1, 7), AMR_LSF  (  1, 6), AMR_LSF  (  1, 5), AMR_LSF  (  1, 4),
@@ -145,7 +145,7 @@ static const AMROrder order_MODE_475[95]
  AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6)
 };
 
-static const AMROrder order_MODE_515[103] = {
+static const AMROrder order_MODE_5k15[103] = {
  AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
  AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  0, 7),
  AMR_LSF  (  1, 0), AMR_LSF  (  1, 1), AMR_LSF  (  1, 2), AMR_LSF  (  1, 3),
@@ -174,7 +174,7 @@ static const AMROrder order_MODE_515[103
  AMR_PULSE(1,0, 3), AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3)
 };
 
-static const AMROrder order_MODE_59[118] = {
+static const AMROrder order_MODE_5k9[118] = {
  AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 3), AMR_LSF  (  0, 2),
  AMR_LSF  (  0, 4), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0), AMR_LSF  (  0, 5),
  AMR_LSF  (  1, 3), AMR_LSF  (  1, 1), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7),
@@ -207,7 +207,7 @@ static const AMROrder order_MODE_59[118]
  AMR_PULSE(2,0, 5), AMR_PULSE(3,0, 5)
 };
 
-static const AMROrder order_MODE_67[134] = {
+static const AMROrder order_MODE_6k7[134] = {
  AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 3), AMR_LSF  (  0, 4),
  AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  1, 3), AMR_LSF  (  0, 0),
  AMR_LSF  (  0, 5), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 5),
@@ -244,7 +244,7 @@ static const AMROrder order_MODE_67[134]
  AMR_PULSE(2,0, 8), AMR_PULSE(3,0, 8)
 };
 
-static const AMROrder order_MODE_74[148] = {
+static const AMROrder order_MODE_7k4[148] = {
  AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4),
  AMR_LSF  (  0, 3), AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0),
  AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 6), AMR_LSF  (  1, 5),
@@ -284,7 +284,7 @@ static const AMROrder order_MODE_74[148]
  AMR_PULSE(0,0, 6), AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6)
 };
 
-static const AMROrder order_MODE_795[159] = {
+static const AMROrder order_MODE_7k95[159] = {
  AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
  AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  1, 3),
  AMR_LSF  (  1, 1), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 5),
@@ -327,7 +327,7 @@ static const AMROrder order_MODE_795[159
  AMR_PULSE(1,0, 9), AMR_PULSE(2,0, 9), AMR_PULSE(3,0, 9)
 };
 
-static const AMROrder order_MODE_102[204] = {
+static const AMROrder order_MODE_10k2[204] = {
  AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
  AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  0, 7),
  AMR_LSF  (  1, 0), AMR_LSF  (  1, 1), AMR_LSF  (  1, 2), AMR_LSF  (  1, 3),
@@ -381,7 +381,7 @@ static const AMROrder order_MODE_102[204
  AMR_PULSE(0,6, 1), AMR_PULSE(0,4, 1), AMR_PULSE(0,5, 2), AMR_PULSE(0,5, 1)
 };
 
-static const AMROrder order_MODE_122[244] = {
+static const AMROrder order_MODE_12k2[244] = {
  AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4), AMR_LSF  (  0, 3),
  AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0), AMR_LSF  (  1, 7),
  AMR_LSF  (  1, 6), AMR_LSF  (  1, 5), AMR_LSF  (  1, 4), AMR_LSF  (  1, 3),
@@ -463,27 +463,27 @@ static const AMROrder order_MODE_DTX[35]
  * the AMRNBFrame
  */
 static const AMROrder * const amr_unpacking_bitmaps_per_mode[9] = {
-    order_MODE_475,
-    order_MODE_515,
-    order_MODE_59,
-    order_MODE_67,
-    order_MODE_74,
-    order_MODE_795,
-    order_MODE_102,
-    order_MODE_122,
+    order_MODE_4k75,
+    order_MODE_5k15,
+    order_MODE_5k9,
+    order_MODE_6k7,
+    order_MODE_7k4,
+    order_MODE_7k95,
+    order_MODE_10k2,
+    order_MODE_12k2,
     order_MODE_DTX,
 };
 
 /** number of bits for each mode */
 static const uint8_t mode_bits[N_MODES] = {
-    FF_ARRAY_ELEMS(order_MODE_475),
-    FF_ARRAY_ELEMS(order_MODE_515),
-    FF_ARRAY_ELEMS(order_MODE_59),
-    FF_ARRAY_ELEMS(order_MODE_67),
-    FF_ARRAY_ELEMS(order_MODE_74),
-    FF_ARRAY_ELEMS(order_MODE_795),
-    FF_ARRAY_ELEMS(order_MODE_102),
-    FF_ARRAY_ELEMS(order_MODE_122),
+    FF_ARRAY_ELEMS(order_MODE_4k75),
+    FF_ARRAY_ELEMS(order_MODE_5k15),
+    FF_ARRAY_ELEMS(order_MODE_5k9),
+    FF_ARRAY_ELEMS(order_MODE_6k7),
+    FF_ARRAY_ELEMS(order_MODE_7k4),
+    FF_ARRAY_ELEMS(order_MODE_7k95),
+    FF_ARRAY_ELEMS(order_MODE_10k2),
+    FF_ARRAY_ELEMS(order_MODE_12k2),
     FF_ARRAY_ELEMS(order_MODE_DTX)
 };
 
@@ -510,7 +510,7 @@ static const int16_t lsp_avg_init[LP_FIL
 // These are stored as integers to save space. The values are taken from
 // q_plsf_3.tab and q_plsf_5.tab in 3GPP TS 26.090.
 
-static const int16_t lsf_3_3_MODE_515[128][4] = {
+static const int16_t lsf_3_3_MODE_5k15[128][4] = {
 {  419,  163,  -30, -262},{ -455, -789,-1430, -721},{ 1006,  664,  269,   25},
 {  619,  260,  183,   96},{ -968,-1358, -388,  135},{ -693,  835,  456,  154},
 { 1105,  703,  569,  363},{ 1625, 1326,  985,  748},{ -220,  219,   76, -208},
@@ -556,7 +556,7 @@ static const int16_t lsf_3_3_MODE_515[12
 {  191,  -17, -544, -231},{-1540, -544, -901, -886}
 };
 
-static const int16_t lsf_3_1_MODE_795[512][3] = {
+static const int16_t lsf_3_1_MODE_7k95[512][3] = {
 { -890,-1550,-2541},{ -819, -970,  175},{ -826,-1234, -762},
 { -599,  -22,  634},{ -811, -987, -902},{ -323,  203,   26},
 { -383, -235, -781},{ -399, 1262,  906},{ -932,-1399,-1380},
@@ -1523,13 +1523,13 @@ static const float pred_fac[LP_FILTER_OR
 };
 
 /** Prediction factor for 12.2kbit/s mode */
-#define PRED_FAC_MODE_122              0.65
+#define PRED_FAC_MODE_12k2              0.65
 
 #define LSF_R_FAC          (8000.0/32768.0) ///< LSF residual tables to Hertz
 #define MIN_LSF_SPACING             50.0488 ///< Ensures stability of LPC filter
 #define PITCH_LAG_MAX                   143 ///< Upper bound on decoded lag search
 #define PITCH_LAG_MIN                    20 ///< Lower bound on decoded lag search
-#define PITCH_LAG_MIN_MODE_122           18 ///< Lower bound on decoded lag search in 12.2kbit/s mode
+#define PITCH_LAG_MIN_MODE_12k2           18 ///< Lower bound on decoded lag search in 12.2kbit/s mode
 
 /** b60 hamming windowed sinc function coefficients */
 static const float b60[61] = {
@@ -1590,7 +1590,7 @@ static const float energy_pred_fac[4] = 
  *
  * first index has even/odd indexes for subframes 0,2/1,3
  * second index is {pitch_gain, fixed_gain_factor} */
-static const uint16_t gains_MODE_475[512][2] = {
+static const uint16_t gains_MODE_4k75[512][2] = {
 {  812,  128}, {  542,  140}, { 2873, 1135}, { 2266, 3402}, { 2067,  563},
 {12677,  647}, { 4132, 1798}, { 5601, 5285}, { 7689,  374}, { 3735,  441},
 {10912, 2638}, {11807, 2494}, {20490,  797}, { 5218,  675}, { 6724, 8354},
@@ -1759,7 +1759,7 @@ static const uint16_t gains_low[64][2] =
 
 /** impulse response filter tables converted to float from Q15 int32_t
  * used for anti-sparseness processing */
-static const float ir_filter_strong_MODE_795[AMR_SUBFRAME_SIZE] = {
+static const float ir_filter_strong_MODE_7k95[AMR_SUBFRAME_SIZE] = {
  0.817169,  0.024445,  0.076447, -0.020844, -0.042175,  0.017761,  0.018433,
 -0.038879,  0.107147, -0.179871,  0.138367, -0.015228, -0.059204,  0.091888,
 -0.154358,  0.171326, -0.060730, -0.032379, -0.044525,  0.135559, -0.021362,
@@ -1787,7 +1787,7 @@ static const float ir_filter_medium[AMR_
 };
 
 static const float *ir_filters_lookup[2]          = { ir_filter_strong,          ir_filter_medium };
-static const float *ir_filters_lookup_MODE_795[2] = { ir_filter_strong_MODE_795, ir_filter_medium };
+static const float *ir_filters_lookup_MODE_7k95[2] = { ir_filter_strong_MODE_7k95, ir_filter_medium };
 
 
 // postfilter tables

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Sat Aug 15 22:14:52 2009	(r5144)
+++ amr/amrnbdec.c	Sat Aug 15 22:20:50 2009	(r5145)
@@ -193,7 +193,7 @@ static void lsf2lsp(const float *lsf, fl
 
 /**
  * Interpolate the LSF vector (used for fixed gain smoothing).
- * The interpolation is done over all four subframes even in MODE_122.
+ * The interpolation is done over all four subframes even in MODE_12k2.
  *
  * @param[in,out] lsf_q     LSFs in [0,1] for each subframe
  * @param[in]     lsf_new   New LSFs in Hertz for subframe 4
@@ -288,7 +288,7 @@ static void lsf2lsp_5(AMRContext *p)
     lsf_quantizer[4] = lsf_5_5[lsf_param[4]];
 
     for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsf_no_r[i] = p->prev_lsf_r[i] * LSF_R_FAC * PRED_FAC_MODE_122 + lsf_5_mean[i];
+        lsf_no_r[i] = p->prev_lsf_r[i] * LSF_R_FAC * PRED_FAC_MODE_12k2 + lsf_5_mean[i];
 
     lsf2lsp_for_mode122(p, p->lsp[1], lsf_no_r, lsf_quantizer, 0, lsf_param[2] & 1, 0);
     lsf2lsp_for_mode122(p, p->lsp[3], lsf_no_r, lsf_quantizer, 2, lsf_param[2] & 1, 1);
@@ -311,13 +311,13 @@ static void lsf2lsp_3(AMRContext *p)
     const int16_t *lsf_quantizer;
     int i;
 
-    lsf_quantizer = (p->cur_frame_mode == MODE_795 ? lsf_3_1_MODE_795 : lsf_3_1)[lsf_param[0]];
+    lsf_quantizer = (p->cur_frame_mode == MODE_7k95 ? lsf_3_1_MODE_7k95 : lsf_3_1)[lsf_param[0]];
     memcpy(lsf_r, lsf_quantizer, 3 * sizeof(*lsf_r));
 
-    lsf_quantizer = lsf_3_2[lsf_param[1] << (p->cur_frame_mode <= MODE_515)];
+    lsf_quantizer = lsf_3_2[lsf_param[1] << (p->cur_frame_mode <= MODE_5k15)];
     memcpy(lsf_r + 3, lsf_quantizer, 3 * sizeof(*lsf_r));
 
-    lsf_quantizer = (p->cur_frame_mode <= MODE_515 ? lsf_3_3_MODE_515 : lsf_3_3)[lsf_param[2]];
+    lsf_quantizer = (p->cur_frame_mode <= MODE_5k15 ? lsf_3_3_MODE_5k15 : lsf_3_3)[lsf_param[2]];
     memcpy(lsf_r + 6, lsf_quantizer, 4 * sizeof(*lsf_r));
 
     // calculate mean-removed LSF vector and add mean
@@ -365,7 +365,7 @@ static void lsp2lpc(const float *lsp, fl
 
 /**
  * Decode the adaptive codebook index to the integer and fractional parts
- * of the pitch lag for one subframe at 1/6 resolution for MODE_122,
+ * of the pitch lag for one subframe at 1/6 resolution for MODE_12k2,
  * 1/3 for other modes.
  *
  * The choice of pitch lag is described in 3GPP TS 26.090 section 5.6.1.
@@ -383,8 +383,8 @@ static void decode_pitch_lag(int *lag_in
 {
     /* Note n * 10923 >> 15 is floor(x/3) for 0 <= n <= 32767 */
     if (subframe == 0 ||
-        (subframe == 2 && mode != MODE_475 && mode != MODE_515)) {
-        if (mode == MODE_122) {
+        (subframe == 2 && mode != MODE_4k75 && mode != MODE_5k15)) {
+        if (mode == MODE_12k2) {
             if (pitch_index < 463) {
                 *lag_int  = (pitch_index + 107) * 10923 >> 16;
                 *lag_frac = pitch_index - *lag_int * 6 + 105;
@@ -400,12 +400,12 @@ static void decode_pitch_lag(int *lag_in
             *lag_frac = 0;
         }
     } else {
-        if (mode == MODE_122) {
+        if (mode == MODE_12k2) {
             *lag_int  = ((pitch_index + 5) * 10923 >> 16) - 1;
             *lag_frac = pitch_index - *lag_int * 6 - 3;
-            *lag_int += av_clip(prev_lag_int - 5, PITCH_LAG_MIN_MODE_122,
+            *lag_int += av_clip(prev_lag_int - 5, PITCH_LAG_MIN_MODE_12k2,
                                 PITCH_LAG_MAX - 9);
-        } else if (mode <= MODE_67) {
+        } else if (mode <= MODE_6k7) {
             int search_range_min = av_clip(prev_lag_int - 5, PITCH_LAG_MIN,
                                            PITCH_LAG_MAX - 9);
 
@@ -428,7 +428,7 @@ static void decode_pitch_lag(int *lag_in
             // decoding with 5 or 6 bit resolution, 1/3 fractional precision
             *lag_int  = ((pitch_index + 2) * 10923 >> 15) - 1;
             *lag_frac = pitch_index - *lag_int * 3 - 2;
-            if (mode == MODE_795) {
+            if (mode == MODE_7k95) {
                 *lag_int += av_clip(prev_lag_int - 10, PITCH_LAG_MIN,
                                     PITCH_LAG_MAX - 19);
             } else
@@ -456,7 +456,7 @@ static void interp_pitch_vector(float *p
     float *exc_idx;
 
     lag_frac *= -1;
-    if (mode != MODE_122) {
+    if (mode != MODE_12k2) {
         lag_frac <<= 1;
     }
 
@@ -503,7 +503,7 @@ static void decode_pitch_vector(AMRConte
 
 /**
  * Decode the algebraic codebook index to pulse positions and signs and
- * construct the algebraic codebook vector for MODE_102.
+ * construct the algebraic codebook vector for MODE_10k2.
  *
  * @param fixed_index          positions of the eight pulses
  * @param fixed_sparse         pointer to the algebraic codebook vector
@@ -552,9 +552,9 @@ static void decode_8_pulses_31bits(const
 
 /**
  * Decode the algebraic codebook index to pulse positions and signs and
- * construct the algebraic codebook vector for MODE_122.
+ * construct the algebraic codebook vector for MODE_12k2.
  *
- * @note: The positions and signs are explicitly coded in MODE_122.
+ * @note: The positions and signs are explicitly coded in MODE_12k2.
  *
  * @param fixed_index          positions of the ten pulses
  * @param fixed_sparse         pointer to the algebraic codebook vector
@@ -581,10 +581,10 @@ static void decode_10_pulses_35bits(cons
  * then construct the algebraic codebook vector.
  *
  *                           nb of pulses | bits encoding pulses
- * For MODE_475 or MODE_515,            2 | 1-3, 4-6, 7
- *                  MODE_59,            2 | 1,   2-4, 5-6, 7-9
- *                  MODE_67,            3 | 1-3, 4,   5-7, 8,  9-11
- *      MODE_74 or MODE_795,            4 | 1-3, 4-6, 7-9, 10, 11-13
+ * For MODE_4k75 or MODE_5k15,            2 | 1-3, 4-6, 7
+ *                  MODE_5k9,            2 | 1,   2-4, 5-6, 7-9
+ *                  MODE_6k7,            3 | 1-3, 4,   5-7, 8,  9-11
+ *      MODE_7k4 or MODE_7k95,            4 | 1-3, 4-6, 7-9, 10, 11-13
  *
  * @param fixed_sparse pointer to the algebraic codebook vector
  * @param pulses       algebraic codebook indexes
@@ -594,36 +594,36 @@ static void decode_10_pulses_35bits(cons
 static void decode_fixed_sparse(AMRFixed *fixed_sparse, const uint16_t *pulses,
                                 const enum Mode mode, const int subframe)
 {
-    assert(MODE_475 <= mode && mode <= MODE_122);
+    assert(MODE_4k75 <= mode && mode <= MODE_12k2);
 
-    if (mode == MODE_122) {
+    if (mode == MODE_12k2) {
         decode_10_pulses_35bits(pulses, fixed_sparse);
-    } else if (mode == MODE_102) {
+    } else if (mode == MODE_10k2) {
         decode_8_pulses_31bits(pulses, fixed_sparse);
     } else {
         int *pulse_position = fixed_sparse->x;
         int i, pulse_subset;
         const int fixed_index = pulses[0];
 
-        if (mode <= MODE_515) {
+        if (mode <= MODE_5k15) {
             pulse_subset      = ((fixed_index >> 3) & 8)     + (subframe << 1);
             pulse_position[0] = ( fixed_index       & 7) * 5 + track_position[pulse_subset];
             pulse_position[1] = ((fixed_index >> 3) & 7) * 5 + track_position[pulse_subset + 1];
             fixed_sparse->n = 2;
-        } else if (mode == MODE_59) {
+        } else if (mode == MODE_5k9) {
             pulse_subset      = ((fixed_index & 1) << 1) + 1;
             pulse_position[0] = ((fixed_index >> 1) & 7) * 5 + pulse_subset;
             pulse_subset      = (fixed_index  >> 4) & 3;
             pulse_position[1] = ((fixed_index >> 6) & 7) * 5 + pulse_subset + (pulse_subset == 3 ? 1 : 0);
             fixed_sparse->n = pulse_position[0] == pulse_position[1] ? 1 : 2;
-        } else if (mode == MODE_67) {
+        } else if (mode == MODE_6k7) {
             pulse_position[0] = (fixed_index        & 7) * 5;
             pulse_subset      = (fixed_index  >> 2) & 2;
             pulse_position[1] = ((fixed_index >> 4) & 7) * 5 + pulse_subset + 1;
             pulse_subset      = (fixed_index  >> 6) & 2;
             pulse_position[2] = ((fixed_index >> 8) & 7) * 5 + pulse_subset + 2;
             fixed_sparse->n = 3;
-        } else { // mode <= MODE_795
+        } else { // mode <= MODE_7k95
             pulse_position[0] = gray_decode[ fixed_index        & 7] * 5;
             pulse_position[1] = gray_decode[(fixed_index >> 3)  & 7] * 5 + 1;
             pulse_position[2] = gray_decode[(fixed_index >> 6)  & 7] * 5 + 2;
@@ -650,16 +650,16 @@ static void pitch_sharpening(AMRContext 
     // The spec suggests the current pitch gain is always used, but in other
     // modes the pitch and codebook gains are joinly quantized (sec 5.8.2)
     // so the codebook gain cannot depend on the quantized pitch gain.
-    if (mode == MODE_122)
+    if (mode == MODE_12k2)
         p->beta = FFMIN(p->pitch_gain[4], 1.0);
 
     fixed_sparse->pitch_lag  = p->pitch_lag_int;
     fixed_sparse->pitch_fac  = p->beta;
 
     // Save pitch sharpening factor for the next subframe
-    // MODE_475 only updates on the 2nd and 4th subframes - this follows from
+    // MODE_4k75 only updates on the 2nd and 4th subframes - this follows from
     // the fact that the gains for two subframes are jointly quantized.
-    if (mode != MODE_475 || subframe & 1)
+    if (mode != MODE_4k75 || subframe & 1)
         p->beta = av_clipf(p->pitch_gain[4], 0.0, SHARP_MAX);
 }
 
@@ -787,7 +787,7 @@ static float fixed_gain_smooth(AMRContex
 
     if (p->hang_count < 40) {
         p->hang_count++;
-    } else if (mode < MODE_74 || mode == MODE_102) {
+    } else if (mode < MODE_7k4 || mode == MODE_10k2) {
         const float smoothing_factor = av_clipf(4.0 * diff - 1.6, 0.0, 1.0);
         const float fixed_gain_mean = (p->fixed_gain[0] + p->fixed_gain[1] +
                                        p->fixed_gain[2] + p->fixed_gain[3] +
@@ -811,19 +811,19 @@ static void decode_gains(AMRContext *p, 
                          const enum Mode mode, const int subframe,
                          float *fixed_gain_factor)
 {
-    if (mode == MODE_122 || mode == MODE_795) {
+    if (mode == MODE_12k2 || mode == MODE_7k95) {
         p->pitch_gain[4]   = qua_gain_pit [amr_subframe->p_gain    ] / 16384.0;
         *fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain] / 2048.0;
     } else {
         const uint16_t *gains;
 
-        if (mode >= MODE_67) {
+        if (mode >= MODE_6k7) {
             gains = gains_high[amr_subframe->p_gain];
-        } else if (mode >= MODE_515) {
+        } else if (mode >= MODE_5k15) {
             gains = gains_low [amr_subframe->p_gain];
         } else {
-            // gain index is only coded in subframes 0,2 for MODE_475
-            gains = gains_MODE_475[(p->frame.subframe[subframe & 2].p_gain << 1)
+            // gain index is only coded in subframes 0,2 for MODE_4k75
+            gains = gains_MODE_4k75[(p->frame.subframe[subframe & 2].p_gain << 1)
                                    + (subframe & 1)];
         }
 
@@ -965,11 +965,11 @@ static const float *anti_sparseness(AMRC
     if (fixed_gain < 5.0)
         ir_filter_nr = 2;
 
-    if (p->cur_frame_mode != MODE_74 && p->cur_frame_mode < MODE_102
+    if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2
          && ir_filter_nr < 2) {
         apply_ir_filter(out, fixed_sparse,
-                        (p->cur_frame_mode == MODE_795 ?
-                             ir_filters_lookup_MODE_795 :
+                        (p->cur_frame_mode == MODE_7k95 ?
+                             ir_filters_lookup_MODE_7k95 :
                              ir_filters_lookup)[ir_filter_nr]);
         fixed_vector = out;
     }
@@ -1019,7 +1019,7 @@ static int synthesis(AMRContext *p, floa
                                        AMR_SUBFRAME_SIZE);
         float pitch_factor =
             p->pitch_gain[4] *
-            (p->cur_frame_mode == MODE_122 ?
+            (p->cur_frame_mode == MODE_12k2 ?
                 0.25 * FFMIN(p->pitch_gain[4], 1.0) :
                 0.5  * FFMIN(p->pitch_gain[4], SHARP_MAX));
 
@@ -1143,7 +1143,7 @@ static void postfilter(AMRContext *p, fl
     const float *gamma_n, *gamma_d;                       // Formant filter factor table
     float lpc_n[LP_FILTER_ORDER], lpc_d[LP_FILTER_ORDER]; // Transfer function coefficients
 
-    if (p->cur_frame_mode == MODE_122 || p->cur_frame_mode == MODE_102) {
+    if (p->cur_frame_mode == MODE_12k2 || p->cur_frame_mode == MODE_10k2) {
         gamma_n = formant_high_n;
         gamma_d = formant_high_d;
     } else {
@@ -1203,7 +1203,7 @@ static int amrnb_decode_frame(AVCodecCon
         return -1;
     }
 
-    if (p->cur_frame_mode == MODE_122) {
+    if (p->cur_frame_mode == MODE_12k2) {
         lsf2lsp_5(p);
     } else
         lsf2lsp_3(p);


More information about the FFmpeg-soc mailing list