summaryrefslogtreecommitdiff
path: root/apps/codecs/libmusepack/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libmusepack/decoder.h')
-rw-r--r--apps/codecs/libmusepack/decoder.h46
1 files changed, 29 insertions, 17 deletions
diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h
index 708533b09e..7ffa572db2 100644
--- a/apps/codecs/libmusepack/decoder.h
+++ b/apps/codecs/libmusepack/decoder.h
@@ -44,6 +44,7 @@
44#include "streaminfo.h" 44#include "streaminfo.h"
45 45
46#define MPC_SUPPORT_SV456 46#define MPC_SUPPORT_SV456
47#define SCF_HACK
47 48
48enum { 49enum {
49 MPC_V_MEM = 2304, 50 MPC_V_MEM = 2304,
@@ -51,8 +52,8 @@ enum {
51}; 52};
52 53
53typedef struct { 54typedef struct {
54 mpc_int32_t L [36]; 55 mpc_int16_t L [36];
55 mpc_int32_t R [36]; 56 mpc_int16_t R [36];
56} QuantTyp; 57} QuantTyp;
57 58
58typedef struct mpc_decoder_t { 59typedef struct mpc_decoder_t {
@@ -61,10 +62,12 @@ typedef struct mpc_decoder_t {
61 /// @name internal state variables 62 /// @name internal state variables
62 //@{ 63 //@{
63 64
65 mpc_uint32_t next;
64 mpc_uint32_t dword; /// currently decoded 32bit-word 66 mpc_uint32_t dword; /// currently decoded 32bit-word
65 mpc_uint32_t pos; /// bit-position within dword 67 mpc_uint32_t pos; /// bit-position within dword
66 mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer 68 mpc_uint32_t *Speicher; /// read-buffer
67 mpc_uint32_t Zaehler; /// actual index within read-buffer 69 mpc_uint32_t Zaehler; /// actual index within read-buffer
70 mpc_uint32_t Ring;
68 71
69 mpc_uint32_t samples_to_skip; 72 mpc_uint32_t samples_to_skip;
70 mpc_uint32_t last_block_samples; 73 mpc_uint32_t last_block_samples;
@@ -74,6 +77,9 @@ typedef struct mpc_decoder_t {
74 77
75 mpc_uint32_t DecodedFrames; 78 mpc_uint32_t DecodedFrames;
76 mpc_uint32_t OverallFrames; 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;
77 mpc_int32_t SampleRate; // Sample frequency 83 mpc_int32_t SampleRate; // Sample frequency
78 84
79 mpc_uint32_t StreamVersion; // version of bitstream 85 mpc_uint32_t StreamVersion; // version of bitstream
@@ -90,28 +96,34 @@ typedef struct mpc_decoder_t {
90 mpc_uint32_t __r1; 96 mpc_uint32_t __r1;
91 mpc_uint32_t __r2; 97 mpc_uint32_t __r2;
92 98
93 mpc_int32_t SCF_Index_L [32] [3]; 99 mpc_int8_t SCF_Index_L [32] [3];
94 mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices 100 mpc_int8_t SCF_Index_R [32] [3]; // holds scalefactor-indices
95 QuantTyp Q [32]; // holds quantized samples 101 QuantTyp Q [32]; // holds quantized samples
96 mpc_int32_t Res_L [32]; 102 mpc_int8_t Res_L [32];
97 mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband 103 mpc_int8_t Res_R [32]; // holds the chosen quantizer for each subband
104#ifdef MPC_SUPPORT_SV456
98 mpc_bool_t DSCF_Flag_L [32]; 105 mpc_bool_t DSCF_Flag_L [32];
99 mpc_bool_t DSCF_Flag_R [32]; // differential SCF used? 106 mpc_bool_t DSCF_Flag_R [32]; // differential SCF used?
100 mpc_int32_t SCFI_L [32]; 107#endif
101 mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF 108 mpc_int8_t SCFI_L [32];
102 mpc_int32_t DSCF_Reference_L [32]; 109 mpc_int8_t SCFI_R [32]; // describes order of transmitted SCF
103 mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF 110 //mpc_int32_t DSCF_Reference_L [32];
111 //mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF
104 mpc_bool_t MS_Flag[32]; // MS used? 112 mpc_bool_t MS_Flag[32]; // MS used?
113
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;
120
105#ifdef MPC_FIXED_POINT 121#ifdef MPC_FIXED_POINT
106 unsigned char SCF_shift[256]; 122 unsigned char SCF_shift[256];
107#endif 123#endif
108 124
109 /* These two see very frequent use in synth_filter.c, so we'll put them 125 MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
110 in IRAM for Rockbox use. Actual arrays are placed in mpc_decoder.c */ 126 MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
111 /* MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960]; */
112 /* MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960]; */
113 MPC_SAMPLE_FORMAT *V_L;
114 MPC_SAMPLE_FORMAT *V_R;
115 MPC_SAMPLE_FORMAT Y_L[36][32]; 127 MPC_SAMPLE_FORMAT Y_L[36][32];
116 MPC_SAMPLE_FORMAT Y_R[36][32]; 128 MPC_SAMPLE_FORMAT Y_R[36][32];
117 MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention) 129 MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)