Some changes for musepack: Disable SV4-SV6 support (I guess I am the only one who oned such). Remove tabs, perform some minor code beautification and add ICONST_ATTR to some requantization constants.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17438 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2008-05-10 15:15:10 +00:00
parent 27bb9986f6
commit a7a2baa97f
6 changed files with 59 additions and 70 deletions

View file

@ -43,7 +43,7 @@
#include "reader.h"
#include "streaminfo.h"
#define MPC_SUPPORT_SV456
//#define MPC_SUPPORT_SV456
#define SCF_HACK
enum {
@ -107,8 +107,6 @@ typedef struct mpc_decoder_t {
#endif
mpc_int8_t SCFI_L [32];
mpc_int8_t SCFI_R [32]; // describes order of transmitted SCF
//mpc_int32_t DSCF_Reference_L [32];
//mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF
mpc_bool_t MS_Flag[32]; // MS used?
mpc_uint32_t* SeekTable;

View file

@ -87,7 +87,8 @@ mpc_uint8_t LUT5_0 [1<< 6];
mpc_uint8_t LUT5_1 [1<< 8]; // 320 Bytes
mpc_uint8_t LUT6_0 [1<< 7];
mpc_uint8_t LUT6_1 [1<< 7]; // 256 Bytes
mpc_uint8_t LUT7_0 [1<< 8];mpc_uint8_t LUT7_1 [1<< 8]; // 512 Bytes
mpc_uint8_t LUT7_0 [1<< 8];
mpc_uint8_t LUT7_1 [1<< 8]; // 512 Bytes
mpc_uint8_t LUTDSCF [1<< 6]; // 64 Bytes = 2976 Bytes
//------------------------------------------------------------------------------
@ -95,9 +96,6 @@ mpc_uint8_t LUTDSCF [1<< 6]; // 64 Bytes = 2976 Bytes
//------------------------------------------------------------------------------
enum
{
EQ_TAP = 13, // length of FIR filter for EQ
DELAY = ((EQ_TAP + 1) / 2), // delay of FIR
FIR_BANDS = 4, // number of subbands to be FIR filtered
MEMSIZE = MPC_DECODER_MEMSIZE, // overall buffer size
MEMSIZE2 = (MEMSIZE/2), // size of one buffer
MEMMASK = (MEMSIZE-1)
@ -226,6 +224,7 @@ mpc_decoder_make_huffman_lookup(
return;
}
#ifdef MPC_SUPPORT_SV456
// decode SCFI-bundle (sv4,5,6)
static void
mpc_decoder_scfi_bundle_read(
@ -273,6 +272,7 @@ mpc_decoder_huffman_decode(mpc_decoder *d, const HuffmanTyp *Table)
return Table->Value;
}
#endif
// faster huffman through previewing less bits
// works with maximum lengths up to 10
@ -399,18 +399,16 @@ mpc_decoder_reset_globals(mpc_decoder *d)
memset(d->Y_L , 0, sizeof Y_L );
memset(d->Y_R , 0, sizeof Y_R );
memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L );
memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R );
memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L);
memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R);
memset(d->Res_L , 0, sizeof d->Res_L );
memset(d->Res_R , 0, sizeof d->Res_R );
memset(d->SCFI_L , 0, sizeof d->SCFI_L );
memset(d->SCFI_R , 0, sizeof d->SCFI_R );
#ifdef MPC_SUPPORT_SV456
memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L );
memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R );
memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L);
memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R);
#endif
//memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L );
//memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R );
memset(d->Q , 0, sizeof d->Q );
memset(d->MS_Flag , 0, sizeof d->MS_Flag );
}
@ -856,7 +854,6 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
/*********** DSCF ************/
if (d->DSCF_Flag_L[n]==1)
{
//L[2] = d->DSCF_Reference_L[n];
switch (d->SCFI_L[n])
{
case 3:
@ -914,12 +911,9 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
break;
}
}
// update Reference for DSCF
//d->DSCF_Reference_L[n] = L[2];
}
if (*ResR)
{
//R[2] = d->DSCF_Reference_R[n];
/*********** DSCF ************/
if (d->DSCF_Flag_R[n]==1)
{
@ -1086,7 +1080,6 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d, mpc_bool_t fastSeeking)
for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) {
if (*ResL)
{
//L[2] = d->DSCF_Reference_L[n];
switch (d->SCFI_L[n])
{
case 1:
@ -1663,8 +1656,6 @@ void mpc_decoder_reset_state(mpc_decoder *d) {
memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L );
memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R );
#endif
//memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L );
//memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R );
memset(d->Q , 0, sizeof d->Q );
memset(d->MS_Flag , 0, sizeof d->MS_Flag );

View file

@ -41,7 +41,7 @@
/* C O N S T A N T S */
// bits per sample for chosen quantizer
const mpc_uint32_t Res_bit [18] = {
const mpc_uint32_t Res_bit [18] ICONST_ATTR = {
0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
};
@ -50,7 +50,7 @@ const mpc_uint32_t Res_bit [18] = {
#define _(X) MAKE_MPC_SAMPLE_EX(X,14)
const MPC_SAMPLE_FORMAT __Cc [1 + 18] = {
const MPC_SAMPLE_FORMAT __Cc [1 + 18] ICONST_ATTR = {
_(111.285962475327f), // 32768/2/255*sqrt(3)
_(65536.000000000000f), _(21845.333333333332f), _(13107.200000000001f), _(9362.285714285713f),
_(7281.777777777777f), _(4369.066666666666f), _(2114.064516129032f), _(1040.253968253968f),
@ -63,7 +63,7 @@ const MPC_SAMPLE_FORMAT __Cc [1 + 18] = {
// offset for requantization
// 2*D+1 = steps of quantizer
const mpc_int32_t __Dc [1 + 18] = {
const mpc_int32_t __Dc [1 + 18] ICONST_ATTR = {
2,
0, 1, 2, 3, 4, 7, 15, 31, 63,
127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767