comparison ra144.c @ 6898:27b34839f1db libavcodec

Rename var: val -> energy
author vitor
date Mon, 26 May 2008 18:18:33 +0000
parents 27e2ec900300
children 61283b6e5f73
comparison
equal deleted inserted replaced
6897:27e2ec900300 6898:27b34839f1db
29 #define BUFFERSIZE 146 /* for do_output */ 29 #define BUFFERSIZE 146 /* for do_output */
30 30
31 31
32 /* internal globals */ 32 /* internal globals */
33 typedef struct { 33 typedef struct {
34 unsigned int oldval; 34 unsigned int old_energy;
35 35
36 /* the swapped buffers */ 36 /* the swapped buffers */
37 unsigned int lpc_tables[4][10]; 37 unsigned int lpc_tables[4][10];
38 unsigned int *lpc_refl; //< LPC reflection coefficients 38 unsigned int *lpc_refl; //< LPC reflection coefficients
39 unsigned int *lpc_coef; //< LPC coefficients 39 unsigned int *lpc_coef; //< LPC coefficients
310 unsigned int gbuf1[4]; 310 unsigned int gbuf1[4];
311 uint16_t gbuf2[4][30]; 311 uint16_t gbuf2[4][30];
312 unsigned int a, c; 312 unsigned int a, c;
313 int i; 313 int i;
314 int16_t *data = vdata; 314 int16_t *data = vdata;
315 unsigned int val; 315 unsigned int energy;
316 316
317 RA144Context *ractx = avctx->priv_data; 317 RA144Context *ractx = avctx->priv_data;
318 GetBitContext gb; 318 GetBitContext gb;
319 319
320 if(buf_size < 20) { 320 if(buf_size < 20) {
328 // "<< 1"? Doesn't this make one value out of two of the table useless? 328 // "<< 1"? Doesn't this make one value out of two of the table useless?
329 ractx->lpc_refl[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1]; 329 ractx->lpc_refl[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1];
330 330
331 do_voice(ractx->lpc_refl, ractx->lpc_coef); 331 do_voice(ractx->lpc_refl, ractx->lpc_coef);
332 332
333 val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries? 333 energy = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries?
334 a = t_sqrt(val*ractx->oldval) >> 12; 334 a = t_sqrt(energy*ractx->old_energy) >> 12;
335 335
336 gbuf1[0] = dec2(gbuf2[0], ractx->lpc_refl_old, ractx->lpc_coef_old, ractx->oldval, ractx->lpc_coef, 3); 336 gbuf1[0] = dec2(gbuf2[0], ractx->lpc_refl_old, ractx->lpc_coef_old, ractx->old_energy, ractx->lpc_coef, 3);
337 if (ractx->oldval < val) { 337 if (ractx->old_energy < energy) {
338 gbuf1[1] = dec2(gbuf2[1], ractx->lpc_refl, ractx->lpc_coef, a, ractx->lpc_coef_old, 2); 338 gbuf1[1] = dec2(gbuf2[1], ractx->lpc_refl, ractx->lpc_coef, a, ractx->lpc_coef_old, 2);
339 } else { 339 } else {
340 gbuf1[1] = dec2(gbuf2[1], ractx->lpc_refl_old, ractx->lpc_coef_old, a, ractx->lpc_coef, 2); 340 gbuf1[1] = dec2(gbuf2[1], ractx->lpc_refl_old, ractx->lpc_coef_old, a, ractx->lpc_coef, 2);
341 } 341 }
342 gbuf1[2] = dec2(gbuf2[2], ractx->lpc_refl, ractx->lpc_coef, val, ractx->lpc_coef_old, 3); 342 gbuf1[2] = dec2(gbuf2[2], ractx->lpc_refl, ractx->lpc_coef, energy, ractx->lpc_coef_old, 3);
343 gbuf1[3] = dec1(gbuf2[3], ractx->lpc_refl, ractx->lpc_coef, val); 343 gbuf1[3] = dec1(gbuf2[3], ractx->lpc_refl, ractx->lpc_coef, energy);
344 344
345 /* do output */ 345 /* do output */
346 for (c=0; c<4; c++) { 346 for (c=0; c<4; c++) {
347 do_output_subblock(ractx, gbuf2[c], gbuf1[c], data, &gb); 347 do_output_subblock(ractx, gbuf2[c], gbuf1[c], data, &gb);
348 348
350 *data = av_clip_int16(*data << 2); 350 *data = av_clip_int16(*data << 2);
351 data++; 351 data++;
352 } 352 }
353 } 353 }
354 354
355 ractx->oldval = val; 355 ractx->old_energy = energy;
356 356
357 FFSWAP(unsigned int *, ractx->lpc_refl_old, ractx->lpc_refl); 357 FFSWAP(unsigned int *, ractx->lpc_refl_old, ractx->lpc_refl);
358 FFSWAP(unsigned int *, ractx->lpc_coef_old, ractx->lpc_coef); 358 FFSWAP(unsigned int *, ractx->lpc_coef_old, ractx->lpc_coef);
359 359
360 *data_size = 2*160; 360 *data_size = 2*160;