Originally committed as revision 15296 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -38,16 +38,16 @@ typedef struct { | |||||
| unsigned int lpc_tables[2][10]; | unsigned int lpc_tables[2][10]; | ||||
| /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame | /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame | ||||
| * and lpc_coef[1] of the previous one */ | |||||
| * and lpc_coef[1] of the previous one. */ | |||||
| unsigned int *lpc_coef[2]; | unsigned int *lpc_coef[2]; | ||||
| unsigned int lpc_refl_rms[2]; | unsigned int lpc_refl_rms[2]; | ||||
| /** the current subblock padded by the last 10 values of the previous one*/ | |||||
| /** The current subblock padded by the last 10 values of the previous one. */ | |||||
| int16_t curr_sblock[50]; | int16_t curr_sblock[50]; | ||||
| /** adaptive codebook. Its size is two units bigger to avoid a | |||||
| * buffer overflow */ | |||||
| /** Adaptive codebook, its size is two units bigger to avoid a | |||||
| * buffer overflow. */ | |||||
| uint16_t adapt_cb[146+2]; | uint16_t adapt_cb[146+2]; | ||||
| } RA144Context; | } RA144Context; | ||||
| @@ -218,7 +218,7 @@ static void int_to_int16(int16_t *out, const int *inp) | |||||
| * Evaluate the reflection coefficients from the filter coefficients. | * Evaluate the reflection coefficients from the filter coefficients. | ||||
| * Does the inverse of the eval_coefs() function. | * Does the inverse of the eval_coefs() function. | ||||
| * | * | ||||
| * @return 1 if one of the reflection coefficients is of magnitude greater than | |||||
| * @return 1 if one of the reflection coefficients is greater than | |||||
| * 4095, 0 if not. | * 4095, 0 if not. | ||||
| */ | */ | ||||
| static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) | static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) | ||||
| @@ -265,14 +265,14 @@ static int interp(RA144Context *ractx, int16_t *out, int a, | |||||
| int b = NBLOCKS - a; | int b = NBLOCKS - a; | ||||
| int i; | int i; | ||||
| // Interpolate block coefficients from the this frame forth block and | |||||
| // last frame forth block | |||||
| // Interpolate block coefficients from the this frame's forth block and | |||||
| // last frame's forth block. | |||||
| for (i=0; i<30; i++) | for (i=0; i<30; i++) | ||||
| out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; | out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; | ||||
| if (eval_refl(work, out, ractx)) { | if (eval_refl(work, out, ractx)) { | ||||
| // The interpolated coefficients are unstable, copy either new or old | // The interpolated coefficients are unstable, copy either new or old | ||||
| // coefficients | |||||
| // coefficients. | |||||
| int_to_int16(out, ractx->lpc_coef[copyold]); | int_to_int16(out, ractx->lpc_coef[copyold]); | ||||
| return rescale_rms(ractx->lpc_refl_rms[copyold], energy); | return rescale_rms(ractx->lpc_refl_rms[copyold], energy); | ||||
| } else { | } else { | ||||
| @@ -280,7 +280,7 @@ static int interp(RA144Context *ractx, int16_t *out, int a, | |||||
| } | } | ||||
| } | } | ||||
| /** Uncompress one block (20 bytes -> 160*2 bytes) */ | |||||
| /** Uncompress one block (20 bytes -> 160*2 bytes). */ | |||||
| static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, | static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, | ||||
| int *data_size, const uint8_t *buf, int buf_size) | int *data_size, const uint8_t *buf, int buf_size) | ||||
| { | { | ||||
| @@ -29,18 +29,18 @@ typedef struct { | |||||
| float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A) | float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A) | ||||
| float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB) | float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB) | ||||
| float sp_hist[111]; ///< Speech data history (spec: SB) | |||||
| float sp_hist[111]; ///< speech data history (spec: SB) | |||||
| /** Speech part of the gain autocorrelation (spec: REXP) */ | |||||
| /** speech part of the gain autocorrelation (spec: REXP) */ | |||||
| float sp_rec[37]; | float sp_rec[37]; | ||||
| float gain_hist[38]; ///< Log-gain history (spec: SBLG) | |||||
| float gain_hist[38]; ///< log-gain history (spec: SBLG) | |||||
| /** Recursive part of the gain autocorrelation (spec: REXPLG) */ | |||||
| /** recursive part of the gain autocorrelation (spec: REXPLG) */ | |||||
| float gain_rec[11]; | float gain_rec[11]; | ||||
| float sp_block[41]; ///< Speech data of four blocks (spec: STTMP) | |||||
| float gain_block[10]; ///< Gain data of four blocks (spec: GSTATE) | |||||
| float sp_block[41]; ///< four blocks of speech data (spec: STTMP) | |||||
| float gain_block[10]; ///< four blocks of gain data (spec: GSTATE) | |||||
| } RA288Context; | } RA288Context; | ||||
| static av_cold int ra288_decode_init(AVCodecContext *avctx) | static av_cold int ra288_decode_init(AVCodecContext *avctx) | ||||
| @@ -71,7 +71,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef) | |||||
| int i, j; | int i, j; | ||||
| double sumsum; | double sumsum; | ||||
| float sum, buffer[5]; | float sum, buffer[5]; | ||||
| float *block = ractx->sp_block + 36; // Current block | |||||
| float *block = ractx->sp_block + 36; // current block | |||||
| memmove(ractx->sp_block, ractx->sp_block + 5, 36*sizeof(*ractx->sp_block)); | memmove(ractx->sp_block, ractx->sp_block + 5, 36*sizeof(*ractx->sp_block)); | ||||
| @@ -122,14 +122,14 @@ static void convolve(float *tgt, const float *src, int len, int n) | |||||
| } | } | ||||
| /** | /** | ||||
| * Hybrid window filtering. See blocks 36 and 49 of the G.728 specification. | |||||
| * Hybrid window filtering, see blocks 36 and 49 of the G.728 specification. | |||||
| * | * | ||||
| * @param order the order of the filter | |||||
| * @param n the length of the input | |||||
| * @param non_rec the number of non-recursive samples | |||||
| * @param out the filter output | |||||
| * @param order filter order | |||||
| * @param n input length | |||||
| * @param non_rec number of non-recursive samples | |||||
| * @param out filter output | |||||
| * @param in pointer to the input of the filter | * @param in pointer to the input of the filter | ||||
| * @param hist pointer to the input history of the filter. It is updated by | |||||
| * @param hist Pointer to the input history of the filter, it is updated by | |||||
| * this function. | * this function. | ||||
| * @param out pointer to the non-recursive part of the output | * @param out pointer to the non-recursive part of the output | ||||
| * @param out2 pointer to the recursive part of the output | * @param out2 pointer to the recursive part of the output | ||||
| @@ -158,12 +158,12 @@ static void do_hybrid_window(int order, int n, int non_rec, const float *in, | |||||
| out [i] = out2[i] + buffer2[i]; | out [i] = out2[i] + buffer2[i]; | ||||
| } | } | ||||
| /* Multiply by the white noise correcting factor (WNCF) */ | |||||
| /* Multiply by the white noise correcting factor (WNCF). */ | |||||
| *out *= 257./256.; | *out *= 257./256.; | ||||
| } | } | ||||
| /** | /** | ||||
| * Backward synthesis filter. Find the LPC coefficients from past speech data. | |||||
| * Backward synthesis filter, find the LPC coefficients from past speech data. | |||||
| */ | */ | ||||
| static void backward_filter(RA288Context *ractx) | static void backward_filter(RA288Context *ractx) | ||||
| { | { | ||||
| @@ -126,7 +126,7 @@ static const float gain_window[38]={ | |||||
| 0.183868408, 0.0923461914 | 0.183868408, 0.0923461914 | ||||
| }; | }; | ||||
| /** Synthesis bandwidth broadening table */ | |||||
| /** synthesis bandwidth broadening table */ | |||||
| static const float syn_bw_tab[36]={ | static const float syn_bw_tab[36]={ | ||||
| 0.98828125, 0.976699829, 0.965254128, 0.953942537, 0.942763507, 0.931715488, | 0.98828125, 0.976699829, 0.965254128, 0.953942537, 0.942763507, 0.931715488, | ||||
| 0.920796931, 0.910006344, 0.899342179, 0.888803005, 0.878387332, 0.868093729, | 0.920796931, 0.910006344, 0.899342179, 0.888803005, 0.878387332, 0.868093729, | ||||
| @@ -136,7 +136,7 @@ static const float syn_bw_tab[36]={ | |||||
| 0.693900526, 0.685768902, 0.677732527, 0.669790328, 0.66194123, 0.654184103 | 0.693900526, 0.685768902, 0.677732527, 0.669790328, 0.66194123, 0.654184103 | ||||
| }; | }; | ||||
| /** Gain bandwidth broadening table */ | |||||
| /** gain bandwidth broadening table */ | |||||
| static const float gain_bw_tab[10]={ | static const float gain_bw_tab[10]={ | ||||
| 0.90625, 0.821289063, 0.74432373, 0.674499512, 0.61126709, | 0.90625, 0.821289063, 0.74432373, 0.674499512, 0.61126709, | ||||
| 0.553955078, 0.50201416, 0.454956055, 0.41229248, 0.373657227 | 0.553955078, 0.50201416, 0.454956055, 0.41229248, 0.373657227 | ||||