diff options
author | Thom Johansen <thomj@rockbox.org> | 2006-01-30 01:00:40 +0000 |
---|---|---|
committer | Thom Johansen <thomj@rockbox.org> | 2006-01-30 01:00:40 +0000 |
commit | 2b483958f961637e296432632a5b891eb061c22d (patch) | |
tree | 180fd3596df375fa56732050a7cc20ebdbc3cdb7 /apps/codecs/libmusepack | |
parent | 58231d50f2cb940a309814e31ae583b4b0dfed24 (diff) | |
download | rockbox-2b483958f961637e296432632a5b891eb061c22d.tar.gz rockbox-2b483958f961637e296432632a5b891eb061c22d.zip |
Synced libmpcdec to musepack.net SVN.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8488 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmusepack')
-rw-r--r-- | apps/codecs/libmusepack/config_types.h | 6 | ||||
-rw-r--r-- | apps/codecs/libmusepack/decoder.h | 56 | ||||
-rw-r--r-- | apps/codecs/libmusepack/huffman.h | 32 | ||||
-rw-r--r-- | apps/codecs/libmusepack/huffsv46.c | 269 | ||||
-rw-r--r-- | apps/codecs/libmusepack/huffsv7.c | 507 | ||||
-rw-r--r-- | apps/codecs/libmusepack/idtag.c | 1 | ||||
-rw-r--r-- | apps/codecs/libmusepack/internal.h | 20 | ||||
-rw-r--r-- | apps/codecs/libmusepack/math.h | 10 | ||||
-rw-r--r-- | apps/codecs/libmusepack/mpc_decoder.c | 359 | ||||
-rw-r--r-- | apps/codecs/libmusepack/musepack.h | 29 | ||||
-rw-r--r-- | apps/codecs/libmusepack/reader.h | 23 | ||||
-rw-r--r-- | apps/codecs/libmusepack/requant.c | 36 | ||||
-rw-r--r-- | apps/codecs/libmusepack/requant.h | 6 | ||||
-rw-r--r-- | apps/codecs/libmusepack/streaminfo.c | 28 | ||||
-rw-r--r-- | apps/codecs/libmusepack/streaminfo.h | 6 | ||||
-rw-r--r-- | apps/codecs/libmusepack/synth_filter.c | 6 |
16 files changed, 361 insertions, 1033 deletions
diff --git a/apps/codecs/libmusepack/config_types.h b/apps/codecs/libmusepack/config_types.h index 8f42e11cce..30a609b863 100644 --- a/apps/codecs/libmusepack/config_types.h +++ b/apps/codecs/libmusepack/config_types.h | |||
@@ -35,9 +35,9 @@ | |||
35 | #ifndef __MUSEPACK_CONFIG_TYPES_H__ | 35 | #ifndef __MUSEPACK_CONFIG_TYPES_H__ |
36 | #define __MUSEPACK_CONFIG_TYPES_H__ | 36 | #define __MUSEPACK_CONFIG_TYPES_H__ |
37 | 37 | ||
38 | // typedef unsigned char BOOL; | 38 | typedef unsigned char mpc_bool_t; |
39 | // #define TRUE 1 | 39 | #define TRUE 1 |
40 | // #define FALSE 0 | 40 | #define FALSE 0 |
41 | 41 | ||
42 | /* these are filled in by configure */ | 42 | /* these are filled in by configure */ |
43 | typedef short mpc_int16_t; | 43 | typedef short mpc_int16_t; |
diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index 11acb7598b..759670ee72 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h | |||
@@ -34,8 +34,8 @@ | |||
34 | 34 | ||
35 | /// \file decoder.h | 35 | /// \file decoder.h |
36 | 36 | ||
37 | #ifndef _musepack_decoder_h_ | 37 | #ifndef _mpcdec_decoder_h_ |
38 | #define _musepack_decoder_h_ | 38 | #define _mpcdec_decoder_h_ |
39 | 39 | ||
40 | #include "huffman.h" | 40 | #include "huffman.h" |
41 | #include "math.h" | 41 | #include "math.h" |
@@ -43,6 +43,8 @@ | |||
43 | #include "reader.h" | 43 | #include "reader.h" |
44 | #include "streaminfo.h" | 44 | #include "streaminfo.h" |
45 | 45 | ||
46 | #define MPC_SUPPORT_SV456 | ||
47 | |||
46 | enum { | 48 | enum { |
47 | MPC_V_MEM = 2304, | 49 | MPC_V_MEM = 2304, |
48 | MPC_DECODER_MEMSIZE = 16384, // overall buffer size | 50 | MPC_DECODER_MEMSIZE = 16384, // overall buffer size |
@@ -59,29 +61,28 @@ typedef struct mpc_decoder_t { | |||
59 | /// @name internal state variables | 61 | /// @name internal state variables |
60 | //@{ | 62 | //@{ |
61 | 63 | ||
62 | mpc_uint32_t dword; /// actually decoded 32bit-word | 64 | mpc_uint32_t dword; /// currently decoded 32bit-word |
63 | mpc_uint32_t pos; /// bit-position within dword | 65 | mpc_uint32_t pos; /// bit-position within dword |
64 | mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer | 66 | mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer |
65 | mpc_uint32_t Zaehler; /// actual index within read-buffer | 67 | mpc_uint32_t Zaehler; /// actual index within read-buffer |
66 | 68 | ||
67 | mpc_uint32_t samples_to_skip; | 69 | mpc_uint32_t samples_to_skip; |
68 | 70 | ||
69 | mpc_uint32_t FwdJumpInfo; | 71 | mpc_uint32_t FwdJumpInfo; |
70 | mpc_uint32_t ActDecodePos; | 72 | mpc_uint32_t ActDecodePos; |
71 | mpc_uint32_t FrameWasValid; | 73 | |
72 | 74 | ||
73 | mpc_uint32_t DecodedFrames; | 75 | mpc_uint32_t DecodedFrames; |
74 | mpc_uint32_t OverallFrames; | 76 | mpc_uint32_t OverallFrames; |
75 | mpc_int32_t SampleRate; // Sample frequency | 77 | mpc_int32_t SampleRate; // Sample frequency |
76 | 78 | ||
77 | mpc_uint32_t StreamVersion; // version of bitstream | 79 | mpc_uint32_t StreamVersion; // version of bitstream |
78 | mpc_uint32_t MS_used; // MS-coding used ? | ||
79 | mpc_int32_t Max_Band; | 80 | mpc_int32_t Max_Band; |
80 | mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2 | 81 | mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2 |
81 | mpc_uint32_t LastValidSamples; | ||
82 | mpc_uint32_t TrueGaplessPresent; | ||
83 | 82 | ||
84 | mpc_uint32_t EQ_activated; | 83 | mpc_uint32_t FrameWasValid; |
84 | mpc_uint32_t MS_used; // MS-coding used ? | ||
85 | mpc_uint32_t TrueGaplessPresent; | ||
85 | 86 | ||
86 | mpc_uint32_t WordsRead; // counts amount of decoded dwords | 87 | mpc_uint32_t WordsRead; // counts amount of decoded dwords |
87 | 88 | ||
@@ -89,49 +90,18 @@ typedef struct mpc_decoder_t { | |||
89 | mpc_uint32_t __r1; | 90 | mpc_uint32_t __r1; |
90 | mpc_uint32_t __r2; | 91 | mpc_uint32_t __r2; |
91 | 92 | ||
92 | mpc_uint32_t Q_bit [32]; | ||
93 | mpc_uint32_t Q_res [32][16]; | ||
94 | |||
95 | // huffman table stuff | ||
96 | HuffmanTyp HuffHdr [10]; | ||
97 | HuffmanTyp HuffSCFI [ 4]; | ||
98 | HuffmanTyp HuffDSCF [16]; | ||
99 | HuffmanTyp* HuffQ [2] [8]; | ||
100 | |||
101 | HuffmanTyp HuffQ1 [2] [3*3*3]; | ||
102 | HuffmanTyp HuffQ2 [2] [5*5]; | ||
103 | HuffmanTyp HuffQ3 [2] [ 7]; | ||
104 | HuffmanTyp HuffQ4 [2] [ 9]; | ||
105 | HuffmanTyp HuffQ5 [2] [15]; | ||
106 | HuffmanTyp HuffQ6 [2] [31]; | ||
107 | HuffmanTyp HuffQ7 [2] [63]; | ||
108 | const HuffmanTyp* SampleHuff [18]; | ||
109 | HuffmanTyp SCFI_Bundle [ 8]; | ||
110 | HuffmanTyp DSCF_Entropie [13]; | ||
111 | HuffmanTyp Region_A [16]; | ||
112 | HuffmanTyp Region_B [ 8]; | ||
113 | HuffmanTyp Region_C [ 4]; | ||
114 | |||
115 | HuffmanTyp Entropie_1 [ 3]; | ||
116 | HuffmanTyp Entropie_2 [ 5]; | ||
117 | HuffmanTyp Entropie_3 [ 7]; | ||
118 | HuffmanTyp Entropie_4 [ 9]; | ||
119 | HuffmanTyp Entropie_5 [15]; | ||
120 | HuffmanTyp Entropie_6 [31]; | ||
121 | HuffmanTyp Entropie_7 [63]; | ||
122 | |||
123 | mpc_int32_t SCF_Index_L [32] [3]; | 93 | mpc_int32_t SCF_Index_L [32] [3]; |
124 | mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices | 94 | mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices |
125 | QuantTyp Q [32]; // holds quantized samples | 95 | QuantTyp Q [32]; // holds quantized samples |
126 | mpc_int32_t Res_L [32]; | 96 | mpc_int32_t Res_L [32]; |
127 | mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband | 97 | mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband |
128 | mpc_int32_t DSCF_Flag_L [32]; | 98 | mpc_bool_t DSCF_Flag_L [32]; |
129 | mpc_int32_t DSCF_Flag_R [32]; // differential SCF used? | 99 | mpc_bool_t DSCF_Flag_R [32]; // differential SCF used? |
130 | mpc_int32_t SCFI_L [32]; | 100 | mpc_int32_t SCFI_L [32]; |
131 | mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF | 101 | mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF |
132 | mpc_int32_t DSCF_Reference_L [32]; | 102 | mpc_int32_t DSCF_Reference_L [32]; |
133 | mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF | 103 | mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF |
134 | mpc_int32_t MS_Flag[32]; // MS used? | 104 | mpc_bool_t MS_Flag[32]; // MS used? |
135 | #ifdef MPC_FIXED_POINT | 105 | #ifdef MPC_FIXED_POINT |
136 | unsigned char SCF_shift[256]; | 106 | unsigned char SCF_shift[256]; |
137 | #endif | 107 | #endif |
diff --git a/apps/codecs/libmusepack/huffman.h b/apps/codecs/libmusepack/huffman.h index a769fece4b..3edbeb7b6e 100644 --- a/apps/codecs/libmusepack/huffman.h +++ b/apps/codecs/libmusepack/huffman.h | |||
@@ -35,8 +35,8 @@ | |||
35 | /// \file huffman.h | 35 | /// \file huffman.h |
36 | /// Data structures and functions for huffman coding. | 36 | /// Data structures and functions for huffman coding. |
37 | 37 | ||
38 | #ifndef _musepack_huffman_h_ | 38 | #ifndef _mpcdec_huffman_h_ |
39 | #define _musepack_huffman_h_ | 39 | #define _mpcdec_huffman_h_ |
40 | 40 | ||
41 | #include "config_types.h" | 41 | #include "config_types.h" |
42 | #include "decoder.h" | 42 | #include "decoder.h" |
@@ -46,30 +46,8 @@ struct mpc_decoder_t; // forward declare to break circular dependencies | |||
46 | /// Huffman table entry. | 46 | /// Huffman table entry. |
47 | typedef struct huffman_type_t { | 47 | typedef struct huffman_type_t { |
48 | mpc_uint32_t Code; | 48 | mpc_uint32_t Code; |
49 | mpc_uint32_t Length; | 49 | mpc_uint16_t Length; |
50 | mpc_int32_t Value; | 50 | mpc_int16_t Value; |
51 | } HuffmanTyp; | 51 | } HuffmanTyp; |
52 | 52 | ||
53 | //! \brief Sorts huffman-tables by codeword. | 53 | #endif // _mpcdec_huffman_h_ |
54 | //! | ||
55 | //! offset resulting value. | ||
56 | //! \param elements | ||
57 | //! \param Table table to sort | ||
58 | //! \param offset offset of resulting sort | ||
59 | void | ||
60 | mpc_decoder_resort_huff_tables( | ||
61 | const mpc_uint32_t elements, HuffmanTyp *Table, const mpc_int32_t offset); | ||
62 | |||
63 | /// Initializes sv6 huffman decoding structures. | ||
64 | void mpc_decoder_init_huffman_sv6(struct mpc_decoder_t *d); | ||
65 | |||
66 | /// Initializes sv6 huffman decoding tables. | ||
67 | void mpc_decoder_init_huffman_sv6_tables(struct mpc_decoder_t *d); | ||
68 | |||
69 | /// Initializes sv7 huffman decoding structures. | ||
70 | void mpc_decoder_init_huffman_sv7(struct mpc_decoder_t *d); | ||
71 | |||
72 | /// Initializes sv7 huffman decoding tables. | ||
73 | void mpc_decoder_init_huffman_sv7_tables(struct mpc_decoder_t *d); | ||
74 | |||
75 | #endif // _musepack_huffman_h_ | ||
diff --git a/apps/codecs/libmusepack/huffsv46.c b/apps/codecs/libmusepack/huffsv46.c index 4b6e0610d6..3e0fb3ed93 100644 --- a/apps/codecs/libmusepack/huffsv46.c +++ b/apps/codecs/libmusepack/huffsv46.c | |||
@@ -35,234 +35,41 @@ | |||
35 | /// \file huffsv46.c | 35 | /// \file huffsv46.c |
36 | /// Implementations of huffman decoding for streamversions < 7. | 36 | /// Implementations of huffman decoding for streamversions < 7. |
37 | 37 | ||
38 | #include "musepack.h" | 38 | #include <musepack.h> |
39 | #include "requant.h" | 39 | #include <requant.h> |
40 | #include "huffman.h" | 40 | #include <huffman.h> |
41 | 41 | ||
42 | void | 42 | #ifdef MPC_SUPPORT_SV456 |
43 | mpc_decoder_init_huffman_sv6(mpc_decoder *d) | 43 | |
44 | { | 44 | |
45 | mpc_decoder_init_huffman_sv6_tables(d); | 45 | const HuffmanTyp mpc_table_SCFI_Bundle [ 8] = |
46 | mpc_decoder_resort_huff_tables(16, d->Region_A , 0); | 46 | {{2147483648u,1,7},{1073741824u,2,3},{939524096u,5,1},{805306368u,5,2},{738197504u,6,0},{671088640u,6,6},{536870912u,5,4},{0u,3,5},}; |
47 | mpc_decoder_resort_huff_tables( 8, d->Region_B , 0); | 47 | const HuffmanTyp mpc_table_DSCF_Entropie [13] = |
48 | mpc_decoder_resort_huff_tables( 4, d->Region_C , 0); | 48 | {{3758096384u,3,1},{3489660928u,4,3},{3355443200u,5,5},{3221225472u,5,-3},{2952790016u,4,-2},{2684354560u,4,4},{2147483648u,3,-1},{1610612736u,3,2},{1476395008u,5,-5},{1409286144u,6,6},{1342177280u,6,-6},{1073741824u,4,-4},{0u,2,0},}; |
49 | mpc_decoder_resort_huff_tables( 8, d->SCFI_Bundle , 0); | 49 | const HuffmanTyp mpc_table_Region_A [16] = |
50 | mpc_decoder_resort_huff_tables(13, d->DSCF_Entropie , 6); | 50 | {{2147483648u,1,1},{2013265920u,5,3},{1946157056u,6,4},{1912602624u,7,7},{1895825408u,8,8},{1887436800u,9,9},{1883242496u,10,10},{1881145344u,11,11},{1880096768u,12,12},{1879572480u,13,13},{1879310336u,14,14},{1879048192u,14,15},{1744830464u,5,5},{1610612736u,5,6},{1073741824u,3,0},{0u,2,2},}; |
51 | mpc_decoder_resort_huff_tables( 3, d->Entropie_1 , Dc[1]); | 51 | const HuffmanTyp mpc_table_Region_B [ 8] = |
52 | mpc_decoder_resort_huff_tables( 5, d->Entropie_2 , Dc[2]); | 52 | {{2147483648u,1,1},{1073741824u,2,0},{536870912u,3,2},{268435456u,4,3},{134217728u,5,4},{67108864u,6,5},{33554432u,7,6},{0u,7,7},}; |
53 | mpc_decoder_resort_huff_tables( 7, d->Entropie_3 , Dc[3]); | 53 | const HuffmanTyp mpc_table_Region_C [ 4] = |
54 | mpc_decoder_resort_huff_tables( 9, d->Entropie_4 , Dc[4]); | 54 | {{2147483648u,1,0},{1073741824u,2,1},{536870912u,3,2},{0u,3,3},}; |
55 | mpc_decoder_resort_huff_tables(15, d->Entropie_5 , Dc[5]); | 55 | |
56 | mpc_decoder_resort_huff_tables(31, d->Entropie_6 , Dc[6]); | 56 | static const HuffmanTyp mpc_table_Entropie_1 [ 3] = |
57 | mpc_decoder_resort_huff_tables(63, d->Entropie_7 , Dc[7]); | 57 | {{2147483648u,1,0},{1073741824u,2,-1},{0u,2,1},}; |
58 | } | 58 | static const HuffmanTyp mpc_table_Entropie_2 [ 5] = |
59 | 59 | {{3221225472u,2,0},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,1},{0u,2,-1},}; | |
60 | void | 60 | static const HuffmanTyp mpc_table_Entropie_3 [ 7] = |
61 | mpc_decoder_init_huffman_sv6_tables(mpc_decoder *d) | 61 | {{3221225472u,2,0},{2684354560u,3,-2},{2415919104u,4,2},{2281701376u,5,-3},{2147483648u,5,3},{1073741824u,2,-1},{0u,2,1},}; |
62 | { | 62 | static const HuffmanTyp mpc_table_Entropie_4 [ 9] = |
63 | // SCFI-bundle | 63 | {{4026531840u,4,3},{3758096384u,4,-3},{3221225472u,3,1},{2684354560u,3,-1},{2147483648u,3,2},{1610612736u,3,-2},{1342177280u,4,-4},{1073741824u,4,4},{0u,2,0},}; |
64 | d->SCFI_Bundle[7].Code= 1; d->SCFI_Bundle[7].Length= 1; | 64 | static const HuffmanTyp mpc_table_Entropie_5 [15] = |
65 | d->SCFI_Bundle[3].Code= 1; d->SCFI_Bundle[3].Length= 2; | 65 | {{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},{2147483648u,3,0},{1610612736u,3,1},{1073741824u,3,-1},{805306368u,4,-4},{536870912u,4,5},{0u,3,2},}; |
66 | d->SCFI_Bundle[5].Code= 0; d->SCFI_Bundle[5].Length= 3; | 66 | static const HuffmanTyp mpc_table_Entropie_6 [31] = |
67 | d->SCFI_Bundle[1].Code= 7; d->SCFI_Bundle[1].Length= 5; | 67 | {{4160749568u,5,-4},{4026531840u,5,5},{3892314112u,5,-5},{3825205248u,6,10},{3758096384u,6,-10},{3623878656u,5,-6},{3489660928u,5,6},{3355443200u,5,7},{3221225472u,5,-7},{3087007744u,5,-8},{3019898880u,6,-11},{2986344448u,7,14},{2952790016u,7,-14},{2818572288u,5,8},{2751463424u,6,11},{2684354560u,6,-13},{2415919104u,4,0},{2147483648u,4,1},{1879048192u,4,-1},{1610612736u,4,3},{1342177280u,4,2},{1207959552u,5,-9},{1140850688u,6,12},{1073741824u,6,13},{805306368u,4,-3},{536870912u,4,-2},{402653184u,5,9},{335544320u,6,-12},{301989888u,7,15},{268435456u,7,-15},{0u,4,4},}; |
68 | d->SCFI_Bundle[2].Code= 6; d->SCFI_Bundle[2].Length= 5; | 68 | static const HuffmanTyp mpc_table_Entropie_7 [63] = |
69 | d->SCFI_Bundle[4].Code= 4; d->SCFI_Bundle[4].Length= 5; | 69 | {{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},}; |
70 | d->SCFI_Bundle[0].Code= 11; d->SCFI_Bundle[0].Length= 6; | 70 | |
71 | d->SCFI_Bundle[6].Code= 10; d->SCFI_Bundle[6].Length= 6; | 71 | const HuffmanTyp* mpc_table_SampleHuff [18] = { |
72 | 72 | 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 | |
73 | // region A (subbands 0..10) | 73 | }; |
74 | d->Region_A[ 1].Code= 1; d->Region_A[ 1].Length= 1; | 74 | |
75 | d->Region_A[ 2].Code= 0; d->Region_A[ 2].Length= 2; | 75 | #endif //#ifdef MPC_SUPPORT_SV456 |
76 | d->Region_A[ 0].Code= 2; d->Region_A[ 0].Length= 3; | ||
77 | d->Region_A[ 3].Code= 15; d->Region_A[ 3].Length= 5; | ||
78 | d->Region_A[ 5].Code= 13; d->Region_A[ 5].Length= 5; | ||
79 | d->Region_A[ 6].Code= 12; d->Region_A[ 6].Length= 5; | ||
80 | d->Region_A[ 4].Code= 29; d->Region_A[ 4].Length= 6; | ||
81 | d->Region_A[ 7].Code= 57; d->Region_A[ 7].Length= 7; | ||
82 | d->Region_A[ 8].Code= 113; d->Region_A[ 8].Length= 8; | ||
83 | d->Region_A[ 9].Code= 225; d->Region_A[ 9].Length= 9; | ||
84 | d->Region_A[10].Code= 449; d->Region_A[10].Length= 10; | ||
85 | d->Region_A[11].Code= 897; d->Region_A[11].Length= 11; | ||
86 | d->Region_A[12].Code= 1793; d->Region_A[12].Length= 12; | ||
87 | d->Region_A[13].Code= 3585; d->Region_A[13].Length= 13; | ||
88 | d->Region_A[14].Code= 7169; d->Region_A[14].Length= 14; | ||
89 | d->Region_A[15].Code= 7168; d->Region_A[15].Length= 14; | ||
90 | |||
91 | // region B (subbands 11..22) | ||
92 | d->Region_B[1].Code= 1; d->Region_B[1].Length= 1; | ||
93 | d->Region_B[0].Code= 1; d->Region_B[0].Length= 2; | ||
94 | d->Region_B[2].Code= 1; d->Region_B[2].Length= 3; | ||
95 | d->Region_B[3].Code= 1; d->Region_B[3].Length= 4; | ||
96 | d->Region_B[4].Code= 1; d->Region_B[4].Length= 5; | ||
97 | d->Region_B[5].Code= 1; d->Region_B[5].Length= 6; | ||
98 | d->Region_B[6].Code= 1; d->Region_B[6].Length= 7; | ||
99 | d->Region_B[7].Code= 0; d->Region_B[7].Length= 7; | ||
100 | |||
101 | // region C (subbands 23..31) | ||
102 | d->Region_C[0].Code= 1; d->Region_C[0].Length= 1; | ||
103 | d->Region_C[1].Code= 1; d->Region_C[1].Length= 2; | ||
104 | d->Region_C[2].Code= 1; d->Region_C[2].Length= 3; | ||
105 | d->Region_C[3].Code= 0; d->Region_C[3].Length= 3; | ||
106 | |||
107 | // DSCF | ||
108 | d->DSCF_Entropie[ 6].Code= 0; d->DSCF_Entropie[ 6].Length= 2; | ||
109 | d->DSCF_Entropie[ 7].Code= 7; d->DSCF_Entropie[ 7].Length= 3; | ||
110 | d->DSCF_Entropie[ 5].Code= 4; d->DSCF_Entropie[ 5].Length= 3; | ||
111 | d->DSCF_Entropie[ 8].Code= 3; d->DSCF_Entropie[ 8].Length= 3; | ||
112 | d->DSCF_Entropie[ 9].Code= 13; d->DSCF_Entropie[ 9].Length= 4; | ||
113 | d->DSCF_Entropie[ 4].Code= 11; d->DSCF_Entropie[ 4].Length= 4; | ||
114 | d->DSCF_Entropie[10].Code= 10; d->DSCF_Entropie[10].Length= 4; | ||
115 | d->DSCF_Entropie[ 2].Code= 4; d->DSCF_Entropie[ 2].Length= 4; | ||
116 | d->DSCF_Entropie[11].Code= 25; d->DSCF_Entropie[11].Length= 5; | ||
117 | d->DSCF_Entropie[ 3].Code= 24; d->DSCF_Entropie[ 3].Length= 5; | ||
118 | d->DSCF_Entropie[ 1].Code= 11; d->DSCF_Entropie[ 1].Length= 5; | ||
119 | d->DSCF_Entropie[12].Code= 21; d->DSCF_Entropie[12].Length= 6; | ||
120 | d->DSCF_Entropie[ 0].Code= 20; d->DSCF_Entropie[ 0].Length= 6; | ||
121 | |||
122 | // first quantizer | ||
123 | d->Entropie_1[1].Code= 1; d->Entropie_1[1].Length= 1; | ||
124 | d->Entropie_1[0].Code= 1; d->Entropie_1[0].Length= 2; | ||
125 | d->Entropie_1[2].Code= 0; d->Entropie_1[2].Length= 2; | ||
126 | |||
127 | // second quantizer | ||
128 | d->Entropie_2[2].Code= 3; d->Entropie_2[2].Length= 2; | ||
129 | d->Entropie_2[3].Code= 1; d->Entropie_2[3].Length= 2; | ||
130 | d->Entropie_2[1].Code= 0; d->Entropie_2[1].Length= 2; | ||
131 | d->Entropie_2[4].Code= 5; d->Entropie_2[4].Length= 3; | ||
132 | d->Entropie_2[0].Code= 4; d->Entropie_2[0].Length= 3; | ||
133 | |||
134 | // third quantizer | ||
135 | d->Entropie_3[3].Code= 3; d->Entropie_3[3].Length= 2; | ||
136 | d->Entropie_3[2].Code= 1; d->Entropie_3[2].Length= 2; | ||
137 | d->Entropie_3[4].Code= 0; d->Entropie_3[4].Length= 2; | ||
138 | d->Entropie_3[1].Code= 5; d->Entropie_3[1].Length= 3; | ||
139 | d->Entropie_3[5].Code= 9; d->Entropie_3[5].Length= 4; | ||
140 | d->Entropie_3[0].Code= 17; d->Entropie_3[0].Length= 5; | ||
141 | d->Entropie_3[6].Code= 16; d->Entropie_3[6].Length= 5; | ||
142 | |||
143 | // forth quantizer | ||
144 | d->Entropie_4[4].Code= 0; d->Entropie_4[4].Length= 2; | ||
145 | d->Entropie_4[5].Code= 6; d->Entropie_4[5].Length= 3; | ||
146 | d->Entropie_4[3].Code= 5; d->Entropie_4[3].Length= 3; | ||
147 | d->Entropie_4[6].Code= 4; d->Entropie_4[6].Length= 3; | ||
148 | d->Entropie_4[2].Code= 3; d->Entropie_4[2].Length= 3; | ||
149 | d->Entropie_4[7].Code= 15; d->Entropie_4[7].Length= 4; | ||
150 | d->Entropie_4[1].Code= 14; d->Entropie_4[1].Length= 4; | ||
151 | d->Entropie_4[0].Code= 5; d->Entropie_4[0].Length= 4; | ||
152 | d->Entropie_4[8].Code= 4; d->Entropie_4[8].Length= 4; | ||
153 | |||
154 | // fifth quantizer | ||
155 | d->Entropie_5[7 ].Code= 4; d->Entropie_5[7 ].Length= 3; | ||
156 | d->Entropie_5[8 ].Code= 3; d->Entropie_5[8 ].Length= 3; | ||
157 | d->Entropie_5[6 ].Code= 2; d->Entropie_5[6 ].Length= 3; | ||
158 | d->Entropie_5[9 ].Code= 0; d->Entropie_5[9 ].Length= 3; | ||
159 | d->Entropie_5[5 ].Code= 15; d->Entropie_5[5 ].Length= 4; | ||
160 | d->Entropie_5[4 ].Code= 13; d->Entropie_5[4 ].Length= 4; | ||
161 | d->Entropie_5[10].Code= 12; d->Entropie_5[10].Length= 4; | ||
162 | d->Entropie_5[11].Code= 10; d->Entropie_5[11].Length= 4; | ||
163 | d->Entropie_5[3 ].Code= 3; d->Entropie_5[3 ].Length= 4; | ||
164 | d->Entropie_5[12].Code= 2; d->Entropie_5[12].Length= 4; | ||
165 | d->Entropie_5[2 ].Code= 29; d->Entropie_5[2 ].Length= 5; | ||
166 | d->Entropie_5[1 ].Code= 23; d->Entropie_5[1 ].Length= 5; | ||
167 | d->Entropie_5[13].Code= 22; d->Entropie_5[13].Length= 5; | ||
168 | d->Entropie_5[0 ].Code= 57; d->Entropie_5[0 ].Length= 6; | ||
169 | d->Entropie_5[14].Code= 56; d->Entropie_5[14].Length= 6; | ||
170 | |||
171 | // sixth quantizer | ||
172 | d->Entropie_6[15].Code= 9; d->Entropie_6[15].Length= 4; | ||
173 | d->Entropie_6[16].Code= 8; d->Entropie_6[16].Length= 4; | ||
174 | d->Entropie_6[14].Code= 7; d->Entropie_6[14].Length= 4; | ||
175 | d->Entropie_6[18].Code= 6; d->Entropie_6[18].Length= 4; | ||
176 | d->Entropie_6[17].Code= 5; d->Entropie_6[17].Length= 4; | ||
177 | d->Entropie_6[12].Code= 3; d->Entropie_6[12].Length= 4; | ||
178 | d->Entropie_6[13].Code= 2; d->Entropie_6[13].Length= 4; | ||
179 | d->Entropie_6[19].Code= 0; d->Entropie_6[19].Length= 4; | ||
180 | d->Entropie_6[11].Code= 31; d->Entropie_6[11].Length= 5; | ||
181 | d->Entropie_6[20].Code= 30; d->Entropie_6[20].Length= 5; | ||
182 | d->Entropie_6[10].Code= 29; d->Entropie_6[10].Length= 5; | ||
183 | d->Entropie_6[9 ].Code= 27; d->Entropie_6[9 ].Length= 5; | ||
184 | d->Entropie_6[21].Code= 26; d->Entropie_6[21].Length= 5; | ||
185 | d->Entropie_6[22].Code= 25; d->Entropie_6[22].Length= 5; | ||
186 | d->Entropie_6[8 ].Code= 24; d->Entropie_6[8 ].Length= 5; | ||
187 | d->Entropie_6[7 ].Code= 23; d->Entropie_6[7 ].Length= 5; | ||
188 | d->Entropie_6[23].Code= 21; d->Entropie_6[23].Length= 5; | ||
189 | d->Entropie_6[6 ].Code= 9; d->Entropie_6[6 ].Length= 5; | ||
190 | d->Entropie_6[24].Code= 3; d->Entropie_6[24].Length= 5; | ||
191 | d->Entropie_6[25].Code= 57; d->Entropie_6[25].Length= 6; | ||
192 | d->Entropie_6[5 ].Code= 56; d->Entropie_6[5 ].Length= 6; | ||
193 | d->Entropie_6[4 ].Code= 45; d->Entropie_6[4 ].Length= 6; | ||
194 | d->Entropie_6[26].Code= 41; d->Entropie_6[26].Length= 6; | ||
195 | d->Entropie_6[2 ].Code= 40; d->Entropie_6[2 ].Length= 6; | ||
196 | d->Entropie_6[27].Code= 17; d->Entropie_6[27].Length= 6; | ||
197 | d->Entropie_6[28].Code= 16; d->Entropie_6[28].Length= 6; | ||
198 | d->Entropie_6[3 ].Code= 5; d->Entropie_6[3 ].Length= 6; | ||
199 | d->Entropie_6[29].Code= 89; d->Entropie_6[29].Length= 7; | ||
200 | d->Entropie_6[1 ].Code= 88; d->Entropie_6[1 ].Length= 7; | ||
201 | d->Entropie_6[30].Code= 9; d->Entropie_6[30].Length= 7; | ||
202 | d->Entropie_6[0 ].Code= 8; d->Entropie_6[0 ].Length= 7; | ||
203 | |||
204 | // seventh quantizer | ||
205 | d->Entropie_7[25].Code= 0; d->Entropie_7[25].Length= 5; | ||
206 | d->Entropie_7[37].Code= 1; d->Entropie_7[37].Length= 5; | ||
207 | d->Entropie_7[62].Code= 16; d->Entropie_7[62].Length= 8; | ||
208 | d->Entropie_7[ 0].Code= 17; d->Entropie_7[ 0].Length= 8; | ||
209 | d->Entropie_7[ 3].Code= 9; d->Entropie_7[ 3].Length= 7; | ||
210 | d->Entropie_7[ 5].Code= 10; d->Entropie_7[ 5].Length= 7; | ||
211 | d->Entropie_7[ 6].Code= 11; d->Entropie_7[ 6].Length= 7; | ||
212 | d->Entropie_7[38].Code= 3; d->Entropie_7[38].Length= 5; | ||
213 | d->Entropie_7[35].Code= 4; d->Entropie_7[35].Length= 5; | ||
214 | d->Entropie_7[33].Code= 5; d->Entropie_7[33].Length= 5; | ||
215 | d->Entropie_7[24].Code= 6; d->Entropie_7[24].Length= 5; | ||
216 | d->Entropie_7[27].Code= 7; d->Entropie_7[27].Length= 5; | ||
217 | d->Entropie_7[26].Code= 8; d->Entropie_7[26].Length= 5; | ||
218 | d->Entropie_7[12].Code= 18; d->Entropie_7[12].Length= 6; | ||
219 | d->Entropie_7[50].Code= 19; d->Entropie_7[50].Length= 6; | ||
220 | d->Entropie_7[29].Code= 10; d->Entropie_7[29].Length= 5; | ||
221 | d->Entropie_7[31].Code= 11; d->Entropie_7[31].Length= 5; | ||
222 | d->Entropie_7[36].Code= 12; d->Entropie_7[36].Length= 5; | ||
223 | d->Entropie_7[34].Code= 13; d->Entropie_7[34].Length= 5; | ||
224 | d->Entropie_7[28].Code= 14; d->Entropie_7[28].Length= 5; | ||
225 | d->Entropie_7[49].Code= 30; d->Entropie_7[49].Length= 6; | ||
226 | d->Entropie_7[56].Code= 62; d->Entropie_7[56].Length= 7; | ||
227 | d->Entropie_7[ 7].Code= 63; d->Entropie_7[ 7].Length= 7; | ||
228 | d->Entropie_7[32].Code= 16; d->Entropie_7[32].Length= 5; | ||
229 | d->Entropie_7[30].Code= 17; d->Entropie_7[30].Length= 5; | ||
230 | d->Entropie_7[13].Code= 36; d->Entropie_7[13].Length= 6; | ||
231 | d->Entropie_7[55].Code= 74; d->Entropie_7[55].Length= 7; | ||
232 | d->Entropie_7[61].Code= 150; d->Entropie_7[61].Length= 8; | ||
233 | d->Entropie_7[ 1].Code= 151; d->Entropie_7[ 1].Length= 8; | ||
234 | d->Entropie_7[14].Code= 38; d->Entropie_7[14].Length= 6; | ||
235 | d->Entropie_7[48].Code= 39; d->Entropie_7[48].Length= 6; | ||
236 | d->Entropie_7[ 4].Code= 80; d->Entropie_7[ 4].Length= 7; | ||
237 | d->Entropie_7[58].Code= 81; d->Entropie_7[58].Length= 7; | ||
238 | d->Entropie_7[47].Code= 41; d->Entropie_7[47].Length= 6; | ||
239 | d->Entropie_7[15].Code= 42; d->Entropie_7[15].Length= 6; | ||
240 | d->Entropie_7[16].Code= 43; d->Entropie_7[16].Length= 6; | ||
241 | d->Entropie_7[54].Code= 88; d->Entropie_7[54].Length= 7; | ||
242 | d->Entropie_7[ 8].Code= 89; d->Entropie_7[ 8].Length= 7; | ||
243 | d->Entropie_7[17].Code= 45; d->Entropie_7[17].Length= 6; | ||
244 | d->Entropie_7[46].Code= 46; d->Entropie_7[46].Length= 6; | ||
245 | d->Entropie_7[45].Code= 47; d->Entropie_7[45].Length= 6; | ||
246 | d->Entropie_7[53].Code= 96; d->Entropie_7[53].Length= 7; | ||
247 | d->Entropie_7[ 9].Code= 97; d->Entropie_7[ 9].Length= 7; | ||
248 | d->Entropie_7[43].Code= 49; d->Entropie_7[43].Length= 6; | ||
249 | d->Entropie_7[19].Code= 50; d->Entropie_7[19].Length= 6; | ||
250 | d->Entropie_7[18].Code= 51; d->Entropie_7[18].Length= 6; | ||
251 | d->Entropie_7[44].Code= 52; d->Entropie_7[44].Length= 6; | ||
252 | d->Entropie_7[ 2].Code= 212; d->Entropie_7[ 2].Length= 8; | ||
253 | d->Entropie_7[60].Code= 213; d->Entropie_7[60].Length= 8; | ||
254 | d->Entropie_7[10].Code= 107; d->Entropie_7[10].Length= 7; | ||
255 | d->Entropie_7[42].Code= 54; d->Entropie_7[42].Length= 6; | ||
256 | d->Entropie_7[41].Code= 55; d->Entropie_7[41].Length= 6; | ||
257 | d->Entropie_7[20].Code= 56; d->Entropie_7[20].Length= 6; | ||
258 | d->Entropie_7[21].Code= 57; d->Entropie_7[21].Length= 6; | ||
259 | d->Entropie_7[52].Code= 116; d->Entropie_7[52].Length= 7; | ||
260 | d->Entropie_7[51].Code= 117; d->Entropie_7[51].Length= 7; | ||
261 | d->Entropie_7[40].Code= 59; d->Entropie_7[40].Length= 6; | ||
262 | d->Entropie_7[22].Code= 60; d->Entropie_7[22].Length= 6; | ||
263 | d->Entropie_7[23].Code= 61; d->Entropie_7[23].Length= 6; | ||
264 | d->Entropie_7[39].Code= 62; d->Entropie_7[39].Length= 6; | ||
265 | d->Entropie_7[11].Code= 126; d->Entropie_7[11].Length= 7; | ||
266 | d->Entropie_7[57].Code= 254; d->Entropie_7[57].Length= 8; | ||
267 | d->Entropie_7[59].Code= 255; d->Entropie_7[59].Length= 8; | ||
268 | } | ||
diff --git a/apps/codecs/libmusepack/huffsv7.c b/apps/codecs/libmusepack/huffsv7.c index bebe1af07c..a59674191d 100644 --- a/apps/codecs/libmusepack/huffsv7.c +++ b/apps/codecs/libmusepack/huffsv7.c | |||
@@ -35,466 +35,47 @@ | |||
35 | /// \file huffsv7.c | 35 | /// \file huffsv7.c |
36 | /// Implementations of sv7 huffman decoding functions. | 36 | /// Implementations of sv7 huffman decoding functions. |
37 | 37 | ||
38 | #include "musepack.h" | 38 | #include <musepack.h> |
39 | #include "huffman.h" | 39 | #include <huffman.h> |
40 | #include "requant.h" | 40 | #include <requant.h> |
41 | 41 | ||
42 | void | 42 | const HuffmanTyp mpc_table_HuffHdr [10] = |
43 | mpc_decoder_init_huffman_sv7(mpc_decoder *d) | 43 | {{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},}; |
44 | { | 44 | const HuffmanTyp mpc_table_HuffSCFI [ 4] = |
45 | mpc_decoder_init_huffman_sv7_tables(d); | 45 | {{2147483648u,1,1},{1610612736u,3,2},{1073741824u,3,0},{0u,2,3},}; |
46 | mpc_decoder_resort_huff_tables(10, &(d->HuffHdr[0]) , 5); | 46 | const HuffmanTyp mpc_table_HuffDSCF [16] = |
47 | mpc_decoder_resort_huff_tables( 4, &(d->HuffSCFI[0]) , 0); | 47 | {{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},}; |
48 | mpc_decoder_resort_huff_tables(16, &(d->HuffDSCF[0]) , 7); | 48 | |
49 | mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[0][0]) , 0); | 49 | static const HuffmanTyp mpc_table_HuffQ1 [2] [3*3*3] = { |
50 | mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[1][0]) , 0); | 50 | {{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},}, |
51 | mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[0][0]) , 0); | 51 | {{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},}, |
52 | mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[1][0]) , 0); | 52 | }; |
53 | mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[0][0]) , Dc[3]); | 53 | static const HuffmanTyp mpc_table_HuffQ2 [2] [5*5] = { |
54 | mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[1][0]) , Dc[3]); | 54 | {{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},}, |
55 | mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[0][0]) , Dc[4]); | 55 | {{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},}, |
56 | mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[1][0]) , Dc[4]); | 56 | }; |
57 | mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[0][0]) , Dc[5]); | 57 | static const HuffmanTyp mpc_table_HuffQ3 [2] [ 7] = { |
58 | mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[1][0]) , Dc[5]); | 58 | {{3758096384u,3,1},{3489660928u,4,3},{3221225472u,4,-3},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,0},{0u,2,-1},}, |
59 | mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[0][0]) , Dc[6]); | 59 | {{3221225472u,2,0},{2147483648u,2,-1},{1073741824u,2,1},{805306368u,4,-2},{671088640u,5,3},{536870912u,5,-3},{0u,3,2},}, |
60 | mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[1][0]) , Dc[6]); | 60 | }; |
61 | mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[0][0]) , Dc[7]); | 61 | static const HuffmanTyp mpc_table_HuffQ4 [2] [ 9] = { |
62 | mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[1][0]) , Dc[7]); | 62 | {{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},}, |
63 | } | 63 | {{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},}, |
64 | 64 | }; | |
65 | void | 65 | static const HuffmanTyp mpc_table_HuffQ5 [2] [15] = { |
66 | mpc_decoder_init_huffman_sv7_tables(mpc_decoder *d) | 66 | {{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},}, |
67 | { | 67 | {{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},}, |
68 | /***************************** SCFI *******************************/ | 68 | }; |
69 | d->HuffSCFI[0].Code = 2; d->HuffSCFI[0].Length = 3; | 69 | static const HuffmanTyp mpc_table_HuffQ6 [2] [31] = { |
70 | d->HuffSCFI[1].Code = 1; d->HuffSCFI[1].Length = 1; | 70 | {{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},}, |
71 | d->HuffSCFI[2].Code = 3; d->HuffSCFI[2].Length = 3; | 71 | {{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},}, |
72 | d->HuffSCFI[3].Code = 0; d->HuffSCFI[3].Length = 2; | 72 | }; |
73 | 73 | static const HuffmanTyp mpc_table_HuffQ7 [2] [63] = { | |
74 | /***************************** DSCF *******************************/ | 74 | {{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},}, |
75 | d->HuffDSCF[ 0].Code = 32; d->HuffDSCF[ 0].Length = 6; | 75 | {{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},}, |
76 | d->HuffDSCF[ 1].Code = 4; d->HuffDSCF[ 1].Length = 5; | 76 | }; |
77 | d->HuffDSCF[ 2].Code = 17; d->HuffDSCF[ 2].Length = 5; | 77 | |
78 | d->HuffDSCF[ 3].Code = 30; d->HuffDSCF[ 3].Length = 5; | 78 | const HuffmanTyp* mpc_table_HuffQ [2] [8] = { |
79 | d->HuffDSCF[ 4].Code = 13; d->HuffDSCF[ 4].Length = 4; | 79 | {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]}, |
80 | d->HuffDSCF[ 5].Code = 0; d->HuffDSCF[ 5].Length = 3; | 80 | {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]}, |
81 | d->HuffDSCF[ 6].Code = 3; d->HuffDSCF[ 6].Length = 3; | 81 | }; |
82 | d->HuffDSCF[ 7].Code = 9; d->HuffDSCF[ 7].Length = 4; | ||
83 | d->HuffDSCF[ 8].Code = 5; d->HuffDSCF[ 8].Length = 3; | ||
84 | d->HuffDSCF[ 9].Code = 2; d->HuffDSCF[ 9].Length = 3; | ||
85 | d->HuffDSCF[10].Code = 14; d->HuffDSCF[10].Length = 4; | ||
86 | d->HuffDSCF[11].Code = 3; d->HuffDSCF[11].Length = 4; | ||
87 | d->HuffDSCF[12].Code = 31; d->HuffDSCF[12].Length = 5; | ||
88 | d->HuffDSCF[13].Code = 5; d->HuffDSCF[13].Length = 5; | ||
89 | d->HuffDSCF[14].Code = 33; d->HuffDSCF[14].Length = 6; | ||
90 | d->HuffDSCF[15].Code = 12; d->HuffDSCF[15].Length = 4; | ||
91 | |||
92 | /************************* frame-header ***************************/ | ||
93 | /***************** differential quantizer indizes *****************/ | ||
94 | d->HuffHdr[0].Code = 92; d->HuffHdr[0].Length = 8; | ||
95 | d->HuffHdr[1].Code = 47; d->HuffHdr[1].Length = 7; | ||
96 | d->HuffHdr[2].Code = 10; d->HuffHdr[2].Length = 5; | ||
97 | d->HuffHdr[3].Code = 4; d->HuffHdr[3].Length = 4; | ||
98 | d->HuffHdr[4].Code = 0; d->HuffHdr[4].Length = 2; | ||
99 | d->HuffHdr[5].Code = 1; d->HuffHdr[5].Length = 1; | ||
100 | d->HuffHdr[6].Code = 3; d->HuffHdr[6].Length = 3; | ||
101 | d->HuffHdr[7].Code = 22; d->HuffHdr[7].Length = 6; | ||
102 | d->HuffHdr[8].Code = 187; d->HuffHdr[8].Length = 9; | ||
103 | d->HuffHdr[9].Code = 186; d->HuffHdr[9].Length = 9; | ||
104 | |||
105 | /********************** 3-step quantizer **************************/ | ||
106 | /********************* 3 bundled samples **************************/ | ||
107 | //less shaped, book 0 | ||
108 | d->HuffQ1[0][ 0].Code = 54; d->HuffQ1[0][ 0].Length = 6; | ||
109 | d->HuffQ1[0][ 1].Code = 9; d->HuffQ1[0][ 1].Length = 5; | ||
110 | d->HuffQ1[0][ 2].Code = 32; d->HuffQ1[0][ 2].Length = 6; | ||
111 | d->HuffQ1[0][ 3].Code = 5; d->HuffQ1[0][ 3].Length = 5; | ||
112 | d->HuffQ1[0][ 4].Code = 10; d->HuffQ1[0][ 4].Length = 4; | ||
113 | d->HuffQ1[0][ 5].Code = 7; d->HuffQ1[0][ 5].Length = 5; | ||
114 | d->HuffQ1[0][ 6].Code = 52; d->HuffQ1[0][ 6].Length = 6; | ||
115 | d->HuffQ1[0][ 7].Code = 0; d->HuffQ1[0][ 7].Length = 5; | ||
116 | d->HuffQ1[0][ 8].Code = 35; d->HuffQ1[0][ 8].Length = 6; | ||
117 | d->HuffQ1[0][ 9].Code = 10; d->HuffQ1[0][ 9].Length = 5; | ||
118 | d->HuffQ1[0][10].Code = 6; d->HuffQ1[0][10].Length = 4; | ||
119 | d->HuffQ1[0][11].Code = 4; d->HuffQ1[0][11].Length = 5; | ||
120 | d->HuffQ1[0][12].Code = 11; d->HuffQ1[0][12].Length = 4; | ||
121 | d->HuffQ1[0][13].Code = 7; d->HuffQ1[0][13].Length = 3; | ||
122 | d->HuffQ1[0][14].Code = 12; d->HuffQ1[0][14].Length = 4; | ||
123 | d->HuffQ1[0][15].Code = 3; d->HuffQ1[0][15].Length = 5; | ||
124 | d->HuffQ1[0][16].Code = 7; d->HuffQ1[0][16].Length = 4; | ||
125 | d->HuffQ1[0][17].Code = 11; d->HuffQ1[0][17].Length = 5; | ||
126 | d->HuffQ1[0][18].Code = 34; d->HuffQ1[0][18].Length = 6; | ||
127 | d->HuffQ1[0][19].Code = 1; d->HuffQ1[0][19].Length = 5; | ||
128 | d->HuffQ1[0][20].Code = 53; d->HuffQ1[0][20].Length = 6; | ||
129 | d->HuffQ1[0][21].Code = 6; d->HuffQ1[0][21].Length = 5; | ||
130 | d->HuffQ1[0][22].Code = 9; d->HuffQ1[0][22].Length = 4; | ||
131 | d->HuffQ1[0][23].Code = 2; d->HuffQ1[0][23].Length = 5; | ||
132 | d->HuffQ1[0][24].Code = 33; d->HuffQ1[0][24].Length = 6; | ||
133 | d->HuffQ1[0][25].Code = 8; d->HuffQ1[0][25].Length = 5; | ||
134 | d->HuffQ1[0][26].Code = 55; d->HuffQ1[0][26].Length = 6; | ||
135 | |||
136 | //more shaped, book 1 | ||
137 | d->HuffQ1[1][ 0].Code = 103; d->HuffQ1[1][ 0].Length = 8; | ||
138 | d->HuffQ1[1][ 1].Code = 62; d->HuffQ1[1][ 1].Length = 7; | ||
139 | d->HuffQ1[1][ 2].Code = 225; d->HuffQ1[1][ 2].Length = 9; | ||
140 | d->HuffQ1[1][ 3].Code = 55; d->HuffQ1[1][ 3].Length = 7; | ||
141 | d->HuffQ1[1][ 4].Code = 3; d->HuffQ1[1][ 4].Length = 4; | ||
142 | d->HuffQ1[1][ 5].Code = 52; d->HuffQ1[1][ 5].Length = 7; | ||
143 | d->HuffQ1[1][ 6].Code = 101; d->HuffQ1[1][ 6].Length = 8; | ||
144 | d->HuffQ1[1][ 7].Code = 60; d->HuffQ1[1][ 7].Length = 7; | ||
145 | d->HuffQ1[1][ 8].Code = 227; d->HuffQ1[1][ 8].Length = 9; | ||
146 | d->HuffQ1[1][ 9].Code = 24; d->HuffQ1[1][ 9].Length = 6; | ||
147 | d->HuffQ1[1][10].Code = 0; d->HuffQ1[1][10].Length = 4; | ||
148 | d->HuffQ1[1][11].Code = 61; d->HuffQ1[1][11].Length = 7; | ||
149 | d->HuffQ1[1][12].Code = 4; d->HuffQ1[1][12].Length = 4; | ||
150 | d->HuffQ1[1][13].Code = 1; d->HuffQ1[1][13].Length = 1; | ||
151 | d->HuffQ1[1][14].Code = 5; d->HuffQ1[1][14].Length = 4; | ||
152 | d->HuffQ1[1][15].Code = 63; d->HuffQ1[1][15].Length = 7; | ||
153 | d->HuffQ1[1][16].Code = 1; d->HuffQ1[1][16].Length = 4; | ||
154 | d->HuffQ1[1][17].Code = 59; d->HuffQ1[1][17].Length = 7; | ||
155 | d->HuffQ1[1][18].Code = 226; d->HuffQ1[1][18].Length = 9; | ||
156 | d->HuffQ1[1][19].Code = 57; d->HuffQ1[1][19].Length = 7; | ||
157 | d->HuffQ1[1][20].Code = 100; d->HuffQ1[1][20].Length = 8; | ||
158 | d->HuffQ1[1][21].Code = 53; d->HuffQ1[1][21].Length = 7; | ||
159 | d->HuffQ1[1][22].Code = 2; d->HuffQ1[1][22].Length = 4; | ||
160 | d->HuffQ1[1][23].Code = 54; d->HuffQ1[1][23].Length = 7; | ||
161 | d->HuffQ1[1][24].Code = 224; d->HuffQ1[1][24].Length = 9; | ||
162 | d->HuffQ1[1][25].Code = 58; d->HuffQ1[1][25].Length = 7; | ||
163 | d->HuffQ1[1][26].Code = 102; d->HuffQ1[1][26].Length = 8; | ||
164 | |||
165 | /********************** 5-step quantizer **************************/ | ||
166 | /********************* 2 bundled samples **************************/ | ||
167 | //less shaped, book 0 | ||
168 | d->HuffQ2[0][ 0].Code = 89; d->HuffQ2[0][ 0].Length = 7; | ||
169 | d->HuffQ2[0][ 1].Code = 47; d->HuffQ2[0][ 1].Length = 6; | ||
170 | d->HuffQ2[0][ 2].Code = 15; d->HuffQ2[0][ 2].Length = 5; | ||
171 | d->HuffQ2[0][ 3].Code = 0; d->HuffQ2[0][ 3].Length = 5; | ||
172 | d->HuffQ2[0][ 4].Code = 91; d->HuffQ2[0][ 4].Length = 7; | ||
173 | d->HuffQ2[0][ 5].Code = 4; d->HuffQ2[0][ 5].Length = 5; | ||
174 | d->HuffQ2[0][ 6].Code = 6; d->HuffQ2[0][ 6].Length = 4; | ||
175 | d->HuffQ2[0][ 7].Code = 13; d->HuffQ2[0][ 7].Length = 4; | ||
176 | d->HuffQ2[0][ 8].Code = 4; d->HuffQ2[0][ 8].Length = 4; | ||
177 | d->HuffQ2[0][ 9].Code = 5; d->HuffQ2[0][ 9].Length = 5; | ||
178 | d->HuffQ2[0][10].Code = 20; d->HuffQ2[0][10].Length = 5; | ||
179 | d->HuffQ2[0][11].Code = 12; d->HuffQ2[0][11].Length = 4; | ||
180 | d->HuffQ2[0][12].Code = 4; d->HuffQ2[0][12].Length = 3; | ||
181 | d->HuffQ2[0][13].Code = 15; d->HuffQ2[0][13].Length = 4; | ||
182 | d->HuffQ2[0][14].Code = 14; d->HuffQ2[0][14].Length = 5; | ||
183 | d->HuffQ2[0][15].Code = 3; d->HuffQ2[0][15].Length = 5; | ||
184 | d->HuffQ2[0][16].Code = 3; d->HuffQ2[0][16].Length = 4; | ||
185 | d->HuffQ2[0][17].Code = 14; d->HuffQ2[0][17].Length = 4; | ||
186 | d->HuffQ2[0][18].Code = 5; d->HuffQ2[0][18].Length = 4; | ||
187 | d->HuffQ2[0][19].Code = 1; d->HuffQ2[0][19].Length = 5; | ||
188 | d->HuffQ2[0][20].Code = 90; d->HuffQ2[0][20].Length = 7; | ||
189 | d->HuffQ2[0][21].Code = 2; d->HuffQ2[0][21].Length = 5; | ||
190 | d->HuffQ2[0][22].Code = 21; d->HuffQ2[0][22].Length = 5; | ||
191 | d->HuffQ2[0][23].Code = 46; d->HuffQ2[0][23].Length = 6; | ||
192 | d->HuffQ2[0][24].Code = 88; d->HuffQ2[0][24].Length = 7; | ||
193 | |||
194 | //more shaped, book 1 | ||
195 | d->HuffQ2[1][ 0].Code = 921; d->HuffQ2[1][ 0].Length = 10; | ||
196 | d->HuffQ2[1][ 1].Code = 113; d->HuffQ2[1][ 1].Length = 7; | ||
197 | d->HuffQ2[1][ 2].Code = 51; d->HuffQ2[1][ 2].Length = 6; | ||
198 | d->HuffQ2[1][ 3].Code = 231; d->HuffQ2[1][ 3].Length = 8; | ||
199 | d->HuffQ2[1][ 4].Code = 922; d->HuffQ2[1][ 4].Length = 10; | ||
200 | d->HuffQ2[1][ 5].Code = 104; d->HuffQ2[1][ 5].Length = 7; | ||
201 | d->HuffQ2[1][ 6].Code = 30; d->HuffQ2[1][ 6].Length = 5; | ||
202 | d->HuffQ2[1][ 7].Code = 0; d->HuffQ2[1][ 7].Length = 3; | ||
203 | d->HuffQ2[1][ 8].Code = 29; d->HuffQ2[1][ 8].Length = 5; | ||
204 | d->HuffQ2[1][ 9].Code = 105; d->HuffQ2[1][ 9].Length = 7; | ||
205 | d->HuffQ2[1][10].Code = 50; d->HuffQ2[1][10].Length = 6; | ||
206 | d->HuffQ2[1][11].Code = 1; d->HuffQ2[1][11].Length = 3; | ||
207 | d->HuffQ2[1][12].Code = 2; d->HuffQ2[1][12].Length = 2; | ||
208 | d->HuffQ2[1][13].Code = 3; d->HuffQ2[1][13].Length = 3; | ||
209 | d->HuffQ2[1][14].Code = 49; d->HuffQ2[1][14].Length = 6; | ||
210 | d->HuffQ2[1][15].Code = 107; d->HuffQ2[1][15].Length = 7; | ||
211 | d->HuffQ2[1][16].Code = 27; d->HuffQ2[1][16].Length = 5; | ||
212 | d->HuffQ2[1][17].Code = 2; d->HuffQ2[1][17].Length = 3; | ||
213 | d->HuffQ2[1][18].Code = 31; d->HuffQ2[1][18].Length = 5; | ||
214 | d->HuffQ2[1][19].Code = 112; d->HuffQ2[1][19].Length = 7; | ||
215 | d->HuffQ2[1][20].Code = 920; d->HuffQ2[1][20].Length = 10; | ||
216 | d->HuffQ2[1][21].Code = 106; d->HuffQ2[1][21].Length = 7; | ||
217 | d->HuffQ2[1][22].Code = 48; d->HuffQ2[1][22].Length = 6; | ||
218 | d->HuffQ2[1][23].Code = 114; d->HuffQ2[1][23].Length = 7; | ||
219 | d->HuffQ2[1][24].Code = 923; d->HuffQ2[1][24].Length = 10; | ||
220 | |||
221 | /********************** 7-step quantizer **************************/ | ||
222 | /*********************** single samples ***************************/ | ||
223 | //less shaped, book 0 | ||
224 | d->HuffQ3[0][0].Code = 12; d->HuffQ3[0][0].Length = 4; | ||
225 | d->HuffQ3[0][1].Code = 4; d->HuffQ3[0][1].Length = 3; | ||
226 | d->HuffQ3[0][2].Code = 0; d->HuffQ3[0][2].Length = 2; | ||
227 | d->HuffQ3[0][3].Code = 1; d->HuffQ3[0][3].Length = 2; | ||
228 | d->HuffQ3[0][4].Code = 7; d->HuffQ3[0][4].Length = 3; | ||
229 | d->HuffQ3[0][5].Code = 5; d->HuffQ3[0][5].Length = 3; | ||
230 | d->HuffQ3[0][6].Code = 13; d->HuffQ3[0][6].Length = 4; | ||
231 | |||
232 | //more shaped, book 1 | ||
233 | d->HuffQ3[1][0].Code = 4; d->HuffQ3[1][0].Length = 5; | ||
234 | d->HuffQ3[1][1].Code = 3; d->HuffQ3[1][1].Length = 4; | ||
235 | d->HuffQ3[1][2].Code = 2; d->HuffQ3[1][2].Length = 2; | ||
236 | d->HuffQ3[1][3].Code = 3; d->HuffQ3[1][3].Length = 2; | ||
237 | d->HuffQ3[1][4].Code = 1; d->HuffQ3[1][4].Length = 2; | ||
238 | d->HuffQ3[1][5].Code = 0; d->HuffQ3[1][5].Length = 3; | ||
239 | d->HuffQ3[1][6].Code = 5; d->HuffQ3[1][6].Length = 5; | ||
240 | |||
241 | /********************** 9-step quantizer **************************/ | ||
242 | /*********************** single samples ***************************/ | ||
243 | //less shaped, book 0 | ||
244 | d->HuffQ4[0][0].Code = 5; d->HuffQ4[0][0].Length = 4; | ||
245 | d->HuffQ4[0][1].Code = 0; d->HuffQ4[0][1].Length = 3; | ||
246 | d->HuffQ4[0][2].Code = 4; d->HuffQ4[0][2].Length = 3; | ||
247 | d->HuffQ4[0][3].Code = 6; d->HuffQ4[0][3].Length = 3; | ||
248 | d->HuffQ4[0][4].Code = 7; d->HuffQ4[0][4].Length = 3; | ||
249 | d->HuffQ4[0][5].Code = 5; d->HuffQ4[0][5].Length = 3; | ||
250 | d->HuffQ4[0][6].Code = 3; d->HuffQ4[0][6].Length = 3; | ||
251 | d->HuffQ4[0][7].Code = 1; d->HuffQ4[0][7].Length = 3; | ||
252 | d->HuffQ4[0][8].Code = 4; d->HuffQ4[0][8].Length = 4; | ||
253 | |||
254 | //more shaped, book 1 | ||
255 | d->HuffQ4[1][0].Code = 9; d->HuffQ4[1][0].Length = 5; | ||
256 | d->HuffQ4[1][1].Code = 12; d->HuffQ4[1][1].Length = 4; | ||
257 | d->HuffQ4[1][2].Code = 3; d->HuffQ4[1][2].Length = 3; | ||
258 | d->HuffQ4[1][3].Code = 0; d->HuffQ4[1][3].Length = 2; | ||
259 | d->HuffQ4[1][4].Code = 2; d->HuffQ4[1][4].Length = 2; | ||
260 | d->HuffQ4[1][5].Code = 7; d->HuffQ4[1][5].Length = 3; | ||
261 | d->HuffQ4[1][6].Code = 13; d->HuffQ4[1][6].Length = 4; | ||
262 | d->HuffQ4[1][7].Code = 5; d->HuffQ4[1][7].Length = 4; | ||
263 | d->HuffQ4[1][8].Code = 8; d->HuffQ4[1][8].Length = 5; | ||
264 | |||
265 | /********************* 15-step quantizer **************************/ | ||
266 | /*********************** single samples ***************************/ | ||
267 | //less shaped, book 0 | ||
268 | d->HuffQ5[0][ 0].Code = 57; d->HuffQ5[0][ 0].Length = 6; | ||
269 | d->HuffQ5[0][ 1].Code = 23; d->HuffQ5[0][ 1].Length = 5; | ||
270 | d->HuffQ5[0][ 2].Code = 8; d->HuffQ5[0][ 2].Length = 4; | ||
271 | d->HuffQ5[0][ 3].Code = 10; d->HuffQ5[0][ 3].Length = 4; | ||
272 | d->HuffQ5[0][ 4].Code = 13; d->HuffQ5[0][ 4].Length = 4; | ||
273 | d->HuffQ5[0][ 5].Code = 0; d->HuffQ5[0][ 5].Length = 3; | ||
274 | d->HuffQ5[0][ 6].Code = 2; d->HuffQ5[0][ 6].Length = 3; | ||
275 | d->HuffQ5[0][ 7].Code = 3; d->HuffQ5[0][ 7].Length = 3; | ||
276 | d->HuffQ5[0][ 8].Code = 1; d->HuffQ5[0][ 8].Length = 3; | ||
277 | d->HuffQ5[0][ 9].Code = 15; d->HuffQ5[0][ 9].Length = 4; | ||
278 | d->HuffQ5[0][10].Code = 12; d->HuffQ5[0][10].Length = 4; | ||
279 | d->HuffQ5[0][11].Code = 9; d->HuffQ5[0][11].Length = 4; | ||
280 | d->HuffQ5[0][12].Code = 29; d->HuffQ5[0][12].Length = 5; | ||
281 | d->HuffQ5[0][13].Code = 22; d->HuffQ5[0][13].Length = 5; | ||
282 | d->HuffQ5[0][14].Code = 56; d->HuffQ5[0][14].Length = 6; | ||
283 | |||
284 | //more shaped, book 1 | ||
285 | d->HuffQ5[1][ 0].Code = 229; d->HuffQ5[1][ 0].Length = 8; | ||
286 | d->HuffQ5[1][ 1].Code = 56; d->HuffQ5[1][ 1].Length = 6; | ||
287 | d->HuffQ5[1][ 2].Code = 7; d->HuffQ5[1][ 2].Length = 5; | ||
288 | d->HuffQ5[1][ 3].Code = 2; d->HuffQ5[1][ 3].Length = 4; | ||
289 | d->HuffQ5[1][ 4].Code = 0; d->HuffQ5[1][ 4].Length = 3; | ||
290 | d->HuffQ5[1][ 5].Code = 3; d->HuffQ5[1][ 5].Length = 3; | ||
291 | d->HuffQ5[1][ 6].Code = 5; d->HuffQ5[1][ 6].Length = 3; | ||
292 | d->HuffQ5[1][ 7].Code = 6; d->HuffQ5[1][ 7].Length = 3; | ||
293 | d->HuffQ5[1][ 8].Code = 4; d->HuffQ5[1][ 8].Length = 3; | ||
294 | d->HuffQ5[1][ 9].Code = 2; d->HuffQ5[1][ 9].Length = 3; | ||
295 | d->HuffQ5[1][10].Code = 15; d->HuffQ5[1][10].Length = 4; | ||
296 | d->HuffQ5[1][11].Code = 29; d->HuffQ5[1][11].Length = 5; | ||
297 | d->HuffQ5[1][12].Code = 6; d->HuffQ5[1][12].Length = 5; | ||
298 | d->HuffQ5[1][13].Code = 115; d->HuffQ5[1][13].Length = 7; | ||
299 | d->HuffQ5[1][14].Code = 228; d->HuffQ5[1][14].Length = 8; | ||
300 | |||
301 | /********************* 31-step quantizer **************************/ | ||
302 | /*********************** single samples ***************************/ | ||
303 | //less shaped, book 0 | ||
304 | d->HuffQ6[0][ 0].Code = 65; d->HuffQ6[0][ 0].Length = 7; | ||
305 | d->HuffQ6[0][ 1].Code = 6; d->HuffQ6[0][ 1].Length = 6; | ||
306 | d->HuffQ6[0][ 2].Code = 44; d->HuffQ6[0][ 2].Length = 6; | ||
307 | d->HuffQ6[0][ 3].Code = 45; d->HuffQ6[0][ 3].Length = 6; | ||
308 | d->HuffQ6[0][ 4].Code = 59; d->HuffQ6[0][ 4].Length = 6; | ||
309 | d->HuffQ6[0][ 5].Code = 13; d->HuffQ6[0][ 5].Length = 5; | ||
310 | d->HuffQ6[0][ 6].Code = 17; d->HuffQ6[0][ 6].Length = 5; | ||
311 | d->HuffQ6[0][ 7].Code = 19; d->HuffQ6[0][ 7].Length = 5; | ||
312 | d->HuffQ6[0][ 8].Code = 23; d->HuffQ6[0][ 8].Length = 5; | ||
313 | d->HuffQ6[0][ 9].Code = 21; d->HuffQ6[0][ 9].Length = 5; | ||
314 | d->HuffQ6[0][10].Code = 26; d->HuffQ6[0][10].Length = 5; | ||
315 | d->HuffQ6[0][11].Code = 30; d->HuffQ6[0][11].Length = 5; | ||
316 | d->HuffQ6[0][12].Code = 0; d->HuffQ6[0][12].Length = 4; | ||
317 | d->HuffQ6[0][13].Code = 2; d->HuffQ6[0][13].Length = 4; | ||
318 | d->HuffQ6[0][14].Code = 5; d->HuffQ6[0][14].Length = 4; | ||
319 | d->HuffQ6[0][15].Code = 7; d->HuffQ6[0][15].Length = 4; | ||
320 | d->HuffQ6[0][16].Code = 3; d->HuffQ6[0][16].Length = 4; | ||
321 | d->HuffQ6[0][17].Code = 4; d->HuffQ6[0][17].Length = 4; | ||
322 | d->HuffQ6[0][18].Code = 31; d->HuffQ6[0][18].Length = 5; | ||
323 | d->HuffQ6[0][19].Code = 28; d->HuffQ6[0][19].Length = 5; | ||
324 | d->HuffQ6[0][20].Code = 25; d->HuffQ6[0][20].Length = 5; | ||
325 | d->HuffQ6[0][21].Code = 27; d->HuffQ6[0][21].Length = 5; | ||
326 | d->HuffQ6[0][22].Code = 24; d->HuffQ6[0][22].Length = 5; | ||
327 | d->HuffQ6[0][23].Code = 20; d->HuffQ6[0][23].Length = 5; | ||
328 | d->HuffQ6[0][24].Code = 18; d->HuffQ6[0][24].Length = 5; | ||
329 | d->HuffQ6[0][25].Code = 12; d->HuffQ6[0][25].Length = 5; | ||
330 | d->HuffQ6[0][26].Code = 2; d->HuffQ6[0][26].Length = 5; | ||
331 | d->HuffQ6[0][27].Code = 58; d->HuffQ6[0][27].Length = 6; | ||
332 | d->HuffQ6[0][28].Code = 33; d->HuffQ6[0][28].Length = 6; | ||
333 | d->HuffQ6[0][29].Code = 7; d->HuffQ6[0][29].Length = 6; | ||
334 | d->HuffQ6[0][30].Code = 64; d->HuffQ6[0][30].Length = 7; | ||
335 | |||
336 | //more shaped, book 1 | ||
337 | d->HuffQ6[1][ 0].Code = 6472; d->HuffQ6[1][ 0].Length = 13; | ||
338 | d->HuffQ6[1][ 1].Code = 6474; d->HuffQ6[1][ 1].Length = 13; | ||
339 | d->HuffQ6[1][ 2].Code = 808; d->HuffQ6[1][ 2].Length = 10; | ||
340 | d->HuffQ6[1][ 3].Code = 405; d->HuffQ6[1][ 3].Length = 9; | ||
341 | d->HuffQ6[1][ 4].Code = 203; d->HuffQ6[1][ 4].Length = 8; | ||
342 | d->HuffQ6[1][ 5].Code = 102; d->HuffQ6[1][ 5].Length = 7; | ||
343 | d->HuffQ6[1][ 6].Code = 49; d->HuffQ6[1][ 6].Length = 6; | ||
344 | d->HuffQ6[1][ 7].Code = 9; d->HuffQ6[1][ 7].Length = 5; | ||
345 | d->HuffQ6[1][ 8].Code = 15; d->HuffQ6[1][ 8].Length = 5; | ||
346 | d->HuffQ6[1][ 9].Code = 31; d->HuffQ6[1][ 9].Length = 5; | ||
347 | d->HuffQ6[1][10].Code = 2; d->HuffQ6[1][10].Length = 4; | ||
348 | d->HuffQ6[1][11].Code = 6; d->HuffQ6[1][11].Length = 4; | ||
349 | d->HuffQ6[1][12].Code = 8; d->HuffQ6[1][12].Length = 4; | ||
350 | d->HuffQ6[1][13].Code = 11; d->HuffQ6[1][13].Length = 4; | ||
351 | d->HuffQ6[1][14].Code = 13; d->HuffQ6[1][14].Length = 4; | ||
352 | d->HuffQ6[1][15].Code = 0; d->HuffQ6[1][15].Length = 3; | ||
353 | d->HuffQ6[1][16].Code = 14; d->HuffQ6[1][16].Length = 4; | ||
354 | d->HuffQ6[1][17].Code = 10; d->HuffQ6[1][17].Length = 4; | ||
355 | d->HuffQ6[1][18].Code = 9; d->HuffQ6[1][18].Length = 4; | ||
356 | d->HuffQ6[1][19].Code = 5; d->HuffQ6[1][19].Length = 4; | ||
357 | d->HuffQ6[1][20].Code = 3; d->HuffQ6[1][20].Length = 4; | ||
358 | d->HuffQ6[1][21].Code = 30; d->HuffQ6[1][21].Length = 5; | ||
359 | d->HuffQ6[1][22].Code = 14; d->HuffQ6[1][22].Length = 5; | ||
360 | d->HuffQ6[1][23].Code = 8; d->HuffQ6[1][23].Length = 5; | ||
361 | d->HuffQ6[1][24].Code = 48; d->HuffQ6[1][24].Length = 6; | ||
362 | d->HuffQ6[1][25].Code = 103; d->HuffQ6[1][25].Length = 7; | ||
363 | d->HuffQ6[1][26].Code = 201; d->HuffQ6[1][26].Length = 8; | ||
364 | d->HuffQ6[1][27].Code = 200; d->HuffQ6[1][27].Length = 8; | ||
365 | d->HuffQ6[1][28].Code = 1619; d->HuffQ6[1][28].Length = 11; | ||
366 | d->HuffQ6[1][29].Code = 6473; d->HuffQ6[1][29].Length = 13; | ||
367 | d->HuffQ6[1][30].Code = 6475; d->HuffQ6[1][30].Length = 13; | ||
368 | |||
369 | /********************* 63-step quantizer **************************/ | ||
370 | /*********************** single samples ***************************/ | ||
371 | //less shaped, book 0 | ||
372 | d->HuffQ7[0][ 0].Code = 103; d->HuffQ7[0][ 0].Length = 8; /* 0.003338 - 01100111 */ | ||
373 | d->HuffQ7[0][ 1].Code = 153; d->HuffQ7[0][ 1].Length = 8; /* 0.003766 - 10011001 */ | ||
374 | d->HuffQ7[0][ 2].Code = 181; d->HuffQ7[0][ 2].Length = 8; /* 0.004715 - 10110101 */ | ||
375 | d->HuffQ7[0][ 3].Code = 233; d->HuffQ7[0][ 3].Length = 8; /* 0.005528 - 11101001 */ | ||
376 | d->HuffQ7[0][ 4].Code = 64; d->HuffQ7[0][ 4].Length = 7; /* 0.006677 - 1000000 */ | ||
377 | d->HuffQ7[0][ 5].Code = 65; d->HuffQ7[0][ 5].Length = 7; /* 0.007041 - 1000001 */ | ||
378 | d->HuffQ7[0][ 6].Code = 77; d->HuffQ7[0][ 6].Length = 7; /* 0.007733 - 1001101 */ | ||
379 | d->HuffQ7[0][ 7].Code = 81; d->HuffQ7[0][ 7].Length = 7; /* 0.008296 - 1010001 */ | ||
380 | d->HuffQ7[0][ 8].Code = 91; d->HuffQ7[0][ 8].Length = 7; /* 0.009295 - 1011011 */ | ||
381 | d->HuffQ7[0][ 9].Code = 113; d->HuffQ7[0][ 9].Length = 7; /* 0.010814 - 1110001 */ | ||
382 | d->HuffQ7[0][10].Code = 112; d->HuffQ7[0][10].Length = 7; /* 0.010807 - 1110000 */ | ||
383 | d->HuffQ7[0][11].Code = 24; d->HuffQ7[0][11].Length = 6; /* 0.012748 - 011000 */ | ||
384 | d->HuffQ7[0][12].Code = 29; d->HuffQ7[0][12].Length = 6; /* 0.013390 - 011101 */ | ||
385 | d->HuffQ7[0][13].Code = 35; d->HuffQ7[0][13].Length = 6; /* 0.014224 - 100011 */ | ||
386 | d->HuffQ7[0][14].Code = 37; d->HuffQ7[0][14].Length = 6; /* 0.015201 - 100101 */ | ||
387 | d->HuffQ7[0][15].Code = 41; d->HuffQ7[0][15].Length = 6; /* 0.016642 - 101001 */ | ||
388 | d->HuffQ7[0][16].Code = 44; d->HuffQ7[0][16].Length = 6; /* 0.017292 - 101100 */ | ||
389 | d->HuffQ7[0][17].Code = 46; d->HuffQ7[0][17].Length = 6; /* 0.018647 - 101110 */ | ||
390 | d->HuffQ7[0][18].Code = 51; d->HuffQ7[0][18].Length = 6; /* 0.020473 - 110011 */ | ||
391 | d->HuffQ7[0][19].Code = 49; d->HuffQ7[0][19].Length = 6; /* 0.020152 - 110001 */ | ||
392 | d->HuffQ7[0][20].Code = 54; d->HuffQ7[0][20].Length = 6; /* 0.021315 - 110110 */ | ||
393 | d->HuffQ7[0][21].Code = 55; d->HuffQ7[0][21].Length = 6; /* 0.021358 - 110111 */ | ||
394 | d->HuffQ7[0][22].Code = 57; d->HuffQ7[0][22].Length = 6; /* 0.021700 - 111001 */ | ||
395 | d->HuffQ7[0][23].Code = 60; d->HuffQ7[0][23].Length = 6; /* 0.022449 - 111100 */ | ||
396 | d->HuffQ7[0][24].Code = 0; d->HuffQ7[0][24].Length = 5; /* 0.023063 - 00000 */ | ||
397 | d->HuffQ7[0][25].Code = 2; d->HuffQ7[0][25].Length = 5; /* 0.023854 - 00010 */ | ||
398 | d->HuffQ7[0][26].Code = 10; d->HuffQ7[0][26].Length = 5; /* 0.025481 - 01010 */ | ||
399 | d->HuffQ7[0][27].Code = 5; d->HuffQ7[0][27].Length = 5; /* 0.024867 - 00101 */ | ||
400 | d->HuffQ7[0][28].Code = 9; d->HuffQ7[0][28].Length = 5; /* 0.025352 - 01001 */ | ||
401 | d->HuffQ7[0][29].Code = 6; d->HuffQ7[0][29].Length = 5; /* 0.025074 - 00110 */ | ||
402 | d->HuffQ7[0][30].Code = 13; d->HuffQ7[0][30].Length = 5; /* 0.025745 - 01101 */ | ||
403 | d->HuffQ7[0][31].Code = 7; d->HuffQ7[0][31].Length = 5; /* 0.025195 - 00111 */ | ||
404 | d->HuffQ7[0][32].Code = 11; d->HuffQ7[0][32].Length = 5; /* 0.025502 - 01011 */ | ||
405 | d->HuffQ7[0][33].Code = 15; d->HuffQ7[0][33].Length = 5; /* 0.026251 - 01111 */ | ||
406 | d->HuffQ7[0][34].Code = 8; d->HuffQ7[0][34].Length = 5; /* 0.025260 - 01000 */ | ||
407 | d->HuffQ7[0][35].Code = 4; d->HuffQ7[0][35].Length = 5; /* 0.024418 - 00100 */ | ||
408 | d->HuffQ7[0][36].Code = 3; d->HuffQ7[0][36].Length = 5; /* 0.023983 - 00011 */ | ||
409 | d->HuffQ7[0][37].Code = 1; d->HuffQ7[0][37].Length = 5; /* 0.023697 - 00001 */ | ||
410 | d->HuffQ7[0][38].Code = 63; d->HuffQ7[0][38].Length = 6; /* 0.023041 - 111111 */ | ||
411 | d->HuffQ7[0][39].Code = 62; d->HuffQ7[0][39].Length = 6; /* 0.022656 - 111110 */ | ||
412 | d->HuffQ7[0][40].Code = 61; d->HuffQ7[0][40].Length = 6; /* 0.022549 - 111101 */ | ||
413 | d->HuffQ7[0][41].Code = 53; d->HuffQ7[0][41].Length = 6; /* 0.021151 - 110101 */ | ||
414 | d->HuffQ7[0][42].Code = 59; d->HuffQ7[0][42].Length = 6; /* 0.022042 - 111011 */ | ||
415 | d->HuffQ7[0][43].Code = 52; d->HuffQ7[0][43].Length = 6; /* 0.020837 - 110100 */ | ||
416 | d->HuffQ7[0][44].Code = 48; d->HuffQ7[0][44].Length = 6; /* 0.019446 - 110000 */ | ||
417 | d->HuffQ7[0][45].Code = 47; d->HuffQ7[0][45].Length = 6; /* 0.019189 - 101111 */ | ||
418 | d->HuffQ7[0][46].Code = 43; d->HuffQ7[0][46].Length = 6; /* 0.017177 - 101011 */ | ||
419 | d->HuffQ7[0][47].Code = 42; d->HuffQ7[0][47].Length = 6; /* 0.017035 - 101010 */ | ||
420 | d->HuffQ7[0][48].Code = 39; d->HuffQ7[0][48].Length = 6; /* 0.015287 - 100111 */ | ||
421 | d->HuffQ7[0][49].Code = 36; d->HuffQ7[0][49].Length = 6; /* 0.014559 - 100100 */ | ||
422 | d->HuffQ7[0][50].Code = 33; d->HuffQ7[0][50].Length = 6; /* 0.014117 - 100001 */ | ||
423 | d->HuffQ7[0][51].Code = 28; d->HuffQ7[0][51].Length = 6; /* 0.012776 - 011100 */ | ||
424 | d->HuffQ7[0][52].Code = 117; d->HuffQ7[0][52].Length = 7; /* 0.011107 - 1110101 */ | ||
425 | d->HuffQ7[0][53].Code = 101; d->HuffQ7[0][53].Length = 7; /* 0.010636 - 1100101 */ | ||
426 | d->HuffQ7[0][54].Code = 100; d->HuffQ7[0][54].Length = 7; /* 0.009751 - 1100100 */ | ||
427 | d->HuffQ7[0][55].Code = 80; d->HuffQ7[0][55].Length = 7; /* 0.008132 - 1010000 */ | ||
428 | d->HuffQ7[0][56].Code = 69; d->HuffQ7[0][56].Length = 7; /* 0.007091 - 1000101 */ | ||
429 | d->HuffQ7[0][57].Code = 68; d->HuffQ7[0][57].Length = 7; /* 0.007084 - 1000100 */ | ||
430 | d->HuffQ7[0][58].Code = 50; d->HuffQ7[0][58].Length = 7; /* 0.006277 - 0110010 */ | ||
431 | d->HuffQ7[0][59].Code = 232; d->HuffQ7[0][59].Length = 8; /* 0.005386 - 11101000 */ | ||
432 | d->HuffQ7[0][60].Code = 180; d->HuffQ7[0][60].Length = 8; /* 0.004408 - 10110100 */ | ||
433 | d->HuffQ7[0][61].Code = 152; d->HuffQ7[0][61].Length = 8; /* 0.003759 - 10011000 */ | ||
434 | d->HuffQ7[0][62].Code = 102; d->HuffQ7[0][62].Length = 8; /* 0.003160 - 01100110 */ | ||
435 | |||
436 | //more shaped, book 1 | ||
437 | d->HuffQ7[1][ 0].Code = 14244; d->HuffQ7[1][ 0].Length = 14; /* 0.000059 - 11011110100100 */ | ||
438 | d->HuffQ7[1][ 1].Code = 14253; d->HuffQ7[1][ 1].Length = 14; /* 0.000098 - 11011110101101 */ | ||
439 | d->HuffQ7[1][ 2].Code = 14246; d->HuffQ7[1][ 2].Length = 14; /* 0.000078 - 11011110100110 */ | ||
440 | d->HuffQ7[1][ 3].Code = 14254; d->HuffQ7[1][ 3].Length = 14; /* 0.000111 - 11011110101110 */ | ||
441 | d->HuffQ7[1][ 4].Code = 3562; d->HuffQ7[1][ 4].Length = 12; /* 0.000320 - 110111101010 */ | ||
442 | d->HuffQ7[1][ 5].Code = 752; d->HuffQ7[1][ 5].Length = 10; /* 0.000920 - 1011110000 */ | ||
443 | d->HuffQ7[1][ 6].Code = 753; d->HuffQ7[1][ 6].Length = 10; /* 0.001057 - 1011110001 */ | ||
444 | d->HuffQ7[1][ 7].Code = 160; d->HuffQ7[1][ 7].Length = 9; /* 0.001403 - 010100000 */ | ||
445 | d->HuffQ7[1][ 8].Code = 162; d->HuffQ7[1][ 8].Length = 9; /* 0.001579 - 010100010 */ | ||
446 | d->HuffQ7[1][ 9].Code = 444; d->HuffQ7[1][ 9].Length = 9; /* 0.002486 - 110111100 */ | ||
447 | d->HuffQ7[1][10].Code = 122; d->HuffQ7[1][10].Length = 8; /* 0.003772 - 01111010 */ | ||
448 | d->HuffQ7[1][11].Code = 223; d->HuffQ7[1][11].Length = 8; /* 0.005710 - 11011111 */ | ||
449 | d->HuffQ7[1][12].Code = 60; d->HuffQ7[1][12].Length = 7; /* 0.006858 - 0111100 */ | ||
450 | d->HuffQ7[1][13].Code = 73; d->HuffQ7[1][13].Length = 7; /* 0.008033 - 1001001 */ | ||
451 | d->HuffQ7[1][14].Code = 110; d->HuffQ7[1][14].Length = 7; /* 0.009827 - 1101110 */ | ||
452 | d->HuffQ7[1][15].Code = 14; d->HuffQ7[1][15].Length = 6; /* 0.012601 - 001110 */ | ||
453 | d->HuffQ7[1][16].Code = 24; d->HuffQ7[1][16].Length = 6; /* 0.013194 - 011000 */ | ||
454 | d->HuffQ7[1][17].Code = 25; d->HuffQ7[1][17].Length = 6; /* 0.013938 - 011001 */ | ||
455 | d->HuffQ7[1][18].Code = 34; d->HuffQ7[1][18].Length = 6; /* 0.015693 - 100010 */ | ||
456 | d->HuffQ7[1][19].Code = 37; d->HuffQ7[1][19].Length = 6; /* 0.017846 - 100101 */ | ||
457 | d->HuffQ7[1][20].Code = 54; d->HuffQ7[1][20].Length = 6; /* 0.020078 - 110110 */ | ||
458 | d->HuffQ7[1][21].Code = 3; d->HuffQ7[1][21].Length = 5; /* 0.022975 - 00011 */ | ||
459 | d->HuffQ7[1][22].Code = 9; d->HuffQ7[1][22].Length = 5; /* 0.025631 - 01001 */ | ||
460 | d->HuffQ7[1][23].Code = 11; d->HuffQ7[1][23].Length = 5; /* 0.027021 - 01011 */ | ||
461 | d->HuffQ7[1][24].Code = 16; d->HuffQ7[1][24].Length = 5; /* 0.031465 - 10000 */ | ||
462 | d->HuffQ7[1][25].Code = 19; d->HuffQ7[1][25].Length = 5; /* 0.034244 - 10011 */ | ||
463 | d->HuffQ7[1][26].Code = 21; d->HuffQ7[1][26].Length = 5; /* 0.035921 - 10101 */ | ||
464 | d->HuffQ7[1][27].Code = 24; d->HuffQ7[1][27].Length = 5; /* 0.037938 - 11000 */ | ||
465 | d->HuffQ7[1][28].Code = 26; d->HuffQ7[1][28].Length = 5; /* 0.039595 - 11010 */ | ||
466 | d->HuffQ7[1][29].Code = 29; d->HuffQ7[1][29].Length = 5; /* 0.041546 - 11101 */ | ||
467 | d->HuffQ7[1][30].Code = 31; d->HuffQ7[1][30].Length = 5; /* 0.042623 - 11111 */ | ||
468 | d->HuffQ7[1][31].Code = 2; d->HuffQ7[1][31].Length = 4; /* 0.045180 - 0010 */ | ||
469 | d->HuffQ7[1][32].Code = 0; d->HuffQ7[1][32].Length = 4; /* 0.043151 - 0000 */ | ||
470 | d->HuffQ7[1][33].Code = 30; d->HuffQ7[1][33].Length = 5; /* 0.042538 - 11110 */ | ||
471 | d->HuffQ7[1][34].Code = 28; d->HuffQ7[1][34].Length = 5; /* 0.041422 - 11100 */ | ||
472 | d->HuffQ7[1][35].Code = 25; d->HuffQ7[1][35].Length = 5; /* 0.039145 - 11001 */ | ||
473 | d->HuffQ7[1][36].Code = 22; d->HuffQ7[1][36].Length = 5; /* 0.036691 - 10110 */ | ||
474 | d->HuffQ7[1][37].Code = 20; d->HuffQ7[1][37].Length = 5; /* 0.034955 - 10100 */ | ||
475 | d->HuffQ7[1][38].Code = 14; d->HuffQ7[1][38].Length = 5; /* 0.029155 - 01110 */ | ||
476 | d->HuffQ7[1][39].Code = 13; d->HuffQ7[1][39].Length = 5; /* 0.027921 - 01101 */ | ||
477 | d->HuffQ7[1][40].Code = 8; d->HuffQ7[1][40].Length = 5; /* 0.025553 - 01000 */ | ||
478 | d->HuffQ7[1][41].Code = 6; d->HuffQ7[1][41].Length = 5; /* 0.023093 - 00110 */ | ||
479 | d->HuffQ7[1][42].Code = 2; d->HuffQ7[1][42].Length = 5; /* 0.021200 - 00010 */ | ||
480 | d->HuffQ7[1][43].Code = 46; d->HuffQ7[1][43].Length = 6; /* 0.018134 - 101110 */ | ||
481 | d->HuffQ7[1][44].Code = 35; d->HuffQ7[1][44].Length = 6; /* 0.015824 - 100011 */ | ||
482 | d->HuffQ7[1][45].Code = 31; d->HuffQ7[1][45].Length = 6; /* 0.014701 - 011111 */ | ||
483 | d->HuffQ7[1][46].Code = 21; d->HuffQ7[1][46].Length = 6; /* 0.013187 - 010101 */ | ||
484 | d->HuffQ7[1][47].Code = 15; d->HuffQ7[1][47].Length = 6; /* 0.012776 - 001111 */ | ||
485 | d->HuffQ7[1][48].Code = 95; d->HuffQ7[1][48].Length = 7; /* 0.009664 - 1011111 */ | ||
486 | d->HuffQ7[1][49].Code = 72; d->HuffQ7[1][49].Length = 7; /* 0.007922 - 1001000 */ | ||
487 | d->HuffQ7[1][50].Code = 41; d->HuffQ7[1][50].Length = 7; /* 0.006838 - 0101001 */ | ||
488 | d->HuffQ7[1][51].Code = 189; d->HuffQ7[1][51].Length = 8; /* 0.005024 - 10111101 */ | ||
489 | d->HuffQ7[1][52].Code = 123; d->HuffQ7[1][52].Length = 8; /* 0.003830 - 01111011 */ | ||
490 | d->HuffQ7[1][53].Code = 377; d->HuffQ7[1][53].Length = 9; /* 0.002232 - 101111001 */ | ||
491 | d->HuffQ7[1][54].Code = 161; d->HuffQ7[1][54].Length = 9; /* 0.001566 - 010100001 */ | ||
492 | d->HuffQ7[1][55].Code = 891; d->HuffQ7[1][55].Length = 10; /* 0.001383 - 1101111011 */ | ||
493 | d->HuffQ7[1][56].Code = 327; d->HuffQ7[1][56].Length = 10; /* 0.000900 - 0101000111 */ | ||
494 | d->HuffQ7[1][57].Code = 326; d->HuffQ7[1][57].Length = 10; /* 0.000790 - 0101000110 */ | ||
495 | d->HuffQ7[1][58].Code = 3560; d->HuffQ7[1][58].Length = 12; /* 0.000254 - 110111101000 */ | ||
496 | d->HuffQ7[1][59].Code = 14255; d->HuffQ7[1][59].Length = 14; /* 0.000117 - 11011110101111 */ | ||
497 | d->HuffQ7[1][60].Code = 14247; d->HuffQ7[1][60].Length = 14; /* 0.000085 - 11011110100111 */ | ||
498 | d->HuffQ7[1][61].Code = 14252; d->HuffQ7[1][61].Length = 14; /* 0.000085 - 11011110101100 */ | ||
499 | d->HuffQ7[1][62].Code = 14245; d->HuffQ7[1][62].Length = 14; /* 0.000065 - 11011110100101 */ | ||
500 | } | ||
diff --git a/apps/codecs/libmusepack/idtag.c b/apps/codecs/libmusepack/idtag.c index 8f1c9d58fc..8af5ce4d3b 100644 --- a/apps/codecs/libmusepack/idtag.c +++ b/apps/codecs/libmusepack/idtag.c | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include "musepack.h" | 39 | #include "musepack.h" |
40 | #include "internal.h" | 40 | #include "internal.h" |
41 | #include "string.h" | ||
42 | 41 | ||
43 | mpc_int32_t | 42 | mpc_int32_t |
44 | JumpID3v2 (mpc_reader* r) { | 43 | JumpID3v2 (mpc_reader* r) { |
diff --git a/apps/codecs/libmusepack/internal.h b/apps/codecs/libmusepack/internal.h index 27656d5a54..19642a240e 100644 --- a/apps/codecs/libmusepack/internal.h +++ b/apps/codecs/libmusepack/internal.h | |||
@@ -32,16 +32,24 @@ | |||
32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /// \file musepack_internal.h | 35 | /// \file internal.h |
36 | /// Definitions and structures used only internally by the libmusepack. | 36 | /// Definitions and structures used only internally by the libmpcdec. |
37 | |||
38 | #ifndef _mpcdec_internal_h | ||
39 | #define _mpcdec_internal_h | ||
37 | 40 | ||
38 | #ifndef _musepack_internal_h | ||
39 | #define _musepack_internal_h | ||
40 | 41 | ||
41 | enum { | 42 | enum { |
42 | MPC_DECODER_SYNTH_DELAY = 481 | 43 | MPC_DECODER_SYNTH_DELAY = 481 |
43 | }; | 44 | }; |
44 | 45 | ||
46 | /// Big/little endian 32 bit byte swapping routine. | ||
47 | static __inline | ||
48 | mpc_uint32_t mpc_swap32(mpc_uint32_t val) { | ||
49 | return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | | ||
50 | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); | ||
51 | } | ||
52 | |||
45 | /// Searches for a ID3v2-tag and reads the length (in bytes) of it. | 53 | /// Searches for a ID3v2-tag and reads the length (in bytes) of it. |
46 | /// \param reader supplying raw stream data | 54 | /// \param reader supplying raw stream data |
47 | /// \return size of tag, in bytes | 55 | /// \return size of tag, in bytes |
@@ -49,9 +57,9 @@ enum { | |||
49 | mpc_int32_t JumpID3v2(mpc_reader* fp); | 57 | mpc_int32_t JumpID3v2(mpc_reader* fp); |
50 | 58 | ||
51 | /// helper functions used by multiple files | 59 | /// helper functions used by multiple files |
52 | mpc_uint32_t random_int(mpc_decoder *d); // in synth_filter.c | 60 | mpc_uint32_t mpc_random_int(mpc_decoder *d); // in synth_filter.c |
53 | void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor); | 61 | void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor); |
54 | void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData); | 62 | void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData); |
55 | 63 | ||
56 | #endif // _musepack_internal_h | 64 | #endif // _mpcdec_internal_h |
57 | 65 | ||
diff --git a/apps/codecs/libmusepack/math.h b/apps/codecs/libmusepack/math.h index 247e9d03cd..eb9b0e978a 100644 --- a/apps/codecs/libmusepack/math.h +++ b/apps/codecs/libmusepack/math.h | |||
@@ -32,11 +32,11 @@ | |||
32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /// \file mpc_math.h | 35 | /// \file math.h |
36 | /// Libmusepack internal math routines. | 36 | /// Libmpcdec internal math routines. |
37 | 37 | ||
38 | #ifndef _musepack_math_h_ | 38 | #ifndef _mpcdec_math_h_ |
39 | #define _musepack_math_h_ | 39 | #define _mpcdec_math_h_ |
40 | 40 | ||
41 | #define MPC_FIXED_POINT | 41 | #define MPC_FIXED_POINT |
42 | 42 | ||
@@ -215,5 +215,5 @@ typedef float MPC_SAMPLE_FORMAT; | |||
215 | 215 | ||
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | #endif // _musepack_math_h_ | 218 | #endif // _mpcdec_math_h_ |
219 | 219 | ||
diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index 024e7ab2c2..b608ae81e1 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c | |||
@@ -35,12 +35,29 @@ | |||
35 | /// \file mpc_decoder.c | 35 | /// \file mpc_decoder.c |
36 | /// Core decoding routines and logic. | 36 | /// Core decoding routines and logic. |
37 | 37 | ||
38 | #include <string.h> | ||
39 | #include "musepack.h" | 38 | #include "musepack.h" |
40 | #include "internal.h" | 39 | #include "internal.h" |
41 | #include "requant.h" | 40 | #include "requant.h" |
42 | #include "huffman.h" | 41 | #include "huffman.h" |
43 | 42 | ||
43 | //SV7 tables | ||
44 | extern const HuffmanTyp* mpc_table_HuffQ [2] [8]; | ||
45 | extern const HuffmanTyp mpc_table_HuffHdr [10]; | ||
46 | extern const HuffmanTyp mpc_table_HuffSCFI [ 4]; | ||
47 | extern const HuffmanTyp mpc_table_HuffDSCF [16]; | ||
48 | |||
49 | |||
50 | #ifdef MPC_SUPPORT_SV456 | ||
51 | //SV4/5/6 tables | ||
52 | extern const HuffmanTyp* mpc_table_SampleHuff [18]; | ||
53 | extern const HuffmanTyp mpc_table_SCFI_Bundle [ 8]; | ||
54 | extern const HuffmanTyp mpc_table_DSCF_Entropie [13]; | ||
55 | extern const HuffmanTyp mpc_table_Region_A [16]; | ||
56 | extern const HuffmanTyp mpc_table_Region_B [ 8]; | ||
57 | extern const HuffmanTyp mpc_table_Region_C [ 4]; | ||
58 | |||
59 | #endif | ||
60 | |||
44 | //------------------------------------------------------------------------------ | 61 | //------------------------------------------------------------------------------ |
45 | // types | 62 | // types |
46 | //------------------------------------------------------------------------------ | 63 | //------------------------------------------------------------------------------ |
@@ -57,12 +74,10 @@ enum | |||
57 | //------------------------------------------------------------------------------ | 74 | //------------------------------------------------------------------------------ |
58 | // forward declarations | 75 | // forward declarations |
59 | //------------------------------------------------------------------------------ | 76 | //------------------------------------------------------------------------------ |
60 | void mpc_decoder_init_huffman_sv6(mpc_decoder *d); | ||
61 | void mpc_decoder_init_huffman_sv7(mpc_decoder *d); | ||
62 | void mpc_decoder_read_bitstream_sv6(mpc_decoder *d); | 77 | void mpc_decoder_read_bitstream_sv6(mpc_decoder *d); |
63 | void mpc_decoder_read_bitstream_sv7(mpc_decoder *d); | 78 | void mpc_decoder_read_bitstream_sv7(mpc_decoder *d); |
64 | void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING); | 79 | void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING); |
65 | bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); | 80 | mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); |
66 | void mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band); | 81 | void mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band); |
67 | 82 | ||
68 | //------------------------------------------------------------------------------ | 83 | //------------------------------------------------------------------------------ |
@@ -73,7 +88,7 @@ static mpc_int32_t f_read(mpc_decoder *d, void *ptr, size_t size) | |||
73 | return d->r->read(d->r->data, ptr, size); | 88 | return d->r->read(d->r->data, ptr, size); |
74 | }; | 89 | }; |
75 | 90 | ||
76 | static bool f_seek(mpc_decoder *d, mpc_int32_t offset) | 91 | static mpc_bool_t f_seek(mpc_decoder *d, mpc_int32_t offset) |
77 | { | 92 | { |
78 | return d->r->seek(d->r->data, offset); | 93 | return d->r->seek(d->r->data, offset); |
79 | }; | 94 | }; |
@@ -84,7 +99,7 @@ static mpc_int32_t f_read_dword(mpc_decoder *d, mpc_uint32_t * ptr, mpc_uint32_t | |||
84 | #ifndef MPC_LITTLE_ENDIAN | 99 | #ifndef MPC_LITTLE_ENDIAN |
85 | mpc_uint32_t n; | 100 | mpc_uint32_t n; |
86 | for(n = 0; n< count; n++) { | 101 | for(n = 0; n< count; n++) { |
87 | ptr[n] = swap32(ptr[n]); | 102 | ptr[n] = mpc_swap32(ptr[n]); |
88 | } | 103 | } |
89 | #endif | 104 | #endif |
90 | return count; | 105 | return count; |
@@ -152,7 +167,7 @@ mpc_decoder_bitstream_read(mpc_decoder *d, const mpc_uint32_t bits) | |||
152 | static void | 167 | static void |
153 | mpc_decoder_scfi_bundle_read( | 168 | mpc_decoder_scfi_bundle_read( |
154 | mpc_decoder *d, | 169 | mpc_decoder *d, |
155 | HuffmanTyp* Table, mpc_int32_t* SCFI, mpc_int32_t* DSCF) | 170 | const HuffmanTyp* Table, mpc_int32_t* SCFI, mpc_bool_t* DSCF) |
156 | { | 171 | { |
157 | // load preview and decode | 172 | // load preview and decode |
158 | mpc_uint32_t code = d->dword << d->pos; | 173 | mpc_uint32_t code = d->dword << d->pos; |
@@ -174,29 +189,6 @@ mpc_decoder_scfi_bundle_read( | |||
174 | *DSCF = Table->Value & 1; | 189 | *DSCF = Table->Value & 1; |
175 | } | 190 | } |
176 | 191 | ||
177 | static int | ||
178 | mpc_decoder_huffman_typ_cmpfn(const void* p1, const void* p2) | ||
179 | { | ||
180 | if (((HuffmanTyp*) p1)->Code < ((HuffmanTyp*) p2)->Code ) return +1; | ||
181 | if (((HuffmanTyp*) p1)->Code > ((HuffmanTyp*) p2)->Code ) return -1; | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | // sort huffman-tables by codeword | ||
186 | // offset resulting value | ||
187 | void | ||
188 | mpc_decoder_resort_huff_tables( | ||
189 | const mpc_uint32_t elements, HuffmanTyp* Table, const mpc_int32_t offset ) | ||
190 | { | ||
191 | mpc_uint32_t i; | ||
192 | |||
193 | for ( i = 0; i < elements; i++ ) { | ||
194 | Table[i].Code <<= 32 - Table[i].Length; | ||
195 | Table[i].Value = i - offset; | ||
196 | } | ||
197 | qsort(Table, elements, sizeof(*Table), mpc_decoder_huffman_typ_cmpfn); | ||
198 | } | ||
199 | |||
200 | // basic huffman decoding routine | 192 | // basic huffman decoding routine |
201 | // works with maximum lengths up to 14 | 193 | // works with maximum lengths up to 14 |
202 | static mpc_int32_t | 194 | static mpc_int32_t |
@@ -318,6 +310,39 @@ mpc_decoder_reset_globals(mpc_decoder *d) | |||
318 | memset(d->MS_Flag , 0, sizeof d->MS_Flag ); | 310 | memset(d->MS_Flag , 0, sizeof d->MS_Flag ); |
319 | } | 311 | } |
320 | 312 | ||
313 | mpc_uint32_t | ||
314 | mpc_decoder_decode_frame(mpc_decoder *d, mpc_uint32_t *in_buffer, | ||
315 | mpc_uint32_t in_len, MPC_SAMPLE_FORMAT *out_buffer) | ||
316 | { | ||
317 | unsigned int i; | ||
318 | mpc_decoder_reset_bitstream_decode(d); | ||
319 | if (in_len > sizeof(d->Speicher)) in_len = sizeof(d->Speicher); | ||
320 | memcpy(d->Speicher, in_buffer, in_len); | ||
321 | #ifdef MPC_LITTLE_ENDIAN | ||
322 | for (i = 0; i < (in_len + 3) / 4; i++) | ||
323 | d->Speicher[i] = mpc_swap32(d->Speicher[i]); | ||
324 | #endif | ||
325 | d->dword = d->Speicher[0]; | ||
326 | switch (d->StreamVersion) { | ||
327 | #ifdef MPC_SUPPORT_SV456 | ||
328 | case 0x04: | ||
329 | case 0x05: | ||
330 | case 0x06: | ||
331 | mpc_decoder_read_bitstream_sv6(d); | ||
332 | break; | ||
333 | #endif | ||
334 | case 0x07: | ||
335 | case 0x17: | ||
336 | mpc_decoder_read_bitstream_sv7(d); | ||
337 | break; | ||
338 | default: | ||
339 | return (mpc_uint32_t)(-1); | ||
340 | } | ||
341 | mpc_decoder_requantisierung(d, d->Max_Band); | ||
342 | mpc_decoder_synthese_filter_float(d, out_buffer); | ||
343 | return mpc_decoder_bits_read(d); | ||
344 | } | ||
345 | |||
321 | static mpc_uint32_t | 346 | static mpc_uint32_t |
322 | mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) | 347 | mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) |
323 | { | 348 | { |
@@ -337,11 +362,13 @@ mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) | |||
337 | // decode data and check for validity of frame | 362 | // decode data and check for validity of frame |
338 | FrameBitCnt = mpc_decoder_bits_read(d); | 363 | FrameBitCnt = mpc_decoder_bits_read(d); |
339 | switch (d->StreamVersion) { | 364 | switch (d->StreamVersion) { |
365 | #ifdef MPC_SUPPORT_SV456 | ||
340 | case 0x04: | 366 | case 0x04: |
341 | case 0x05: | 367 | case 0x05: |
342 | case 0x06: | 368 | case 0x06: |
343 | mpc_decoder_read_bitstream_sv6(d); | 369 | mpc_decoder_read_bitstream_sv6(d); |
344 | break; | 370 | break; |
371 | #endif | ||
345 | case 0x07: | 372 | case 0x07: |
346 | case 0x17: | 373 | case 0x17: |
347 | mpc_decoder_read_bitstream_sv7(d); | 374 | mpc_decoder_read_bitstream_sv7(d); |
@@ -375,26 +402,12 @@ mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) | |||
375 | 402 | ||
376 | // additional FilterDecay samples are needed for decay of synthesis filter | 403 | // additional FilterDecay samples are needed for decay of synthesis filter |
377 | if (MPC_DECODER_SYNTH_DELAY + mod_block >= MPC_FRAME_LENGTH) { | 404 | if (MPC_DECODER_SYNTH_DELAY + mod_block >= MPC_FRAME_LENGTH) { |
378 | |||
379 | // ********************************************************************** | ||
380 | // Rhoades 4/16/2002 | ||
381 | // Commented out are blocks of code which cause gapless playback to fail. | ||
382 | // Temporary fix... | ||
383 | // ********************************************************************** | ||
384 | |||
385 | if (!d->TrueGaplessPresent) { | 405 | if (!d->TrueGaplessPresent) { |
386 | mpc_decoder_reset_y(d); | 406 | mpc_decoder_reset_y(d); |
387 | } | 407 | } else { |
388 | else { | ||
389 | //if ( MPC_FRAME_LENGTH != d->LastValidSamples ) { | ||
390 | mpc_decoder_bitstream_read(d, 20); | 408 | mpc_decoder_bitstream_read(d, 20); |
391 | mpc_decoder_read_bitstream_sv7(d); | 409 | mpc_decoder_read_bitstream_sv7(d); |
392 | mpc_decoder_requantisierung(d, d->Max_Band); | 410 | mpc_decoder_requantisierung(d, d->Max_Band); |
393 | //FilterDecay = d->LastValidSamples; | ||
394 | //} | ||
395 | //else { | ||
396 | //FilterDecay = 0; | ||
397 | //} | ||
398 | } | 411 | } |
399 | 412 | ||
400 | mpc_decoder_synthese_filter_float(d, buffer + 2304); | 413 | mpc_decoder_synthese_filter_float(d, buffer + 2304); |
@@ -625,13 +638,49 @@ mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band) | |||
625 | } | 638 | } |
626 | } | 639 | } |
627 | 640 | ||
641 | #ifdef MPC_SUPPORT_SV456 | ||
642 | static const unsigned char Q_res[32][16] = { | ||
643 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
644 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
645 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
646 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
647 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
648 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
649 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
650 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
651 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
652 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
653 | {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17}, | ||
654 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
655 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
656 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
657 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
658 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
659 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
660 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
661 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
662 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
663 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
664 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
665 | {0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0}, | ||
666 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
667 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
668 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
669 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
670 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
671 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
672 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
673 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
674 | {0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0}, | ||
675 | }; | ||
676 | |||
628 | /****************************************** SV 6 ******************************************/ | 677 | /****************************************** SV 6 ******************************************/ |
629 | void | 678 | void |
630 | mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | 679 | mpc_decoder_read_bitstream_sv6(mpc_decoder *d) |
631 | { | 680 | { |
632 | mpc_int32_t n,k; | 681 | mpc_int32_t n,k; |
633 | mpc_int32_t Max_used_Band=0; | 682 | mpc_int32_t Max_used_Band=0; |
634 | HuffmanTyp *Table; | 683 | const HuffmanTyp *Table; |
635 | const HuffmanTyp *x1; | 684 | const HuffmanTyp *x1; |
636 | const HuffmanTyp *x2; | 685 | const HuffmanTyp *x2; |
637 | mpc_int32_t *L; | 686 | mpc_int32_t *L; |
@@ -644,15 +693,15 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
644 | ResR = d->Res_R; | 693 | ResR = d->Res_R; |
645 | for (n=0; n <= d->Max_Band; ++n, ++ResL, ++ResR) | 694 | for (n=0; n <= d->Max_Band; ++n, ++ResL, ++ResR) |
646 | { | 695 | { |
647 | if (n<11) Table = d->Region_A; | 696 | if (n<11) Table = mpc_table_Region_A; |
648 | else if (n>=11 && n<=22) Table = d->Region_B; | 697 | else if (n>=11 && n<=22) Table = mpc_table_Region_B; |
649 | else /*if (n>=23)*/ Table = d->Region_C; | 698 | else /*if (n>=23)*/ Table = mpc_table_Region_C; |
650 | 699 | ||
651 | *ResL = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)]; | 700 | *ResL = Q_res[n][mpc_decoder_huffman_decode(d, Table)]; |
652 | if (d->MS_used) { | 701 | if (d->MS_used) { |
653 | d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); | 702 | d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); |
654 | } | 703 | } |
655 | *ResR = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)]; | 704 | *ResR = Q_res[n][mpc_decoder_huffman_decode(d, Table)]; |
656 | 705 | ||
657 | // only perform the following procedure up to the maximum non-zero subband | 706 | // only perform the following procedure up to the maximum non-zero subband |
658 | if (*ResL || *ResR) Max_used_Band = n; | 707 | if (*ResL || *ResR) Max_used_Band = n; |
@@ -662,8 +711,8 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
662 | ResL = d->Res_L; | 711 | ResL = d->Res_L; |
663 | ResR = d->Res_R; | 712 | ResR = d->Res_R; |
664 | for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) { | 713 | for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) { |
665 | if (*ResL) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_L[n]), &(d->DSCF_Flag_L[n])); | 714 | if (*ResL) mpc_decoder_scfi_bundle_read(d, mpc_table_SCFI_Bundle, &(d->SCFI_L[n]), &(d->DSCF_Flag_L[n])); |
666 | if (*ResR) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_R[n]), &(d->DSCF_Flag_R[n])); | 715 | if (*ResR) mpc_decoder_scfi_bundle_read(d, mpc_table_SCFI_Bundle, &(d->SCFI_R[n]), &(d->DSCF_Flag_R[n])); |
667 | } | 716 | } |
668 | 717 | ||
669 | /***************************** SCFI ********************************/ | 718 | /***************************** SCFI ********************************/ |
@@ -682,24 +731,24 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
682 | switch (d->SCFI_L[n]) | 731 | switch (d->SCFI_L[n]) |
683 | { | 732 | { |
684 | case 3: | 733 | case 3: |
685 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 734 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
686 | L[1] = L[0]; | 735 | L[1] = L[0]; |
687 | L[2] = L[1]; | 736 | L[2] = L[1]; |
688 | break; | 737 | break; |
689 | case 1: | 738 | case 1: |
690 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 739 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
691 | L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 740 | L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
692 | L[2] = L[1]; | 741 | L[2] = L[1]; |
693 | break; | 742 | break; |
694 | case 2: | 743 | case 2: |
695 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 744 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
696 | L[1] = L[0]; | 745 | L[1] = L[0]; |
697 | L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 746 | L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
698 | break; | 747 | break; |
699 | case 0: | 748 | case 0: |
700 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 749 | L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
701 | L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 750 | L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
702 | L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 751 | L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
703 | break; | 752 | break; |
704 | default: | 753 | default: |
705 | return; | 754 | return; |
@@ -748,24 +797,24 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
748 | switch (d->SCFI_R[n]) | 797 | switch (d->SCFI_R[n]) |
749 | { | 798 | { |
750 | case 3: | 799 | case 3: |
751 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 800 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
752 | R[1] = R[0]; | 801 | R[1] = R[0]; |
753 | R[2] = R[1]; | 802 | R[2] = R[1]; |
754 | break; | 803 | break; |
755 | case 1: | 804 | case 1: |
756 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 805 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
757 | R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 806 | R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
758 | R[2] = R[1]; | 807 | R[2] = R[1]; |
759 | break; | 808 | break; |
760 | case 2: | 809 | case 2: |
761 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 810 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
762 | R[1] = R[0]; | 811 | R[1] = R[0]; |
763 | R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 812 | R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
764 | break; | 813 | break; |
765 | case 0: | 814 | case 0: |
766 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 815 | R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
767 | R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 816 | R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
768 | R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); | 817 | R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, mpc_table_DSCF_Entropie); |
769 | break; | 818 | break; |
770 | default: | 819 | default: |
771 | return; | 820 | return; |
@@ -813,8 +862,8 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
813 | for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR) | 862 | for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR) |
814 | { | 863 | { |
815 | // setting pointers | 864 | // setting pointers |
816 | x1 = d->SampleHuff[*ResL]; | 865 | x1 = mpc_table_SampleHuff[*ResL]; |
817 | x2 = d->SampleHuff[*ResR]; | 866 | x2 = mpc_table_SampleHuff[*ResR]; |
818 | L = d->Q[n].L; | 867 | L = d->Q[n].L; |
819 | R = d->Q[n].R; | 868 | R = d->Q[n].R; |
820 | 869 | ||
@@ -833,7 +882,7 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d) | |||
833 | } | 882 | } |
834 | } | 883 | } |
835 | } | 884 | } |
836 | 885 | #endif //MPC_SUPPORT_SV456 | |
837 | /****************************************** SV 7 ******************************************/ | 886 | /****************************************** SV 7 ******************************************/ |
838 | void | 887 | void |
839 | mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | 888 | mpc_decoder_read_bitstream_sv7(mpc_decoder *d) |
@@ -868,11 +917,11 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
868 | ++ResL; ++ResR; // increase pointers | 917 | ++ResL; ++ResR; // increase pointers |
869 | for (n=1; n <= d->Max_Band; ++n, ++ResL, ++ResR) | 918 | for (n=1; n <= d->Max_Band; ++n, ++ResL, ++ResR) |
870 | { | 919 | { |
871 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr); | 920 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffHdr); |
872 | *ResL = (idx!=4) ? *(ResL-1) + idx : (int)mpc_decoder_bitstream_read(d, 4); | 921 | *ResL = (idx!=4) ? *(ResL-1) + idx : (int) mpc_decoder_bitstream_read(d, 4); |
873 | 922 | ||
874 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr); | 923 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffHdr); |
875 | *ResR = (idx!=4) ? *(ResR-1) + idx : (int)mpc_decoder_bitstream_read(d, 4); | 924 | *ResR = (idx!=4) ? *(ResR-1) + idx : (int) mpc_decoder_bitstream_read(d, 4); |
876 | 925 | ||
877 | if (d->MS_used && !(*ResL==0 && *ResR==0)) { | 926 | if (d->MS_used && !(*ResL==0 && *ResR==0)) { |
878 | d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); | 927 | d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); |
@@ -889,8 +938,8 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
889 | ResL = d->Res_L; | 938 | ResL = d->Res_L; |
890 | ResR = d->Res_R; | 939 | ResR = d->Res_R; |
891 | for (n=0; n <= Max_used_Band; ++n, ++L, ++R, ++ResL, ++ResR) { | 940 | for (n=0; n <= Max_used_Band; ++n, ++L, ++R, ++ResL, ++ResR) { |
892 | if (*ResL) *L = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI); | 941 | if (*ResL) *L = mpc_decoder_huffman_decode_faster(d, mpc_table_HuffSCFI); |
893 | if (*ResR) *R = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI); | 942 | if (*ResR) *R = mpc_decoder_huffman_decode_faster(d, mpc_table_HuffSCFI); |
894 | } | 943 | } |
895 | 944 | ||
896 | /**************************** SCF/DSCF ****************************/ | 945 | /**************************** SCF/DSCF ****************************/ |
@@ -905,32 +954,32 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
905 | switch (d->SCFI_L[n]) | 954 | switch (d->SCFI_L[n]) |
906 | { | 955 | { |
907 | case 1: | 956 | case 1: |
908 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 957 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
909 | L[0] = (idx!=8) ? L[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 958 | L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
910 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 959 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
911 | L[1] = (idx!=8) ? L[0] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 960 | L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
912 | L[2] = L[1]; | 961 | L[2] = L[1]; |
913 | break; | 962 | break; |
914 | case 3: | 963 | case 3: |
915 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 964 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
916 | L[0] = (idx!=8) ? L[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 965 | L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
917 | L[1] = L[0]; | 966 | L[1] = L[0]; |
918 | L[2] = L[1]; | 967 | L[2] = L[1]; |
919 | break; | 968 | break; |
920 | case 2: | 969 | case 2: |
921 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 970 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
922 | L[0] = (idx!=8) ? L[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 971 | L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
923 | L[1] = L[0]; | 972 | L[1] = L[0]; |
924 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 973 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
925 | L[2] = (idx!=8) ? L[1] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 974 | L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
926 | break; | 975 | break; |
927 | case 0: | 976 | case 0: |
928 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 977 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
929 | L[0] = (idx!=8) ? L[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 978 | L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
930 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 979 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
931 | L[1] = (idx!=8) ? L[0] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 980 | L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
932 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 981 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
933 | L[2] = (idx!=8) ? L[1] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 982 | L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
934 | break; | 983 | break; |
935 | default: | 984 | default: |
936 | return; | 985 | return; |
@@ -945,32 +994,32 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
945 | switch (d->SCFI_R[n]) | 994 | switch (d->SCFI_R[n]) |
946 | { | 995 | { |
947 | case 1: | 996 | case 1: |
948 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 997 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
949 | R[0] = (idx!=8) ? R[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 998 | R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
950 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 999 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
951 | R[1] = (idx!=8) ? R[0] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1000 | R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
952 | R[2] = R[1]; | 1001 | R[2] = R[1]; |
953 | break; | 1002 | break; |
954 | case 3: | 1003 | case 3: |
955 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1004 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
956 | R[0] = (idx!=8) ? R[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1005 | R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
957 | R[1] = R[0]; | 1006 | R[1] = R[0]; |
958 | R[2] = R[1]; | 1007 | R[2] = R[1]; |
959 | break; | 1008 | break; |
960 | case 2: | 1009 | case 2: |
961 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1010 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
962 | R[0] = (idx!=8) ? R[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1011 | R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
963 | R[1] = R[0]; | 1012 | R[1] = R[0]; |
964 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1013 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
965 | R[2] = (idx!=8) ? R[1] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1014 | R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
966 | break; | 1015 | break; |
967 | case 0: | 1016 | case 0: |
968 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1017 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
969 | R[0] = (idx!=8) ? R[2] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1018 | R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
970 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1019 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
971 | R[1] = (idx!=8) ? R[0] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1020 | R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
972 | idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); | 1021 | idx = mpc_decoder_huffman_decode_fast(d, mpc_table_HuffDSCF); |
973 | R[2] = (idx!=8) ? R[1] + idx : (int)mpc_decoder_bitstream_read(d, 6); | 1022 | R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6); |
974 | break; | 1023 | break; |
975 | default: | 1024 | default: |
976 | return; | 1025 | return; |
@@ -996,7 +1045,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
996 | break; | 1045 | break; |
997 | case -1: | 1046 | case -1: |
998 | for (k=0; k<36; k++ ) { | 1047 | for (k=0; k<36; k++ ) { |
999 | tmp = random_int(d); | 1048 | tmp = mpc_random_int(d); |
1000 | *L++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; | 1049 | *L++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; |
1001 | } | 1050 | } |
1002 | break; | 1051 | break; |
@@ -1004,7 +1053,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1004 | L += 36;// increase pointer | 1053 | L += 36;// increase pointer |
1005 | break; | 1054 | break; |
1006 | case 1: | 1055 | case 1: |
1007 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; | 1056 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; |
1008 | for (k=0; k<12; ++k) | 1057 | for (k=0; k<12; ++k) |
1009 | { | 1058 | { |
1010 | idx = mpc_decoder_huffman_decode_fast(d, Table); | 1059 | idx = mpc_decoder_huffman_decode_fast(d, Table); |
@@ -1014,7 +1063,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1014 | } | 1063 | } |
1015 | break; | 1064 | break; |
1016 | case 2: | 1065 | case 2: |
1017 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; | 1066 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; |
1018 | for (k=0; k<18; ++k) | 1067 | for (k=0; k<18; ++k) |
1019 | { | 1068 | { |
1020 | idx = mpc_decoder_huffman_decode_fast(d, Table); | 1069 | idx = mpc_decoder_huffman_decode_fast(d, Table); |
@@ -1024,18 +1073,18 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1024 | break; | 1073 | break; |
1025 | case 3: | 1074 | case 3: |
1026 | case 4: | 1075 | case 4: |
1027 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; | 1076 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; |
1028 | for (k=0; k<36; ++k) | 1077 | for (k=0; k<36; ++k) |
1029 | *L++ = mpc_decoder_huffman_decode_faster(d, Table); | 1078 | *L++ = mpc_decoder_huffman_decode_faster(d, Table); |
1030 | break; | 1079 | break; |
1031 | case 5: | 1080 | case 5: |
1032 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; | 1081 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; |
1033 | for (k=0; k<36; ++k) | 1082 | for (k=0; k<36; ++k) |
1034 | *L++ = mpc_decoder_huffman_decode_fast(d, Table); | 1083 | *L++ = mpc_decoder_huffman_decode_fast(d, Table); |
1035 | break; | 1084 | break; |
1036 | case 6: | 1085 | case 6: |
1037 | case 7: | 1086 | case 7: |
1038 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; | 1087 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; |
1039 | for (k=0; k<36; ++k) | 1088 | for (k=0; k<36; ++k) |
1040 | *L++ = mpc_decoder_huffman_decode(d, Table); | 1089 | *L++ = mpc_decoder_huffman_decode(d, Table); |
1041 | break; | 1090 | break; |
@@ -1056,7 +1105,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1056 | break; | 1105 | break; |
1057 | case -1: | 1106 | case -1: |
1058 | for (k=0; k<36; k++ ) { | 1107 | for (k=0; k<36; k++ ) { |
1059 | tmp = random_int(d); | 1108 | tmp = mpc_random_int(d); |
1060 | *R++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; | 1109 | *R++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; |
1061 | } | 1110 | } |
1062 | break; | 1111 | break; |
@@ -1064,7 +1113,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1064 | R += 36;// increase pointer | 1113 | R += 36;// increase pointer |
1065 | break; | 1114 | break; |
1066 | case 1: | 1115 | case 1: |
1067 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; | 1116 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; |
1068 | for (k=0; k<12; ++k) | 1117 | for (k=0; k<12; ++k) |
1069 | { | 1118 | { |
1070 | idx = mpc_decoder_huffman_decode_fast(d, Table); | 1119 | idx = mpc_decoder_huffman_decode_fast(d, Table); |
@@ -1074,7 +1123,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1074 | } | 1123 | } |
1075 | break; | 1124 | break; |
1076 | case 2: | 1125 | case 2: |
1077 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; | 1126 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; |
1078 | for (k=0; k<18; ++k) | 1127 | for (k=0; k<18; ++k) |
1079 | { | 1128 | { |
1080 | idx = mpc_decoder_huffman_decode_fast(d, Table); | 1129 | idx = mpc_decoder_huffman_decode_fast(d, Table); |
@@ -1084,18 +1133,18 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d) | |||
1084 | break; | 1133 | break; |
1085 | case 3: | 1134 | case 3: |
1086 | case 4: | 1135 | case 4: |
1087 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; | 1136 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; |
1088 | for (k=0; k<36; ++k) | 1137 | for (k=0; k<36; ++k) |
1089 | *R++ = mpc_decoder_huffman_decode_faster(d, Table); | 1138 | *R++ = mpc_decoder_huffman_decode_faster(d, Table); |
1090 | break; | 1139 | break; |
1091 | case 5: | 1140 | case 5: |
1092 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; | 1141 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; |
1093 | for (k=0; k<36; ++k) | 1142 | for (k=0; k<36; ++k) |
1094 | *R++ = mpc_decoder_huffman_decode_fast(d, Table); | 1143 | *R++ = mpc_decoder_huffman_decode_fast(d, Table); |
1095 | break; | 1144 | break; |
1096 | case 6: | 1145 | case 6: |
1097 | case 7: | 1146 | case 7: |
1098 | Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; | 1147 | Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; |
1099 | for (k=0; k<36; ++k) | 1148 | for (k=0; k<36; ++k) |
1100 | *R++ = mpc_decoder_huffman_decode(d, Table); | 1149 | *R++ = mpc_decoder_huffman_decode(d, Table); |
1101 | break; | 1150 | break; |
@@ -1114,43 +1163,6 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) | |||
1114 | { | 1163 | { |
1115 | d->r = r; | 1164 | d->r = r; |
1116 | 1165 | ||
1117 | d->HuffQ[0][0] = 0; | ||
1118 | d->HuffQ[1][0] = 0; | ||
1119 | d->HuffQ[0][1] = d->HuffQ1[0]; | ||
1120 | d->HuffQ[1][1] = d->HuffQ1[1]; | ||
1121 | d->HuffQ[0][2] = d->HuffQ2[0]; | ||
1122 | d->HuffQ[1][2] = d->HuffQ2[1]; | ||
1123 | d->HuffQ[0][3] = d->HuffQ3[0]; | ||
1124 | d->HuffQ[1][3] = d->HuffQ3[1]; | ||
1125 | d->HuffQ[0][4] = d->HuffQ4[0]; | ||
1126 | d->HuffQ[1][4] = d->HuffQ4[1]; | ||
1127 | d->HuffQ[0][5] = d->HuffQ5[0]; | ||
1128 | d->HuffQ[1][5] = d->HuffQ5[1]; | ||
1129 | d->HuffQ[0][6] = d->HuffQ6[0]; | ||
1130 | d->HuffQ[1][6] = d->HuffQ6[1]; | ||
1131 | d->HuffQ[0][7] = d->HuffQ7[0]; | ||
1132 | d->HuffQ[1][7] = d->HuffQ7[1]; | ||
1133 | |||
1134 | d->SampleHuff[0] = NULL; | ||
1135 | d->SampleHuff[1] = d->Entropie_1; | ||
1136 | d->SampleHuff[2] = d->Entropie_2; | ||
1137 | d->SampleHuff[3] = d->Entropie_3; | ||
1138 | d->SampleHuff[4] = d->Entropie_4; | ||
1139 | d->SampleHuff[5] = d->Entropie_5; | ||
1140 | d->SampleHuff[6] = d->Entropie_6; | ||
1141 | d->SampleHuff[7] = d->Entropie_7; | ||
1142 | d->SampleHuff[8] = NULL; | ||
1143 | d->SampleHuff[9] = NULL; | ||
1144 | d->SampleHuff[10] = NULL; | ||
1145 | d->SampleHuff[11] = NULL; | ||
1146 | d->SampleHuff[12] = NULL; | ||
1147 | d->SampleHuff[13] = NULL; | ||
1148 | d->SampleHuff[14] = NULL; | ||
1149 | d->SampleHuff[15] = NULL; | ||
1150 | d->SampleHuff[16] = NULL; | ||
1151 | d->SampleHuff[17] = NULL; | ||
1152 | |||
1153 | d->EQ_activated = 0; | ||
1154 | d->MPCHeaderPos = 0; | 1166 | d->MPCHeaderPos = 0; |
1155 | d->StreamVersion = 0; | 1167 | d->StreamVersion = 0; |
1156 | d->MS_used = 0; | 1168 | d->MS_used = 0; |
@@ -1159,12 +1171,10 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) | |||
1159 | d->FrameWasValid = 0; | 1171 | d->FrameWasValid = 0; |
1160 | d->OverallFrames = 0; | 1172 | d->OverallFrames = 0; |
1161 | d->DecodedFrames = 0; | 1173 | d->DecodedFrames = 0; |
1162 | d->LastValidSamples = 0; | ||
1163 | d->TrueGaplessPresent = 0; | 1174 | d->TrueGaplessPresent = 0; |
1164 | d->WordsRead = 0; | 1175 | d->WordsRead = 0; |
1165 | d->Max_Band = 0; | 1176 | d->Max_Band = 0; |
1166 | d->SampleRate = 0; | 1177 | d->SampleRate = 0; |
1167 | // clips = 0; | ||
1168 | d->__r1 = 1; | 1178 | d->__r1 = 1; |
1169 | d->__r2 = 1; | 1179 | d->__r2 = 1; |
1170 | 1180 | ||
@@ -1175,8 +1185,6 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) | |||
1175 | d->Max_Band = 0; | 1185 | d->Max_Band = 0; |
1176 | 1186 | ||
1177 | mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f); | 1187 | mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f); |
1178 | mpc_decoder_init_huffman_sv6(d); | ||
1179 | mpc_decoder_init_huffman_sv7(d); | ||
1180 | 1188 | ||
1181 | /* Link struct entries to actual tables which are placed in IRAM */ | 1189 | /* Link struct entries to actual tables which are placed in IRAM */ |
1182 | d->V_L = V_L; | 1190 | d->V_L = V_L; |
@@ -1186,7 +1194,7 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) | |||
1186 | #endif | 1194 | #endif |
1187 | } | 1195 | } |
1188 | 1196 | ||
1189 | static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) | 1197 | void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) |
1190 | { | 1198 | { |
1191 | mpc_decoder_reset_synthesis(d); | 1199 | mpc_decoder_reset_synthesis(d); |
1192 | mpc_decoder_reset_globals(d); | 1200 | mpc_decoder_reset_globals(d); |
@@ -1196,14 +1204,13 @@ static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) | |||
1196 | d->Max_Band = si->max_band; | 1204 | d->Max_Band = si->max_band; |
1197 | d->OverallFrames = si->frames; | 1205 | d->OverallFrames = si->frames; |
1198 | d->MPCHeaderPos = si->header_position; | 1206 | d->MPCHeaderPos = si->header_position; |
1199 | d->LastValidSamples = si->last_frame_samples; | ||
1200 | d->TrueGaplessPresent = si->is_true_gapless; | 1207 | d->TrueGaplessPresent = si->is_true_gapless; |
1201 | d->SampleRate = (mpc_int32_t)si->sample_freq; | 1208 | d->SampleRate = (mpc_int32_t)si->sample_freq; |
1202 | 1209 | ||
1203 | d->samples_to_skip = MPC_DECODER_SYNTH_DELAY; | 1210 | d->samples_to_skip = MPC_DECODER_SYNTH_DELAY; |
1204 | } | 1211 | } |
1205 | 1212 | ||
1206 | bool mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) | 1213 | mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) |
1207 | { | 1214 | { |
1208 | mpc_decoder_set_streaminfo(d, si); | 1215 | mpc_decoder_set_streaminfo(d, si); |
1209 | 1216 | ||
@@ -1214,14 +1221,14 @@ bool mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) | |||
1214 | case 0x06: f_seek(d, 8 + d->MPCHeaderPos); d->pos = 0; break; | 1221 | case 0x06: f_seek(d, 8 + d->MPCHeaderPos); d->pos = 0; break; |
1215 | case 0x07: | 1222 | case 0x07: |
1216 | case 0x17: /*f_seek ( 24 + d->MPCHeaderPos );*/ d->pos = 8; break; | 1223 | case 0x17: /*f_seek ( 24 + d->MPCHeaderPos );*/ d->pos = 8; break; |
1217 | default: return false; | 1224 | default: return FALSE; |
1218 | } | 1225 | } |
1219 | 1226 | ||
1220 | // AB: fill buffer and initialize decoder | 1227 | // AB: fill buffer and initialize decoder |
1221 | f_read_dword(d, d->Speicher, MEMSIZE ); | 1228 | f_read_dword(d, d->Speicher, MEMSIZE ); |
1222 | d->dword = d->Speicher[d->Zaehler = 0]; | 1229 | d->dword = d->Speicher[d->Zaehler = 0]; |
1223 | 1230 | ||
1224 | return true; | 1231 | return TRUE; |
1225 | } | 1232 | } |
1226 | 1233 | ||
1227 | //--------------------------------------------------------------- | 1234 | //--------------------------------------------------------------- |
@@ -1266,7 +1273,7 @@ helper3(mpc_decoder *d, mpc_uint32_t bitpos, mpc_uint32_t* buffoffs) | |||
1266 | static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion) | 1273 | static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion) |
1267 | { | 1274 | { |
1268 | mpc_uint32_t fpos = 0; | 1275 | mpc_uint32_t fpos = 0; |
1269 | (void)StreamVersion; | 1276 | (void) StreamVersion; |
1270 | switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream | 1277 | switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream |
1271 | case 0x04: fpos = 48; break; | 1278 | case 0x04: fpos = 48; break; |
1272 | case 0x05: | 1279 | case 0x05: |
@@ -1277,12 +1284,12 @@ static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion) | |||
1277 | return fpos; | 1284 | return fpos; |
1278 | } | 1285 | } |
1279 | 1286 | ||
1280 | bool mpc_decoder_seek_seconds(mpc_decoder *d, double seconds) | 1287 | mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds) |
1281 | { | 1288 | { |
1282 | return mpc_decoder_seek_sample(d, (mpc_int64_t)(seconds * (double)d->SampleRate + 0.5)); | 1289 | return mpc_decoder_seek_sample(d, (mpc_int64_t)(seconds * (double)d->SampleRate + 0.5)); |
1283 | } | 1290 | } |
1284 | 1291 | ||
1285 | bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) | 1292 | mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) |
1286 | { | 1293 | { |
1287 | mpc_uint32_t fpos; | 1294 | mpc_uint32_t fpos; |
1288 | mpc_uint32_t fwd; | 1295 | mpc_uint32_t fwd; |
@@ -1316,7 +1323,7 @@ bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) | |||
1316 | 1323 | ||
1317 | fpos = get_initial_fpos(d, d->StreamVersion); | 1324 | fpos = get_initial_fpos(d, d->StreamVersion); |
1318 | if (fpos == 0) { | 1325 | if (fpos == 0) { |
1319 | return false; | 1326 | return FALSE; |
1320 | } | 1327 | } |
1321 | 1328 | ||
1322 | helper2(d, fpos); | 1329 | helper2(d, fpos); |
@@ -1333,11 +1340,15 @@ bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) | |||
1333 | mpc_decoder_read_bitstream_sv7(d); | 1340 | mpc_decoder_read_bitstream_sv7(d); |
1334 | } | 1341 | } |
1335 | else { | 1342 | else { |
1343 | #ifdef MPC_SUPPORT_SV456 | ||
1336 | mpc_decoder_read_bitstream_sv6(d); | 1344 | mpc_decoder_read_bitstream_sv6(d); |
1345 | #else | ||
1346 | return FALSE; | ||
1347 | #endif | ||
1337 | } | 1348 | } |
1338 | if (mpc_decoder_bits_read(d) - FrameBitCnt != d->FwdJumpInfo ) { | 1349 | if (mpc_decoder_bits_read(d) - FrameBitCnt != d->FwdJumpInfo ) { |
1339 | // Box ("Bug in perform_jump"); | 1350 | // Box ("Bug in perform_jump"); |
1340 | return false; | 1351 | return FALSE; |
1341 | } | 1352 | } |
1342 | // update buffer | 1353 | // update buffer |
1343 | if ((RING ^ d->Zaehler) & MEMSIZE2) { | 1354 | if ((RING ^ d->Zaehler) & MEMSIZE2) { |
@@ -1348,7 +1359,7 @@ bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) | |||
1348 | // LastBitsRead = BitsRead (); | 1359 | // LastBitsRead = BitsRead (); |
1349 | // LastFrame = d->DecodedFrames; | 1360 | // LastFrame = d->DecodedFrames; |
1350 | 1361 | ||
1351 | return true; | 1362 | return TRUE; |
1352 | } | 1363 | } |
1353 | 1364 | ||
1354 | void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING) | 1365 | void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING) |
diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h index cd9a983603..d631c6d05d 100644 --- a/apps/codecs/libmusepack/musepack.h +++ b/apps/codecs/libmusepack/musepack.h | |||
@@ -32,19 +32,18 @@ | |||
32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /// \file musepack.h | 35 | /// \file mpcdec.h |
36 | /// Top level include file for libmusepack. | 36 | /// Top level include file for libmpcdec. |
37 | 37 | ||
38 | #ifndef _musepack_h_ | 38 | #ifndef _mpcdec_h_ |
39 | #define _musepack_h_ | 39 | #define _mpcdec_h_ |
40 | 40 | ||
41 | #ifdef __cplusplus | 41 | #ifdef __cplusplus |
42 | extern "C" { | 42 | extern "C" { |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #include <stdbool.h> | 45 | //#include <stdlib.h> |
46 | #include <stdlib.h> | 46 | #include <string.h> |
47 | //#include <string.h> | ||
48 | 47 | ||
49 | #include "../codec.h" | 48 | #include "../codec.h" |
50 | #include "config_types.h" | 49 | #include "config_types.h" |
@@ -98,7 +97,9 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r); | |||
98 | /// Call this next after calling mpc_decoder_setup. | 97 | /// Call this next after calling mpc_decoder_setup. |
99 | /// \param si streaminfo structure indicating format of source stream | 98 | /// \param si streaminfo structure indicating format of source stream |
100 | /// \return TRUE if decoder was initalized successfully, FALSE otherwise | 99 | /// \return TRUE if decoder was initalized successfully, FALSE otherwise |
101 | bool mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si); | 100 | mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si); |
101 | |||
102 | void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si); | ||
102 | 103 | ||
103 | /// Sets decoder sample scaling factor. All decoded samples will be multiplied | 104 | /// Sets decoder sample scaling factor. All decoded samples will be multiplied |
104 | /// by this factor. | 105 | /// by this factor. |
@@ -119,14 +120,20 @@ mpc_uint32_t mpc_decoder_decode( | |||
119 | mpc_uint32_t *vbr_update_acc, | 120 | mpc_uint32_t *vbr_update_acc, |
120 | mpc_uint32_t *vbr_update_bits); | 121 | mpc_uint32_t *vbr_update_bits); |
121 | 122 | ||
123 | mpc_uint32_t mpc_decoder_decode_frame( | ||
124 | mpc_decoder *d, | ||
125 | mpc_uint32_t *in_buffer, | ||
126 | mpc_uint32_t in_len, | ||
127 | MPC_SAMPLE_FORMAT *out_buffer); | ||
128 | |||
122 | /// Seeks to the specified sample in the source stream. | 129 | /// Seeks to the specified sample in the source stream. |
123 | bool mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); | 130 | mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); |
124 | 131 | ||
125 | /// Seeks to specified position in seconds in the source stream. | 132 | /// Seeks to specified position in seconds in the source stream. |
126 | bool mpc_decoder_seek_seconds(mpc_decoder *d, double seconds); | 133 | mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds); |
127 | 134 | ||
128 | #ifdef __cplusplus | 135 | #ifdef __cplusplus |
129 | } | 136 | } |
130 | #endif // __cplusplus | 137 | #endif // __cplusplus |
131 | 138 | ||
132 | #endif // _musepack_h_ | 139 | #endif // _mpcdec_h_ |
diff --git a/apps/codecs/libmusepack/reader.h b/apps/codecs/libmusepack/reader.h index 3189e91971..83ef589e8f 100644 --- a/apps/codecs/libmusepack/reader.h +++ b/apps/codecs/libmusepack/reader.h | |||
@@ -34,8 +34,8 @@ | |||
34 | 34 | ||
35 | /// \file reader.h | 35 | /// \file reader.h |
36 | 36 | ||
37 | #ifndef _musepack_reader_h_ | 37 | #ifndef _mpcdec_reader_h_ |
38 | #define _musepack_reader_h_ | 38 | #define _mpcdec_reader_h_ |
39 | 39 | ||
40 | /// \brief Stream reader interface structure. | 40 | /// \brief Stream reader interface structure. |
41 | /// | 41 | /// |
@@ -47,7 +47,7 @@ typedef struct mpc_reader_t { | |||
47 | mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size); | 47 | mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size); |
48 | 48 | ||
49 | /// Seeks to byte position offset. | 49 | /// Seeks to byte position offset. |
50 | bool (*seek)(void *t, mpc_int32_t offset); | 50 | mpc_bool_t (*seek)(void *t, mpc_int32_t offset); |
51 | 51 | ||
52 | /// Returns the current byte offset in the stream. | 52 | /// Returns the current byte offset in the stream. |
53 | mpc_int32_t (*tell)(void *t); | 53 | mpc_int32_t (*tell)(void *t); |
@@ -56,18 +56,27 @@ typedef struct mpc_reader_t { | |||
56 | mpc_int32_t (*get_size)(void *t); | 56 | mpc_int32_t (*get_size)(void *t); |
57 | 57 | ||
58 | /// True if the stream is a seekable stream. | 58 | /// True if the stream is a seekable stream. |
59 | bool (*canseek)(void *t); | 59 | mpc_bool_t (*canseek)(void *t); |
60 | 60 | ||
61 | /// Optional field that can be used to identify a particular instance of | 61 | /// Field that can be used to identify a particular instance of |
62 | /// reader or carry along data associated with that reader. | 62 | /// reader or carry along data associated with that reader. |
63 | void *data; | 63 | void *data; |
64 | |||
64 | } mpc_reader; | 65 | } mpc_reader; |
66 | /* No standard STDIO based reader in Rockbox | ||
67 | typedef struct mpc_reader_file_t { | ||
68 | mpc_reader reader; | ||
65 | 69 | ||
70 | FILE *file; | ||
71 | long file_size; | ||
72 | mpc_bool_t is_seekable; | ||
73 | } mpc_reader_file; | ||
74 | */ | ||
66 | /// Initializes reader with default stdio file reader implementation. Use | 75 | /// Initializes reader with default stdio file reader implementation. Use |
67 | /// this if you're just reading from a plain file. | 76 | /// this if you're just reading from a plain file. |
68 | /// | 77 | /// |
69 | /// \param r reader struct to initalize | 78 | /// \param r reader struct to initalize |
70 | /// \param input input stream to attach to the reader | 79 | /// \param input input stream to attach to the reader |
71 | // void mpc_reader_setup_file_reader(mpc_reader *r, FILE *input); | 80 | /* void mpc_reader_setup_file_reader(mpc_reader_file *r, FILE *input); */ |
72 | 81 | ||
73 | #endif // _musepack_reader_h_ | 82 | #endif // _mpcdec_reader_h_ |
diff --git a/apps/codecs/libmusepack/requant.c b/apps/codecs/libmusepack/requant.c index df1175a105..a72a165786 100644 --- a/apps/codecs/libmusepack/requant.c +++ b/apps/codecs/libmusepack/requant.c | |||
@@ -72,9 +72,9 @@ const mpc_int32_t __Dc [1 + 18] = { | |||
72 | #ifdef MPC_FIXED_POINT | 72 | #ifdef MPC_FIXED_POINT |
73 | static mpc_uint32_t find_shift(double fval) | 73 | static mpc_uint32_t find_shift(double fval) |
74 | { | 74 | { |
75 | mpc_int64_t val = (mpc_int64_t)fval; | 75 | mpc_int64_t val = (mpc_int64_t)fval; |
76 | if (val<0) val = -val; | ||
77 | mpc_uint32_t ptr = 0; | 76 | mpc_uint32_t ptr = 0; |
77 | if (val<0) val = -val; | ||
78 | while(val) {val>>=1;ptr++;} | 78 | while(val) {val>>=1;ptr++;} |
79 | 79 | ||
80 | return ptr > 31 ? 0 : 31 - ptr; | 80 | return ptr > 31 ? 0 : 31 - ptr; |
@@ -113,40 +113,8 @@ mpc_decoder_scale_output(mpc_decoder *d, double factor) | |||
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | static void | ||
117 | mpc_decoder_quantisierungsmodes(mpc_decoder *d) // conversion: index -> quantizer (bitstream reading) | ||
118 | { // conversion: quantizer -> index (bitstream writing) | ||
119 | mpc_int32_t Band = 0; | ||
120 | mpc_int32_t i; | ||
121 | |||
122 | do { | ||
123 | d->Q_bit [Band] = 4; | ||
124 | for ( i = 0; i < 16-1; i++ ) | ||
125 | d->Q_res [Band] [i] = i; | ||
126 | d->Q_res [Band][i] = 17; | ||
127 | Band++; | ||
128 | } while ( Band < 11 ); | ||
129 | |||
130 | do { | ||
131 | d->Q_bit [Band] = 3; | ||
132 | for ( i = 0; i < 8-1; i++ ) | ||
133 | d->Q_res [Band] [i] = i; | ||
134 | d->Q_res [Band] [i] = 17; | ||
135 | Band++; | ||
136 | } while ( Band < 23 ); | ||
137 | |||
138 | do { | ||
139 | d->Q_bit [Band] = 2; | ||
140 | for ( i = 0; i < 4-1; i++ ) | ||
141 | d->Q_res [Band] [i] = i; | ||
142 | d->Q_res [Band] [i] = 17; | ||
143 | Band++; | ||
144 | } while ( Band < 32 ); | ||
145 | } | ||
146 | |||
147 | void | 116 | void |
148 | mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor) | 117 | mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor) |
149 | { | 118 | { |
150 | mpc_decoder_quantisierungsmodes(d); | ||
151 | mpc_decoder_scale_output(d, scale_factor); | 119 | mpc_decoder_scale_output(d, scale_factor); |
152 | } | 120 | } |
diff --git a/apps/codecs/libmusepack/requant.h b/apps/codecs/libmusepack/requant.h index 71b2a3e800..e70dce7085 100644 --- a/apps/codecs/libmusepack/requant.h +++ b/apps/codecs/libmusepack/requant.h | |||
@@ -35,8 +35,8 @@ | |||
35 | /// \file requant.h | 35 | /// \file requant.h |
36 | /// Requantization function definitions. | 36 | /// Requantization function definitions. |
37 | 37 | ||
38 | #ifndef _musepack_requant_h | 38 | #ifndef _mpcdec_requant_h |
39 | #define _musepack_requant_h_ | 39 | #define _mpcdec_requant_h_ |
40 | 40 | ||
41 | #include "musepack.h" | 41 | #include "musepack.h" |
42 | 42 | ||
@@ -48,4 +48,4 @@ extern const mpc_int32_t __Dc [1 + 18]; // offset for requantiza | |||
48 | #define Cc (__Cc + 1) | 48 | #define Cc (__Cc + 1) |
49 | #define Dc (__Dc + 1) | 49 | #define Dc (__Dc + 1) |
50 | 50 | ||
51 | #endif // _musepack_requant_h_ | 51 | #endif // _mpcdec_requant_h_ |
diff --git a/apps/codecs/libmusepack/streaminfo.c b/apps/codecs/libmusepack/streaminfo.c index 8ec2234b4f..5475c6f0f6 100644 --- a/apps/codecs/libmusepack/streaminfo.c +++ b/apps/codecs/libmusepack/streaminfo.c | |||
@@ -35,7 +35,6 @@ | |||
35 | /// \file streaminfo.c | 35 | /// \file streaminfo.c |
36 | /// Implementation of streaminfo reading functions. | 36 | /// Implementation of streaminfo reading functions. |
37 | 37 | ||
38 | #include <string.h> | ||
39 | #include "musepack.h" | 38 | #include "musepack.h" |
40 | #include "internal.h" | 39 | #include "internal.h" |
41 | 40 | ||
@@ -59,16 +58,6 @@ mpc_streaminfo_init(mpc_streaminfo * si) | |||
59 | memset(si, 0, sizeof(mpc_streaminfo)); | 58 | memset(si, 0, sizeof(mpc_streaminfo)); |
60 | } | 59 | } |
61 | 60 | ||
62 | // read information from SV8 header | ||
63 | // not yet implemented | ||
64 | static mpc_int32_t | ||
65 | streaminfo_read_header_sv8(mpc_streaminfo * si, mpc_reader * fp) | ||
66 | { | ||
67 | (void)si; | ||
68 | (void)fp; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | /// Reads streaminfo from SV7 header. | 61 | /// Reads streaminfo from SV7 header. |
73 | static mpc_int32_t | 62 | static mpc_int32_t |
74 | streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) | 63 | streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) |
@@ -143,6 +132,7 @@ streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) | |||
143 | } | 132 | } |
144 | 133 | ||
145 | // read information from SV4-SV6 header | 134 | // read information from SV4-SV6 header |
135 | #ifdef MPC_SUPPORT_SV456 | ||
146 | static mpc_int32_t | 136 | static mpc_int32_t |
147 | streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) | 137 | streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) |
148 | { | 138 | { |
@@ -199,7 +189,7 @@ streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) | |||
199 | 189 | ||
200 | return ERROR_CODE_OK; | 190 | return ERROR_CODE_OK; |
201 | } | 191 | } |
202 | 192 | #endif | |
203 | // reads file header and tags | 193 | // reads file header and tags |
204 | mpc_int32_t | 194 | mpc_int32_t |
205 | mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) | 195 | mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) |
@@ -228,23 +218,27 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) | |||
228 | #ifndef MPC_LITTLE_ENDIAN | 218 | #ifndef MPC_LITTLE_ENDIAN |
229 | mpc_uint32_t ptr; | 219 | mpc_uint32_t ptr; |
230 | for (ptr = 0; ptr < 8; ptr++) { | 220 | for (ptr = 0; ptr < 8; ptr++) { |
231 | HeaderData[ptr] = swap32(HeaderData[ptr]); | 221 | HeaderData[ptr] = mpc_swap32(HeaderData[ptr]); |
232 | } | 222 | } |
233 | #endif | 223 | #endif |
234 | si->stream_version = HeaderData[0] >> 24; | 224 | si->stream_version = HeaderData[0] >> 24; |
235 | 225 | ||
236 | // stream version 8 | 226 | // stream version 8 |
237 | if ((si->stream_version & 15) >= 8) { | 227 | if ((si->stream_version & 15) >= 8) { |
238 | Error = streaminfo_read_header_sv8(si, r); | 228 | return ERROR_CODE_INVALIDSV; |
239 | } | 229 | } |
240 | // stream version 7 | 230 | // stream version 7 |
241 | else if ((si->stream_version & 15) == 7) { | 231 | else if ((si->stream_version & 15) == 7) { |
242 | Error = streaminfo_read_header_sv7(si, HeaderData); | 232 | Error = streaminfo_read_header_sv7(si, HeaderData); |
233 | if (Error != ERROR_CODE_OK) return Error; | ||
243 | } | 234 | } |
244 | } | 235 | } else { |
245 | else { | 236 | #ifdef MPC_SUPPORT_SV456 |
246 | // stream version 4-6 | 237 | // stream version 4-6 |
247 | Error = streaminfo_read_header_sv6(si, HeaderData); | 238 | Error = streaminfo_read_header_sv6(si, HeaderData); |
239 | #else | ||
240 | return ERROR_CODE_INVALIDSV; | ||
241 | #endif | ||
248 | } | 242 | } |
249 | 243 | ||
250 | // estimation, exact value needs too much time | 244 | // estimation, exact value needs too much time |
@@ -259,7 +253,7 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) | |||
259 | si->average_bitrate = 0; | 253 | si->average_bitrate = 0; |
260 | } | 254 | } |
261 | 255 | ||
262 | return Error; | 256 | return ERROR_CODE_OK; |
263 | } | 257 | } |
264 | 258 | ||
265 | double | 259 | double |
diff --git a/apps/codecs/libmusepack/streaminfo.h b/apps/codecs/libmusepack/streaminfo.h index d046f0ebc8..6c4b4ca108 100644 --- a/apps/codecs/libmusepack/streaminfo.h +++ b/apps/codecs/libmusepack/streaminfo.h | |||
@@ -34,8 +34,8 @@ | |||
34 | 34 | ||
35 | /// \file streaminfo.h | 35 | /// \file streaminfo.h |
36 | 36 | ||
37 | #ifndef _musepack_streaminfo_h_ | 37 | #ifndef _mpcdec_streaminfo_h_ |
38 | #define _musepack_streaminfo_h_ | 38 | #define _mpcdec_streaminfo_h_ |
39 | 39 | ||
40 | typedef mpc_int32_t mpc_streaminfo_off_t; | 40 | typedef mpc_int32_t mpc_streaminfo_off_t; |
41 | 41 | ||
@@ -83,4 +83,4 @@ typedef struct mpc_streaminfo { | |||
83 | //@} | 83 | //@} |
84 | } mpc_streaminfo; | 84 | } mpc_streaminfo; |
85 | 85 | ||
86 | #endif // _musepack_streaminfo_h_ | 86 | #endif // _mpcdec_streaminfo_h_ |
diff --git a/apps/codecs/libmusepack/synth_filter.c b/apps/codecs/libmusepack/synth_filter.c index f2945ce9c5..56bf65ea12 100644 --- a/apps/codecs/libmusepack/synth_filter.c +++ b/apps/codecs/libmusepack/synth_filter.c | |||
@@ -36,12 +36,9 @@ | |||
36 | /// Synthesis functions. | 36 | /// Synthesis functions. |
37 | /// \todo document me | 37 | /// \todo document me |
38 | 38 | ||
39 | #include <string.h> | ||
40 | #include "musepack.h" | 39 | #include "musepack.h" |
41 | #include "internal.h" | 40 | #include "internal.h" |
42 | 41 | ||
43 | typedef mpc_int32_t ptrdiff_t; | ||
44 | |||
45 | /* C O N S T A N T S */ | 42 | /* C O N S T A N T S */ |
46 | #undef _ | 43 | #undef _ |
47 | 44 | ||
@@ -334,7 +331,6 @@ static void Calculate_New_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMA | |||
334 | static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y) | 331 | static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y) |
335 | { | 332 | { |
336 | mpc_uint32_t n; | 333 | mpc_uint32_t n; |
337 | |||
338 | for ( n = 0; n < 36; n++, Y += 32 ) { | 334 | for ( n = 0; n < 36; n++, Y += 32 ) { |
339 | V -= 64; | 335 | V -= 64; |
340 | Calculate_New_V ( Y, V ); | 336 | Calculate_New_V ( Y, V ); |
@@ -457,7 +453,7 @@ static const unsigned char Parity [256] = { // parity | |||
457 | * XORed values of both generators. | 453 | * XORed values of both generators. |
458 | */ | 454 | */ |
459 | mpc_uint32_t | 455 | mpc_uint32_t |
460 | random_int(mpc_decoder *d) | 456 | mpc_random_int(mpc_decoder *d) |
461 | { | 457 | { |
462 | #if 1 | 458 | #if 1 |
463 | mpc_uint32_t t1, t2, t3, t4; | 459 | mpc_uint32_t t1, t2, t3, t4; |