diff options
Diffstat (limited to 'apps/codecs/libmusepack')
-rw-r--r-- | apps/codecs/libmusepack/decoder.h | 4 | ||||
-rw-r--r-- | apps/codecs/libmusepack/huffsv46.c | 2 | ||||
-rw-r--r-- | apps/codecs/libmusepack/huffsv7.c | 34 | ||||
-rw-r--r-- | apps/codecs/libmusepack/mpc_decoder.c | 45 | ||||
-rw-r--r-- | apps/codecs/libmusepack/reader.h | 12 | ||||
-rw-r--r-- | apps/codecs/libmusepack/requant.c | 32 |
6 files changed, 59 insertions, 70 deletions
diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index d65f6dcfb3..bbd1aa9610 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h @@ -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; diff --git a/apps/codecs/libmusepack/huffsv46.c b/apps/codecs/libmusepack/huffsv46.c index 3e0fb3ed93..833b64b454 100644 --- a/apps/codecs/libmusepack/huffsv46.c +++ b/apps/codecs/libmusepack/huffsv46.c @@ -69,7 +69,7 @@ static const HuffmanTyp mpc_table_Entropie_7 [63] = {{4278190080u,8,28},{4261412864u,8,26},{4227858432u,7,-20},{4160749568u,6,8},{4093640704u,6,-8},{4026531840u,6,-9},{3959422976u,6,9},{3925868544u,7,20},{3892314112u,7,21},{3825205248u,6,-10},{3758096384u,6,-11},{3690987520u,6,10},{3623878656u,6,11},{3590324224u,7,-21},{3573547008u,8,29},{3556769792u,8,-29},{3489660928u,6,13},{3422552064u,6,-13},{3355443200u,6,-12},{3288334336u,6,12},{3254779904u,7,-22},{3221225472u,7,22},{3154116608u,6,14},{3087007744u,6,15},{3019898880u,6,-14},{2986344448u,7,-23},{2952790016u,7,23},{2885681152u,6,-15},{2818572288u,6,-16},{2751463424u,6,16},{2717908992u,7,27},{2684354560u,7,-27},{2617245696u,6,17},{2550136832u,6,-17},{2533359616u,8,-30},{2516582400u,8,30},{2483027968u,7,24},{2415919104u,6,-18},{2281701376u,5,-1},{2147483648u,5,1},{2113929216u,7,-24},{2080374784u,7,25},{2013265920u,6,18},{1879048192u,5,-3},{1744830464u,5,3},{1610612736u,5,5},{1476395008u,5,0},{1342177280u,5,-2},{1275068416u,6,19},{1207959552u,6,-19},{1073741824u,5,-5},{939524096u,5,-4},{805306368u,5,-7},{671088640u,5,2},{536870912u,5,4},{402653184u,5,7},{369098752u,7,-25},{335544320u,7,-26},{301989888u,7,-28},{285212672u,8,-31},{268435456u,8,31},{134217728u,5,6},{0u,5,-6},}; const HuffmanTyp* mpc_table_SampleHuff [18] = { - NULL,mpc_table_Entropie_1,mpc_table_Entropie_2,mpc_table_Entropie_3,mpc_table_Entropie_4,mpc_table_Entropie_5,mpc_table_Entropie_6,mpc_table_Entropie_7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL + NULL,mpc_table_Entropie_1,mpc_table_Entropie_2,mpc_table_Entropie_3,mpc_table_Entropie_4,mpc_table_Entropie_5,mpc_table_Entropie_6,mpc_table_Entropie_7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; #endif //#ifdef MPC_SUPPORT_SV456 diff --git a/apps/codecs/libmusepack/huffsv7.c b/apps/codecs/libmusepack/huffsv7.c index 5611595281..ae2b902ea7 100644 --- a/apps/codecs/libmusepack/huffsv7.c +++ b/apps/codecs/libmusepack/huffsv7.c @@ -39,7 +39,7 @@ #include <huffman.h> #include <requant.h> -const HuffmanTyp mpc_table_HuffHdr [10] ICONST_ATTR = +const HuffmanTyp mpc_table_HuffHdr [10] ICONST_ATTR = {{2147483648u,1,0},{1610612736u,3,1},{1577058304u,7,-4},{1568669696u,9,3},{1560281088u,9,4},{1543503872u,8,-5},{1476395008u,6,2},{1342177280u,5,-3},{1073741824u,4,-2},{0u,2,-1},}; const HuffmanTyp mpc_table_HuffSCFI [ 4] ICONST_ATTR = {{2147483648u,1,1},{1610612736u,3,2},{1073741824u,3,0},{0u,2,3},}; @@ -47,35 +47,35 @@ const HuffmanTyp mpc_table_HuffDSCF [16] ICONST_ATTR = {{4160749568u,5,5},{4026531840u,5,-4},{3758096384u,4,3},{3489660928u,4,-3},{3221225472u,4,8},{2684354560u,3,1},{2415919104u,4,0},{2281701376u,5,-5},{2214592512u,6,7},{2147483648u,6,-7},{1610612736u,3,-1},{1073741824u,3,2},{805306368u,4,4},{671088640u,5,6},{536870912u,5,-6},{0u,3,-2},}; static const HuffmanTyp mpc_table_HuffQ1 [2] [3*3*3] ICONST_ATTR = { - {{3758096384u,3,13},{3690987520u,6,26},{3623878656u,6,0},{3556769792u,6,20},{3489660928u,6,6},{3221225472u,4,14},{2952790016u,4,12},{2684354560u,4,4},{2415919104u,4,22},{2348810240u,6,8},{2281701376u,6,18},{2214592512u,6,24},{2147483648u,6,2},{1879048192u,4,16},{1610612736u,4,10},{1476395008u,5,17},{1342177280u,5,9},{1207959552u,5,1},{1073741824u,5,25},{939524096u,5,5},{805306368u,5,21},{671088640u,5,3},{536870912u,5,11},{402653184u,5,15},{268435456u,5,23},{134217728u,5,19},{0u,5,7},}, - {{2147483648u,1,13},{2113929216u,7,15},{2080374784u,7,1},{2046820352u,7,11},{2013265920u,7,7},{1979711488u,7,17},{1946157056u,7,25},{1912602624u,7,19},{1904214016u,9,8},{1895825408u,9,18},{1887436800u,9,2},{1879048192u,9,24},{1845493760u,7,3},{1811939328u,7,23},{1778384896u,7,21},{1744830464u,7,5},{1728053248u,8,0},{1711276032u,8,26},{1694498816u,8,6},{1677721600u,8,20},{1610612736u,6,9},{1342177280u,4,14},{1073741824u,4,12},{805306368u,4,4},{536870912u,4,22},{268435456u,4,16},{0u,4,10},}, + {{3758096384u,3,13},{3690987520u,6,26},{3623878656u,6,0},{3556769792u,6,20},{3489660928u,6,6},{3221225472u,4,14},{2952790016u,4,12},{2684354560u,4,4},{2415919104u,4,22},{2348810240u,6,8},{2281701376u,6,18},{2214592512u,6,24},{2147483648u,6,2},{1879048192u,4,16},{1610612736u,4,10},{1476395008u,5,17},{1342177280u,5,9},{1207959552u,5,1},{1073741824u,5,25},{939524096u,5,5},{805306368u,5,21},{671088640u,5,3},{536870912u,5,11},{402653184u,5,15},{268435456u,5,23},{134217728u,5,19},{0u,5,7},}, + {{2147483648u,1,13},{2113929216u,7,15},{2080374784u,7,1},{2046820352u,7,11},{2013265920u,7,7},{1979711488u,7,17},{1946157056u,7,25},{1912602624u,7,19},{1904214016u,9,8},{1895825408u,9,18},{1887436800u,9,2},{1879048192u,9,24},{1845493760u,7,3},{1811939328u,7,23},{1778384896u,7,21},{1744830464u,7,5},{1728053248u,8,0},{1711276032u,8,26},{1694498816u,8,6},{1677721600u,8,20},{1610612736u,6,9},{1342177280u,4,14},{1073741824u,4,12},{805306368u,4,4},{536870912u,4,22},{268435456u,4,16},{0u,4,10},}, }; static const HuffmanTyp mpc_table_HuffQ2 [2] [5*5] ICONST_ATTR = { - {{4026531840u,4,13},{3758096384u,4,17},{3489660928u,4,7},{3221225472u,4,11},{3154116608u,6,1},{3087007744u,6,23},{3053453312u,7,4},{3019898880u,7,20},{2986344448u,7,0},{2952790016u,7,24},{2818572288u,5,22},{2684354560u,5,10},{2147483648u,3,12},{2013265920u,5,2},{1879048192u,5,14},{1610612736u,4,6},{1342177280u,4,18},{1073741824u,4,8},{805306368u,4,16},{671088640u,5,9},{536870912u,5,5},{402653184u,5,15},{268435456u,5,21},{134217728u,5,19},{0u,5,3},}, - {{4160749568u,5,18},{4026531840u,5,6},{3892314112u,5,8},{3875536896u,8,3},{3871342592u,10,24},{3867148288u,10,4},{3862953984u,10,0},{3858759680u,10,20},{3825205248u,7,23},{3791650816u,7,1},{3758096384u,7,19},{3623878656u,5,16},{3590324224u,7,15},{3556769792u,7,21},{3523215360u,7,9},{3489660928u,7,5},{3422552064u,6,2},{3355443200u,6,10},{3288334336u,6,14},{3221225472u,6,22},{2147483648u,2,12},{1610612736u,3,13},{1073741824u,3,17},{536870912u,3,11},{0u,3,7},}, + {{4026531840u,4,13},{3758096384u,4,17},{3489660928u,4,7},{3221225472u,4,11},{3154116608u,6,1},{3087007744u,6,23},{3053453312u,7,4},{3019898880u,7,20},{2986344448u,7,0},{2952790016u,7,24},{2818572288u,5,22},{2684354560u,5,10},{2147483648u,3,12},{2013265920u,5,2},{1879048192u,5,14},{1610612736u,4,6},{1342177280u,4,18},{1073741824u,4,8},{805306368u,4,16},{671088640u,5,9},{536870912u,5,5},{402653184u,5,15},{268435456u,5,21},{134217728u,5,19},{0u,5,3},}, + {{4160749568u,5,18},{4026531840u,5,6},{3892314112u,5,8},{3875536896u,8,3},{3871342592u,10,24},{3867148288u,10,4},{3862953984u,10,0},{3858759680u,10,20},{3825205248u,7,23},{3791650816u,7,1},{3758096384u,7,19},{3623878656u,5,16},{3590324224u,7,15},{3556769792u,7,21},{3523215360u,7,9},{3489660928u,7,5},{3422552064u,6,2},{3355443200u,6,10},{3288334336u,6,14},{3221225472u,6,22},{2147483648u,2,12},{1610612736u,3,13},{1073741824u,3,17},{536870912u,3,11},{0u,3,7},}, }; static const HuffmanTyp mpc_table_HuffQ3 [2] [ 7] ICONST_ATTR = { - {{3758096384u,3,1},{3489660928u,4,3},{3221225472u,4,-3},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,0},{0u,2,-1},}, - {{3221225472u,2,0},{2147483648u,2,-1},{1073741824u,2,1},{805306368u,4,-2},{671088640u,5,3},{536870912u,5,-3},{0u,3,2},}, + {{3758096384u,3,1},{3489660928u,4,3},{3221225472u,4,-3},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,0},{0u,2,-1},}, + {{3221225472u,2,0},{2147483648u,2,-1},{1073741824u,2,1},{805306368u,4,-2},{671088640u,5,3},{536870912u,5,-3},{0u,3,2},}, }; static const HuffmanTyp mpc_table_HuffQ4 [2] [ 9] ICONST_ATTR = { - {{3758096384u,3,0},{3221225472u,3,-1},{2684354560u,3,1},{2147483648u,3,-2},{1610612736u,3,2},{1342177280u,4,-4},{1073741824u,4,4},{536870912u,3,3},{0u,3,-3},}, - {{3758096384u,3,1},{3489660928u,4,2},{3221225472u,4,-3},{2147483648u,2,0},{1610612736u,3,-2},{1342177280u,4,3},{1207959552u,5,-4},{1073741824u,5,4},{0u,2,-1},}, + {{3758096384u,3,0},{3221225472u,3,-1},{2684354560u,3,1},{2147483648u,3,-2},{1610612736u,3,2},{1342177280u,4,-4},{1073741824u,4,4},{536870912u,3,3},{0u,3,-3},}, + {{3758096384u,3,1},{3489660928u,4,2},{3221225472u,4,-3},{2147483648u,2,0},{1610612736u,3,-2},{1342177280u,4,3},{1207959552u,5,-4},{1073741824u,5,4},{0u,2,-1},}, }; static const HuffmanTyp mpc_table_HuffQ5 [2] [15] ICONST_ATTR = { - {{4026531840u,4,2},{3892314112u,5,5},{3825205248u,6,-7},{3758096384u,6,7},{3489660928u,4,-3},{3221225472u,4,3},{3087007744u,5,-6},{2952790016u,5,6},{2684354560u,4,-4},{2415919104u,4,4},{2147483648u,4,-5},{1610612736u,3,0},{1073741824u,3,-1},{536870912u,3,1},{0u,3,-2},}, - {{4026531840u,4,3},{3892314112u,5,4},{3858759680u,7,6},{3841982464u,8,-7},{3825205248u,8,7},{3758096384u,6,-6},{3221225472u,3,0},{2684354560u,3,-1},{2147483648u,3,1},{1610612736u,3,-2},{1073741824u,3,2},{939524096u,5,-5},{805306368u,5,5},{536870912u,4,-4},{0u,3,-3},}, + {{4026531840u,4,2},{3892314112u,5,5},{3825205248u,6,-7},{3758096384u,6,7},{3489660928u,4,-3},{3221225472u,4,3},{3087007744u,5,-6},{2952790016u,5,6},{2684354560u,4,-4},{2415919104u,4,4},{2147483648u,4,-5},{1610612736u,3,0},{1073741824u,3,-1},{536870912u,3,1},{0u,3,-2},}, + {{4026531840u,4,3},{3892314112u,5,4},{3858759680u,7,6},{3841982464u,8,-7},{3825205248u,8,7},{3758096384u,6,-6},{3221225472u,3,0},{2684354560u,3,-1},{2147483648u,3,1},{1610612736u,3,-2},{1073741824u,3,2},{939524096u,5,-5},{805306368u,5,5},{536870912u,4,-4},{0u,3,-3},}, }; static const HuffmanTyp mpc_table_HuffQ6 [2] [31] ICONST_ATTR = { - {{4160749568u,5,3},{4026531840u,5,-4},{3959422976u,6,-11},{3892314112u,6,12},{3758096384u,5,4},{3623878656u,5,6},{3489660928u,5,-5},{3355443200u,5,5},{3221225472u,5,7},{3087007744u,5,-7},{3019898880u,6,-12},{2952790016u,6,-13},{2818572288u,5,-6},{2684354560u,5,8},{2550136832u,5,-8},{2415919104u,5,9},{2281701376u,5,-9},{2214592512u,6,13},{2181038080u,7,-15},{2147483648u,7,15},{1879048192u,4,0},{1744830464u,5,-10},{1610612736u,5,10},{1342177280u,4,-1},{1073741824u,4,2},{805306368u,4,1},{536870912u,4,-2},{469762048u,6,14},{402653184u,6,-14},{268435456u,5,11},{0u,4,-3},}, - {{4160749568u,5,-6},{4026531840u,5,6},{3758096384u,4,1},{3489660928u,4,-1},{3456106496u,7,10},{3422552064u,7,-10},{3405774848u,8,-11},{3397386240u,9,-12},{3395289088u,11,13},{3394764800u,13,15},{3394240512u,13,-14},{3393716224u,13,14},{3393191936u,13,-15},{3388997632u,10,-13},{3372220416u,8,11},{3355443200u,8,12},{3288334336u,6,-9},{3221225472u,6,9},{2952790016u,4,-2},{2684354560u,4,2},{2415919104u,4,3},{2147483648u,4,-3},{2013265920u,5,-7},{1879048192u,5,7},{1610612736u,4,-4},{1342177280u,4,4},{1207959552u,5,-8},{1073741824u,5,8},{805306368u,4,5},{536870912u,4,-5},{0u,3,0},}, + {{4160749568u,5,3},{4026531840u,5,-4},{3959422976u,6,-11},{3892314112u,6,12},{3758096384u,5,4},{3623878656u,5,6},{3489660928u,5,-5},{3355443200u,5,5},{3221225472u,5,7},{3087007744u,5,-7},{3019898880u,6,-12},{2952790016u,6,-13},{2818572288u,5,-6},{2684354560u,5,8},{2550136832u,5,-8},{2415919104u,5,9},{2281701376u,5,-9},{2214592512u,6,13},{2181038080u,7,-15},{2147483648u,7,15},{1879048192u,4,0},{1744830464u,5,-10},{1610612736u,5,10},{1342177280u,4,-1},{1073741824u,4,2},{805306368u,4,1},{536870912u,4,-2},{469762048u,6,14},{402653184u,6,-14},{268435456u,5,11},{0u,4,-3},}, + {{4160749568u,5,-6},{4026531840u,5,6},{3758096384u,4,1},{3489660928u,4,-1},{3456106496u,7,10},{3422552064u,7,-10},{3405774848u,8,-11},{3397386240u,9,-12},{3395289088u,11,13},{3394764800u,13,15},{3394240512u,13,-14},{3393716224u,13,14},{3393191936u,13,-15},{3388997632u,10,-13},{3372220416u,8,11},{3355443200u,8,12},{3288334336u,6,-9},{3221225472u,6,9},{2952790016u,4,-2},{2684354560u,4,2},{2415919104u,4,3},{2147483648u,4,-3},{2013265920u,5,-7},{1879048192u,5,7},{1610612736u,4,-4},{1342177280u,4,4},{1207959552u,5,-8},{1073741824u,5,8},{805306368u,4,5},{536870912u,4,-5},{0u,3,0},}, }; static const HuffmanTyp mpc_table_HuffQ7 [2] [63] ICONST_ATTR = { - {{4227858432u,6,7},{4160749568u,6,8},{4093640704u,6,9},{4026531840u,6,-8},{3959422976u,6,11},{3925868544u,7,21},{3909091328u,8,-28},{3892314112u,8,28},{3825205248u,6,-9},{3791650816u,7,-22},{3758096384u,7,-21},{3690987520u,6,-10},{3623878656u,6,-11},{3556769792u,6,10},{3489660928u,6,12},{3422552064u,6,-13},{3388997632u,7,22},{3355443200u,7,23},{3288334336u,6,-12},{3221225472u,6,13},{3154116608u,6,14},{3087007744u,6,-14},{3053453312u,7,-23},{3036676096u,8,-29},{3019898880u,8,29},{2952790016u,6,-15},{2885681152u,6,15},{2818572288u,6,16},{2751463424u,6,-16},{2717908992u,7,-24},{2684354560u,7,24},{2617245696u,6,17},{2583691264u,7,-25},{2566914048u,8,-30},{2550136832u,8,30},{2483027968u,6,-17},{2415919104u,6,18},{2348810240u,6,-18},{2315255808u,7,25},{2281701376u,7,26},{2214592512u,6,19},{2181038080u,7,-26},{2147483648u,7,-27},{2013265920u,5,2},{1946157056u,6,-19},{1879048192u,6,20},{1744830464u,5,-1},{1728053248u,8,-31},{1711276032u,8,31},{1677721600u,7,27},{1610612736u,6,-20},{1476395008u,5,1},{1342177280u,5,-5},{1207959552u,5,-3},{1073741824u,5,3},{939524096u,5,0},{805306368u,5,-2},{671088640u,5,-4},{536870912u,5,4},{402653184u,5,5},{268435456u,5,-6},{134217728u,5,6},{0u,5,-7},}, - {{4160749568u,5,-1},{4026531840u,5,2},{3892314112u,5,-2},{3758096384u,5,3},{3741319168u,8,-20},{3737124864u,10,24},{3736862720u,14,28},{3736600576u,14,-28},{3736338432u,14,-30},{3736076288u,14,30},{3735027712u,12,-27},{3734765568u,14,29},{3734503424u,14,-29},{3734241280u,14,31},{3733979136u,14,-31},{3732930560u,12,27},{3724541952u,9,-22},{3690987520u,7,-17},{3623878656u,6,-11},{3489660928u,5,-3},{3355443200u,5,4},{3221225472u,5,-4},{3187671040u,7,17},{3170893824u,8,20},{3162505216u,9,22},{3158310912u,10,-25},{3154116608u,10,-26},{3087007744u,6,12},{2952790016u,5,5},{2818572288u,5,-5},{2684354560u,5,6},{2550136832u,5,-6},{2483027968u,6,-12},{2449473536u,7,-18},{2415919104u,7,18},{2348810240u,6,13},{2281701376u,6,-13},{2147483648u,5,-7},{2080374784u,6,14},{2063597568u,8,21},{2046820352u,8,-21},{2013265920u,7,-19},{1879048192u,5,7},{1744830464u,5,8},{1677721600u,6,-14},{1610612736u,6,-15},{1476395008u,5,-8},{1409286144u,6,15},{1375731712u,7,19},{1371537408u,10,25},{1367343104u,10,26},{1358954496u,9,-23},{1350565888u,9,23},{1342177280u,9,-24},{1207959552u,5,-9},{1073741824u,5,9},{1006632960u,6,16},{939524096u,6,-16},{805306368u,5,10},{536870912u,4,0},{402653184u,5,-10},{268435456u,5,11},{0u,4,1},}, + {{4227858432u,6,7},{4160749568u,6,8},{4093640704u,6,9},{4026531840u,6,-8},{3959422976u,6,11},{3925868544u,7,21},{3909091328u,8,-28},{3892314112u,8,28},{3825205248u,6,-9},{3791650816u,7,-22},{3758096384u,7,-21},{3690987520u,6,-10},{3623878656u,6,-11},{3556769792u,6,10},{3489660928u,6,12},{3422552064u,6,-13},{3388997632u,7,22},{3355443200u,7,23},{3288334336u,6,-12},{3221225472u,6,13},{3154116608u,6,14},{3087007744u,6,-14},{3053453312u,7,-23},{3036676096u,8,-29},{3019898880u,8,29},{2952790016u,6,-15},{2885681152u,6,15},{2818572288u,6,16},{2751463424u,6,-16},{2717908992u,7,-24},{2684354560u,7,24},{2617245696u,6,17},{2583691264u,7,-25},{2566914048u,8,-30},{2550136832u,8,30},{2483027968u,6,-17},{2415919104u,6,18},{2348810240u,6,-18},{2315255808u,7,25},{2281701376u,7,26},{2214592512u,6,19},{2181038080u,7,-26},{2147483648u,7,-27},{2013265920u,5,2},{1946157056u,6,-19},{1879048192u,6,20},{1744830464u,5,-1},{1728053248u,8,-31},{1711276032u,8,31},{1677721600u,7,27},{1610612736u,6,-20},{1476395008u,5,1},{1342177280u,5,-5},{1207959552u,5,-3},{1073741824u,5,3},{939524096u,5,0},{805306368u,5,-2},{671088640u,5,-4},{536870912u,5,4},{402653184u,5,5},{268435456u,5,-6},{134217728u,5,6},{0u,5,-7},}, + {{4160749568u,5,-1},{4026531840u,5,2},{3892314112u,5,-2},{3758096384u,5,3},{3741319168u,8,-20},{3737124864u,10,24},{3736862720u,14,28},{3736600576u,14,-28},{3736338432u,14,-30},{3736076288u,14,30},{3735027712u,12,-27},{3734765568u,14,29},{3734503424u,14,-29},{3734241280u,14,31},{3733979136u,14,-31},{3732930560u,12,27},{3724541952u,9,-22},{3690987520u,7,-17},{3623878656u,6,-11},{3489660928u,5,-3},{3355443200u,5,4},{3221225472u,5,-4},{3187671040u,7,17},{3170893824u,8,20},{3162505216u,9,22},{3158310912u,10,-25},{3154116608u,10,-26},{3087007744u,6,12},{2952790016u,5,5},{2818572288u,5,-5},{2684354560u,5,6},{2550136832u,5,-6},{2483027968u,6,-12},{2449473536u,7,-18},{2415919104u,7,18},{2348810240u,6,13},{2281701376u,6,-13},{2147483648u,5,-7},{2080374784u,6,14},{2063597568u,8,21},{2046820352u,8,-21},{2013265920u,7,-19},{1879048192u,5,7},{1744830464u,5,8},{1677721600u,6,-14},{1610612736u,6,-15},{1476395008u,5,-8},{1409286144u,6,15},{1375731712u,7,19},{1371537408u,10,25},{1367343104u,10,26},{1358954496u,9,-23},{1350565888u,9,23},{1342177280u,9,-24},{1207959552u,5,-9},{1073741824u,5,9},{1006632960u,6,16},{939524096u,6,-16},{805306368u,5,10},{536870912u,4,0},{402653184u,5,-10},{268435456u,5,11},{0u,4,1},}, }; const HuffmanTyp* mpc_table_HuffQ [2] [8] = { - {0,mpc_table_HuffQ1[0],mpc_table_HuffQ2[0],mpc_table_HuffQ3[0],mpc_table_HuffQ4[0],mpc_table_HuffQ5[0],mpc_table_HuffQ6[0],mpc_table_HuffQ7[0]}, - {0,mpc_table_HuffQ1[1],mpc_table_HuffQ2[1],mpc_table_HuffQ3[1],mpc_table_HuffQ4[1],mpc_table_HuffQ5[1],mpc_table_HuffQ6[1],mpc_table_HuffQ7[1]}, + {0,mpc_table_HuffQ1[0],mpc_table_HuffQ2[0],mpc_table_HuffQ3[0],mpc_table_HuffQ4[0],mpc_table_HuffQ5[0],mpc_table_HuffQ6[0],mpc_table_HuffQ7[0]}, + {0,mpc_table_HuffQ1[1],mpc_table_HuffQ2[1],mpc_table_HuffQ3[1],mpc_table_HuffQ4[1],mpc_table_HuffQ5[1],mpc_table_HuffQ6[1],mpc_table_HuffQ7[1]}, }; diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index a5a24d6c8a..f3aff7e54b 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c @@ -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 @@ -391,28 +391,26 @@ mpc_decoder_reset_globals(mpc_decoder *d) { mpc_decoder_reset_bitstream_decode(d); - d->DecodedFrames = 0; - d->SeekTableIndex = 0; + d->DecodedFrames = 0; + d->SeekTableIndex = 0; d->MaxDecodedFrames = 0; - d->StreamVersion = 0; - d->MS_used = 0; + d->StreamVersion = 0; + d->MS_used = 0; 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->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 ); + 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 ); + memset(d->Q , 0, sizeof d->Q ); + memset(d->MS_Flag , 0, sizeof d->MS_Flag ); } mpc_uint32_t @@ -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 ); diff --git a/apps/codecs/libmusepack/reader.h b/apps/codecs/libmusepack/reader.h index 83ef589e8f..397319b292 100644 --- a/apps/codecs/libmusepack/reader.h +++ b/apps/codecs/libmusepack/reader.h @@ -44,19 +44,19 @@ /// a functional reader. typedef struct mpc_reader_t { /// Reads size bytes of data into buffer at ptr. - mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size); + mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size); /// Seeks to byte position offset. - mpc_bool_t (*seek)(void *t, mpc_int32_t offset); + mpc_bool_t (*seek)(void *t, mpc_int32_t offset); /// Returns the current byte offset in the stream. - mpc_int32_t (*tell)(void *t); + mpc_int32_t (*tell)(void *t); /// Returns the total length of the source stream, in bytes. - mpc_int32_t (*get_size)(void *t); + mpc_int32_t (*get_size)(void *t); /// True if the stream is a seekable stream. - mpc_bool_t (*canseek)(void *t); + mpc_bool_t (*canseek)(void *t); /// Field that can be used to identify a particular instance of /// reader or carry along data associated with that reader. @@ -65,7 +65,7 @@ typedef struct mpc_reader_t { } mpc_reader; /* No standard STDIO based reader in Rockbox typedef struct mpc_reader_file_t { - mpc_reader reader; + mpc_reader reader; FILE *file; long file_size; diff --git a/apps/codecs/libmusepack/requant.c b/apps/codecs/libmusepack/requant.c index 6b77585d32..3282286d74 100644 --- a/apps/codecs/libmusepack/requant.c +++ b/apps/codecs/libmusepack/requant.c @@ -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 @@ -72,12 +72,12 @@ const mpc_int32_t __Dc [1 + 18] = { #ifdef MPC_FIXED_POINT static mpc_uint32_t find_shift(double fval) { - mpc_int64_t val = (mpc_int64_t)fval; - mpc_uint32_t ptr = 0; - if (val<0) val = -val; - while(val) {val>>=1;ptr++;} + mpc_int64_t val = (mpc_int64_t)fval; + mpc_uint32_t ptr = 0; + if (val<0) val = -val; + while(val) {val>>=1;ptr++;} - return ptr > 31 ? 0 : 31 - ptr; + return ptr > 31 ? 0 : 31 - ptr; } #endif @@ -92,22 +92,22 @@ mpc_decoder_scale_output(mpc_decoder *d, double factor) double f1; double f2; #ifndef MPC_FIXED_POINT - factor *= 1.0 / (double)(1<<(MPC_FIXED_POINT_SHIFT-1)); + factor *= 1.0 / (double)(1<<(MPC_FIXED_POINT_SHIFT-1)); #else - factor *= 1.0 / (double)(1<<(16 - MPC_FIXED_POINT_SHIFT)); + factor *= 1.0 / (double)(1<<(16 - MPC_FIXED_POINT_SHIFT)); #endif f1 = f2 = factor; // handles +1.58...-98.41 dB, where's scf[n] / scf[n-1] = 1.20050805774840750476 - - SET_SCF(1,factor); + + SET_SCF(1,factor); - f1 *= 0.83298066476582673961; - f2 *= 1/0.83298066476582673961; + f1 *= 0.83298066476582673961; + f2 *= 1/0.83298066476582673961; for ( n = 1; n <= 128; n++ ) { - SET_SCF((unsigned char)(1+n),f1); - SET_SCF((unsigned char)(1-n),f2); + SET_SCF((unsigned char)(1+n),f1); + SET_SCF((unsigned char)(1-n),f2); f1 *= 0.83298066476582673961; f2 *= 1/0.83298066476582673961; } |