autodetection: convert path to native separators before displaying it.
[Rockbox.git] / apps / codecs / libmusepack / decoder.h
blob1f78d53c8df2ca2735be35f644bc0ebf1fddcb3b
1 /*
2 Copyright (c) 2005, The Musepack Development Team
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
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
20 written permission.
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.
35 /// \file decoder.h
37 #ifndef _mpcdec_decoder_h_
38 #define _mpcdec_decoder_h_
40 #include "huffman.h"
41 #include "math.h"
42 #include "musepack.h"
43 #include "reader.h"
44 #include "streaminfo.h"
46 //#define MPC_SUPPORT_SV456
47 #define SCF_HACK
49 enum {
50 MPC_V_MEM = 2304,
51 MPC_DECODER_MEMSIZE = 16384, // overall buffer size
54 typedef struct {
55 mpc_int16_t L [36];
56 mpc_int16_t R [36];
57 } QuantTyp;
59 typedef struct mpc_decoder_t {
60 mpc_reader *r;
62 /// @name internal state variables
63 //@{
65 mpc_uint32_t next;
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
70 mpc_uint32_t Ring;
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
86 mpc_int32_t Max_Band;
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
96 mpc_uint32_t __r1;
97 mpc_uint32_t __r2;
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?
107 #endif
108 mpc_int8_t SCFI_L [32];
109 mpc_int8_t SCFI_R [32]; // describes order of transmitted SCF
110 mpc_bool_t MS_Flag[32]; // MS used?
112 mpc_uint32_t* SeekTable;
113 mpc_uint8_t SeekTable_Step;
115 #ifdef MPC_FIXED_POINT
116 mpc_uint8_t SCF_shift[256];
117 #endif
119 MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
120 MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
121 MPC_SAMPLE_FORMAT (*Y_L)[32];
122 MPC_SAMPLE_FORMAT (*Y_R)[32];
123 MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)
124 //@}
126 } mpc_decoder;
128 #endif // _mpc_decoder_h