diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2008-05-10 20:33:28 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2008-05-10 20:33:28 +0000 |
commit | 14d45c9d17385bbedb4a7f62baeedfc7b98221d4 (patch) | |
tree | fe1de44f84b4868cbc89c97ceadb3ed3031e8fcd /apps/codecs/libmusepack | |
parent | 66010b9f306cc4cdb98ec10ba3e5f45476e76690 (diff) |
Removed non-active seek mechanism from musepack library, small other cleanups.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17446 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmusepack')
-rw-r--r-- | apps/codecs/libmusepack/decoder.h | 4 | ||||
-rw-r--r-- | apps/codecs/libmusepack/mpc_decoder.c | 268 | ||||
-rw-r--r-- | apps/codecs/libmusepack/musepack.h | 7 | ||||
-rw-r--r-- | apps/codecs/libmusepack/requant.c | 27 | ||||
-rw-r--r-- | apps/codecs/libmusepack/requant.h | 12 |
5 files changed, 123 insertions, 195 deletions
diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index bbd1aa9610..e36425bd1e 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h @@ -110,11 +110,7 @@ typedef struct mpc_decoder_t { mpc_bool_t MS_Flag[32]; // MS used? mpc_uint32_t* SeekTable; - mpc_bool_t Use_SeekTable; - mpc_bool_t Use_FastSeek; - mpc_bool_t Use_StaticSeekTable; mpc_uint8_t SeekTable_Step; - mpc_uint32_t Max_SeekTable_Size; #ifdef MPC_FIXED_POINT unsigned char SCF_shift[256]; diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index f3aff7e54b..c41b17c54c 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c @@ -468,7 +468,7 @@ mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) return (mpc_uint32_t)(-1); // end of file -> abort decoding } - if (d->DecodedFrames == 0 && d->Use_SeekTable) + if (d->DecodedFrames == 0) d->SeekTable[0] = mpc_decoder_bits_read(d); // read jump-info for validity check of frame @@ -497,25 +497,21 @@ mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) d->DecodedFrames++; - if (d->Use_SeekTable) { - if (d->SeekTable_Step == 1) { - d->SeekTable [d->DecodedFrames] = d->FwdJumpInfo + 20; - } else { - if ((d->DecodedFrames-1) % d->SeekTable_Step == 0) { - d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; - d->SeekTableIndex += 1; - d->SeekTableCounter = 0; - } - d->SeekTableCounter += d->FwdJumpInfo + 20; + /* update seek table */ + if (d->SeekTable_Step == 1) { + d->SeekTable [d->DecodedFrames] = d->FwdJumpInfo + 20; + } else { + if ((d->DecodedFrames-1) % d->SeekTable_Step == 0) { + d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; + d->SeekTableIndex += 1; + d->SeekTableCounter = 0; } + d->SeekTableCounter += d->FwdJumpInfo + 20; } // synthesize signal mpc_decoder_requantisierung(d, d->Max_Band); - //if ( d->EQ_activated && PluginSettings.EQbyMPC ) - // perform_EQ (); - mpc_decoder_synthese_filter_float(d, buffer); // cut off first MPC_DECODER_SYNTH_DELAY zero-samples @@ -570,8 +566,6 @@ mpc_uint32_t mpc_decoder_decode( { for(;;) { - //const mpc_int32_t MaxBrokenFrames = 0; // PluginSettings.MaxBrokenFrames - mpc_uint32_t RING = d->Zaehler; mpc_int32_t vbr_ring = (RING << 5) + d->pos; @@ -764,7 +758,7 @@ mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band) } #ifdef MPC_SUPPORT_SV456 -static const unsigned char Q_res[32][16] = { +static const unsigned char Q_res[32][16] ICONST_ATTR = { {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, @@ -974,8 +968,6 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) break; } } - // update Reference for DSCF - //d->DSCF_Reference_R[n] = R[2]; } } @@ -1010,13 +1002,6 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) void mpc_decoder_read_bitstream_sv7(mpc_decoder *d, mpc_bool_t fastSeeking) { - // these arrays hold decoding results for bundled quantizers (3- and 5-step) - /*static*/ mpc_int32_t idx30[] = { -1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1}; - /*static*/ mpc_int32_t idx31[] = { -1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1}; - /*static*/ mpc_int32_t idx32[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - /*static*/ mpc_int32_t idx50[] = { -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2}; - /*static*/ mpc_int32_t idx51[] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; - mpc_int32_t n,k; mpc_int32_t Max_used_Band=0; const HuffmanTyp *Table; @@ -1340,7 +1325,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d, mpc_bool_t fastSeeking) { idx = HUFFMAN_DECODE_FASTEST ( d, Table, LUT, max_length ); *RQ++ = idx50[idx]; - *RQ++ = idx51[idx]; + *RQ++ = idx51[idx]; } break; case 3: @@ -1451,19 +1436,11 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) d->WordsRead = 0; d->Max_Band = 0; d->SeekTable = NULL; - d->Use_FastSeek = TRUE; - d->Use_SeekTable = TRUE; - d->Use_StaticSeekTable = FALSE; d->SeekTable_Step = 1; d->SeekTableIndex = 0; d->SeekTableCounter = 0; - d->Max_SeekTable_Size = 0; mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f); -#if 0 - mpc_decoder_init_huffman_sv6(d); - mpc_decoder_init_huffman_sv7(d); -#endif LOOKUP ( mpc_table_HuffQ[0][1], 27, LUT1_0 ); LOOKUP ( mpc_table_HuffQ[1][1], 27, LUT1_1 ); @@ -1490,16 +1467,15 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) #endif } -void mpc_decoder_destroy(mpc_decoder *d) { - - if (d->SeekTable != NULL && d->Use_StaticSeekTable == FALSE) +void mpc_decoder_destroy(mpc_decoder *d) +{ + if (d->SeekTable != NULL) free(d->SeekTable); - } -void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) +static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) { - mpc_uint16_t seekTableSize; + mpc_uint32_t seekTableSize; mpc_decoder_reset_synthesis(d); mpc_decoder_reset_globals(d); @@ -1514,28 +1490,14 @@ void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) d->samples_to_skip = MPC_DECODER_SYNTH_DELAY; - if (d->SeekTable != NULL && d->Use_StaticSeekTable == FALSE) + if (d->SeekTable != NULL) free(d->SeekTable); - if (d->Use_SeekTable) { - if (d->Use_StaticSeekTable == FALSE) { - if (d->Max_SeekTable_Size == 0) { - seekTableSize = si->frames; - } else { - seekTableSize = min(si->frames, d->Max_SeekTable_Size / sizeof(mpc_uint32_t)); - } - d->SeekTable = (mpc_uint32_t*) calloc( sizeof(mpc_uint32_t), seekTableSize); - d->SeekTable_Step = si->frames / seekTableSize; - if (si->frames % seekTableSize) - d->SeekTable_Step+=1; - } else { - seekTableSize = d->Max_SeekTable_Size / sizeof(mpc_uint32_t); - d->SeekTable_Step = si->frames / seekTableSize; - if (si->frames % seekTableSize) - d->SeekTable_Step+=1; - } - } - + seekTableSize = si->frames; + d->SeekTable = (mpc_uint32_t*) calloc( sizeof(mpc_uint32_t), seekTableSize); + d->SeekTable_Step = si->frames / seekTableSize; + if (si->frames % seekTableSize) + d->SeekTable_Step+=1; } mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) @@ -1563,43 +1525,6 @@ mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) return TRUE; } -//--------------------------------------------------------------- -// will seek from the beginning of the file to the desired -// position in ms (given by seek_needed) -//--------------------------------------------------------------- -#if 0 -static void -helper1(mpc_decoder *d, mpc_uint32_t bitpos) -{ - f_seek(d, (bitpos >> 5) * 4 + d->MPCHeaderPos); - f_read_dword(d, d->Speicher, 2); - d->dword = SWAP(d->Speicher[d->Zaehler = 0]); - d->pos = bitpos & 31; -} - -static void -helper2(mpc_decoder *d, mpc_uint32_t bitpos) -{ - f_seek(d, (bitpos>>5) * 4 + d->MPCHeaderPos); - f_read_dword(d, d->Speicher, MEMSIZE); - d->dword = SWAP(d->Speicher[d->Zaehler = 0]); - d->pos = bitpos & 31; -} - -static void -helper3(mpc_decoder *d, mpc_uint32_t bitpos, mpc_uint32_t* buffoffs) -{ - d->pos = bitpos & 31; - bitpos >>= 5; - if ((mpc_uint32_t)(bitpos - *buffoffs) >= MEMSIZE - 2) { - *buffoffs = bitpos; - f_seek(d, bitpos * 4L + d->MPCHeaderPos); - f_read_dword(d, d->Speicher, MEMSIZE ); - } - d->dword = SWAP(d->Speicher[d->Zaehler = bitpos - *buffoffs ]); -} -#endif - // jumps over the current frame mpc_uint32_t mpc_decoder_jump_frame(mpc_decoder *d) { @@ -1622,7 +1547,9 @@ static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion) { mpc_uint32_t fpos = 0; (void) StreamVersion; - switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream + + // setting position to the beginning of the data-bitstream + switch ( d->StreamVersion ) { case 0x04: fpos = 48; break; case 0x05: case 0x06: fpos = 64; break; @@ -1685,7 +1612,7 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) if (seekFrame > 33) lastFrame = seekFrame - 33 + 1 - d->SeekTable_Step; - if ((!d->Use_SeekTable && delta < 0) || d->MaxDecodedFrames == 0) { + if (d->MaxDecodedFrames == 0) { mpc_decoder_reset_state(d); @@ -1698,29 +1625,24 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) // reset number of decoded frames d->DecodedFrames = 0; - if (d->Use_SeekTable) { - // jump to the last frame, updating seek table - if (d->SeekTable_Step == 1) { - d->SeekTable[0] = (mpc_uint32_t)fpos; - for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) - d->SeekTable[d->DecodedFrames+1] = mpc_decoder_jump_frame(d); - } else { - d->SeekTableIndex = 0; - d->SeekTableCounter = (mpc_uint32_t)fpos; - for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) { - if (d->DecodedFrames % d->SeekTable_Step == 0) { - d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; - d->SeekTableIndex += 1; - d->SeekTableCounter = 0; - } - d->SeekTableCounter += mpc_decoder_jump_frame(d); + // jump to the last frame, updating seek table + if (d->SeekTable_Step == 1) { + d->SeekTable[0] = (mpc_uint32_t)fpos; + for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) + d->SeekTable[d->DecodedFrames+1] = mpc_decoder_jump_frame(d); + } else { + d->SeekTableIndex = 0; + d->SeekTableCounter = (mpc_uint32_t)fpos; + for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) { + if (d->DecodedFrames % d->SeekTable_Step == 0) { + d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; + d->SeekTableIndex += 1; + d->SeekTableCounter = 0; } + d->SeekTableCounter += mpc_decoder_jump_frame(d); } - } else { - // just jump to the last frame - for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) - mpc_decoder_jump_frame(d); - } + } + } else if (delta < 0) { @@ -1745,45 +1667,38 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) mpc_decoder_reset_state(d); // jumps forward from the current position - if (d->Use_SeekTable) { - - if (d->MaxDecodedFrames > lastFrame) { // REVIEW: Correct?? or (d->MaxDecodedFrames > d->DecodedFrames) - // jump to the last usable position in the seek table - if (d->SeekTable_Step == 1) { - fpos = mpc_decoder_bits_read(d); - for (; d->DecodedFrames < d->MaxDecodedFrames && d->DecodedFrames < lastFrame; d->DecodedFrames++) - fpos += d->SeekTable[d->DecodedFrames+1]; - } else { - // could test SeekTable offset and jump to next entry but this is easier for now... - //d->SeekTableIndex = 0; - //d->SeekTableCounter = 0; - fpos = d->SeekTable[0]; - d->SeekTableIndex = 0; - for (d->DecodedFrames = 0;d->DecodedFrames < d->MaxDecodedFrames && d->DecodedFrames < lastFrame; d->DecodedFrames+=d->SeekTable_Step, d->SeekTableIndex++) - fpos += d->SeekTable[d->SeekTableIndex+1]; - d->SeekTableCounter = d->SeekTable[d->SeekTableIndex]; - } - - mpc_decoder_seek_to(d, fpos); - } + if (d->MaxDecodedFrames > lastFrame) { // REVIEW: Correct?? or (d->MaxDecodedFrames > d->DecodedFrames) + // jump to the last usable position in the seek table if (d->SeekTable_Step == 1) { - for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) - d->SeekTable[d->DecodedFrames+1] = mpc_decoder_jump_frame(d); + fpos = mpc_decoder_bits_read(d); + for (; d->DecodedFrames < d->MaxDecodedFrames && d->DecodedFrames < lastFrame; d->DecodedFrames++) + fpos += d->SeekTable[d->DecodedFrames+1]; } else { - for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) { - if (d->DecodedFrames % d->SeekTable_Step == 0) { - d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; - d->SeekTableIndex += 1; - d->SeekTableCounter = 0; - } - d->SeekTableCounter += mpc_decoder_jump_frame(d); - } - } - } else { + // could test SeekTable offset and jump to next entry but this is easier for now... + //d->SeekTableIndex = 0; + //d->SeekTableCounter = 0; + fpos = d->SeekTable[0]; + d->SeekTableIndex = 0; + for (d->DecodedFrames = 0;d->DecodedFrames < d->MaxDecodedFrames && d->DecodedFrames < lastFrame; d->DecodedFrames+=d->SeekTable_Step, d->SeekTableIndex++) + fpos += d->SeekTable[d->SeekTableIndex+1]; + d->SeekTableCounter = d->SeekTable[d->SeekTableIndex]; + } + + mpc_decoder_seek_to(d, fpos); + } + if (d->SeekTable_Step == 1) { for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) - mpc_decoder_jump_frame(d); + d->SeekTable[d->DecodedFrames+1] = mpc_decoder_jump_frame(d); + } else { + for (;d->DecodedFrames < lastFrame; d->DecodedFrames++) { + if (d->DecodedFrames % d->SeekTable_Step == 0) { + d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; + d->SeekTableIndex += 1; + d->SeekTableCounter = 0; + } + d->SeekTableCounter += mpc_decoder_jump_frame(d); + } } - } // REVIEW: Needed? @@ -1798,7 +1713,7 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) FrameBitCnt = mpc_decoder_bits_read(d); // scanning the scalefactors (and check for validity of frame) if (d->StreamVersion >= 7) { - mpc_decoder_read_bitstream_sv7(d, d->Use_FastSeek && (d->DecodedFrames < seekFrame - 1)); + mpc_decoder_read_bitstream_sv7(d, (d->DecodedFrames < seekFrame - 1)); } else { #ifdef MPC_SUPPORT_SV456 @@ -1810,29 +1725,27 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) FrameBitCnt = mpc_decoder_bits_read(d) - FrameBitCnt; - if (d->Use_FastSeek && d->FwdJumpInfo > FrameBitCnt) + if (d->FwdJumpInfo > FrameBitCnt) mpc_decoder_seek_forward(d, d->FwdJumpInfo - FrameBitCnt); else if (FrameBitCnt != d->FwdJumpInfo ) // Bug in perform_jump; return FALSE; // REVIEW: Only if decodedFrames < maxDecodedFrames?? - if (d->Use_SeekTable) { - if (d->SeekTable_Step == 1) { - // check that the frame length corresponds with any data already in the seek table - if (d->SeekTable[d->DecodedFrames+1] != 0 && d->SeekTable[d->DecodedFrames+1] != d->FwdJumpInfo + 20) + if (d->SeekTable_Step == 1) { + // check that the frame length corresponds with any data already in the seek table + if (d->SeekTable[d->DecodedFrames+1] != 0 && d->SeekTable[d->DecodedFrames+1] != d->FwdJumpInfo + 20) + return FALSE; + d->SeekTable [d->DecodedFrames+1] = d->FwdJumpInfo + 20; + } else { + if (d->DecodedFrames % d->SeekTable_Step == 0) { + if (d->SeekTable[d->SeekTableIndex] != 0 && d->SeekTable[d->SeekTableIndex] != d->SeekTableCounter) return FALSE; - d->SeekTable [d->DecodedFrames+1] = d->FwdJumpInfo + 20; - } else { - if (d->DecodedFrames % d->SeekTable_Step == 0) { - if (d->SeekTable[d->SeekTableIndex] != 0 && d->SeekTable[d->SeekTableIndex] != d->SeekTableCounter) - return FALSE; - d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; - d->SeekTableIndex += 1; - d->SeekTableCounter = 0; - } - d->SeekTableCounter += d->FwdJumpInfo + 20; - } + d->SeekTable[d->SeekTableIndex] = d->SeekTableCounter; + d->SeekTableIndex += 1; + d->SeekTableCounter = 0; + } + d->SeekTableCounter += d->FwdJumpInfo + 20; } // update buffer @@ -1906,7 +1819,6 @@ void mpc_decoder_seek_to(mpc_decoder *d, mpc_uint32_t bitPos) { } - void mpc_decoder_seek_forward(mpc_decoder *d, mpc_uint32_t bits) { bits += d->pos; @@ -1919,11 +1831,3 @@ void mpc_decoder_seek_forward(mpc_decoder *d, mpc_uint32_t bits) { } - -void mpc_decoder_set_seek_table(mpc_decoder *d, mpc_uint32_t *seek_table, mpc_uint32_t max_table_size) { - - d->Use_StaticSeekTable = TRUE; - d->SeekTable = seek_table; - d->Max_SeekTable_Size = max_table_size; - -} diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h index 7e65c75c5a..8233f21f91 100644 --- a/apps/codecs/libmusepack/musepack.h +++ b/apps/codecs/libmusepack/musepack.h @@ -103,8 +103,6 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r); /// \return TRUE if decoder was initalized successfully, FALSE otherwise mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si); -void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si); - /// Sets decoder sample scaling factor. All decoded samples will be multiplied /// by this factor. /// \param scale_factor multiplicative scaling factor @@ -136,10 +134,7 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); /// Seeks to specified position in seconds in the source stream. mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds); -/// Sets the static seek table pointer. -void mpc_decoder_set_seek_table(mpc_decoder *d, mpc_uint32_t *seek_table, mpc_uint32_t max_table_size); - -/// Cleans up the decoder +/// Cleans up the decoder (seektable) void mpc_decoder_destroy(mpc_decoder *d); #ifdef __cplusplus diff --git a/apps/codecs/libmusepack/requant.c b/apps/codecs/libmusepack/requant.c index 3282286d74..d40f36fded 100644 --- a/apps/codecs/libmusepack/requant.c +++ b/apps/codecs/libmusepack/requant.c @@ -69,6 +69,33 @@ const mpc_int32_t __Dc [1 + 18] ICONST_ATTR = { 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767 }; +// decoding results (requantized) for bundled quantizers (3- and 5-step) +// 1st value of bundled 3-step quantizer +const mpc_int32_t idx30[27] ICONST_ATTR = { -1, 0, 1,-1, 0, 1,-1, 0, 1, + -1, 0, 1,-1, 0, 1,-1, 0, 1, + -1, 0, 1,-1, 0, 1,-1, 0, 1}; +// 2nd value of bundled 3-step quantizer +const mpc_int32_t idx31[27] ICONST_ATTR = { -1,-1,-1, 0, 0, 0, 1, 1, 1, + -1,-1,-1, 0, 0, 0, 1, 1, 1, + -1,-1,-1, 0, 0, 0, 1, 1, 1}; +// 3rd value of bundled 3-step quantizer +const mpc_int32_t idx32[27] ICONST_ATTR = { -1,-1,-1,-1,-1,-1,-1,-1,-1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1}; +// 1st value of bundled 5-step quantizer +const mpc_int32_t idx50[25] ICONST_ATTR = { -2,-1, 0, 1, 2, + -2,-1, 0, 1, 2, + -2,-1, 0, 1, 2, + -2,-1, 0, 1, 2, + -2,-1, 0, 1, 2}; +// 2nd value of bundled 5-step quantizer +const mpc_int32_t idx51[25] ICONST_ATTR = { -2,-2,-2,-2,-2, + -1,-1,-1,-1,-1, + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2}; + + #ifdef MPC_FIXED_POINT static mpc_uint32_t find_shift(double fval) { diff --git a/apps/codecs/libmusepack/requant.h b/apps/codecs/libmusepack/requant.h index e70dce7085..1a21c21143 100644 --- a/apps/codecs/libmusepack/requant.h +++ b/apps/codecs/libmusepack/requant.h @@ -41,9 +41,15 @@ #include "musepack.h" /* C O N S T A N T S */ -extern const mpc_uint32_t Res_bit [18]; // bits per sample for chosen quantizer -extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization -extern const mpc_int32_t __Dc [1 + 18]; // offset for requantization +extern const mpc_uint32_t Res_bit[18]; // bits per sample for chosen quantizer +extern const MPC_SAMPLE_FORMAT __Cc[1 + 18]; // coefficients for requantization +extern const mpc_int32_t __Dc[1 + 18]; // offset for requantization +extern const mpc_int32_t idx30[27]; // 1st value of bundled 3-step quantizer +extern const mpc_int32_t idx31[27]; // 2nd value of bundled 3-step quantizer +extern const mpc_int32_t idx32[27]; // 3rd value of bundled 3-step quantizer +extern const mpc_int32_t idx50[25]; // 1st value of bundled 5-step quantizer +extern const mpc_int32_t idx51[25]; // 2nd value of bundled 5-step quantizer + #define Cc (__Cc + 1) #define Dc (__Dc + 1) |