Revision 756e3467 libavcodec/ra144.c
libavcodec/ra144.c | ||
---|---|---|
21 | 21 |
|
22 | 22 |
#include <stdint.h> |
23 | 23 |
#include "avcodec.h" |
24 |
#include "celp_filters.h" |
|
24 | 25 |
#include "ra144.h" |
25 | 26 |
|
26 | 27 |
const int16_t ff_gain_val_tab[256][3] = { |
... | ... | |
1684 | 1685 |
|
1685 | 1686 |
return 0x20000000 / (ff_t_sqrt(sum) >> 8); |
1686 | 1687 |
} |
1688 |
|
|
1689 |
void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs, |
|
1690 |
int cba_idx, int cb1_idx, int cb2_idx, |
|
1691 |
int gval, int gain) |
|
1692 |
{ |
|
1693 |
uint16_t buffer_a[40]; |
|
1694 |
uint16_t *block; |
|
1695 |
int m[3]; |
|
1696 |
|
|
1697 |
if (cba_idx) { |
|
1698 |
cba_idx += BLOCKSIZE/2 - 1; |
|
1699 |
ff_copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx); |
|
1700 |
m[0] = (ff_irms(buffer_a) * gval) >> 12; |
|
1701 |
} else { |
|
1702 |
m[0] = 0; |
|
1703 |
} |
|
1704 |
m[1] = (ff_cb1_base[cb1_idx] * gval) >> 8; |
|
1705 |
m[2] = (ff_cb2_base[cb2_idx] * gval) >> 8; |
|
1706 |
memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE, |
|
1707 |
(BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb)); |
|
1708 |
|
|
1709 |
block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE; |
|
1710 |
|
|
1711 |
ff_add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL, |
|
1712 |
ff_cb1_vects[cb1_idx], ff_cb2_vects[cb2_idx]); |
|
1713 |
|
|
1714 |
memcpy(ractx->curr_sblock, ractx->curr_sblock + 40, |
|
1715 |
10*sizeof(*ractx->curr_sblock)); |
|
1716 |
|
|
1717 |
if (ff_celp_lp_synthesis_filter(ractx->curr_sblock + 10, lpc_coefs, |
|
1718 |
block, BLOCKSIZE, 10, 1, 0xfff)) |
|
1719 |
memset(ractx->curr_sblock, 0, 50*sizeof(*ractx->curr_sblock)); |
|
1720 |
} |
Also available in: Unified diff