annotate mpc8huff.h @ 7351:1502ba3beb72 libavcodec

The codebook generator algorithm involves picking three different codebook centroids ("high utility", "low utility" and "closest to the low utility one"). This change avoid the corner case of choosing two times the same centroid.
author vitor
date Wed, 23 Jul 2008 03:54:31 +0000
parents ad73103623ab
children c4a4495715dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5879
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
1 /*
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
2 * Musepack SV8 decoder
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
3 * Copyright (c) 2007 Konstantin Shishkov
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
4 *
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
5 * This file is part of FFmpeg.
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
6 *
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
11 *
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
15 * Lesser General Public License for more details.
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
16 *
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
20 */
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
21
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
22 #ifndef FFMPEG_MPC8HUFF_H
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
23 #define FFMPEG_MPC8HUFF_H
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
24
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
25 #include <stdint.h>
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
26
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
27 #define MPC8_BANDS_SIZE 33
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
28 #define MPC8_BANDS_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
29
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
30 static const uint8_t mpc8_bands_codes[MPC8_BANDS_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
31 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
32 0x05, 0x06, 0x01, 0x02, 0x03, 0x00, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
33 0x06, 0x07, 0x08, 0x01, 0x09, 0x0A, 0x0B, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
34 0x08, 0x09, 0x06, 0x07, 0x05, 0x05, 0x03, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
35 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
36 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
37 static const int8_t mpc8_bands_bits[MPC8_BANDS_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
38 1, 3, 5, 6, 7, 8, 8, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
39 10, 11, 12, 12, 12, 13, 12, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
40 12, 12, 12, 13, 12, 12, 12, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
41 11, 11, 10, 10, 9, 8, 6, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
42 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
43 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
44
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
45 #define MPC8_SCFI0_SIZE 4
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
46 #define MPC8_SCFI0_BITS 3
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
47
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
48 static const uint8_t mpc8_scfi0_codes[MPC8_SCFI0_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
49 0x00, 0x01, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
50 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
51 static const int8_t mpc8_scfi0_bits[MPC8_SCFI0_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
52 3, 3, 1, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
53 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
54
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
55 #define MPC8_SCFI1_SIZE 16
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
56 #define MPC8_SCFI1_BITS 7
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
57
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
58 static const uint8_t mpc8_scfi1_codes[MPC8_SCFI1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
59 0x01, 0x00, 0x02, 0x03, 0x01, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
60 0x04, 0x06, 0x02, 0x02, 0x05, 0x07, 0x03, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
61
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
62 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
63 static const int8_t mpc8_scfi1_bits[MPC8_SCFI1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
64 6, 7, 6, 6, 7, 5, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
65 6, 5, 2, 3, 6, 5, 3, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
66
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
67 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
68
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
69 #define MPC8_DSCF0_SIZE 64
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
70 #define MPC8_DSCF0_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
71
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
72 static const uint8_t mpc8_dscf0_codes[MPC8_DSCF0_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
73 0x03, 0x04, 0x05, 0x04, 0x05, 0x06, 0x05, 0x06,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
74 0x07, 0x08, 0x09, 0x07, 0x08, 0x09, 0x0A, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
75 0x08, 0x09, 0x0A, 0x07, 0x08, 0x09, 0x0A, 0x06,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
76 0x07, 0x05, 0x04, 0x05, 0x06, 0x06, 0x07, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
77 0x08, 0x05, 0x06, 0x07, 0x09, 0x07, 0x08, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
78 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C, 0x0D, 0x0B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
79 0x0C, 0x0D, 0x07, 0x08, 0x09, 0x06, 0x07, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
80 0x04, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
81 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
82 static const int8_t mpc8_dscf0_bits[MPC8_DSCF0_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
83 12, 12, 12, 11, 11, 11, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
84 10, 10, 10, 9, 9, 9, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
85 8, 8, 8, 7, 7, 7, 7, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
86 6, 5, 4, 4, 5, 4, 4, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
87 4, 3, 3, 3, 4, 5, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
88 7, 8, 8, 8, 9, 9, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
89 10, 10, 11, 11, 11, 12, 12, 13,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
90 13, 13, 14, 14, 14, 14, 14, 14,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
91
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
92 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
93
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
94 #define MPC8_DSCF1_SIZE 65
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
95 #define MPC8_DSCF1_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
96
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
97 static const uint8_t mpc8_dscf1_codes[MPC8_DSCF1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
98 0x00, 0x03, 0x04, 0x04, 0x05, 0x06, 0x05, 0x06,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
99 0x07, 0x08, 0x07, 0x08, 0x09, 0x0A, 0x07, 0x08,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
100 0x09, 0x0A, 0x07, 0x08, 0x09, 0x06, 0x07, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
101 0x06, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
102 0x06, 0x07, 0x05, 0x04, 0x05, 0x05, 0x07, 0x08,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
103 0x09, 0x0A, 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
104 0x0D, 0x09, 0x0A, 0x0B, 0x0C, 0x07, 0x08, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
105 0x05, 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
106 0x0D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
107 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
108 static const int8_t mpc8_dscf1_bits[MPC8_DSCF1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
109 15, 14, 14, 13, 13, 13, 12, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
110 12, 12, 11, 11, 11, 11, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
111 10, 10, 9, 9, 9, 8, 8, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
112 7, 6, 5, 4, 4, 3, 3, 3,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
113 3, 3, 4, 5, 5, 6, 7, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
114 8, 9, 9, 10, 10, 10, 11, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
115 11, 12, 12, 12, 12, 13, 13, 13,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
116 14, 14, 14, 15, 15, 15, 15, 15,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
117 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
118 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
119
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
120 #define MPC8_RES_SIZE 17
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
121 #define MPC8_RES_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
122
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
123 static const uint8_t mpc8_res_codes[2][MPC8_RES_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
124 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
125 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
126 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
127 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
128 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
129 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
130 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
131 0x00, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
132 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
133 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
134 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
135 static const int8_t mpc8_res_bits[2][MPC8_RES_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
136 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
137 1, 2, 4, 5, 6, 7, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
138 11, 12, 13, 14, 15, 16, 16, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
139 3,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
140 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
141 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
142 2, 2, 3, 5, 7, 8, 10, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
143 14, 14, 14, 14, 11, 9, 6, 4,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
144 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
145 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
146 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
147
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
148 #define MPC8_Q1_SIZE 19
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
149 #define MPC8_Q1_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
150
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
151 static const uint8_t mpc8_q1_codes[MPC8_Q1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
152 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
153 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
154 0x01, 0x00, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
155 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
156 static const int8_t mpc8_q1_bits[MPC8_Q1_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
157 6, 4, 4, 3, 3, 3, 3, 3,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
158 4, 4, 4, 5, 7, 8, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
159 11, 12, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
160 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
161
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
162 #define MPC8_Q9UP_SIZE 256
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
163 #define MPC8_Q9UP_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
164
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
165 static const uint8_t mpc8_q9up_codes[MPC8_Q9UP_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
166 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
167 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
168 0x10, 0x11, 0x12, 0x26, 0x27, 0x13, 0x14, 0x15,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
169 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
170 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
171 0x28, 0x26, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
172 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
173 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
174 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
175 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
176 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
177 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
178 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
179 0x67, 0x68, 0x69, 0x6A, 0x56, 0x57, 0x58, 0x59,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
180 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
181 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x3E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
182 0x3F, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
183 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
184 0x78, 0x79, 0x7A, 0x6B, 0x7B, 0x6C, 0x6D, 0x6E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
185 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
186 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
187 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
188 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
189 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
190 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
191 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
192 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x27, 0x28, 0x29,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
193 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
194 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
195 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
196 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
197 0x4A, 0x4B, 0x06, 0x07, 0x08, 0x09, 0x00, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
198 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
199 static const int8_t mpc8_q9up_bits[MPC8_Q9UP_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
200 10, 10, 10, 10, 10, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
201 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
202 9, 9, 9, 8, 8, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
203 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
204 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
205 8, 9, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
206 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
207 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
208 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
209 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
210 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
211 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
212 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
213 8, 8, 8, 8, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
214 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
215 7, 7, 7, 7, 7, 7, 7, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
216 6, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
217 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
218 7, 7, 7, 8, 7, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
219 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
220 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
221 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
222 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
223 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
224 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
225 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
226 8, 8, 8, 8, 8, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
227 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
228 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
229 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
230 9, 9, 9, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
231 9, 9, 10, 10, 10, 10, 11, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
232 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
233
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
234 #define MPC8_Q2_SIZE 125
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
235 #define MPC8_Q2_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
236
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
237 static const uint8_t mpc8_q2_codes[2][MPC8_Q2_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
238 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
239 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
240 0x0D, 0x06, 0x07, 0x13, 0x15, 0x14, 0x08, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
241 0x0E, 0x15, 0x0F, 0x0A, 0x03, 0x0B, 0x10, 0x0C,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
242 0x01, 0x0D, 0x10, 0x16, 0x11, 0x0E, 0x12, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
243 0x10, 0x16, 0x13, 0x17, 0x11, 0x08, 0x12, 0x18,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
244 0x14, 0x13, 0x14, 0x17, 0x15, 0x0F, 0x16, 0x19,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
245 0x17, 0x10, 0x11, 0x1A, 0x18, 0x1B, 0x12, 0x1C,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
246 0x15, 0x09, 0x16, 0x1D, 0x19, 0x0A, 0x07, 0x0B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
247 0x1A, 0x1E, 0x17, 0x0C, 0x18, 0x1F, 0x13, 0x20,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
248 0x1B, 0x21, 0x14, 0x11, 0x18, 0x22, 0x19, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
249 0x1A, 0x19, 0x1A, 0x1B, 0x1B, 0x23, 0x1C, 0x0D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
250 0x1D, 0x24, 0x1C, 0x1C, 0x1E, 0x1F, 0x1D, 0x13,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
251 0x1E, 0x25, 0x1F, 0x14, 0x02, 0x15, 0x15, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
252 0x04, 0x17, 0x20, 0x26, 0x21, 0x18, 0x16, 0x27,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
253 0x1D, 0x28, 0x19, 0x1A, 0x22, 0x29, 0x23, 0x1B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
254 0x03, 0x1C, 0x17, 0x1D, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
255 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
256 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
257 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x0D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
258 0x0E, 0x06, 0x07, 0x0F, 0x1E, 0x10, 0x10, 0x08,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
259 0x11, 0x12, 0x13, 0x09, 0x03, 0x0A, 0x11, 0x0B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
260 0x01, 0x0C, 0x14, 0x15, 0x16, 0x0D, 0x17, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
261 0x0E, 0x13, 0x18, 0x19, 0x14, 0x0F, 0x10, 0x1A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
262 0x1B, 0x15, 0x11, 0x16, 0x1C, 0x0E, 0x1D, 0x1E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
263 0x1F, 0x0F, 0x12, 0x20, 0x1F, 0x21, 0x13, 0x22,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
264 0x12, 0x13, 0x14, 0x23, 0x20, 0x15, 0x0F, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
265 0x21, 0x24, 0x17, 0x18, 0x19, 0x25, 0x14, 0x26,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
266 0x22, 0x27, 0x15, 0x10, 0x28, 0x29, 0x2A, 0x11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
267 0x2B, 0x17, 0x1A, 0x18, 0x2C, 0x2D, 0x1B, 0x1C,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
268 0x19, 0x2E, 0x2F, 0x1A, 0x1D, 0x1B, 0x30, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
269 0x31, 0x32, 0x33, 0x13, 0x02, 0x14, 0x15, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
270 0x04, 0x17, 0x34, 0x35, 0x36, 0x18, 0x16, 0x37,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
271 0x23, 0x38, 0x19, 0x1A, 0x39, 0x3A, 0x3B, 0x1B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
272 0x03, 0x1C, 0x17, 0x1D, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
273 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
274 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
275 static const int8_t mpc8_q2_bits[2][MPC8_Q2_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
276 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
277 12, 11, 10, 11, 13, 11, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
278 9, 11, 11, 8, 7, 8, 11, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
279 9, 8, 9, 11, 12, 11, 10, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
280 13, 11, 9, 8, 9, 11, 9, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
281 6, 7, 9, 8, 6, 4, 6, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
282 9, 6, 6, 7, 9, 11, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
283 9, 11, 10, 8, 7, 8, 10, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
284 6, 4, 6, 8, 7, 4, 3, 4,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
285 7, 8, 6, 4, 6, 8, 10, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
286 7, 8, 10, 11, 9, 8, 9, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
287 9, 6, 6, 6, 9, 8, 6, 4,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
288 6, 8, 9, 7, 6, 6, 9, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
289 9, 8, 9, 11, 13, 11, 10, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
290 12, 11, 9, 8, 9, 11, 10, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
291 7, 8, 11, 11, 9, 8, 9, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
292 13, 11, 10, 11, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
293 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
294 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
295 11, 10, 9, 10, 12, 10, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
296 8, 10, 10, 8, 7, 8, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
297 8, 8, 8, 10, 11, 10, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
298 12, 10, 8, 8, 8, 10, 8, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
299 5, 6, 8, 8, 6, 5, 5, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
300 8, 6, 5, 6, 8, 10, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
301 8, 10, 9, 8, 7, 8, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
302 5, 5, 5, 8, 7, 5, 4, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
303 7, 8, 5, 5, 5, 8, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
304 7, 8, 9, 10, 8, 8, 8, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
305 8, 6, 5, 6, 8, 8, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
306 6, 8, 8, 6, 5, 6, 8, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
307 8, 8, 8, 10, 12, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
308 11, 10, 8, 8, 8, 10, 9, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
309 7, 8, 10, 10, 8, 8, 8, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
310 12, 10, 9, 10, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
311 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
312 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
313
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
314 #define MPC8_Q3_SIZE 49
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
315 #define MPC8_Q3_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
316 #define MPC8_Q3_OFFSET -48
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
317
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
318 static const uint8_t mpc8_q3_codes[MPC8_Q3_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
319 0x07, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
320 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x13, 0x12, 0x11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
321 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
322 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
323 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
324 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
325 0x00,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
326 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
327 static const int8_t mpc8_q3_bits[MPC8_Q3_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
328 3, 4, 4, 4, 4, 4, 4, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
329 5, 5, 5, 5, 5, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
330 6, 6, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
331 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
332 7, 7, 7, 7, 7, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
333 8, 8, 8, 8, 8, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
334 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
335 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
336 static const int8_t mpc8_q3_syms[MPC8_Q3_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
337 48, 65, 64, 49, 63, 32, 47, 80,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
338 79, 50, 62, 33, 16, 82, 81, 95,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
339 94, 66, 78, 34, 46, 17, 31, 30,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
340 97, 96, 111, 67, 77, 51, 61, 35,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
341 45, 18, 1, 0, 15, 98, 110, 83,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
342 93, 19, 29, 2, 14, 99, 109, 3,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
343 13,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
344 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
345
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
346 #define MPC8_Q4_SIZE 81
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
347 #define MPC8_Q4_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
348 #define MPC8_Q4_OFFSET -64
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
349
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
350 static const uint8_t mpc8_q4_codes[MPC8_Q4_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
351 0x0F, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
352 0x16, 0x15, 0x14, 0x13, 0x12, 0x23, 0x22, 0x21,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
353 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
354 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
355 0x10, 0x0F, 0x0E, 0x0D, 0x19, 0x18, 0x17, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
356 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0F, 0x0E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
357 0x0D, 0x0C, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
358 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
359 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
360 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
361 0x00,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
362 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
363 static const int8_t mpc8_q4_bits[MPC8_Q4_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
364 4, 5, 5, 5, 5, 5, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
365 5, 5, 5, 5, 5, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
366 6, 6, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
367 6, 6, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
368 6, 6, 6, 6, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
369 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
370 7, 7, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
371 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
372 8, 8, 8, 8, 8, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
373 9, 9, 9, 9, 9, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
374 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
375 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
376 static const int8_t mpc8_q4_syms[MPC8_Q4_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
377 64, 96, 81, 80, 95, 66, 65, 79,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
378 78, 49, 48, 63, 32, 113, 112, 98,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
379 97, 111, 110, 83, 82, 94, 93, 67,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
380 77, 51, 50, 62, 61, 34, 33, 47,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
381 46, 17, 16, 31, 128, 114, 127, 126,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
382 99, 109, 68, 76, 35, 45, 18, 30,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
383 0, 15, 130, 129, 143, 142, 115, 125,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
384 100, 108, 84, 92, 52, 60, 36, 44,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
385 19, 29, 2, 1, 14, 131, 141, 116,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
386 124, 20, 28, 3, 13, 132, 140, 4,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
387 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
388 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
389
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
390 #define MPC8_Q5_SIZE 15
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
391 #define MPC8_Q5_BITS 7
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
392 #define MPC8_Q5_OFFSET -7
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
393
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
394 static const uint8_t mpc8_q5_codes[2][MPC8_Q5_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
395 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
396 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
397 0x04, 0x05, 0x03, 0x03, 0x03, 0x02, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
398 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
399 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
400 0x00, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
401 0x06, 0x07, 0x04, 0x05, 0x03, 0x02, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
402 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
403 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
404 static const int8_t mpc8_q5_bits[2][MPC8_Q5_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
405 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
406 7, 7, 6, 5, 4, 3, 3, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
407 3, 3, 4, 5, 6, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
408 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
409 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
410 6, 6, 5, 4, 4, 3, 3, 3,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
411 3, 3, 4, 4, 5, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
412 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
413 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
414
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
415 #define MPC8_Q6_SIZE 31
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
416 #define MPC8_Q6_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
417 #define MPC8_Q6_OFFSET -15
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
418
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
419 static const uint8_t mpc8_q6_codes[2][MPC8_Q6_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
420 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
421 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x04, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
422 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x04, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
423 0x05, 0x06, 0x07, 0x07, 0x06, 0x07, 0x08, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
424 0x05, 0x06, 0x07, 0x04, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
425 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
426 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
427 0x00, 0x01, 0x02, 0x03, 0x04, 0x04, 0x05, 0x04,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
428 0x05, 0x06, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
429 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x07, 0x08, 0x09,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
430 0x06, 0x07, 0x05, 0x06, 0x07, 0x02, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
431 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
432 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
433 static const int8_t mpc8_q6_bits[2][MPC8_Q6_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
434 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
435 9, 9, 9, 9, 8, 8, 7, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
436 6, 6, 5, 5, 4, 4, 3, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
437 3, 4, 4, 5, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
438 7, 8, 8, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
439 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
440 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
441 8, 8, 7, 7, 7, 6, 6, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
442 5, 5, 4, 4, 4, 4, 4, 4,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
443 4, 4, 4, 4, 4, 5, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
444 6, 6, 7, 7, 7, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
445 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
446 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
447
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
448 #define MPC8_Q7_SIZE 63
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
449 #define MPC8_Q7_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
450 #define MPC8_Q7_OFFSET -31
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
451
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
452 static const uint8_t mpc8_q7_codes[2][MPC8_Q7_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
453 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
454 0x00, 0x01, 0x02, 0x08, 0x09, 0x03, 0x04, 0x05,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
455 0x06, 0x07, 0x0A, 0x0B, 0x0C, 0x0D, 0x0A, 0x0B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
456 0x0C, 0x0D, 0x0E, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
457 0x0A, 0x0B, 0x0C, 0x08, 0x09, 0x06, 0x04, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
458 0x05, 0x07, 0x0A, 0x0B, 0x0D, 0x0E, 0x0F, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
459 0x10, 0x11, 0x12, 0x0F, 0x13, 0x10, 0x11, 0x12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
460 0x13, 0x0E, 0x0F, 0x10, 0x11, 0x08, 0x09, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
461 0x0B, 0x0C, 0x12, 0x13, 0x0D, 0x0E, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
462 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
463 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
464 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
465 0x08, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x09, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
466 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x0C, 0x0D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
467 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
468 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
469 0x1E, 0x1F, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
470 0x17, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x09, 0x0A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
471 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x02, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
472 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
473 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
474 static const int8_t mpc8_q7_bits[2][MPC8_Q7_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
475 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
476 10, 10, 10, 9, 9, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
477 10, 10, 9, 9, 9, 9, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
478 8, 8, 8, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
479 6, 6, 6, 5, 5, 4, 3, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
480 3, 4, 5, 5, 6, 6, 6, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
481 7, 7, 7, 8, 7, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
482 8, 9, 9, 9, 9, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
483 10, 10, 9, 9, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
484 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
485 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
486 9, 9, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
487 8, 7, 7, 7, 7, 7, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
488 6, 6, 6, 6, 6, 6, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
489 5, 5, 5, 5, 5, 5, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
490 5, 5, 5, 5, 5, 5, 5, 5,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
491 5, 5, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
492 6, 7, 7, 7, 7, 7, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
493 8, 8, 8, 8, 8, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
494 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
495 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
496
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
497 #define MPC8_Q8_SIZE 127
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
498 #define MPC8_Q8_BITS 9
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
499 #define MPC8_Q8_OFFSET -63
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
500
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
501 static const uint8_t mpc8_q8_codes[2][MPC8_Q8_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
502 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
503 0x03, 0x04, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x1A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
504 0x0F, 0x1B, 0x10, 0x00, 0x01, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
505 0x08, 0x09, 0x0A, 0x0B, 0x11, 0x0C, 0x12, 0x13,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
506 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1C, 0x1A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
507 0x1B, 0x1C, 0x1D, 0x1E, 0x1D, 0x1E, 0x1F, 0x20,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
508 0x21, 0x22, 0x23, 0x24, 0x19, 0x25, 0x1A, 0x1B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
509 0x1C, 0x1D, 0x1E, 0x1F, 0x14, 0x15, 0x16, 0x17,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
510 0x0E, 0x0F, 0x10, 0x11, 0x0B, 0x07, 0x04, 0x03,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
511 0x05, 0x0C, 0x0D, 0x12, 0x13, 0x14, 0x15, 0x18,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
512 0x19, 0x1A, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
513 0x25, 0x26, 0x27, 0x26, 0x27, 0x28, 0x29, 0x2A,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
514 0x2B, 0x2C, 0x2D, 0x2E, 0x1F, 0x20, 0x2F, 0x21,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
515 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
516 0x0D, 0x0E, 0x2A, 0x0F, 0x10, 0x11, 0x12, 0x02,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
517 0x13, 0x03, 0x04, 0x05, 0x2B, 0x2C, 0x30, 0x31,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
518 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
519 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
520 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
521 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
522 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
523 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x15, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
524 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
525 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
526 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
527 0x2F, 0x30, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
528 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
529 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
530 0x3C, 0x3D, 0x3E, 0x31, 0x3F, 0x32, 0x33, 0x34,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
531 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
532 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
533 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x16,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
534 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
535 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
536 0x27, 0x28, 0x29, 0x04, 0x05, 0x06, 0x07,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
537 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
538 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
539 static const int8_t mpc8_q8_bits[2][MPC8_Q8_SIZE] = {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
540 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
541 11, 11, 10, 10, 10, 10, 10, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
542 10, 9, 10, 12, 12, 11, 11, 11,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
543 11, 11, 11, 11, 10, 11, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
544 10, 10, 10, 10, 10, 10, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
545 10, 10, 10, 10, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
546 9, 9, 9, 9, 8, 9, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
547 8, 8, 8, 8, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
548 6, 6, 6, 6, 5, 4, 3, 2,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
549 3, 5, 5, 6, 6, 6, 6, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
550 7, 7, 7, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
551 8, 8, 8, 9, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
552 9, 9, 9, 9, 10, 10, 9, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
553 10, 10, 10, 10, 10, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
554 11, 11, 10, 11, 11, 11, 11, 12,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
555 11, 12, 12, 12, 10, 10, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
556 10, 10, 10, 10, 10, 10, 10,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
557 },
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
558 {
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
559 9, 9, 9, 9, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
560 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
561 8, 8, 8, 8, 8, 8, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
562 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
563 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
564 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
565 7, 7, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
566 6, 6, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
567 6, 6, 6, 6, 6, 6, 6, 6,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
568 6, 6, 6, 7, 6, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
569 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
570 7, 7, 7, 7, 7, 7, 7, 7,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
571 7, 7, 7, 7, 7, 7, 7, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
572 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
573 8, 8, 8, 8, 8, 8, 8, 8,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
574 8, 8, 8, 9, 9, 9, 9,
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
575 }
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
576 };
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
577
ad73103623ab Musepack SV8 demuxer and decoder
kostya
parents:
diff changeset
578 #endif /* FFMPEG_MPC8HUFF_H */