Mercurial > libavcodec.hg
comparison ra144.c @ 6968:50dd3a733f43 libavcodec
The function dec1() do two completly unrelated things. Split the rms calculation out of it.
author | vitor |
---|---|
date | Sun, 01 Jun 2008 19:30:07 +0000 |
parents | c3446faee506 |
children | 1f0026d344a9 |
comparison
equal
deleted
inserted
replaced
6967:c3446faee506 | 6968:50dd3a733f43 |
---|---|
237 block); | 237 block); |
238 | 238 |
239 final(lpc_coefs, block, output_buffer, ractx->buffer, BLOCKSIZE); | 239 final(lpc_coefs, block, output_buffer, ractx->buffer, BLOCKSIZE); |
240 } | 240 } |
241 | 241 |
242 static int dec1(int16_t *decsp, const int *data, const int *inp, int f) | 242 static void dec1(int16_t *decsp, const int *inp) |
243 { | 243 { |
244 int i; | 244 int i; |
245 | 245 |
246 for (i=0; i<30; i++) | 246 for (i=0; i<30; i++) |
247 *(decsp++) = *(inp++); | 247 *(decsp++) = *(inp++); |
248 | |
249 return rms(data, f); | |
250 } | 248 } |
251 | 249 |
252 /** | 250 /** |
253 * Evaluate the reflection coefficients from the filter coefficients. | 251 * Evaluate the reflection coefficients from the filter coefficients. |
254 * Does the inverse of the eval_coefs() function. | 252 * Does the inverse of the eval_coefs() function. |
313 decsp[x] = (a * ractx->lpc_coef[x] + b * ractx->lpc_coef_old[x])>> 2; | 311 decsp[x] = (a * ractx->lpc_coef[x] + b * ractx->lpc_coef_old[x])>> 2; |
314 | 312 |
315 if (eval_refl(decsp, work)) { | 313 if (eval_refl(decsp, work)) { |
316 // The interpolated coefficients are unstable, copy either new or old | 314 // The interpolated coefficients are unstable, copy either new or old |
317 // coefficients | 315 // coefficients |
318 if (copynew) | 316 if (copynew) { |
319 return dec1(decsp, ractx->lpc_refl, ractx->lpc_coef, f); | 317 dec1(decsp, ractx->lpc_coef); |
320 else | 318 return rms(ractx->lpc_refl, f); |
321 return dec1(decsp, ractx->lpc_refl_old, ractx->lpc_coef_old, f); | 319 } else { |
320 dec1(decsp, ractx->lpc_coef_old); | |
321 return rms(ractx->lpc_refl_old, f); | |
322 } | |
322 } else { | 323 } else { |
323 return rms(work, f); | 324 return rms(work, f); |
324 } | 325 } |
325 } | 326 } |
326 | 327 |
356 | 357 |
357 refl_rms[0] = dec2(ractx, block_coefs[0], 0, 0, ractx->old_energy); | 358 refl_rms[0] = dec2(ractx, block_coefs[0], 0, 0, ractx->old_energy); |
358 refl_rms[1] = dec2(ractx, block_coefs[1], 1, energy > ractx->old_energy, | 359 refl_rms[1] = dec2(ractx, block_coefs[1], 1, energy > ractx->old_energy, |
359 t_sqrt(energy*ractx->old_energy) >> 12); | 360 t_sqrt(energy*ractx->old_energy) >> 12); |
360 refl_rms[2] = dec2(ractx, block_coefs[2], 2, 1, energy); | 361 refl_rms[2] = dec2(ractx, block_coefs[2], 2, 1, energy); |
361 refl_rms[3] = dec1(block_coefs[3], ractx->lpc_refl, ractx->lpc_coef, | 362 refl_rms[3] = rms(ractx->lpc_refl, energy); |
362 energy); | 363 |
364 dec1(block_coefs[3], ractx->lpc_coef); | |
363 | 365 |
364 /* do output */ | 366 /* do output */ |
365 for (c=0; c<4; c++) { | 367 for (c=0; c<4; c++) { |
366 do_output_subblock(ractx, block_coefs[c], refl_rms[c], data, &gb); | 368 do_output_subblock(ractx, block_coefs[c], refl_rms[c], data, &gb); |
367 | 369 |