diff options
Diffstat (limited to 'lib/rbcodec/codecs/libwma/wmadeci.c')
-rwxr-xr-x[-rw-r--r--] | lib/rbcodec/codecs/libwma/wmadeci.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/rbcodec/codecs/libwma/wmadeci.c b/lib/rbcodec/codecs/libwma/wmadeci.c index d7a836dd97..69bdbeaca2 100644..100755 --- a/lib/rbcodec/codecs/libwma/wmadeci.c +++ b/lib/rbcodec/codecs/libwma/wmadeci.c | |||
@@ -487,23 +487,33 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) | |||
487 | 487 | ||
488 | s->reset_block_lengths = 1; | 488 | s->reset_block_lengths = 1; |
489 | 489 | ||
490 | if (s->use_noise_coding) | 490 | if (s->use_noise_coding) /* init the noise generator */ |
491 | { | 491 | { |
492 | /* init the noise generator */ | 492 | /* LSP values are simply 2x the EXP values */ |
493 | if (s->use_exp_vlc) | 493 | if (s->use_exp_vlc) |
494 | { | 494 | { |
495 | s->noise_mult = 0x51f; | 495 | s->noise_mult = 0x51f; |
496 | /*unlikely, but we may have previoiusly used this table for LSP, | ||
497 | so halve the values if needed*/ | ||
498 | if(noisetable_exp[0] == 0x10) { | ||
499 | for (i=0;i<NOISE_TAB_SIZE;++i) | ||
500 | noisetable_exp[i] >>= 1; | ||
501 | } | ||
496 | s->noise_table = noisetable_exp; | 502 | s->noise_table = noisetable_exp; |
497 | } | 503 | } |
498 | else | 504 | else |
499 | { | 505 | { |
500 | s->noise_mult = 0xa3d; | 506 | s->noise_mult = 0xa3d; |
501 | /* LSP values are simply 2x the EXP values */ | 507 | /*check that we haven't already doubled this table*/ |
502 | for (i=0;i<NOISE_TAB_SIZE;++i) | 508 | if(noisetable_exp[0] == 0x5) { |
503 | noisetable_exp[i] = noisetable_exp[i]<< 1; | 509 | for (i=0;i<NOISE_TAB_SIZE;++i) |
510 | noisetable_exp[i] <<= 1; | ||
511 | } | ||
504 | s->noise_table = noisetable_exp; | 512 | s->noise_table = noisetable_exp; |
505 | } | 513 | } |
506 | #if 0 | 514 | #if 0 |
515 | /*TODO: Rockbox has a dither function. Consider using it for noise coding*/ | ||
516 | |||
507 | /* We use a lookup table computered in advance, so no need to do this*/ | 517 | /* We use a lookup table computered in advance, so no need to do this*/ |
508 | { | 518 | { |
509 | unsigned int seed; | 519 | unsigned int seed; |