diff options
-rw-r--r-- | apps/codecs/libwma/wmadec.h | 4 | ||||
-rw-r--r-- | apps/codecs/libwma/wmadeci.c | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/apps/codecs/libwma/wmadec.h b/apps/codecs/libwma/wmadec.h index 395b29f6e8..56f935bbb4 100644 --- a/apps/codecs/libwma/wmadec.h +++ b/apps/codecs/libwma/wmadec.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define M_PI 3.14159265358979323846 | 25 | #define M_PI 3.14159265358979323846 |
26 | 26 | ||
27 | #define M_PI_F 0x3243f // in fixed 32 format | 27 | #define M_PI_F 0x3243f // in fixed 32 format |
28 | #define TWO_M_PI_F 0x6487f //in fixed 32 | 28 | #define TWO_M_PI_F 0x6487f //in fixed 32 |
29 | 29 | ||
30 | #define MAX_CHANNELS 2 | 30 | #define MAX_CHANNELS 2 |
31 | 31 | ||
@@ -128,7 +128,7 @@ typedef struct WMADecodeContext | |||
128 | fixed32 exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 128 | fixed32 exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
129 | fixed32 max_exponent[MAX_CHANNELS]; | 129 | fixed32 max_exponent[MAX_CHANNELS]; |
130 | int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 130 | int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
131 | fixed32 coefs[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 131 | fixed32 (*coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
132 | MDCTContext mdct_ctx[BLOCK_NB_SIZES]; | 132 | MDCTContext mdct_ctx[BLOCK_NB_SIZES]; |
133 | fixed32 *windows[BLOCK_NB_SIZES]; | 133 | fixed32 *windows[BLOCK_NB_SIZES]; |
134 | FFTComplex *mdct_tmp; /* temporary storage for imdct */ | 134 | FFTComplex *mdct_tmp; /* temporary storage for imdct */ |
diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index 7eab26863c..a1326abbfe 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c | |||
@@ -106,6 +106,8 @@ static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); | |||
106 | int fft_calc(FFTContext *s, FFTComplex *z); | 106 | int fft_calc(FFTContext *s, FFTComplex *z); |
107 | 107 | ||
108 | 108 | ||
109 | fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; | ||
110 | |||
109 | //static variables that replace malloced stuff | 111 | //static variables that replace malloced stuff |
110 | fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows | 112 | fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows |
111 | 113 | ||
@@ -755,6 +757,8 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) | |||
755 | s->bit_rate = wfx->bitrate; | 757 | s->bit_rate = wfx->bitrate; |
756 | s->block_align = wfx->blockalign; | 758 | s->block_align = wfx->blockalign; |
757 | 759 | ||
760 | s->coefs = &coefsarray; | ||
761 | |||
758 | if (wfx->codec_id == ASF_CODEC_ID_WMAV1){ | 762 | if (wfx->codec_id == ASF_CODEC_ID_WMAV1){ |
759 | s->version = 1; | 763 | s->version = 1; |
760 | }else{ | 764 | }else{ |
@@ -1612,7 +1616,7 @@ static int wma_decode_block(WMADecodeContext *s) | |||
1612 | // mul = fixtof64(pow_table[total_gain])/(s->block_len/2)/fixtof64(s->max_exponent[ch]); | 1616 | // mul = fixtof64(pow_table[total_gain])/(s->block_len/2)/fixtof64(s->max_exponent[ch]); |
1613 | 1617 | ||
1614 | mult = fixmul64byfixed(mult, mdct_norm); //what the hell? This is actually fixed64*2^16! | 1618 | mult = fixmul64byfixed(mult, mdct_norm); //what the hell? This is actually fixed64*2^16! |
1615 | coefs = s->coefs[ch]; //VLC exponenents are used to get MDCT coef here! | 1619 | coefs = (*(s->coefs))[ch]; //VLC exponenents are used to get MDCT coef here! |
1616 | 1620 | ||
1617 | n=0; | 1621 | n=0; |
1618 | 1622 | ||
@@ -1750,16 +1754,16 @@ static int wma_decode_block(WMADecodeContext *s) | |||
1750 | never happen */ | 1754 | never happen */ |
1751 | if (!s->channel_coded[0]) | 1755 | if (!s->channel_coded[0]) |
1752 | { | 1756 | { |
1753 | memset(s->coefs[0], 0, sizeof(fixed32) * s->block_len); | 1757 | memset((*(s->coefs))[0], 0, sizeof(fixed32) * s->block_len); |
1754 | s->channel_coded[0] = 1; | 1758 | s->channel_coded[0] = 1; |
1755 | } | 1759 | } |
1756 | 1760 | ||
1757 | for(i = 0; i < s->block_len; ++i) | 1761 | for(i = 0; i < s->block_len; ++i) |
1758 | { | 1762 | { |
1759 | a = s->coefs[0][i]; | 1763 | a = (*s->coefs)[0][i]; |
1760 | b = s->coefs[1][i]; | 1764 | b = (*s->coefs)[1][i]; |
1761 | s->coefs[0][i] = a + b; | 1765 | (*s->coefs)[0][i] = a + b; |
1762 | s->coefs[1][i] = a - b; | 1766 | (*s->coefs)[1][i] = a - b; |
1763 | } | 1767 | } |
1764 | } | 1768 | } |
1765 | 1769 | ||
@@ -1776,7 +1780,7 @@ static int wma_decode_block(WMADecodeContext *s) | |||
1776 | 1780 | ||
1777 | ff_imdct_calc(&s->mdct_ctx[bsize], | 1781 | ff_imdct_calc(&s->mdct_ctx[bsize], |
1778 | output, | 1782 | output, |
1779 | s->coefs[ch], | 1783 | (*(s->coefs))[ch], |
1780 | s->mdct_tmp); | 1784 | s->mdct_tmp); |
1781 | 1785 | ||
1782 | 1786 | ||