1
0
Fork 0
forked from len0rd/rockbox

Initial attept at supporting Line Spectral Pairs. Various issues remain, and the ffmpeg decoder itself often fails on certain valid LSP files. Expect some issues.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14134 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Giacomelli 2007-08-02 04:47:33 +00:00
parent 66029a58ae
commit 206e883e78
4 changed files with 125 additions and 83 deletions

View file

@ -1425,9 +1425,10 @@ static const CoefVLCTable coef_vlcs[6] = {
}, },
}; };
/*table of the values of 10^(index*.05)*/
const fixed64 pow_table[] = const fixed64 pow_table[] =
{ { 0x199a, 0x1cb9, 0x203a, 0x2429, 0x2893, 0x2d86, 0x3314, 0x3950, 0x404e, 0x4827,
0x50f4, 0x5ad5, 0x65ea, 0x725a, 0x804e, 0x8ff6, 0xa186, 0xb53c, 0xcb59, 0xe429,
0x10000LL,0x11f3dLL,0x14249LL,0x1699cLL,0x195bcLL,0x1c73dLL,0x1fec9LL,0x23d1dLL,0x2830bLL,0x2d182LL, 0x10000LL,0x11f3dLL,0x14249LL,0x1699cLL,0x195bcLL,0x1c73dLL,0x1fec9LL,0x23d1dLL,0x2830bLL,0x2d182LL,
0x3298bLL,0x38c53LL,0x3fb28LL,0x47783LL,0x5030aLL,0x59f98LL,0x64f40LL,0x71457LL,0x7f17bLL,0x8e99aLL, 0x3298bLL,0x38c53LL,0x3fb28LL,0x47783LL,0x5030aLL,0x59f98LL,0x64f40LL,0x71457LL,0x7f17bLL,0x8e99aLL,
0xa0000LL,0xb385eLL,0xc96d9LL,0xe2019LL,0xfd954LL,0x11c865LL,0x13f3dfLL,0x166320LL,0x191e6eLL,0x1c2f10LL, 0xa0000LL,0xb385eLL,0xc96d9LL,0xe2019LL,0xfd954LL,0x11c865LL,0x13f3dfLL,0x166320LL,0x191e6eLL,0x1c2f10LL,
@ -1479,46 +1480,69 @@ const fixed32 pow_a_table[] =
0x12fe,0x1307 0x12fe,0x1307
}; };
/* 32.32 unsigned fixed format */
/* This is a table of exponent values for an IEEE SP float. Theres never anything less then about index 115
* making the size of this table fairly ridiculous.
*/
const fixed64 lsp_pow_e_table[] = const fixed64 lsp_pow_e_table[] =
{ {
0xf333f9deLL, 0xf0518db9LL, 0x0LL, 0x7e656b4fLL, 0x7999fcefLL, 0xf828c6dcLL, 0x0LL, 0xb504f30000000000LL, 0x9837f00000000000LL, 0x8000000000000000LL, 0x6ba27e8000000000LL, 0x5a82798000000000LL,
0x3f32b5a7LL, 0x3cccfe78LL, 0xfc14636eLL, 0x0LL, 0x9f995ad4LL, 0x9e667f3cLL, 0xfe0a31b7LL, 0x4c1bf80000000000LL, 0x4000000000000000LL, 0x35d13f4000000000LL, 0x2d413cc000000000LL, 0x260dfc0000000000LL,
0x0LL, 0x4fccad6aLL, 0x4f333f9eLL, 0x7f0518dcLL, 0x0LL, 0x27e656b5LL, 0x27999fcfLL, 0x2000000000000000LL, 0x1ae89fa000000000LL, 0x16a09e6000000000LL, 0x1306fe0000000000LL, 0x1000000000000000LL,
0xbf828c6eLL, 0x0LL, 0x13f32b5aLL, 0x13cccfe7LL, 0xdfc14637LL, 0x0LL, 0x89f995adLL, 0xd744fd000000000LL, 0xb504f3000000000LL, 0x9837f0000000000LL, 0x800000000000000LL, 0x6ba27e800000000LL,
0x9e667f4LL, 0x6fe0a31bLL, 0x0LL, 0x44fccad7LL, 0x4f333faLL, 0x37f0518eLL, 0x0LL, 0x5a8279800000000LL, 0x4c1bf8000000000LL, 0x400000000000000LL, 0x35d13f400000000LL, 0x2d413cc00000000LL,
0xa27e656bLL, 0x827999fdLL, 0x1bf828c7LL, 0x0LL, 0xd13f32b6LL, 0x413cccfeLL, 0xdfc1463LL, 0x260dfc000000000LL, 0x200000000000000LL, 0x1ae89fa00000000LL, 0x16a09e600000000LL, 0x1306fe000000000LL,
0x0LL, 0xe89f995bLL, 0xa09e667fLL, 0x6fe0a32LL, 0x0LL, 0x744fccadLL, 0x504f3340LL, 0x100000000000000LL, 0xd744fd00000000LL, 0xb504f300000000LL, 0x9837f000000000LL, 0x80000000000000LL,
0x837f0519LL, 0x0LL, 0xba27e657LL, 0xa82799a0LL, 0xc1bf828cLL, 0x0LL, 0x5d13f32bLL, 0x6ba27e80000000LL, 0x5a827980000000LL, 0x4c1bf800000000LL, 0x40000000000000LL, 0x35d13f40000000LL,
0xd413ccd0LL, 0x60dfc146LL, 0x0LL, 0xae89f996LL, 0x6a09e668LL, 0x306fe0a3LL, 0x0LL, 0x2d413cc0000000LL, 0x260dfc00000000LL, 0x20000000000000LL, 0x1ae89fa0000000LL, 0x16a09e60000000LL,
0xd744fccbLL, 0xb504f334LL, 0x9837f052LL, 0x80000000LL, 0x6ba27e65LL, 0x5a82799aLL, 0x1306fe00000000LL, 0x10000000000000LL, 0xd744fd0000000LL, 0xb504f30000000LL, 0x9837f00000000LL,
0x4c1bf829LL, 0x40000000LL, 0x35d13f33LL, 0x2d413ccdLL, 0x260dfc14LL, 0x20000000LL, 0x8000000000000LL, 0x6ba27e8000000LL, 0x5a82798000000LL, 0x4c1bf80000000LL, 0x4000000000000LL,
0x1ae89f99LL, 0x16a09e66LL, 0x1306fe0aLL, 0x10000000LL, 0xd744fcdLL, 0xb504f33LL, 0x35d13f4000000LL, 0x2d413cc000000LL, 0x260dfc0000000LL, 0x2000000000000LL, 0x1ae89fa000000LL,
0x9837f05LL, 0x8000000LL, 0x6ba27e6LL, 0x5a8279aLL, 0x4c1bf83LL, 0x4000000LL, 0x16a09e6000000LL, 0x1306fe0000000LL, 0x1000000000000LL, 0xd744fd000000LL, 0xb504f3000000LL,
0x35d13f3LL, 0x2d413cdLL, 0x260dfc1LL, 0x2000000LL, 0x1ae89faLL, 0x16a09e6LL, 0x9837f0000000LL, 0x800000000000LL, 0x6ba27e800000LL, 0x5a8279800000LL, 0x4c1bf8000000LL,
0x1306fe1LL, 0x1000000LL, 0xd744fdLL, 0xb504f3LL, 0x9837f0LL, 0x800000LL, 0x400000000000LL, 0x35d13f400000LL, 0x2d413cc00000LL, 0x260dfc000000LL, 0x200000000000LL,
0x6ba27eLL, 0x5a827aLL, 0x4c1bf8LL, 0x400000LL, 0x35d13fLL, 0x2d413dLL, 0x1ae89fa00000LL, 0x16a09e600000LL, 0x1306fe000000LL, 0x100000000000LL, 0xd744fd00000LL,
0x260dfcLL, 0x200000LL, 0x1ae8a0LL, 0x16a09eLL, 0x1306feLL, 0x100000LL, 0xb504f300000LL, 0x9837f000000LL, 0x80000000000LL, 0x6ba27e80000LL, 0x5a827980000LL,
0xd7450LL, 0xb504fLL, 0x9837fLL, 0x80000LL, 0x6ba28LL, 0x5a828LL, 0x4c1c0LL, 0x4c1bf800000LL, 0x40000000000LL, 0x35d13f40000LL, 0x2d413cc0000LL, 0x260dfc00000LL,
0x40000LL, 0x35d14LL, 0x2d414LL, 0x260e0LL, 0x20000LL, 0x1ae8aLL, 0x16a0aLL, 0x20000000000LL, 0x1ae89fa0000LL, 0x16a09e60000LL, 0x1306fe00000LL, 0x10000000000LL,
0x13070LL, 0x10000LL, 0xd745LL, 0xb505LL, 0x9838LL, 0x8000LL, 0x6ba2LL, 0xd744fd0000LL, 0xb504f30000LL, 0x9837f00000LL, 0x8000000000LL, 0x6ba27e8000LL,
0x5a82LL, 0x4c1cLL, 0x4000LL, 0x35d1LL, 0x2d41LL, 0x260eLL, 0x2000LL, 0x5a82798000LL, 0x4c1bf80000LL, 0x4000000000LL, 0x35d13f4000LL, 0x2d413cc000LL,
0x1ae9LL, 0x16a1LL, 0x1307LL, 0x1000LL, 0xd74LL, 0xb50LL, 0x983LL, 0x800LL, 0x260dfc0000LL, 0x2000000000LL, 0x1ae89fa000LL, 0x16a09e6000LL, 0x1306fe0000LL,
0x6baLL, 0x5a8LL, 0x4c2LL, 0x400LL, 0x35dLL, 0x2d4LL, 0x261LL, 0x200LL, 0x1afLL, 0x1000000000LL, 0xd744fd000LL, 0xb504f3000LL, 0x9837f0000LL, 0x800000000LL,
0x16aLL, 0x130LL, 0x100LL, 0xd7LL, 0xb5LL, 0x98LL, 0x80LL, 0x6cLL, 0x5bLL, 0x6ba27e800LL, 0x5a8279800LL, 0x4c1bf8000LL, 0x400000000LL, 0x35d13f400LL,
0x4cLL, 0x40LL, 0x36LL, 0x2dLL, 0x26LL, 0x20LL, 0x1bLL, 0x17LL, 0x13LL, 0x2d413cc00LL, 0x260dfc000LL, 0x200000000LL, 0x1ae89fa00LL, 0x16a09e600LL,
0x10LL, 0xdLL, 0xbLL, 0xaLL, 0x8LL, 0x7LL, 0x6LL, 0x5LL, 0x4LL, 0x3LL, 0x1306fe000LL, 0x100000000LL, 0xd744fd00LL, 0xb504f300LL, 0x9837f000LL,
0x3LL, 0x2LL, 0x2LL, 0x2LL, 0x1LL, 0x1LL, 0x1LL, 0x1LL, 0x1LL, 0x1LL, 0x80000000LL, 0x6ba27e80LL, 0x5a827980LL, 0x4c1bf800LL, 0x40000000LL,
0x1LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x35d13f40LL, 0x2d413cc0LL, 0x260dfc00LL, 0x20000000LL, 0x1ae89fa0LL,
0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x16a09e60LL, 0x1306fe00LL, 0x10000000LL, 0xd744fd0LL, 0xb504f30LL,
0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x9837f00LL, 0x8000000LL, 0x6ba27e8LL, 0x5a82798LL, 0x4c1bf80LL,
0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x4000000LL, 0x35d13f4LL, 0x2d413ccLL, 0x260dfc0LL, 0x2000000LL,
0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x1ae89faLL, 0x16a09e6LL, 0x1306fe0LL, 0x1000000LL, 0xd744fdLL,
0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0x0LL, 0xb504f3LL, 0x9837f0LL, 0x800000LL, 0x6ba27eLL, 0x5a8279LL,
0x0LL, 0x0LL 0x4c1bf8LL, 0x400000LL, 0x35d13fLL, 0x2d413cLL, 0x260dfcLL,
0x200000LL, 0x1ae89fLL, 0x16a09eLL, 0x1306feLL, 0x100000LL,
0xd744fLL, 0xb504fLL, 0x9837fLL, 0x80000LL, 0x6ba27LL,
0x5a827LL, 0x4c1bfLL, 0x40000LL, 0x35d13LL, 0x2d413LL,
0x260dfLL, 0x20000LL, 0x1ae89LL, 0x16a09LL, 0x1306fLL,
0x10000LL, 0xd744LL, 0xb504LL, 0x9837LL, 0x8000LL,
0x6ba2LL, 0x5a82LL, 0x4c1bLL, 0x4000LL, 0x35d1LL,
0x2d41LL, 0x260dLL, 0x2000LL, 0x1ae8LL, 0x16a0LL,
0x1306LL, 0x1000LL, 0xd74LL, 0xb50LL, 0x983LL,
0x800LL, 0x6baLL, 0x5a8LL, 0x4c1LL, 0x400LL,
0x35dLL, 0x2d4LL, 0x260LL, 0x200LL, 0x1aeLL,
0x16aLL, 0x130LL, 0x100LL, 0xd7LL, 0xb5LL,
0x98LL, 0x80LL, 0x6bLL, 0x5aLL, 0x4cLL,
0x40LL, 0x35LL, 0x2dLL, 0x26LL, 0x20LL,
0x1aLL, 0x16LL, 0x13LL, 0x10LL, 0xdLL,
0xbLL, 0x9LL, 0x8LL, 0x6LL, 0x5LL,
0x4LL, 0x4LL, 0x3LL, 0x2LL, 0x2LL,
0x2LL, 0x1LL, 0x1LL, 0x1LL, 0x1LL,
0x0LL
}; };
/* table of exp noise values multiplied by 16 in order to reduce rounding error */ /* table of exp noise values multiplied by 16 in order to reduce rounding error */
fixed32 noisetable_exp[] = fixed32 noisetable_exp[] =
{ {

View file

@ -153,8 +153,8 @@ typedef struct WMADecodeContext
/* lsp_to_curve tables */ /* lsp_to_curve tables */
fixed32 lsp_cos_table[BLOCK_MAX_SIZE]; fixed32 lsp_cos_table[BLOCK_MAX_SIZE];
fixed64 lsp_pow_e_table[256]; fixed64 lsp_pow_e_table[256];
fixed64 lsp_pow_m_table1[(1 << LSP_POW_BITS)]; fixed32 lsp_pow_m_table1[(1 << LSP_POW_BITS)];
fixed64 lsp_pow_m_table2[(1 << LSP_POW_BITS)]; fixed32 lsp_pow_m_table2[(1 << LSP_POW_BITS)];
/* State of current superframe decoding */ /* State of current superframe decoding */
int bit_offset; int bit_offset;

View file

@ -286,10 +286,9 @@ int ff_mdct_init(MDCTContext *s, int nbits, int inverse)
s->tsin[i] = - fsincos(ip<<16, &(s->tcos[i])); //I can't remember why this works, but it seems to agree for ~24 bits, maybe more! s->tsin[i] = - fsincos(ip<<16, &(s->tcos[i])); //I can't remember why this works, but it seems to agree for ~24 bits, maybe more!
s->tcos[i] *=-1; s->tcos[i] *=-1;
} }
s->fft.nbits = s->nbits - 2; (&s->fft)->nbits = nbits-2;
(&s->fft)->inverse = inverse;
s->fft.inverse = inverse;
return 0; return 0;
@ -733,8 +732,10 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx)
s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k;
/* high freq computation */ /* high freq computation */
fixed32 tmp = high_freq*2; fixed32 tmp1 = high_freq*2; /* high_freq is a fixed32!*/
s->high_band_start[k] = fixtoi32(fixdiv32(tmp, itofix32(s->sample_rate)) *block_len +0x8000); fixed32 tmp2=itofix32(s->sample_rate>>1);
s->high_band_start[k] = fixtoi32( fixdiv32(tmp1, tmp2) * (block_len>>1) +0x8000);
/* /*
s->high_band_start[k] = (int)((block_len * 2 * high_freq) / s->high_band_start[k] = (int)((block_len * 2 * high_freq) /
s->sample_rate + 0.5);*/ s->sample_rate + 0.5);*/
@ -935,48 +936,57 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx)
static inline fixed32 pow_m1_4(WMADecodeContext *s, fixed32 x) static inline fixed32 pow_m1_4(WMADecodeContext *s, fixed32 x)
{ {
union { union {
fixed64 f; float f;
unsigned int v; unsigned int v;
} u, t; } u, t;
unsigned int e, m; unsigned int e, m;
fixed64 a, b; fixed32 a, b;
u.f = x; u.f = fixtof64(x);
e = u.v >> 23; e = u.v >> 23;
m = (u.v >> (23 - LSP_POW_BITS)) & ((1 << LSP_POW_BITS) - 1); m = (u.v >> (23 - LSP_POW_BITS)) & ((1 << LSP_POW_BITS) - 1);
/* build interpolation scale: 1 <= t < 2. */ /* build interpolation scale: 1 <= t < 2. */
t.v = ((u.v << LSP_POW_BITS) & ((1 << 23) - 1)) | (127 << 23); t.v = ((u.v << LSP_POW_BITS) & ((1 << 23) - 1)) | (127 << 23);
a = s->lsp_pow_m_table1[m]; a = s->lsp_pow_m_table1[m];
b = s->lsp_pow_m_table2[m]; b = s->lsp_pow_m_table2[m];
return lsp_pow_e_table[e] * (a + b * t.f);
/*lsp_pow_e_table contains 32.32 format */
/*TODO: Since we're unlikely have value that cover the whole
* IEEE754 range, we probably don't need to have all possible exponents*/
return (lsp_pow_e_table[e] * (a + fixmul32(b, ftofix32(t.f))) >>32);
} }
static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len) static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len)
{ {
fixed32 wdel, a, b; fixed32 wdel, a, b, temp, temp2;
int i, m; int i, m;
wdel = fixdiv32(M_PI_F, itofix32(frame_len)); wdel = fixdiv32(M_PI_F, itofix32(frame_len));
temp = fixdiv32(itofix32(1), itofix32(frame_len));
for (i=0; i<frame_len; ++i) for (i=0; i<frame_len; ++i)
{ {
s->lsp_cos_table[i] = 0x20000 * fixcos32(wdel * i); //wdel*i between 0 and pi /*TODO: can probably reuse the trig_init values here */
fsincos((temp*i)<<15, &temp2);
/*get 3 bits headroom + 1 bit from not doubleing the values*/
s->lsp_cos_table[i] = temp2>>3;
} }
/* NOTE: these two tables are needed to avoid two operations in /* NOTE: these two tables are needed to avoid two operations in
pow_m1_4 */ pow_m1_4 */
b = itofix32(1); b = itofix32(1);
int ix = 0; int ix = 0;
/*double check this later*/
for(i=(1 << LSP_POW_BITS) - 1;i>=0;i--) for(i=(1 << LSP_POW_BITS) - 1;i>=0;i--)
{ {
m = (1 << LSP_POW_BITS) + i; m = (1 << LSP_POW_BITS) + i;
a = m * (0x8000 / (1 << LSP_POW_BITS)); //PJJ a = pow_a_table[ix++]<<4;
a = pow_a_table[ix++]; // PJJ : further refinement
s->lsp_pow_m_table1[i] = 2 * a - b; s->lsp_pow_m_table1[i] = 2 * a - b;
s->lsp_pow_m_table2[i] = b - a; s->lsp_pow_m_table2[i] = b - a;
b = a; b = a;
} }
} }
/* NOTE: We use the same code as Vorbis here */ /* NOTE: We use the same code as Vorbis here */
@ -988,27 +998,42 @@ static void wma_lsp_to_curve(WMADecodeContext *s,
fixed32 *lsp) fixed32 *lsp)
{ {
int i, j; int i, j;
fixed32 p, q, w, v, val_max; fixed32 p, q, w, v, val_max, temp, temp2;
val_max = 0; val_max = 0;
for(i=0;i<n;++i) for(i=0;i<n;++i)
{ {
p = 0x8000; /* shift by 2 now to reduce rounding error,
q = 0x8000; * we can renormalize right before pow_m1_4
*/
p = 0x8000<<5;
q = 0x8000<<5;
w = s->lsp_cos_table[i]; w = s->lsp_cos_table[i];
for (j=1;j<NB_LSP_COEFS;j+=2) for (j=1;j<NB_LSP_COEFS;j+=2)
{ {
q *= w - lsp[j - 1];
p *= w - lsp[j]; /*w is 5.27 format, lsp is in 16.16, temp2 becomes 5.27 format*/
temp2 = ((w - (lsp[j - 1]<<11)));
temp = q;
/*q is 16.16 format, temp2 is 5.27, q becomes 16.16 */
q = fixmul32b(q, temp2 )<<4;
p = fixmul32b(p, (w - (lsp[j]<<11)))<<4;
} }
p *= p * (0x20000 - w);
q *= q * (0x20000 + w); /* 2 in 5.27 format is 0x10000000 */
v = p + q; p = fixmul32(p, fixmul32b(p, (0x10000000 - w)))<<3;
v = pow_m1_4(s, v); // PJJ q = fixmul32(q, fixmul32b(q, (0x10000000 + w)))<<3;
v = (p + q) >>9; /* p/q end up as 16.16 */
v = pow_m1_4(s, v);
if (v > val_max) if (v > val_max)
val_max = v; val_max = v;
out[i] = v; out[i] = v;
} }
*val_max_ptr = val_max; *val_max_ptr = val_max;
} }
@ -1392,13 +1417,11 @@ static int wma_decode_block(WMADecodeContext *s)
coefs1 = s->coefs1[ch]; coefs1 = s->coefs1[ch];
exponents = s->exponents[ch]; exponents = s->exponents[ch];
esize = s->exponents_bsize[ch]; esize = s->exponents_bsize[ch];
mult = fixdiv64(pow_table[total_gain],Fixed32To64(s->max_exponent[ch])); mult = fixdiv64(pow_table[total_gain+20],Fixed32To64(s->max_exponent[ch]));
// mul = fixtof64(pow_table[total_gain])/(s->block_len/2)/fixtof64(s->max_exponent[ch]);
mult = fixmul64byfixed(mult, mdct_norm); //what the hell? This is actually fixed64*2^16! mult = fixmul64byfixed(mult, mdct_norm); //what the hell? This is actually fixed64*2^16!
coefs = (*(s->coefs))[ch]; //VLC exponenents are used to get MDCT coef here! coefs = (*(s->coefs))[ch];
n=0; n=0;
if (s->use_noise_coding) if (s->use_noise_coding)
{ {
@ -1428,8 +1451,9 @@ static int wma_decode_block(WMADecodeContext *s)
e2 = 0; e2 = 0;
for(i = 0;i < n; ++i) for(i = 0;i < n; ++i)
{ {
v = exp_ptr[i]>>5; /*v is noramlized later on so its fixed format is irrelevant*/ /*v is noramlized later on so its fixed format is irrelevant*/
e2 += fixmul32(v, v); v = exp_ptr[i]>>4;
e2 += fixmul32(v, v)>>3;
} }
exp_power[j] = e2/n; /*n is an int...*/ exp_power[j] = e2/n; /*n is an int...*/
last_high_band = j; last_high_band = j;
@ -1456,7 +1480,8 @@ static int wma_decode_block(WMADecodeContext *s)
fixed32 tmp = fixdiv32(exp_power[j],exp_power[last_high_band]); fixed32 tmp = fixdiv32(exp_power[j],exp_power[last_high_band]);
mult1 = (fixed64)fixsqrt32(tmp); mult1 = (fixed64)fixsqrt32(tmp);
/* XXX: use a table */ /* XXX: use a table */
mult1 = mult1 * pow_table[s->high_band_values[ch][j]] >> PRECISION; /*mult1 is 48.16, pow_table is 48.16*/
mult1 = mult1 * pow_table[s->high_band_values[ch][j]+20] >> PRECISION;
/*this step has a fairly high degree of error for some reason*/ /*this step has a fairly high degree of error for some reason*/
mult1 = fixdiv64(mult1,fixmul32(s->max_exponent[ch],s->noise_mult)); mult1 = fixdiv64(mult1,fixmul32(s->max_exponent[ch],s->noise_mult));
@ -1481,9 +1506,9 @@ static int wma_decode_block(WMADecodeContext *s)
/*don't forget to renormalize the noise*/ /*don't forget to renormalize the noise*/
temp1 = (((int32_t)*coefs1++)<<16) + (noise>>4); temp1 = (((int32_t)*coefs1++)<<16) + (noise>>4);
temp2 = fixmul32(*exponents, mult>>16); temp2 = fixmul32(*exponents, mult>>17);
*coefs++ = fixmul32(temp1, temp2)>>1; *coefs++ = fixmul32(temp1, temp2);
++exponents; ++exponents;
} }
} }
} }
@ -1637,10 +1662,8 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
for (i=0;i<n;++i) for (i=0;i<n;++i)
{ {
a = fixtoi32(*iptr++)<<1; //ugly but good enough for now
a = fixtoi32(*iptr++)<<1; //ugly but good enough for now
if (a > 32767) if (a > 32767)

View file

@ -498,11 +498,6 @@ bool get_asf_metadata(int fd, struct mp3entry* id3)
return false; return false;
} }
if (wfx.bitrate < 20000) {
DEBUGF("ASF: < 20kbps files not supported\n");
return false;
}
asf_read_object_header(&obj, fd); asf_read_object_header(&obj, fd);
if (!asf_guid_match(&obj.guid, &asf_guid_data)) { if (!asf_guid_match(&obj.guid, &asf_guid_data)) {