[FFmpeg-soc] [soc]: r4000 - in amr: amrdata.h amrnbdec.c amrnbfloatdata.h amrnbfloatdec.c

diego subversion at mplayerhq.hu
Sun Jan 25 16:38:52 CET 2009


Author: diego
Date: Sun Jan 25 16:38:52 2009
New Revision: 4000

Log:
spelling/wording/grammar cosmetics

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

Modified: amr/amrdata.h
==============================================================================
--- amr/amrdata.h	Sun Jan 25 16:35:48 2009	(r3999)
+++ amr/amrdata.h	Sun Jan 25 16:38:52 2009	(r4000)
@@ -108,7 +108,8 @@ int16_t cos_table[65]; // cosine table u
 
 #define TRACKS_MODE_102  4 // number of tracks for MODE_102
 
-// FIXME - not quite sure how i'm going to implement this yet and some other variables may be moved around later
+/* FIXME - not quite sure how i'm going to implement this yet
+ *         and some other variables may be moved around later */
 typedef struct AMRDecoderState {
     // Bad frame
     int state;
@@ -244,7 +245,7 @@ static const AMROrder order_MODE_DTX[35]
 // encoder homing frame pattern
 #define EHF_MASK 0x0008
 
-// Homing frames for the decoder
+// homing frames for the decoder
 static const int16_t dhf_MODE_475[PRMS_MODE_475] = {
   0x00F8,0x009D,0x001C,0x0066,0x0000,0x0003,0x0028,0x000F,0x0038,0x0001,
   0x000F,0x0031,0x0002,0x0008,0x000F,0x0026,0x0003
@@ -376,7 +377,7 @@ static const uint16_t pred_fac[10] = {
     11651, 10588,  9767,  8593,  6484
 };
 
-// vector quantised lsf tables
+// vector quantized lsf tables
 static const int16_t lsf_3_MODE_515[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},
@@ -1157,7 +1158,7 @@ static const uint16_t pitch_gain_attenua
     6553
 };
 
-// quantisation table for the adaptive codebook gain (MODE_795, MODE_122)
+// quantization table for the adaptive codebook gain (MODE_795, MODE_122)
 #define N_PITCH_QUANTS 16
 static const uint16_t pitch_gain_quant[N_PITCH_QUANTS] = {
    0,

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Sun Jan 25 16:35:48 2009	(r3999)
+++ amr/amrnbdec.c	Sun Jan 25 16:38:52 2009	(r4000)
@@ -41,18 +41,18 @@ typedef struct AMRContext {
     GetBitContext                        gb;
     int16_t                  *sample_buffer;
 
-    int16_t                       *amr_prms; ///< pointer to the decoded amr parameters (lsf coefficients, codebook indices, etc)
+    int16_t                       *amr_prms; ///< pointer to the decoded AMR parameters (lsf coefficients, codebook indexes, etc)
     int                 bad_frame_indicator; ///< bad frame ? 1 : 0
 
     int                   prev_frame_homing; ///< previous frame was a homing frame ? 1 : 0
     enum RXFrameType        prev_frame_type; ///< frame type of previous frame
     enum Mode               prev_frame_mode; ///< mode of previous frame
 
-    int                        *prev_lsf_dq; ///< previous dequantised lsfs
-    int                    *prev_residual_q; ///< previous quantised residual
+    int                        *prev_lsf_dq; ///< previous dequantized lsfs
+    int                    *prev_residual_q; ///< previous quantized residual
 
-    int             lsp1_q[LP_FILTER_ORDER]; ///< vector of quantised lsps
-    int             lsp2_q[LP_FILTER_ORDER]; ///< vector of quantised lsps
+    int             lsp1_q[LP_FILTER_ORDER]; ///< vector of quantized lsps
+    int             lsp2_q[LP_FILTER_ORDER]; ///< vector of quantized lsps
 
     int                    cur_frame_homing; ///< current frame homing ? 1 : 0
     enum RXFrameType         cur_frame_type; ///< current frame type
@@ -96,7 +96,7 @@ static int amrnb_decode_init(AVCodecCont
 
     // allocate and zero the sample buffer
     p->sample_buffer = av_mallocz(sizeof(int16_t)*AMR_BLOCK_SIZE);
-    // allocate and zero the amr parameters
+    // allocate and zero the AMR parameters
     p->amr_prms = av_mallocz(sizeof(int16_t)*PRMS_MODE_122);
     // allocate and zero the decoder state
     p->state = av_mallocz(sizeof(AMRDecoderState));
@@ -117,13 +117,13 @@ static int amrnb_decode_init(AVCodecCont
 
 
 /**
- * Decode the bitstream into the AMR parameters and discover the frame mode
+ * Decode the bitstream into the AMR parameters and discover the frame mode.
  *
  * @param buf               pointer to the input buffer
  * @param buf_size          size of the input buffer
  * @param speech_mode       pointer to the speech mode
  *
- * @return Returns the frame mode
+ * @return the frame mode
  */
 
 enum Mode decode_bitstream(AVCodecContext *avctx, uint8_t *buf, int buf_size,
@@ -134,7 +134,7 @@ enum Mode decode_bitstream(AVCodecContex
     int i;
     const AMROrder *order;
 
-    // initialise get_bits
+    // initialize get_bits
     init_get_bits(&p->gb, buf, buf_size*8);
     skip_bits1(&p->gb);
     // set the mode
@@ -207,8 +207,8 @@ enum Mode decode_bitstream(AVCodecContex
 
 
 /**
- * DESCRIPTION FROM REF SOURCE:
- * Make sure that the LSFs are properly ordered and to keep a certain minimum
+ * DESCRIPTION FROM REFERENCE SOURCE:
+ * Make sure that the LSFs are properly ordered and keep a certain minimum
  * distance between adjacent LSFs.
  *
  * @param lsf               a vector of lsfs (range: 0<=val<=0.5)
@@ -230,7 +230,7 @@ static void reorder_lsf(int *lsf, int mi
 
 
 /**
- * Convert a vector of lsfs into the corresponding, cosine domain lsps
+ * Convert a vector of lsfs into the corresponding cosine domain lsps.
  *
  * @param lsf               a vector of lsfs
  * @param lsp               a vector of lsps
@@ -250,7 +250,7 @@ static void lsf2lsp(int *lsf, int *lsp)
 
 
 /**
- * Convert a set of 3 lsf quantisation indices into lsp parameters
+ * Convert a set of 3 lsf quantization indexes into lsp parameters.
  *
  * @param avctx             pointer to the AVCodecContext for AMR
  */
@@ -260,12 +260,13 @@ static void decode_lsf2lsp_3(AVCodecCont
     AMRContext *p = avctx->priv_data;
 
     int lsf1_r[LP_FILTER_ORDER]; // vector of residual lsfs
-    int lsf1_q[LP_FILTER_ORDER]; // vector of quantised lsfs
+    int lsf1_q[LP_FILTER_ORDER]; // vector of quantized lsfs
     const int16_t (*lsf_3_temp1)[3], (*lsf_3_temp3)[4]; // temp ptrs for switching tables depending on mode
     int index_temp; // temp lsf index
     int i; // counter
 
-    // if the current frame is bad estimate the past quantised residual based on the past lsf shifted slightly towards the mean
+    /* if the current frame is bad, estimate the past quantized residual
+     * based on the past lsf shifted slightly towards the mean */
     if(p->bad_frame_indicator) {
         for(i=0; i<LP_FILTER_ORDER; i++) {
             lsf1_q[i] = ( (p->prev_lsf_dq[i]*ALPHA)>>15 ) + ( (lsf_3_mean[i]*ONE_ALPHA)>>15 );
@@ -292,13 +293,14 @@ static void decode_lsf2lsp_3(AVCodecCont
             lsf_3_temp3 = lsf_3_3;
         }
 
-        // decode lsf residuals from lsf tables using the indices from the bitstream
+        // decode lsf residuals from lsf tables using the bitstream indexes
         lsf1_r[0] = lsf_3_temp1[ p->amr_prms[0] ][0];
         lsf1_r[1] = lsf_3_temp1[ p->amr_prms[0] ][1];
         lsf1_r[2] = lsf_3_temp1[ p->amr_prms[0] ][2];
 
         index_temp = p->amr_prms[1];
-        // MODE_475, MODE_515 only use every second entry - NOTE : not quite sure what they mean and the spec doesn't mention this
+        /* MODE_475, MODE_515 only use every second entry
+         * NOTE: unsure what they mean and the spec doesn't mention this */
         if((p->cur_frame_mode == MODE_475) || (p->cur_frame_mode == MODE_515)) {
             index_temp = index_temp << 1;
         }
@@ -325,7 +327,7 @@ static void decode_lsf2lsp_3(AVCodecCont
         }
     }
 
-    /* verification that LSFs has minimum distance of LSF_GAP Hz */
+    /* verification that LSFs have minimum distance of LSF_GAP Hz */
     reorder_lsf(lsf1_q, LSF_GAP);
     memcpy(p->prev_lsf_dq, lsf1_q, LP_FILTER_ORDER<<2);
 
@@ -335,7 +337,7 @@ static void decode_lsf2lsp_3(AVCodecCont
 
 
 /**
- * Convert a set of 5 lsf quantisation indices into lsp parameters
+ * Convert a set of 5 lsf quantization indexes into lsp parameters.
  *
  * @param avctx             pointer to the AVCodecContext for AMR
  */
@@ -345,11 +347,12 @@ static void decode_lsf2lsp_5(AVCodecCont
     AMRContext *p = avctx->priv_data;
 
     int lsf1_r[LP_FILTER_ORDER], lsf2_r[LP_FILTER_ORDER]; // vectors of residual lsfs
-    int lsf1_q[LP_FILTER_ORDER], lsf2_q[LP_FILTER_ORDER]; // vectors of quantised lsfs
+    int lsf1_q[LP_FILTER_ORDER], lsf2_q[LP_FILTER_ORDER]; // vectors of quantized lsfs
     int temp;
     int i, sign; // counter and sign of 3rd lsf table
 
-    // if the current frame is bad estimate the past quantised residual based on the past lsf shifted slightly towards the mean
+    /* if the current frame is bad, estimate the past quantized residual
+     * based on the past lsf shifted slightly towards the mean */
     if(p->bad_frame_indicator) {
         for(i=0; i<LP_FILTER_ORDER; i++) {
             lsf1_q[i] = ( (p->prev_lsf_dq[i]*ALPHA_122)>>15 ) + ( (lsf_5_mean[i]*ONE_ALPHA_122)>>15 );
@@ -359,7 +362,7 @@ static void decode_lsf2lsp_5(AVCodecCont
             p->prev_residual_q[i] = lsf2_q[i] - lsf_5_mean[i] - ( (p->prev_residual_q[i]*LSP_PRED_FAC_MODE_122)>>15 );
         }
     }else {
-        /* decode prediction residuals from 5 received indices */
+        /* decode prediction residuals from 5 received indexes */
         lsf1_r[0] = lsf_5_1[ p->amr_prms[0] ][0];
         lsf1_r[1] = lsf_5_1[ p->amr_prms[0] ][1];
         lsf2_r[0] = lsf_5_1[ p->amr_prms[0] ][2];
@@ -436,7 +439,8 @@ static void lsp2poly(int *lsp, int *f)
         f[1] -= lsp[2*i-2]<<10;
     }
 }
-/* FIXME - check rounding sensitivity of F1(z) and F2(z) as the code below is faster but rounds differently
+/* FIXME - check rounding sensitivity of F1(z) and F2(z)
+ * as the code below is faster but rounds differently
 static void lsp2poly(int *lsp, int *f) {
     int i, j;
     f[0] = 1<<24;
@@ -452,7 +456,7 @@ static void lsp2poly(int *lsp, int *f) {
 
 
 /**
- * Convert a vector of lsps to lpc coefficients for a 10th order filter
+ * Convert a vector of lsps to lpc coefficients for a 10th order filter.
  *
  * @param lsp                 vector of lsps
  * @param lpc_coeffs          pointer to a subframe of lpc coefficients
@@ -494,7 +498,7 @@ static void lsp2lpc(int *lsp, int *lpc_c
 
 
 /**
- * Interpolate lsps for subframes 1 and 3 and convert them to lpc coefficients
+ * Interpolate lsps for subframes 1 and 3 and convert them to lpc coefficients.
  *
  * @param avctx                 pointer to AVCodecContext
  * @param lpc_coeffs            array of lpc coefficients for the four subframes
@@ -531,7 +535,7 @@ static void lpc_interp_13(AVCodecContext
 
 
 /**
- * Interpolate lsps for subframes 1, 2 and 3 and convert them to lpc coefficients
+ * Interpolate lsps for subframes 1, 2 and 3 and convert them to lpc coefficients.
  *
  * @param avctx                 pointer to AVCodecContext
  * @param lpc_coeffs            array of lpc coefficients for the four subframes
@@ -573,10 +577,10 @@ static void lpc_interp_123(AVCodecContex
 
 
 /**
- * Decode the adaptive codebook index to the integer and fractional pitch lags for one subframe
- * at 1/3 resolution
+ * Decode the adaptive codebook index to the integer and fractional
+ * pitch lags for one subframe at 1/3 resolution.
  *
- * Description from ref source:
+ * Description from reference source:
  *    The fractional lag in 1st and 3rd subframes is encoded with 8 bits
  *    while that in 2nd and 4th subframes is relatively encoded with 4, 5
  *    and 6 bits depending on the mode.
@@ -593,16 +597,17 @@ static void decode_pitch_lag_3(AVCodecCo
     AMRContext *p = avctx->priv_data;
     int tmp_lag;
 
-    // FIXME - find out where these constants come from and add appropriate comments
-    // such that people reading the code can understand why these particular values
-    // are used
+    // FIXME: find out where these constants come from and add appropriate
+    // comments such that people reading the code can understand why these
+    // particular values are used
 
     // subframe 1 or 3
     if(p->cur_subframe & 1) {
         if(pitch_index < 197) {
             *pitch_lag_int  = (( (pitch_index + 2)*10923 )>>15) + 19;
             *pitch_lag_frac = pitch_index - *pitch_lag_int*3 + 58;
-            // For the sake of deciphering where this comes from, the above code probably means:
+            // For the sake of deciphering where this comes from,
+            // the above code probably means:
             // *pitch_lag_int  = (pitch_index + 2)/3 + 19;
             // *pitch_lag_frac = (pitch_index + 2)%3 + 56;
         }else {
@@ -639,16 +644,16 @@ static void decode_pitch_lag_3(AVCodecCo
 
 
 /**
- * Decode the adaptive codebook index to the integer and fractional pitch lag for one subframe
- * at 1/6 resolution
+ * Decode the adaptive codebook index to the integer and fractional
+ * pitch lag for one subframe at 1/6 resolution.
  *
- * Description from ref source:
+ * Description from reference source:
  *    The fractional lag in 1st and 3rd subframes is encoded with 9 bits
  *    while that in 2nd and 4th subframes is relatively encoded with 6 bits.
  *    Note that in relative encoding only 61 values are used. If the
  *    decoder receives 61, 62, or 63 as the relative pitch index, it means
  *    that a transmission error occurred. In this case, the pitch lag from
- *    previous subframe (actually from previous frame) is used.
+ *    the previous subframe (actually from the previous frame) is used.
  *
  * @param avctx              pointer to AVCodecContext
  * @param pitch_index        received adaptive codebook (pitch) index
@@ -662,9 +667,9 @@ static void decode_pitch_lag_6(AVCodecCo
     AMRContext *p = avctx->priv_data;
     int temp;
 
-    // FIXME - find out where these constants come from and add appropriate comments
-    // such that people reading the code can understand why these particular values
-    // are used
+    // FIXME - find out where these constants come from and add appropriate
+    // comments such that people reading the code can understand why these
+    // particular values are used.
 
     // subframe 1 or 3
     if(p->cur_subframe & 1) {
@@ -694,11 +699,12 @@ static void decode_pitch_lag_6(AVCodecCo
 
 
 /**
- * Find the adaptive codebook (pitch) vector from interpolating the past excitation at the
- * decoded pitch lag with corresponding resolution of 1/3 or 1/6
+ * Find the adaptive codebook (pitch) vector from interpolating the past
+ * excitation at the decoded pitch lag with corresponding resolution
+ * of 1/3 or 1/6.
  *
  * See the specification for details of the underlying mathematics and the used
- * FIR filter
+ * FIR filter.
  *
  * @param avctx              pointer to AVCodecContext
  * @param excitation         pointer to the excitation buffer
@@ -732,7 +738,7 @@ static void decode_pitch_vector(AVCodecC
 
 
 /**
- * Reconstruct the algebraic codebook vector
+ * Reconstruct the algebraic codebook vector.
  *
  * @param fixed_code           algebraic codebook vector
  * @param pulse_position       vector of pulse positions
@@ -755,7 +761,7 @@ static void reconstruct_fixed_code(int *
 
 
 /**
- * Decode the algebraic codebook index to pulse position indices for MODE_102
+ * Decode the algebraic codebook index to pulse position indexes for MODE_102.
  *
  * @param fixed_index          positions of the eight pulses (encoded)
  * @param position_index       position index of the eight pulses
@@ -765,7 +771,7 @@ static void fixed2position(int16_t *fixe
 {
     int MSBs, LSBs, MSBs0_24, divMSB;
 
-    // indices from track 1 (7+3 bits)
+    // indexes from track 1 (7+3 bits)
     MSBs= FFMIN(fixed_index[0] >> 3, 124);
     // LSBs = fixed_index[0]%8;
     LSBs = fixed_index[0] & 0x7;
@@ -777,7 +783,7 @@ static void fixed2position(int16_t *fixe
     position_index[4] = (( (MSBs - 25*divMSB)/5 )<<1) + ((LSBs & 0x2)>>1);
     position_index[1] = (divMSB<<1) + (LSBs>>2);
 
-    // indices from track 2 (7+3 bits)
+    // indexes from track 2 (7+3 bits)
     MSBs= FFMIN(fixed_index[1] >> 3, 124);
     // LSBs = fixed_index[1]%8;
     LSBs = fixed_index[1] & 0x7;
@@ -789,7 +795,7 @@ static void fixed2position(int16_t *fixe
     position_index[6] = (( (MSBs - 25*divMSB)/5 )<<1) + ((LSBs & 0x2)>>1);
     position_index[5] = (divMSB<<1) + (LSBs>>2);
 
-    // indices from track 3 (5+2 bits)
+    // indexes from track 3 (5+2 bits)
     MSBs = fixed_index[2] >> 2;
     // LSBs = fixed_index[2]%4;
     LSBs = fixed_index[2] & 0x3;
@@ -806,8 +812,8 @@ static void fixed2position(int16_t *fixe
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_475 and MODE_515
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_475 and MODE_515.
  *
  * @param avctx                pointer to AVCodecContext
  * @param sign                 signs of the two pulses
@@ -835,8 +841,8 @@ static void decode_2_pulses_9bits(AVCode
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_59
+ * Decode the algebraic codebook index to pulse positions and signs
+ * and construct the algebraic codebook vector for MODE_59.
  *
  * @param sign                 signs of the two pulses
  * @param fixed_index          positions of the two pulses
@@ -867,8 +873,8 @@ static void decode_2_pulses_11bits(int s
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_67
+ * Decode the algebraic codebook index to pulse positions and signs
+ * and construct the algebraic codebook vector for MODE_67.
  *
  * @param sign                 signs of the three pulses
  * @param fixed_index          positions of the three pulses
@@ -897,8 +903,8 @@ static void decode_3_pulses_14bits(int s
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_74 and MODE_795
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_74 and MODE_795.
  *
  * @param sign                 signs of the four pulses
  * @param fixed_index          positions of the four pulses
@@ -927,8 +933,8 @@ static void decode_4_pulses_17bits(int s
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_102
+ * Decode the algebraic codebook index to pulse positions and signs
+ * and construct the algebraic codebook vector for MODE_102.
  *
  * @param fixed_index          positions of the eight pulses
  * @param fixed_code           pointer to the algebraic codebook vector
@@ -961,8 +967,8 @@ static void decode_8_pulses_31bits(int16
 
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_122
+ * Decode the algebraic codebook index to pulse positions and signs
+ * and construct the algebraic codebook vector for MODE_122.
  *
  * @param fixed_index          positions of the ten pulses
  * @param fixed_code           pointer to the algebraic codebook vector
@@ -979,7 +985,7 @@ static void decode_10_pulses_35bits(int1
         // find the position of the ith pulse
         pos1 = dgray[fixed_index[i  ] & 7]*5 + i;
         // find the sign of the ith pulse
-        sign = (fixed_index[i] & 8) ? -4096 : 4096; // +/-1 : 4096 is used here in the ref source
+        sign = (fixed_index[i] & 8) ? -4096 : 4096; // +/-1 : 4096 is used here in the reference source
         // find the position of the i+5th pulse
         pos2 = dgray[fixed_index[i+5] & 7]*5 + i;
         // assign the ith pulse (+/-1) to its appropriate position
@@ -995,10 +1001,10 @@ static void decode_10_pulses_35bits(int1
 // general functions FIXME - useful enough to put into libavutil?
 
 /**
- * Comparison function for use with qsort
+ * Comparison function for use with qsort.
  *
- * @param a             First value for comparison
- * @param b             Second value for comparison
+ * @param a             first value for comparison
+ * @param b             second value for comparison
  * @return a-b : the result of the comparison
  */
 
@@ -1008,11 +1014,11 @@ int qsort_compare(const int *a, const in
 }
 
 /**
- * Find the median of some values
+ * Find the median of some values.
  *
  * @param values        pointer to the values of which to find the median
  * @param n             number of values
- * @return Returns the median value
+ * @return the median value
  */
 
 static int median(int *values, int n)
@@ -1030,10 +1036,10 @@ static int median(int *values, int n)
 // gain functions
 
 /**
- * Calculate the pitch gain from previous values
+ * Calculate the pitch gain from previous values.
  *
  * @param state_ptr             pointer to the current state
- * @return Returns the pitch gain
+ * @return the pitch gain
  */
 
 static int find_pitch_gain(AMRDecoderState *state_ptr)
@@ -1052,11 +1058,11 @@ static int find_pitch_gain(AMRDecoderSta
 
 
 /**
- * Decode the pitch gain using the received index
+ * Decode the pitch gain using the received index.
  *
  * @param mode              current mode
- * @param index             quantisation index
- * @return Returns the pitch gain
+ * @param index             quantization index
+ * @return the pitch gain
  */
 
 static int decode_pitch_gain(enum Mode mode, int index)
@@ -1075,7 +1081,7 @@ static int decode_pitch_gain(enum Mode m
 
 
 /**
- * Update the pitch gain and limit pitch_gain if the previous frame was bad
+ * Update the pitch gain and limit pitch_gain if the previous frame was bad.
  *
  * @param state_ptr             pointer to the current state
  * @param bad_frame_indicator   bad frame indicator
@@ -1113,7 +1119,7 @@ static void pitch_gain_update(AMRDecoder
 
 
 /**
- * Reset the AMR frame parameters
+ * Reset the AMR frame parameters.
  *
  * @param avctx             pointer to the AVCodecContext for AMR
  */
@@ -1139,7 +1145,7 @@ static int amrnb_decode_frame(AVCodecCon
     const int16_t *homing_frame;             // pointer to the homing frame
     int homing_frame_size;                   // homing frame size
 
-    // decode the bitstream to amr parameters
+    // decode the bitstream to AMR parameters
     p->cur_frame_mode = decode_bitstream(avctx, buf, buf_size, &speech_mode);
 
     // guess the mode from the previous frame if no data or bad data
@@ -1267,14 +1273,15 @@ static int amrnb_decode_frame(AVCodecCon
     p->prev_frame_type   =  p->cur_frame_type;
     p->prev_frame_mode   =  p->cur_frame_mode;
 
-    /* To make it easy the stream can only be 16 bits mono, so let's convert it to that */
+    /* To make it easy the stream can only be 16 bits mono,
+     * so let's convert it to that */
     for (i=0 ; i<buf_size; i++)
         outbuffer[i] = (int16_t)p->sample_buffer[i];
 
     /* Report how many samples we got */
     *data_size = buf_size;
 
-    /* Return the amount of bytes consumed if everything was ok */
+    /* Return the amount of bytes consumed if everything was OK */
     return *data_size*sizeof(int16_t);
 }
 
@@ -1288,7 +1295,7 @@ static int amrnb_decode_close(AVCodecCon
     av_free(p->amr_prms);
     av_free(p->state);
 
-    /* Return 0 if everything is ok, -1 if not */
+    /* Return 0 if everything is OK, -1 if not */
     return 0;
 }
 

Modified: amr/amrnbfloatdata.h
==============================================================================
--- amr/amrnbfloatdata.h	Sun Jan 25 16:35:48 2009	(r3999)
+++ amr/amrnbfloatdata.h	Sun Jan 25 16:38:52 2009	(r4000)
@@ -98,9 +98,9 @@ typedef struct AMROrder {
 
 /**************************** tables *****************************/
 
-// The following order* tables are used to reorder the bitstream into the bit allocation
-// format as in the specification. The bits are grouped into three classes of importance.
-// See the specification, for more information.
+// The following order* tables are used to reorder the bitstream into the bit
+// allocation format as in the specification. The bits are grouped into three
+// classes of importance. See the specification for more information.
 
 static const AMROrder order_MODE_475[95] = {
 { 0, 7}, { 0, 6}, { 0, 5}, { 0, 4}, { 0, 3}, { 0, 2}, { 0, 1}, { 0, 0},
@@ -1814,7 +1814,7 @@ static const uint8_t gray_decode[8] = { 
 
 #define MIN_ENERGY -14.0
 
-// scalar quantised pitch gain table for 7.95 and 12.2 kbps modes
+// scalar quantized pitch gain table for 7.95 and 12.2 kbps modes
 static const float qua_gain_pit[16] = {
 0.0             , 0.20001220703125, 0.400146484375  , 0.5             ,
 0.5999755859375 , 0.70001220703125, 0.75            , 0.79998779296875,
@@ -1822,10 +1822,11 @@ static const float qua_gain_pit[16] = {
 1.04998779296875, 1.0999755859375 , 1.1500244140625 , 1.20001220703125,
 };
 
-// scalar quantised fixed gain table for 7.95 and 12.2 kbps modes
-// note: this table was generated from the integer qua_gain_code tables in the
-// ref source that store Q10 qua_ener = 20*log10(g_fac). The table below stores
-// g_fac as a float from printf("%10.6f,\n", powf(10.0, qua_ener/(20.0*(1<<10))))
+// scalar quantized fixed gain table for 7.95 and 12.2 kbps modes
+// NOTE: This table was generated from the integer qua_gain_code tables
+// in the reference source that store Q10 qua_ener = 20*log10(g_fac).
+// The table below stores g_fac as a float from
+// printf("%10.6f,\n", powf(10.0, qua_ener/(20.0*(1<<10)))).
 static const float qua_gain_code[32] = {
  0.077640,  0.100586,  0.130857,  0.170410,  0.204592,  0.235358,  0.270507,  0.311044,
  0.357898,  0.411116,  0.473151,  0.543935,  0.625519,  0.719258,  0.827138,  0.951199,
@@ -1841,7 +1842,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 subframes 0,2/1,3
+// first index has even/odd indexes 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	Sun Jan 25 16:35:48 2009	(r3999)
+++ amr/amrnbfloatdec.c	Sun Jan 25 16:38:52 2009	(r4000)
@@ -41,7 +41,7 @@ typedef struct AMRContext {
 
     GetBitContext                        gb;
 
-    int16_t         amr_prms[PRMS_MODE_122]; ///< decoded amr parameters (lsf coefficients, codebook indices, etc)
+    int16_t         amr_prms[PRMS_MODE_122]; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc)
     int                 bad_frame_indicator; ///< bad frame ? 1 : 0
     int                      cur_frame_mode; ///< current frame mode
     int                      cur_frame_type; ///< current frame type
@@ -52,7 +52,7 @@ typedef struct AMRContext {
 
     float          lsp_avg[LP_FILTER_ORDER]; ///< vector of averaged lsp coefficients
 
-    float           lpc[4][LP_FILTER_ORDER]; ///< vectors of lpc coefficients for 4 subframes
+    float           lpc[4][LP_FILTER_ORDER]; ///< lpc coefficient vectors for 4 subframes
 
     int                    search_range_min; ///< minimum pitch lag search range
     int                    search_range_max; ///< maximum pitch lag search range
@@ -90,9 +90,9 @@ static void reset_state(AMRContext *p)
 {
     int i;
 
-    // initialise values for the lsp vector from the 4th subframe of the
-    // previous subframe values
-    // taken from Decoder_amr_reset using val/(float)(1<<15)
+    // Initialize values for the lsp vector from the 4th subframe of the
+    // previous subframe values.
+    // Taken from Decoder_amr_reset using val/(float)(1<<15).
     p->prev_lsp_sub4[0] = 0.91552734375;
     p->prev_lsp_sub4[1] = 0.79345703125;
     p->prev_lsp_sub4[2] = 0.640869140625;
@@ -104,8 +104,8 @@ static void reset_state(AMRContext *p)
     p->prev_lsp_sub4[8] = -0.640869140625;
     p->prev_lsp_sub4[9] = -0.79345703125;
 
-    // initialise mean lsp values
-    // taken from Decoder_amr_reset using val/(float)(1<<15)
+    // Initialize mean lsp values.
+    // Taken from Decoder_amr_reset using val/(float)(1<<15).
     p->lsp_avg[0] = 0.042236328125;
     p->lsp_avg[1] = 0.063385009765625;
     p->lsp_avg[2] = 0.1043701171875;
@@ -148,13 +148,13 @@ static int amrnb_decode_init(AVCodecCont
 
 
 /**
- * Decode the bitstream into the AMR parameters and discover the frame mode
+ * Decode the bitstream into the AMR parameters and discover the frame mode.
  *
  * @param buf               pointer to the input buffer
  * @param buf_size          size of the input buffer
  * @param speech_mode       pointer to the speech mode
  *
- * @return Returns the frame mode
+ * @return the frame mode
  */
 
 enum Mode decode_bitstream(AMRContext *p, uint8_t *buf, int buf_size,
@@ -167,7 +167,7 @@ enum Mode decode_bitstream(AMRContext *p
     // reset amr_prms
     memset(p->amr_prms, 0, PRMS_MODE_122 * sizeof(int16_t));
 
-    // initialise get_bits
+    // initialize get_bits
     init_get_bits(&p->gb, buf, buf_size*8);
     skip_bits(&p->gb, 1);
     // set the mode
@@ -242,7 +242,7 @@ enum Mode decode_bitstream(AMRContext *p
 /*** LPC coefficient decoding functions ***/
 
 /**
- * Convert an lsf vector into an lsp vector
+ * Convert an lsf vector into an lsp vector.
  *
  * @param lsf               input lsf vector
  * @param lsp               output lsp vector
@@ -258,7 +258,7 @@ static void lsf2lsp(float *lsf, float *l
 }
 
 /**
- * Decode a set of 5 split-matrix quantised lsf indices into an lsp vector
+ * Decode a set of 5 split-matrix quantized lsf indexes into an lsp vector.
  *
  * @param p                 pointer to the AMRContext
  */
@@ -319,7 +319,7 @@ static void lsf2lsp_5(AMRContext *p)
 }
 
 /**
- * Decode a set of 3 split-matrix quantised lsf indices into an lsp vector
+ * Decode a set of 3 split-matrix quantized lsf indexes into an lsp vector.
  *
  * @param p                 pointer to the AMRContext
  */
@@ -351,8 +351,8 @@ static void lsf2lsp_3(AMRContext *p)
     lsf_r[2] = lsf_3_1_tmp[ idx ][2];
 
     idx = p->amr_prms[1];
-    // MODE_475, MODE_515 only use every other entry as their indices are stored
-    // using 1 less bit (8-bits vs 9-bits)
+    // MODE_475, MODE_515 only use every other entry as their indexes
+    // are stored using 1 less bit (8 bits vs 9 bits)
     if((p->cur_frame_mode == MODE_475) || (p->cur_frame_mode == MODE_515)) {
         idx <<= 1;
     }
@@ -377,7 +377,7 @@ static void lsf2lsp_3(AMRContext *p)
 }
 
 /**
- * Interpolate lsp vectors for subframes 1 and 3
+ * Interpolate lsp vectors for subframes 1 and 3.
  *
  * @param p                 pointer to the AMRContext
  */
@@ -393,7 +393,7 @@ static void interp_lsp_13(AMRContext *p)
 }
 
 /**
- * Interpolate lsp vectors for subframes 1, 2 and 3
+ * Interpolate lsp vectors for subframes 1, 2 and 3.
  *
  * @param p                 pointer to the AMRContext
  */
@@ -410,7 +410,7 @@ static void interp_lsp_123(AMRContext *p
 }
 
 /**
- * Find the polynomial F1(z) or F2(z) from the lsp vectors
+ * Find the polynomial F1(z) or F2(z) from the lsp vectors.
  *
  * @param lsp               input lsp vector
  * @param f                 pointer to the polynomial F1(z) or F2(z)
@@ -433,7 +433,7 @@ static void lsp2poly(float *lsp, float *
 }
 
 /**
- * Convert an lsp vector to lpc coefficients
+ * Convert an lsp vector to lpc coefficients.
  *
  * @param lsp                 input lsp vector
  * @param lpc                 output lpc coefficients
@@ -457,8 +457,8 @@ static void lsp2lpc(float *lsp, float *l
     // A(z) = ( F1'(z) + F2'(z) )/2
     // note f1 and f2 are actually f1' and f2'
     for(i=0; i<5; i++) {
-        lpc_coeffs[i]   = 0.5*(f1[i+2] + f2[i+2]); // lpc 0..4 uses indices to f, 2..6
-        lpc_coeffs[i+5] = 0.5*(f1[6-i] - f2[6-i]); // lpc 5..9 uses indices to f, 6..2
+        lpc_coeffs[i]   = 0.5*(f1[i+2] + f2[i+2]); // lpc 0..4 uses indexes to f, 2..6
+        lpc_coeffs[i+5] = 0.5*(f1[6-i] - f2[6-i]); // lpc 5..9 uses indexes to f, 6..2
     }
 }
 
@@ -468,8 +468,8 @@ static void lsp2lpc(float *lsp, float *l
 /*** pitch vector decoding functions ***/
 
 /**
- * Decode the adaptive codebook index to the integer and fractional parts of the
- * pitch lag for one subframe at 1/3 resolution
+ * Decode the adaptive codebook index to the integer and fractional parts
+ * of the pitch lag for one subframe at 1/3 resolution.
  *
  * @param p                   pointer to the AMRContext
  * @param pitch_index         parsed adaptive codebook (pitch) index
@@ -492,7 +492,7 @@ static void decode_pitch_lag_3(AMRContex
     }else {
         if( (p->cur_frame_mode == MODE_475) || (p->cur_frame_mode == MODE_515) ||
             (p->cur_frame_mode == MODE_59)  || (p->cur_frame_mode == MODE_67) ) {
-            // decoding with 4 bit resolution
+            // decoding with 4-bit resolution
             int t1_temp = FFMAX(FFMIN(p->prev_pitch_lag_int, p->search_range_max-4), p->search_range_min+5);
 
             if(pitch_index < 4) {
@@ -519,8 +519,8 @@ static void decode_pitch_lag_3(AMRContex
 }
 
 /**
- * Decode the adaptive codebook index to the integer and fractional parts of the
- * pitch lag for one subframe at 1/6 resolution
+ * Decode the adaptive codebook index to the integer and fractional parts
+ * of the pitch lag for one subframe at 1/6 resolution.
  *
  * @param p                   pointer to the AMRContext
  * @param pitch_index         parsed adaptive codebook (pitch) index
@@ -550,7 +550,7 @@ static void decode_pitch_lag_6(AMRContex
 
 /**
  * Calculate the pitch vector by interpolating the past excitation at the pitch
- * pitch lag using a b60 hamming windowed sinc function
+ * pitch lag using a b60 hamming windowed sinc function.
  *
  * @param prev_excitation     pointer to the element after the previous excitations
  * @param lag_int             integer part of pitch lag
@@ -599,7 +599,7 @@ static void interp_pitch_vector(float *p
 /*** algebraic code book (fixed) vector decoding functions ***/
 
 /**
- * Reconstruct the algebraic codebook vector
+ * Reconstruct the algebraic codebook vector.
  *
  * @param pulse_position       vector of pulse positions
  * @param sign                 signs of the pulses
@@ -620,8 +620,8 @@ static void reconstruct_fixed_vector(int
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_475 and MODE_515
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_475 and MODE_515.
  *
  * @param fixed_index          positions of the two pulses
  * @param sign                 signs of the two pulses
@@ -647,8 +647,8 @@ static void decode_2_pulses_9bits(int fi
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_59
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_59.
  *
  * @param fixed_index          positions of the two pulses
  * @param sign                 signs of the two pulses
@@ -676,8 +676,8 @@ static void decode_2_pulses_11bits(int f
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_67
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_67.
  *
  * @param fixed_index          positions of the three pulses
  * @param sign                 signs of the three pulses
@@ -706,8 +706,8 @@ static void decode_3_pulses_14bits(int f
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_74 and MODE_795
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_74 and MODE_795.
  *
  * @param fixed_index          positions of the four pulses
  * @param sign                 signs of the four pulses
@@ -736,8 +736,8 @@ static void decode_4_pulses_17bits(int f
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_102
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_102.
  *
  * @param fixed_index          positions of the eight pulses
  * @param fixed_vector         pointer to the algebraic codebook vector
@@ -791,8 +791,8 @@ static void decode_8_pulses_31bits(int16
 }
 
 /**
- * Decode the algebraic codebook index to pulse positions and signs and construct
- * the algebraic codebook vector for MODE_122
+ * Decode the algebraic codebook index to pulse positions and signs and
+ * construct the algebraic codebook vector for MODE_122.
  *
  * @param fixed_index          positions of the ten pulses
  * @param fixed_vector         pointer to the algebraic codebook vector
@@ -827,12 +827,12 @@ static void decode_10_pulses_35bits(int1
 /*** gain decoding functions ***/
 
 /**
- * Predict the fixed gain
+ * Predict the fixed gain.
  *
  * @param fixed_vector         pointer to the algebraic codebook vector
  * @param prev_pred_error      pointer to the quantified prediction errors from the previous four subframes
  *
- * @return Returns the predicted fixed gain
+ * @return the predicted fixed gain
  */
 
 static float fixed_gain_prediction(float *fixed_vector, float *prev_pred_error,
@@ -863,10 +863,10 @@ static float fixed_gain_prediction(float
 /*** pre-processing functions ***/
 
 /**
- * Comparison function for use with qsort
+ * Comparison function for use with qsort.
  *
- * @param a             First value for comparison
- * @param b             Second value for comparison
+ * @param a             first value for comparison
+ * @param b             second value for comparison
  * @return a-b : the result of the comparison
  */
 
@@ -881,11 +881,11 @@ int qsort_compare(const float *a, const 
 }
 
 /**
- * Find the median of some float values
+ * Find the median of some float values.
  *
  * @param values        pointer to the values of which to find the median
  * @param n             number of values
- * @return Returns the median value
+ * @return the median value
  */
 
 static float medianf(float *values, int n)
@@ -905,7 +905,7 @@ static float medianf(float *values, int 
 
 /**
  * Circularly convolve the fixed vector with a phase dispersion impulse response
- * filter
+ * filter.
  *
  * @param fixed_vector  pointer to the fixed vector
  * @param ir_filter     pointer to the impulse response filter
@@ -945,7 +945,7 @@ static void convolve_circ(float *fixed_v
 /*** synthesis functions ***/
 
 /**
- * Conduct 10th order linear predictive coding synthesis
+ * Conduct 10th order linear predictive coding synthesis.
  *
  * @param p             pointer to the AMRContext
  * @param excitation    pointer to the excitation vector
@@ -980,7 +980,7 @@ static int synthesis(AMRContext *p, floa
         float eta, temp1 = 0.0, temp2 = 0.0;
 
         for(i=0; i<AMR_SUBFRAME_SIZE; i++) {
-            // emphasise pitch vector contribution
+            // emphasize pitch vector contribution
             excitation_temp[i] = excitation[i] + pitch_factor*p->pitch_vector[i];
             // find gain scale
             temp1 +=      excitation[i]*excitation[i];
@@ -999,7 +999,7 @@ static int synthesis(AMRContext *p, floa
         for(j=0; j<LP_FILTER_ORDER; j++) {
             samples[i] -= lpc[j]*samples[i-j-1];
         }
-        // Detect overflow
+        // detect overflow
         if(fabsf(samples[i])>1.0) {
             overflow_temp = 1;
             samples[i] = av_clipf(samples[i], -1.0, 1.0);
@@ -1015,7 +1015,7 @@ static int synthesis(AMRContext *p, floa
 /*** update functions ***/
 
 /**
- * Update buffers and history at the end of decoding a subframe
+ * Update buffers and history at the end of decoding a subframe.
  *
  * @param p             pointer to the AMRContext
  */
@@ -1066,20 +1066,20 @@ static int amrnb_decode_frame(AVCodecCon
     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
+    // decode the bitstream to AMR parameters
     p->cur_frame_mode = decode_bitstream(p, buf, buf_size, &speech_mode);
 
 /*** LPC coefficient decoding ***/
 
     if(p->cur_frame_mode == MODE_122) {
-        // decode split-matrix quantised lsf vector indices to lsp vectors
+        // decode split-matrix quantized lsf vector indexes to lsp vectors
         lsf2lsp_5(p);
         // interpolate LSP vectors at subframes 1 and 3
         interp_lsp_13(p);
         // advance index into amr_prms
         index += 5;
     }else {
-        // decode split-matrix quantised lsf vector indices to an lsp vector
+        // decode split-matrix quantized lsf vector indexes to an lsp vector
         lsf2lsp_3(p);
         // interpolate LSP vectors at subframes 1, 2 and 3
         interp_lsp_123(p);
@@ -1305,10 +1305,10 @@ static int amrnb_decode_frame(AVCodecCon
 
     }
 
-    /* Report how many samples we got */
+    /* report how many samples we got */
     *data_size = AMR_BLOCK_SIZE * sizeof(int16_t);
 
-    /* Return the amount of bytes consumed if everything was ok */
+    /* return the amount of bytes consumed if everything was OK */
     return (mode_bits[p->cur_frame_mode] + 15)>>3; // +7 for rounding and +8 for TOC
 }
 
@@ -1317,7 +1317,7 @@ static int amrnb_decode_close(AVCodecCon
 {
     AMRContext *p = avctx->priv_data;
 
-    /* Return 0 if everything is ok, -1 if not */
+    /* return 0 if everything is OK, -1 if not */
     return 0;
 }
 



More information about the FFmpeg-soc mailing list