Mercurial > libavcodec.hg
comparison ra144.c @ 7847:5a114f24632a libavcodec
misc spelling/wording/grammar fixes
author | diego |
---|---|
date | Thu, 11 Sep 2008 08:13:23 +0000 |
parents | b9a26c7e64ef |
children | 611a21e4b01b |
comparison
equal
deleted
inserted
replaced
7846:a7162bb60138 | 7847:5a114f24632a |
---|---|
36 unsigned int old_energy; ///< previous frame energy | 36 unsigned int old_energy; ///< previous frame energy |
37 | 37 |
38 unsigned int lpc_tables[2][10]; | 38 unsigned int lpc_tables[2][10]; |
39 | 39 |
40 /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame | 40 /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame |
41 * and lpc_coef[1] of the previous one */ | 41 * and lpc_coef[1] of the previous one. */ |
42 unsigned int *lpc_coef[2]; | 42 unsigned int *lpc_coef[2]; |
43 | 43 |
44 unsigned int lpc_refl_rms[2]; | 44 unsigned int lpc_refl_rms[2]; |
45 | 45 |
46 /** the current subblock padded by the last 10 values of the previous one*/ | 46 /** The current subblock padded by the last 10 values of the previous one. */ |
47 int16_t curr_sblock[50]; | 47 int16_t curr_sblock[50]; |
48 | 48 |
49 /** adaptive codebook. Its size is two units bigger to avoid a | 49 /** Adaptive codebook, its size is two units bigger to avoid a |
50 * buffer overflow */ | 50 * buffer overflow. */ |
51 uint16_t adapt_cb[146+2]; | 51 uint16_t adapt_cb[146+2]; |
52 } RA144Context; | 52 } RA144Context; |
53 | 53 |
54 static av_cold int ra144_decode_init(AVCodecContext * avctx) | 54 static av_cold int ra144_decode_init(AVCodecContext * avctx) |
55 { | 55 { |
216 | 216 |
217 /** | 217 /** |
218 * Evaluate the reflection coefficients from the filter coefficients. | 218 * Evaluate the reflection coefficients from the filter coefficients. |
219 * Does the inverse of the eval_coefs() function. | 219 * Does the inverse of the eval_coefs() function. |
220 * | 220 * |
221 * @return 1 if one of the reflection coefficients is of magnitude greater than | 221 * @return 1 if one of the reflection coefficients is greater than |
222 * 4095, 0 if not. | 222 * 4095, 0 if not. |
223 */ | 223 */ |
224 static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) | 224 static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) |
225 { | 225 { |
226 int b, i, j; | 226 int b, i, j; |
263 { | 263 { |
264 int work[10]; | 264 int work[10]; |
265 int b = NBLOCKS - a; | 265 int b = NBLOCKS - a; |
266 int i; | 266 int i; |
267 | 267 |
268 // Interpolate block coefficients from the this frame forth block and | 268 // Interpolate block coefficients from the this frame's forth block and |
269 // last frame forth block | 269 // last frame's forth block. |
270 for (i=0; i<30; i++) | 270 for (i=0; i<30; i++) |
271 out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; | 271 out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; |
272 | 272 |
273 if (eval_refl(work, out, ractx)) { | 273 if (eval_refl(work, out, ractx)) { |
274 // The interpolated coefficients are unstable, copy either new or old | 274 // The interpolated coefficients are unstable, copy either new or old |
275 // coefficients | 275 // coefficients. |
276 int_to_int16(out, ractx->lpc_coef[copyold]); | 276 int_to_int16(out, ractx->lpc_coef[copyold]); |
277 return rescale_rms(ractx->lpc_refl_rms[copyold], energy); | 277 return rescale_rms(ractx->lpc_refl_rms[copyold], energy); |
278 } else { | 278 } else { |
279 return rescale_rms(rms(work), energy); | 279 return rescale_rms(rms(work), energy); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 /** Uncompress one block (20 bytes -> 160*2 bytes) */ | 283 /** Uncompress one block (20 bytes -> 160*2 bytes). */ |
284 static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, | 284 static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, |
285 int *data_size, const uint8_t *buf, int buf_size) | 285 int *data_size, const uint8_t *buf, int buf_size) |
286 { | 286 { |
287 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; | 287 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; |
288 unsigned int refl_rms[4]; // RMS of the reflection coefficients | 288 unsigned int refl_rms[4]; // RMS of the reflection coefficients |