Mercurial > libavcodec.hg
comparison ra144.c @ 6897:27e2ec900300 libavcodec
Rename var: swapbuf* are LPC related
author | vitor |
---|---|
date | Mon, 26 May 2008 18:16:05 +0000 |
parents | 5f79e5940b33 |
children | 27b34839f1db |
comparison
equal
deleted
inserted
replaced
6896:5f79e5940b33 | 6897:27e2ec900300 |
---|---|
32 /* internal globals */ | 32 /* internal globals */ |
33 typedef struct { | 33 typedef struct { |
34 unsigned int oldval; | 34 unsigned int oldval; |
35 | 35 |
36 /* the swapped buffers */ | 36 /* the swapped buffers */ |
37 unsigned int swapbuffers[4][10]; | 37 unsigned int lpc_tables[4][10]; |
38 unsigned int *swapbuf1; | 38 unsigned int *lpc_refl; //< LPC reflection coefficients |
39 unsigned int *swapbuf2; | 39 unsigned int *lpc_coef; //< LPC coefficients |
40 unsigned int *swapbuf1alt; | 40 unsigned int *lpc_refl_old; //< previous frame LPC reflection coefs |
41 unsigned int *swapbuf2alt; | 41 unsigned int *lpc_coef_old; //< previous frame LPC coefficients |
42 | 42 |
43 unsigned int buffer[5]; | 43 unsigned int buffer[5]; |
44 uint16_t adapt_cb[148]; //< Adaptative codebook | 44 uint16_t adapt_cb[148]; //< Adaptative codebook |
45 } RA144Context; | 45 } RA144Context; |
46 | 46 |
47 static int ra144_decode_init(AVCodecContext * avctx) | 47 static int ra144_decode_init(AVCodecContext * avctx) |
48 { | 48 { |
49 RA144Context *ractx = avctx->priv_data; | 49 RA144Context *ractx = avctx->priv_data; |
50 | 50 |
51 ractx->swapbuf1 = ractx->swapbuffers[0]; | 51 ractx->lpc_refl = ractx->lpc_tables[0]; |
52 ractx->swapbuf2 = ractx->swapbuffers[1]; | 52 ractx->lpc_coef = ractx->lpc_tables[1]; |
53 ractx->swapbuf1alt = ractx->swapbuffers[2]; | 53 ractx->lpc_refl_old = ractx->lpc_tables[2]; |
54 ractx->swapbuf2alt = ractx->swapbuffers[3]; | 54 ractx->lpc_coef_old = ractx->lpc_tables[3]; |
55 | 55 |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 | 58 |
59 /* lookup square roots in table */ | 59 /* lookup square roots in table */ |
324 } | 324 } |
325 init_get_bits(&gb, buf, 20 * 8); | 325 init_get_bits(&gb, buf, 20 * 8); |
326 | 326 |
327 for (i=0; i<10; i++) | 327 for (i=0; i<10; i++) |
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->swapbuf1[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->swapbuf1, ractx->swapbuf2); | 331 do_voice(ractx->lpc_refl, ractx->lpc_coef); |
332 | 332 |
333 val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries? | 333 val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries? |
334 a = t_sqrt(val*ractx->oldval) >> 12; | 334 a = t_sqrt(val*ractx->oldval) >> 12; |
335 | 335 |
336 gbuf1[0] = dec2(gbuf2[0], ractx->swapbuf1alt, ractx->swapbuf2alt, ractx->oldval, ractx->swapbuf2, 3); | 336 gbuf1[0] = dec2(gbuf2[0], ractx->lpc_refl_old, ractx->lpc_coef_old, ractx->oldval, ractx->lpc_coef, 3); |
337 if (ractx->oldval < val) { | 337 if (ractx->oldval < val) { |
338 gbuf1[1] = dec2(gbuf2[1], ractx->swapbuf1, ractx->swapbuf2, a, ractx->swapbuf2alt, 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->swapbuf1alt, ractx->swapbuf2alt, a, ractx->swapbuf2, 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->swapbuf1, ractx->swapbuf2, val, ractx->swapbuf2alt, 3); | 342 gbuf1[2] = dec2(gbuf2[2], ractx->lpc_refl, ractx->lpc_coef, val, ractx->lpc_coef_old, 3); |
343 gbuf1[3] = dec1(gbuf2[3], ractx->swapbuf1, ractx->swapbuf2, val); | 343 gbuf1[3] = dec1(gbuf2[3], ractx->lpc_refl, ractx->lpc_coef, val); |
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 |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 ractx->oldval = val; | 355 ractx->oldval = val; |
356 | 356 |
357 FFSWAP(unsigned int *, ractx->swapbuf1alt, ractx->swapbuf1); | 357 FFSWAP(unsigned int *, ractx->lpc_refl_old, ractx->lpc_refl); |
358 FFSWAP(unsigned int *, ractx->swapbuf2alt, ractx->swapbuf2); | 358 FFSWAP(unsigned int *, ractx->lpc_coef_old, ractx->lpc_coef); |
359 | 359 |
360 *data_size = 2*160; | 360 *data_size = 2*160; |
361 return 20; | 361 return 20; |
362 } | 362 } |
363 | 363 |