Mercurial > libavcodec.hg
comparison ra144.c @ 11868:159554445343 libavcodec
Split do_output_subblock() into common code and decoder specific parts
Patch by Francesco Lavra (firstnamelastname@interfree.it)
author | vitor |
---|---|
date | Fri, 11 Jun 2010 08:05:17 +0000 |
parents | ba4e21f7bd3a |
children |
comparison
equal
deleted
inserted
replaced
11867:ba4e21f7bd3a | 11868:159554445343 |
---|---|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 | 21 |
22 #include <stdint.h> | 22 #include <stdint.h> |
23 #include "avcodec.h" | 23 #include "avcodec.h" |
24 #include "celp_filters.h" | |
24 #include "ra144.h" | 25 #include "ra144.h" |
25 | 26 |
26 const int16_t ff_gain_val_tab[256][3] = { | 27 const int16_t ff_gain_val_tab[256][3] = { |
27 { 541, 956, 768}, { 877, 581, 568}, { 675,1574, 635}, {1248,1464, 668}, | 28 { 541, 956, 768}, { 877, 581, 568}, { 675,1574, 635}, {1248,1464, 668}, |
28 {1246, 839, 1394}, {2560,1386, 991}, { 925, 687, 608}, {2208, 797, 1144}, | 29 {1246, 839, 1394}, {2560,1386, 991}, { 925, 687, 608}, {2208, 797, 1144}, |
1682 if (sum == 0) | 1683 if (sum == 0) |
1683 return 0; /* OOPS - division by zero */ | 1684 return 0; /* OOPS - division by zero */ |
1684 | 1685 |
1685 return 0x20000000 / (ff_t_sqrt(sum) >> 8); | 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 } |