2 Copyright (c) 2005, The Musepack Development Team
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above
13 copyright notice, this list of conditions and the following
14 disclaimer in the documentation and/or other materials provided
15 with the distribution.
17 * Neither the name of the The Musepack Development Team nor the
18 names of its contributors may be used to endorse or promote
19 products derived from this software without specific prior
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #ifndef _mpcdec_decoder_h_
38 #define _mpcdec_decoder_h_
44 #include "streaminfo.h"
46 #define MPC_SUPPORT_SV456
51 MPC_DECODER_MEMSIZE
= 16384, // overall buffer size
59 typedef struct mpc_decoder_t
{
62 /// @name internal state variables
66 mpc_uint32_t dword
; /// currently decoded 32bit-word
67 mpc_uint32_t pos
; /// bit-position within dword
68 mpc_uint32_t
*Speicher
; /// read-buffer
69 mpc_uint32_t Zaehler
; /// actual index within read-buffer
72 mpc_uint32_t samples_to_skip
;
73 mpc_uint32_t last_block_samples
;
74 mpc_uint32_t FwdJumpInfo
;
75 mpc_uint32_t ActDecodePos
;
78 mpc_uint32_t DecodedFrames
;
79 mpc_uint32_t OverallFrames
;
80 mpc_uint32_t MaxDecodedFrames
; // Maximum frames decoded (indicates usable seek table entries)
81 mpc_uint16_t SeekTableIndex
;
82 mpc_uint32_t SeekTableCounter
;
83 mpc_int32_t SampleRate
; // Sample frequency
85 mpc_uint32_t StreamVersion
; // version of bitstream
87 mpc_uint32_t MPCHeaderPos
; // AB: needed to support ID3v2
89 mpc_uint32_t FrameWasValid
;
90 mpc_uint32_t MS_used
; // MS-coding used ?
91 mpc_uint32_t TrueGaplessPresent
;
93 mpc_uint32_t WordsRead
; // counts amount of decoded dwords
95 // randomizer state variables
99 mpc_int8_t SCF_Index_L
[32] [3];
100 mpc_int8_t SCF_Index_R
[32] [3]; // holds scalefactor-indices
101 QuantTyp Q
[32]; // holds quantized samples
102 mpc_int8_t Res_L
[32];
103 mpc_int8_t Res_R
[32]; // holds the chosen quantizer for each subband
104 #ifdef MPC_SUPPORT_SV456
105 mpc_bool_t DSCF_Flag_L
[32];
106 mpc_bool_t DSCF_Flag_R
[32]; // differential SCF used?
108 mpc_int8_t SCFI_L
[32];
109 mpc_int8_t SCFI_R
[32]; // describes order of transmitted SCF
110 //mpc_int32_t DSCF_Reference_L [32];
111 //mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF
112 mpc_bool_t MS_Flag
[32]; // MS used?
114 mpc_uint32_t
* SeekTable
;
115 mpc_bool_t Use_SeekTable
;
116 mpc_bool_t Use_FastSeek
;
117 mpc_bool_t Use_StaticSeekTable
;
118 mpc_uint8_t SeekTable_Step
;
119 mpc_uint32_t Max_SeekTable_Size
;
121 #ifdef MPC_FIXED_POINT
122 unsigned char SCF_shift
[256];
125 MPC_SAMPLE_FORMAT V_L
[MPC_V_MEM
+ 960];
126 MPC_SAMPLE_FORMAT V_R
[MPC_V_MEM
+ 960];
127 MPC_SAMPLE_FORMAT (*Y_L
)[32];
128 MPC_SAMPLE_FORMAT (*Y_R
)[32];
129 MPC_SAMPLE_FORMAT SCF
[256]; ///< holds adapted scalefactors (for clipping prevention)
134 #endif // _mpc_decoder_h