diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-22 21:02:57 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-22 21:02:57 +0000 |
commit | 3f5f3524d478743a4c2f470f0baf7b767ce8d1c2 (patch) | |
tree | 26a7df9071388e223c2f1b165dc84ae3bf4f5832 | |
parent | 398b37124e870b3be69a03e5d89c5887204d6990 (diff) | |
download | rockbox-3f5f3524d478743a4c2f470f0baf7b767ce8d1c2.tar.gz rockbox-3f5f3524d478743a4c2f470f0baf7b767ce8d1c2.zip |
Change liba52 and libmad to the original 8-spaced tabbing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24863 a1c6a512-1295-4272-9138-f99709370657
30 files changed, 2800 insertions, 2800 deletions
diff --git a/apps/codecs/liba52/a52.h b/apps/codecs/liba52/a52.h index cae9ae6403..e852e8d6bb 100644 --- a/apps/codecs/liba52/a52.h +++ b/apps/codecs/liba52/a52.h | |||
@@ -56,11 +56,11 @@ typedef struct a52_state_s a52_state_t; | |||
56 | a52_state_t * a52_init (uint32_t mm_accel); | 56 | a52_state_t * a52_init (uint32_t mm_accel); |
57 | sample_t * a52_samples (a52_state_t * state); | 57 | sample_t * a52_samples (a52_state_t * state); |
58 | int a52_syncinfo (uint8_t * buf, int * flags, | 58 | int a52_syncinfo (uint8_t * buf, int * flags, |
59 | int * sample_rate, int * bit_rate); | 59 | int * sample_rate, int * bit_rate); |
60 | int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, | 60 | int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, |
61 | level_t * level, sample_t bias); | 61 | level_t * level, sample_t bias); |
62 | void a52_dynrng (a52_state_t * state, | 62 | void a52_dynrng (a52_state_t * state, |
63 | level_t (* call) (level_t, void *), void * data); | 63 | level_t (* call) (level_t, void *), void * data); |
64 | int a52_block (a52_state_t * state); | 64 | int a52_block (a52_state_t * state); |
65 | void a52_free (a52_state_t * state); | 65 | void a52_free (a52_state_t * state); |
66 | 66 | ||
diff --git a/apps/codecs/liba52/a52_internal.h b/apps/codecs/liba52/a52_internal.h index 48f23836f7..3b3d21c9a3 100644 --- a/apps/codecs/liba52/a52_internal.h +++ b/apps/codecs/liba52/a52_internal.h | |||
@@ -22,62 +22,62 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | typedef struct { | 24 | typedef struct { |
25 | uint8_t bai; /* fine SNR offset, fast gain */ | 25 | uint8_t bai; /* fine SNR offset, fast gain */ |
26 | uint8_t deltbae; /* delta bit allocation exists */ | 26 | uint8_t deltbae; /* delta bit allocation exists */ |
27 | int8_t deltba[50]; /* per-band delta bit allocation */ | 27 | int8_t deltba[50]; /* per-band delta bit allocation */ |
28 | } ba_t; | 28 | } ba_t; |
29 | 29 | ||
30 | typedef struct { | 30 | typedef struct { |
31 | uint8_t exp[256]; /* decoded channel exponents */ | 31 | uint8_t exp[256]; /* decoded channel exponents */ |
32 | int8_t bap[256]; /* derived channel bit allocation */ | 32 | int8_t bap[256]; /* derived channel bit allocation */ |
33 | } expbap_t; | 33 | } expbap_t; |
34 | 34 | ||
35 | struct a52_state_s { | 35 | struct a52_state_s { |
36 | uint8_t fscod; /* sample rate */ | 36 | uint8_t fscod; /* sample rate */ |
37 | uint8_t halfrate; /* halfrate factor */ | 37 | uint8_t halfrate; /* halfrate factor */ |
38 | uint8_t acmod; /* coded channels */ | 38 | uint8_t acmod; /* coded channels */ |
39 | uint8_t lfeon; /* coded lfe channel */ | 39 | uint8_t lfeon; /* coded lfe channel */ |
40 | level_t clev; /* centre channel mix level */ | 40 | level_t clev; /* centre channel mix level */ |
41 | level_t slev; /* surround channels mix level */ | 41 | level_t slev; /* surround channels mix level */ |
42 | 42 | ||
43 | int output; /* type of output */ | 43 | int output; /* type of output */ |
44 | level_t level; /* output level */ | 44 | level_t level; /* output level */ |
45 | sample_t bias; /* output bias */ | 45 | sample_t bias; /* output bias */ |
46 | 46 | ||
47 | int dynrnge; /* apply dynamic range */ | 47 | int dynrnge; /* apply dynamic range */ |
48 | level_t dynrng; /* dynamic range */ | 48 | level_t dynrng; /* dynamic range */ |
49 | void * dynrngdata; /* dynamic range callback funtion and data */ | 49 | void * dynrngdata; /* dynamic range callback funtion and data */ |
50 | level_t (* dynrngcall) (level_t range, void * dynrngdata); | 50 | level_t (* dynrngcall) (level_t range, void * dynrngdata); |
51 | 51 | ||
52 | uint8_t chincpl; /* channel coupled */ | 52 | uint8_t chincpl; /* channel coupled */ |
53 | uint8_t phsflginu; /* phase flags in use (stereo only) */ | 53 | uint8_t phsflginu; /* phase flags in use (stereo only) */ |
54 | uint8_t cplstrtmant; /* coupling channel start mantissa */ | 54 | uint8_t cplstrtmant; /* coupling channel start mantissa */ |
55 | uint8_t cplendmant; /* coupling channel end mantissa */ | 55 | uint8_t cplendmant; /* coupling channel end mantissa */ |
56 | uint32_t cplbndstrc; /* coupling band structure */ | 56 | uint32_t cplbndstrc; /* coupling band structure */ |
57 | level_t cplco[5][18]; /* coupling coordinates */ | 57 | level_t cplco[5][18]; /* coupling coordinates */ |
58 | 58 | ||
59 | /* derived information */ | 59 | /* derived information */ |
60 | uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ | 60 | uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ |
61 | uint8_t ncplbnd; /* number of coupling bands */ | 61 | uint8_t ncplbnd; /* number of coupling bands */ |
62 | 62 | ||
63 | uint8_t rematflg; /* stereo rematrixing */ | 63 | uint8_t rematflg; /* stereo rematrixing */ |
64 | 64 | ||
65 | uint8_t endmant[5]; /* channel end mantissa */ | 65 | uint8_t endmant[5]; /* channel end mantissa */ |
66 | 66 | ||
67 | uint16_t bai; /* bit allocation information */ | 67 | uint16_t bai; /* bit allocation information */ |
68 | 68 | ||
69 | uint32_t * buffer_start; | 69 | uint32_t * buffer_start; |
70 | uint16_t lfsr_state; /* dither state */ | 70 | uint16_t lfsr_state; /* dither state */ |
71 | uint32_t bits_left; | 71 | uint32_t bits_left; |
72 | uint32_t current_word; | 72 | uint32_t current_word; |
73 | 73 | ||
74 | uint8_t csnroffst; /* coarse SNR offset */ | 74 | uint8_t csnroffst; /* coarse SNR offset */ |
75 | ba_t cplba; /* coupling bit allocation parameters */ | 75 | ba_t cplba; /* coupling bit allocation parameters */ |
76 | ba_t ba[5]; /* channel bit allocation parameters */ | 76 | ba_t ba[5]; /* channel bit allocation parameters */ |
77 | ba_t lfeba; /* lfe bit allocation parameters */ | 77 | ba_t lfeba; /* lfe bit allocation parameters */ |
78 | 78 | ||
79 | uint8_t cplfleak; /* coupling fast leak init */ | 79 | uint8_t cplfleak; /* coupling fast leak init */ |
80 | uint8_t cplsleak; /* coupling slow leak init */ | 80 | uint8_t cplsleak; /* coupling slow leak init */ |
81 | 81 | ||
82 | expbap_t cpl_expbap; | 82 | expbap_t cpl_expbap; |
83 | expbap_t fbw_expbap[5]; | 83 | expbap_t fbw_expbap[5]; |
@@ -104,15 +104,15 @@ struct a52_state_s { | |||
104 | #define DELTA_BIT_RESERVED (3) | 104 | #define DELTA_BIT_RESERVED (3) |
105 | 105 | ||
106 | void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, | 106 | void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, |
107 | int start, int end, int fastleak, int slowleak, | 107 | int start, int end, int fastleak, int slowleak, |
108 | expbap_t * expbap); | 108 | expbap_t * expbap); |
109 | 109 | ||
110 | int a52_downmix_init (int input, int flags, level_t * level, | 110 | int a52_downmix_init (int input, int flags, level_t * level, |
111 | level_t clev, level_t slev); | 111 | level_t clev, level_t slev); |
112 | int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, | 112 | int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, |
113 | level_t clev, level_t slev); | 113 | level_t clev, level_t slev); |
114 | void a52_downmix (sample_t * samples, int acmod, int output, | 114 | void a52_downmix (sample_t * samples, int acmod, int output, |
115 | level_t clev, level_t slev); | 115 | level_t clev, level_t slev); |
116 | void a52_upmix (sample_t * samples, int acmod, int output); | 116 | void a52_upmix (sample_t * samples, int acmod, int output); |
117 | 117 | ||
118 | void a52_imdct_init (uint32_t mm_accel); | 118 | void a52_imdct_init (uint32_t mm_accel); |
diff --git a/apps/codecs/liba52/bit_allocate.c b/apps/codecs/liba52/bit_allocate.c index 3f68c92c0c..aaac245913 100644 --- a/apps/codecs/liba52/bit_allocate.c +++ b/apps/codecs/liba52/bit_allocate.c | |||
@@ -68,12 +68,12 @@ static int8_t baptab[305] IDATA_ATTR = { | |||
68 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 68 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
69 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 69 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
70 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 70 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
71 | 0, 0, 0, 0 /* 148 padding elems */ | 71 | 0, 0, 0, 0 /* 148 padding elems */ |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static int bndtab[30] IDATA_ATTR = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34, | 74 | static int bndtab[30] IDATA_ATTR = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34, |
75 | 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, | 75 | 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, |
76 | 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; | 76 | 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; |
77 | 77 | ||
78 | static int8_t latab[256] IDATA_ATTR = { | 78 | static int8_t latab[256] IDATA_ATTR = { |
79 | -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, | 79 | -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, |
@@ -100,35 +100,35 @@ static int8_t latab[256] IDATA_ATTR = { | |||
100 | 0, 0, 0, 0 | 100 | 0, 0, 0, 0 |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define UPDATE_LEAK() \ | 103 | #define UPDATE_LEAK() \ |
104 | do { \ | 104 | do { \ |
105 | fastleak += fdecay; \ | 105 | fastleak += fdecay; \ |
106 | if (fastleak > psd + fgain) \ | 106 | if (fastleak > psd + fgain) \ |
107 | fastleak = psd + fgain; \ | 107 | fastleak = psd + fgain; \ |
108 | slowleak += sdecay; \ | 108 | slowleak += sdecay; \ |
109 | if (slowleak > psd + sgain) \ | 109 | if (slowleak > psd + sgain) \ |
110 | slowleak = psd + sgain; \ | 110 | slowleak = psd + sgain; \ |
111 | } while (0) | 111 | } while (0) |
112 | 112 | ||
113 | #define COMPUTE_MASK() \ | 113 | #define COMPUTE_MASK() \ |
114 | do { \ | 114 | do { \ |
115 | if (psd > dbknee) \ | 115 | if (psd > dbknee) \ |
116 | mask -= (psd - dbknee) >> 2; \ | 116 | mask -= (psd - dbknee) >> 2; \ |
117 | if (mask > hth [i >> halfrate]) \ | 117 | if (mask > hth [i >> halfrate]) \ |
118 | mask = hth [i >> halfrate]; \ | 118 | mask = hth [i >> halfrate]; \ |
119 | mask -= snroffset + 128 * deltba[i]; \ | 119 | mask -= snroffset + 128 * deltba[i]; \ |
120 | mask = (mask > 0) ? 0 : ((-mask) >> 5); \ | 120 | mask = (mask > 0) ? 0 : ((-mask) >> 5); \ |
121 | mask -= floor; \ | 121 | mask -= floor; \ |
122 | } while (0) | 122 | } while (0) |
123 | 123 | ||
124 | void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, | 124 | void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, |
125 | int start, int end, int fastleak, int slowleak, | 125 | int start, int end, int fastleak, int slowleak, |
126 | expbap_t * expbap) | 126 | expbap_t * expbap) |
127 | { | 127 | { |
128 | static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; | 128 | static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; |
129 | static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; | 129 | static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; |
130 | static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0, | 130 | static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0, |
131 | 0xa10, 0xa90, 0xb10, 0x1400}; | 131 | 0xa10, 0xa90, 0xb10, 0x1400}; |
132 | 132 | ||
133 | int i, j; | 133 | int i, j; |
134 | uint8_t * exp; | 134 | uint8_t * exp; |
@@ -141,17 +141,17 @@ void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, | |||
141 | 141 | ||
142 | halfrate = state->halfrate; | 142 | halfrate = state->halfrate; |
143 | fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ | 143 | fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ |
144 | fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ | 144 | fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ |
145 | sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ | 145 | sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ |
146 | sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ | 146 | sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ |
147 | dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ | 147 | dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ |
148 | hth = hthtab[state->fscod]; | 148 | hth = hthtab[state->fscod]; |
149 | /* | 149 | /* |
150 | * if there is no delta bit allocation, make deltba point to an area | 150 | * if there is no delta bit allocation, make deltba point to an area |
151 | * known to contain zeroes. baptab+156 here. | 151 | * known to contain zeroes. baptab+156 here. |
152 | */ | 152 | */ |
153 | deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; | 153 | deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; |
154 | floor = floortab[state->bai & 7]; /* floorcod */ | 154 | floor = floortab[state->bai & 7]; /* floorcod */ |
155 | snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; | 155 | snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; |
156 | floor >>= 5; | 156 | floor >>= 5; |
157 | 157 | ||
@@ -161,105 +161,105 @@ void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, | |||
161 | i = bndstart; | 161 | i = bndstart; |
162 | j = start; | 162 | j = start; |
163 | if (start == 0) { /* not the coupling channel */ | 163 | if (start == 0) { /* not the coupling channel */ |
164 | int lowcomp; | 164 | int lowcomp; |
165 | 165 | ||
166 | lowcomp = 0; | 166 | lowcomp = 0; |
167 | j = end - 1; | 167 | j = end - 1; |
168 | do { | 168 | do { |
169 | if (i < j) { | 169 | if (i < j) { |
170 | if (exp[i+1] == exp[i] - 2) | 170 | if (exp[i+1] == exp[i] - 2) |
171 | lowcomp = 384; | 171 | lowcomp = 384; |
172 | else if (lowcomp && (exp[i+1] > exp[i])) | 172 | else if (lowcomp && (exp[i+1] > exp[i])) |
173 | lowcomp -= 64; | 173 | lowcomp -= 64; |
174 | } | 174 | } |
175 | psd = 128 * exp[i]; | 175 | psd = 128 * exp[i]; |
176 | mask = psd + fgain + lowcomp; | 176 | mask = psd + fgain + lowcomp; |
177 | COMPUTE_MASK (); | 177 | COMPUTE_MASK (); |
178 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; | 178 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; |
179 | i++; | 179 | i++; |
180 | } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); | 180 | } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); |
181 | fastleak = psd + fgain; | 181 | fastleak = psd + fgain; |
182 | slowleak = psd + sgain; | 182 | slowleak = psd + sgain; |
183 | 183 | ||
184 | while (i < 7) { | 184 | while (i < 7) { |
185 | if (i < j) { | 185 | if (i < j) { |
186 | if (exp[i+1] == exp[i] - 2) | 186 | if (exp[i+1] == exp[i] - 2) |
187 | lowcomp = 384; | 187 | lowcomp = 384; |
188 | else if (lowcomp && (exp[i+1] > exp[i])) | 188 | else if (lowcomp && (exp[i+1] > exp[i])) |
189 | lowcomp -= 64; | 189 | lowcomp -= 64; |
190 | } | ||
191 | psd = 128 * exp[i]; | ||
192 | UPDATE_LEAK (); | ||
193 | mask = ((fastleak + lowcomp < slowleak) ? | ||
194 | fastleak + lowcomp : slowleak); | ||
195 | COMPUTE_MASK (); | ||
196 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; | ||
197 | i++; | ||
190 | } | 198 | } |
191 | psd = 128 * exp[i]; | ||
192 | UPDATE_LEAK (); | ||
193 | mask = ((fastleak + lowcomp < slowleak) ? | ||
194 | fastleak + lowcomp : slowleak); | ||
195 | COMPUTE_MASK (); | ||
196 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; | ||
197 | i++; | ||
198 | } | ||
199 | 199 | ||
200 | if (end == 7) /* lfe channel */ | 200 | if (end == 7) /* lfe channel */ |
201 | return; | 201 | return; |
202 | 202 | ||
203 | do { | 203 | do { |
204 | if (exp[i+1] == exp[i] - 2) | 204 | if (exp[i+1] == exp[i] - 2) |
205 | lowcomp = 320; | 205 | lowcomp = 320; |
206 | else if (lowcomp && (exp[i+1] > exp[i])) | 206 | else if (lowcomp && (exp[i+1] > exp[i])) |
207 | lowcomp -= 64; | 207 | lowcomp -= 64; |
208 | psd = 128 * exp[i]; | 208 | psd = 128 * exp[i]; |
209 | UPDATE_LEAK (); | 209 | UPDATE_LEAK (); |
210 | mask = ((fastleak + lowcomp < slowleak) ? | 210 | mask = ((fastleak + lowcomp < slowleak) ? |
211 | fastleak + lowcomp : slowleak); | 211 | fastleak + lowcomp : slowleak); |
212 | COMPUTE_MASK (); | 212 | COMPUTE_MASK (); |
213 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; | 213 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; |
214 | i++; | 214 | i++; |
215 | } while (i < 20); | 215 | } while (i < 20); |
216 | 216 | ||
217 | while (lowcomp > 128) { /* two iterations maximum */ | 217 | while (lowcomp > 128) { /* two iterations maximum */ |
218 | lowcomp -= 128; | 218 | lowcomp -= 128; |
219 | psd = 128 * exp[i]; | 219 | psd = 128 * exp[i]; |
220 | UPDATE_LEAK (); | 220 | UPDATE_LEAK (); |
221 | mask = ((fastleak + lowcomp < slowleak) ? | 221 | mask = ((fastleak + lowcomp < slowleak) ? |
222 | fastleak + lowcomp : slowleak); | 222 | fastleak + lowcomp : slowleak); |
223 | COMPUTE_MASK (); | 223 | COMPUTE_MASK (); |
224 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; | 224 | bap[i] = (baptab+156)[mask + 4 * exp[i]]; |
225 | i++; | 225 | i++; |
226 | } | 226 | } |
227 | j = i; | 227 | j = i; |
228 | } | 228 | } |
229 | 229 | ||
230 | do { | 230 | do { |
231 | int startband, endband; | 231 | int startband, endband; |
232 | 232 | ||
233 | startband = j; | 233 | startband = j; |
234 | endband = (bndtab[i-20] < end) ? bndtab[i-20] : end; | 234 | endband = (bndtab[i-20] < end) ? bndtab[i-20] : end; |
235 | psd = 128 * exp[j++]; | 235 | psd = 128 * exp[j++]; |
236 | while (j < endband) { | 236 | while (j < endband) { |
237 | int next, delta; | 237 | int next, delta; |
238 | 238 | ||
239 | next = 128 * exp[j++]; | 239 | next = 128 * exp[j++]; |
240 | delta = next - psd; | 240 | delta = next - psd; |
241 | switch (delta >> 9) { | 241 | switch (delta >> 9) { |
242 | case -6: case -5: case -4: case -3: case -2: | 242 | case -6: case -5: case -4: case -3: case -2: |
243 | psd = next; | 243 | psd = next; |
244 | break; | 244 | break; |
245 | case -1: | 245 | case -1: |
246 | psd = next + latab[(-delta) >> 1]; | 246 | psd = next + latab[(-delta) >> 1]; |
247 | break; | 247 | break; |
248 | case 0: | 248 | case 0: |
249 | psd += latab[delta >> 1]; | 249 | psd += latab[delta >> 1]; |
250 | break; | 250 | break; |
251 | } | ||
251 | } | 252 | } |
252 | } | 253 | /* minpsd = -289 */ |
253 | /* minpsd = -289 */ | 254 | UPDATE_LEAK (); |
254 | UPDATE_LEAK (); | 255 | mask = (fastleak < slowleak) ? fastleak : slowleak; |
255 | mask = (fastleak < slowleak) ? fastleak : slowleak; | 256 | COMPUTE_MASK (); |
256 | COMPUTE_MASK (); | 257 | i++; |
257 | i++; | 258 | j = startband; |
258 | j = startband; | 259 | do { |
259 | do { | 260 | /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ |
260 | /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ | 261 | /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ |
261 | /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ | 262 | bap[j] = (baptab+156)[mask + 4 * exp[j]]; |
262 | bap[j] = (baptab+156)[mask + 4 * exp[j]]; | 263 | } while (++j < endband); |
263 | } while (++j < endband); | ||
264 | } while (j < end); | 264 | } while (j < end); |
265 | } | 265 | } |
diff --git a/apps/codecs/liba52/bitstream.c b/apps/codecs/liba52/bitstream.c index f9f3ad76b0..155368f1ed 100644 --- a/apps/codecs/liba52/bitstream.c +++ b/apps/codecs/liba52/bitstream.c | |||
@@ -66,12 +66,12 @@ uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits) | |||
66 | 66 | ||
67 | num_bits -= state->bits_left; | 67 | num_bits -= state->bits_left; |
68 | result = ((state->current_word << (32 - state->bits_left)) >> | 68 | result = ((state->current_word << (32 - state->bits_left)) >> |
69 | (32 - state->bits_left)); | 69 | (32 - state->bits_left)); |
70 | 70 | ||
71 | bitstream_fill_current (state); | 71 | bitstream_fill_current (state); |
72 | 72 | ||
73 | if (num_bits != 0) | 73 | if (num_bits != 0) |
74 | result = (result << num_bits) | (state->current_word >> (32 - num_bits)); | 74 | result = (result << num_bits) | (state->current_word >> (32 - num_bits)); |
75 | 75 | ||
76 | state->bits_left = 32 - num_bits; | 76 | state->bits_left = 32 - num_bits; |
77 | 77 | ||
@@ -84,13 +84,13 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) | |||
84 | 84 | ||
85 | num_bits -= state->bits_left; | 85 | num_bits -= state->bits_left; |
86 | result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >> | 86 | result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >> |
87 | (32 - state->bits_left)); | 87 | (32 - state->bits_left)); |
88 | 88 | ||
89 | bitstream_fill_current(state); | 89 | bitstream_fill_current(state); |
90 | 90 | ||
91 | if (num_bits != 0) | 91 | if (num_bits != 0) |
92 | result = (result << num_bits) | (state->current_word >> (32 - num_bits)); | 92 | result = (result << num_bits) | (state->current_word >> (32 - num_bits)); |
93 | 93 | ||
94 | state->bits_left = 32 - num_bits; | 94 | state->bits_left = 32 - num_bits; |
95 | 95 | ||
96 | return result; | 96 | return result; |
diff --git a/apps/codecs/liba52/bitstream.h b/apps/codecs/liba52/bitstream.h index c316a971b5..56de1571b7 100644 --- a/apps/codecs/liba52/bitstream.h +++ b/apps/codecs/liba52/bitstream.h | |||
@@ -30,11 +30,11 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); | |||
30 | static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) | 30 | static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) |
31 | { | 31 | { |
32 | uint32_t result; | 32 | uint32_t result; |
33 | 33 | ||
34 | if (num_bits < state->bits_left) { | 34 | if (num_bits < state->bits_left) { |
35 | result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); | 35 | result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); |
36 | state->bits_left -= num_bits; | 36 | state->bits_left -= num_bits; |
37 | return result; | 37 | return result; |
38 | } | 38 | } |
39 | 39 | ||
40 | return a52_bitstream_get_bh (state, num_bits); | 40 | return a52_bitstream_get_bh (state, num_bits); |
@@ -43,11 +43,11 @@ static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) | |||
43 | static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) | 43 | static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) |
44 | { | 44 | { |
45 | int32_t result; | 45 | int32_t result; |
46 | 46 | ||
47 | if (num_bits < state->bits_left) { | 47 | if (num_bits < state->bits_left) { |
48 | result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); | 48 | result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); |
49 | state->bits_left -= num_bits; | 49 | state->bits_left -= num_bits; |
50 | return result; | 50 | return result; |
51 | } | 51 | } |
52 | 52 | ||
53 | return a52_bitstream_get_bh_2 (state, num_bits); | 53 | return a52_bitstream_get_bh_2 (state, num_bits); |
diff --git a/apps/codecs/liba52/downmix.c b/apps/codecs/liba52/downmix.c index b9506de8c1..dd2867cb92 100644 --- a/apps/codecs/liba52/downmix.c +++ b/apps/codecs/liba52/downmix.c | |||
@@ -32,135 +32,135 @@ | |||
32 | #define CONVERT(acmod,output) (((output) << 3) + (acmod)) | 32 | #define CONVERT(acmod,output) (((output) << 3) + (acmod)) |
33 | 33 | ||
34 | int a52_downmix_init (int input, int flags, level_t * level, | 34 | int a52_downmix_init (int input, int flags, level_t * level, |
35 | level_t clev, level_t slev) | 35 | level_t clev, level_t slev) |
36 | { | 36 | { |
37 | static uint8_t table[11][8] = { | 37 | static uint8_t table[11][8] = { |
38 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, | 38 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, |
39 | A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, | 39 | A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, |
40 | {A52_MONO, A52_MONO, A52_MONO, A52_MONO, | 40 | {A52_MONO, A52_MONO, A52_MONO, A52_MONO, |
41 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, | 41 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, |
42 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, | 42 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, |
43 | A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, | 43 | A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, |
44 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, | 44 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, |
45 | A52_STEREO, A52_3F, A52_STEREO, A52_3F}, | 45 | A52_STEREO, A52_3F, A52_STEREO, A52_3F}, |
46 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, | 46 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, |
47 | A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, | 47 | A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, |
48 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, | 48 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, |
49 | A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, | 49 | A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, |
50 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, | 50 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, |
51 | A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, | 51 | A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, |
52 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, | 52 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, |
53 | A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, | 53 | A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, |
54 | {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, | 54 | {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, |
55 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, | 55 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, |
56 | {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, | 56 | {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, |
57 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, | 57 | A52_MONO, A52_MONO, A52_MONO, A52_MONO}, |
58 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, | 58 | {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, |
59 | A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} | 59 | A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} |
60 | }; | 60 | }; |
61 | int output; | 61 | int output; |
62 | 62 | ||
63 | output = flags & A52_CHANNEL_MASK; | 63 | output = flags & A52_CHANNEL_MASK; |
64 | if (output > A52_DOLBY) | 64 | if (output > A52_DOLBY) |
65 | return -1; | 65 | return -1; |
66 | 66 | ||
67 | output = table[output][input & 7]; | 67 | output = table[output][input & 7]; |
68 | 68 | ||
69 | if (output == A52_STEREO && | 69 | if (output == A52_STEREO && |
70 | (input == A52_DOLBY || (input == A52_3F && clev == LEVEL (LEVEL_3DB)))) | 70 | (input == A52_DOLBY || (input == A52_3F && clev == LEVEL (LEVEL_3DB)))) |
71 | output = A52_DOLBY; | 71 | output = A52_DOLBY; |
72 | 72 | ||
73 | if (flags & A52_ADJUST_LEVEL) { | 73 | if (flags & A52_ADJUST_LEVEL) { |
74 | level_t adjust; | 74 | level_t adjust; |
75 | 75 | ||
76 | switch (CONVERT (input & 7, output)) { | 76 | switch (CONVERT (input & 7, output)) { |
77 | 77 | ||
78 | case CONVERT (A52_3F, A52_MONO): | 78 | case CONVERT (A52_3F, A52_MONO): |
79 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev); | 79 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev); |
80 | break; | 80 | break; |
81 | 81 | ||
82 | case CONVERT (A52_STEREO, A52_MONO): | 82 | case CONVERT (A52_STEREO, A52_MONO): |
83 | case CONVERT (A52_2F2R, A52_2F1R): | 83 | case CONVERT (A52_2F2R, A52_2F1R): |
84 | case CONVERT (A52_3F2R, A52_3F1R): | 84 | case CONVERT (A52_3F2R, A52_3F1R): |
85 | level_3db: | 85 | level_3db: |
86 | adjust = LEVEL (LEVEL_3DB); | 86 | adjust = LEVEL (LEVEL_3DB); |
87 | break; | 87 | break; |
88 | 88 | ||
89 | case CONVERT (A52_3F2R, A52_2F1R): | 89 | case CONVERT (A52_3F2R, A52_2F1R): |
90 | if (clev < LEVEL (LEVEL_PLUS3DB - 1)) | 90 | if (clev < LEVEL (LEVEL_PLUS3DB - 1)) |
91 | goto level_3db; | 91 | goto level_3db; |
92 | /* break thru */ | 92 | /* break thru */ |
93 | case CONVERT (A52_3F, A52_STEREO): | 93 | case CONVERT (A52_3F, A52_STEREO): |
94 | case CONVERT (A52_3F1R, A52_2F1R): | 94 | case CONVERT (A52_3F1R, A52_2F1R): |
95 | case CONVERT (A52_3F1R, A52_2F2R): | 95 | case CONVERT (A52_3F1R, A52_2F2R): |
96 | case CONVERT (A52_3F2R, A52_2F2R): | 96 | case CONVERT (A52_3F2R, A52_2F2R): |
97 | adjust = DIV (1, LEVEL (1) + clev); | 97 | adjust = DIV (1, LEVEL (1) + clev); |
98 | break; | 98 | break; |
99 | 99 | ||
100 | case CONVERT (A52_2F1R, A52_MONO): | 100 | case CONVERT (A52_2F1R, A52_MONO): |
101 | adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev); | 101 | adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev); |
102 | break; | 102 | break; |
103 | 103 | ||
104 | case CONVERT (A52_2F1R, A52_STEREO): | 104 | case CONVERT (A52_2F1R, A52_STEREO): |
105 | case CONVERT (A52_3F1R, A52_3F): | 105 | case CONVERT (A52_3F1R, A52_3F): |
106 | adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB)); | 106 | adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB)); |
107 | break; | 107 | break; |
108 | 108 | ||
109 | case CONVERT (A52_3F1R, A52_MONO): | 109 | case CONVERT (A52_3F1R, A52_MONO): |
110 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5)); | 110 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5)); |
111 | break; | 111 | break; |
112 | 112 | ||
113 | case CONVERT (A52_3F1R, A52_STEREO): | 113 | case CONVERT (A52_3F1R, A52_STEREO): |
114 | adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB)); | 114 | adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB)); |
115 | break; | 115 | break; |
116 | 116 | ||
117 | case CONVERT (A52_2F2R, A52_MONO): | 117 | case CONVERT (A52_2F2R, A52_MONO): |
118 | adjust = DIV (LEVEL_3DB, LEVEL (1) + slev); | 118 | adjust = DIV (LEVEL_3DB, LEVEL (1) + slev); |
119 | break; | 119 | break; |
120 | 120 | ||
121 | case CONVERT (A52_2F2R, A52_STEREO): | 121 | case CONVERT (A52_2F2R, A52_STEREO): |
122 | case CONVERT (A52_3F2R, A52_3F): | 122 | case CONVERT (A52_3F2R, A52_3F): |
123 | adjust = DIV (1, LEVEL (1) + slev); | 123 | adjust = DIV (1, LEVEL (1) + slev); |
124 | break; | 124 | break; |
125 | 125 | ||
126 | case CONVERT (A52_3F2R, A52_MONO): | 126 | case CONVERT (A52_3F2R, A52_MONO): |
127 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev); | 127 | adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev); |
128 | break; | 128 | break; |
129 | 129 | ||
130 | case CONVERT (A52_3F2R, A52_STEREO): | 130 | case CONVERT (A52_3F2R, A52_STEREO): |
131 | adjust = DIV (1, LEVEL (1) + clev + slev); | 131 | adjust = DIV (1, LEVEL (1) + clev + slev); |
132 | break; | 132 | break; |
133 | 133 | ||
134 | case CONVERT (A52_MONO, A52_DOLBY): | 134 | case CONVERT (A52_MONO, A52_DOLBY): |
135 | adjust = LEVEL (LEVEL_PLUS3DB); | 135 | adjust = LEVEL (LEVEL_PLUS3DB); |
136 | break; | 136 | break; |
137 | 137 | ||
138 | case CONVERT (A52_3F, A52_DOLBY): | 138 | case CONVERT (A52_3F, A52_DOLBY): |
139 | case CONVERT (A52_2F1R, A52_DOLBY): | 139 | case CONVERT (A52_2F1R, A52_DOLBY): |
140 | adjust = LEVEL (1 / (1 + LEVEL_3DB)); | 140 | adjust = LEVEL (1 / (1 + LEVEL_3DB)); |
141 | break; | 141 | break; |
142 | 142 | ||
143 | case CONVERT (A52_3F1R, A52_DOLBY): | 143 | case CONVERT (A52_3F1R, A52_DOLBY): |
144 | case CONVERT (A52_2F2R, A52_DOLBY): | 144 | case CONVERT (A52_2F2R, A52_DOLBY): |
145 | adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB)); | 145 | adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB)); |
146 | break; | 146 | break; |
147 | 147 | ||
148 | case CONVERT (A52_3F2R, A52_DOLBY): | 148 | case CONVERT (A52_3F2R, A52_DOLBY): |
149 | adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB)); | 149 | adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB)); |
150 | break; | 150 | break; |
151 | 151 | ||
152 | default: | 152 | default: |
153 | return output; | 153 | return output; |
154 | } | 154 | } |
155 | 155 | ||
156 | *level = MUL_L (*level, adjust); | 156 | *level = MUL_L (*level, adjust); |
157 | } | 157 | } |
158 | 158 | ||
159 | return output; | 159 | return output; |
160 | } | 160 | } |
161 | 161 | ||
162 | int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, | 162 | int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, |
163 | level_t clev, level_t slev) | 163 | level_t clev, level_t slev) |
164 | { | 164 | { |
165 | level_t level_3db; | 165 | level_t level_3db; |
166 | 166 | ||
@@ -177,153 +177,153 @@ int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, | |||
177 | case CONVERT (A52_2F2R, A52_2F2R): | 177 | case CONVERT (A52_2F2R, A52_2F2R): |
178 | case CONVERT (A52_3F2R, A52_3F2R): | 178 | case CONVERT (A52_3F2R, A52_3F2R): |
179 | case CONVERT (A52_STEREO, A52_DOLBY): | 179 | case CONVERT (A52_STEREO, A52_DOLBY): |
180 | coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; | 180 | coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; |
181 | return 0; | 181 | return 0; |
182 | 182 | ||
183 | case CONVERT (A52_CHANNEL, A52_MONO): | 183 | case CONVERT (A52_CHANNEL, A52_MONO): |
184 | coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB); | 184 | coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB); |
185 | return 3; | 185 | return 3; |
186 | 186 | ||
187 | case CONVERT (A52_STEREO, A52_MONO): | 187 | case CONVERT (A52_STEREO, A52_MONO): |
188 | coeff[0] = coeff[1] = level_3db; | 188 | coeff[0] = coeff[1] = level_3db; |
189 | return 3; | 189 | return 3; |
190 | 190 | ||
191 | case CONVERT (A52_3F, A52_MONO): | 191 | case CONVERT (A52_3F, A52_MONO): |
192 | coeff[0] = coeff[2] = level_3db; | 192 | coeff[0] = coeff[2] = level_3db; |
193 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); | 193 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); |
194 | return 7; | 194 | return 7; |
195 | 195 | ||
196 | case CONVERT (A52_2F1R, A52_MONO): | 196 | case CONVERT (A52_2F1R, A52_MONO): |
197 | coeff[0] = coeff[1] = level_3db; | 197 | coeff[0] = coeff[1] = level_3db; |
198 | coeff[2] = MUL_L (level_3db, slev); | 198 | coeff[2] = MUL_L (level_3db, slev); |
199 | return 7; | 199 | return 7; |
200 | 200 | ||
201 | case CONVERT (A52_2F2R, A52_MONO): | 201 | case CONVERT (A52_2F2R, A52_MONO): |
202 | coeff[0] = coeff[1] = level_3db; | 202 | coeff[0] = coeff[1] = level_3db; |
203 | coeff[2] = coeff[3] = MUL_L (level_3db, slev); | 203 | coeff[2] = coeff[3] = MUL_L (level_3db, slev); |
204 | return 15; | 204 | return 15; |
205 | 205 | ||
206 | case CONVERT (A52_3F1R, A52_MONO): | 206 | case CONVERT (A52_3F1R, A52_MONO): |
207 | coeff[0] = coeff[2] = level_3db; | 207 | coeff[0] = coeff[2] = level_3db; |
208 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); | 208 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); |
209 | coeff[3] = MUL_L (level_3db, slev); | 209 | coeff[3] = MUL_L (level_3db, slev); |
210 | return 15; | 210 | return 15; |
211 | 211 | ||
212 | case CONVERT (A52_3F2R, A52_MONO): | 212 | case CONVERT (A52_3F2R, A52_MONO): |
213 | coeff[0] = coeff[2] = level_3db; | 213 | coeff[0] = coeff[2] = level_3db; |
214 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); | 214 | coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); |
215 | coeff[3] = coeff[4] = MUL_L (level_3db, slev); | 215 | coeff[3] = coeff[4] = MUL_L (level_3db, slev); |
216 | return 31; | 216 | return 31; |
217 | 217 | ||
218 | case CONVERT (A52_MONO, A52_DOLBY): | 218 | case CONVERT (A52_MONO, A52_DOLBY): |
219 | coeff[0] = level_3db; | 219 | coeff[0] = level_3db; |
220 | return 0; | 220 | return 0; |
221 | 221 | ||
222 | case CONVERT (A52_3F, A52_DOLBY): | 222 | case CONVERT (A52_3F, A52_DOLBY): |
223 | coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; | 223 | coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; |
224 | coeff[1] = level_3db; | 224 | coeff[1] = level_3db; |
225 | return 7; | 225 | return 7; |
226 | 226 | ||
227 | case CONVERT (A52_3F, A52_STEREO): | 227 | case CONVERT (A52_3F, A52_STEREO): |
228 | case CONVERT (A52_3F1R, A52_2F1R): | 228 | case CONVERT (A52_3F1R, A52_2F1R): |
229 | case CONVERT (A52_3F2R, A52_2F2R): | 229 | case CONVERT (A52_3F2R, A52_2F2R): |
230 | coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; | 230 | coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; |
231 | coeff[1] = MUL_L (level, clev); | 231 | coeff[1] = MUL_L (level, clev); |
232 | return 7; | 232 | return 7; |
233 | 233 | ||
234 | case CONVERT (A52_2F1R, A52_DOLBY): | 234 | case CONVERT (A52_2F1R, A52_DOLBY): |
235 | coeff[0] = coeff[1] = level; | 235 | coeff[0] = coeff[1] = level; |
236 | coeff[2] = level_3db; | 236 | coeff[2] = level_3db; |
237 | return 7; | 237 | return 7; |
238 | 238 | ||
239 | case CONVERT (A52_2F1R, A52_STEREO): | 239 | case CONVERT (A52_2F1R, A52_STEREO): |
240 | coeff[0] = coeff[1] = level; | 240 | coeff[0] = coeff[1] = level; |
241 | coeff[2] = MUL_L (level_3db, slev); | 241 | coeff[2] = MUL_L (level_3db, slev); |
242 | return 7; | 242 | return 7; |
243 | 243 | ||
244 | case CONVERT (A52_3F1R, A52_DOLBY): | 244 | case CONVERT (A52_3F1R, A52_DOLBY): |
245 | coeff[0] = coeff[2] = level; | 245 | coeff[0] = coeff[2] = level; |
246 | coeff[1] = coeff[3] = level_3db; | 246 | coeff[1] = coeff[3] = level_3db; |
247 | return 15; | 247 | return 15; |
248 | 248 | ||
249 | case CONVERT (A52_3F1R, A52_STEREO): | 249 | case CONVERT (A52_3F1R, A52_STEREO): |
250 | coeff[0] = coeff[2] = level; | 250 | coeff[0] = coeff[2] = level; |
251 | coeff[1] = MUL_L (level, clev); | 251 | coeff[1] = MUL_L (level, clev); |
252 | coeff[3] = MUL_L (level_3db, slev); | 252 | coeff[3] = MUL_L (level_3db, slev); |
253 | return 15; | 253 | return 15; |
254 | 254 | ||
255 | case CONVERT (A52_2F2R, A52_DOLBY): | 255 | case CONVERT (A52_2F2R, A52_DOLBY): |
256 | coeff[0] = coeff[1] = level; | 256 | coeff[0] = coeff[1] = level; |
257 | coeff[2] = coeff[3] = level_3db; | 257 | coeff[2] = coeff[3] = level_3db; |
258 | return 15; | 258 | return 15; |
259 | 259 | ||
260 | case CONVERT (A52_2F2R, A52_STEREO): | 260 | case CONVERT (A52_2F2R, A52_STEREO): |
261 | coeff[0] = coeff[1] = level; | 261 | coeff[0] = coeff[1] = level; |
262 | coeff[2] = coeff[3] = MUL_L (level, slev); | 262 | coeff[2] = coeff[3] = MUL_L (level, slev); |
263 | return 15; | 263 | return 15; |
264 | 264 | ||
265 | case CONVERT (A52_3F2R, A52_DOLBY): | 265 | case CONVERT (A52_3F2R, A52_DOLBY): |
266 | coeff[0] = coeff[2] = level; | 266 | coeff[0] = coeff[2] = level; |
267 | coeff[1] = coeff[3] = coeff[4] = level_3db; | 267 | coeff[1] = coeff[3] = coeff[4] = level_3db; |
268 | return 31; | 268 | return 31; |
269 | 269 | ||
270 | case CONVERT (A52_3F2R, A52_2F1R): | 270 | case CONVERT (A52_3F2R, A52_2F1R): |
271 | coeff[0] = coeff[2] = level; | 271 | coeff[0] = coeff[2] = level; |
272 | coeff[1] = MUL_L (level, clev); | 272 | coeff[1] = MUL_L (level, clev); |
273 | coeff[3] = coeff[4] = level_3db; | 273 | coeff[3] = coeff[4] = level_3db; |
274 | return 31; | 274 | return 31; |
275 | 275 | ||
276 | case CONVERT (A52_3F2R, A52_STEREO): | 276 | case CONVERT (A52_3F2R, A52_STEREO): |
277 | coeff[0] = coeff[2] = level; | 277 | coeff[0] = coeff[2] = level; |
278 | coeff[1] = MUL_L (level, clev); | 278 | coeff[1] = MUL_L (level, clev); |
279 | coeff[3] = coeff[4] = MUL_L (level, slev); | 279 | coeff[3] = coeff[4] = MUL_L (level, slev); |
280 | return 31; | 280 | return 31; |
281 | 281 | ||
282 | case CONVERT (A52_3F1R, A52_3F): | 282 | case CONVERT (A52_3F1R, A52_3F): |
283 | coeff[0] = coeff[1] = coeff[2] = level; | 283 | coeff[0] = coeff[1] = coeff[2] = level; |
284 | coeff[3] = MUL_L (level_3db, slev); | 284 | coeff[3] = MUL_L (level_3db, slev); |
285 | return 13; | 285 | return 13; |
286 | 286 | ||
287 | case CONVERT (A52_3F2R, A52_3F): | 287 | case CONVERT (A52_3F2R, A52_3F): |
288 | coeff[0] = coeff[1] = coeff[2] = level; | 288 | coeff[0] = coeff[1] = coeff[2] = level; |
289 | coeff[3] = coeff[4] = MUL_L (level, slev); | 289 | coeff[3] = coeff[4] = MUL_L (level, slev); |
290 | return 29; | 290 | return 29; |
291 | 291 | ||
292 | case CONVERT (A52_2F2R, A52_2F1R): | 292 | case CONVERT (A52_2F2R, A52_2F1R): |
293 | coeff[0] = coeff[1] = level; | 293 | coeff[0] = coeff[1] = level; |
294 | coeff[2] = coeff[3] = level_3db; | 294 | coeff[2] = coeff[3] = level_3db; |
295 | return 12; | 295 | return 12; |
296 | 296 | ||
297 | case CONVERT (A52_3F2R, A52_3F1R): | 297 | case CONVERT (A52_3F2R, A52_3F1R): |
298 | coeff[0] = coeff[1] = coeff[2] = level; | 298 | coeff[0] = coeff[1] = coeff[2] = level; |
299 | coeff[3] = coeff[4] = level_3db; | 299 | coeff[3] = coeff[4] = level_3db; |
300 | return 24; | 300 | return 24; |
301 | 301 | ||
302 | case CONVERT (A52_2F1R, A52_2F2R): | 302 | case CONVERT (A52_2F1R, A52_2F2R): |
303 | coeff[0] = coeff[1] = level; | 303 | coeff[0] = coeff[1] = level; |
304 | coeff[2] = level_3db; | 304 | coeff[2] = level_3db; |
305 | return 0; | 305 | return 0; |
306 | 306 | ||
307 | case CONVERT (A52_3F1R, A52_2F2R): | 307 | case CONVERT (A52_3F1R, A52_2F2R): |
308 | coeff[0] = coeff[2] = level; | 308 | coeff[0] = coeff[2] = level; |
309 | coeff[1] = MUL_L (level, clev); | 309 | coeff[1] = MUL_L (level, clev); |
310 | coeff[3] = level_3db; | 310 | coeff[3] = level_3db; |
311 | return 7; | 311 | return 7; |
312 | 312 | ||
313 | case CONVERT (A52_3F1R, A52_3F2R): | 313 | case CONVERT (A52_3F1R, A52_3F2R): |
314 | coeff[0] = coeff[1] = coeff[2] = level; | 314 | coeff[0] = coeff[1] = coeff[2] = level; |
315 | coeff[3] = level_3db; | 315 | coeff[3] = level_3db; |
316 | return 0; | 316 | return 0; |
317 | 317 | ||
318 | case CONVERT (A52_CHANNEL, A52_CHANNEL1): | 318 | case CONVERT (A52_CHANNEL, A52_CHANNEL1): |
319 | coeff[0] = level; | 319 | coeff[0] = level; |
320 | coeff[1] = 0; | 320 | coeff[1] = 0; |
321 | return 0; | 321 | return 0; |
322 | 322 | ||
323 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): | 323 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): |
324 | coeff[0] = 0; | 324 | coeff[0] = 0; |
325 | coeff[1] = level; | 325 | coeff[1] = level; |
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
328 | 328 | ||
329 | return -1; /* NOTREACHED */ | 329 | return -1; /* NOTREACHED */ |
@@ -334,7 +334,7 @@ static void mix2to1 (sample_t * dest, sample_t * src) | |||
334 | int i; | 334 | int i; |
335 | 335 | ||
336 | for (i = 0; i < 256; i++) | 336 | for (i = 0; i < 256; i++) |
337 | dest[i] += BIAS (src[i]); | 337 | dest[i] += BIAS (src[i]); |
338 | } | 338 | } |
339 | 339 | ||
340 | static void mix3to1 (sample_t * samples) | 340 | static void mix3to1 (sample_t * samples) |
@@ -342,7 +342,7 @@ static void mix3to1 (sample_t * samples) | |||
342 | int i; | 342 | int i; |
343 | 343 | ||
344 | for (i = 0; i < 256; i++) | 344 | for (i = 0; i < 256; i++) |
345 | samples[i] += BIAS (samples[i + 256] + samples[i + 512]); | 345 | samples[i] += BIAS (samples[i + 256] + samples[i + 512]); |
346 | } | 346 | } |
347 | 347 | ||
348 | static void mix4to1 (sample_t * samples) | 348 | static void mix4to1 (sample_t * samples) |
@@ -350,8 +350,8 @@ static void mix4to1 (sample_t * samples) | |||
350 | int i; | 350 | int i; |
351 | 351 | ||
352 | for (i = 0; i < 256; i++) | 352 | for (i = 0; i < 256; i++) |
353 | samples[i] += BIAS (samples[i + 256] + samples[i + 512] + | 353 | samples[i] += BIAS (samples[i + 256] + samples[i + 512] + |
354 | samples[i + 768]); | 354 | samples[i + 768]); |
355 | } | 355 | } |
356 | 356 | ||
357 | static void mix5to1 (sample_t * samples) | 357 | static void mix5to1 (sample_t * samples) |
@@ -359,8 +359,8 @@ static void mix5to1 (sample_t * samples) | |||
359 | int i; | 359 | int i; |
360 | 360 | ||
361 | for (i = 0; i < 256; i++) | 361 | for (i = 0; i < 256; i++) |
362 | samples[i] += BIAS (samples[i + 256] + samples[i + 512] + | 362 | samples[i] += BIAS (samples[i + 256] + samples[i + 512] + |
363 | samples[i + 768] + samples[i + 1024]); | 363 | samples[i + 768] + samples[i + 1024]); |
364 | } | 364 | } |
365 | 365 | ||
366 | static void mix3to2 (sample_t * samples) | 366 | static void mix3to2 (sample_t * samples) |
@@ -369,9 +369,9 @@ static void mix3to2 (sample_t * samples) | |||
369 | sample_t common; | 369 | sample_t common; |
370 | 370 | ||
371 | for (i = 0; i < 256; i++) { | 371 | for (i = 0; i < 256; i++) { |
372 | common = BIAS (samples[i + 256]); | 372 | common = BIAS (samples[i + 256]); |
373 | samples[i] += common; | 373 | samples[i] += common; |
374 | samples[i + 256] = samples[i + 512] + common; | 374 | samples[i + 256] = samples[i + 512] + common; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
@@ -381,9 +381,9 @@ static void mix21to2 (sample_t * left, sample_t * right) | |||
381 | sample_t common; | 381 | sample_t common; |
382 | 382 | ||
383 | for (i = 0; i < 256; i++) { | 383 | for (i = 0; i < 256; i++) { |
384 | common = BIAS (right[i + 256]); | 384 | common = BIAS (right[i + 256]); |
385 | left[i] += common; | 385 | left[i] += common; |
386 | right[i] += common; | 386 | right[i] += common; |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
@@ -393,9 +393,9 @@ static void mix21toS (sample_t * samples) | |||
393 | sample_t surround; | 393 | sample_t surround; |
394 | 394 | ||
395 | for (i = 0; i < 256; i++) { | 395 | for (i = 0; i < 256; i++) { |
396 | surround = samples[i + 512]; | 396 | surround = samples[i + 512]; |
397 | samples[i] += BIAS (-surround); | 397 | samples[i] += BIAS (-surround); |
398 | samples[i + 256] += BIAS (surround); | 398 | samples[i + 256] += BIAS (surround); |
399 | } | 399 | } |
400 | } | 400 | } |
401 | 401 | ||
@@ -405,9 +405,9 @@ static void mix31to2 (sample_t * samples) | |||
405 | sample_t common; | 405 | sample_t common; |
406 | 406 | ||
407 | for (i = 0; i < 256; i++) { | 407 | for (i = 0; i < 256; i++) { |
408 | common = BIAS (samples[i + 256] + samples[i + 768]); | 408 | common = BIAS (samples[i + 256] + samples[i + 768]); |
409 | samples[i] += common; | 409 | samples[i] += common; |
410 | samples[i + 256] = samples[i + 512] + common; | 410 | samples[i + 256] = samples[i + 512] + common; |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
@@ -417,10 +417,10 @@ static void mix31toS (sample_t * samples) | |||
417 | sample_t common, surround; | 417 | sample_t common, surround; |
418 | 418 | ||
419 | for (i = 0; i < 256; i++) { | 419 | for (i = 0; i < 256; i++) { |
420 | common = BIAS (samples[i + 256]); | 420 | common = BIAS (samples[i + 256]); |
421 | surround = samples[i + 768]; | 421 | surround = samples[i + 768]; |
422 | samples[i] += common - surround; | 422 | samples[i] += common - surround; |
423 | samples[i + 256] = samples[i + 512] + common + surround; | 423 | samples[i + 256] = samples[i + 512] + common + surround; |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
@@ -430,9 +430,9 @@ static void mix22toS (sample_t * samples) | |||
430 | sample_t surround; | 430 | sample_t surround; |
431 | 431 | ||
432 | for (i = 0; i < 256; i++) { | 432 | for (i = 0; i < 256; i++) { |
433 | surround = samples[i + 512] + samples[i + 768]; | 433 | surround = samples[i + 512] + samples[i + 768]; |
434 | samples[i] += BIAS (-surround); | 434 | samples[i] += BIAS (-surround); |
435 | samples[i + 256] += BIAS (surround); | 435 | samples[i + 256] += BIAS (surround); |
436 | } | 436 | } |
437 | } | 437 | } |
438 | 438 | ||
@@ -442,9 +442,9 @@ static void mix32to2 (sample_t * samples) | |||
442 | sample_t common; | 442 | sample_t common; |
443 | 443 | ||
444 | for (i = 0; i < 256; i++) { | 444 | for (i = 0; i < 256; i++) { |
445 | common = BIAS (samples[i + 256]); | 445 | common = BIAS (samples[i + 256]); |
446 | samples[i] += common + samples[i + 768]; | 446 | samples[i] += common + samples[i + 768]; |
447 | samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; | 447 | samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
@@ -454,10 +454,10 @@ static void mix32toS (sample_t * samples) | |||
454 | sample_t common, surround; | 454 | sample_t common, surround; |
455 | 455 | ||
456 | for (i = 0; i < 256; i++) { | 456 | for (i = 0; i < 256; i++) { |
457 | common = BIAS (samples[i + 256]); | 457 | common = BIAS (samples[i + 256]); |
458 | surround = samples[i + 768] + samples[i + 1024]; | 458 | surround = samples[i + 768] + samples[i + 1024]; |
459 | samples[i] += common - surround; | 459 | samples[i] += common - surround; |
460 | samples[i + 256] = samples[i + 512] + common + surround; | 460 | samples[i + 256] = samples[i + 512] + common + surround; |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
@@ -466,7 +466,7 @@ static void move2to1 (sample_t * src, sample_t * dest) | |||
466 | int i; | 466 | int i; |
467 | 467 | ||
468 | for (i = 0; i < 256; i++) | 468 | for (i = 0; i < 256; i++) |
469 | dest[i] = BIAS (src[i] + src[i + 256]); | 469 | dest[i] = BIAS (src[i] + src[i + 256]); |
470 | } | 470 | } |
471 | 471 | ||
472 | static void zero (sample_t * samples) | 472 | static void zero (sample_t * samples) |
@@ -474,11 +474,11 @@ static void zero (sample_t * samples) | |||
474 | int i; | 474 | int i; |
475 | 475 | ||
476 | for (i = 0; i < 256; i++) | 476 | for (i = 0; i < 256; i++) |
477 | samples[i] = 0; | 477 | samples[i] = 0; |
478 | } | 478 | } |
479 | 479 | ||
480 | void a52_downmix (sample_t * samples, int acmod, int output, | 480 | void a52_downmix (sample_t * samples, int acmod, int output, |
481 | level_t clev, level_t slev) | 481 | level_t clev, level_t slev) |
482 | { | 482 | { |
483 | /* avoid compiler warning */ | 483 | /* avoid compiler warning */ |
484 | (void)clev; | 484 | (void)clev; |
@@ -486,138 +486,138 @@ void a52_downmix (sample_t * samples, int acmod, int output, | |||
486 | switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { | 486 | switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { |
487 | 487 | ||
488 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): | 488 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): |
489 | memcpy (samples, samples + 256, 256 * sizeof (sample_t)); | 489 | memcpy (samples, samples + 256, 256 * sizeof (sample_t)); |
490 | break; | 490 | break; |
491 | 491 | ||
492 | case CONVERT (A52_CHANNEL, A52_MONO): | 492 | case CONVERT (A52_CHANNEL, A52_MONO): |
493 | case CONVERT (A52_STEREO, A52_MONO): | 493 | case CONVERT (A52_STEREO, A52_MONO): |
494 | mix_2to1: | 494 | mix_2to1: |
495 | mix2to1 (samples, samples + 256); | 495 | mix2to1 (samples, samples + 256); |
496 | break; | 496 | break; |
497 | 497 | ||
498 | case CONVERT (A52_2F1R, A52_MONO): | 498 | case CONVERT (A52_2F1R, A52_MONO): |
499 | if (slev == 0) | 499 | if (slev == 0) |
500 | goto mix_2to1; | 500 | goto mix_2to1; |
501 | case CONVERT (A52_3F, A52_MONO): | 501 | case CONVERT (A52_3F, A52_MONO): |
502 | mix_3to1: | 502 | mix_3to1: |
503 | mix3to1 (samples); | 503 | mix3to1 (samples); |
504 | break; | 504 | break; |
505 | 505 | ||
506 | case CONVERT (A52_3F1R, A52_MONO): | 506 | case CONVERT (A52_3F1R, A52_MONO): |
507 | if (slev == 0) | 507 | if (slev == 0) |
508 | goto mix_3to1; | 508 | goto mix_3to1; |
509 | case CONVERT (A52_2F2R, A52_MONO): | 509 | case CONVERT (A52_2F2R, A52_MONO): |
510 | if (slev == 0) | 510 | if (slev == 0) |
511 | goto mix_2to1; | 511 | goto mix_2to1; |
512 | mix4to1 (samples); | 512 | mix4to1 (samples); |
513 | break; | 513 | break; |
514 | 514 | ||
515 | case CONVERT (A52_3F2R, A52_MONO): | 515 | case CONVERT (A52_3F2R, A52_MONO): |
516 | if (slev == 0) | 516 | if (slev == 0) |
517 | goto mix_3to1; | 517 | goto mix_3to1; |
518 | mix5to1 (samples); | 518 | mix5to1 (samples); |
519 | break; | 519 | break; |
520 | 520 | ||
521 | case CONVERT (A52_MONO, A52_DOLBY): | 521 | case CONVERT (A52_MONO, A52_DOLBY): |
522 | memcpy (samples + 256, samples, 256 * sizeof (sample_t)); | 522 | memcpy (samples + 256, samples, 256 * sizeof (sample_t)); |
523 | break; | 523 | break; |
524 | 524 | ||
525 | case CONVERT (A52_3F, A52_STEREO): | 525 | case CONVERT (A52_3F, A52_STEREO): |
526 | case CONVERT (A52_3F, A52_DOLBY): | 526 | case CONVERT (A52_3F, A52_DOLBY): |
527 | mix_3to2: | 527 | mix_3to2: |
528 | mix3to2 (samples); | 528 | mix3to2 (samples); |
529 | break; | 529 | break; |
530 | 530 | ||
531 | case CONVERT (A52_2F1R, A52_STEREO): | 531 | case CONVERT (A52_2F1R, A52_STEREO): |
532 | if (slev == 0) | 532 | if (slev == 0) |
533 | break; | ||
534 | mix21to2 (samples, samples + 256); | ||
533 | break; | 535 | break; |
534 | mix21to2 (samples, samples + 256); | ||
535 | break; | ||
536 | 536 | ||
537 | case CONVERT (A52_2F1R, A52_DOLBY): | 537 | case CONVERT (A52_2F1R, A52_DOLBY): |
538 | mix21toS (samples); | 538 | mix21toS (samples); |
539 | break; | 539 | break; |
540 | 540 | ||
541 | case CONVERT (A52_3F1R, A52_STEREO): | 541 | case CONVERT (A52_3F1R, A52_STEREO): |
542 | if (slev == 0) | 542 | if (slev == 0) |
543 | goto mix_3to2; | 543 | goto mix_3to2; |
544 | mix31to2 (samples); | 544 | mix31to2 (samples); |
545 | break; | 545 | break; |
546 | 546 | ||
547 | case CONVERT (A52_3F1R, A52_DOLBY): | 547 | case CONVERT (A52_3F1R, A52_DOLBY): |
548 | mix31toS (samples); | 548 | mix31toS (samples); |
549 | break; | 549 | break; |
550 | 550 | ||
551 | case CONVERT (A52_2F2R, A52_STEREO): | 551 | case CONVERT (A52_2F2R, A52_STEREO): |
552 | if (slev == 0) | 552 | if (slev == 0) |
553 | break; | ||
554 | mix2to1 (samples, samples + 512); | ||
555 | mix2to1 (samples + 256, samples + 768); | ||
553 | break; | 556 | break; |
554 | mix2to1 (samples, samples + 512); | ||
555 | mix2to1 (samples + 256, samples + 768); | ||
556 | break; | ||
557 | 557 | ||
558 | case CONVERT (A52_2F2R, A52_DOLBY): | 558 | case CONVERT (A52_2F2R, A52_DOLBY): |
559 | mix22toS (samples); | 559 | mix22toS (samples); |
560 | break; | 560 | break; |
561 | 561 | ||
562 | case CONVERT (A52_3F2R, A52_STEREO): | 562 | case CONVERT (A52_3F2R, A52_STEREO): |
563 | if (slev == 0) | 563 | if (slev == 0) |
564 | goto mix_3to2; | 564 | goto mix_3to2; |
565 | mix32to2 (samples); | 565 | mix32to2 (samples); |
566 | break; | 566 | break; |
567 | 567 | ||
568 | case CONVERT (A52_3F2R, A52_DOLBY): | 568 | case CONVERT (A52_3F2R, A52_DOLBY): |
569 | mix32toS (samples); | 569 | mix32toS (samples); |
570 | break; | 570 | break; |
571 | 571 | ||
572 | case CONVERT (A52_3F1R, A52_3F): | 572 | case CONVERT (A52_3F1R, A52_3F): |
573 | if (slev == 0) | 573 | if (slev == 0) |
574 | break; | ||
575 | mix21to2 (samples, samples + 512); | ||
574 | break; | 576 | break; |
575 | mix21to2 (samples, samples + 512); | ||
576 | break; | ||
577 | 577 | ||
578 | case CONVERT (A52_3F2R, A52_3F): | 578 | case CONVERT (A52_3F2R, A52_3F): |
579 | if (slev == 0) | 579 | if (slev == 0) |
580 | break; | ||
581 | mix2to1 (samples, samples + 768); | ||
582 | mix2to1 (samples + 512, samples + 1024); | ||
580 | break; | 583 | break; |
581 | mix2to1 (samples, samples + 768); | ||
582 | mix2to1 (samples + 512, samples + 1024); | ||
583 | break; | ||
584 | 584 | ||
585 | case CONVERT (A52_3F1R, A52_2F1R): | 585 | case CONVERT (A52_3F1R, A52_2F1R): |
586 | mix3to2 (samples); | 586 | mix3to2 (samples); |
587 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); | 587 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); |
588 | break; | 588 | break; |
589 | 589 | ||
590 | case CONVERT (A52_2F2R, A52_2F1R): | 590 | case CONVERT (A52_2F2R, A52_2F1R): |
591 | mix2to1 (samples + 512, samples + 768); | 591 | mix2to1 (samples + 512, samples + 768); |
592 | break; | 592 | break; |
593 | 593 | ||
594 | case CONVERT (A52_3F2R, A52_2F1R): | 594 | case CONVERT (A52_3F2R, A52_2F1R): |
595 | mix3to2 (samples); | 595 | mix3to2 (samples); |
596 | move2to1 (samples + 768, samples + 512); | 596 | move2to1 (samples + 768, samples + 512); |
597 | break; | 597 | break; |
598 | 598 | ||
599 | case CONVERT (A52_3F2R, A52_3F1R): | 599 | case CONVERT (A52_3F2R, A52_3F1R): |
600 | mix2to1 (samples + 768, samples + 1024); | 600 | mix2to1 (samples + 768, samples + 1024); |
601 | break; | 601 | break; |
602 | 602 | ||
603 | case CONVERT (A52_2F1R, A52_2F2R): | 603 | case CONVERT (A52_2F1R, A52_2F2R): |
604 | memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); | 604 | memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); |
605 | break; | 605 | break; |
606 | 606 | ||
607 | case CONVERT (A52_3F1R, A52_2F2R): | 607 | case CONVERT (A52_3F1R, A52_2F2R): |
608 | mix3to2 (samples); | 608 | mix3to2 (samples); |
609 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); | 609 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); |
610 | break; | 610 | break; |
611 | 611 | ||
612 | case CONVERT (A52_3F2R, A52_2F2R): | 612 | case CONVERT (A52_3F2R, A52_2F2R): |
613 | mix3to2 (samples); | 613 | mix3to2 (samples); |
614 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); | 614 | memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); |
615 | memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); | 615 | memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); |
616 | break; | 616 | break; |
617 | 617 | ||
618 | case CONVERT (A52_3F1R, A52_3F2R): | 618 | case CONVERT (A52_3F1R, A52_3F2R): |
619 | memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); | 619 | memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); |
620 | break; | 620 | break; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
@@ -626,63 +626,63 @@ void a52_upmix (sample_t * samples, int acmod, int output) | |||
626 | switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { | 626 | switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { |
627 | 627 | ||
628 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): | 628 | case CONVERT (A52_CHANNEL, A52_CHANNEL2): |
629 | memcpy (samples + 256, samples, 256 * sizeof (sample_t)); | 629 | memcpy (samples + 256, samples, 256 * sizeof (sample_t)); |
630 | break; | 630 | break; |
631 | 631 | ||
632 | case CONVERT (A52_3F2R, A52_MONO): | 632 | case CONVERT (A52_3F2R, A52_MONO): |
633 | zero (samples + 1024); | 633 | zero (samples + 1024); |
634 | case CONVERT (A52_3F1R, A52_MONO): | 634 | case CONVERT (A52_3F1R, A52_MONO): |
635 | case CONVERT (A52_2F2R, A52_MONO): | 635 | case CONVERT (A52_2F2R, A52_MONO): |
636 | zero (samples + 768); | 636 | zero (samples + 768); |
637 | case CONVERT (A52_3F, A52_MONO): | 637 | case CONVERT (A52_3F, A52_MONO): |
638 | case CONVERT (A52_2F1R, A52_MONO): | 638 | case CONVERT (A52_2F1R, A52_MONO): |
639 | zero (samples + 512); | 639 | zero (samples + 512); |
640 | case CONVERT (A52_CHANNEL, A52_MONO): | 640 | case CONVERT (A52_CHANNEL, A52_MONO): |
641 | case CONVERT (A52_STEREO, A52_MONO): | 641 | case CONVERT (A52_STEREO, A52_MONO): |
642 | zero (samples + 256); | 642 | zero (samples + 256); |
643 | break; | 643 | break; |
644 | 644 | ||
645 | case CONVERT (A52_3F2R, A52_STEREO): | 645 | case CONVERT (A52_3F2R, A52_STEREO): |
646 | case CONVERT (A52_3F2R, A52_DOLBY): | 646 | case CONVERT (A52_3F2R, A52_DOLBY): |
647 | zero (samples + 1024); | 647 | zero (samples + 1024); |
648 | case CONVERT (A52_3F1R, A52_STEREO): | 648 | case CONVERT (A52_3F1R, A52_STEREO): |
649 | case CONVERT (A52_3F1R, A52_DOLBY): | 649 | case CONVERT (A52_3F1R, A52_DOLBY): |
650 | zero (samples + 768); | 650 | zero (samples + 768); |
651 | case CONVERT (A52_3F, A52_STEREO): | 651 | case CONVERT (A52_3F, A52_STEREO): |
652 | case CONVERT (A52_3F, A52_DOLBY): | 652 | case CONVERT (A52_3F, A52_DOLBY): |
653 | mix_3to2: | 653 | mix_3to2: |
654 | memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); | 654 | memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); |
655 | zero (samples + 256); | 655 | zero (samples + 256); |
656 | break; | 656 | break; |
657 | 657 | ||
658 | case CONVERT (A52_2F2R, A52_STEREO): | 658 | case CONVERT (A52_2F2R, A52_STEREO): |
659 | case CONVERT (A52_2F2R, A52_DOLBY): | 659 | case CONVERT (A52_2F2R, A52_DOLBY): |
660 | zero (samples + 768); | 660 | zero (samples + 768); |
661 | case CONVERT (A52_2F1R, A52_STEREO): | 661 | case CONVERT (A52_2F1R, A52_STEREO): |
662 | case CONVERT (A52_2F1R, A52_DOLBY): | 662 | case CONVERT (A52_2F1R, A52_DOLBY): |
663 | zero (samples + 512); | 663 | zero (samples + 512); |
664 | break; | 664 | break; |
665 | 665 | ||
666 | case CONVERT (A52_3F2R, A52_3F): | 666 | case CONVERT (A52_3F2R, A52_3F): |
667 | zero (samples + 1024); | 667 | zero (samples + 1024); |
668 | case CONVERT (A52_3F1R, A52_3F): | 668 | case CONVERT (A52_3F1R, A52_3F): |
669 | case CONVERT (A52_2F2R, A52_2F1R): | 669 | case CONVERT (A52_2F2R, A52_2F1R): |
670 | zero (samples + 768); | 670 | zero (samples + 768); |
671 | break; | 671 | break; |
672 | 672 | ||
673 | case CONVERT (A52_3F2R, A52_3F1R): | 673 | case CONVERT (A52_3F2R, A52_3F1R): |
674 | zero (samples + 1024); | 674 | zero (samples + 1024); |
675 | break; | 675 | break; |
676 | 676 | ||
677 | case CONVERT (A52_3F2R, A52_2F1R): | 677 | case CONVERT (A52_3F2R, A52_2F1R): |
678 | zero (samples + 1024); | 678 | zero (samples + 1024); |
679 | case CONVERT (A52_3F1R, A52_2F1R): | 679 | case CONVERT (A52_3F1R, A52_2F1R): |
680 | mix_31to21: | 680 | mix_31to21: |
681 | memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); | 681 | memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); |
682 | goto mix_3to2; | 682 | goto mix_3to2; |
683 | 683 | ||
684 | case CONVERT (A52_3F2R, A52_2F2R): | 684 | case CONVERT (A52_3F2R, A52_2F2R): |
685 | memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); | 685 | memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); |
686 | goto mix_31to21; | 686 | goto mix_31to21; |
687 | } | 687 | } |
688 | } | 688 | } |
diff --git a/apps/codecs/liba52/imdct.c b/apps/codecs/liba52/imdct.c index 9aaa9d85ad..e93424c5fa 100644 --- a/apps/codecs/liba52/imdct.c +++ b/apps/codecs/liba52/imdct.c | |||
@@ -114,73 +114,73 @@ static inline void ifft4 (complex_t * buf) | |||
114 | */ | 114 | */ |
115 | /* basic radix-2 ifft butterfly */ | 115 | /* basic radix-2 ifft butterfly */ |
116 | 116 | ||
117 | #define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ | 117 | #define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ |
118 | t0 = MUL (W1, d1) + MUL (W0, d0); \ | 118 | t0 = MUL (W1, d1) + MUL (W0, d0); \ |
119 | t1 = MUL (W0, d1) - MUL (W1, d0); \ | 119 | t1 = MUL (W0, d1) - MUL (W1, d0); \ |
120 | } while (0) | 120 | } while (0) |
121 | 121 | ||
122 | /* radix-2 ifft butterfly with bias */ | 122 | /* radix-2 ifft butterfly with bias */ |
123 | 123 | ||
124 | #define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ | 124 | #define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ |
125 | t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ | 125 | t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ |
126 | t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ | 126 | t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ |
127 | } while (0) | 127 | } while (0) |
128 | 128 | ||
129 | /* the basic split-radix ifft butterfly */ | 129 | /* the basic split-radix ifft butterfly */ |
130 | 130 | ||
131 | #define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ | 131 | #define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ |
132 | BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ | 132 | BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ |
133 | BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ | 133 | BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ |
134 | tmp1 = tmp5 + tmp7; \ | 134 | tmp1 = tmp5 + tmp7; \ |
135 | tmp2 = tmp6 + tmp8; \ | 135 | tmp2 = tmp6 + tmp8; \ |
136 | tmp3 = tmp6 - tmp8; \ | 136 | tmp3 = tmp6 - tmp8; \ |
137 | tmp4 = tmp7 - tmp5; \ | 137 | tmp4 = tmp7 - tmp5; \ |
138 | a2.real = a0.real - tmp1; \ | 138 | a2.real = a0.real - tmp1; \ |
139 | a2.imag = a0.imag - tmp2; \ | 139 | a2.imag = a0.imag - tmp2; \ |
140 | a3.real = a1.real - tmp3; \ | 140 | a3.real = a1.real - tmp3; \ |
141 | a3.imag = a1.imag - tmp4; \ | 141 | a3.imag = a1.imag - tmp4; \ |
142 | a0.real += tmp1; \ | 142 | a0.real += tmp1; \ |
143 | a0.imag += tmp2; \ | 143 | a0.imag += tmp2; \ |
144 | a1.real += tmp3; \ | 144 | a1.real += tmp3; \ |
145 | a1.imag += tmp4; \ | 145 | a1.imag += tmp4; \ |
146 | } while (0) | 146 | } while (0) |
147 | 147 | ||
148 | /* split-radix ifft butterfly, specialized for wr=1 wi=0 */ | 148 | /* split-radix ifft butterfly, specialized for wr=1 wi=0 */ |
149 | 149 | ||
150 | #define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ | 150 | #define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ |
151 | tmp1 = a2.real + a3.real; \ | 151 | tmp1 = a2.real + a3.real; \ |
152 | tmp2 = a2.imag + a3.imag; \ | 152 | tmp2 = a2.imag + a3.imag; \ |
153 | tmp3 = a2.imag - a3.imag; \ | 153 | tmp3 = a2.imag - a3.imag; \ |
154 | tmp4 = a3.real - a2.real; \ | 154 | tmp4 = a3.real - a2.real; \ |
155 | a2.real = a0.real - tmp1; \ | 155 | a2.real = a0.real - tmp1; \ |
156 | a2.imag = a0.imag - tmp2; \ | 156 | a2.imag = a0.imag - tmp2; \ |
157 | a3.real = a1.real - tmp3; \ | 157 | a3.real = a1.real - tmp3; \ |
158 | a3.imag = a1.imag - tmp4; \ | 158 | a3.imag = a1.imag - tmp4; \ |
159 | a0.real += tmp1; \ | 159 | a0.real += tmp1; \ |
160 | a0.imag += tmp2; \ | 160 | a0.imag += tmp2; \ |
161 | a1.real += tmp3; \ | 161 | a1.real += tmp3; \ |
162 | a1.imag += tmp4; \ | 162 | a1.imag += tmp4; \ |
163 | } while (0) | 163 | } while (0) |
164 | 164 | ||
165 | /* split-radix ifft butterfly, specialized for wr=wi */ | 165 | /* split-radix ifft butterfly, specialized for wr=wi */ |
166 | /* | 166 | /* |
167 | #define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ | 167 | #define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ |
168 | tmp5 = MUL (a2.real + a2.imag, w); \ | 168 | tmp5 = MUL (a2.real + a2.imag, w); \ |
169 | tmp6 = MUL (a2.imag - a2.real, w); \ | 169 | tmp6 = MUL (a2.imag - a2.real, w); \ |
170 | tmp7 = MUL (a3.real - a3.imag, w); \ | 170 | tmp7 = MUL (a3.real - a3.imag, w); \ |
171 | tmp8 = MUL (a3.imag + a3.real, w); \ | 171 | tmp8 = MUL (a3.imag + a3.real, w); \ |
172 | tmp1 = tmp5 + tmp7; \ | 172 | tmp1 = tmp5 + tmp7; \ |
173 | tmp2 = tmp6 + tmp8; \ | 173 | tmp2 = tmp6 + tmp8; \ |
174 | tmp3 = tmp6 - tmp8; \ | 174 | tmp3 = tmp6 - tmp8; \ |
175 | tmp4 = tmp7 - tmp5; \ | 175 | tmp4 = tmp7 - tmp5; \ |
176 | a2.real = a0.real - tmp1; \ | 176 | a2.real = a0.real - tmp1; \ |
177 | a2.imag = a0.imag - tmp2; \ | 177 | a2.imag = a0.imag - tmp2; \ |
178 | a3.real = a1.real - tmp3; \ | 178 | a3.real = a1.real - tmp3; \ |
179 | a3.imag = a1.imag - tmp4; \ | 179 | a3.imag = a1.imag - tmp4; \ |
180 | a0.real += tmp1; \ | 180 | a0.real += tmp1; \ |
181 | a0.imag += tmp2; \ | 181 | a0.imag += tmp2; \ |
182 | a1.real += tmp3; \ | 182 | a1.real += tmp3; \ |
183 | a1.imag += tmp4; \ | 183 | a1.imag += tmp4; \ |
184 | } while (0) | 184 | } while (0) |
185 | 185 | ||
186 | static inline void ifft8 (complex_t * buf) | 186 | static inline void ifft8 (complex_t * buf) |
@@ -212,13 +212,13 @@ static void ifft_pass (complex_t * buf, const sample_t * weight, int n) | |||
212 | i = n - 1; | 212 | i = n - 1; |
213 | 213 | ||
214 | do { | 214 | do { |
215 | BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], | 215 | BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], |
216 | weight[0], weight[2*i-n]); | 216 | weight[0], weight[2*i-n]); |
217 | buf++; | 217 | buf++; |
218 | buf1++; | 218 | buf1++; |
219 | buf2++; | 219 | buf2++; |
220 | buf3++; | 220 | buf3++; |
221 | weight++; | 221 | weight++; |
222 | } while (--i); | 222 | } while (--i); |
223 | } | 223 | } |
224 | 224 | ||
@@ -264,7 +264,7 @@ void a52_imdct_512 (sample_t * data, sample_t * delay) | |||
264 | sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; | 264 | sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; |
265 | const sample_t * window = a52_imdct_window; | 265 | const sample_t * window = a52_imdct_window; |
266 | FFTComplex buf[128]; | 266 | FFTComplex buf[128]; |
267 | 267 | ||
268 | for (i = 0; i < 128; i++) { | 268 | for (i = 0; i < 128; i++) { |
269 | k = fftorder[i]; | 269 | k = fftorder[i]; |
270 | t_r = pre1[i].real; | 270 | t_r = pre1[i].real; |
@@ -357,7 +357,7 @@ static double besselI0 (double x) | |||
357 | int i = 100; | 357 | int i = 100; |
358 | 358 | ||
359 | do | 359 | do |
360 | bessel = bessel * x / (i * i) + 1; | 360 | bessel = bessel * x / (i * i) + 1; |
361 | while (--i); | 361 | while (--i); |
362 | return bessel; | 362 | return bessel; |
363 | } | 363 | } |
@@ -376,13 +376,13 @@ void a52_imdct_init (uint32_t mm_accel) | |||
376 | /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ | 376 | /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ |
377 | /* sum = 0; | 377 | /* sum = 0; |
378 | for (i = 0; i < 256; i++) { | 378 | for (i = 0; i < 256; i++) { |
379 | sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); | 379 | sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); |
380 | local_imdct_window[i] = sum; | 380 | local_imdct_window[i] = sum; |
381 | } | 381 | } |
382 | sum++; | 382 | sum++; |
383 | */ | 383 | */ |
384 | /* for (i = 0; i < 256; i++) | 384 | /* for (i = 0; i < 256; i++) |
385 | a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); | 385 | a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); |
386 | 386 | ||
387 | printf("static sample_t a52_imdct_window[256]={"); | 387 | printf("static sample_t a52_imdct_window[256]={"); |
388 | for (i=0;i<256;i++) { | 388 | for (i=0;i<256;i++) { |
@@ -393,26 +393,26 @@ void a52_imdct_init (uint32_t mm_accel) | |||
393 | */ | 393 | */ |
394 | 394 | ||
395 | /* for (i = 0; i < 3; i++) | 395 | /* for (i = 0; i < 3; i++) |
396 | roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); | 396 | roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); |
397 | 397 | ||
398 | printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]); | 398 | printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]); |
399 | 399 | ||
400 | for (i = 0; i < 7; i++) | 400 | for (i = 0; i < 7; i++) |
401 | roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); | 401 | roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); |
402 | 402 | ||
403 | printf("static sample_t roots32[7]={"); | 403 | printf("static sample_t roots32[7]={"); |
404 | for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); } | 404 | for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); } |
405 | printf("};\n"); | 405 | printf("};\n"); |
406 | 406 | ||
407 | for (i = 0; i < 15; i++) | 407 | for (i = 0; i < 15; i++) |
408 | roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); | 408 | roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); |
409 | 409 | ||
410 | printf("static sample_t roots64[15]={"); | 410 | printf("static sample_t roots64[15]={"); |
411 | for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); } | 411 | for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); } |
412 | printf("};\n"); | 412 | printf("};\n"); |
413 | 413 | ||
414 | for (i = 0; i < 31; i++) | 414 | for (i = 0; i < 31; i++) |
415 | roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); | 415 | roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); |
416 | 416 | ||
417 | printf("static sample_t roots128[31]={"); | 417 | printf("static sample_t roots128[31]={"); |
418 | for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); } | 418 | for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); } |
@@ -420,15 +420,15 @@ void a52_imdct_init (uint32_t mm_accel) | |||
420 | */ | 420 | */ |
421 | /* | 421 | /* |
422 | for (i = 0; i < 64; i++) { | 422 | for (i = 0; i < 64; i++) { |
423 | k = fftorder[i] / 2 + 64; | 423 | k = fftorder[i] / 2 + 64; |
424 | pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); | 424 | pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); |
425 | pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); | 425 | pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); |
426 | } | 426 | } |
427 | 427 | ||
428 | for (i = 64; i < 128; i++) { | 428 | for (i = 64; i < 128; i++) { |
429 | k = fftorder[i] / 2 + 64; | 429 | k = fftorder[i] / 2 + 64; |
430 | pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); | 430 | pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); |
431 | pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); | 431 | pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); |
432 | } | 432 | } |
433 | 433 | ||
434 | printf("static complex_t pre1[128]={"); | 434 | printf("static complex_t pre1[128]={"); |
@@ -437,8 +437,8 @@ void a52_imdct_init (uint32_t mm_accel) | |||
437 | */ | 437 | */ |
438 | /* | 438 | /* |
439 | for (i = 0; i < 64; i++) { | 439 | for (i = 0; i < 64; i++) { |
440 | post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); | 440 | post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); |
441 | post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); | 441 | post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); |
442 | } | 442 | } |
443 | 443 | ||
444 | printf("static complex_t post1[64]={"); | 444 | printf("static complex_t post1[64]={"); |
@@ -448,9 +448,9 @@ void a52_imdct_init (uint32_t mm_accel) | |||
448 | 448 | ||
449 | /* | 449 | /* |
450 | for (i = 0; i < 64; i++) { | 450 | for (i = 0; i < 64; i++) { |
451 | k = fftorder[i] / 4; | 451 | k = fftorder[i] / 4; |
452 | pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); | 452 | pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); |
453 | pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); | 453 | pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); |
454 | } | 454 | } |
455 | 455 | ||
456 | printf("static complex_t pre2[64]={"); | 456 | printf("static complex_t pre2[64]={"); |
@@ -458,8 +458,8 @@ void a52_imdct_init (uint32_t mm_accel) | |||
458 | printf("};\n"); | 458 | printf("};\n"); |
459 | 459 | ||
460 | for (i = 0; i < 32; i++) { | 460 | for (i = 0; i < 32; i++) { |
461 | post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); | 461 | post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); |
462 | post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); | 462 | post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); |
463 | } | 463 | } |
464 | 464 | ||
465 | printf("static complex_t post2[32]={"); | 465 | printf("static complex_t post2[32]={"); |
@@ -470,17 +470,17 @@ void a52_imdct_init (uint32_t mm_accel) | |||
470 | #ifdef LIBA52_DJBFFT | 470 | #ifdef LIBA52_DJBFFT |
471 | if (mm_accel & MM_ACCEL_DJBFFT) { | 471 | if (mm_accel & MM_ACCEL_DJBFFT) { |
472 | #ifndef LIBA52_DOUBLE | 472 | #ifndef LIBA52_DOUBLE |
473 | ifft128 = (void (*) (complex_t *)) fftc4_un128; | 473 | ifft128 = (void (*) (complex_t *)) fftc4_un128; |
474 | ifft64 = (void (*) (complex_t *)) fftc4_un64; | 474 | ifft64 = (void (*) (complex_t *)) fftc4_un64; |
475 | #else | 475 | #else |
476 | ifft128 = (void (*) (complex_t *)) fftc8_un128; | 476 | ifft128 = (void (*) (complex_t *)) fftc8_un128; |
477 | ifft64 = (void (*) (complex_t *)) fftc8_un64; | 477 | ifft64 = (void (*) (complex_t *)) fftc8_un64; |
478 | #endif | 478 | #endif |
479 | } else | 479 | } else |
480 | #endif | 480 | #endif |
481 | { | 481 | { |
482 | ifft128 = ifft128_c; | 482 | ifft128 = ifft128_c; |
483 | ifft64 = ifft64_c; | 483 | ifft64 = ifft64_c; |
484 | } | 484 | } |
485 | */ | 485 | */ |
486 | } | 486 | } |
diff --git a/apps/codecs/liba52/imdct_lookups.h b/apps/codecs/liba52/imdct_lookups.h index 769623ff53..9d14fe21a7 100644 --- a/apps/codecs/liba52/imdct_lookups.h +++ b/apps/codecs/liba52/imdct_lookups.h | |||
@@ -1,5 +1,5 @@ | |||
1 | static const sample_t a52_imdct_window[256]ICONST_ATTR={ | 1 | static const sample_t a52_imdct_window[256]ICONST_ATTR={ |
2 | 146020,261886,393529,545197,719447,918478,1144416,1399394,1685589,2005234,2360623,2754115,3188134,3665170,4187773,4758556, 5380193,6055411,6786995,7577779,8430645,9348521,10334375,11391212,12522071,13730020,15018150,16389576,17847424,19394833,21034947,22770912, 24605865,26542938,28585242,30735872,32997891,35374332,37868188,40482408,43219889,46083473,49075937,52199993,55458273,58853331,62387636,66063559, 69883377,73849259,77963266,82227341,86643307,91212859,95937560,100818835,105857968,111056092,116414194,121933098,127613474,133455822,139460477,145627601, 151957182,158449029,165102772,171917855,178893540,186028900,193322822,200774000,208380940,216141958,224055176,232118527,240329753,248686407,257185854,265825270, 274601649,283511802,292552357,301719768,311010314,320420105,329945084,339581031,349323572,359168178,369110174,379144743,389266934,399471665,409753732,420107815, 430528483,441010205,451547355,462134219,472765003,483433845,494134818,504861939,515609181,526370480,537139740,547910849,558677680,569434108,580174011,590891284, 601579849,612233658,622846709,633413050,643926788,654382103,664773249,675094567,685340494,695505569,705584441,715571877,725462772,735252152,744935184,754507184, 763963620,773300119,782512477,791596659,800548807,809365245,818042484,826577226,834966364,843206992,851296404,859232096,867011771,874633340,882094922,889394844, 896531647,903504079,910311101,916951881,923425798,929732436,935871584,941843233,947647575,953284997,958756080,964061593,969202490,974179906,978995149,983649698, 988145195,992483442,996666390,1000696136,1004574919,1008305104,1011889185,1015329772,1018629583,1021791439,1024818257,1027713038,1030478862,1033118881,1035636308,1038034411, 1040316504,1042485942,1044546109,1046500412,1048352275,1050105129,1051762405,1053327531,1054803917,1056194958,1057504020,1058734435,1059889501,1060972468,1061986539,1062934861, 1063820523,1064646551,1065415903,1066131467,1066796055,1067412403,1067983168,1068510924,1068998160,1069447282,1069860607,1070240366,1070588702,1070907668,1071199230,1071465266, 1071707567,1071927836,1072127692,1072308670,1072472221,1072619716,1072752449,1072871635,1072978415,1073073858,1073158963,1073234663,1073301826,1073361257,1073413702,1073459852, 1073500344,1073535763,1073566646,1073593486,1073616731,1073636791,1073654036,1073668804,1073681398,1073692090,1073701126,1073708726,1073715084,1073720373,1073724748,1073728344, 1073731279,1073733657,1073735568,1073737090,1073738291,1073739229,1073739951,1073740500,1073740912,1073741214,1073741431,1073741582,1073741685,1073741751,1073741792,1073741814 | 2 | 146020,261886,393529,545197,719447,918478,1144416,1399394,1685589,2005234,2360623,2754115,3188134,3665170,4187773,4758556, 5380193,6055411,6786995,7577779,8430645,9348521,10334375,11391212,12522071,13730020,15018150,16389576,17847424,19394833,21034947,22770912, 24605865,26542938,28585242,30735872,32997891,35374332,37868188,40482408,43219889,46083473,49075937,52199993,55458273,58853331,62387636,66063559, 69883377,73849259,77963266,82227341,86643307,91212859,95937560,100818835,105857968,111056092,116414194,121933098,127613474,133455822,139460477,145627601, 151957182,158449029,165102772,171917855,178893540,186028900,193322822,200774000,208380940,216141958,224055176,232118527,240329753,248686407,257185854,265825270, 274601649,283511802,292552357,301719768,311010314,320420105,329945084,339581031,349323572,359168178,369110174,379144743,389266934,399471665,409753732,420107815, 430528483,441010205,451547355,462134219,472765003,483433845,494134818,504861939,515609181,526370480,537139740,547910849,558677680,569434108,580174011,590891284, 601579849,612233658,622846709,633413050,643926788,654382103,664773249,675094567,685340494,695505569,705584441,715571877,725462772,735252152,744935184,754507184, 763963620,773300119,782512477,791596659,800548807,809365245,818042484,826577226,834966364,843206992,851296404,859232096,867011771,874633340,882094922,889394844, 896531647,903504079,910311101,916951881,923425798,929732436,935871584,941843233,947647575,953284997,958756080,964061593,969202490,974179906,978995149,983649698, 988145195,992483442,996666390,1000696136,1004574919,1008305104,1011889185,1015329772,1018629583,1021791439,1024818257,1027713038,1030478862,1033118881,1035636308,1038034411, 1040316504,1042485942,1044546109,1046500412,1048352275,1050105129,1051762405,1053327531,1054803917,1056194958,1057504020,1058734435,1059889501,1060972468,1061986539,1062934861, 1063820523,1064646551,1065415903,1066131467,1066796055,1067412403,1067983168,1068510924,1068998160,1069447282,1069860607,1070240366,1070588702,1070907668,1071199230,1071465266, 1071707567,1071927836,1072127692,1072308670,1072472221,1072619716,1072752449,1072871635,1072978415,1073073858,1073158963,1073234663,1073301826,1073361257,1073413702,1073459852, 1073500344,1073535763,1073566646,1073593486,1073616731,1073636791,1073654036,1073668804,1073681398,1073692090,1073701126,1073708726,1073715084,1073720373,1073724748,1073728344, 1073731279,1073733657,1073735568,1073737090,1073738291,1073739229,1073739951,1073740500,1073740912,1073741214,1073741431,1073741582,1073741685,1073741751,1073741792,1073741814 |
3 | }; | 3 | }; |
4 | 4 | ||
5 | static const sample_t roots16[3]ICONST_ATTR={992008094,759250124,410903206}; | 5 | static const sample_t roots16[3]ICONST_ATTR={992008094,759250124,410903206}; |
diff --git a/apps/codecs/liba52/mm_accel.h b/apps/codecs/liba52/mm_accel.h index 8005930cc6..aafc3fed82 100644 --- a/apps/codecs/liba52/mm_accel.h +++ b/apps/codecs/liba52/mm_accel.h | |||
@@ -25,12 +25,12 @@ | |||
25 | #define MM_ACCEL_H | 25 | #define MM_ACCEL_H |
26 | 26 | ||
27 | /* generic accelerations */ | 27 | /* generic accelerations */ |
28 | #define MM_ACCEL_DJBFFT 0x00000001 | 28 | #define MM_ACCEL_DJBFFT 0x00000001 |
29 | 29 | ||
30 | /* x86 accelerations */ | 30 | /* x86 accelerations */ |
31 | #define MM_ACCEL_X86_MMX 0x80000000 | 31 | #define MM_ACCEL_X86_MMX 0x80000000 |
32 | #define MM_ACCEL_X86_3DNOW 0x40000000 | 32 | #define MM_ACCEL_X86_3DNOW 0x40000000 |
33 | #define MM_ACCEL_X86_MMXEXT 0x20000000 | 33 | #define MM_ACCEL_X86_MMXEXT 0x20000000 |
34 | 34 | ||
35 | uint32_t mm_accel (void); | 35 | uint32_t mm_accel (void); |
36 | 36 | ||
diff --git a/apps/codecs/liba52/parse.c b/apps/codecs/liba52/parse.c index fd7e13006d..c61c13cdb5 100644 --- a/apps/codecs/liba52/parse.c +++ b/apps/codecs/liba52/parse.c | |||
@@ -66,19 +66,19 @@ a52_state_t * a52_init (uint32_t mm_accel) | |||
66 | simultenously. NOTE, you also need to remove comments in a52_free. | 66 | simultenously. NOTE, you also need to remove comments in a52_free. |
67 | state = (a52_state_t *) malloc (sizeof (a52_state_t)); | 67 | state = (a52_state_t *) malloc (sizeof (a52_state_t)); |
68 | if (state == NULL) | 68 | if (state == NULL) |
69 | return NULL; | 69 | return NULL; |
70 | 70 | ||
71 | state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t)); | 71 | state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t)); |
72 | if (state->samples == NULL) { | 72 | if (state->samples == NULL) { |
73 | free (state); | 73 | free (state); |
74 | return NULL; | 74 | return NULL; |
75 | } | 75 | } |
76 | 76 | ||
77 | */ | 77 | */ |
78 | state = &istate; | 78 | state = &istate; |
79 | state->samples = isamples; | 79 | state->samples = isamples; |
80 | for (i = 0; i < 256 * 12; i++) | 80 | for (i = 0; i < 256 * 12; i++) |
81 | state->samples[i] = 0; | 81 | state->samples[i] = 0; |
82 | 82 | ||
83 | state->downmixed = 1; | 83 | state->downmixed = 1; |
84 | 84 | ||
@@ -95,11 +95,11 @@ sample_t * a52_samples (a52_state_t * state) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | int a52_syncinfo (uint8_t * buf, int * flags, | 97 | int a52_syncinfo (uint8_t * buf, int * flags, |
98 | int * sample_rate, int * bit_rate) | 98 | int * sample_rate, int * bit_rate) |
99 | { | 99 | { |
100 | static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, | 100 | static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, |
101 | 128, 160, 192, 224, 256, 320, 384, 448, | 101 | 128, 160, 192, 224, 256, 320, 384, 448, |
102 | 512, 576, 640}; | 102 | 512, 576, 640}; |
103 | static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; | 103 | static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; |
104 | int frmsizecod; | 104 | int frmsizecod; |
105 | int bitrate; | 105 | int bitrate; |
@@ -107,45 +107,45 @@ int a52_syncinfo (uint8_t * buf, int * flags, | |||
107 | int acmod; | 107 | int acmod; |
108 | 108 | ||
109 | if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */ | 109 | if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */ |
110 | return 0; | 110 | return 0; |
111 | 111 | ||
112 | if (buf[5] >= 0x60) /* bsid >= 12 */ | 112 | if (buf[5] >= 0x60) /* bsid >= 12 */ |
113 | return 0; | 113 | return 0; |
114 | half = halfrate[buf[5] >> 3]; | 114 | half = halfrate[buf[5] >> 3]; |
115 | 115 | ||
116 | /* acmod, dsurmod and lfeon */ | 116 | /* acmod, dsurmod and lfeon */ |
117 | acmod = buf[6] >> 5; | 117 | acmod = buf[6] >> 5; |
118 | *flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) | | 118 | *flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) | |
119 | ((buf[6] & lfeon[acmod]) ? A52_LFE : 0)); | 119 | ((buf[6] & lfeon[acmod]) ? A52_LFE : 0)); |
120 | 120 | ||
121 | frmsizecod = buf[4] & 63; | 121 | frmsizecod = buf[4] & 63; |
122 | if (frmsizecod >= 38) | 122 | if (frmsizecod >= 38) |
123 | return 0; | 123 | return 0; |
124 | bitrate = rate [frmsizecod >> 1]; | 124 | bitrate = rate [frmsizecod >> 1]; |
125 | *bit_rate = (bitrate * 1000) >> half; | 125 | *bit_rate = (bitrate * 1000) >> half; |
126 | 126 | ||
127 | switch (buf[4] & 0xc0) { | 127 | switch (buf[4] & 0xc0) { |
128 | case 0: | 128 | case 0: |
129 | *sample_rate = 48000 >> half; | 129 | *sample_rate = 48000 >> half; |
130 | return 4 * bitrate; | 130 | return 4 * bitrate; |
131 | case 0x40: | 131 | case 0x40: |
132 | *sample_rate = 44100 >> half; | 132 | *sample_rate = 44100 >> half; |
133 | return 2 * (320 * bitrate / 147 + (frmsizecod & 1)); | 133 | return 2 * (320 * bitrate / 147 + (frmsizecod & 1)); |
134 | case 0x80: | 134 | case 0x80: |
135 | *sample_rate = 32000 >> half; | 135 | *sample_rate = 32000 >> half; |
136 | return 6 * bitrate; | 136 | return 6 * bitrate; |
137 | default: | 137 | default: |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, | 142 | int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, |
143 | level_t * level, sample_t bias) | 143 | level_t * level, sample_t bias) |
144 | { | 144 | { |
145 | static level_t clev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_45DB), | 145 | static level_t clev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_45DB), |
146 | LEVEL (LEVEL_6DB), LEVEL (LEVEL_45DB) }; | 146 | LEVEL (LEVEL_6DB), LEVEL (LEVEL_45DB) }; |
147 | static level_t slev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_6DB), | 147 | static level_t slev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_6DB), |
148 | 0, LEVEL (LEVEL_6DB) }; | 148 | 0, LEVEL (LEVEL_6DB) }; |
149 | int chaninfo; | 149 | int chaninfo; |
150 | int acmod; | 150 | int acmod; |
151 | 151 | ||
@@ -156,25 +156,25 @@ int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, | |||
156 | a52_bitstream_set_ptr (state, buf + 6); | 156 | a52_bitstream_set_ptr (state, buf + 6); |
157 | bitstream_get (state, 3); /* skip acmod we already parsed */ | 157 | bitstream_get (state, 3); /* skip acmod we already parsed */ |
158 | 158 | ||
159 | if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */ | 159 | if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */ |
160 | acmod = A52_DOLBY; | 160 | acmod = A52_DOLBY; |
161 | 161 | ||
162 | state->clev = state->slev = 0; | 162 | state->clev = state->slev = 0; |
163 | 163 | ||
164 | if ((acmod & 1) && (acmod != 1)) | 164 | if ((acmod & 1) && (acmod != 1)) |
165 | state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */ | 165 | state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */ |
166 | 166 | ||
167 | if (acmod & 4) | 167 | if (acmod & 4) |
168 | state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */ | 168 | state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */ |
169 | 169 | ||
170 | state->lfeon = bitstream_get (state, 1); | 170 | state->lfeon = bitstream_get (state, 1); |
171 | 171 | ||
172 | state->output = a52_downmix_init (acmod, *flags, level, | 172 | state->output = a52_downmix_init (acmod, *flags, level, |
173 | state->clev, state->slev); | 173 | state->clev, state->slev); |
174 | if (state->output < 0) | 174 | if (state->output < 0) |
175 | return 1; | 175 | return 1; |
176 | if (state->lfeon && (*flags & A52_LFE)) | 176 | if (state->lfeon && (*flags & A52_LFE)) |
177 | state->output |= A52_LFE; | 177 | state->output |= A52_LFE; |
178 | *flags = state->output; | 178 | *flags = state->output; |
179 | /* the 2* compensates for differences in imdct */ | 179 | /* the 2* compensates for differences in imdct */ |
180 | state->dynrng = state->level = MUL_C (*level, 2); | 180 | state->dynrng = state->level = MUL_C (*level, 2); |
@@ -183,98 +183,98 @@ int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, | |||
183 | state->dynrngcall = NULL; | 183 | state->dynrngcall = NULL; |
184 | state->cplba.deltbae = DELTA_BIT_NONE; | 184 | state->cplba.deltbae = DELTA_BIT_NONE; |
185 | state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae = | 185 | state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae = |
186 | state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE; | 186 | state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE; |
187 | 187 | ||
188 | chaninfo = !acmod; | 188 | chaninfo = !acmod; |
189 | do { | 189 | do { |
190 | bitstream_get (state, 5); /* dialnorm */ | 190 | bitstream_get (state, 5); /* dialnorm */ |
191 | if (bitstream_get (state, 1)) /* compre */ | 191 | if (bitstream_get (state, 1)) /* compre */ |
192 | bitstream_get (state, 8); /* compr */ | 192 | bitstream_get (state, 8); /* compr */ |
193 | if (bitstream_get (state, 1)) /* langcode */ | 193 | if (bitstream_get (state, 1)) /* langcode */ |
194 | bitstream_get (state, 8); /* langcod */ | 194 | bitstream_get (state, 8); /* langcod */ |
195 | if (bitstream_get (state, 1)) /* audprodie */ | 195 | if (bitstream_get (state, 1)) /* audprodie */ |
196 | bitstream_get (state, 7); /* mixlevel + roomtyp */ | 196 | bitstream_get (state, 7); /* mixlevel + roomtyp */ |
197 | } while (chaninfo--); | 197 | } while (chaninfo--); |
198 | 198 | ||
199 | bitstream_get (state, 2); /* copyrightb + origbs */ | 199 | bitstream_get (state, 2); /* copyrightb + origbs */ |
200 | 200 | ||
201 | if (bitstream_get (state, 1)) /* timecod1e */ | 201 | if (bitstream_get (state, 1)) /* timecod1e */ |
202 | bitstream_get (state, 14); /* timecod1 */ | 202 | bitstream_get (state, 14); /* timecod1 */ |
203 | if (bitstream_get (state, 1)) /* timecod2e */ | 203 | if (bitstream_get (state, 1)) /* timecod2e */ |
204 | bitstream_get (state, 14); /* timecod2 */ | 204 | bitstream_get (state, 14); /* timecod2 */ |
205 | 205 | ||
206 | if (bitstream_get (state, 1)) { /* addbsie */ | 206 | if (bitstream_get (state, 1)) { /* addbsie */ |
207 | int addbsil; | 207 | int addbsil; |
208 | 208 | ||
209 | addbsil = bitstream_get (state, 6); | 209 | addbsil = bitstream_get (state, 6); |
210 | do { | 210 | do { |
211 | bitstream_get (state, 8); /* addbsi */ | 211 | bitstream_get (state, 8); /* addbsi */ |
212 | } while (addbsil--); | 212 | } while (addbsil--); |
213 | } | 213 | } |
214 | 214 | ||
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | 217 | ||
218 | void a52_dynrng (a52_state_t * state, | 218 | void a52_dynrng (a52_state_t * state, |
219 | level_t (* call) (level_t, void *), void * data) | 219 | level_t (* call) (level_t, void *), void * data) |
220 | { | 220 | { |
221 | state->dynrnge = 0; | 221 | state->dynrnge = 0; |
222 | if (call) { | 222 | if (call) { |
223 | state->dynrnge = 1; | 223 | state->dynrnge = 1; |
224 | state->dynrngcall = call; | 224 | state->dynrngcall = call; |
225 | state->dynrngdata = data; | 225 | state->dynrngdata = data; |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | static int parse_exponents (a52_state_t * state, int expstr, int ngrps, | 229 | static int parse_exponents (a52_state_t * state, int expstr, int ngrps, |
230 | uint8_t exponent, uint8_t * dest) | 230 | uint8_t exponent, uint8_t * dest) |
231 | { | 231 | { |
232 | int exps; | 232 | int exps; |
233 | 233 | ||
234 | while (ngrps--) { | 234 | while (ngrps--) { |
235 | exps = bitstream_get (state, 7); | 235 | exps = bitstream_get (state, 7); |
236 | 236 | ||
237 | exponent += exp_1[exps]; | 237 | exponent += exp_1[exps]; |
238 | if (exponent > 24) | 238 | if (exponent > 24) |
239 | return 1; | 239 | return 1; |
240 | 240 | ||
241 | switch (expstr) { | 241 | switch (expstr) { |
242 | case EXP_D45: | 242 | case EXP_D45: |
243 | *(dest++) = exponent; | 243 | *(dest++) = exponent; |
244 | *(dest++) = exponent; | 244 | *(dest++) = exponent; |
245 | case EXP_D25: | 245 | case EXP_D25: |
246 | *(dest++) = exponent; | 246 | *(dest++) = exponent; |
247 | case EXP_D15: | 247 | case EXP_D15: |
248 | *(dest++) = exponent; | 248 | *(dest++) = exponent; |
249 | } | 249 | } |
250 | 250 | ||
251 | exponent += exp_2[exps]; | 251 | exponent += exp_2[exps]; |
252 | if (exponent > 24) | 252 | if (exponent > 24) |
253 | return 1; | 253 | return 1; |
254 | 254 | ||
255 | switch (expstr) { | 255 | switch (expstr) { |
256 | case EXP_D45: | 256 | case EXP_D45: |
257 | *(dest++) = exponent; | 257 | *(dest++) = exponent; |
258 | *(dest++) = exponent; | 258 | *(dest++) = exponent; |
259 | case EXP_D25: | 259 | case EXP_D25: |
260 | *(dest++) = exponent; | 260 | *(dest++) = exponent; |
261 | case EXP_D15: | 261 | case EXP_D15: |
262 | *(dest++) = exponent; | 262 | *(dest++) = exponent; |
263 | } | 263 | } |
264 | 264 | ||
265 | exponent += exp_3[exps]; | 265 | exponent += exp_3[exps]; |
266 | if (exponent > 24) | 266 | if (exponent > 24) |
267 | return 1; | 267 | return 1; |
268 | 268 | ||
269 | switch (expstr) { | 269 | switch (expstr) { |
270 | case EXP_D45: | 270 | case EXP_D45: |
271 | *(dest++) = exponent; | 271 | *(dest++) = exponent; |
272 | *(dest++) = exponent; | 272 | *(dest++) = exponent; |
273 | case EXP_D25: | 273 | case EXP_D25: |
274 | *(dest++) = exponent; | 274 | *(dest++) = exponent; |
275 | case EXP_D15: | 275 | case EXP_D15: |
276 | *(dest++) = exponent; | 276 | *(dest++) = exponent; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | return 0; | 280 | return 0; |
@@ -289,16 +289,16 @@ static int parse_deltba (a52_state_t * state, int8_t * deltba) | |||
289 | deltnseg = bitstream_get (state, 3); | 289 | deltnseg = bitstream_get (state, 3); |
290 | j = 0; | 290 | j = 0; |
291 | do { | 291 | do { |
292 | j += bitstream_get (state, 5); | 292 | j += bitstream_get (state, 5); |
293 | deltlen = bitstream_get (state, 4); | 293 | deltlen = bitstream_get (state, 4); |
294 | delta = bitstream_get (state, 3); | 294 | delta = bitstream_get (state, 3); |
295 | delta -= (delta >= 4) ? 3 : 4; | 295 | delta -= (delta >= 4) ? 3 : 4; |
296 | if (!deltlen) | 296 | if (!deltlen) |
297 | continue; | 297 | continue; |
298 | if (j + deltlen >= 50) | 298 | if (j + deltlen >= 50) |
299 | return 1; | 299 | return 1; |
300 | while (deltlen--) | 300 | while (deltlen--) |
301 | deltba[j++] = delta; | 301 | deltba[j++] = delta; |
302 | } while (deltnseg--); | 302 | } while (deltnseg--); |
303 | 303 | ||
304 | return 0; | 304 | return 0; |
@@ -309,12 +309,12 @@ static inline int zero_snr_offsets (int nfchans, a52_state_t * state) | |||
309 | int i; | 309 | int i; |
310 | 310 | ||
311 | if ((state->csnroffst) || | 311 | if ((state->csnroffst) || |
312 | (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */ | 312 | (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */ |
313 | (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */ | 313 | (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */ |
314 | return 0; | ||
315 | for (i = 0; i < nfchans; i++) | ||
316 | if (state->ba[i].bai >> 3) /* fsnroffst */ | ||
317 | return 0; | 314 | return 0; |
315 | for (i = 0; i < nfchans; i++) | ||
316 | if (state->ba[i].bai >> 3) /* fsnroffst */ | ||
317 | return 0; | ||
318 | return 1; | 318 | return 1; |
319 | } | 319 | } |
320 | 320 | ||
@@ -323,7 +323,7 @@ static inline int16_t dither_gen (a52_state_t * state) | |||
323 | int16_t nstate; | 323 | int16_t nstate; |
324 | 324 | ||
325 | nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8); | 325 | nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8); |
326 | 326 | ||
327 | state->lfsr_state = (uint16_t) nstate; | 327 | state->lfsr_state = (uint16_t) nstate; |
328 | 328 | ||
329 | return (3 * nstate) >> 2; | 329 | return (3 * nstate) >> 2; |
@@ -332,21 +332,21 @@ static inline int16_t dither_gen (a52_state_t * state) | |||
332 | #ifndef LIBA52_FIXED | 332 | #ifndef LIBA52_FIXED |
333 | #define COEFF(c,t,l,s,e) (c) = (t) * (s)[e] | 333 | #define COEFF(c,t,l,s,e) (c) = (t) * (s)[e] |
334 | #else | 334 | #else |
335 | #define COEFF(c,_t,_l,s,e) do { \ | 335 | #define COEFF(c,_t,_l,s,e) do { \ |
336 | quantizer_t t = (_t); \ | 336 | quantizer_t t = (_t); \ |
337 | level_t l = (_l); \ | 337 | level_t l = (_l); \ |
338 | int shift = e - 5; \ | 338 | int shift = e - 5; \ |
339 | sample_t tmp = t * (l >> 16) + ((t * (l & 0xffff)) >> 16); \ | 339 | sample_t tmp = t * (l >> 16) + ((t * (l & 0xffff)) >> 16); \ |
340 | if (shift >= 0) \ | 340 | if (shift >= 0) \ |
341 | (c) = tmp >> shift; \ | 341 | (c) = tmp >> shift; \ |
342 | else \ | 342 | else \ |
343 | (c) = tmp << -shift; \ | 343 | (c) = tmp << -shift; \ |
344 | } while (0) | 344 | } while (0) |
345 | #endif | 345 | #endif |
346 | 346 | ||
347 | static void coeff_get (a52_state_t * state, sample_t * coeff, | 347 | static void coeff_get (a52_state_t * state, sample_t * coeff, |
348 | expbap_t * expbap, quantizer_set_t * quant, | 348 | expbap_t * expbap, quantizer_set_t * quant, |
349 | level_t level, int dither, int end) | 349 | level_t level, int dither, int end) |
350 | { | 350 | { |
351 | int i; | 351 | int i; |
352 | uint8_t * exp; | 352 | uint8_t * exp; |
@@ -356,96 +356,96 @@ static void coeff_get (a52_state_t * state, sample_t * coeff, | |||
356 | sample_t factor[25]; | 356 | sample_t factor[25]; |
357 | 357 | ||
358 | for (i = 0; i <= 24; i++) | 358 | for (i = 0; i <= 24; i++) |
359 | factor[i] = scale_factor[i] * level; | 359 | factor[i] = scale_factor[i] * level; |
360 | #endif | 360 | #endif |
361 | 361 | ||
362 | exp = expbap->exp; | 362 | exp = expbap->exp; |
363 | bap = expbap->bap; | 363 | bap = expbap->bap; |
364 | 364 | ||
365 | for (i = 0; i < end; i++) { | 365 | for (i = 0; i < end; i++) { |
366 | int bapi; | 366 | int bapi; |
367 | |||
368 | bapi = bap[i]; | ||
369 | switch (bapi) { | ||
370 | case 0: | ||
371 | if (dither) { | ||
372 | COEFF (coeff[i], dither_gen (state), level, factor, exp[i]); | ||
373 | continue; | ||
374 | } else { | ||
375 | coeff[i] = 0; | ||
376 | continue; | ||
377 | } | ||
378 | |||
379 | case -1: | ||
380 | if (quant->q1_ptr >= 0) { | ||
381 | COEFF (coeff[i], quant->q1[quant->q1_ptr--], level, | ||
382 | factor, exp[i]); | ||
383 | continue; | ||
384 | } else { | ||
385 | int code; | ||
386 | |||
387 | code = bitstream_get (state, 5); | ||
388 | |||
389 | quant->q1_ptr = 1; | ||
390 | quant->q1[0] = q_1_2[code]; | ||
391 | quant->q1[1] = q_1_1[code]; | ||
392 | COEFF (coeff[i], q_1_0[code], level, factor, exp[i]); | ||
393 | continue; | ||
394 | } | ||
395 | 367 | ||
396 | case -2: | 368 | bapi = bap[i]; |
397 | if (quant->q2_ptr >= 0) { | 369 | switch (bapi) { |
398 | COEFF (coeff[i], quant->q2[quant->q2_ptr--], level, | 370 | case 0: |
399 | factor, exp[i]); | 371 | if (dither) { |
400 | continue; | 372 | COEFF (coeff[i], dither_gen (state), level, factor, exp[i]); |
401 | } else { | 373 | continue; |
402 | int code; | 374 | } else { |
375 | coeff[i] = 0; | ||
376 | continue; | ||
377 | } | ||
403 | 378 | ||
404 | code = bitstream_get (state, 7); | 379 | case -1: |
380 | if (quant->q1_ptr >= 0) { | ||
381 | COEFF (coeff[i], quant->q1[quant->q1_ptr--], level, | ||
382 | factor, exp[i]); | ||
383 | continue; | ||
384 | } else { | ||
385 | int code; | ||
386 | |||
387 | code = bitstream_get (state, 5); | ||
388 | |||
389 | quant->q1_ptr = 1; | ||
390 | quant->q1[0] = q_1_2[code]; | ||
391 | quant->q1[1] = q_1_1[code]; | ||
392 | COEFF (coeff[i], q_1_0[code], level, factor, exp[i]); | ||
393 | continue; | ||
394 | } | ||
405 | 395 | ||
406 | quant->q2_ptr = 1; | 396 | case -2: |
407 | quant->q2[0] = q_2_2[code]; | 397 | if (quant->q2_ptr >= 0) { |
408 | quant->q2[1] = q_2_1[code]; | 398 | COEFF (coeff[i], quant->q2[quant->q2_ptr--], level, |
409 | COEFF (coeff[i], q_2_0[code], level, factor, exp[i]); | 399 | factor, exp[i]); |
410 | continue; | 400 | continue; |
411 | } | 401 | } else { |
402 | int code; | ||
403 | |||
404 | code = bitstream_get (state, 7); | ||
405 | |||
406 | quant->q2_ptr = 1; | ||
407 | quant->q2[0] = q_2_2[code]; | ||
408 | quant->q2[1] = q_2_1[code]; | ||
409 | COEFF (coeff[i], q_2_0[code], level, factor, exp[i]); | ||
410 | continue; | ||
411 | } | ||
412 | 412 | ||
413 | case 3: | 413 | case 3: |
414 | COEFF (coeff[i], q_3[bitstream_get (state, 3)], level, | 414 | COEFF (coeff[i], q_3[bitstream_get (state, 3)], level, |
415 | factor, exp[i]); | 415 | factor, exp[i]); |
416 | continue; | 416 | continue; |
417 | 417 | ||
418 | case -3: | 418 | case -3: |
419 | if (quant->q4_ptr == 0) { | 419 | if (quant->q4_ptr == 0) { |
420 | quant->q4_ptr = -1; | 420 | quant->q4_ptr = -1; |
421 | COEFF (coeff[i], quant->q4, level, factor, exp[i]); | 421 | COEFF (coeff[i], quant->q4, level, factor, exp[i]); |
422 | continue; | 422 | continue; |
423 | } else { | 423 | } else { |
424 | int code; | 424 | int code; |
425 | |||
426 | code = bitstream_get (state, 7); | ||
427 | |||
428 | quant->q4_ptr = 0; | ||
429 | quant->q4 = q_4_1[code]; | ||
430 | COEFF (coeff[i], q_4_0[code], level, factor, exp[i]); | ||
431 | continue; | ||
432 | } | ||
425 | 433 | ||
426 | code = bitstream_get (state, 7); | 434 | case 4: |
435 | COEFF (coeff[i], q_5[bitstream_get (state, 4)], level, | ||
436 | factor, exp[i]); | ||
437 | continue; | ||
427 | 438 | ||
428 | quant->q4_ptr = 0; | 439 | default: |
429 | quant->q4 = q_4_1[code]; | 440 | COEFF (coeff[i], bitstream_get_2 (state, bapi) << (16 - bapi), |
430 | COEFF (coeff[i], q_4_0[code], level, factor, exp[i]); | 441 | level, factor, exp[i]); |
431 | continue; | ||
432 | } | 442 | } |
433 | |||
434 | case 4: | ||
435 | COEFF (coeff[i], q_5[bitstream_get (state, 4)], level, | ||
436 | factor, exp[i]); | ||
437 | continue; | ||
438 | |||
439 | default: | ||
440 | COEFF (coeff[i], bitstream_get_2 (state, bapi) << (16 - bapi), | ||
441 | level, factor, exp[i]); | ||
442 | } | ||
443 | } | 443 | } |
444 | } | 444 | } |
445 | 445 | ||
446 | static void coeff_get_coupling (a52_state_t * state, int nfchans, | 446 | static void coeff_get_coupling (a52_state_t * state, int nfchans, |
447 | level_t * coeff, sample_t (* samples)[256], | 447 | level_t * coeff, sample_t (* samples)[256], |
448 | quantizer_set_t * quant, uint8_t dithflag[5]) | 448 | quantizer_set_t * quant, uint8_t dithflag[5]) |
449 | { | 449 | { |
450 | int cplbndstrc, bnd, i, i_end, ch; | 450 | int cplbndstrc, bnd, i, i_end, ch; |
451 | uint8_t * exp; | 451 | uint8_t * exp; |
@@ -458,111 +458,111 @@ static void coeff_get_coupling (a52_state_t * state, int nfchans, | |||
458 | cplbndstrc = state->cplbndstrc; | 458 | cplbndstrc = state->cplbndstrc; |
459 | i = state->cplstrtmant; | 459 | i = state->cplstrtmant; |
460 | while (i < state->cplendmant) { | 460 | while (i < state->cplendmant) { |
461 | i_end = i + 12; | 461 | i_end = i + 12; |
462 | while (cplbndstrc & 1) { | 462 | while (cplbndstrc & 1) { |
463 | cplbndstrc >>= 1; | ||
464 | i_end += 12; | ||
465 | } | ||
463 | cplbndstrc >>= 1; | 466 | cplbndstrc >>= 1; |
464 | i_end += 12; | ||
465 | } | ||
466 | cplbndstrc >>= 1; | ||
467 | for (ch = 0; ch < nfchans; ch++) | ||
468 | cplco[ch] = MUL_L (state->cplco[ch][bnd], coeff[ch]); | ||
469 | bnd++; | ||
470 | |||
471 | while (i < i_end) { | ||
472 | quantizer_t cplcoeff; | ||
473 | int bapi; | ||
474 | |||
475 | bapi = bap[i]; | ||
476 | switch (bapi) { | ||
477 | case 0: | ||
478 | for (ch = 0; ch < nfchans; ch++) | 467 | for (ch = 0; ch < nfchans; ch++) |
479 | if ((state->chincpl >> ch) & 1) { | 468 | cplco[ch] = MUL_L (state->cplco[ch][bnd], coeff[ch]); |
480 | if (dithflag[ch]) | 469 | bnd++; |
470 | |||
471 | while (i < i_end) { | ||
472 | quantizer_t cplcoeff; | ||
473 | int bapi; | ||
474 | |||
475 | bapi = bap[i]; | ||
476 | switch (bapi) { | ||
477 | case 0: | ||
478 | for (ch = 0; ch < nfchans; ch++) | ||
479 | if ((state->chincpl >> ch) & 1) { | ||
480 | if (dithflag[ch]) | ||
481 | #ifndef LIBA52_FIXED | 481 | #ifndef LIBA52_FIXED |
482 | samples[ch][i] = (scale_factor[exp[i]] * | 482 | samples[ch][i] = (scale_factor[exp[i]] * |
483 | cplco[ch] * dither_gen (state)); | 483 | cplco[ch] * dither_gen (state)); |
484 | #else | 484 | #else |
485 | COEFF (samples[ch][i], dither_gen (state), | 485 | COEFF (samples[ch][i], dither_gen (state), |
486 | cplco[ch], scale_factor, exp[i]); | 486 | cplco[ch], scale_factor, exp[i]); |
487 | #endif | 487 | #endif |
488 | else | 488 | else |
489 | samples[ch][i] = 0; | 489 | samples[ch][i] = 0; |
490 | } | ||
491 | i++; | ||
492 | continue; | ||
493 | |||
494 | case -1: | ||
495 | if (quant->q1_ptr >= 0) { | ||
496 | cplcoeff = quant->q1[quant->q1_ptr--]; | ||
497 | break; | ||
498 | } else { | ||
499 | int code; | ||
500 | |||
501 | code = bitstream_get (state, 5); | ||
502 | |||
503 | quant->q1_ptr = 1; | ||
504 | quant->q1[0] = q_1_2[code]; | ||
505 | quant->q1[1] = q_1_1[code]; | ||
506 | cplcoeff = q_1_0[code]; | ||
507 | break; | ||
508 | } | ||
509 | |||
510 | case -2: | ||
511 | if (quant->q2_ptr >= 0) { | ||
512 | cplcoeff = quant->q2[quant->q2_ptr--]; | ||
513 | break; | ||
514 | } else { | ||
515 | int code; | ||
516 | |||
517 | code = bitstream_get (state, 7); | ||
518 | |||
519 | quant->q2_ptr = 1; | ||
520 | quant->q2[0] = q_2_2[code]; | ||
521 | quant->q2[1] = q_2_1[code]; | ||
522 | cplcoeff = q_2_0[code]; | ||
523 | break; | ||
524 | } | ||
525 | |||
526 | case 3: | ||
527 | cplcoeff = q_3[bitstream_get (state, 3)]; | ||
528 | break; | ||
529 | |||
530 | case -3: | ||
531 | if (quant->q4_ptr == 0) { | ||
532 | quant->q4_ptr = -1; | ||
533 | cplcoeff = quant->q4; | ||
534 | break; | ||
535 | } else { | ||
536 | int code; | ||
537 | |||
538 | code = bitstream_get (state, 7); | ||
539 | |||
540 | quant->q4_ptr = 0; | ||
541 | quant->q4 = q_4_1[code]; | ||
542 | cplcoeff = q_4_0[code]; | ||
543 | break; | ||
544 | } | ||
545 | |||
546 | case 4: | ||
547 | cplcoeff = q_5[bitstream_get (state, 4)]; | ||
548 | break; | ||
549 | |||
550 | default: | ||
551 | cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi); | ||
490 | } | 552 | } |
491 | i++; | ||
492 | continue; | ||
493 | |||
494 | case -1: | ||
495 | if (quant->q1_ptr >= 0) { | ||
496 | cplcoeff = quant->q1[quant->q1_ptr--]; | ||
497 | break; | ||
498 | } else { | ||
499 | int code; | ||
500 | |||
501 | code = bitstream_get (state, 5); | ||
502 | |||
503 | quant->q1_ptr = 1; | ||
504 | quant->q1[0] = q_1_2[code]; | ||
505 | quant->q1[1] = q_1_1[code]; | ||
506 | cplcoeff = q_1_0[code]; | ||
507 | break; | ||
508 | } | ||
509 | |||
510 | case -2: | ||
511 | if (quant->q2_ptr >= 0) { | ||
512 | cplcoeff = quant->q2[quant->q2_ptr--]; | ||
513 | break; | ||
514 | } else { | ||
515 | int code; | ||
516 | |||
517 | code = bitstream_get (state, 7); | ||
518 | |||
519 | quant->q2_ptr = 1; | ||
520 | quant->q2[0] = q_2_2[code]; | ||
521 | quant->q2[1] = q_2_1[code]; | ||
522 | cplcoeff = q_2_0[code]; | ||
523 | break; | ||
524 | } | ||
525 | |||
526 | case 3: | ||
527 | cplcoeff = q_3[bitstream_get (state, 3)]; | ||
528 | break; | ||
529 | |||
530 | case -3: | ||
531 | if (quant->q4_ptr == 0) { | ||
532 | quant->q4_ptr = -1; | ||
533 | cplcoeff = quant->q4; | ||
534 | break; | ||
535 | } else { | ||
536 | int code; | ||
537 | |||
538 | code = bitstream_get (state, 7); | ||
539 | |||
540 | quant->q4_ptr = 0; | ||
541 | quant->q4 = q_4_1[code]; | ||
542 | cplcoeff = q_4_0[code]; | ||
543 | break; | ||
544 | } | ||
545 | |||
546 | case 4: | ||
547 | cplcoeff = q_5[bitstream_get (state, 4)]; | ||
548 | break; | ||
549 | |||
550 | default: | ||
551 | cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi); | ||
552 | } | ||
553 | #ifndef LIBA52_FIXED | 553 | #ifndef LIBA52_FIXED |
554 | cplcoeff *= scale_factor[exp[i]]; | 554 | cplcoeff *= scale_factor[exp[i]]; |
555 | #endif | 555 | #endif |
556 | for (ch = 0; ch < nfchans; ch++) | 556 | for (ch = 0; ch < nfchans; ch++) |
557 | if ((state->chincpl >> ch) & 1) | 557 | if ((state->chincpl >> ch) & 1) |
558 | #ifndef LIBA52_FIXED | 558 | #ifndef LIBA52_FIXED |
559 | samples[ch][i] = cplcoeff * cplco[ch]; | 559 | samples[ch][i] = cplcoeff * cplco[ch]; |
560 | #else | 560 | #else |
561 | COEFF (samples[ch][i], cplcoeff, cplco[ch], | 561 | COEFF (samples[ch][i], cplcoeff, cplco[ch], |
562 | scale_factor, exp[i]); | 562 | scale_factor, exp[i]); |
563 | #endif | 563 | #endif |
564 | i++; | 564 | i++; |
565 | } | 565 | } |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
@@ -581,366 +581,366 @@ int a52_block (a52_state_t * state) | |||
581 | nfchans = nfchans_tbl[state->acmod]; | 581 | nfchans = nfchans_tbl[state->acmod]; |
582 | 582 | ||
583 | for (i = 0; i < nfchans; i++) | 583 | for (i = 0; i < nfchans; i++) |
584 | blksw[i] = bitstream_get (state, 1); | 584 | blksw[i] = bitstream_get (state, 1); |
585 | 585 | ||
586 | for (i = 0; i < nfchans; i++) | 586 | for (i = 0; i < nfchans; i++) |
587 | dithflag[i] = bitstream_get (state, 1); | 587 | dithflag[i] = bitstream_get (state, 1); |
588 | 588 | ||
589 | chaninfo = !state->acmod; | 589 | chaninfo = !state->acmod; |
590 | do { | 590 | do { |
591 | if (bitstream_get (state, 1)) { /* dynrnge */ | 591 | if (bitstream_get (state, 1)) { /* dynrnge */ |
592 | int dynrng; | 592 | int dynrng; |
593 | 593 | ||
594 | dynrng = bitstream_get_2 (state, 8); | 594 | dynrng = bitstream_get_2 (state, 8); |
595 | if (state->dynrnge) { | 595 | if (state->dynrnge) { |
596 | level_t range; | 596 | level_t range; |
597 | 597 | ||
598 | #if !defined(LIBA52_FIXED) | 598 | #if !defined(LIBA52_FIXED) |
599 | range = ((((dynrng & 0x1f) | 0x20) << 13) * | 599 | range = ((((dynrng & 0x1f) | 0x20) << 13) * |
600 | scale_factor[3 - (dynrng >> 5)]); | 600 | scale_factor[3 - (dynrng >> 5)]); |
601 | #else | 601 | #else |
602 | range = ((dynrng & 0x1f) | 0x20) << (21 + (dynrng >> 5)); | 602 | range = ((dynrng & 0x1f) | 0x20) << (21 + (dynrng >> 5)); |
603 | #endif | 603 | #endif |
604 | if (state->dynrngcall) | 604 | if (state->dynrngcall) |
605 | range = state->dynrngcall (range, state->dynrngdata); | 605 | range = state->dynrngcall (range, state->dynrngdata); |
606 | state->dynrng = MUL_L (state->level, range); | 606 | state->dynrng = MUL_L (state->level, range); |
607 | } | ||
607 | } | 608 | } |
608 | } | ||
609 | } while (chaninfo--); | 609 | } while (chaninfo--); |
610 | 610 | ||
611 | if (bitstream_get (state, 1)) { /* cplstre */ | 611 | if (bitstream_get (state, 1)) { /* cplstre */ |
612 | state->chincpl = 0; | 612 | state->chincpl = 0; |
613 | if (bitstream_get (state, 1)) { /* cplinu */ | 613 | if (bitstream_get (state, 1)) { /* cplinu */ |
614 | static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44, | 614 | static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44, |
615 | 45, 45, 46, 46, 47, 47, 48, 48}; | 615 | 45, 45, 46, 46, 47, 47, 48, 48}; |
616 | int cplbegf; | 616 | int cplbegf; |
617 | int cplendf; | 617 | int cplendf; |
618 | int ncplsubnd; | 618 | int ncplsubnd; |
619 | 619 | ||
620 | for (i = 0; i < nfchans; i++) | 620 | for (i = 0; i < nfchans; i++) |
621 | state->chincpl |= bitstream_get (state, 1) << i; | 621 | state->chincpl |= bitstream_get (state, 1) << i; |
622 | switch (state->acmod) { | 622 | switch (state->acmod) { |
623 | case 0: case 1: | 623 | case 0: case 1: |
624 | return 1; | 624 | return 1; |
625 | case 2: | 625 | case 2: |
626 | state->phsflginu = bitstream_get (state, 1); | 626 | state->phsflginu = bitstream_get (state, 1); |
627 | } | 627 | } |
628 | cplbegf = bitstream_get (state, 4); | 628 | cplbegf = bitstream_get (state, 4); |
629 | cplendf = bitstream_get (state, 4); | 629 | cplendf = bitstream_get (state, 4); |
630 | 630 | ||
631 | if (cplendf + 3 - cplbegf < 0) | 631 | if (cplendf + 3 - cplbegf < 0) |
632 | return 1; | 632 | return 1; |
633 | state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf; | 633 | state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf; |
634 | state->cplstrtbnd = bndtab[cplbegf]; | 634 | state->cplstrtbnd = bndtab[cplbegf]; |
635 | state->cplstrtmant = cplbegf * 12 + 37; | 635 | state->cplstrtmant = cplbegf * 12 + 37; |
636 | state->cplendmant = cplendf * 12 + 73; | 636 | state->cplendmant = cplendf * 12 + 73; |
637 | 637 | ||
638 | state->cplbndstrc = 0; | 638 | state->cplbndstrc = 0; |
639 | for (i = 0; i < ncplsubnd - 1; i++) | 639 | for (i = 0; i < ncplsubnd - 1; i++) |
640 | if (bitstream_get (state, 1)) { | 640 | if (bitstream_get (state, 1)) { |
641 | state->cplbndstrc |= 1 << i; | 641 | state->cplbndstrc |= 1 << i; |
642 | state->ncplbnd--; | 642 | state->ncplbnd--; |
643 | } | ||
643 | } | 644 | } |
644 | } | 645 | } |
645 | } | ||
646 | 646 | ||
647 | if (state->chincpl) { /* cplinu */ | 647 | if (state->chincpl) { /* cplinu */ |
648 | int j, cplcoe; | 648 | int j, cplcoe; |
649 | 649 | ||
650 | cplcoe = 0; | 650 | cplcoe = 0; |
651 | for (i = 0; i < nfchans; i++) | 651 | for (i = 0; i < nfchans; i++) |
652 | if ((state->chincpl) >> i & 1) | 652 | if ((state->chincpl) >> i & 1) |
653 | if (bitstream_get (state, 1)) { /* cplcoe */ | 653 | if (bitstream_get (state, 1)) { /* cplcoe */ |
654 | int mstrcplco, cplcoexp, cplcomant; | 654 | int mstrcplco, cplcoexp, cplcomant; |
655 | 655 | ||
656 | cplcoe = 1; | 656 | cplcoe = 1; |
657 | mstrcplco = 3 * bitstream_get (state, 2); | 657 | mstrcplco = 3 * bitstream_get (state, 2); |
658 | for (j = 0; j < state->ncplbnd; j++) { | 658 | for (j = 0; j < state->ncplbnd; j++) { |
659 | cplcoexp = bitstream_get (state, 4); | 659 | cplcoexp = bitstream_get (state, 4); |
660 | cplcomant = bitstream_get (state, 4); | 660 | cplcomant = bitstream_get (state, 4); |
661 | if (cplcoexp == 15) | 661 | if (cplcoexp == 15) |
662 | cplcomant <<= 14; | 662 | cplcomant <<= 14; |
663 | else | 663 | else |
664 | cplcomant = (cplcomant | 0x10) << 13; | 664 | cplcomant = (cplcomant | 0x10) << 13; |
665 | #ifndef LIBA52_FIXED | 665 | #ifndef LIBA52_FIXED |
666 | state->cplco[i][j] = | 666 | state->cplco[i][j] = |
667 | cplcomant * scale_factor[cplcoexp + mstrcplco]; | 667 | cplcomant * scale_factor[cplcoexp + mstrcplco]; |
668 | #else | 668 | #else |
669 | state->cplco[i][j] = (cplcomant << 11) >> (cplcoexp + mstrcplco); | 669 | state->cplco[i][j] = (cplcomant << 11) >> (cplcoexp + mstrcplco); |
670 | #endif | 670 | #endif |
671 | 671 | ||
672 | } | 672 | } |
673 | } | 673 | } |
674 | if ((state->acmod == 2) && state->phsflginu && cplcoe) | 674 | if ((state->acmod == 2) && state->phsflginu && cplcoe) |
675 | for (j = 0; j < state->ncplbnd; j++) | 675 | for (j = 0; j < state->ncplbnd; j++) |
676 | if (bitstream_get (state, 1)) /* phsflg */ | 676 | if (bitstream_get (state, 1)) /* phsflg */ |
677 | state->cplco[1][j] = -state->cplco[1][j]; | 677 | state->cplco[1][j] = -state->cplco[1][j]; |
678 | } | 678 | } |
679 | 679 | ||
680 | if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */ | 680 | if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */ |
681 | int end; | 681 | int end; |
682 | 682 | ||
683 | state->rematflg = 0; | 683 | state->rematflg = 0; |
684 | end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */ | 684 | end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */ |
685 | i = 0; | 685 | i = 0; |
686 | do | 686 | do |
687 | state->rematflg |= bitstream_get (state, 1) << i; | 687 | state->rematflg |= bitstream_get (state, 1) << i; |
688 | while (rematrix_band[i++] < end); | 688 | while (rematrix_band[i++] < end); |
689 | } | 689 | } |
690 | 690 | ||
691 | cplexpstr = EXP_REUSE; | 691 | cplexpstr = EXP_REUSE; |
692 | lfeexpstr = EXP_REUSE; | 692 | lfeexpstr = EXP_REUSE; |
693 | if (state->chincpl) /* cplinu */ | 693 | if (state->chincpl) /* cplinu */ |
694 | cplexpstr = bitstream_get (state, 2); | 694 | cplexpstr = bitstream_get (state, 2); |
695 | for (i = 0; i < nfchans; i++) | 695 | for (i = 0; i < nfchans; i++) |
696 | chexpstr[i] = bitstream_get (state, 2); | 696 | chexpstr[i] = bitstream_get (state, 2); |
697 | if (state->lfeon) | 697 | if (state->lfeon) |
698 | lfeexpstr = bitstream_get (state, 1); | 698 | lfeexpstr = bitstream_get (state, 1); |
699 | 699 | ||
700 | for (i = 0; i < nfchans; i++) | 700 | for (i = 0; i < nfchans; i++) |
701 | if (chexpstr[i] != EXP_REUSE) { | 701 | if (chexpstr[i] != EXP_REUSE) { |
702 | if ((state->chincpl >> i) & 1) | 702 | if ((state->chincpl >> i) & 1) |
703 | state->endmant[i] = state->cplstrtmant; | 703 | state->endmant[i] = state->cplstrtmant; |
704 | else { | 704 | else { |
705 | int chbwcod; | 705 | int chbwcod; |
706 | 706 | ||
707 | chbwcod = bitstream_get (state, 6); | 707 | chbwcod = bitstream_get (state, 6); |
708 | if (chbwcod > 60) | 708 | if (chbwcod > 60) |
709 | return 1; | 709 | return 1; |
710 | state->endmant[i] = chbwcod * 3 + 73; | 710 | state->endmant[i] = chbwcod * 3 + 73; |
711 | } | ||
711 | } | 712 | } |
712 | } | ||
713 | 713 | ||
714 | do_bit_alloc = 0; | 714 | do_bit_alloc = 0; |
715 | 715 | ||
716 | if (cplexpstr != EXP_REUSE) { | 716 | if (cplexpstr != EXP_REUSE) { |
717 | int cplabsexp, ncplgrps; | 717 | int cplabsexp, ncplgrps; |
718 | 718 | ||
719 | do_bit_alloc = 64; | 719 | do_bit_alloc = 64; |
720 | ncplgrps = ((state->cplendmant - state->cplstrtmant) / | 720 | ncplgrps = ((state->cplendmant - state->cplstrtmant) / |
721 | (3 << (cplexpstr - 1))); | 721 | (3 << (cplexpstr - 1))); |
722 | cplabsexp = bitstream_get (state, 4) << 1; | 722 | cplabsexp = bitstream_get (state, 4) << 1; |
723 | if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp, | 723 | if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp, |
724 | state->cpl_expbap.exp + state->cplstrtmant)) | 724 | state->cpl_expbap.exp + state->cplstrtmant)) |
725 | return 1; | 725 | return 1; |
726 | } | 726 | } |
727 | for (i = 0; i < nfchans; i++) | 727 | for (i = 0; i < nfchans; i++) |
728 | if (chexpstr[i] != EXP_REUSE) { | 728 | if (chexpstr[i] != EXP_REUSE) { |
729 | int grp_size, nchgrps; | 729 | int grp_size, nchgrps; |
730 | 730 | ||
731 | do_bit_alloc |= 1 << i; | 731 | do_bit_alloc |= 1 << i; |
732 | grp_size = 3 << (chexpstr[i] - 1); | 732 | grp_size = 3 << (chexpstr[i] - 1); |
733 | nchgrps = (state->endmant[i] + grp_size - 4) / grp_size; | 733 | nchgrps = (state->endmant[i] + grp_size - 4) / grp_size; |
734 | state->fbw_expbap[i].exp[0] = bitstream_get (state, 4); | 734 | state->fbw_expbap[i].exp[0] = bitstream_get (state, 4); |
735 | if (parse_exponents (state, chexpstr[i], nchgrps, | 735 | if (parse_exponents (state, chexpstr[i], nchgrps, |
736 | state->fbw_expbap[i].exp[0], | 736 | state->fbw_expbap[i].exp[0], |
737 | state->fbw_expbap[i].exp + 1)) | 737 | state->fbw_expbap[i].exp + 1)) |
738 | return 1; | 738 | return 1; |
739 | bitstream_get (state, 2); /* gainrng */ | 739 | bitstream_get (state, 2); /* gainrng */ |
740 | } | 740 | } |
741 | if (lfeexpstr != EXP_REUSE) { | 741 | if (lfeexpstr != EXP_REUSE) { |
742 | do_bit_alloc |= 32; | 742 | do_bit_alloc |= 32; |
743 | state->lfe_expbap.exp[0] = bitstream_get (state, 4); | 743 | state->lfe_expbap.exp[0] = bitstream_get (state, 4); |
744 | if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0], | 744 | if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0], |
745 | state->lfe_expbap.exp + 1)) | 745 | state->lfe_expbap.exp + 1)) |
746 | return 1; | 746 | return 1; |
747 | } | 747 | } |
748 | 748 | ||
749 | if (bitstream_get (state, 1)) { /* baie */ | 749 | if (bitstream_get (state, 1)) { /* baie */ |
750 | do_bit_alloc = 127; | 750 | do_bit_alloc = 127; |
751 | state->bai = bitstream_get (state, 11); | 751 | state->bai = bitstream_get (state, 11); |
752 | } | 752 | } |
753 | if (bitstream_get (state, 1)) { /* snroffste */ | 753 | if (bitstream_get (state, 1)) { /* snroffste */ |
754 | do_bit_alloc = 127; | 754 | do_bit_alloc = 127; |
755 | state->csnroffst = bitstream_get (state, 6); | 755 | state->csnroffst = bitstream_get (state, 6); |
756 | if (state->chincpl) /* cplinu */ | 756 | if (state->chincpl) /* cplinu */ |
757 | state->cplba.bai = bitstream_get (state, 7); | 757 | state->cplba.bai = bitstream_get (state, 7); |
758 | for (i = 0; i < nfchans; i++) | 758 | for (i = 0; i < nfchans; i++) |
759 | state->ba[i].bai = bitstream_get (state, 7); | 759 | state->ba[i].bai = bitstream_get (state, 7); |
760 | if (state->lfeon) | 760 | if (state->lfeon) |
761 | state->lfeba.bai = bitstream_get (state, 7); | 761 | state->lfeba.bai = bitstream_get (state, 7); |
762 | } | 762 | } |
763 | if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */ | 763 | if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */ |
764 | do_bit_alloc |= 64; | 764 | do_bit_alloc |= 64; |
765 | state->cplfleak = 9 - bitstream_get (state, 3); | 765 | state->cplfleak = 9 - bitstream_get (state, 3); |
766 | state->cplsleak = 9 - bitstream_get (state, 3); | 766 | state->cplsleak = 9 - bitstream_get (state, 3); |
767 | } | 767 | } |
768 | 768 | ||
769 | if (bitstream_get (state, 1)) { /* deltbaie */ | 769 | if (bitstream_get (state, 1)) { /* deltbaie */ |
770 | do_bit_alloc = 127; | 770 | do_bit_alloc = 127; |
771 | if (state->chincpl) /* cplinu */ | 771 | if (state->chincpl) /* cplinu */ |
772 | state->cplba.deltbae = bitstream_get (state, 2); | 772 | state->cplba.deltbae = bitstream_get (state, 2); |
773 | for (i = 0; i < nfchans; i++) | 773 | for (i = 0; i < nfchans; i++) |
774 | state->ba[i].deltbae = bitstream_get (state, 2); | 774 | state->ba[i].deltbae = bitstream_get (state, 2); |
775 | if (state->chincpl && /* cplinu */ | 775 | if (state->chincpl && /* cplinu */ |
776 | (state->cplba.deltbae == DELTA_BIT_NEW) && | 776 | (state->cplba.deltbae == DELTA_BIT_NEW) && |
777 | parse_deltba (state, state->cplba.deltba)) | 777 | parse_deltba (state, state->cplba.deltba)) |
778 | return 1; | 778 | return 1; |
779 | for (i = 0; i < nfchans; i++) | 779 | for (i = 0; i < nfchans; i++) |
780 | if ((state->ba[i].deltbae == DELTA_BIT_NEW) && | 780 | if ((state->ba[i].deltbae == DELTA_BIT_NEW) && |
781 | parse_deltba (state, state->ba[i].deltba)) | 781 | parse_deltba (state, state->ba[i].deltba)) |
782 | return 1; | 782 | return 1; |
783 | } | 783 | } |
784 | 784 | ||
785 | if (do_bit_alloc) { | 785 | if (do_bit_alloc) { |
786 | if (zero_snr_offsets (nfchans, state)) { | 786 | if (zero_snr_offsets (nfchans, state)) { |
787 | memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap)); | 787 | memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap)); |
788 | for (i = 0; i < nfchans; i++) | 788 | for (i = 0; i < nfchans; i++) |
789 | memset (state->fbw_expbap[i].bap, 0, | 789 | memset (state->fbw_expbap[i].bap, 0, |
790 | sizeof (state->fbw_expbap[i].bap)); | 790 | sizeof (state->fbw_expbap[i].bap)); |
791 | memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap)); | 791 | memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap)); |
792 | } else { | 792 | } else { |
793 | if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */ | 793 | if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */ |
794 | a52_bit_allocate (state, &state->cplba, state->cplstrtbnd, | 794 | a52_bit_allocate (state, &state->cplba, state->cplstrtbnd, |
795 | state->cplstrtmant, state->cplendmant, | 795 | state->cplstrtmant, state->cplendmant, |
796 | state->cplfleak << 8, state->cplsleak << 8, | 796 | state->cplfleak << 8, state->cplsleak << 8, |
797 | &state->cpl_expbap); | 797 | &state->cpl_expbap); |
798 | for (i = 0; i < nfchans; i++) | 798 | for (i = 0; i < nfchans; i++) |
799 | if (do_bit_alloc & (1 << i)) | 799 | if (do_bit_alloc & (1 << i)) |
800 | a52_bit_allocate (state, state->ba + i, 0, 0, | 800 | a52_bit_allocate (state, state->ba + i, 0, 0, |
801 | state->endmant[i], 0, 0, | 801 | state->endmant[i], 0, 0, |
802 | state->fbw_expbap +i); | 802 | state->fbw_expbap +i); |
803 | if (state->lfeon && (do_bit_alloc & 32)) { | 803 | if (state->lfeon && (do_bit_alloc & 32)) { |
804 | state->lfeba.deltbae = DELTA_BIT_NONE; | 804 | state->lfeba.deltbae = DELTA_BIT_NONE; |
805 | a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0, | 805 | a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0, |
806 | &state->lfe_expbap); | 806 | &state->lfe_expbap); |
807 | } | ||
807 | } | 808 | } |
808 | } | 809 | } |
809 | } | ||
810 | 810 | ||
811 | if (bitstream_get (state, 1)) { /* skiple */ | 811 | if (bitstream_get (state, 1)) { /* skiple */ |
812 | i = bitstream_get (state, 9); /* skipl */ | 812 | i = bitstream_get (state, 9); /* skipl */ |
813 | while (i--) | 813 | while (i--) |
814 | bitstream_get (state, 8); | 814 | bitstream_get (state, 8); |
815 | } | 815 | } |
816 | 816 | ||
817 | samples = state->samples; | 817 | samples = state->samples; |
818 | if (state->output & A52_LFE) | 818 | if (state->output & A52_LFE) |
819 | samples += 256; /* shift for LFE channel */ | 819 | samples += 256; /* shift for LFE channel */ |
820 | 820 | ||
821 | chanbias = a52_downmix_coeff (coeff, state->acmod, state->output, | 821 | chanbias = a52_downmix_coeff (coeff, state->acmod, state->output, |
822 | state->dynrng, state->clev, state->slev); | 822 | state->dynrng, state->clev, state->slev); |
823 | 823 | ||
824 | quant.q1_ptr = quant.q2_ptr = quant.q4_ptr = -1; | 824 | quant.q1_ptr = quant.q2_ptr = quant.q4_ptr = -1; |
825 | done_cpl = 0; | 825 | done_cpl = 0; |
826 | 826 | ||
827 | for (i = 0; i < nfchans; i++) { | 827 | for (i = 0; i < nfchans; i++) { |
828 | int j; | 828 | int j; |
829 | 829 | ||
830 | coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quant, | 830 | coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quant, |
831 | coeff[i], dithflag[i], state->endmant[i]); | 831 | coeff[i], dithflag[i], state->endmant[i]); |
832 | 832 | ||
833 | if ((state->chincpl >> i) & 1) { | 833 | if ((state->chincpl >> i) & 1) { |
834 | if (!done_cpl) { | 834 | if (!done_cpl) { |
835 | done_cpl = 1; | 835 | done_cpl = 1; |
836 | coeff_get_coupling (state, nfchans, coeff, | 836 | coeff_get_coupling (state, nfchans, coeff, |
837 | (sample_t (*)[256])samples, &quant, | 837 | (sample_t (*)[256])samples, &quant, |
838 | dithflag); | 838 | dithflag); |
839 | } | 839 | } |
840 | j = state->cplendmant; | 840 | j = state->cplendmant; |
841 | } else | 841 | } else |
842 | j = state->endmant[i]; | 842 | j = state->endmant[i]; |
843 | do | 843 | do |
844 | (samples + 256 * i)[j] = 0; | 844 | (samples + 256 * i)[j] = 0; |
845 | while (++j < 256); | 845 | while (++j < 256); |
846 | } | 846 | } |
847 | 847 | ||
848 | if (state->acmod == 2) { | 848 | if (state->acmod == 2) { |
849 | int j, end, band, rematflg; | 849 | int j, end, band, rematflg; |
850 | 850 | ||
851 | end = ((state->endmant[0] < state->endmant[1]) ? | 851 | end = ((state->endmant[0] < state->endmant[1]) ? |
852 | state->endmant[0] : state->endmant[1]); | 852 | state->endmant[0] : state->endmant[1]); |
853 | 853 | ||
854 | i = 0; | 854 | i = 0; |
855 | j = 13; | 855 | j = 13; |
856 | rematflg = state->rematflg; | 856 | rematflg = state->rematflg; |
857 | do { | ||
858 | if (! (rematflg & 1)) { | ||
859 | rematflg >>= 1; | ||
860 | j = rematrix_band[i++]; | ||
861 | continue; | ||
862 | } | ||
863 | rematflg >>= 1; | ||
864 | band = rematrix_band[i++]; | ||
865 | if (band > end) | ||
866 | band = end; | ||
867 | do { | 857 | do { |
868 | sample_t tmp0, tmp1; | 858 | if (! (rematflg & 1)) { |
869 | 859 | rematflg >>= 1; | |
870 | tmp0 = samples[j]; | 860 | j = rematrix_band[i++]; |
871 | tmp1 = (samples+256)[j]; | 861 | continue; |
872 | samples[j] = tmp0 + tmp1; | 862 | } |
873 | (samples+256)[j] = tmp0 - tmp1; | 863 | rematflg >>= 1; |
874 | } while (++j < band); | 864 | band = rematrix_band[i++]; |
875 | } while (j < end); | 865 | if (band > end) |
866 | band = end; | ||
867 | do { | ||
868 | sample_t tmp0, tmp1; | ||
869 | |||
870 | tmp0 = samples[j]; | ||
871 | tmp1 = (samples+256)[j]; | ||
872 | samples[j] = tmp0 + tmp1; | ||
873 | (samples+256)[j] = tmp0 - tmp1; | ||
874 | } while (++j < band); | ||
875 | } while (j < end); | ||
876 | } | 876 | } |
877 | 877 | ||
878 | if (state->lfeon) { | 878 | if (state->lfeon) { |
879 | if (state->output & A52_LFE) { | 879 | if (state->output & A52_LFE) { |
880 | coeff_get (state, samples - 256, &state->lfe_expbap, &quant, | 880 | coeff_get (state, samples - 256, &state->lfe_expbap, &quant, |
881 | state->dynrng, 0, 7); | 881 | state->dynrng, 0, 7); |
882 | for (i = 7; i < 256; i++) | 882 | for (i = 7; i < 256; i++) |
883 | (samples-256)[i] = 0; | 883 | (samples-256)[i] = 0; |
884 | a52_imdct_512 (samples - 256, samples + 1536 - 256); | 884 | a52_imdct_512 (samples - 256, samples + 1536 - 256); |
885 | } else { | 885 | } else { |
886 | /* just skip the LFE coefficients */ | 886 | /* just skip the LFE coefficients */ |
887 | coeff_get (state, samples + 1280, &state->lfe_expbap, &quant, | 887 | coeff_get (state, samples + 1280, &state->lfe_expbap, &quant, |
888 | 0, 0, 7); | 888 | 0, 0, 7); |
889 | } | 889 | } |
890 | } | 890 | } |
891 | 891 | ||
892 | i = 0; | 892 | i = 0; |
893 | if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans) | 893 | if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans) |
894 | for (i = 1; i < nfchans; i++) | 894 | for (i = 1; i < nfchans; i++) |
895 | if (blksw[i] != blksw[0]) | 895 | if (blksw[i] != blksw[0]) |
896 | break; | 896 | break; |
897 | 897 | ||
898 | if (i < nfchans) { | 898 | if (i < nfchans) { |
899 | if (state->downmixed) { | 899 | if (state->downmixed) { |
900 | state->downmixed = 0; | 900 | state->downmixed = 0; |
901 | a52_upmix (samples + 1536, state->acmod, state->output); | 901 | a52_upmix (samples + 1536, state->acmod, state->output); |
902 | } | 902 | } |
903 | 903 | ||
904 | for (i = 0; i < nfchans; i++) { | 904 | for (i = 0; i < nfchans; i++) { |
905 | sample_t bias; | 905 | sample_t bias; |
906 | 906 | ||
907 | bias = 0; | 907 | bias = 0; |
908 | if (!(chanbias & (1 << i))) | 908 | if (!(chanbias & (1 << i))) |
909 | bias = state->bias; | 909 | bias = state->bias; |
910 | 910 | ||
911 | if (coeff[i]) { | 911 | if (coeff[i]) { |
912 | if (blksw[i]) | 912 | if (blksw[i]) |
913 | a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); | 913 | a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); |
914 | else | 914 | else |
915 | a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); | 915 | a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); |
916 | } else { | 916 | } else { |
917 | int j; | 917 | int j; |
918 | 918 | ||
919 | for (j = 0; j < 256; j++) | 919 | for (j = 0; j < 256; j++) |
920 | (samples + 256 * i)[j] = bias; | 920 | (samples + 256 * i)[j] = bias; |
921 | } | ||
921 | } | 922 | } |
922 | } | ||
923 | 923 | ||
924 | a52_downmix (samples, state->acmod, state->output, | 924 | a52_downmix (samples, state->acmod, state->output, |
925 | state->clev, state->slev); | 925 | state->clev, state->slev); |
926 | } else { | 926 | } else { |
927 | nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK]; | 927 | nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK]; |
928 | 928 | ||
929 | a52_downmix (samples, state->acmod, state->output, | 929 | a52_downmix (samples, state->acmod, state->output, |
930 | state->clev, state->slev); | 930 | state->clev, state->slev); |
931 | 931 | ||
932 | if (!state->downmixed) { | 932 | if (!state->downmixed) { |
933 | state->downmixed = 1; | 933 | state->downmixed = 1; |
934 | a52_downmix (samples + 1536, state->acmod, state->output, | 934 | a52_downmix (samples + 1536, state->acmod, state->output, |
935 | state->clev, state->slev); | 935 | state->clev, state->slev); |
936 | } | 936 | } |
937 | 937 | ||
938 | if (blksw[0]) | 938 | if (blksw[0]) |
939 | for (i = 0; i < nfchans; i++) | 939 | for (i = 0; i < nfchans; i++) |
940 | a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); | 940 | a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); |
941 | else | 941 | else |
942 | for (i = 0; i < nfchans; i++) | 942 | for (i = 0; i < nfchans; i++) |
943 | a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); | 943 | a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); |
944 | } | 944 | } |
945 | 945 | ||
946 | return 0; | 946 | return 0; |
diff --git a/apps/codecs/libmad/bit.c b/apps/codecs/libmad/bit.c index f3cca84b2b..660c78d9f9 100644 --- a/apps/codecs/libmad/bit.c +++ b/apps/codecs/libmad/bit.c | |||
@@ -87,7 +87,7 @@ unsigned short const crc_table[256] = { | |||
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * NAME: bit->init() | 90 | * NAME: bit->init() |
91 | * DESCRIPTION: initialize bit pointer struct | 91 | * DESCRIPTION: initialize bit pointer struct |
92 | */ | 92 | */ |
93 | void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) | 93 | void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) |
@@ -97,11 +97,11 @@ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * NAME: bit->length() | 100 | * NAME: bit->length() |
101 | * DESCRIPTION: return number of bits between start and end points | 101 | * DESCRIPTION: return number of bits between start and end points |
102 | */ | 102 | */ |
103 | unsigned int mad_bit_length(struct mad_bitptr const *begin, | 103 | unsigned int mad_bit_length(struct mad_bitptr const *begin, |
104 | struct mad_bitptr const *end) | 104 | struct mad_bitptr const *end) |
105 | { | 105 | { |
106 | return end->readbit - begin->readbit; | 106 | return end->readbit - begin->readbit; |
107 | } | 107 | } |
@@ -111,7 +111,7 @@ unsigned char mad_bit_bitsleft(struct mad_bitptr const *bitptr) | |||
111 | return 8 - (bitptr->readbit & 7); | 111 | return 8 - (bitptr->readbit & 7); |
112 | } | 112 | } |
113 | /* | 113 | /* |
114 | * NAME: bit->nextbyte() | 114 | * NAME: bit->nextbyte() |
115 | * DESCRIPTION: return pointer to next unprocessed byte | 115 | * DESCRIPTION: return pointer to next unprocessed byte |
116 | */ | 116 | */ |
117 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) | 117 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) |
@@ -120,7 +120,7 @@ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) | |||
120 | } | 120 | } |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * NAME: bit->skip() | 123 | * NAME: bit->skip() |
124 | * DESCRIPTION: advance bit pointer | 124 | * DESCRIPTION: advance bit pointer |
125 | */ | 125 | */ |
126 | void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) | 126 | void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) |
@@ -129,7 +129,7 @@ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /* | 131 | /* |
132 | * NAME: bit->read() | 132 | * NAME: bit->read() |
133 | * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value | 133 | * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value |
134 | */ | 134 | */ |
135 | 135 | ||
@@ -154,11 +154,11 @@ uint32_t mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) | |||
154 | 154 | ||
155 | # if 0 | 155 | # if 0 |
156 | /* | 156 | /* |
157 | * NAME: bit->write() | 157 | * NAME: bit->write() |
158 | * DESCRIPTION: write an arbitrary number of bits | 158 | * DESCRIPTION: write an arbitrary number of bits |
159 | */ | 159 | */ |
160 | void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, | 160 | void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, |
161 | uint32_t value) | 161 | uint32_t value) |
162 | { | 162 | { |
163 | unsigned char *ptr; | 163 | unsigned char *ptr; |
164 | 164 | ||
@@ -169,11 +169,11 @@ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, | |||
169 | # endif | 169 | # endif |
170 | 170 | ||
171 | /* | 171 | /* |
172 | * NAME: bit->crc() | 172 | * NAME: bit->crc() |
173 | * DESCRIPTION: compute CRC-check word | 173 | * DESCRIPTION: compute CRC-check word |
174 | */ | 174 | */ |
175 | unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, | 175 | unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, |
176 | unsigned short init) | 176 | unsigned short init) |
177 | { | 177 | { |
178 | register unsigned int crc; | 178 | register unsigned int crc; |
179 | 179 | ||
@@ -190,11 +190,11 @@ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, | |||
190 | 190 | ||
191 | switch (len / 8) { | 191 | switch (len / 8) { |
192 | case 3: crc = (crc << 8) ^ | 192 | case 3: crc = (crc << 8) ^ |
193 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 193 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
194 | case 2: crc = (crc << 8) ^ | 194 | case 2: crc = (crc << 8) ^ |
195 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 195 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
196 | case 1: crc = (crc << 8) ^ | 196 | case 1: crc = (crc << 8) ^ |
197 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 197 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
198 | 198 | ||
199 | len %= 8; | 199 | len %= 8; |
200 | 200 | ||
diff --git a/apps/codecs/libmad/bit.h b/apps/codecs/libmad/bit.h index ad13373eee..985109f906 100644 --- a/apps/codecs/libmad/bit.h +++ b/apps/codecs/libmad/bit.h | |||
@@ -29,10 +29,10 @@ struct mad_bitptr { | |||
29 | 29 | ||
30 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); | 30 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); |
31 | 31 | ||
32 | # define mad_bit_finish(bitptr) /* nothing */ | 32 | # define mad_bit_finish(bitptr) /* nothing */ |
33 | 33 | ||
34 | unsigned int mad_bit_length(struct mad_bitptr const *, | 34 | unsigned int mad_bit_length(struct mad_bitptr const *, |
35 | struct mad_bitptr const *); | 35 | struct mad_bitptr const *); |
36 | 36 | ||
37 | unsigned char mad_bit_bitsleft(struct mad_bitptr const *bitptr); | 37 | unsigned char mad_bit_bitsleft(struct mad_bitptr const *bitptr); |
38 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); | 38 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); |
diff --git a/apps/codecs/libmad/decoder.c b/apps/codecs/libmad/decoder.c index dfa45aaa34..46f4dfe5f7 100644 --- a/apps/codecs/libmad/decoder.c +++ b/apps/codecs/libmad/decoder.c | |||
@@ -51,25 +51,25 @@ | |||
51 | # include "decoder.h" | 51 | # include "decoder.h" |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * NAME: decoder->init() | 54 | * NAME: decoder->init() |
55 | * DESCRIPTION: initialize a decoder object with callback routines | 55 | * DESCRIPTION: initialize a decoder object with callback routines |
56 | */ | 56 | */ |
57 | void mad_decoder_init(struct mad_decoder *decoder, void *data, | 57 | void mad_decoder_init(struct mad_decoder *decoder, void *data, |
58 | enum mad_flow (*input_func)(void *, | 58 | enum mad_flow (*input_func)(void *, |
59 | struct mad_stream *), | 59 | struct mad_stream *), |
60 | enum mad_flow (*header_func)(void *, | 60 | enum mad_flow (*header_func)(void *, |
61 | struct mad_header const *), | 61 | struct mad_header const *), |
62 | enum mad_flow (*filter_func)(void *, | 62 | enum mad_flow (*filter_func)(void *, |
63 | struct mad_stream const *, | 63 | struct mad_stream const *, |
64 | struct mad_frame *), | 64 | struct mad_frame *), |
65 | enum mad_flow (*output_func)(void *, | 65 | enum mad_flow (*output_func)(void *, |
66 | struct mad_header const *, | 66 | struct mad_header const *, |
67 | struct mad_pcm *), | 67 | struct mad_pcm *), |
68 | enum mad_flow (*error_func)(void *, | 68 | enum mad_flow (*error_func)(void *, |
69 | struct mad_stream *, | 69 | struct mad_stream *, |
70 | struct mad_frame *), | 70 | struct mad_frame *), |
71 | enum mad_flow (*message_func)(void *, | 71 | enum mad_flow (*message_func)(void *, |
72 | void *, unsigned int *)) | 72 | void *, unsigned int *)) |
73 | { | 73 | { |
74 | decoder->mode = -1; | 74 | decoder->mode = -1; |
75 | 75 | ||
@@ -237,9 +237,9 @@ enum mad_flow receive(int fd, void **message, unsigned int *size) | |||
237 | 237 | ||
238 | if (*size > 0) { | 238 | if (*size > 0) { |
239 | if (*message == 0) { | 239 | if (*message == 0) { |
240 | *message = malloc(*size); | 240 | *message = malloc(*size); |
241 | if (*message == 0) | 241 | if (*message == 0) |
242 | return MAD_FLOW_BREAK; | 242 | return MAD_FLOW_BREAK; |
243 | } | 243 | } |
244 | 244 | ||
245 | result = receive_io_blocking(fd, *message, *size); | 245 | result = receive_io_blocking(fd, *message, *size); |
@@ -278,8 +278,8 @@ enum mad_flow check_message(struct mad_decoder *decoder) | |||
278 | result = decoder->message_func(decoder->cb_data, message, &size); | 278 | result = decoder->message_func(decoder->cb_data, message, &size); |
279 | 279 | ||
280 | if (result == MAD_FLOW_IGNORE || | 280 | if (result == MAD_FLOW_IGNORE || |
281 | result == MAD_FLOW_BREAK) | 281 | result == MAD_FLOW_BREAK) |
282 | size = 0; | 282 | size = 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) | 285 | if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) |
@@ -295,7 +295,7 @@ enum mad_flow check_message(struct mad_decoder *decoder) | |||
295 | 295 | ||
296 | static | 296 | static |
297 | enum mad_flow error_default(void *data, struct mad_stream *stream, | 297 | enum mad_flow error_default(void *data, struct mad_stream *stream, |
298 | struct mad_frame *frame) | 298 | struct mad_frame *frame) |
299 | { | 299 | { |
300 | int *bad_last_frame = data; | 300 | int *bad_last_frame = data; |
301 | 301 | ||
@@ -361,92 +361,92 @@ int run_sync(struct mad_decoder *decoder) | |||
361 | while (1) { | 361 | while (1) { |
362 | # if defined(USE_ASYNC) | 362 | # if defined(USE_ASYNC) |
363 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { | 363 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { |
364 | switch (check_message(decoder)) { | 364 | switch (check_message(decoder)) { |
365 | case MAD_FLOW_IGNORE: | 365 | case MAD_FLOW_IGNORE: |
366 | case MAD_FLOW_CONTINUE: | 366 | case MAD_FLOW_CONTINUE: |
367 | break; | 367 | break; |
368 | case MAD_FLOW_BREAK: | 368 | case MAD_FLOW_BREAK: |
369 | goto fail; | 369 | goto fail; |
370 | case MAD_FLOW_STOP: | 370 | case MAD_FLOW_STOP: |
371 | goto done; | 371 | goto done; |
372 | } | 372 | } |
373 | } | 373 | } |
374 | # endif | 374 | # endif |
375 | 375 | ||
376 | if (decoder->header_func) { | 376 | if (decoder->header_func) { |
377 | if (mad_header_decode(&frame->header, stream) == -1) { | 377 | if (mad_header_decode(&frame->header, stream) == -1) { |
378 | if (!MAD_RECOVERABLE(stream->error)) | 378 | if (!MAD_RECOVERABLE(stream->error)) |
379 | break; | 379 | break; |
380 | 380 | ||
381 | switch (error_func(error_data, stream, frame)) { | 381 | switch (error_func(error_data, stream, frame)) { |
382 | case MAD_FLOW_STOP: | 382 | case MAD_FLOW_STOP: |
383 | goto done; | 383 | goto done; |
384 | case MAD_FLOW_BREAK: | 384 | case MAD_FLOW_BREAK: |
385 | goto fail; | 385 | goto fail; |
386 | case MAD_FLOW_IGNORE: | 386 | case MAD_FLOW_IGNORE: |
387 | case MAD_FLOW_CONTINUE: | 387 | case MAD_FLOW_CONTINUE: |
388 | default: | 388 | default: |
389 | continue; | 389 | continue; |
390 | } | 390 | } |
391 | } | 391 | } |
392 | 392 | ||
393 | switch (decoder->header_func(decoder->cb_data, &frame->header)) { | 393 | switch (decoder->header_func(decoder->cb_data, &frame->header)) { |
394 | case MAD_FLOW_STOP: | 394 | case MAD_FLOW_STOP: |
395 | goto done; | 395 | goto done; |
396 | case MAD_FLOW_BREAK: | 396 | case MAD_FLOW_BREAK: |
397 | goto fail; | 397 | goto fail; |
398 | case MAD_FLOW_IGNORE: | 398 | case MAD_FLOW_IGNORE: |
399 | continue; | 399 | continue; |
400 | case MAD_FLOW_CONTINUE: | 400 | case MAD_FLOW_CONTINUE: |
401 | break; | 401 | break; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | 404 | ||
405 | if (mad_frame_decode(frame, stream) == -1) { | 405 | if (mad_frame_decode(frame, stream) == -1) { |
406 | if (!MAD_RECOVERABLE(stream->error)) | 406 | if (!MAD_RECOVERABLE(stream->error)) |
407 | break; | 407 | break; |
408 | 408 | ||
409 | switch (error_func(error_data, stream, frame)) { | 409 | switch (error_func(error_data, stream, frame)) { |
410 | case MAD_FLOW_STOP: | 410 | case MAD_FLOW_STOP: |
411 | goto done; | 411 | goto done; |
412 | case MAD_FLOW_BREAK: | 412 | case MAD_FLOW_BREAK: |
413 | goto fail; | 413 | goto fail; |
414 | case MAD_FLOW_IGNORE: | 414 | case MAD_FLOW_IGNORE: |
415 | break; | 415 | break; |
416 | case MAD_FLOW_CONTINUE: | 416 | case MAD_FLOW_CONTINUE: |
417 | default: | 417 | default: |
418 | continue; | 418 | continue; |
419 | } | 419 | } |
420 | } | 420 | } |
421 | else | 421 | else |
422 | bad_last_frame = 0; | 422 | bad_last_frame = 0; |
423 | 423 | ||
424 | if (decoder->filter_func) { | 424 | if (decoder->filter_func) { |
425 | switch (decoder->filter_func(decoder->cb_data, stream, frame)) { | 425 | switch (decoder->filter_func(decoder->cb_data, stream, frame)) { |
426 | case MAD_FLOW_STOP: | 426 | case MAD_FLOW_STOP: |
427 | goto done; | 427 | goto done; |
428 | case MAD_FLOW_BREAK: | 428 | case MAD_FLOW_BREAK: |
429 | goto fail; | 429 | goto fail; |
430 | case MAD_FLOW_IGNORE: | 430 | case MAD_FLOW_IGNORE: |
431 | continue; | 431 | continue; |
432 | case MAD_FLOW_CONTINUE: | 432 | case MAD_FLOW_CONTINUE: |
433 | break; | 433 | break; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | mad_synth_frame(synth, frame); | 437 | mad_synth_frame(synth, frame); |
438 | 438 | ||
439 | if (decoder->output_func) { | 439 | if (decoder->output_func) { |
440 | switch (decoder->output_func(decoder->cb_data, | 440 | switch (decoder->output_func(decoder->cb_data, |
441 | &frame->header, &synth->pcm)) { | 441 | &frame->header, &synth->pcm)) { |
442 | case MAD_FLOW_STOP: | 442 | case MAD_FLOW_STOP: |
443 | goto done; | 443 | goto done; |
444 | case MAD_FLOW_BREAK: | 444 | case MAD_FLOW_BREAK: |
445 | goto fail; | 445 | goto fail; |
446 | case MAD_FLOW_IGNORE: | 446 | case MAD_FLOW_IGNORE: |
447 | case MAD_FLOW_CONTINUE: | 447 | case MAD_FLOW_CONTINUE: |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | } | 451 | } |
452 | } | 452 | } |
@@ -528,7 +528,7 @@ int run_async(struct mad_decoder *decoder) | |||
528 | # endif | 528 | # endif |
529 | 529 | ||
530 | /* | 530 | /* |
531 | * NAME: decoder->run() | 531 | * NAME: decoder->run() |
532 | * DESCRIPTION: run the decoder thread either synchronously or asynchronously | 532 | * DESCRIPTION: run the decoder thread either synchronously or asynchronously |
533 | */ | 533 | */ |
534 | int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | 534 | int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) |
@@ -564,11 +564,11 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | |||
564 | } | 564 | } |
565 | 565 | ||
566 | /* | 566 | /* |
567 | * NAME: decoder->message() | 567 | * NAME: decoder->message() |
568 | * DESCRIPTION: send a message to and receive a reply from the decoder process | 568 | * DESCRIPTION: send a message to and receive a reply from the decoder process |
569 | */ | 569 | */ |
570 | int mad_decoder_message(struct mad_decoder *decoder, | 570 | int mad_decoder_message(struct mad_decoder *decoder, |
571 | void *message, unsigned int *len) | 571 | void *message, unsigned int *len) |
572 | { | 572 | { |
573 | # if defined(USE_ASYNC) | 573 | # if defined(USE_ASYNC) |
574 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || | 574 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || |
diff --git a/apps/codecs/libmad/decoder.h b/apps/codecs/libmad/decoder.h index 1f022154f2..b9ea0b188f 100644 --- a/apps/codecs/libmad/decoder.h +++ b/apps/codecs/libmad/decoder.h | |||
@@ -60,26 +60,26 @@ struct mad_decoder { | |||
60 | enum mad_flow (*input_func)(void *, struct mad_stream *); | 60 | enum mad_flow (*input_func)(void *, struct mad_stream *); |
61 | enum mad_flow (*header_func)(void *, struct mad_header const *); | 61 | enum mad_flow (*header_func)(void *, struct mad_header const *); |
62 | enum mad_flow (*filter_func)(void *, | 62 | enum mad_flow (*filter_func)(void *, |
63 | struct mad_stream const *, struct mad_frame *); | 63 | struct mad_stream const *, struct mad_frame *); |
64 | enum mad_flow (*output_func)(void *, | 64 | enum mad_flow (*output_func)(void *, |
65 | struct mad_header const *, struct mad_pcm *); | 65 | struct mad_header const *, struct mad_pcm *); |
66 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); | 66 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
67 | enum mad_flow (*message_func)(void *, void *, unsigned int *); | 67 | enum mad_flow (*message_func)(void *, void *, unsigned int *); |
68 | }; | 68 | }; |
69 | 69 | ||
70 | void mad_decoder_init(struct mad_decoder *, void *, | 70 | void mad_decoder_init(struct mad_decoder *, void *, |
71 | enum mad_flow (*)(void *, struct mad_stream *), | 71 | enum mad_flow (*)(void *, struct mad_stream *), |
72 | enum mad_flow (*)(void *, struct mad_header const *), | 72 | enum mad_flow (*)(void *, struct mad_header const *), |
73 | enum mad_flow (*)(void *, | 73 | enum mad_flow (*)(void *, |
74 | struct mad_stream const *, | 74 | struct mad_stream const *, |
75 | struct mad_frame *), | 75 | struct mad_frame *), |
76 | enum mad_flow (*)(void *, | 76 | enum mad_flow (*)(void *, |
77 | struct mad_header const *, | 77 | struct mad_header const *, |
78 | struct mad_pcm *), | 78 | struct mad_pcm *), |
79 | enum mad_flow (*)(void *, | 79 | enum mad_flow (*)(void *, |
80 | struct mad_stream *, | 80 | struct mad_stream *, |
81 | struct mad_frame *), | 81 | struct mad_frame *), |
82 | enum mad_flow (*)(void *, void *, unsigned int *)); | 82 | enum mad_flow (*)(void *, void *, unsigned int *)); |
83 | int mad_decoder_finish(struct mad_decoder *); | 83 | int mad_decoder_finish(struct mad_decoder *); |
84 | 84 | ||
85 | # define mad_decoder_options(decoder, opts) \ | 85 | # define mad_decoder_options(decoder, opts) \ |
diff --git a/apps/codecs/libmad/fixed.c b/apps/codecs/libmad/fixed.c index f2f0a3ce4a..e839232058 100644 --- a/apps/codecs/libmad/fixed.c +++ b/apps/codecs/libmad/fixed.c | |||
@@ -28,7 +28,7 @@ | |||
28 | # include "fixed.h" | 28 | # include "fixed.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * NAME: fixed->abs() | 31 | * NAME: fixed->abs() |
32 | * DESCRIPTION: return absolute value of a fixed-point number | 32 | * DESCRIPTION: return absolute value of a fixed-point number |
33 | */ | 33 | */ |
34 | mad_fixed_t mad_f_abs(mad_fixed_t x) | 34 | mad_fixed_t mad_f_abs(mad_fixed_t x) |
@@ -37,7 +37,7 @@ mad_fixed_t mad_f_abs(mad_fixed_t x) | |||
37 | } | 37 | } |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * NAME: fixed->div() | 40 | * NAME: fixed->div() |
41 | * DESCRIPTION: perform division using fixed-point math | 41 | * DESCRIPTION: perform division using fixed-point math |
42 | */ | 42 | */ |
43 | mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) | 43 | mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) |
diff --git a/apps/codecs/libmad/fixed.h b/apps/codecs/libmad/fixed.h index 84bb5954e3..c0b4c0f7df 100644 --- a/apps/codecs/libmad/fixed.h +++ b/apps/codecs/libmad/fixed.h | |||
@@ -64,50 +64,50 @@ typedef mad_fixed_t mad_sample_t; | |||
64 | * supported, and must be done with care. | 64 | * supported, and must be done with care. |
65 | */ | 65 | */ |
66 | 66 | ||
67 | # define MAD_F_FRACBITS 28 | 67 | # define MAD_F_FRACBITS 28 |
68 | 68 | ||
69 | # if MAD_F_FRACBITS == 28 | 69 | # if MAD_F_FRACBITS == 28 |
70 | # define MAD_F(x) ((mad_fixed_t) (x##L)) | 70 | # define MAD_F(x) ((mad_fixed_t) (x##L)) |
71 | # else | 71 | # else |
72 | # if MAD_F_FRACBITS < 28 | 72 | # if MAD_F_FRACBITS < 28 |
73 | # warning "MAD_F_FRACBITS < 28" | 73 | # warning "MAD_F_FRACBITS < 28" |
74 | # define MAD_F(x) ((mad_fixed_t) \ | 74 | # define MAD_F(x) ((mad_fixed_t) \ |
75 | (((x##L) + \ | 75 | (((x##L) + \ |
76 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ | 76 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ |
77 | (28 - MAD_F_FRACBITS))) | 77 | (28 - MAD_F_FRACBITS))) |
78 | # elif MAD_F_FRACBITS > 28 | 78 | # elif MAD_F_FRACBITS > 28 |
79 | # error "MAD_F_FRACBITS > 28 not currently supported" | 79 | # error "MAD_F_FRACBITS > 28 not currently supported" |
80 | # define MAD_F(x) ((mad_fixed_t) \ | 80 | # define MAD_F(x) ((mad_fixed_t) \ |
81 | ((x##L) << (MAD_F_FRACBITS - 28))) | 81 | ((x##L) << (MAD_F_FRACBITS - 28))) |
82 | # endif | 82 | # endif |
83 | # endif | 83 | # endif |
84 | 84 | ||
85 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) | 85 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) |
86 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) | 86 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) |
87 | 87 | ||
88 | # define MAD_F_ONE MAD_F(0x10000000) | 88 | # define MAD_F_ONE MAD_F(0x10000000) |
89 | 89 | ||
90 | # define mad_f_tofixed(x) ((mad_fixed_t) \ | 90 | # define mad_f_tofixed(x) ((mad_fixed_t) \ |
91 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) | 91 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) |
92 | # define mad_f_todouble(x) ((double) \ | 92 | # define mad_f_todouble(x) ((double) \ |
93 | ((x) / (double) (1L << MAD_F_FRACBITS))) | 93 | ((x) / (double) (1L << MAD_F_FRACBITS))) |
94 | 94 | ||
95 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) | 95 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) |
96 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) | 96 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) |
97 | /* (x should be positive) */ | 97 | /* (x should be positive) */ |
98 | 98 | ||
99 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) | 99 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) |
100 | 100 | ||
101 | # define mad_f_add(x, y) ((x) + (y)) | 101 | # define mad_f_add(x, y) ((x) + (y)) |
102 | # define mad_f_sub(x, y) ((x) - (y)) | 102 | # define mad_f_sub(x, y) ((x) - (y)) |
103 | 103 | ||
104 | # if defined(FPM_FLOAT) | 104 | # if defined(FPM_FLOAT) |
105 | # error "FPM_FLOAT not yet supported" | 105 | # error "FPM_FLOAT not yet supported" |
106 | 106 | ||
107 | # undef MAD_F | 107 | # undef MAD_F |
108 | # define MAD_F(x) mad_f_todouble(x) | 108 | # define MAD_F(x) mad_f_todouble(x) |
109 | 109 | ||
110 | # define mad_f_mul(x, y) ((x) * (y)) | 110 | # define mad_f_mul(x, y) ((x) * (y)) |
111 | # define mad_f_scale64 | 111 | # define mad_f_scale64 |
112 | 112 | ||
113 | # undef ASO_ZEROCHECK | 113 | # undef ASO_ZEROCHECK |
@@ -154,7 +154,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
154 | } | 154 | } |
155 | # pragma warning(pop) | 155 | # pragma warning(pop) |
156 | 156 | ||
157 | # define mad_f_mul mad_f_mul_inline | 157 | # define mad_f_mul mad_f_mul_inline |
158 | # define mad_f_scale64 | 158 | # define mad_f_scale64 |
159 | # else | 159 | # else |
160 | /* | 160 | /* |
@@ -163,9 +163,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
163 | */ | 163 | */ |
164 | # define MAD_F_MLX(hi, lo, x, y) \ | 164 | # define MAD_F_MLX(hi, lo, x, y) \ |
165 | asm ("imull %3" \ | 165 | asm ("imull %3" \ |
166 | : "=a" (lo), "=d" (hi) \ | 166 | : "=a" (lo), "=d" (hi) \ |
167 | : "%a" (x), "rm" (y) \ | 167 | : "%a" (x), "rm" (y) \ |
168 | : "cc") | 168 | : "cc") |
169 | 169 | ||
170 | # if defined(OPT_ACCURACY) | 170 | # if defined(OPT_ACCURACY) |
171 | /* | 171 | /* |
@@ -176,10 +176,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
176 | mad_fixed64lo_t __lo; \ | 176 | mad_fixed64lo_t __lo; \ |
177 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 177 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
178 | asm ("addl %2,%0\n\t" \ | 178 | asm ("addl %2,%0\n\t" \ |
179 | "adcl %3,%1" \ | 179 | "adcl %3,%1" \ |
180 | : "=rm" (lo), "=rm" (hi) \ | 180 | : "=rm" (lo), "=rm" (hi) \ |
181 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ | 181 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ |
182 | : "cc"); \ | 182 | : "cc"); \ |
183 | }) | 183 | }) |
184 | # endif /* OPT_ACCURACY */ | 184 | # endif /* OPT_ACCURACY */ |
185 | 185 | ||
@@ -192,15 +192,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
192 | mad_fixed64lo_t __lo_; \ | 192 | mad_fixed64lo_t __lo_; \ |
193 | mad_fixed_t __result; \ | 193 | mad_fixed_t __result; \ |
194 | asm ("addl %4,%2\n\t" \ | 194 | asm ("addl %4,%2\n\t" \ |
195 | "adcl %5,%3" \ | 195 | "adcl %5,%3" \ |
196 | : "=rm" (__lo_), "=rm" (__hi_) \ | 196 | : "=rm" (__lo_), "=rm" (__hi_) \ |
197 | : "0" (lo), "1" (hi), \ | 197 | : "0" (lo), "1" (hi), \ |
198 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | 198 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ |
199 | : "cc"); \ | 199 | : "cc"); \ |
200 | asm ("shrdl %3,%2,%1" \ | 200 | asm ("shrdl %3,%2,%1" \ |
201 | : "=rm" (__result) \ | 201 | : "=rm" (__result) \ |
202 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | 202 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ |
203 | : "cc"); \ | 203 | : "cc"); \ |
204 | __result; \ | 204 | __result; \ |
205 | }) | 205 | }) |
206 | # elif defined(OPT_INTEL) | 206 | # elif defined(OPT_INTEL) |
@@ -210,21 +210,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
210 | # define mad_f_scale64(hi, lo) \ | 210 | # define mad_f_scale64(hi, lo) \ |
211 | ({ mad_fixed_t __result; \ | 211 | ({ mad_fixed_t __result; \ |
212 | asm ("shrl %3,%1\n\t" \ | 212 | asm ("shrl %3,%1\n\t" \ |
213 | "shll %4,%2\n\t" \ | 213 | "shll %4,%2\n\t" \ |
214 | "orl %2,%1" \ | 214 | "orl %2,%1" \ |
215 | : "=rm" (__result) \ | 215 | : "=rm" (__result) \ |
216 | : "0" (lo), "r" (hi), \ | 216 | : "0" (lo), "r" (hi), \ |
217 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | 217 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ |
218 | : "cc"); \ | 218 | : "cc"); \ |
219 | __result; \ | 219 | __result; \ |
220 | }) | 220 | }) |
221 | # else | 221 | # else |
222 | # define mad_f_scale64(hi, lo) \ | 222 | # define mad_f_scale64(hi, lo) \ |
223 | ({ mad_fixed_t __result; \ | 223 | ({ mad_fixed_t __result; \ |
224 | asm ("shrdl %3,%2,%1" \ | 224 | asm ("shrdl %3,%2,%1" \ |
225 | : "=rm" (__result) \ | 225 | : "=rm" (__result) \ |
226 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | 226 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ |
227 | : "cc"); \ | 227 | : "cc"); \ |
228 | __result; \ | 228 | __result; \ |
229 | }) | 229 | }) |
230 | # endif /* OPT_ACCURACY */ | 230 | # endif /* OPT_ACCURACY */ |
@@ -249,42 +249,42 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
249 | ({ mad_fixed64hi_t __hi; \ | 249 | ({ mad_fixed64hi_t __hi; \ |
250 | mad_fixed64lo_t __lo; \ | 250 | mad_fixed64lo_t __lo; \ |
251 | mad_fixed_t __result; \ | 251 | mad_fixed_t __result; \ |
252 | asm ("smull %0, %1, %3, %4\n\t" \ | 252 | asm ("smull %0, %1, %3, %4\n\t" \ |
253 | "movs %0, %0, lsr %5\n\t" \ | 253 | "movs %0, %0, lsr %5\n\t" \ |
254 | "adc %2, %0, %1, lsl %6" \ | 254 | "adc %2, %0, %1, lsl %6" \ |
255 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | 255 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ |
256 | : "%r" (x), "r" (y), \ | 256 | : "%r" (x), "r" (y), \ |
257 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 257 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
258 | : "cc"); \ | 258 | : "cc"); \ |
259 | __result; \ | 259 | __result; \ |
260 | }) | 260 | }) |
261 | # endif | 261 | # endif |
262 | 262 | ||
263 | # define MAD_F_MLX(hi, lo, x, y) \ | 263 | # define MAD_F_MLX(hi, lo, x, y) \ |
264 | asm ("smull %0, %1, %2, %3" \ | 264 | asm ("smull %0, %1, %2, %3" \ |
265 | : "=&r" (lo), "=&r" (hi) \ | 265 | : "=&r" (lo), "=&r" (hi) \ |
266 | : "%r" (x), "r" (y)) | 266 | : "%r" (x), "r" (y)) |
267 | 267 | ||
268 | # define MAD_F_MLA(hi, lo, x, y) \ | 268 | # define MAD_F_MLA(hi, lo, x, y) \ |
269 | asm ("smlal %0, %1, %2, %3" \ | 269 | asm ("smlal %0, %1, %2, %3" \ |
270 | : "+r" (lo), "+r" (hi) \ | 270 | : "+r" (lo), "+r" (hi) \ |
271 | : "%r" (x), "r" (y)) | 271 | : "%r" (x), "r" (y)) |
272 | 272 | ||
273 | # define MAD_F_MLN(hi, lo) \ | 273 | # define MAD_F_MLN(hi, lo) \ |
274 | asm ("rsbs %0, %2, #0\n\t" \ | 274 | asm ("rsbs %0, %2, #0\n\t" \ |
275 | "rsc %1, %3, #0" \ | 275 | "rsc %1, %3, #0" \ |
276 | : "=r" (lo), "=r" (hi) \ | 276 | : "=r" (lo), "=r" (hi) \ |
277 | : "0" (lo), "1" (hi) \ | 277 | : "0" (lo), "1" (hi) \ |
278 | : "cc") | 278 | : "cc") |
279 | 279 | ||
280 | # define mad_f_scale64(hi, lo) \ | 280 | # define mad_f_scale64(hi, lo) \ |
281 | ({ mad_fixed_t __result; \ | 281 | ({ mad_fixed_t __result; \ |
282 | asm ("movs %0, %1, lsr %3\n\t" \ | 282 | asm ("movs %0, %1, lsr %3\n\t" \ |
283 | "adc %0, %0, %2, lsl %4" \ | 283 | "adc %0, %0, %2, lsl %4" \ |
284 | : "=&r" (__result) \ | 284 | : "=&r" (__result) \ |
285 | : "r" (lo), "r" (hi), \ | 285 | : "r" (lo), "r" (hi), \ |
286 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 286 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
287 | : "cc"); \ | 287 | : "cc"); \ |
288 | __result; \ | 288 | __result; \ |
289 | }) | 289 | }) |
290 | 290 | ||
@@ -300,14 +300,14 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
300 | */ | 300 | */ |
301 | # define MAD_F_MLX(hi, lo, x, y) \ | 301 | # define MAD_F_MLX(hi, lo, x, y) \ |
302 | asm ("mult %2,%3" \ | 302 | asm ("mult %2,%3" \ |
303 | : "=l" (lo), "=h" (hi) \ | 303 | : "=l" (lo), "=h" (hi) \ |
304 | : "%r" (x), "r" (y)) | 304 | : "%r" (x), "r" (y)) |
305 | 305 | ||
306 | # if defined(HAVE_MADD_ASM) | 306 | # if defined(HAVE_MADD_ASM) |
307 | # define MAD_F_MLA(hi, lo, x, y) \ | 307 | # define MAD_F_MLA(hi, lo, x, y) \ |
308 | asm ("madd %2,%3" \ | 308 | asm ("madd %2,%3" \ |
309 | : "+l" (lo), "+h" (hi) \ | 309 | : "+l" (lo), "+h" (hi) \ |
310 | : "%r" (x), "r" (y)) | 310 | : "%r" (x), "r" (y)) |
311 | # elif defined(HAVE_MADD16_ASM) | 311 | # elif defined(HAVE_MADD16_ASM) |
312 | /* | 312 | /* |
313 | * This loses significant accuracy due to the 16-bit integer limit in the | 313 | * This loses significant accuracy due to the 16-bit integer limit in the |
@@ -315,12 +315,12 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
315 | */ | 315 | */ |
316 | # define MAD_F_ML0(hi, lo, x, y) \ | 316 | # define MAD_F_ML0(hi, lo, x, y) \ |
317 | asm ("mult %2,%3" \ | 317 | asm ("mult %2,%3" \ |
318 | : "=l" (lo), "=h" (hi) \ | 318 | : "=l" (lo), "=h" (hi) \ |
319 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 319 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
320 | # define MAD_F_MLA(hi, lo, x, y) \ | 320 | # define MAD_F_MLA(hi, lo, x, y) \ |
321 | asm ("madd16 %2,%3" \ | 321 | asm ("madd16 %2,%3" \ |
322 | : "+l" (lo), "+h" (hi) \ | 322 | : "+l" (lo), "+h" (hi) \ |
323 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 323 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
324 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) | 324 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) |
325 | # endif | 325 | # endif |
326 | 326 | ||
@@ -340,9 +340,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
340 | */ | 340 | */ |
341 | # define MAD_F_MLX(hi, lo, x, y) \ | 341 | # define MAD_F_MLX(hi, lo, x, y) \ |
342 | asm ("smul %2, %3, %0\n\t" \ | 342 | asm ("smul %2, %3, %0\n\t" \ |
343 | "rd %%y, %1" \ | 343 | "rd %%y, %1" \ |
344 | : "=r" (lo), "=r" (hi) \ | 344 | : "=r" (lo), "=r" (hi) \ |
345 | : "%r" (x), "rI" (y)) | 345 | : "%r" (x), "rI" (y)) |
346 | 346 | ||
347 | /* --- PowerPC ------------------------------------------------------------- */ | 347 | /* --- PowerPC ------------------------------------------------------------- */ |
348 | 348 | ||
@@ -355,11 +355,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
355 | # define MAD_F_MLX(hi, lo, x, y) \ | 355 | # define MAD_F_MLX(hi, lo, x, y) \ |
356 | do { \ | 356 | do { \ |
357 | asm ("mullw %0,%1,%2" \ | 357 | asm ("mullw %0,%1,%2" \ |
358 | : "=r" (lo) \ | 358 | : "=r" (lo) \ |
359 | : "%r" (x), "r" (y)); \ | 359 | : "%r" (x), "r" (y)); \ |
360 | asm ("mulhw %0,%1,%2" \ | 360 | asm ("mulhw %0,%1,%2" \ |
361 | : "=r" (hi) \ | 361 | : "=r" (hi) \ |
362 | : "%r" (x), "r" (y)); \ | 362 | : "%r" (x), "r" (y)); \ |
363 | } \ | 363 | } \ |
364 | while (0) | 364 | while (0) |
365 | 365 | ||
@@ -372,11 +372,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
372 | mad_fixed64lo_t __lo; \ | 372 | mad_fixed64lo_t __lo; \ |
373 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 373 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
374 | asm ("addc %0,%2,%3\n\t" \ | 374 | asm ("addc %0,%2,%3\n\t" \ |
375 | "adde %1,%4,%5" \ | 375 | "adde %1,%4,%5" \ |
376 | : "=r" (lo), "=r" (hi) \ | 376 | : "=r" (lo), "=r" (hi) \ |
377 | : "%r" (lo), "r" (__lo), \ | 377 | : "%r" (lo), "r" (__lo), \ |
378 | "%r" (hi), "r" (__hi) \ | 378 | "%r" (hi), "r" (__hi) \ |
379 | : "xer"); \ | 379 | : "xer"); \ |
380 | }) | 380 | }) |
381 | # endif | 381 | # endif |
382 | 382 | ||
@@ -387,28 +387,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
387 | # define mad_f_scale64(hi, lo) \ | 387 | # define mad_f_scale64(hi, lo) \ |
388 | ({ mad_fixed_t __result, __round; \ | 388 | ({ mad_fixed_t __result, __round; \ |
389 | asm ("rotrwi %0,%1,%2" \ | 389 | asm ("rotrwi %0,%1,%2" \ |
390 | : "=r" (__result) \ | 390 | : "=r" (__result) \ |
391 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 391 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
392 | asm ("extrwi %0,%1,1,0" \ | 392 | asm ("extrwi %0,%1,1,0" \ |
393 | : "=r" (__round) \ | 393 | : "=r" (__round) \ |
394 | : "r" (__result)); \ | 394 | : "r" (__result)); \ |
395 | asm ("insrwi %0,%1,%2,0" \ | 395 | asm ("insrwi %0,%1,%2,0" \ |
396 | : "+r" (__result) \ | 396 | : "+r" (__result) \ |
397 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 397 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
398 | asm ("add %0,%1,%2" \ | 398 | asm ("add %0,%1,%2" \ |
399 | : "=r" (__result) \ | 399 | : "=r" (__result) \ |
400 | : "%r" (__result), "r" (__round)); \ | 400 | : "%r" (__result), "r" (__round)); \ |
401 | __result; \ | 401 | __result; \ |
402 | }) | 402 | }) |
403 | # else | 403 | # else |
404 | # define mad_f_scale64(hi, lo) \ | 404 | # define mad_f_scale64(hi, lo) \ |
405 | ({ mad_fixed_t __result; \ | 405 | ({ mad_fixed_t __result; \ |
406 | asm ("rotrwi %0,%1,%2" \ | 406 | asm ("rotrwi %0,%1,%2" \ |
407 | : "=r" (__result) \ | 407 | : "=r" (__result) \ |
408 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 408 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
409 | asm ("insrwi %0,%1,%2,0" \ | 409 | asm ("insrwi %0,%1,%2,0" \ |
410 | : "+r" (__result) \ | 410 | : "+r" (__result) \ |
411 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 411 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
412 | __result; \ | 412 | __result; \ |
413 | }) | 413 | }) |
414 | # endif | 414 | # endif |
@@ -452,10 +452,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
452 | * Pre-rounding is required to stay within the limits of compliance. | 452 | * Pre-rounding is required to stay within the limits of compliance. |
453 | */ | 453 | */ |
454 | # if defined(OPT_SPEED) | 454 | # if defined(OPT_SPEED) |
455 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) | 455 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) |
456 | # else | 456 | # else |
457 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ | 457 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ |
458 | (((y) + (1L << 15)) >> 16)) | 458 | (((y) + (1L << 15)) >> 16)) |
459 | # endif | 459 | # endif |
460 | 460 | ||
461 | /* ------------------------------------------------------------------------- */ | 461 | /* ------------------------------------------------------------------------- */ |
@@ -476,22 +476,22 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
476 | # endif | 476 | # endif |
477 | 477 | ||
478 | # if !defined(MAD_F_MLA) | 478 | # if !defined(MAD_F_MLA) |
479 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) | 479 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) |
480 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) | 480 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) |
481 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | 481 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) |
482 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 482 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
483 | # endif | 483 | # endif |
484 | 484 | ||
485 | # if !defined(MAD_F_ML0) | 485 | # if !defined(MAD_F_ML0) |
486 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) | 486 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) |
487 | # endif | 487 | # endif |
488 | 488 | ||
489 | # if !defined(MAD_F_MLN) | 489 | # if !defined(MAD_F_MLN) |
490 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | 490 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) |
491 | # endif | 491 | # endif |
492 | 492 | ||
493 | # if !defined(MAD_F_MLZ) | 493 | # if !defined(MAD_F_MLZ) |
494 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) | 494 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) |
495 | # endif | 495 | # endif |
496 | 496 | ||
497 | # if !defined(mad_f_scale64) | 497 | # if !defined(mad_f_scale64) |
@@ -499,7 +499,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
499 | # define mad_f_scale64(hi, lo) \ | 499 | # define mad_f_scale64(hi, lo) \ |
500 | ((((mad_fixed_t) \ | 500 | ((((mad_fixed_t) \ |
501 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ | 501 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ |
502 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) | 502 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) |
503 | # else | 503 | # else |
504 | # define mad_f_scale64(hi, lo) \ | 504 | # define mad_f_scale64(hi, lo) \ |
505 | ((mad_fixed_t) \ | 505 | ((mad_fixed_t) \ |
diff --git a/apps/codecs/libmad/frame.c b/apps/codecs/libmad/frame.c index 85c2a201f7..7fd4235e30 100644 --- a/apps/codecs/libmad/frame.c +++ b/apps/codecs/libmad/frame.c | |||
@@ -61,7 +61,7 @@ int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * NAME: header->init() | 64 | * NAME: header->init() |
65 | * DESCRIPTION: initialize header struct | 65 | * DESCRIPTION: initialize header struct |
66 | */ | 66 | */ |
67 | void mad_header_init(struct mad_header *header) | 67 | void mad_header_init(struct mad_header *header) |
@@ -84,7 +84,7 @@ void mad_header_init(struct mad_header *header) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * NAME: frame->init() | 87 | * NAME: frame->init() |
88 | * DESCRIPTION: initialize frame struct | 88 | * DESCRIPTION: initialize frame struct |
89 | */ | 89 | */ |
90 | void mad_frame_init(struct mad_frame *frame) | 90 | void mad_frame_init(struct mad_frame *frame) |
@@ -98,7 +98,7 @@ void mad_frame_init(struct mad_frame *frame) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * NAME: frame->finish() | 101 | * NAME: frame->finish() |
102 | * DESCRIPTION: deallocate any dynamic memory associated with frame | 102 | * DESCRIPTION: deallocate any dynamic memory associated with frame |
103 | */ | 103 | */ |
104 | void mad_frame_finish(struct mad_frame *frame) | 104 | void mad_frame_finish(struct mad_frame *frame) |
@@ -112,7 +112,7 @@ void mad_frame_finish(struct mad_frame *frame) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * NAME: decode_header() | 115 | * NAME: decode_header() |
116 | * DESCRIPTION: read header data and following CRC word | 116 | * DESCRIPTION: read header data and following CRC word |
117 | */ | 117 | */ |
118 | static | 118 | static |
@@ -231,7 +231,7 @@ int decode_header(struct mad_header *header, struct mad_stream *stream) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | /* | 233 | /* |
234 | * NAME: free_bitrate() | 234 | * NAME: free_bitrate() |
235 | * DESCRIPTION: attempt to discover the bitstream's free bitrate | 235 | * DESCRIPTION: attempt to discover the bitstream's free bitrate |
236 | */ | 236 | */ |
237 | static | 237 | static |
@@ -246,7 +246,7 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
246 | 246 | ||
247 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; | 247 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; |
248 | slots_per_frame = (header->layer == MAD_LAYER_III && | 248 | slots_per_frame = (header->layer == MAD_LAYER_III && |
249 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; | 249 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; |
250 | 250 | ||
251 | while (mad_stream_sync(stream) == 0) { | 251 | while (mad_stream_sync(stream) == 0) { |
252 | struct mad_stream peek_stream; | 252 | struct mad_stream peek_stream; |
@@ -256,8 +256,8 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
256 | peek_header = *header; | 256 | peek_header = *header; |
257 | 257 | ||
258 | if (decode_header(&peek_header, &peek_stream) == 0 && | 258 | if (decode_header(&peek_header, &peek_stream) == 0 && |
259 | peek_header.layer == header->layer && | 259 | peek_header.layer == header->layer && |
260 | peek_header.samplerate == header->samplerate) { | 260 | peek_header.samplerate == header->samplerate) { |
261 | unsigned int N; | 261 | unsigned int N; |
262 | 262 | ||
263 | ptr = mad_bit_nextbyte(&stream->ptr); | 263 | ptr = mad_bit_nextbyte(&stream->ptr); |
@@ -265,16 +265,16 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
265 | N = ptr - stream->this_frame; | 265 | N = ptr - stream->this_frame; |
266 | 266 | ||
267 | if (header->layer == MAD_LAYER_I) { | 267 | if (header->layer == MAD_LAYER_I) { |
268 | rate = (unsigned long) header->samplerate * | 268 | rate = (unsigned long) header->samplerate * |
269 | (N - 4 * pad_slot + 4) / 48 / 1000; | 269 | (N - 4 * pad_slot + 4) / 48 / 1000; |
270 | } | 270 | } |
271 | else { | 271 | else { |
272 | rate = (unsigned long) header->samplerate * | 272 | rate = (unsigned long) header->samplerate * |
273 | (N - pad_slot + 1) / slots_per_frame / 1000; | 273 | (N - pad_slot + 1) / slots_per_frame / 1000; |
274 | } | 274 | } |
275 | 275 | ||
276 | if (rate >= 8) | 276 | if (rate >= 8) |
277 | break; | 277 | break; |
278 | } | 278 | } |
279 | 279 | ||
280 | mad_bit_skip(&stream->ptr, 8); | 280 | mad_bit_skip(&stream->ptr, 8); |
@@ -293,7 +293,7 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | /* | 295 | /* |
296 | * NAME: header->decode() | 296 | * NAME: header->decode() |
297 | * DESCRIPTION: read the next frame header from the stream | 297 | * DESCRIPTION: read the next frame header from the stream |
298 | */ | 298 | */ |
299 | int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | 299 | int mad_header_decode(struct mad_header *header, struct mad_stream *stream) |
@@ -351,7 +351,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
351 | 351 | ||
352 | if (mad_stream_sync(stream) == -1) { | 352 | if (mad_stream_sync(stream) == -1) { |
353 | if (end - stream->next_frame >= MAD_BUFFER_GUARD) | 353 | if (end - stream->next_frame >= MAD_BUFFER_GUARD) |
354 | stream->next_frame = end - MAD_BUFFER_GUARD; | 354 | stream->next_frame = end - MAD_BUFFER_GUARD; |
355 | 355 | ||
356 | stream->error = MAD_ERROR_BUFLEN; | 356 | stream->error = MAD_ERROR_BUFLEN; |
357 | goto fail; | 357 | goto fail; |
@@ -371,13 +371,13 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
371 | 371 | ||
372 | /* calculate frame duration */ | 372 | /* calculate frame duration */ |
373 | mad_timer_set(&header->duration, 0, | 373 | mad_timer_set(&header->duration, 0, |
374 | 32 * MAD_NSBSAMPLES(header), header->samplerate); | 374 | 32 * MAD_NSBSAMPLES(header), header->samplerate); |
375 | 375 | ||
376 | /* calculate free bit rate */ | 376 | /* calculate free bit rate */ |
377 | if (header->bitrate == 0) { | 377 | if (header->bitrate == 0) { |
378 | if ((stream->freerate == 0 || !stream->sync || | 378 | if ((stream->freerate == 0 || !stream->sync || |
379 | (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && | 379 | (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && |
380 | free_bitrate(stream, header) == -1) | 380 | free_bitrate(stream, header) == -1) |
381 | goto fail; | 381 | goto fail; |
382 | 382 | ||
383 | header->bitrate = stream->freerate; | 383 | header->bitrate = stream->freerate; |
@@ -393,7 +393,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
393 | unsigned int slots_per_frame; | 393 | unsigned int slots_per_frame; |
394 | 394 | ||
395 | slots_per_frame = (header->layer == MAD_LAYER_III && | 395 | slots_per_frame = (header->layer == MAD_LAYER_III && |
396 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; | 396 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; |
397 | 397 | ||
398 | N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; | 398 | N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; |
399 | } | 399 | } |
@@ -431,7 +431,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
431 | } | 431 | } |
432 | 432 | ||
433 | /* | 433 | /* |
434 | * NAME: frame->decode() | 434 | * NAME: frame->decode() |
435 | * DESCRIPTION: decode a single frame from a bitstream | 435 | * DESCRIPTION: decode a single frame from a bitstream |
436 | */ | 436 | */ |
437 | int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) | 437 | int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) |
@@ -479,7 +479,7 @@ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) | |||
479 | } | 479 | } |
480 | 480 | ||
481 | /* | 481 | /* |
482 | * NAME: frame->mute() | 482 | * NAME: frame->mute() |
483 | * DESCRIPTION: zero all subband values so the frame becomes silent | 483 | * DESCRIPTION: zero all subband values so the frame becomes silent |
484 | */ | 484 | */ |
485 | void mad_frame_mute(struct mad_frame *frame) | 485 | void mad_frame_mute(struct mad_frame *frame) |
@@ -496,8 +496,8 @@ void mad_frame_mute(struct mad_frame *frame) | |||
496 | if (frame->overlap) { | 496 | if (frame->overlap) { |
497 | for (s = 0; s < 18; ++s) { | 497 | for (s = 0; s < 18; ++s) { |
498 | for (sb = 0; sb < 32; ++sb) { | 498 | for (sb = 0; sb < 32; ++sb) { |
499 | (*frame->overlap)[0][sb][s] = | 499 | (*frame->overlap)[0][sb][s] = |
500 | (*frame->overlap)[1][sb][s] = 0; | 500 | (*frame->overlap)[1][sb][s] = 0; |
501 | } | 501 | } |
502 | } | 502 | } |
503 | } | 503 | } |
diff --git a/apps/codecs/libmad/frame.h b/apps/codecs/libmad/frame.h index 4d23107d76..2693b0b38b 100644 --- a/apps/codecs/libmad/frame.h +++ b/apps/codecs/libmad/frame.h | |||
@@ -27,41 +27,41 @@ | |||
27 | # include "stream.h" | 27 | # include "stream.h" |
28 | 28 | ||
29 | enum mad_layer { | 29 | enum mad_layer { |
30 | MAD_LAYER_I = 1, /* Layer I */ | 30 | MAD_LAYER_I = 1, /* Layer I */ |
31 | MAD_LAYER_II = 2, /* Layer II */ | 31 | MAD_LAYER_II = 2, /* Layer II */ |
32 | MAD_LAYER_III = 3 /* Layer III */ | 32 | MAD_LAYER_III = 3 /* Layer III */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | enum mad_mode { | 35 | enum mad_mode { |
36 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ | 36 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ |
37 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ | 37 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ |
38 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ | 38 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ |
39 | MAD_MODE_STEREO = 3 /* normal LR stereo */ | 39 | MAD_MODE_STEREO = 3 /* normal LR stereo */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | enum mad_emphasis { | 42 | enum mad_emphasis { |
43 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ | 43 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ |
44 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ | 44 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ |
45 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ | 45 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ |
46 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ | 46 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct mad_header { | 49 | struct mad_header { |
50 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 50 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
51 | enum mad_mode mode; /* channel mode (see above) */ | 51 | enum mad_mode mode; /* channel mode (see above) */ |
52 | int mode_extension; /* additional mode info */ | 52 | int mode_extension; /* additional mode info */ |
53 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 53 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
54 | 54 | ||
55 | unsigned long bitrate; /* stream bitrate (bps) */ | 55 | unsigned long bitrate; /* stream bitrate (bps) */ |
56 | unsigned int samplerate; /* sampling frequency (Hz) */ | 56 | unsigned int samplerate; /* sampling frequency (Hz) */ |
57 | 57 | ||
58 | unsigned short crc_check; /* frame CRC accumulator */ | 58 | unsigned short crc_check; /* frame CRC accumulator */ |
59 | unsigned short crc_target; /* final target CRC checksum */ | 59 | unsigned short crc_target; /* final target CRC checksum */ |
60 | 60 | ||
61 | int flags; /* flags (see below) */ | 61 | int flags; /* flags (see below) */ |
62 | int private_bits; /* private bits (see below) */ | 62 | int private_bits; /* private bits (see below) */ |
63 | 63 | ||
64 | mad_timer_t duration; /* audio playing time of frame */ | 64 | mad_timer_t duration; /* audio playing time of frame */ |
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct mad_frame { | 67 | struct mad_frame { |
@@ -76,33 +76,33 @@ struct mad_frame { | |||
76 | mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ | 76 | mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) | 79 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) |
80 | # define MAD_NSBSAMPLES(header) \ | 80 | # define MAD_NSBSAMPLES(header) \ |
81 | ((header)->layer == MAD_LAYER_I ? 12 : \ | 81 | ((header)->layer == MAD_LAYER_I ? 12 : \ |
82 | (((header)->layer == MAD_LAYER_III && \ | 82 | (((header)->layer == MAD_LAYER_III && \ |
83 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) | 83 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) |
84 | 84 | ||
85 | enum { | 85 | enum { |
86 | MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ | 86 | MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ |
87 | MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ | 87 | MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ |
88 | 88 | ||
89 | MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ | 89 | MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ |
90 | MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ | 90 | MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ |
91 | MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ | 91 | MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ |
92 | MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ | 92 | MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ |
93 | 93 | ||
94 | MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ | 94 | MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ |
95 | MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ | 95 | MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ |
96 | MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ | 96 | MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ |
97 | 97 | ||
98 | MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ | 98 | MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ |
99 | MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ | 99 | MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ |
100 | MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ | 100 | MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ |
101 | }; | 101 | }; |
102 | 102 | ||
103 | enum { | 103 | enum { |
104 | MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ | 104 | MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ |
105 | MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ | 105 | MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ |
106 | }; | 106 | }; |
107 | 107 | ||
108 | void mad_header_init(struct mad_header *); | 108 | void mad_header_init(struct mad_header *); |
diff --git a/apps/codecs/libmad/huffman.c b/apps/codecs/libmad/huffman.c index db788e71b4..bec44434a7 100644 --- a/apps/codecs/libmad/huffman.c +++ b/apps/codecs/libmad/huffman.c | |||
@@ -36,10 +36,10 @@ | |||
36 | 36 | ||
37 | # if defined(__GNUC__) || \ | 37 | # if defined(__GNUC__) || \ |
38 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) | 38 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
39 | # define PTR(offs, bits) { .ptr = { 0, bits, offs } } | 39 | # define PTR(offs, bits) { .ptr = { 0, bits, offs } } |
40 | # define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } | 40 | # define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } |
41 | # else | 41 | # else |
42 | # define PTR(offs, bits) { { 0, bits, offs } } | 42 | # define PTR(offs, bits) { { 0, bits, offs } } |
43 | # if defined(WORDS_BIGENDIAN) | 43 | # if defined(WORDS_BIGENDIAN) |
44 | # define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ | 44 | # define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ |
45 | (x << 9) | (y << 8) } } | 45 | (x << 9) | (y << 8) } } |
@@ -114,14 +114,14 @@ union huffquad const hufftabB[] ICONST_ATTR_MPA_HUFFMAN = { | |||
114 | 114 | ||
115 | # if defined(__GNUC__) || \ | 115 | # if defined(__GNUC__) || \ |
116 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) | 116 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
117 | # define PTR(offs, bits) { .ptr = { 0, bits, offs } } | 117 | # define PTR(offs, bits) { .ptr = { 0, bits, offs } } |
118 | # define V(x, y, hlen) { .value = { 1, hlen, x, y } } | 118 | # define V(x, y, hlen) { .value = { 1, hlen, x, y } } |
119 | # else | 119 | # else |
120 | # define PTR(offs, bits) { { 0, bits, offs } } | 120 | # define PTR(offs, bits) { { 0, bits, offs } } |
121 | # if defined(WORDS_BIGENDIAN) | 121 | # if defined(WORDS_BIGENDIAN) |
122 | # define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } | 122 | # define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } |
123 | # else | 123 | # else |
124 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } | 124 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } |
125 | # endif | 125 | # endif |
126 | # endif | 126 | # endif |
127 | 127 | ||
@@ -154,7 +154,7 @@ union huffpair const hufftab2[] ICONST_ATTR_MPA_HUFFMAN = { | |||
154 | /* 111 */ V(0, 0, 1), | 154 | /* 111 */ V(0, 0, 1), |
155 | 155 | ||
156 | /* 000 ... */ | 156 | /* 000 ... */ |
157 | /* 000 */ V(2, 2, 3), /* 8 */ | 157 | /* 000 */ V(2, 2, 3), /* 8 */ |
158 | /* 001 */ V(0, 2, 3), | 158 | /* 001 */ V(0, 2, 3), |
159 | /* 010 */ V(1, 2, 2), | 159 | /* 010 */ V(1, 2, 2), |
160 | /* 011 */ V(1, 2, 2), | 160 | /* 011 */ V(1, 2, 2), |
@@ -176,7 +176,7 @@ union huffpair const hufftab3[] ICONST_ATTR_MPA_HUFFMAN = { | |||
176 | /* 111 */ V(0, 0, 2), | 176 | /* 111 */ V(0, 0, 2), |
177 | 177 | ||
178 | /* 000 ... */ | 178 | /* 000 ... */ |
179 | /* 000 */ V(2, 2, 3), /* 8 */ | 179 | /* 000 */ V(2, 2, 3), /* 8 */ |
180 | /* 001 */ V(0, 2, 3), | 180 | /* 001 */ V(0, 2, 3), |
181 | /* 010 */ V(1, 2, 2), | 181 | /* 010 */ V(1, 2, 2), |
182 | /* 011 */ V(1, 2, 2), | 182 | /* 011 */ V(1, 2, 2), |
@@ -198,7 +198,7 @@ union huffpair const hufftab5[] ICONST_ATTR_MPA_HUFFMAN = { | |||
198 | /* 111 */ V(0, 0, 1), | 198 | /* 111 */ V(0, 0, 1), |
199 | 199 | ||
200 | /* 000 ... */ | 200 | /* 000 ... */ |
201 | /* 0000 */ PTR(24, 1), /* 8 */ | 201 | /* 0000 */ PTR(24, 1), /* 8 */ |
202 | /* 0001 */ V(3, 2, 4), | 202 | /* 0001 */ V(3, 2, 4), |
203 | /* 0010 */ V(3, 1, 3), | 203 | /* 0010 */ V(3, 1, 3), |
204 | /* 0011 */ V(3, 1, 3), | 204 | /* 0011 */ V(3, 1, 3), |
@@ -216,7 +216,7 @@ union huffpair const hufftab5[] ICONST_ATTR_MPA_HUFFMAN = { | |||
216 | /* 1111 */ V(2, 0, 3), | 216 | /* 1111 */ V(2, 0, 3), |
217 | 217 | ||
218 | /* 000 0000 ... */ | 218 | /* 000 0000 ... */ |
219 | /* 0 */ V(3, 3, 1), /* 24 */ | 219 | /* 0 */ V(3, 3, 1), /* 24 */ |
220 | /* 1 */ V(2, 3, 1) | 220 | /* 1 */ V(2, 3, 1) |
221 | }; | 221 | }; |
222 | 222 | ||
@@ -240,7 +240,7 @@ union huffpair const hufftab6[] ICONST_ATTR_MPA_HUFFMAN = { | |||
240 | /* 1111 */ V(0, 0, 3), | 240 | /* 1111 */ V(0, 0, 3), |
241 | 241 | ||
242 | /* 0000 ... */ | 242 | /* 0000 ... */ |
243 | /* 000 */ V(3, 3, 3), /* 16 */ | 243 | /* 000 */ V(3, 3, 3), /* 16 */ |
244 | /* 001 */ V(0, 3, 3), | 244 | /* 001 */ V(0, 3, 3), |
245 | /* 010 */ V(2, 3, 2), | 245 | /* 010 */ V(2, 3, 2), |
246 | /* 011 */ V(2, 3, 2), | 246 | /* 011 */ V(2, 3, 2), |
@@ -250,11 +250,11 @@ union huffpair const hufftab6[] ICONST_ATTR_MPA_HUFFMAN = { | |||
250 | /* 111 */ V(3, 0, 2), | 250 | /* 111 */ V(3, 0, 2), |
251 | 251 | ||
252 | /* 0001 ... */ | 252 | /* 0001 ... */ |
253 | /* 0 */ V(1, 3, 1), /* 24 */ | 253 | /* 0 */ V(1, 3, 1), /* 24 */ |
254 | /* 1 */ V(3, 1, 1), | 254 | /* 1 */ V(3, 1, 1), |
255 | 255 | ||
256 | /* 0010 ... */ | 256 | /* 0010 ... */ |
257 | /* 0 */ V(2, 2, 1), /* 26 */ | 257 | /* 0 */ V(2, 2, 1), /* 26 */ |
258 | /* 1 */ V(0, 2, 1) | 258 | /* 1 */ V(0, 2, 1) |
259 | }; | 259 | }; |
260 | 260 | ||
@@ -278,7 +278,7 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { | |||
278 | /* 1111 */ V(0, 0, 1), | 278 | /* 1111 */ V(0, 0, 1), |
279 | 279 | ||
280 | /* 0000 ... */ | 280 | /* 0000 ... */ |
281 | /* 0000 */ PTR(52, 2), /* 16 */ | 281 | /* 0000 */ PTR(52, 2), /* 16 */ |
282 | /* 0001 */ PTR(56, 1), | 282 | /* 0001 */ PTR(56, 1), |
283 | /* 0010 */ PTR(58, 1), | 283 | /* 0010 */ PTR(58, 1), |
284 | /* 0011 */ V(1, 5, 4), | 284 | /* 0011 */ V(1, 5, 4), |
@@ -296,7 +296,7 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { | |||
296 | /* 1111 */ V(4, 0, 3), | 296 | /* 1111 */ V(4, 0, 3), |
297 | 297 | ||
298 | /* 0001 ... */ | 298 | /* 0001 ... */ |
299 | /* 0000 */ V(0, 4, 4), /* 32 */ | 299 | /* 0000 */ V(0, 4, 4), /* 32 */ |
300 | /* 0001 */ V(2, 3, 4), | 300 | /* 0001 */ V(2, 3, 4), |
301 | /* 0010 */ V(3, 2, 4), | 301 | /* 0010 */ V(3, 2, 4), |
302 | /* 0011 */ V(0, 3, 4), | 302 | /* 0011 */ V(0, 3, 4), |
@@ -314,31 +314,31 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { | |||
314 | /* 1111 */ V(1, 2, 2), | 314 | /* 1111 */ V(1, 2, 2), |
315 | 315 | ||
316 | /* 0010 ... */ | 316 | /* 0010 ... */ |
317 | /* 00 */ V(2, 1, 1), /* 48 */ | 317 | /* 00 */ V(2, 1, 1), /* 48 */ |
318 | /* 01 */ V(2, 1, 1), | 318 | /* 01 */ V(2, 1, 1), |
319 | /* 10 */ V(0, 2, 2), | 319 | /* 10 */ V(0, 2, 2), |
320 | /* 11 */ V(2, 0, 2), | 320 | /* 11 */ V(2, 0, 2), |
321 | 321 | ||
322 | /* 0000 0000 ... */ | 322 | /* 0000 0000 ... */ |
323 | /* 00 */ V(5, 5, 2), /* 52 */ | 323 | /* 00 */ V(5, 5, 2), /* 52 */ |
324 | /* 01 */ V(4, 5, 2), | 324 | /* 01 */ V(4, 5, 2), |
325 | /* 10 */ V(5, 4, 2), | 325 | /* 10 */ V(5, 4, 2), |
326 | /* 11 */ V(5, 3, 2), | 326 | /* 11 */ V(5, 3, 2), |
327 | 327 | ||
328 | /* 0000 0001 ... */ | 328 | /* 0000 0001 ... */ |
329 | /* 0 */ V(3, 5, 1), /* 56 */ | 329 | /* 0 */ V(3, 5, 1), /* 56 */ |
330 | /* 1 */ V(4, 4, 1), | 330 | /* 1 */ V(4, 4, 1), |
331 | 331 | ||
332 | /* 0000 0010 ... */ | 332 | /* 0000 0010 ... */ |
333 | /* 0 */ V(2, 5, 1), /* 58 */ | 333 | /* 0 */ V(2, 5, 1), /* 58 */ |
334 | /* 1 */ V(5, 2, 1), | 334 | /* 1 */ V(5, 2, 1), |
335 | 335 | ||
336 | /* 0000 0101 ... */ | 336 | /* 0000 0101 ... */ |
337 | /* 0 */ V(0, 5, 1), /* 60 */ | 337 | /* 0 */ V(0, 5, 1), /* 60 */ |
338 | /* 1 */ V(3, 4, 1), | 338 | /* 1 */ V(3, 4, 1), |
339 | 339 | ||
340 | /* 0000 0111 ... */ | 340 | /* 0000 0111 ... */ |
341 | /* 0 */ V(4, 3, 1), /* 62 */ | 341 | /* 0 */ V(4, 3, 1), /* 62 */ |
342 | /* 1 */ V(3, 3, 1) | 342 | /* 1 */ V(3, 3, 1) |
343 | }; | 343 | }; |
344 | 344 | ||
@@ -365,7 +365,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
365 | /* 1111 */ V(0, 0, 2), | 365 | /* 1111 */ V(0, 0, 2), |
366 | 366 | ||
367 | /* 0000 ... */ | 367 | /* 0000 ... */ |
368 | /* 0000 */ PTR(36, 3), /* 16 */ | 368 | /* 0000 */ PTR(36, 3), /* 16 */ |
369 | /* 0001 */ PTR(44, 2), | 369 | /* 0001 */ PTR(44, 2), |
370 | /* 0010 */ PTR(48, 1), | 370 | /* 0010 */ PTR(48, 1), |
371 | /* 0011 */ V(1, 5, 4), | 371 | /* 0011 */ V(1, 5, 4), |
@@ -383,13 +383,13 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
383 | /* 1111 */ V(3, 2, 4), | 383 | /* 1111 */ V(3, 2, 4), |
384 | 384 | ||
385 | /* 0001 ... */ | 385 | /* 0001 ... */ |
386 | /* 00 */ PTR(54, 2), /* 32 */ | 386 | /* 00 */ PTR(54, 2), /* 32 */ |
387 | /* 01 */ V(2, 2, 2), | 387 | /* 01 */ V(2, 2, 2), |
388 | /* 10 */ V(0, 2, 2), | 388 | /* 10 */ V(0, 2, 2), |
389 | /* 11 */ V(2, 0, 2), | 389 | /* 11 */ V(2, 0, 2), |
390 | 390 | ||
391 | /* 0000 0000 ... */ | 391 | /* 0000 0000 ... */ |
392 | /* 000 */ V(5, 5, 3), /* 36 */ | 392 | /* 000 */ V(5, 5, 3), /* 36 */ |
393 | /* 001 */ V(5, 4, 3), | 393 | /* 001 */ V(5, 4, 3), |
394 | /* 010 */ V(4, 5, 2), | 394 | /* 010 */ V(4, 5, 2), |
395 | /* 011 */ V(4, 5, 2), | 395 | /* 011 */ V(4, 5, 2), |
@@ -399,25 +399,25 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
399 | /* 111 */ V(5, 3, 1), | 399 | /* 111 */ V(5, 3, 1), |
400 | 400 | ||
401 | /* 0000 0001 ... */ | 401 | /* 0000 0001 ... */ |
402 | /* 00 */ V(3, 5, 2), /* 44 */ | 402 | /* 00 */ V(3, 5, 2), /* 44 */ |
403 | /* 01 */ V(4, 4, 2), | 403 | /* 01 */ V(4, 4, 2), |
404 | /* 10 */ V(2, 5, 1), | 404 | /* 10 */ V(2, 5, 1), |
405 | /* 11 */ V(2, 5, 1), | 405 | /* 11 */ V(2, 5, 1), |
406 | 406 | ||
407 | /* 0000 0010 ... */ | 407 | /* 0000 0010 ... */ |
408 | /* 0 */ V(5, 2, 1), /* 48 */ | 408 | /* 0 */ V(5, 2, 1), /* 48 */ |
409 | /* 1 */ V(0, 5, 1), | 409 | /* 1 */ V(0, 5, 1), |
410 | 410 | ||
411 | /* 0000 0101 ... */ | 411 | /* 0000 0101 ... */ |
412 | /* 0 */ V(3, 4, 1), /* 50 */ | 412 | /* 0 */ V(3, 4, 1), /* 50 */ |
413 | /* 1 */ V(4, 3, 1), | 413 | /* 1 */ V(4, 3, 1), |
414 | 414 | ||
415 | /* 0000 0110 ... */ | 415 | /* 0000 0110 ... */ |
416 | /* 0 */ V(5, 0, 1), /* 52 */ | 416 | /* 0 */ V(5, 0, 1), /* 52 */ |
417 | /* 1 */ V(3, 3, 1), | 417 | /* 1 */ V(3, 3, 1), |
418 | 418 | ||
419 | /* 0001 00 ... */ | 419 | /* 0001 00 ... */ |
420 | /* 00 */ V(1, 3, 2), /* 54 */ | 420 | /* 00 */ V(1, 3, 2), /* 54 */ |
421 | /* 01 */ V(3, 1, 2), | 421 | /* 01 */ V(3, 1, 2), |
422 | /* 10 */ V(0, 3, 2), | 422 | /* 10 */ V(0, 3, 2), |
423 | /* 11 */ V(3, 0, 2), | 423 | /* 11 */ V(3, 0, 2), |
@@ -443,7 +443,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
443 | /* 1111 */ V(0, 0, 2), | 443 | /* 1111 */ V(0, 0, 2), |
444 | 444 | ||
445 | /* 0000 ... */ | 445 | /* 0000 ... */ |
446 | /* 0000 */ PTR(48, 3), /* 16 */ | 446 | /* 0000 */ PTR(48, 3), /* 16 */ |
447 | /* 0001 */ PTR(56, 2), | 447 | /* 0001 */ PTR(56, 2), |
448 | /* 0010 */ PTR(60, 1), | 448 | /* 0010 */ PTR(60, 1), |
449 | /* 0011 */ V(1, 5, 4), | 449 | /* 0011 */ V(1, 5, 4), |
@@ -461,7 +461,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
461 | /* 1111 */ V(3, 2, 4), | 461 | /* 1111 */ V(3, 2, 4), |
462 | 462 | ||
463 | /* 0001 ... */ | 463 | /* 0001 ... */ |
464 | /* 0000 */ V(1, 3, 4), /* 32 */ | 464 | /* 0000 */ V(1, 3, 4), /* 32 */ |
465 | /* 0001 */ V(3, 1, 4), | 465 | /* 0001 */ V(3, 1, 4), |
466 | /* 0010 */ V(0, 3, 4), | 466 | /* 0010 */ V(0, 3, 4), |
467 | /* 0011 */ V(3, 0, 4), | 467 | /* 0011 */ V(3, 0, 4), |
@@ -479,7 +479,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
479 | /* 1111 */ V(2, 0, 2), | 479 | /* 1111 */ V(2, 0, 2), |
480 | 480 | ||
481 | /* 0000 0000 ... */ | 481 | /* 0000 0000 ... */ |
482 | /* 000 */ V(5, 5, 3), /* 48 */ | 482 | /* 000 */ V(5, 5, 3), /* 48 */ |
483 | /* 001 */ V(5, 4, 3), | 483 | /* 001 */ V(5, 4, 3), |
484 | /* 010 */ V(4, 5, 2), | 484 | /* 010 */ V(4, 5, 2), |
485 | /* 011 */ V(4, 5, 2), | 485 | /* 011 */ V(4, 5, 2), |
@@ -489,21 +489,21 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { | |||
489 | /* 111 */ V(5, 3, 1), | 489 | /* 111 */ V(5, 3, 1), |
490 | 490 | ||
491 | /* 0000 0001 ... */ | 491 | /* 0000 0001 ... */ |
492 | /* 00 */ V(3, 5, 2), /* 56 */ | 492 | /* 00 */ V(3, 5, 2), /* 56 */ |
493 | /* 01 */ V(4, 4, 2), | 493 | /* 01 */ V(4, 4, 2), |
494 | /* 10 */ V(2, 5, 1), | 494 | /* 10 */ V(2, 5, 1), |
495 | /* 11 */ V(2, 5, 1), | 495 | /* 11 */ V(2, 5, 1), |
496 | 496 | ||
497 | /* 0000 0010 ... */ | 497 | /* 0000 0010 ... */ |
498 | /* 0 */ V(5, 2, 1), /* 60 */ | 498 | /* 0 */ V(5, 2, 1), /* 60 */ |
499 | /* 1 */ V(0, 5, 1), | 499 | /* 1 */ V(0, 5, 1), |
500 | 500 | ||
501 | /* 0000 0101 ... */ | 501 | /* 0000 0101 ... */ |
502 | /* 0 */ V(3, 4, 1), /* 62 */ | 502 | /* 0 */ V(3, 4, 1), /* 62 */ |
503 | /* 1 */ V(4, 3, 1), | 503 | /* 1 */ V(4, 3, 1), |
504 | 504 | ||
505 | /* 0000 0110 ... */ | 505 | /* 0000 0110 ... */ |
506 | /* 0 */ V(5, 0, 1), /* 64 */ | 506 | /* 0 */ V(5, 0, 1), /* 64 */ |
507 | /* 1 */ V(3, 3, 1) | 507 | /* 1 */ V(3, 3, 1) |
508 | }; | 508 | }; |
509 | # endif | 509 | # endif |
@@ -528,7 +528,7 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { | |||
528 | /* 1111 */ V(0, 0, 3), | 528 | /* 1111 */ V(0, 0, 3), |
529 | 529 | ||
530 | /* 0000 ... */ | 530 | /* 0000 ... */ |
531 | /* 0000 */ PTR(50, 1), /* 16 */ | 531 | /* 0000 */ PTR(50, 1), /* 16 */ |
532 | /* 0001 */ V(3, 5, 4), | 532 | /* 0001 */ V(3, 5, 4), |
533 | /* 0010 */ V(5, 3, 4), | 533 | /* 0010 */ V(5, 3, 4), |
534 | /* 0011 */ PTR(52, 1), | 534 | /* 0011 */ PTR(52, 1), |
@@ -546,7 +546,7 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { | |||
546 | /* 1111 */ V(0, 4, 4), | 546 | /* 1111 */ V(0, 4, 4), |
547 | 547 | ||
548 | /* 0001 ... */ | 548 | /* 0001 ... */ |
549 | /* 000 */ V(2, 4, 3), /* 32 */ | 549 | /* 000 */ V(2, 4, 3), /* 32 */ |
550 | /* 001 */ V(4, 2, 3), | 550 | /* 001 */ V(4, 2, 3), |
551 | /* 010 */ V(3, 3, 3), | 551 | /* 010 */ V(3, 3, 3), |
552 | /* 011 */ V(4, 0, 3), | 552 | /* 011 */ V(4, 0, 3), |
@@ -556,27 +556,27 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { | |||
556 | /* 111 */ V(4, 1, 2), | 556 | /* 111 */ V(4, 1, 2), |
557 | 557 | ||
558 | /* 0010 ... */ | 558 | /* 0010 ... */ |
559 | /* 00 */ V(2, 3, 2), /* 40 */ | 559 | /* 00 */ V(2, 3, 2), /* 40 */ |
560 | /* 01 */ V(3, 2, 2), | 560 | /* 01 */ V(3, 2, 2), |
561 | /* 10 */ V(1, 3, 1), | 561 | /* 10 */ V(1, 3, 1), |
562 | /* 11 */ V(1, 3, 1), | 562 | /* 11 */ V(1, 3, 1), |
563 | 563 | ||
564 | /* 0011 ... */ | 564 | /* 0011 ... */ |
565 | /* 00 */ V(3, 1, 1), /* 44 */ | 565 | /* 00 */ V(3, 1, 1), /* 44 */ |
566 | /* 01 */ V(3, 1, 1), | 566 | /* 01 */ V(3, 1, 1), |
567 | /* 10 */ V(0, 3, 2), | 567 | /* 10 */ V(0, 3, 2), |
568 | /* 11 */ V(3, 0, 2), | 568 | /* 11 */ V(3, 0, 2), |
569 | 569 | ||
570 | /* 0100 ... */ | 570 | /* 0100 ... */ |
571 | /* 0 */ V(2, 2, 1), /* 48 */ | 571 | /* 0 */ V(2, 2, 1), /* 48 */ |
572 | /* 1 */ V(0, 2, 1), | 572 | /* 1 */ V(0, 2, 1), |
573 | 573 | ||
574 | /* 0000 0000 ... */ | 574 | /* 0000 0000 ... */ |
575 | /* 0 */ V(5, 5, 1), /* 50 */ | 575 | /* 0 */ V(5, 5, 1), /* 50 */ |
576 | /* 1 */ V(4, 5, 1), | 576 | /* 1 */ V(4, 5, 1), |
577 | 577 | ||
578 | /* 0000 0011 ... */ | 578 | /* 0000 0011 ... */ |
579 | /* 0 */ V(5, 4, 1), /* 52 */ | 579 | /* 0 */ V(5, 4, 1), /* 52 */ |
580 | /* 1 */ V(0, 5, 1) | 580 | /* 1 */ V(0, 5, 1) |
581 | }; | 581 | }; |
582 | 582 | ||
@@ -600,7 +600,7 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { | |||
600 | /* 1111 */ V(0, 0, 1), | 600 | /* 1111 */ V(0, 0, 1), |
601 | 601 | ||
602 | /* 0000 ... */ | 602 | /* 0000 ... */ |
603 | /* 0000 */ PTR(52, 3), /* 16 */ | 603 | /* 0000 */ PTR(52, 3), /* 16 */ |
604 | /* 0001 */ PTR(60, 2), | 604 | /* 0001 */ PTR(60, 2), |
605 | /* 0010 */ PTR(64, 3), | 605 | /* 0010 */ PTR(64, 3), |
606 | /* 0011 */ PTR(72, 1), | 606 | /* 0011 */ PTR(72, 1), |
@@ -618,7 +618,7 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { | |||
618 | /* 1111 */ PTR(96, 1), | 618 | /* 1111 */ PTR(96, 1), |
619 | 619 | ||
620 | /* 0001 ... */ | 620 | /* 0001 ... */ |
621 | /* 0000 */ PTR(98, 1), /* 32 */ | 621 | /* 0000 */ PTR(98, 1), /* 32 */ |
622 | /* 0001 */ PTR(100, 1), | 622 | /* 0001 */ PTR(100, 1), |
623 | /* 0010 */ V(1, 4, 4), | 623 | /* 0010 */ V(1, 4, 4), |
624 | /* 0011 */ V(4, 1, 4), | 624 | /* 0011 */ V(4, 1, 4), |
@@ -636,13 +636,13 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { | |||
636 | /* 1111 */ V(2, 2, 3), | 636 | /* 1111 */ V(2, 2, 3), |
637 | 637 | ||
638 | /* 0010 ... */ | 638 | /* 0010 ... */ |
639 | /* 00 */ V(1, 2, 2), /* 48 */ | 639 | /* 00 */ V(1, 2, 2), /* 48 */ |
640 | /* 01 */ V(2, 1, 2), | 640 | /* 01 */ V(2, 1, 2), |
641 | /* 10 */ V(0, 2, 2), | 641 | /* 10 */ V(0, 2, 2), |
642 | /* 11 */ V(2, 0, 2), | 642 | /* 11 */ V(2, 0, 2), |
643 | 643 | ||
644 | /* 0000 0000 ... */ | 644 | /* 0000 0000 ... */ |
645 | /* 000 */ V(7, 7, 3), /* 52 */ | 645 | /* 000 */ V(7, 7, 3), /* 52 */ |
646 | /* 001 */ V(6, 7, 3), | 646 | /* 001 */ V(6, 7, 3), |
647 | /* 010 */ V(7, 6, 3), | 647 | /* 010 */ V(7, 6, 3), |
648 | /* 011 */ V(5, 7, 3), | 648 | /* 011 */ V(5, 7, 3), |
@@ -652,13 +652,13 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { | |||
652 | /* 111 */ V(4, 7, 2), | 652 | /* 111 */ V(4, 7, 2), |
653 | 653 | ||
654 | /* 0000 0001 ... */ | 654 | /* 0000 0001 ... */ |
655 | /* 00 */ V(7, 4, 2), /* 60 */ | 655 | /* 00 */ V(7, 4, 2), /* 60 */ |
656 | /* 01 */ V(5, 6, 2), | 656 | /* 01 */ V(5, 6, 2), |
657 | /* 10 */ V(6, 5, 2), | 657 | /* 10 */ V(6, 5, 2), |
658 | /* 11 */ V(3, 7, 2), | 658 | /* 11 */ V(3, 7, 2), |
659 | 659 | ||
660 | /* 0000 0010 ... */ | 660 | /* 0000 0010 ... */ |
661 | /* 000 */ V(7, 3, 2), /* 64 */ | 661 | /* 000 */ V(7, 3, 2), /* 64 */ |
662 | /* 001 */ V(7, 3, 2), | 662 | /* 001 */ V(7, 3, 2), |
663 | /* 010 */ V(4, 6, 2), | 663 | /* 010 */ V(4, 6, 2), |
664 | /* 011 */ V(4, 6, 2), | 664 | /* 011 */ V(4, 6, 2), |
@@ -668,53 +668,53 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { | |||
668 | /* 111 */ V(6, 3, 2), | 668 | /* 111 */ V(6, 3, 2), |
669 | 669 | ||
670 | /* 0000 0011 ... */ | 670 | /* 0000 0011 ... */ |
671 | /* 0 */ V(2, 7, 1), /* 72 */ | 671 | /* 0 */ V(2, 7, 1), /* 72 */ |
672 | /* 1 */ V(7, 2, 1), | 672 | /* 1 */ V(7, 2, 1), |
673 | 673 | ||
674 | /* 0000 0100 ... */ | 674 | /* 0000 0100 ... */ |
675 | /* 00 */ V(6, 4, 2), /* 74 */ | 675 | /* 00 */ V(6, 4, 2), /* 74 */ |
676 | /* 01 */ V(0, 7, 2), | 676 | /* 01 */ V(0, 7, 2), |
677 | /* 10 */ V(7, 0, 1), | 677 | /* 10 */ V(7, 0, 1), |
678 | /* 11 */ V(7, 0, 1), | 678 | /* 11 */ V(7, 0, 1), |
679 | 679 | ||
680 | /* 0000 0101 ... */ | 680 | /* 0000 0101 ... */ |
681 | /* 00 */ V(6, 2, 1), /* 78 */ | 681 | /* 00 */ V(6, 2, 1), /* 78 */ |
682 | /* 01 */ V(6, 2, 1), | 682 | /* 01 */ V(6, 2, 1), |
683 | /* 10 */ V(4, 5, 2), | 683 | /* 10 */ V(4, 5, 2), |
684 | /* 11 */ V(3, 5, 2), | 684 | /* 11 */ V(3, 5, 2), |
685 | 685 | ||
686 | /* 0000 0110 ... */ | 686 | /* 0000 0110 ... */ |
687 | /* 00 */ V(0, 6, 1), /* 82 */ | 687 | /* 00 */ V(0, 6, 1), /* 82 */ |
688 | /* 01 */ V(0, 6, 1), | 688 | /* 01 */ V(0, 6, 1), |
689 | /* 10 */ V(5, 3, 2), | 689 | /* 10 */ V(5, 3, 2), |
690 | /* 11 */ V(4, 4, 2), | 690 | /* 11 */ V(4, 4, 2), |
691 | 691 | ||
692 | /* 0000 1001 ... */ | 692 | /* 0000 1001 ... */ |
693 | /* 0 */ V(3, 6, 1), /* 86 */ | 693 | /* 0 */ V(3, 6, 1), /* 86 */ |
694 | /* 1 */ V(2, 6, 1), | 694 | /* 1 */ V(2, 6, 1), |
695 | 695 | ||
696 | /* 0000 1010 ... */ | 696 | /* 0000 1010 ... */ |
697 | /* 00 */ V(2, 5, 2), /* 88 */ | 697 | /* 00 */ V(2, 5, 2), /* 88 */ |
698 | /* 01 */ V(5, 2, 2), | 698 | /* 01 */ V(5, 2, 2), |
699 | /* 10 */ V(1, 5, 1), | 699 | /* 10 */ V(1, 5, 1), |
700 | /* 11 */ V(1, 5, 1), | 700 | /* 11 */ V(1, 5, 1), |
701 | 701 | ||
702 | /* 0000 1011 ... */ | 702 | /* 0000 1011 ... */ |
703 | /* 00 */ V(5, 1, 1), /* 92 */ | 703 | /* 00 */ V(5, 1, 1), /* 92 */ |
704 | /* 01 */ V(5, 1, 1), | 704 | /* 01 */ V(5, 1, 1), |
705 | /* 10 */ V(3, 4, 2), | 705 | /* 10 */ V(3, 4, 2), |
706 | /* 11 */ V(4, 3, 2), | 706 | /* 11 */ V(4, 3, 2), |
707 | 707 | ||
708 | /* 0000 1111 ... */ | 708 | /* 0000 1111 ... */ |
709 | /* 0 */ V(0, 5, 1), /* 96 */ | 709 | /* 0 */ V(0, 5, 1), /* 96 */ |
710 | /* 1 */ V(5, 0, 1), | 710 | /* 1 */ V(5, 0, 1), |
711 | 711 | ||
712 | /* 0001 0000 ... */ | 712 | /* 0001 0000 ... */ |
713 | /* 0 */ V(2, 4, 1), /* 98 */ | 713 | /* 0 */ V(2, 4, 1), /* 98 */ |
714 | /* 1 */ V(4, 2, 1), | 714 | /* 1 */ V(4, 2, 1), |
715 | 715 | ||
716 | /* 0001 0001 ... */ | 716 | /* 0001 0001 ... */ |
717 | /* 0 */ V(3, 3, 1), /* 100 */ | 717 | /* 0 */ V(3, 3, 1), /* 100 */ |
718 | /* 1 */ V(0, 4, 1) | 718 | /* 1 */ V(0, 4, 1) |
719 | }; | 719 | }; |
720 | 720 | ||
@@ -738,7 +738,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
738 | /* 1111 */ V(0, 0, 2), | 738 | /* 1111 */ V(0, 0, 2), |
739 | 739 | ||
740 | /* 0000 ... */ | 740 | /* 0000 ... */ |
741 | /* 0000 */ PTR(74, 2), /* 16 */ | 741 | /* 0000 */ PTR(74, 2), /* 16 */ |
742 | /* 0001 */ PTR(78, 3), | 742 | /* 0001 */ PTR(78, 3), |
743 | /* 0010 */ PTR(86, 2), | 743 | /* 0010 */ PTR(86, 2), |
744 | /* 0011 */ PTR(90, 1), | 744 | /* 0011 */ PTR(90, 1), |
@@ -756,7 +756,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
756 | /* 1111 */ PTR(98, 1), | 756 | /* 1111 */ PTR(98, 1), |
757 | 757 | ||
758 | /* 0001 ... */ | 758 | /* 0001 ... */ |
759 | /* 0000 */ PTR(100, 1), /* 32 */ | 759 | /* 0000 */ PTR(100, 1), /* 32 */ |
760 | /* 0001 */ V(1, 5, 4), | 760 | /* 0001 */ V(1, 5, 4), |
761 | /* 0010 */ V(6, 2, 3), | 761 | /* 0010 */ V(6, 2, 3), |
762 | /* 0011 */ V(6, 2, 3), | 762 | /* 0011 */ V(6, 2, 3), |
@@ -774,7 +774,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
774 | /* 1111 */ V(4, 2, 4), | 774 | /* 1111 */ V(4, 2, 4), |
775 | 775 | ||
776 | /* 0010 ... */ | 776 | /* 0010 ... */ |
777 | /* 0000 */ V(1, 4, 4), /* 48 */ | 777 | /* 0000 */ V(1, 4, 4), /* 48 */ |
778 | /* 0001 */ V(4, 1, 4), | 778 | /* 0001 */ V(4, 1, 4), |
779 | /* 0010 */ V(0, 4, 4), | 779 | /* 0010 */ V(0, 4, 4), |
780 | /* 0011 */ V(4, 0, 4), | 780 | /* 0011 */ V(4, 0, 4), |
@@ -792,7 +792,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
792 | /* 1111 */ V(3, 1, 2), | 792 | /* 1111 */ V(3, 1, 2), |
793 | 793 | ||
794 | /* 0011 ... */ | 794 | /* 0011 ... */ |
795 | /* 000 */ V(0, 3, 3), /* 64 */ | 795 | /* 000 */ V(0, 3, 3), /* 64 */ |
796 | /* 001 */ V(3, 0, 3), | 796 | /* 001 */ V(3, 0, 3), |
797 | /* 010 */ V(2, 2, 2), | 797 | /* 010 */ V(2, 2, 2), |
798 | /* 011 */ V(2, 2, 2), | 798 | /* 011 */ V(2, 2, 2), |
@@ -802,17 +802,17 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
802 | /* 111 */ V(2, 1, 1), | 802 | /* 111 */ V(2, 1, 1), |
803 | 803 | ||
804 | /* 0101 ... */ | 804 | /* 0101 ... */ |
805 | /* 0 */ V(0, 2, 1), /* 72 */ | 805 | /* 0 */ V(0, 2, 1), /* 72 */ |
806 | /* 1 */ V(2, 0, 1), | 806 | /* 1 */ V(2, 0, 1), |
807 | 807 | ||
808 | /* 0000 0000 ... */ | 808 | /* 0000 0000 ... */ |
809 | /* 00 */ V(7, 7, 2), /* 74 */ | 809 | /* 00 */ V(7, 7, 2), /* 74 */ |
810 | /* 01 */ V(6, 7, 2), | 810 | /* 01 */ V(6, 7, 2), |
811 | /* 10 */ V(7, 6, 2), | 811 | /* 10 */ V(7, 6, 2), |
812 | /* 11 */ V(7, 5, 2), | 812 | /* 11 */ V(7, 5, 2), |
813 | 813 | ||
814 | /* 0000 0001 ... */ | 814 | /* 0000 0001 ... */ |
815 | /* 000 */ V(6, 6, 2), /* 78 */ | 815 | /* 000 */ V(6, 6, 2), /* 78 */ |
816 | /* 001 */ V(6, 6, 2), | 816 | /* 001 */ V(6, 6, 2), |
817 | /* 010 */ V(4, 7, 2), | 817 | /* 010 */ V(4, 7, 2), |
818 | /* 011 */ V(4, 7, 2), | 818 | /* 011 */ V(4, 7, 2), |
@@ -822,35 +822,35 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { | |||
822 | /* 111 */ V(5, 5, 3), | 822 | /* 111 */ V(5, 5, 3), |
823 | 823 | ||
824 | /* 0000 0010 ... */ | 824 | /* 0000 0010 ... */ |
825 | /* 00 */ V(5, 6, 2), /* 86 */ | 825 | /* 00 */ V(5, 6, 2), /* 86 */ |
826 | /* 01 */ V(6, 5, 2), | 826 | /* 01 */ V(6, 5, 2), |
827 | /* 10 */ V(3, 7, 1), | 827 | /* 10 */ V(3, 7, 1), |
828 | /* 11 */ V(3, 7, 1), | 828 | /* 11 */ V(3, 7, 1), |
829 | 829 | ||
830 | /* 0000 0011 ... */ | 830 | /* 0000 0011 ... */ |
831 | /* 0 */ V(7, 3, 1), /* 90 */ | 831 | /* 0 */ V(7, 3, 1), /* 90 */ |
832 | /* 1 */ V(4, 6, 1), | 832 | /* 1 */ V(4, 6, 1), |
833 | 833 | ||
834 | /* 0000 0100 ... */ | 834 | /* 0000 0100 ... */ |
835 | /* 00 */ V(4, 5, 2), /* 92 */ | 835 | /* 00 */ V(4, 5, 2), /* 92 */ |
836 | /* 01 */ V(5, 4, 2), | 836 | /* 01 */ V(5, 4, 2), |
837 | /* 10 */ V(3, 5, 2), | 837 | /* 10 */ V(3, 5, 2), |
838 | /* 11 */ V(5, 3, 2), | 838 | /* 11 */ V(5, 3, 2), |
839 | 839 | ||
840 | /* 0000 0111 ... */ | 840 | /* 0000 0111 ... */ |
841 | /* 0 */ V(6, 4, 1), /* 96 */ | 841 | /* 0 */ V(6, 4, 1), /* 96 */ |
842 | /* 1 */ V(0, 7, 1), | 842 | /* 1 */ V(0, 7, 1), |
843 | 843 | ||
844 | /* 0000 1111 ... */ | 844 | /* 0000 1111 ... */ |
845 | /* 0 */ V(4, 4, 1), /* 98 */ | 845 | /* 0 */ V(4, 4, 1), /* 98 */ |
846 | /* 1 */ V(2, 5, 1), | 846 | /* 1 */ V(2, 5, 1), |
847 | 847 | ||
848 | /* 0001 0000 ... */ | 848 | /* 0001 0000 ... */ |
849 | /* 0 */ V(5, 2, 1), /* 100 */ | 849 | /* 0 */ V(5, 2, 1), /* 100 */ |
850 | /* 1 */ V(0, 5, 1), | 850 | /* 1 */ V(0, 5, 1), |
851 | 851 | ||
852 | /* 0001 1101 ... */ | 852 | /* 0001 1101 ... */ |
853 | /* 0 */ V(4, 3, 1), /* 102 */ | 853 | /* 0 */ V(4, 3, 1), /* 102 */ |
854 | /* 1 */ V(3, 3, 1) | 854 | /* 1 */ V(3, 3, 1) |
855 | }; | 855 | }; |
856 | 856 | ||
@@ -874,7 +874,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { | |||
874 | /* 1111 */ V(1, 0, 3), | 874 | /* 1111 */ V(1, 0, 3), |
875 | 875 | ||
876 | /* 0000 ... */ | 876 | /* 0000 ... */ |
877 | /* 0000 */ PTR(80, 2), /* 16 */ | 877 | /* 0000 */ PTR(80, 2), /* 16 */ |
878 | /* 0001 */ PTR(84, 1), | 878 | /* 0001 */ PTR(84, 1), |
879 | /* 0010 */ PTR(86, 1), | 879 | /* 0010 */ PTR(86, 1), |
880 | /* 0011 */ PTR(88, 1), | 880 | /* 0011 */ PTR(88, 1), |
@@ -892,7 +892,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { | |||
892 | /* 1111 */ V(6, 3, 4), | 892 | /* 1111 */ V(6, 3, 4), |
893 | 893 | ||
894 | /* 0001 ... */ | 894 | /* 0001 ... */ |
895 | /* 0000 */ V(4, 5, 4), /* 32 */ | 895 | /* 0000 */ V(4, 5, 4), /* 32 */ |
896 | /* 0001 */ V(5, 4, 4), | 896 | /* 0001 */ V(5, 4, 4), |
897 | /* 0010 */ V(4, 4, 4), | 897 | /* 0010 */ V(4, 4, 4), |
898 | /* 0011 */ PTR(94, 1), | 898 | /* 0011 */ PTR(94, 1), |
@@ -910,7 +910,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { | |||
910 | /* 1111 */ V(5, 2, 4), | 910 | /* 1111 */ V(5, 2, 4), |
911 | 911 | ||
912 | /* 0010 ... */ | 912 | /* 0010 ... */ |
913 | /* 0000 */ V(1, 5, 3), /* 48 */ | 913 | /* 0000 */ V(1, 5, 3), /* 48 */ |
914 | /* 0001 */ V(1, 5, 3), | 914 | /* 0001 */ V(1, 5, 3), |
915 | /* 0010 */ V(5, 1, 3), | 915 | /* 0010 */ V(5, 1, 3), |
916 | /* 0011 */ V(5, 1, 3), | 916 | /* 0011 */ V(5, 1, 3), |
@@ -928,13 +928,13 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { | |||
928 | /* 1111 */ V(1, 4, 3), | 928 | /* 1111 */ V(1, 4, 3), |
929 | 929 | ||
930 | /* 0011 ... */ | 930 | /* 0011 ... */ |
931 | /* 00 */ V(3, 3, 2), /* 64 */ | 931 | /* 00 */ V(3, 3, 2), /* 64 */ |
932 | /* 01 */ V(4, 1, 2), | 932 | /* 01 */ V(4, 1, 2), |
933 | /* 10 */ V(2, 3, 2), | 933 | /* 10 */ V(2, 3, 2), |
934 | /* 11 */ V(3, 2, 2), | 934 | /* 11 */ V(3, 2, 2), |
935 | 935 | ||
936 | /* 0100 ... */ | 936 | /* 0100 ... */ |
937 | /* 000 */ V(4, 0, 3), /* 68 */ | 937 | /* 000 */ V(4, 0, 3), /* 68 */ |
938 | /* 001 */ V(0, 3, 3), | 938 | /* 001 */ V(0, 3, 3), |
939 | /* 010 */ V(3, 0, 2), | 939 | /* 010 */ V(3, 0, 2), |
940 | /* 011 */ V(3, 0, 2), | 940 | /* 011 */ V(3, 0, 2), |
@@ -944,41 +944,41 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { | |||
944 | /* 111 */ V(1, 3, 1), | 944 | /* 111 */ V(1, 3, 1), |
945 | 945 | ||
946 | /* 0101 ... */ | 946 | /* 0101 ... */ |
947 | /* 0 */ V(3, 1, 1), /* 76 */ | 947 | /* 0 */ V(3, 1, 1), /* 76 */ |
948 | /* 1 */ V(2, 2, 1), | 948 | /* 1 */ V(2, 2, 1), |
949 | 949 | ||
950 | /* 1000 ... */ | 950 | /* 1000 ... */ |
951 | /* 0 */ V(0, 2, 1), /* 78 */ | 951 | /* 0 */ V(0, 2, 1), /* 78 */ |
952 | /* 1 */ V(2, 0, 1), | 952 | /* 1 */ V(2, 0, 1), |
953 | 953 | ||
954 | /* 0000 0000 ... */ | 954 | /* 0000 0000 ... */ |
955 | /* 00 */ V(7, 7, 2), /* 80 */ | 955 | /* 00 */ V(7, 7, 2), /* 80 */ |
956 | /* 01 */ V(6, 7, 2), | 956 | /* 01 */ V(6, 7, 2), |
957 | /* 10 */ V(7, 6, 1), | 957 | /* 10 */ V(7, 6, 1), |
958 | /* 11 */ V(7, 6, 1), | 958 | /* 11 */ V(7, 6, 1), |
959 | 959 | ||
960 | /* 0000 0001 ... */ | 960 | /* 0000 0001 ... */ |
961 | /* 0 */ V(5, 7, 1), /* 84 */ | 961 | /* 0 */ V(5, 7, 1), /* 84 */ |
962 | /* 1 */ V(7, 5, 1), | 962 | /* 1 */ V(7, 5, 1), |
963 | 963 | ||
964 | /* 0000 0010 ... */ | 964 | /* 0000 0010 ... */ |
965 | /* 0 */ V(6, 6, 1), /* 86 */ | 965 | /* 0 */ V(6, 6, 1), /* 86 */ |
966 | /* 1 */ V(4, 7, 1), | 966 | /* 1 */ V(4, 7, 1), |
967 | 967 | ||
968 | /* 0000 0011 ... */ | 968 | /* 0000 0011 ... */ |
969 | /* 0 */ V(7, 4, 1), /* 88 */ | 969 | /* 0 */ V(7, 4, 1), /* 88 */ |
970 | /* 1 */ V(6, 5, 1), | 970 | /* 1 */ V(6, 5, 1), |
971 | 971 | ||
972 | /* 0000 0110 ... */ | 972 | /* 0000 0110 ... */ |
973 | /* 0 */ V(7, 3, 1), /* 90 */ | 973 | /* 0 */ V(7, 3, 1), /* 90 */ |
974 | /* 1 */ V(5, 5, 1), | 974 | /* 1 */ V(5, 5, 1), |
975 | 975 | ||
976 | /* 0000 1101 ... */ | 976 | /* 0000 1101 ... */ |
977 | /* 0 */ V(0, 7, 1), /* 92 */ | 977 | /* 0 */ V(0, 7, 1), /* 92 */ |
978 | /* 1 */ V(7, 0, 1), | 978 | /* 1 */ V(7, 0, 1), |
979 | 979 | ||
980 | /* 0001 0011 ... */ | 980 | /* 0001 0011 ... */ |
981 | /* 0 */ V(0, 6, 1), /* 94 */ | 981 | /* 0 */ V(0, 6, 1), /* 94 */ |
982 | /* 1 */ V(0, 5, 1) | 982 | /* 1 */ V(0, 5, 1) |
983 | }; | 983 | }; |
984 | 984 | ||
@@ -1002,7 +1002,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1002 | /* 1111 */ V(0, 0, 1), | 1002 | /* 1111 */ V(0, 0, 1), |
1003 | 1003 | ||
1004 | /* 0000 ... */ | 1004 | /* 0000 ... */ |
1005 | /* 0000 */ PTR(68, 4), /* 16 */ | 1005 | /* 0000 */ PTR(68, 4), /* 16 */ |
1006 | /* 0001 */ PTR(84, 4), | 1006 | /* 0001 */ PTR(84, 4), |
1007 | /* 0010 */ PTR(100, 4), | 1007 | /* 0010 */ PTR(100, 4), |
1008 | /* 0011 */ PTR(116, 4), | 1008 | /* 0011 */ PTR(116, 4), |
@@ -1020,7 +1020,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1020 | /* 1111 */ PTR(226, 1), | 1020 | /* 1111 */ PTR(226, 1), |
1021 | 1021 | ||
1022 | /* 0001 ... */ | 1022 | /* 0001 ... */ |
1023 | /* 0000 */ PTR(228, 2), /* 32 */ | 1023 | /* 0000 */ PTR(228, 2), /* 32 */ |
1024 | /* 0001 */ PTR(232, 2), | 1024 | /* 0001 */ PTR(232, 2), |
1025 | /* 0010 */ PTR(236, 2), | 1025 | /* 0010 */ PTR(236, 2), |
1026 | /* 0011 */ PTR(240, 2), | 1026 | /* 0011 */ PTR(240, 2), |
@@ -1038,7 +1038,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1038 | /* 1111 */ V(1, 4, 4), | 1038 | /* 1111 */ V(1, 4, 4), |
1039 | 1039 | ||
1040 | /* 0010 ... */ | 1040 | /* 0010 ... */ |
1041 | /* 0000 */ V(4, 1, 3), /* 48 */ | 1041 | /* 0000 */ V(4, 1, 3), /* 48 */ |
1042 | /* 0001 */ V(4, 1, 3), | 1042 | /* 0001 */ V(4, 1, 3), |
1043 | /* 0010 */ V(0, 4, 4), | 1043 | /* 0010 */ V(0, 4, 4), |
1044 | /* 0011 */ V(4, 0, 4), | 1044 | /* 0011 */ V(4, 0, 4), |
@@ -1056,13 +1056,13 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1056 | /* 1111 */ V(2, 2, 3), | 1056 | /* 1111 */ V(2, 2, 3), |
1057 | 1057 | ||
1058 | /* 0011 ... */ | 1058 | /* 0011 ... */ |
1059 | /* 00 */ V(1, 2, 2), /* 64 */ | 1059 | /* 00 */ V(1, 2, 2), /* 64 */ |
1060 | /* 01 */ V(2, 1, 2), | 1060 | /* 01 */ V(2, 1, 2), |
1061 | /* 10 */ V(0, 2, 2), | 1061 | /* 10 */ V(0, 2, 2), |
1062 | /* 11 */ V(2, 0, 2), | 1062 | /* 11 */ V(2, 0, 2), |
1063 | 1063 | ||
1064 | /* 0000 0000 ... */ | 1064 | /* 0000 0000 ... */ |
1065 | /* 0000 */ PTR(262, 4), /* 68 */ | 1065 | /* 0000 */ PTR(262, 4), /* 68 */ |
1066 | /* 0001 */ PTR(278, 4), | 1066 | /* 0001 */ PTR(278, 4), |
1067 | /* 0010 */ PTR(294, 4), | 1067 | /* 0010 */ PTR(294, 4), |
1068 | /* 0011 */ PTR(310, 3), | 1068 | /* 0011 */ PTR(310, 3), |
@@ -1080,7 +1080,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1080 | /* 1111 */ V(15, 1, 4), | 1080 | /* 1111 */ V(15, 1, 4), |
1081 | 1081 | ||
1082 | /* 0000 0001 ... */ | 1082 | /* 0000 0001 ... */ |
1083 | /* 0000 */ V(15, 0, 4), /* 84 */ | 1083 | /* 0000 */ V(15, 0, 4), /* 84 */ |
1084 | /* 0001 */ PTR(360, 1), | 1084 | /* 0001 */ PTR(360, 1), |
1085 | /* 0010 */ PTR(362, 1), | 1085 | /* 0010 */ PTR(362, 1), |
1086 | /* 0011 */ PTR(364, 1), | 1086 | /* 0011 */ PTR(364, 1), |
@@ -1098,7 +1098,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1098 | /* 1111 */ V(3, 13, 4), | 1098 | /* 1111 */ V(3, 13, 4), |
1099 | 1099 | ||
1100 | /* 0000 0010 ... */ | 1100 | /* 0000 0010 ... */ |
1101 | /* 0000 */ PTR(380, 1), /* 100 */ | 1101 | /* 0000 */ PTR(380, 1), /* 100 */ |
1102 | /* 0001 */ V(2, 13, 4), | 1102 | /* 0001 */ V(2, 13, 4), |
1103 | /* 0010 */ V(13, 2, 4), | 1103 | /* 0010 */ V(13, 2, 4), |
1104 | /* 0011 */ V(1, 13, 4), | 1104 | /* 0011 */ V(1, 13, 4), |
@@ -1116,7 +1116,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1116 | /* 1111 */ V(10, 8, 4), | 1116 | /* 1111 */ V(10, 8, 4), |
1117 | 1117 | ||
1118 | /* 0000 0011 ... */ | 1118 | /* 0000 0011 ... */ |
1119 | /* 0000 */ V(4, 12, 4), /* 116 */ | 1119 | /* 0000 */ V(4, 12, 4), /* 116 */ |
1120 | /* 0001 */ V(12, 4, 4), | 1120 | /* 0001 */ V(12, 4, 4), |
1121 | /* 0010 */ V(6, 11, 4), | 1121 | /* 0010 */ V(6, 11, 4), |
1122 | /* 0011 */ V(11, 6, 4), | 1122 | /* 0011 */ V(11, 6, 4), |
@@ -1134,7 +1134,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1134 | /* 1111 */ V(1, 12, 3), | 1134 | /* 1111 */ V(1, 12, 3), |
1135 | 1135 | ||
1136 | /* 0000 0100 ... */ | 1136 | /* 0000 0100 ... */ |
1137 | /* 0000 */ V(12, 1, 3), /* 132 */ | 1137 | /* 0000 */ V(12, 1, 3), /* 132 */ |
1138 | /* 0001 */ V(12, 1, 3), | 1138 | /* 0001 */ V(12, 1, 3), |
1139 | /* 0010 */ V(9, 8, 4), | 1139 | /* 0010 */ V(9, 8, 4), |
1140 | /* 0011 */ V(0, 12, 4), | 1140 | /* 0011 */ V(0, 12, 4), |
@@ -1152,7 +1152,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1152 | /* 1111 */ V(5, 10, 4), | 1152 | /* 1111 */ V(5, 10, 4), |
1153 | 1153 | ||
1154 | /* 0000 0101 ... */ | 1154 | /* 0000 0101 ... */ |
1155 | /* 0000 */ V(2, 11, 3), /* 148 */ | 1155 | /* 0000 */ V(2, 11, 3), /* 148 */ |
1156 | /* 0001 */ V(2, 11, 3), | 1156 | /* 0001 */ V(2, 11, 3), |
1157 | /* 0010 */ V(10, 5, 4), | 1157 | /* 0010 */ V(10, 5, 4), |
1158 | /* 0011 */ V(6, 9, 4), | 1158 | /* 0011 */ V(6, 9, 4), |
@@ -1170,7 +1170,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1170 | /* 1111 */ V(11, 2, 2), | 1170 | /* 1111 */ V(11, 2, 2), |
1171 | 1171 | ||
1172 | /* 0000 0110 ... */ | 1172 | /* 0000 0110 ... */ |
1173 | /* 000 */ V(1, 11, 2), /* 164 */ | 1173 | /* 000 */ V(1, 11, 2), /* 164 */ |
1174 | /* 001 */ V(1, 11, 2), | 1174 | /* 001 */ V(1, 11, 2), |
1175 | /* 010 */ V(11, 1, 2), | 1175 | /* 010 */ V(11, 1, 2), |
1176 | /* 011 */ V(11, 1, 2), | 1176 | /* 011 */ V(11, 1, 2), |
@@ -1180,7 +1180,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1180 | /* 111 */ V(4, 10, 3), | 1180 | /* 111 */ V(4, 10, 3), |
1181 | 1181 | ||
1182 | /* 0000 0111 ... */ | 1182 | /* 0000 0111 ... */ |
1183 | /* 000 */ V(3, 10, 3), /* 172 */ | 1183 | /* 000 */ V(3, 10, 3), /* 172 */ |
1184 | /* 001 */ V(10, 3, 3), | 1184 | /* 001 */ V(10, 3, 3), |
1185 | /* 010 */ V(5, 9, 3), | 1185 | /* 010 */ V(5, 9, 3), |
1186 | /* 011 */ V(9, 5, 3), | 1186 | /* 011 */ V(9, 5, 3), |
@@ -1190,7 +1190,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1190 | /* 111 */ V(10, 2, 2), | 1190 | /* 111 */ V(10, 2, 2), |
1191 | 1191 | ||
1192 | /* 0000 1000 ... */ | 1192 | /* 0000 1000 ... */ |
1193 | /* 000 */ V(1, 10, 2), /* 180 */ | 1193 | /* 000 */ V(1, 10, 2), /* 180 */ |
1194 | /* 001 */ V(1, 10, 2), | 1194 | /* 001 */ V(1, 10, 2), |
1195 | /* 010 */ V(10, 1, 2), | 1195 | /* 010 */ V(10, 1, 2), |
1196 | /* 011 */ V(10, 1, 2), | 1196 | /* 011 */ V(10, 1, 2), |
@@ -1200,7 +1200,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1200 | /* 111 */ V(10, 0, 2), | 1200 | /* 111 */ V(10, 0, 2), |
1201 | 1201 | ||
1202 | /* 0000 1001 ... */ | 1202 | /* 0000 1001 ... */ |
1203 | /* 000 */ V(8, 6, 3), /* 188 */ | 1203 | /* 000 */ V(8, 6, 3), /* 188 */ |
1204 | /* 001 */ V(4, 9, 3), | 1204 | /* 001 */ V(4, 9, 3), |
1205 | /* 010 */ V(9, 3, 2), | 1205 | /* 010 */ V(9, 3, 2), |
1206 | /* 011 */ V(9, 3, 2), | 1206 | /* 011 */ V(9, 3, 2), |
@@ -1210,7 +1210,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1210 | /* 111 */ V(6, 7, 3), | 1210 | /* 111 */ V(6, 7, 3), |
1211 | 1211 | ||
1212 | /* 0000 1010 ... */ | 1212 | /* 0000 1010 ... */ |
1213 | /* 000 */ V(2, 9, 2), /* 196 */ | 1213 | /* 000 */ V(2, 9, 2), /* 196 */ |
1214 | /* 001 */ V(2, 9, 2), | 1214 | /* 001 */ V(2, 9, 2), |
1215 | /* 010 */ V(9, 2, 2), | 1215 | /* 010 */ V(9, 2, 2), |
1216 | /* 011 */ V(9, 2, 2), | 1216 | /* 011 */ V(9, 2, 2), |
@@ -1220,7 +1220,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1220 | /* 111 */ V(3, 8, 2), | 1220 | /* 111 */ V(3, 8, 2), |
1221 | 1221 | ||
1222 | /* 0000 1011 ... */ | 1222 | /* 0000 1011 ... */ |
1223 | /* 000 */ V(8, 3, 2), /* 204 */ | 1223 | /* 000 */ V(8, 3, 2), /* 204 */ |
1224 | /* 001 */ V(8, 3, 2), | 1224 | /* 001 */ V(8, 3, 2), |
1225 | /* 010 */ V(6, 6, 3), | 1225 | /* 010 */ V(6, 6, 3), |
1226 | /* 011 */ V(4, 7, 3), | 1226 | /* 011 */ V(4, 7, 3), |
@@ -1230,17 +1230,17 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1230 | /* 111 */ V(7, 3, 3), | 1230 | /* 111 */ V(7, 3, 3), |
1231 | 1231 | ||
1232 | /* 0000 1100 ... */ | 1232 | /* 0000 1100 ... */ |
1233 | /* 0 */ V(1, 9, 1), /* 212 */ | 1233 | /* 0 */ V(1, 9, 1), /* 212 */ |
1234 | /* 1 */ V(9, 1, 1), | 1234 | /* 1 */ V(9, 1, 1), |
1235 | 1235 | ||
1236 | /* 0000 1101 ... */ | 1236 | /* 0000 1101 ... */ |
1237 | /* 00 */ V(0, 9, 2), /* 214 */ | 1237 | /* 00 */ V(0, 9, 2), /* 214 */ |
1238 | /* 01 */ V(9, 0, 2), | 1238 | /* 01 */ V(9, 0, 2), |
1239 | /* 10 */ V(4, 8, 2), | 1239 | /* 10 */ V(4, 8, 2), |
1240 | /* 11 */ V(8, 4, 2), | 1240 | /* 11 */ V(8, 4, 2), |
1241 | 1241 | ||
1242 | /* 0000 1110 ... */ | 1242 | /* 0000 1110 ... */ |
1243 | /* 000 */ V(7, 2, 2), /* 218 */ | 1243 | /* 000 */ V(7, 2, 2), /* 218 */ |
1244 | /* 001 */ V(7, 2, 2), | 1244 | /* 001 */ V(7, 2, 2), |
1245 | /* 010 */ V(4, 6, 3), | 1245 | /* 010 */ V(4, 6, 3), |
1246 | /* 011 */ V(6, 4, 3), | 1246 | /* 011 */ V(6, 4, 3), |
@@ -1250,69 +1250,69 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1250 | /* 111 */ V(2, 8, 1), | 1250 | /* 111 */ V(2, 8, 1), |
1251 | 1251 | ||
1252 | /* 0000 1111 ... */ | 1252 | /* 0000 1111 ... */ |
1253 | /* 0 */ V(8, 2, 1), /* 226 */ | 1253 | /* 0 */ V(8, 2, 1), /* 226 */ |
1254 | /* 1 */ V(1, 8, 1), | 1254 | /* 1 */ V(1, 8, 1), |
1255 | 1255 | ||
1256 | /* 0001 0000 ... */ | 1256 | /* 0001 0000 ... */ |
1257 | /* 00 */ V(3, 7, 2), /* 228 */ | 1257 | /* 00 */ V(3, 7, 2), /* 228 */ |
1258 | /* 01 */ V(2, 7, 2), | 1258 | /* 01 */ V(2, 7, 2), |
1259 | /* 10 */ V(1, 7, 1), | 1259 | /* 10 */ V(1, 7, 1), |
1260 | /* 11 */ V(1, 7, 1), | 1260 | /* 11 */ V(1, 7, 1), |
1261 | 1261 | ||
1262 | /* 0001 0001 ... */ | 1262 | /* 0001 0001 ... */ |
1263 | /* 00 */ V(7, 1, 1), /* 232 */ | 1263 | /* 00 */ V(7, 1, 1), /* 232 */ |
1264 | /* 01 */ V(7, 1, 1), | 1264 | /* 01 */ V(7, 1, 1), |
1265 | /* 10 */ V(5, 5, 2), | 1265 | /* 10 */ V(5, 5, 2), |
1266 | /* 11 */ V(0, 7, 2), | 1266 | /* 11 */ V(0, 7, 2), |
1267 | 1267 | ||
1268 | /* 0001 0010 ... */ | 1268 | /* 0001 0010 ... */ |
1269 | /* 00 */ V(7, 0, 2), /* 236 */ | 1269 | /* 00 */ V(7, 0, 2), /* 236 */ |
1270 | /* 01 */ V(3, 6, 2), | 1270 | /* 01 */ V(3, 6, 2), |
1271 | /* 10 */ V(6, 3, 2), | 1271 | /* 10 */ V(6, 3, 2), |
1272 | /* 11 */ V(4, 5, 2), | 1272 | /* 11 */ V(4, 5, 2), |
1273 | 1273 | ||
1274 | /* 0001 0011 ... */ | 1274 | /* 0001 0011 ... */ |
1275 | /* 00 */ V(5, 4, 2), /* 240 */ | 1275 | /* 00 */ V(5, 4, 2), /* 240 */ |
1276 | /* 01 */ V(2, 6, 2), | 1276 | /* 01 */ V(2, 6, 2), |
1277 | /* 10 */ V(6, 2, 2), | 1277 | /* 10 */ V(6, 2, 2), |
1278 | /* 11 */ V(3, 5, 2), | 1278 | /* 11 */ V(3, 5, 2), |
1279 | 1279 | ||
1280 | /* 0001 0101 ... */ | 1280 | /* 0001 0101 ... */ |
1281 | /* 0 */ V(0, 8, 1), /* 244 */ | 1281 | /* 0 */ V(0, 8, 1), /* 244 */ |
1282 | /* 1 */ V(8, 0, 1), | 1282 | /* 1 */ V(8, 0, 1), |
1283 | 1283 | ||
1284 | /* 0001 0110 ... */ | 1284 | /* 0001 0110 ... */ |
1285 | /* 0 */ V(1, 6, 1), /* 246 */ | 1285 | /* 0 */ V(1, 6, 1), /* 246 */ |
1286 | /* 1 */ V(6, 1, 1), | 1286 | /* 1 */ V(6, 1, 1), |
1287 | 1287 | ||
1288 | /* 0001 0111 ... */ | 1288 | /* 0001 0111 ... */ |
1289 | /* 0 */ V(0, 6, 1), /* 248 */ | 1289 | /* 0 */ V(0, 6, 1), /* 248 */ |
1290 | /* 1 */ V(6, 0, 1), | 1290 | /* 1 */ V(6, 0, 1), |
1291 | 1291 | ||
1292 | /* 0001 1000 ... */ | 1292 | /* 0001 1000 ... */ |
1293 | /* 00 */ V(5, 3, 2), /* 250 */ | 1293 | /* 00 */ V(5, 3, 2), /* 250 */ |
1294 | /* 01 */ V(4, 4, 2), | 1294 | /* 01 */ V(4, 4, 2), |
1295 | /* 10 */ V(2, 5, 1), | 1295 | /* 10 */ V(2, 5, 1), |
1296 | /* 11 */ V(2, 5, 1), | 1296 | /* 11 */ V(2, 5, 1), |
1297 | 1297 | ||
1298 | /* 0001 1001 ... */ | 1298 | /* 0001 1001 ... */ |
1299 | /* 0 */ V(5, 2, 1), /* 254 */ | 1299 | /* 0 */ V(5, 2, 1), /* 254 */ |
1300 | /* 1 */ V(0, 5, 1), | 1300 | /* 1 */ V(0, 5, 1), |
1301 | 1301 | ||
1302 | /* 0001 1100 ... */ | 1302 | /* 0001 1100 ... */ |
1303 | /* 0 */ V(3, 4, 1), /* 256 */ | 1303 | /* 0 */ V(3, 4, 1), /* 256 */ |
1304 | /* 1 */ V(4, 3, 1), | 1304 | /* 1 */ V(4, 3, 1), |
1305 | 1305 | ||
1306 | /* 0001 1101 ... */ | 1306 | /* 0001 1101 ... */ |
1307 | /* 0 */ V(5, 0, 1), /* 258 */ | 1307 | /* 0 */ V(5, 0, 1), /* 258 */ |
1308 | /* 1 */ V(2, 4, 1), | 1308 | /* 1 */ V(2, 4, 1), |
1309 | 1309 | ||
1310 | /* 0001 1110 ... */ | 1310 | /* 0001 1110 ... */ |
1311 | /* 0 */ V(4, 2, 1), /* 260 */ | 1311 | /* 0 */ V(4, 2, 1), /* 260 */ |
1312 | /* 1 */ V(3, 3, 1), | 1312 | /* 1 */ V(3, 3, 1), |
1313 | 1313 | ||
1314 | /* 0000 0000 0000 ... */ | 1314 | /* 0000 0000 0000 ... */ |
1315 | /* 0000 */ PTR(388, 3), /* 262 */ | 1315 | /* 0000 */ PTR(388, 3), /* 262 */ |
1316 | /* 0001 */ V(15, 15, 4), | 1316 | /* 0001 */ V(15, 15, 4), |
1317 | /* 0010 */ V(14, 15, 4), | 1317 | /* 0010 */ V(14, 15, 4), |
1318 | /* 0011 */ V(13, 15, 4), | 1318 | /* 0011 */ V(13, 15, 4), |
@@ -1330,7 +1330,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1330 | /* 1111 */ V(13, 13, 3), | 1330 | /* 1111 */ V(13, 13, 3), |
1331 | 1331 | ||
1332 | /* 0000 0000 0001 ... */ | 1332 | /* 0000 0000 0001 ... */ |
1333 | /* 0000 */ V(15, 10, 4), /* 278 */ | 1333 | /* 0000 */ V(15, 10, 4), /* 278 */ |
1334 | /* 0001 */ V(12, 13, 4), | 1334 | /* 0001 */ V(12, 13, 4), |
1335 | /* 0010 */ V(11, 14, 3), | 1335 | /* 0010 */ V(11, 14, 3), |
1336 | /* 0011 */ V(11, 14, 3), | 1336 | /* 0011 */ V(11, 14, 3), |
@@ -1348,7 +1348,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1348 | /* 1111 */ V(13, 11, 3), | 1348 | /* 1111 */ V(13, 11, 3), |
1349 | 1349 | ||
1350 | /* 0000 0000 0010 ... */ | 1350 | /* 0000 0000 0010 ... */ |
1351 | /* 0000 */ V(8, 15, 3), /* 294 */ | 1351 | /* 0000 */ V(8, 15, 3), /* 294 */ |
1352 | /* 0001 */ V(8, 15, 3), | 1352 | /* 0001 */ V(8, 15, 3), |
1353 | /* 0010 */ V(15, 8, 3), | 1353 | /* 0010 */ V(15, 8, 3), |
1354 | /* 0011 */ V(15, 8, 3), | 1354 | /* 0011 */ V(15, 8, 3), |
@@ -1366,7 +1366,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1366 | /* 1111 */ V(15, 7, 2), | 1366 | /* 1111 */ V(15, 7, 2), |
1367 | 1367 | ||
1368 | /* 0000 0000 0011 ... */ | 1368 | /* 0000 0000 0011 ... */ |
1369 | /* 000 */ V(13, 10, 2), /* 310 */ | 1369 | /* 000 */ V(13, 10, 2), /* 310 */ |
1370 | /* 001 */ V(13, 10, 2), | 1370 | /* 001 */ V(13, 10, 2), |
1371 | /* 010 */ V(10, 13, 3), | 1371 | /* 010 */ V(10, 13, 3), |
1372 | /* 011 */ V(11, 12, 3), | 1372 | /* 011 */ V(11, 12, 3), |
@@ -1376,19 +1376,19 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1376 | /* 111 */ V(6, 15, 2), | 1376 | /* 111 */ V(6, 15, 2), |
1377 | 1377 | ||
1378 | /* 0000 0000 0100 ... */ | 1378 | /* 0000 0000 0100 ... */ |
1379 | /* 00 */ V(14, 8, 2), /* 318 */ | 1379 | /* 00 */ V(14, 8, 2), /* 318 */ |
1380 | /* 01 */ V(5, 15, 2), | 1380 | /* 01 */ V(5, 15, 2), |
1381 | /* 10 */ V(9, 13, 2), | 1381 | /* 10 */ V(9, 13, 2), |
1382 | /* 11 */ V(13, 9, 2), | 1382 | /* 11 */ V(13, 9, 2), |
1383 | 1383 | ||
1384 | /* 0000 0000 0101 ... */ | 1384 | /* 0000 0000 0101 ... */ |
1385 | /* 00 */ V(15, 5, 2), /* 322 */ | 1385 | /* 00 */ V(15, 5, 2), /* 322 */ |
1386 | /* 01 */ V(14, 7, 2), | 1386 | /* 01 */ V(14, 7, 2), |
1387 | /* 10 */ V(10, 12, 2), | 1387 | /* 10 */ V(10, 12, 2), |
1388 | /* 11 */ V(11, 11, 2), | 1388 | /* 11 */ V(11, 11, 2), |
1389 | 1389 | ||
1390 | /* 0000 0000 0110 ... */ | 1390 | /* 0000 0000 0110 ... */ |
1391 | /* 000 */ V(4, 15, 2), /* 326 */ | 1391 | /* 000 */ V(4, 15, 2), /* 326 */ |
1392 | /* 001 */ V(4, 15, 2), | 1392 | /* 001 */ V(4, 15, 2), |
1393 | /* 010 */ V(15, 4, 2), | 1393 | /* 010 */ V(15, 4, 2), |
1394 | /* 011 */ V(15, 4, 2), | 1394 | /* 011 */ V(15, 4, 2), |
@@ -1398,103 +1398,103 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1398 | /* 111 */ V(15, 3, 2), | 1398 | /* 111 */ V(15, 3, 2), |
1399 | 1399 | ||
1400 | /* 0000 0000 0111 ... */ | 1400 | /* 0000 0000 0111 ... */ |
1401 | /* 00 */ V(3, 15, 1), /* 334 */ | 1401 | /* 00 */ V(3, 15, 1), /* 334 */ |
1402 | /* 01 */ V(3, 15, 1), | 1402 | /* 01 */ V(3, 15, 1), |
1403 | /* 10 */ V(8, 13, 2), | 1403 | /* 10 */ V(8, 13, 2), |
1404 | /* 11 */ V(13, 8, 2), | 1404 | /* 11 */ V(13, 8, 2), |
1405 | 1405 | ||
1406 | /* 0000 0000 1000 ... */ | 1406 | /* 0000 0000 1000 ... */ |
1407 | /* 0 */ V(2, 15, 1), /* 338 */ | 1407 | /* 0 */ V(2, 15, 1), /* 338 */ |
1408 | /* 1 */ V(15, 2, 1), | 1408 | /* 1 */ V(15, 2, 1), |
1409 | 1409 | ||
1410 | /* 0000 0000 1001 ... */ | 1410 | /* 0000 0000 1001 ... */ |
1411 | /* 00 */ V(6, 14, 2), /* 340 */ | 1411 | /* 00 */ V(6, 14, 2), /* 340 */ |
1412 | /* 01 */ V(9, 12, 2), | 1412 | /* 01 */ V(9, 12, 2), |
1413 | /* 10 */ V(0, 15, 1), | 1413 | /* 10 */ V(0, 15, 1), |
1414 | /* 11 */ V(0, 15, 1), | 1414 | /* 11 */ V(0, 15, 1), |
1415 | 1415 | ||
1416 | /* 0000 0000 1010 ... */ | 1416 | /* 0000 0000 1010 ... */ |
1417 | /* 00 */ V(12, 9, 2), /* 344 */ | 1417 | /* 00 */ V(12, 9, 2), /* 344 */ |
1418 | /* 01 */ V(5, 14, 2), | 1418 | /* 01 */ V(5, 14, 2), |
1419 | /* 10 */ V(10, 11, 1), | 1419 | /* 10 */ V(10, 11, 1), |
1420 | /* 11 */ V(10, 11, 1), | 1420 | /* 11 */ V(10, 11, 1), |
1421 | 1421 | ||
1422 | /* 0000 0000 1011 ... */ | 1422 | /* 0000 0000 1011 ... */ |
1423 | /* 00 */ V(7, 13, 2), /* 348 */ | 1423 | /* 00 */ V(7, 13, 2), /* 348 */ |
1424 | /* 01 */ V(13, 7, 2), | 1424 | /* 01 */ V(13, 7, 2), |
1425 | /* 10 */ V(4, 14, 1), | 1425 | /* 10 */ V(4, 14, 1), |
1426 | /* 11 */ V(4, 14, 1), | 1426 | /* 11 */ V(4, 14, 1), |
1427 | 1427 | ||
1428 | /* 0000 0000 1100 ... */ | 1428 | /* 0000 0000 1100 ... */ |
1429 | /* 00 */ V(12, 8, 2), /* 352 */ | 1429 | /* 00 */ V(12, 8, 2), /* 352 */ |
1430 | /* 01 */ V(13, 6, 2), | 1430 | /* 01 */ V(13, 6, 2), |
1431 | /* 10 */ V(3, 14, 1), | 1431 | /* 10 */ V(3, 14, 1), |
1432 | /* 11 */ V(3, 14, 1), | 1432 | /* 11 */ V(3, 14, 1), |
1433 | 1433 | ||
1434 | /* 0000 0000 1101 ... */ | 1434 | /* 0000 0000 1101 ... */ |
1435 | /* 00 */ V(11, 9, 1), /* 356 */ | 1435 | /* 00 */ V(11, 9, 1), /* 356 */ |
1436 | /* 01 */ V(11, 9, 1), | 1436 | /* 01 */ V(11, 9, 1), |
1437 | /* 10 */ V(9, 11, 2), | 1437 | /* 10 */ V(9, 11, 2), |
1438 | /* 11 */ V(10, 10, 2), | 1438 | /* 11 */ V(10, 10, 2), |
1439 | 1439 | ||
1440 | /* 0000 0001 0001 ... */ | 1440 | /* 0000 0001 0001 ... */ |
1441 | /* 0 */ V(11, 10, 1), /* 360 */ | 1441 | /* 0 */ V(11, 10, 1), /* 360 */ |
1442 | /* 1 */ V(14, 5, 1), | 1442 | /* 1 */ V(14, 5, 1), |
1443 | 1443 | ||
1444 | /* 0000 0001 0010 ... */ | 1444 | /* 0000 0001 0010 ... */ |
1445 | /* 0 */ V(14, 4, 1), /* 362 */ | 1445 | /* 0 */ V(14, 4, 1), /* 362 */ |
1446 | /* 1 */ V(8, 12, 1), | 1446 | /* 1 */ V(8, 12, 1), |
1447 | 1447 | ||
1448 | /* 0000 0001 0011 ... */ | 1448 | /* 0000 0001 0011 ... */ |
1449 | /* 0 */ V(6, 13, 1), /* 364 */ | 1449 | /* 0 */ V(6, 13, 1), /* 364 */ |
1450 | /* 1 */ V(14, 3, 1), | 1450 | /* 1 */ V(14, 3, 1), |
1451 | 1451 | ||
1452 | /* 0000 0001 0101 ... */ | 1452 | /* 0000 0001 0101 ... */ |
1453 | /* 0 */ V(2, 14, 1), /* 366 */ | 1453 | /* 0 */ V(2, 14, 1), /* 366 */ |
1454 | /* 1 */ V(0, 14, 1), | 1454 | /* 1 */ V(0, 14, 1), |
1455 | 1455 | ||
1456 | /* 0000 0001 1000 ... */ | 1456 | /* 0000 0001 1000 ... */ |
1457 | /* 0 */ V(14, 0, 1), /* 368 */ | 1457 | /* 0 */ V(14, 0, 1), /* 368 */ |
1458 | /* 1 */ V(5, 13, 1), | 1458 | /* 1 */ V(5, 13, 1), |
1459 | 1459 | ||
1460 | /* 0000 0001 1001 ... */ | 1460 | /* 0000 0001 1001 ... */ |
1461 | /* 0 */ V(13, 5, 1), /* 370 */ | 1461 | /* 0 */ V(13, 5, 1), /* 370 */ |
1462 | /* 1 */ V(7, 12, 1), | 1462 | /* 1 */ V(7, 12, 1), |
1463 | 1463 | ||
1464 | /* 0000 0001 1010 ... */ | 1464 | /* 0000 0001 1010 ... */ |
1465 | /* 0 */ V(12, 7, 1), /* 372 */ | 1465 | /* 0 */ V(12, 7, 1), /* 372 */ |
1466 | /* 1 */ V(4, 13, 1), | 1466 | /* 1 */ V(4, 13, 1), |
1467 | 1467 | ||
1468 | /* 0000 0001 1011 ... */ | 1468 | /* 0000 0001 1011 ... */ |
1469 | /* 0 */ V(8, 11, 1), /* 374 */ | 1469 | /* 0 */ V(8, 11, 1), /* 374 */ |
1470 | /* 1 */ V(11, 8, 1), | 1470 | /* 1 */ V(11, 8, 1), |
1471 | 1471 | ||
1472 | /* 0000 0001 1100 ... */ | 1472 | /* 0000 0001 1100 ... */ |
1473 | /* 0 */ V(13, 4, 1), /* 376 */ | 1473 | /* 0 */ V(13, 4, 1), /* 376 */ |
1474 | /* 1 */ V(9, 10, 1), | 1474 | /* 1 */ V(9, 10, 1), |
1475 | 1475 | ||
1476 | /* 0000 0001 1101 ... */ | 1476 | /* 0000 0001 1101 ... */ |
1477 | /* 0 */ V(10, 9, 1), /* 378 */ | 1477 | /* 0 */ V(10, 9, 1), /* 378 */ |
1478 | /* 1 */ V(6, 12, 1), | 1478 | /* 1 */ V(6, 12, 1), |
1479 | 1479 | ||
1480 | /* 0000 0010 0000 ... */ | 1480 | /* 0000 0010 0000 ... */ |
1481 | /* 0 */ V(13, 3, 1), /* 380 */ | 1481 | /* 0 */ V(13, 3, 1), /* 380 */ |
1482 | /* 1 */ V(7, 11, 1), | 1482 | /* 1 */ V(7, 11, 1), |
1483 | 1483 | ||
1484 | /* 0000 0010 0101 ... */ | 1484 | /* 0000 0010 0101 ... */ |
1485 | /* 0 */ V(5, 12, 1), /* 382 */ | 1485 | /* 0 */ V(5, 12, 1), /* 382 */ |
1486 | /* 1 */ V(12, 5, 1), | 1486 | /* 1 */ V(12, 5, 1), |
1487 | 1487 | ||
1488 | /* 0000 0010 0110 ... */ | 1488 | /* 0000 0010 0110 ... */ |
1489 | /* 0 */ V(9, 9, 1), /* 384 */ | 1489 | /* 0 */ V(9, 9, 1), /* 384 */ |
1490 | /* 1 */ V(7, 10, 1), | 1490 | /* 1 */ V(7, 10, 1), |
1491 | 1491 | ||
1492 | /* 0000 0010 1000 ... */ | 1492 | /* 0000 0010 1000 ... */ |
1493 | /* 0 */ V(10, 7, 1), /* 386 */ | 1493 | /* 0 */ V(10, 7, 1), /* 386 */ |
1494 | /* 1 */ V(9, 7, 1), | 1494 | /* 1 */ V(9, 7, 1), |
1495 | 1495 | ||
1496 | /* 0000 0000 0000 0000 ... */ | 1496 | /* 0000 0000 0000 0000 ... */ |
1497 | /* 000 */ V(15, 14, 3), /* 388 */ | 1497 | /* 000 */ V(15, 14, 3), /* 388 */ |
1498 | /* 001 */ V(15, 12, 3), | 1498 | /* 001 */ V(15, 12, 3), |
1499 | /* 010 */ V(15, 13, 2), | 1499 | /* 010 */ V(15, 13, 2), |
1500 | /* 011 */ V(15, 13, 2), | 1500 | /* 011 */ V(15, 13, 2), |
@@ -1504,7 +1504,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1504 | /* 111 */ V(14, 13, 1), | 1504 | /* 111 */ V(14, 13, 1), |
1505 | 1505 | ||
1506 | /* 0000 0000 0000 1011 ... */ | 1506 | /* 0000 0000 0000 1011 ... */ |
1507 | /* 0 */ V(10, 15, 1), /* 396 */ | 1507 | /* 0 */ V(10, 15, 1), /* 396 */ |
1508 | /* 1 */ V(14, 9, 1) | 1508 | /* 1 */ V(14, 9, 1) |
1509 | }; | 1509 | }; |
1510 | 1510 | ||
@@ -1528,7 +1528,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1528 | /* 1111 */ V(0, 0, 3), | 1528 | /* 1111 */ V(0, 0, 3), |
1529 | 1529 | ||
1530 | /* 0000 ... */ | 1530 | /* 0000 ... */ |
1531 | /* 0000 */ PTR(120, 4), /* 16 */ | 1531 | /* 0000 */ PTR(120, 4), /* 16 */ |
1532 | /* 0001 */ PTR(136, 4), | 1532 | /* 0001 */ PTR(136, 4), |
1533 | /* 0010 */ PTR(152, 4), | 1533 | /* 0010 */ PTR(152, 4), |
1534 | /* 0011 */ PTR(168, 4), | 1534 | /* 0011 */ PTR(168, 4), |
@@ -1546,7 +1546,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1546 | /* 1111 */ PTR(284, 2), | 1546 | /* 1111 */ PTR(284, 2), |
1547 | 1547 | ||
1548 | /* 0001 ... */ | 1548 | /* 0001 ... */ |
1549 | /* 0000 */ PTR(288, 2), /* 32 */ | 1549 | /* 0000 */ PTR(288, 2), /* 32 */ |
1550 | /* 0001 */ PTR(292, 2), | 1550 | /* 0001 */ PTR(292, 2), |
1551 | /* 0010 */ PTR(296, 2), | 1551 | /* 0010 */ PTR(296, 2), |
1552 | /* 0011 */ PTR(300, 2), | 1552 | /* 0011 */ PTR(300, 2), |
@@ -1564,7 +1564,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1564 | /* 1111 */ PTR(338, 1), | 1564 | /* 1111 */ PTR(338, 1), |
1565 | 1565 | ||
1566 | /* 0010 ... */ | 1566 | /* 0010 ... */ |
1567 | /* 0000 */ PTR(340, 1), /* 48 */ | 1567 | /* 0000 */ PTR(340, 1), /* 48 */ |
1568 | /* 0001 */ PTR(342, 1), | 1568 | /* 0001 */ PTR(342, 1), |
1569 | /* 0010 */ V(9, 1, 4), | 1569 | /* 0010 */ V(9, 1, 4), |
1570 | /* 0011 */ PTR(344, 1), | 1570 | /* 0011 */ PTR(344, 1), |
@@ -1582,7 +1582,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1582 | /* 1111 */ PTR(360, 1), | 1582 | /* 1111 */ PTR(360, 1), |
1583 | 1583 | ||
1584 | /* 0011 ... */ | 1584 | /* 0011 ... */ |
1585 | /* 0000 */ V(2, 7, 4), /* 64 */ | 1585 | /* 0000 */ V(2, 7, 4), /* 64 */ |
1586 | /* 0001 */ V(7, 2, 4), | 1586 | /* 0001 */ V(7, 2, 4), |
1587 | /* 0010 */ V(6, 4, 4), | 1587 | /* 0010 */ V(6, 4, 4), |
1588 | /* 0011 */ V(1, 7, 4), | 1588 | /* 0011 */ V(1, 7, 4), |
@@ -1600,7 +1600,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1600 | /* 1111 */ V(3, 5, 4), | 1600 | /* 1111 */ V(3, 5, 4), |
1601 | 1601 | ||
1602 | /* 0100 ... */ | 1602 | /* 0100 ... */ |
1603 | /* 0000 */ V(6, 1, 3), /* 80 */ | 1603 | /* 0000 */ V(6, 1, 3), /* 80 */ |
1604 | /* 0001 */ V(6, 1, 3), | 1604 | /* 0001 */ V(6, 1, 3), |
1605 | /* 0010 */ V(5, 3, 4), | 1605 | /* 0010 */ V(5, 3, 4), |
1606 | /* 0011 */ V(4, 4, 4), | 1606 | /* 0011 */ V(4, 4, 4), |
@@ -1618,7 +1618,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1618 | /* 1111 */ V(3, 4, 3), | 1618 | /* 1111 */ V(3, 4, 3), |
1619 | 1619 | ||
1620 | /* 0101 ... */ | 1620 | /* 0101 ... */ |
1621 | /* 000 */ V(4, 3, 3), /* 96 */ | 1621 | /* 000 */ V(4, 3, 3), /* 96 */ |
1622 | /* 001 */ V(2, 4, 3), | 1622 | /* 001 */ V(2, 4, 3), |
1623 | /* 010 */ V(4, 2, 3), | 1623 | /* 010 */ V(4, 2, 3), |
1624 | /* 011 */ V(3, 3, 3), | 1624 | /* 011 */ V(3, 3, 3), |
@@ -1628,7 +1628,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1628 | /* 111 */ V(0, 4, 3), | 1628 | /* 111 */ V(0, 4, 3), |
1629 | 1629 | ||
1630 | /* 0110 ... */ | 1630 | /* 0110 ... */ |
1631 | /* 000 */ V(2, 3, 2), /* 104 */ | 1631 | /* 000 */ V(2, 3, 2), /* 104 */ |
1632 | /* 001 */ V(2, 3, 2), | 1632 | /* 001 */ V(2, 3, 2), |
1633 | /* 010 */ V(3, 2, 2), | 1633 | /* 010 */ V(3, 2, 2), |
1634 | /* 011 */ V(3, 2, 2), | 1634 | /* 011 */ V(3, 2, 2), |
@@ -1638,21 +1638,21 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1638 | /* 111 */ V(1, 3, 2), | 1638 | /* 111 */ V(1, 3, 2), |
1639 | 1639 | ||
1640 | /* 0111 ... */ | 1640 | /* 0111 ... */ |
1641 | /* 00 */ V(3, 1, 2), /* 112 */ | 1641 | /* 00 */ V(3, 1, 2), /* 112 */ |
1642 | /* 01 */ V(3, 0, 2), | 1642 | /* 01 */ V(3, 0, 2), |
1643 | /* 10 */ V(2, 2, 1), | 1643 | /* 10 */ V(2, 2, 1), |
1644 | /* 11 */ V(2, 2, 1), | 1644 | /* 11 */ V(2, 2, 1), |
1645 | 1645 | ||
1646 | /* 1000 ... */ | 1646 | /* 1000 ... */ |
1647 | /* 0 */ V(1, 2, 1), /* 116 */ | 1647 | /* 0 */ V(1, 2, 1), /* 116 */ |
1648 | /* 1 */ V(2, 1, 1), | 1648 | /* 1 */ V(2, 1, 1), |
1649 | 1649 | ||
1650 | /* 1001 ... */ | 1650 | /* 1001 ... */ |
1651 | /* 0 */ V(0, 2, 1), /* 118 */ | 1651 | /* 0 */ V(0, 2, 1), /* 118 */ |
1652 | /* 1 */ V(2, 0, 1), | 1652 | /* 1 */ V(2, 0, 1), |
1653 | 1653 | ||
1654 | /* 0000 0000 ... */ | 1654 | /* 0000 0000 ... */ |
1655 | /* 0000 */ PTR(366, 1), /* 120 */ | 1655 | /* 0000 */ PTR(366, 1), /* 120 */ |
1656 | /* 0001 */ PTR(368, 1), | 1656 | /* 0001 */ PTR(368, 1), |
1657 | /* 0010 */ V(14, 14, 4), | 1657 | /* 0010 */ V(14, 14, 4), |
1658 | /* 0011 */ PTR(370, 1), | 1658 | /* 0011 */ PTR(370, 1), |
@@ -1670,7 +1670,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1670 | /* 1111 */ V(9, 15, 4), | 1670 | /* 1111 */ V(9, 15, 4), |
1671 | 1671 | ||
1672 | /* 0000 0001 ... */ | 1672 | /* 0000 0001 ... */ |
1673 | /* 0000 */ V(15, 9, 4), /* 136 */ | 1673 | /* 0000 */ V(15, 9, 4), /* 136 */ |
1674 | /* 0001 */ V(14, 10, 4), | 1674 | /* 0001 */ V(14, 10, 4), |
1675 | /* 0010 */ V(11, 13, 4), | 1675 | /* 0010 */ V(11, 13, 4), |
1676 | /* 0011 */ V(13, 11, 4), | 1676 | /* 0011 */ V(13, 11, 4), |
@@ -1688,7 +1688,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1688 | /* 1111 */ PTR(378, 1), | 1688 | /* 1111 */ PTR(378, 1), |
1689 | 1689 | ||
1690 | /* 0000 0010 ... */ | 1690 | /* 0000 0010 ... */ |
1691 | /* 0000 */ V(12, 11, 3), /* 152 */ | 1691 | /* 0000 */ V(12, 11, 3), /* 152 */ |
1692 | /* 0001 */ V(12, 11, 3), | 1692 | /* 0001 */ V(12, 11, 3), |
1693 | /* 0010 */ V(15, 6, 3), | 1693 | /* 0010 */ V(15, 6, 3), |
1694 | /* 0011 */ V(15, 6, 3), | 1694 | /* 0011 */ V(15, 6, 3), |
@@ -1706,7 +1706,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1706 | /* 1111 */ V(10, 12, 3), | 1706 | /* 1111 */ V(10, 12, 3), |
1707 | 1707 | ||
1708 | /* 0000 0011 ... */ | 1708 | /* 0000 0011 ... */ |
1709 | /* 0000 */ V(12, 10, 3), /* 168 */ | 1709 | /* 0000 */ V(12, 10, 3), /* 168 */ |
1710 | /* 0001 */ V(12, 10, 3), | 1710 | /* 0001 */ V(12, 10, 3), |
1711 | /* 0010 */ V(11, 11, 3), | 1711 | /* 0010 */ V(11, 11, 3), |
1712 | /* 0011 */ V(11, 11, 3), | 1712 | /* 0011 */ V(11, 11, 3), |
@@ -1724,7 +1724,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1724 | /* 1111 */ V(13, 8, 3), | 1724 | /* 1111 */ V(13, 8, 3), |
1725 | 1725 | ||
1726 | /* 0000 0100 ... */ | 1726 | /* 0000 0100 ... */ |
1727 | /* 0000 */ V(14, 6, 3), /* 184 */ | 1727 | /* 0000 */ V(14, 6, 3), /* 184 */ |
1728 | /* 0001 */ V(14, 6, 3), | 1728 | /* 0001 */ V(14, 6, 3), |
1729 | /* 0010 */ V(2, 15, 3), | 1729 | /* 0010 */ V(2, 15, 3), |
1730 | /* 0011 */ V(2, 15, 3), | 1730 | /* 0011 */ V(2, 15, 3), |
@@ -1742,7 +1742,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1742 | /* 1111 */ V(12, 9, 3), | 1742 | /* 1111 */ V(12, 9, 3), |
1743 | 1743 | ||
1744 | /* 0000 0101 ... */ | 1744 | /* 0000 0101 ... */ |
1745 | /* 000 */ V(5, 14, 3), /* 200 */ | 1745 | /* 000 */ V(5, 14, 3), /* 200 */ |
1746 | /* 001 */ V(10, 11, 3), | 1746 | /* 001 */ V(10, 11, 3), |
1747 | /* 010 */ V(11, 10, 3), | 1747 | /* 010 */ V(11, 10, 3), |
1748 | /* 011 */ V(14, 5, 3), | 1748 | /* 011 */ V(14, 5, 3), |
@@ -1752,7 +1752,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1752 | /* 111 */ V(14, 4, 3), | 1752 | /* 111 */ V(14, 4, 3), |
1753 | 1753 | ||
1754 | /* 0000 0110 ... */ | 1754 | /* 0000 0110 ... */ |
1755 | /* 000 */ V(8, 12, 3), /* 208 */ | 1755 | /* 000 */ V(8, 12, 3), /* 208 */ |
1756 | /* 001 */ V(12, 8, 3), | 1756 | /* 001 */ V(12, 8, 3), |
1757 | /* 010 */ V(3, 14, 3), | 1757 | /* 010 */ V(3, 14, 3), |
1758 | /* 011 */ V(6, 13, 3), | 1758 | /* 011 */ V(6, 13, 3), |
@@ -1762,7 +1762,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1762 | /* 111 */ V(11, 9, 3), | 1762 | /* 111 */ V(11, 9, 3), |
1763 | 1763 | ||
1764 | /* 0000 0111 ... */ | 1764 | /* 0000 0111 ... */ |
1765 | /* 0000 */ V(2, 14, 3), /* 216 */ | 1765 | /* 0000 */ V(2, 14, 3), /* 216 */ |
1766 | /* 0001 */ V(2, 14, 3), | 1766 | /* 0001 */ V(2, 14, 3), |
1767 | /* 0010 */ V(10, 10, 3), | 1767 | /* 0010 */ V(10, 10, 3), |
1768 | /* 0011 */ V(10, 10, 3), | 1768 | /* 0011 */ V(10, 10, 3), |
@@ -1780,7 +1780,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1780 | /* 1111 */ V(13, 5, 3), | 1780 | /* 1111 */ V(13, 5, 3), |
1781 | 1781 | ||
1782 | /* 0000 1000 ... */ | 1782 | /* 0000 1000 ... */ |
1783 | /* 000 */ V(7, 12, 3), /* 232 */ | 1783 | /* 000 */ V(7, 12, 3), /* 232 */ |
1784 | /* 001 */ V(12, 7, 3), | 1784 | /* 001 */ V(12, 7, 3), |
1785 | /* 010 */ V(4, 13, 3), | 1785 | /* 010 */ V(4, 13, 3), |
1786 | /* 011 */ V(8, 11, 3), | 1786 | /* 011 */ V(8, 11, 3), |
@@ -1790,7 +1790,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1790 | /* 111 */ V(9, 10, 3), | 1790 | /* 111 */ V(9, 10, 3), |
1791 | 1791 | ||
1792 | /* 0000 1001 ... */ | 1792 | /* 0000 1001 ... */ |
1793 | /* 000 */ V(10, 9, 3), /* 240 */ | 1793 | /* 000 */ V(10, 9, 3), /* 240 */ |
1794 | /* 001 */ V(6, 12, 3), | 1794 | /* 001 */ V(6, 12, 3), |
1795 | /* 010 */ V(12, 6, 3), | 1795 | /* 010 */ V(12, 6, 3), |
1796 | /* 011 */ V(3, 13, 3), | 1796 | /* 011 */ V(3, 13, 3), |
@@ -1800,7 +1800,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1800 | /* 111 */ V(13, 2, 2), | 1800 | /* 111 */ V(13, 2, 2), |
1801 | 1801 | ||
1802 | /* 0000 1010 ... */ | 1802 | /* 0000 1010 ... */ |
1803 | /* 000 */ V(2, 13, 3), /* 248 */ | 1803 | /* 000 */ V(2, 13, 3), /* 248 */ |
1804 | /* 001 */ V(0, 13, 3), | 1804 | /* 001 */ V(0, 13, 3), |
1805 | /* 010 */ V(1, 13, 2), | 1805 | /* 010 */ V(1, 13, 2), |
1806 | /* 011 */ V(1, 13, 2), | 1806 | /* 011 */ V(1, 13, 2), |
@@ -1810,7 +1810,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1810 | /* 111 */ V(11, 7, 2), | 1810 | /* 111 */ V(11, 7, 2), |
1811 | 1811 | ||
1812 | /* 0000 1011 ... */ | 1812 | /* 0000 1011 ... */ |
1813 | /* 000 */ V(13, 1, 2), /* 256 */ | 1813 | /* 000 */ V(13, 1, 2), /* 256 */ |
1814 | /* 001 */ V(13, 1, 2), | 1814 | /* 001 */ V(13, 1, 2), |
1815 | /* 010 */ V(5, 12, 3), | 1815 | /* 010 */ V(5, 12, 3), |
1816 | /* 011 */ V(13, 0, 3), | 1816 | /* 011 */ V(13, 0, 3), |
@@ -1820,13 +1820,13 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1820 | /* 111 */ V(8, 10, 2), | 1820 | /* 111 */ V(8, 10, 2), |
1821 | 1821 | ||
1822 | /* 0000 1100 ... */ | 1822 | /* 0000 1100 ... */ |
1823 | /* 00 */ V(10, 8, 2), /* 264 */ | 1823 | /* 00 */ V(10, 8, 2), /* 264 */ |
1824 | /* 01 */ V(4, 12, 2), | 1824 | /* 01 */ V(4, 12, 2), |
1825 | /* 10 */ V(12, 4, 2), | 1825 | /* 10 */ V(12, 4, 2), |
1826 | /* 11 */ V(6, 11, 2), | 1826 | /* 11 */ V(6, 11, 2), |
1827 | 1827 | ||
1828 | /* 0000 1101 ... */ | 1828 | /* 0000 1101 ... */ |
1829 | /* 000 */ V(11, 6, 2), /* 268 */ | 1829 | /* 000 */ V(11, 6, 2), /* 268 */ |
1830 | /* 001 */ V(11, 6, 2), | 1830 | /* 001 */ V(11, 6, 2), |
1831 | /* 010 */ V(9, 9, 3), | 1831 | /* 010 */ V(9, 9, 3), |
1832 | /* 011 */ V(0, 12, 3), | 1832 | /* 011 */ V(0, 12, 3), |
@@ -1836,7 +1836,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1836 | /* 111 */ V(12, 3, 2), | 1836 | /* 111 */ V(12, 3, 2), |
1837 | 1837 | ||
1838 | /* 0000 1110 ... */ | 1838 | /* 0000 1110 ... */ |
1839 | /* 000 */ V(7, 10, 2), /* 276 */ | 1839 | /* 000 */ V(7, 10, 2), /* 276 */ |
1840 | /* 001 */ V(7, 10, 2), | 1840 | /* 001 */ V(7, 10, 2), |
1841 | /* 010 */ V(10, 7, 2), | 1841 | /* 010 */ V(10, 7, 2), |
1842 | /* 011 */ V(10, 7, 2), | 1842 | /* 011 */ V(10, 7, 2), |
@@ -1846,173 +1846,173 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { | |||
1846 | /* 111 */ V(0, 11, 3), | 1846 | /* 111 */ V(0, 11, 3), |
1847 | 1847 | ||
1848 | /* 0000 1111 ... */ | 1848 | /* 0000 1111 ... */ |
1849 | /* 00 */ V(12, 2, 1), /* 284 */ | 1849 | /* 00 */ V(12, 2, 1), /* 284 */ |
1850 | /* 01 */ V(12, 2, 1), | 1850 | /* 01 */ V(12, 2, 1), |
1851 | /* 10 */ V(2, 12, 2), | 1851 | /* 10 */ V(2, 12, 2), |
1852 | /* 11 */ V(5, 11, 2), | 1852 | /* 11 */ V(5, 11, 2), |
1853 | 1853 | ||
1854 | /* 0001 0000 ... */ | 1854 | /* 0001 0000 ... */ |
1855 | /* 00 */ V(11, 5, 2), /* 288 */ | 1855 | /* 00 */ V(11, 5, 2), /* 288 */ |
1856 | /* 01 */ V(1, 12, 2), | 1856 | /* 01 */ V(1, 12, 2), |
1857 | /* 10 */ V(8, 9, 2), | 1857 | /* 10 */ V(8, 9, 2), |
1858 | /* 11 */ V(9, 8, 2), | 1858 | /* 11 */ V(9, 8, 2), |
1859 | 1859 | ||
1860 | /* 0001 0001 ... */ | 1860 | /* 0001 0001 ... */ |
1861 | /* 00 */ V(12, 1, 2), /* 292 */ | 1861 | /* 00 */ V(12, 1, 2), /* 292 */ |
1862 | /* 01 */ V(4, 11, 2), | 1862 | /* 01 */ V(4, 11, 2), |
1863 | /* 10 */ V(11, 4, 2), | 1863 | /* 10 */ V(11, 4, 2), |
1864 | /* 11 */ V(6, 10, 2), | 1864 | /* 11 */ V(6, 10, 2), |
1865 | 1865 | ||
1866 | /* 0001 0010 ... */ | 1866 | /* 0001 0010 ... */ |
1867 | /* 00 */ V(3, 11, 2), /* 296 */ | 1867 | /* 00 */ V(3, 11, 2), /* 296 */ |
1868 | /* 01 */ V(7, 9, 2), | 1868 | /* 01 */ V(7, 9, 2), |
1869 | /* 10 */ V(11, 3, 1), | 1869 | /* 10 */ V(11, 3, 1), |
1870 | /* 11 */ V(11, 3, 1), | 1870 | /* 11 */ V(11, 3, 1), |
1871 | 1871 | ||
1872 | /* 0001 0011 ... */ | 1872 | /* 0001 0011 ... */ |
1873 | /* 00 */ V(9, 7, 2), /* 300 */ | 1873 | /* 00 */ V(9, 7, 2), /* 300 */ |
1874 | /* 01 */ V(8, 8, 2), | 1874 | /* 01 */ V(8, 8, 2), |
1875 | /* 10 */ V(2, 11, 2), | 1875 | /* 10 */ V(2, 11, 2), |
1876 | /* 11 */ V(5, 10, 2), | 1876 | /* 11 */ V(5, 10, 2), |
1877 | 1877 | ||
1878 | /* 0001 0100 ... */ | 1878 | /* 0001 0100 ... */ |
1879 | /* 00 */ V(11, 2, 1), /* 304 */ | 1879 | /* 00 */ V(11, 2, 1), /* 304 */ |
1880 | /* 01 */ V(11, 2, 1), | 1880 | /* 01 */ V(11, 2, 1), |
1881 | /* 10 */ V(10, 5, 2), | 1881 | /* 10 */ V(10, 5, 2), |
1882 | /* 11 */ V(1, 11, 2), | 1882 | /* 11 */ V(1, 11, 2), |
1883 | 1883 | ||
1884 | /* 0001 0101 ... */ | 1884 | /* 0001 0101 ... */ |
1885 | /* 00 */ V(11, 1, 1), /* 308 */ | 1885 | /* 00 */ V(11, 1, 1), /* 308 */ |
1886 | /* 01 */ V(11, 1, 1), | 1886 | /* 01 */ V(11, 1, 1), |
1887 | /* 10 */ V(11, 0, 2), | 1887 | /* 10 */ V(11, 0, 2), |
1888 | /* 11 */ V(6, 9, 2), | 1888 | /* 11 */ V(6, 9, 2), |
1889 | 1889 | ||
1890 | /* 0001 0110 ... */ | 1890 | /* 0001 0110 ... */ |
1891 | /* 00 */ V(9, 6, 2), /* 312 */ | 1891 | /* 00 */ V(9, 6, 2), /* 312 */ |
1892 | /* 01 */ V(4, 10, 2), | 1892 | /* 01 */ V(4, 10, 2), |
1893 | /* 10 */ V(10, 4, 2), | 1893 | /* 10 */ V(10, 4, 2), |
1894 | /* 11 */ V(7, 8, 2), | 1894 | /* 11 */ V(7, 8, 2), |
1895 | 1895 | ||
1896 | /* 0001 0111 ... */ | 1896 | /* 0001 0111 ... */ |
1897 | /* 00 */ V(8, 7, 2), /* 316 */ | 1897 | /* 00 */ V(8, 7, 2), /* 316 */ |
1898 | /* 01 */ V(3, 10, 2), | 1898 | /* 01 */ V(3, 10, 2), |
1899 | /* 10 */ V(10, 3, 1), | 1899 | /* 10 */ V(10, 3, 1), |
1900 | /* 11 */ V(10, 3, 1), | 1900 | /* 11 */ V(10, 3, 1), |
1901 | 1901 | ||
1902 | /* 0001 1000 ... */ | 1902 | /* 0001 1000 ... */ |
1903 | /* 0 */ V(5, 9, 1), /* 320 */ | 1903 | /* 0 */ V(5, 9, 1), /* 320 */ |
1904 | /* 1 */ V(9, 5, 1), | 1904 | /* 1 */ V(9, 5, 1), |
1905 | 1905 | ||
1906 | /* 0001 1001 ... */ | 1906 | /* 0001 1001 ... */ |
1907 | /* 0 */ V(2, 10, 1), /* 322 */ | 1907 | /* 0 */ V(2, 10, 1), /* 322 */ |
1908 | /* 1 */ V(10, 2, 1), | 1908 | /* 1 */ V(10, 2, 1), |
1909 | 1909 | ||
1910 | /* 0001 1010 ... */ | 1910 | /* 0001 1010 ... */ |
1911 | /* 0 */ V(1, 10, 1), /* 324 */ | 1911 | /* 0 */ V(1, 10, 1), /* 324 */ |
1912 | /* 1 */ V(10, 1, 1), | 1912 | /* 1 */ V(10, 1, 1), |
1913 | 1913 | ||
1914 | /* 0001 1011 ... */ | 1914 | /* 0001 1011 ... */ |
1915 | /* 00 */ V(0, 10, 2), /* 326 */ | 1915 | /* 00 */ V(0, 10, 2), /* 326 */ |
1916 | /* 01 */ V(10, 0, 2), | 1916 | /* 01 */ V(10, 0, 2), |
1917 | /* 10 */ V(6, 8, 1), | 1917 | /* 10 */ V(6, 8, 1), |
1918 | /* 11 */ V(6, 8, 1), | 1918 | /* 11 */ V(6, 8, 1), |
1919 | 1919 | ||
1920 | /* 0001 1100 ... */ | 1920 | /* 0001 1100 ... */ |
1921 | /* 0 */ V(8, 6, 1), /* 330 */ | 1921 | /* 0 */ V(8, 6, 1), /* 330 */ |
1922 | /* 1 */ V(4, 9, 1), | 1922 | /* 1 */ V(4, 9, 1), |
1923 | 1923 | ||
1924 | /* 0001 1101 ... */ | 1924 | /* 0001 1101 ... */ |
1925 | /* 0 */ V(9, 4, 1), /* 332 */ | 1925 | /* 0 */ V(9, 4, 1), /* 332 */ |
1926 | /* 1 */ V(3, 9, 1), | 1926 | /* 1 */ V(3, 9, 1), |
1927 | 1927 | ||
1928 | /* 0001 1110 ... */ | 1928 | /* 0001 1110 ... */ |
1929 | /* 00 */ V(9, 3, 1), /* 334 */ | 1929 | /* 00 */ V(9, 3, 1), /* 334 */ |
1930 | /* 01 */ V(9, 3, 1), | 1930 | /* 01 */ V(9, 3, 1), |
1931 | /* 10 */ V(7, 7, 2), | 1931 | /* 10 */ V(7, 7, 2), |
1932 | /* 11 */ V(0, 9, 2), | 1932 | /* 11 */ V(0, 9, 2), |
1933 | 1933 | ||
1934 | /* 0001 1111 ... */ | 1934 | /* 0001 1111 ... */ |
1935 | /* 0 */ V(5, 8, 1), /* 338 */ | 1935 | /* 0 */ V(5, 8, 1), /* 338 */ |
1936 | /* 1 */ V(8, 5, 1), | 1936 | /* 1 */ V(8, 5, 1), |
1937 | 1937 | ||
1938 | /* 0010 0000 ... */ | 1938 | /* 0010 0000 ... */ |
1939 | /* 0 */ V(2, 9, 1), /* 340 */ | 1939 | /* 0 */ V(2, 9, 1), /* 340 */ |
1940 | /* 1 */ V(6, 7, 1), | 1940 | /* 1 */ V(6, 7, 1), |
1941 | 1941 | ||
1942 | /* 0010 0001 ... */ | 1942 | /* 0010 0001 ... */ |
1943 | /* 0 */ V(7, 6, 1), /* 342 */ | 1943 | /* 0 */ V(7, 6, 1), /* 342 */ |
1944 | /* 1 */ V(9, 2, 1), | 1944 | /* 1 */ V(9, 2, 1), |
1945 | 1945 | ||
1946 | /* 0010 0011 ... */ | 1946 | /* 0010 0011 ... */ |
1947 | /* 0 */ V(1, 9, 1), /* 344 */ | 1947 | /* 0 */ V(1, 9, 1), /* 344 */ |
1948 | /* 1 */ V(9, 0, 1), | 1948 | /* 1 */ V(9, 0, 1), |
1949 | 1949 | ||
1950 | /* 0010 0100 ... */ | 1950 | /* 0010 0100 ... */ |
1951 | /* 0 */ V(4, 8, 1), /* 346 */ | 1951 | /* 0 */ V(4, 8, 1), /* 346 */ |
1952 | /* 1 */ V(8, 4, 1), | 1952 | /* 1 */ V(8, 4, 1), |
1953 | 1953 | ||
1954 | /* 0010 0101 ... */ | 1954 | /* 0010 0101 ... */ |
1955 | /* 0 */ V(5, 7, 1), /* 348 */ | 1955 | /* 0 */ V(5, 7, 1), /* 348 */ |
1956 | /* 1 */ V(7, 5, 1), | 1956 | /* 1 */ V(7, 5, 1), |
1957 | 1957 | ||
1958 | /* 0010 0110 ... */ | 1958 | /* 0010 0110 ... */ |
1959 | /* 0 */ V(3, 8, 1), /* 350 */ | 1959 | /* 0 */ V(3, 8, 1), /* 350 */ |
1960 | /* 1 */ V(8, 3, 1), | 1960 | /* 1 */ V(8, 3, 1), |
1961 | 1961 | ||
1962 | /* 0010 0111 ... */ | 1962 | /* 0010 0111 ... */ |
1963 | /* 0 */ V(6, 6, 1), /* 352 */ | 1963 | /* 0 */ V(6, 6, 1), /* 352 */ |
1964 | /* 1 */ V(4, 7, 1), | 1964 | /* 1 */ V(4, 7, 1), |
1965 | 1965 | ||
1966 | /* 0010 1100 ... */ | 1966 | /* 0010 1100 ... */ |
1967 | /* 0 */ V(7, 4, 1), /* 354 */ | 1967 | /* 0 */ V(7, 4, 1), /* 354 */ |
1968 | /* 1 */ V(0, 8, 1), | 1968 | /* 1 */ V(0, 8, 1), |
1969 | 1969 | ||
1970 | /* 0010 1101 ... */ | 1970 | /* 0010 1101 ... */ |
1971 | /* 0 */ V(8, 0, 1), /* 356 */ | 1971 | /* 0 */ V(8, 0, 1), /* 356 */ |
1972 | /* 1 */ V(5, 6, 1), | 1972 | /* 1 */ V(5, 6, 1), |
1973 | 1973 | ||
1974 | /* 0010 1110 ... */ | 1974 | /* 0010 1110 ... */ |
1975 | /* 0 */ V(6, 5, 1), /* 358 */ | 1975 | /* 0 */ V(6, 5, 1), /* 358 */ |
1976 | /* 1 */ V(3, 7, 1), | 1976 | /* 1 */ V(3, 7, 1), |
1977 | 1977 | ||
1978 | /* 0010 1111 ... */ | 1978 | /* 0010 1111 ... */ |
1979 | /* 0 */ V(7, 3, 1), /* 360 */ | 1979 | /* 0 */ V(7, 3, 1), /* 360 */ |
1980 | /* 1 */ V(4, 6, 1), | 1980 | /* 1 */ V(4, 6, 1), |
1981 | 1981 | ||
1982 | /* 0011 0110 ... */ | 1982 | /* 0011 0110 ... */ |
1983 | /* 0 */ V(0, 7, 1), /* 362 */ | 1983 | /* 0 */ V(0, 7, 1), /* 362 */ |
1984 | /* 1 */ V(7, 0, 1), | 1984 | /* 1 */ V(7, 0, 1), |
1985 | 1985 | ||
1986 | /* 0011 1110 ... */ | 1986 | /* 0011 1110 ... */ |
1987 | /* 0 */ V(0, 6, 1), /* 364 */ | 1987 | /* 0 */ V(0, 6, 1), /* 364 */ |
1988 | /* 1 */ V(6, 0, 1), | 1988 | /* 1 */ V(6, 0, 1), |
1989 | 1989 | ||
1990 | /* 0000 0000 0000 ... */ | 1990 | /* 0000 0000 0000 ... */ |
1991 | /* 0 */ V(15, 15, 1), /* 366 */ | 1991 | /* 0 */ V(15, 15, 1), /* 366 */ |
1992 | /* 1 */ V(14, 15, 1), | 1992 | /* 1 */ V(14, 15, 1), |
1993 | 1993 | ||
1994 | /* 0000 0000 0001 ... */ | 1994 | /* 0000 0000 0001 ... */ |
1995 | /* 0 */ V(15, 14, 1), /* 368 */ | 1995 | /* 0 */ V(15, 14, 1), /* 368 */ |
1996 | /* 1 */ V(13, 15, 1), | 1996 | /* 1 */ V(13, 15, 1), |
1997 | 1997 | ||
1998 | /* 0000 0000 0011 ... */ | 1998 | /* 0000 0000 0011 ... */ |
1999 | /* 0 */ V(15, 13, 1), /* 370 */ | 1999 | /* 0 */ V(15, 13, 1), /* 370 */ |
2000 | /* 1 */ V(12, 15, 1), | 2000 | /* 1 */ V(12, 15, 1), |
2001 | 2001 | ||
2002 | /* 0000 0000 0100 ... */ | 2002 | /* 0000 0000 0100 ... */ |
2003 | /* 0 */ V(15, 12, 1), /* 372 */ | 2003 | /* 0 */ V(15, 12, 1), /* 372 */ |
2004 | /* 1 */ V(13, 14, 1), | 2004 | /* 1 */ V(13, 14, 1), |
2005 | 2005 | ||
2006 | /* 0000 0000 0101 ... */ | 2006 | /* 0000 0000 0101 ... */ |
2007 | /* 0 */ V(14, 13, 1), /* 374 */ | 2007 | /* 0 */ V(14, 13, 1), /* 374 */ |
2008 | /* 1 */ V(11, 15, 1), | 2008 | /* 1 */ V(11, 15, 1), |
2009 | 2009 | ||
2010 | /* 0000 0000 0111 ... */ | 2010 | /* 0000 0000 0111 ... */ |
2011 | /* 0 */ V(12, 14, 1), /* 376 */ | 2011 | /* 0 */ V(12, 14, 1), /* 376 */ |
2012 | /* 1 */ V(14, 12, 1), | 2012 | /* 1 */ V(14, 12, 1), |
2013 | 2013 | ||
2014 | /* 0000 0001 1111 ... */ | 2014 | /* 0000 0001 1111 ... */ |
2015 | /* 0 */ V(10, 14, 1), /* 378 */ | 2015 | /* 0 */ V(10, 14, 1), /* 378 */ |
2016 | /* 1 */ V(0, 15, 1) | 2016 | /* 1 */ V(0, 15, 1) |
2017 | }; | 2017 | }; |
2018 | 2018 | ||
@@ -2036,7 +2036,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2036 | /* 1111 */ V(0, 0, 1), | 2036 | /* 1111 */ V(0, 0, 1), |
2037 | 2037 | ||
2038 | /* 0000 ... */ | 2038 | /* 0000 ... */ |
2039 | /* 0000 */ PTR(68, 3), /* 16 */ | 2039 | /* 0000 */ PTR(68, 3), /* 16 */ |
2040 | /* 0001 */ PTR(76, 3), | 2040 | /* 0001 */ PTR(76, 3), |
2041 | /* 0010 */ PTR(84, 2), | 2041 | /* 0010 */ PTR(84, 2), |
2042 | /* 0011 */ V(15, 15, 4), | 2042 | /* 0011 */ V(15, 15, 4), |
@@ -2054,7 +2054,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2054 | /* 1111 */ PTR(176, 4), | 2054 | /* 1111 */ PTR(176, 4), |
2055 | 2055 | ||
2056 | /* 0001 ... */ | 2056 | /* 0001 ... */ |
2057 | /* 0000 */ PTR(192, 4), /* 32 */ | 2057 | /* 0000 */ PTR(192, 4), /* 32 */ |
2058 | /* 0001 */ PTR(208, 3), | 2058 | /* 0001 */ PTR(208, 3), |
2059 | /* 0010 */ PTR(216, 3), | 2059 | /* 0010 */ PTR(216, 3), |
2060 | /* 0011 */ PTR(224, 3), | 2060 | /* 0011 */ PTR(224, 3), |
@@ -2072,7 +2072,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2072 | /* 1111 */ PTR(284, 1), | 2072 | /* 1111 */ PTR(284, 1), |
2073 | 2073 | ||
2074 | /* 0010 ... */ | 2074 | /* 0010 ... */ |
2075 | /* 0000 */ PTR(286, 1), /* 48 */ | 2075 | /* 0000 */ PTR(286, 1), /* 48 */ |
2076 | /* 0001 */ PTR(288, 1), | 2076 | /* 0001 */ PTR(288, 1), |
2077 | /* 0010 */ PTR(290, 1), | 2077 | /* 0010 */ PTR(290, 1), |
2078 | /* 0011 */ V(1, 4, 4), | 2078 | /* 0011 */ V(1, 4, 4), |
@@ -2090,13 +2090,13 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2090 | /* 1111 */ V(2, 2, 3), | 2090 | /* 1111 */ V(2, 2, 3), |
2091 | 2091 | ||
2092 | /* 0011 ... */ | 2092 | /* 0011 ... */ |
2093 | /* 00 */ V(1, 2, 2), /* 64 */ | 2093 | /* 00 */ V(1, 2, 2), /* 64 */ |
2094 | /* 01 */ V(2, 1, 2), | 2094 | /* 01 */ V(2, 1, 2), |
2095 | /* 10 */ V(0, 2, 2), | 2095 | /* 10 */ V(0, 2, 2), |
2096 | /* 11 */ V(2, 0, 2), | 2096 | /* 11 */ V(2, 0, 2), |
2097 | 2097 | ||
2098 | /* 0000 0000 ... */ | 2098 | /* 0000 0000 ... */ |
2099 | /* 000 */ V(14, 15, 3), /* 68 */ | 2099 | /* 000 */ V(14, 15, 3), /* 68 */ |
2100 | /* 001 */ V(15, 14, 3), | 2100 | /* 001 */ V(15, 14, 3), |
2101 | /* 010 */ V(13, 15, 3), | 2101 | /* 010 */ V(13, 15, 3), |
2102 | /* 011 */ V(15, 13, 3), | 2102 | /* 011 */ V(15, 13, 3), |
@@ -2106,7 +2106,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2106 | /* 111 */ V(15, 11, 3), | 2106 | /* 111 */ V(15, 11, 3), |
2107 | 2107 | ||
2108 | /* 0000 0001 ... */ | 2108 | /* 0000 0001 ... */ |
2109 | /* 000 */ V(10, 15, 2), /* 76 */ | 2109 | /* 000 */ V(10, 15, 2), /* 76 */ |
2110 | /* 001 */ V(10, 15, 2), | 2110 | /* 001 */ V(10, 15, 2), |
2111 | /* 010 */ V(15, 10, 3), | 2111 | /* 010 */ V(15, 10, 3), |
2112 | /* 011 */ V(9, 15, 3), | 2112 | /* 011 */ V(9, 15, 3), |
@@ -2116,23 +2116,23 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2116 | /* 111 */ V(8, 15, 2), | 2116 | /* 111 */ V(8, 15, 2), |
2117 | 2117 | ||
2118 | /* 0000 0010 ... */ | 2118 | /* 0000 0010 ... */ |
2119 | /* 00 */ V(7, 15, 2), /* 84 */ | 2119 | /* 00 */ V(7, 15, 2), /* 84 */ |
2120 | /* 01 */ V(15, 7, 2), | 2120 | /* 01 */ V(15, 7, 2), |
2121 | /* 10 */ V(6, 15, 2), | 2121 | /* 10 */ V(6, 15, 2), |
2122 | /* 11 */ V(15, 6, 2), | 2122 | /* 11 */ V(15, 6, 2), |
2123 | 2123 | ||
2124 | /* 0000 0100 ... */ | 2124 | /* 0000 0100 ... */ |
2125 | /* 00 */ V(5, 15, 2), /* 88 */ | 2125 | /* 00 */ V(5, 15, 2), /* 88 */ |
2126 | /* 01 */ V(15, 5, 2), | 2126 | /* 01 */ V(15, 5, 2), |
2127 | /* 10 */ V(4, 15, 1), | 2127 | /* 10 */ V(4, 15, 1), |
2128 | /* 11 */ V(4, 15, 1), | 2128 | /* 11 */ V(4, 15, 1), |
2129 | 2129 | ||
2130 | /* 0000 0101 ... */ | 2130 | /* 0000 0101 ... */ |
2131 | /* 0 */ V(15, 4, 1), /* 92 */ | 2131 | /* 0 */ V(15, 4, 1), /* 92 */ |
2132 | /* 1 */ V(15, 3, 1), | 2132 | /* 1 */ V(15, 3, 1), |
2133 | 2133 | ||
2134 | /* 0000 0110 ... */ | 2134 | /* 0000 0110 ... */ |
2135 | /* 0000 */ V(15, 0, 1), /* 94 */ | 2135 | /* 0000 */ V(15, 0, 1), /* 94 */ |
2136 | /* 0001 */ V(15, 0, 1), | 2136 | /* 0001 */ V(15, 0, 1), |
2137 | /* 0010 */ V(15, 0, 1), | 2137 | /* 0010 */ V(15, 0, 1), |
2138 | /* 0011 */ V(15, 0, 1), | 2138 | /* 0011 */ V(15, 0, 1), |
@@ -2150,11 +2150,11 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2150 | /* 1111 */ PTR(326, 3), | 2150 | /* 1111 */ PTR(326, 3), |
2151 | 2151 | ||
2152 | /* 0000 1000 ... */ | 2152 | /* 0000 1000 ... */ |
2153 | /* 0 */ V(2, 15, 1), /* 110 */ | 2153 | /* 0 */ V(2, 15, 1), /* 110 */ |
2154 | /* 1 */ V(0, 15, 1), | 2154 | /* 1 */ V(0, 15, 1), |
2155 | 2155 | ||
2156 | /* 0000 1011 ... */ | 2156 | /* 0000 1011 ... */ |
2157 | /* 0000 */ PTR(334, 2), /* 112 */ | 2157 | /* 0000 */ PTR(334, 2), /* 112 */ |
2158 | /* 0001 */ PTR(338, 2), | 2158 | /* 0001 */ PTR(338, 2), |
2159 | /* 0010 */ PTR(342, 2), | 2159 | /* 0010 */ PTR(342, 2), |
2160 | /* 0011 */ PTR(346, 1), | 2160 | /* 0011 */ PTR(346, 1), |
@@ -2172,7 +2172,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2172 | /* 1111 */ PTR(380, 1), | 2172 | /* 1111 */ PTR(380, 1), |
2173 | 2173 | ||
2174 | /* 0000 1100 ... */ | 2174 | /* 0000 1100 ... */ |
2175 | /* 0000 */ PTR(382, 1), /* 128 */ | 2175 | /* 0000 */ PTR(382, 1), /* 128 */ |
2176 | /* 0001 */ PTR(384, 1), | 2176 | /* 0001 */ PTR(384, 1), |
2177 | /* 0010 */ PTR(386, 1), | 2177 | /* 0010 */ PTR(386, 1), |
2178 | /* 0011 */ V(0, 13, 4), | 2178 | /* 0011 */ V(0, 13, 4), |
@@ -2190,7 +2190,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2190 | /* 1111 */ V(1, 14, 4), | 2190 | /* 1111 */ V(1, 14, 4), |
2191 | 2191 | ||
2192 | /* 0000 1101 ... */ | 2192 | /* 0000 1101 ... */ |
2193 | /* 0000 */ V(13, 3, 4), /* 144 */ | 2193 | /* 0000 */ V(13, 3, 4), /* 144 */ |
2194 | /* 0001 */ V(2, 13, 4), | 2194 | /* 0001 */ V(2, 13, 4), |
2195 | /* 0010 */ V(13, 2, 4), | 2195 | /* 0010 */ V(13, 2, 4), |
2196 | /* 0011 */ V(13, 1, 4), | 2196 | /* 0011 */ V(13, 1, 4), |
@@ -2208,7 +2208,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2208 | /* 1111 */ V(11, 5, 4), | 2208 | /* 1111 */ V(11, 5, 4), |
2209 | 2209 | ||
2210 | /* 0000 1110 ... */ | 2210 | /* 0000 1110 ... */ |
2211 | /* 0000 */ V(12, 1, 4), /* 160 */ | 2211 | /* 0000 */ V(12, 1, 4), /* 160 */ |
2212 | /* 0001 */ V(0, 12, 4), | 2212 | /* 0001 */ V(0, 12, 4), |
2213 | /* 0010 */ V(4, 11, 4), | 2213 | /* 0010 */ V(4, 11, 4), |
2214 | /* 0011 */ V(11, 4, 4), | 2214 | /* 0011 */ V(11, 4, 4), |
@@ -2226,7 +2226,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2226 | /* 1111 */ V(1, 11, 3), | 2226 | /* 1111 */ V(1, 11, 3), |
2227 | 2227 | ||
2228 | /* 0000 1111 ... */ | 2228 | /* 0000 1111 ... */ |
2229 | /* 0000 */ V(11, 1, 3), /* 176 */ | 2229 | /* 0000 */ V(11, 1, 3), /* 176 */ |
2230 | /* 0001 */ V(11, 1, 3), | 2230 | /* 0001 */ V(11, 1, 3), |
2231 | /* 0010 */ V(0, 11, 4), | 2231 | /* 0010 */ V(0, 11, 4), |
2232 | /* 0011 */ V(11, 0, 4), | 2232 | /* 0011 */ V(11, 0, 4), |
@@ -2244,7 +2244,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2244 | /* 1111 */ V(2, 10, 3), | 2244 | /* 1111 */ V(2, 10, 3), |
2245 | 2245 | ||
2246 | /* 0001 0000 ... */ | 2246 | /* 0001 0000 ... */ |
2247 | /* 0000 */ V(9, 5, 4), /* 192 */ | 2247 | /* 0000 */ V(9, 5, 4), /* 192 */ |
2248 | /* 0001 */ V(6, 8, 4), | 2248 | /* 0001 */ V(6, 8, 4), |
2249 | /* 0010 */ V(10, 1, 3), | 2249 | /* 0010 */ V(10, 1, 3), |
2250 | /* 0011 */ V(10, 1, 3), | 2250 | /* 0011 */ V(10, 1, 3), |
@@ -2262,7 +2262,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2262 | /* 1111 */ V(10, 2, 2), | 2262 | /* 1111 */ V(10, 2, 2), |
2263 | 2263 | ||
2264 | /* 0001 0001 ... */ | 2264 | /* 0001 0001 ... */ |
2265 | /* 000 */ V(1, 10, 2), /* 208 */ | 2265 | /* 000 */ V(1, 10, 2), /* 208 */ |
2266 | /* 001 */ V(1, 10, 2), | 2266 | /* 001 */ V(1, 10, 2), |
2267 | /* 010 */ V(0, 10, 3), | 2267 | /* 010 */ V(0, 10, 3), |
2268 | /* 011 */ V(10, 0, 3), | 2268 | /* 011 */ V(10, 0, 3), |
@@ -2272,7 +2272,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2272 | /* 111 */ V(8, 5, 3), | 2272 | /* 111 */ V(8, 5, 3), |
2273 | 2273 | ||
2274 | /* 0001 0010 ... */ | 2274 | /* 0001 0010 ... */ |
2275 | /* 000 */ V(2, 9, 2), /* 216 */ | 2275 | /* 000 */ V(2, 9, 2), /* 216 */ |
2276 | /* 001 */ V(2, 9, 2), | 2276 | /* 001 */ V(2, 9, 2), |
2277 | /* 010 */ V(9, 2, 2), | 2277 | /* 010 */ V(9, 2, 2), |
2278 | /* 011 */ V(9, 2, 2), | 2278 | /* 011 */ V(9, 2, 2), |
@@ -2282,7 +2282,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2282 | /* 111 */ V(1, 9, 2), | 2282 | /* 111 */ V(1, 9, 2), |
2283 | 2283 | ||
2284 | /* 0001 0011 ... */ | 2284 | /* 0001 0011 ... */ |
2285 | /* 000 */ V(9, 1, 2), /* 224 */ | 2285 | /* 000 */ V(9, 1, 2), /* 224 */ |
2286 | /* 001 */ V(9, 1, 2), | 2286 | /* 001 */ V(9, 1, 2), |
2287 | /* 010 */ V(9, 0, 3), | 2287 | /* 010 */ V(9, 0, 3), |
2288 | /* 011 */ V(4, 8, 3), | 2288 | /* 011 */ V(4, 8, 3), |
@@ -2292,7 +2292,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2292 | /* 111 */ V(8, 3, 3), | 2292 | /* 111 */ V(8, 3, 3), |
2293 | 2293 | ||
2294 | /* 0001 0100 ... */ | 2294 | /* 0001 0100 ... */ |
2295 | /* 000 */ V(6, 6, 3), /* 232 */ | 2295 | /* 000 */ V(6, 6, 3), /* 232 */ |
2296 | /* 001 */ V(2, 8, 3), | 2296 | /* 001 */ V(2, 8, 3), |
2297 | /* 010 */ V(8, 2, 2), | 2297 | /* 010 */ V(8, 2, 2), |
2298 | /* 011 */ V(8, 2, 2), | 2298 | /* 011 */ V(8, 2, 2), |
@@ -2302,7 +2302,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2302 | /* 111 */ V(1, 8, 2), | 2302 | /* 111 */ V(1, 8, 2), |
2303 | 2303 | ||
2304 | /* 0001 0101 ... */ | 2304 | /* 0001 0101 ... */ |
2305 | /* 000 */ V(8, 1, 2), /* 240 */ | 2305 | /* 000 */ V(8, 1, 2), /* 240 */ |
2306 | /* 001 */ V(8, 1, 2), | 2306 | /* 001 */ V(8, 1, 2), |
2307 | /* 010 */ V(8, 0, 2), | 2307 | /* 010 */ V(8, 0, 2), |
2308 | /* 011 */ V(8, 0, 2), | 2308 | /* 011 */ V(8, 0, 2), |
@@ -2312,7 +2312,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2312 | /* 111 */ V(3, 7, 2), | 2312 | /* 111 */ V(3, 7, 2), |
2313 | 2313 | ||
2314 | /* 0001 0110 ... */ | 2314 | /* 0001 0110 ... */ |
2315 | /* 000 */ V(7, 3, 2), /* 248 */ | 2315 | /* 000 */ V(7, 3, 2), /* 248 */ |
2316 | /* 001 */ V(7, 3, 2), | 2316 | /* 001 */ V(7, 3, 2), |
2317 | /* 010 */ V(6, 5, 3), | 2317 | /* 010 */ V(6, 5, 3), |
2318 | /* 011 */ V(4, 6, 3), | 2318 | /* 011 */ V(4, 6, 3), |
@@ -2322,7 +2322,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2322 | /* 111 */ V(7, 2, 2), | 2322 | /* 111 */ V(7, 2, 2), |
2323 | 2323 | ||
2324 | /* 0001 0111 ... */ | 2324 | /* 0001 0111 ... */ |
2325 | /* 000 */ V(6, 4, 3), /* 256 */ | 2325 | /* 000 */ V(6, 4, 3), /* 256 */ |
2326 | /* 001 */ V(5, 5, 3), | 2326 | /* 001 */ V(5, 5, 3), |
2327 | /* 010 */ V(0, 7, 2), | 2327 | /* 010 */ V(0, 7, 2), |
2328 | /* 011 */ V(0, 7, 2), | 2328 | /* 011 */ V(0, 7, 2), |
@@ -2332,59 +2332,59 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2332 | /* 111 */ V(1, 7, 1), | 2332 | /* 111 */ V(1, 7, 1), |
2333 | 2333 | ||
2334 | /* 0001 1000 ... */ | 2334 | /* 0001 1000 ... */ |
2335 | /* 00 */ V(7, 1, 1), /* 264 */ | 2335 | /* 00 */ V(7, 1, 1), /* 264 */ |
2336 | /* 01 */ V(7, 1, 1), | 2336 | /* 01 */ V(7, 1, 1), |
2337 | /* 10 */ V(7, 0, 2), | 2337 | /* 10 */ V(7, 0, 2), |
2338 | /* 11 */ V(3, 6, 2), | 2338 | /* 11 */ V(3, 6, 2), |
2339 | 2339 | ||
2340 | /* 0001 1001 ... */ | 2340 | /* 0001 1001 ... */ |
2341 | /* 00 */ V(6, 3, 2), /* 268 */ | 2341 | /* 00 */ V(6, 3, 2), /* 268 */ |
2342 | /* 01 */ V(4, 5, 2), | 2342 | /* 01 */ V(4, 5, 2), |
2343 | /* 10 */ V(5, 4, 2), | 2343 | /* 10 */ V(5, 4, 2), |
2344 | /* 11 */ V(2, 6, 2), | 2344 | /* 11 */ V(2, 6, 2), |
2345 | 2345 | ||
2346 | /* 0001 1010 ... */ | 2346 | /* 0001 1010 ... */ |
2347 | /* 0 */ V(6, 2, 1), /* 272 */ | 2347 | /* 0 */ V(6, 2, 1), /* 272 */ |
2348 | /* 1 */ V(1, 6, 1), | 2348 | /* 1 */ V(1, 6, 1), |
2349 | 2349 | ||
2350 | /* 0001 1011 ... */ | 2350 | /* 0001 1011 ... */ |
2351 | /* 00 */ V(6, 1, 1), /* 274 */ | 2351 | /* 00 */ V(6, 1, 1), /* 274 */ |
2352 | /* 01 */ V(6, 1, 1), | 2352 | /* 01 */ V(6, 1, 1), |
2353 | /* 10 */ V(0, 6, 2), | 2353 | /* 10 */ V(0, 6, 2), |
2354 | /* 11 */ V(6, 0, 2), | 2354 | /* 11 */ V(6, 0, 2), |
2355 | 2355 | ||
2356 | /* 0001 1100 ... */ | 2356 | /* 0001 1100 ... */ |
2357 | /* 00 */ V(5, 3, 1), /* 278 */ | 2357 | /* 00 */ V(5, 3, 1), /* 278 */ |
2358 | /* 01 */ V(5, 3, 1), | 2358 | /* 01 */ V(5, 3, 1), |
2359 | /* 10 */ V(3, 5, 2), | 2359 | /* 10 */ V(3, 5, 2), |
2360 | /* 11 */ V(4, 4, 2), | 2360 | /* 11 */ V(4, 4, 2), |
2361 | 2361 | ||
2362 | /* 0001 1101 ... */ | 2362 | /* 0001 1101 ... */ |
2363 | /* 0 */ V(2, 5, 1), /* 282 */ | 2363 | /* 0 */ V(2, 5, 1), /* 282 */ |
2364 | /* 1 */ V(5, 2, 1), | 2364 | /* 1 */ V(5, 2, 1), |
2365 | 2365 | ||
2366 | /* 0001 1111 ... */ | 2366 | /* 0001 1111 ... */ |
2367 | /* 0 */ V(1, 5, 1), /* 284 */ | 2367 | /* 0 */ V(1, 5, 1), /* 284 */ |
2368 | /* 1 */ V(0, 5, 1), | 2368 | /* 1 */ V(0, 5, 1), |
2369 | 2369 | ||
2370 | /* 0010 0000 ... */ | 2370 | /* 0010 0000 ... */ |
2371 | /* 0 */ V(3, 4, 1), /* 286 */ | 2371 | /* 0 */ V(3, 4, 1), /* 286 */ |
2372 | /* 1 */ V(4, 3, 1), | 2372 | /* 1 */ V(4, 3, 1), |
2373 | 2373 | ||
2374 | /* 0010 0001 ... */ | 2374 | /* 0010 0001 ... */ |
2375 | /* 0 */ V(5, 0, 1), /* 288 */ | 2375 | /* 0 */ V(5, 0, 1), /* 288 */ |
2376 | /* 1 */ V(2, 4, 1), | 2376 | /* 1 */ V(2, 4, 1), |
2377 | 2377 | ||
2378 | /* 0010 0010 ... */ | 2378 | /* 0010 0010 ... */ |
2379 | /* 0 */ V(4, 2, 1), /* 290 */ | 2379 | /* 0 */ V(4, 2, 1), /* 290 */ |
2380 | /* 1 */ V(3, 3, 1), | 2380 | /* 1 */ V(3, 3, 1), |
2381 | 2381 | ||
2382 | /* 0010 0101 ... */ | 2382 | /* 0010 0101 ... */ |
2383 | /* 0 */ V(0, 4, 1), /* 292 */ | 2383 | /* 0 */ V(0, 4, 1), /* 292 */ |
2384 | /* 1 */ V(4, 0, 1), | 2384 | /* 1 */ V(4, 0, 1), |
2385 | 2385 | ||
2386 | /* 0000 0110 1100 ... */ | 2386 | /* 0000 0110 1100 ... */ |
2387 | /* 0000 */ V(12, 14, 4), /* 294 */ | 2387 | /* 0000 */ V(12, 14, 4), /* 294 */ |
2388 | /* 0001 */ PTR(400, 1), | 2388 | /* 0001 */ PTR(400, 1), |
2389 | /* 0010 */ V(13, 14, 3), | 2389 | /* 0010 */ V(13, 14, 3), |
2390 | /* 0011 */ V(13, 14, 3), | 2390 | /* 0011 */ V(13, 14, 3), |
@@ -2402,7 +2402,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2402 | /* 1111 */ V(14, 11, 3), | 2402 | /* 1111 */ V(14, 11, 3), |
2403 | 2403 | ||
2404 | /* 0000 0110 1101 ... */ | 2404 | /* 0000 0110 1101 ... */ |
2405 | /* 000 */ V(11, 14, 2), /* 310 */ | 2405 | /* 000 */ V(11, 14, 2), /* 310 */ |
2406 | /* 001 */ V(11, 14, 2), | 2406 | /* 001 */ V(11, 14, 2), |
2407 | /* 010 */ V(12, 13, 2), | 2407 | /* 010 */ V(12, 13, 2), |
2408 | /* 011 */ V(12, 13, 2), | 2408 | /* 011 */ V(12, 13, 2), |
@@ -2412,7 +2412,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2412 | /* 111 */ V(10, 14, 2), | 2412 | /* 111 */ V(10, 14, 2), |
2413 | 2413 | ||
2414 | /* 0000 0110 1110 ... */ | 2414 | /* 0000 0110 1110 ... */ |
2415 | /* 000 */ V(12, 12, 2), /* 318 */ | 2415 | /* 000 */ V(12, 12, 2), /* 318 */ |
2416 | /* 001 */ V(12, 12, 2), | 2416 | /* 001 */ V(12, 12, 2), |
2417 | /* 010 */ V(10, 13, 3), | 2417 | /* 010 */ V(10, 13, 3), |
2418 | /* 011 */ V(13, 10, 3), | 2418 | /* 011 */ V(13, 10, 3), |
@@ -2422,7 +2422,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2422 | /* 111 */ V(12, 10, 2), | 2422 | /* 111 */ V(12, 10, 2), |
2423 | 2423 | ||
2424 | /* 0000 0110 1111 ... */ | 2424 | /* 0000 0110 1111 ... */ |
2425 | /* 000 */ V(12, 9, 3), /* 326 */ | 2425 | /* 000 */ V(12, 9, 3), /* 326 */ |
2426 | /* 001 */ V(7, 13, 3), | 2426 | /* 001 */ V(7, 13, 3), |
2427 | /* 010 */ V(5, 14, 2), | 2427 | /* 010 */ V(5, 14, 2), |
2428 | /* 011 */ V(5, 14, 2), | 2428 | /* 011 */ V(5, 14, 2), |
@@ -2432,121 +2432,121 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2432 | /* 111 */ V(11, 13, 1), | 2432 | /* 111 */ V(11, 13, 1), |
2433 | 2433 | ||
2434 | /* 0000 1011 0000 ... */ | 2434 | /* 0000 1011 0000 ... */ |
2435 | /* 00 */ V(9, 14, 1), /* 334 */ | 2435 | /* 00 */ V(9, 14, 1), /* 334 */ |
2436 | /* 01 */ V(9, 14, 1), | 2436 | /* 01 */ V(9, 14, 1), |
2437 | /* 10 */ V(11, 12, 2), | 2437 | /* 10 */ V(11, 12, 2), |
2438 | /* 11 */ V(12, 11, 2), | 2438 | /* 11 */ V(12, 11, 2), |
2439 | 2439 | ||
2440 | /* 0000 1011 0001 ... */ | 2440 | /* 0000 1011 0001 ... */ |
2441 | /* 00 */ V(8, 14, 2), /* 338 */ | 2441 | /* 00 */ V(8, 14, 2), /* 338 */ |
2442 | /* 01 */ V(14, 8, 2), | 2442 | /* 01 */ V(14, 8, 2), |
2443 | /* 10 */ V(9, 13, 2), | 2443 | /* 10 */ V(9, 13, 2), |
2444 | /* 11 */ V(14, 7, 2), | 2444 | /* 11 */ V(14, 7, 2), |
2445 | 2445 | ||
2446 | /* 0000 1011 0010 ... */ | 2446 | /* 0000 1011 0010 ... */ |
2447 | /* 00 */ V(11, 11, 2), /* 342 */ | 2447 | /* 00 */ V(11, 11, 2), /* 342 */ |
2448 | /* 01 */ V(8, 13, 2), | 2448 | /* 01 */ V(8, 13, 2), |
2449 | /* 10 */ V(13, 8, 2), | 2449 | /* 10 */ V(13, 8, 2), |
2450 | /* 11 */ V(6, 14, 2), | 2450 | /* 11 */ V(6, 14, 2), |
2451 | 2451 | ||
2452 | /* 0000 1011 0011 ... */ | 2452 | /* 0000 1011 0011 ... */ |
2453 | /* 0 */ V(14, 6, 1), /* 346 */ | 2453 | /* 0 */ V(14, 6, 1), /* 346 */ |
2454 | /* 1 */ V(9, 12, 1), | 2454 | /* 1 */ V(9, 12, 1), |
2455 | 2455 | ||
2456 | /* 0000 1011 0100 ... */ | 2456 | /* 0000 1011 0100 ... */ |
2457 | /* 00 */ V(10, 11, 2), /* 348 */ | 2457 | /* 00 */ V(10, 11, 2), /* 348 */ |
2458 | /* 01 */ V(11, 10, 2), | 2458 | /* 01 */ V(11, 10, 2), |
2459 | /* 10 */ V(14, 5, 2), | 2459 | /* 10 */ V(14, 5, 2), |
2460 | /* 11 */ V(13, 7, 2), | 2460 | /* 11 */ V(13, 7, 2), |
2461 | 2461 | ||
2462 | /* 0000 1011 0101 ... */ | 2462 | /* 0000 1011 0101 ... */ |
2463 | /* 00 */ V(4, 14, 1), /* 352 */ | 2463 | /* 00 */ V(4, 14, 1), /* 352 */ |
2464 | /* 01 */ V(4, 14, 1), | 2464 | /* 01 */ V(4, 14, 1), |
2465 | /* 10 */ V(14, 4, 2), | 2465 | /* 10 */ V(14, 4, 2), |
2466 | /* 11 */ V(8, 12, 2), | 2466 | /* 11 */ V(8, 12, 2), |
2467 | 2467 | ||
2468 | /* 0000 1011 0110 ... */ | 2468 | /* 0000 1011 0110 ... */ |
2469 | /* 0 */ V(12, 8, 1), /* 356 */ | 2469 | /* 0 */ V(12, 8, 1), /* 356 */ |
2470 | /* 1 */ V(3, 14, 1), | 2470 | /* 1 */ V(3, 14, 1), |
2471 | 2471 | ||
2472 | /* 0000 1011 0111 ... */ | 2472 | /* 0000 1011 0111 ... */ |
2473 | /* 00 */ V(6, 13, 1), /* 358 */ | 2473 | /* 00 */ V(6, 13, 1), /* 358 */ |
2474 | /* 01 */ V(6, 13, 1), | 2474 | /* 01 */ V(6, 13, 1), |
2475 | /* 10 */ V(13, 6, 2), | 2475 | /* 10 */ V(13, 6, 2), |
2476 | /* 11 */ V(9, 11, 2), | 2476 | /* 11 */ V(9, 11, 2), |
2477 | 2477 | ||
2478 | /* 0000 1011 1000 ... */ | 2478 | /* 0000 1011 1000 ... */ |
2479 | /* 00 */ V(11, 9, 2), /* 362 */ | 2479 | /* 00 */ V(11, 9, 2), /* 362 */ |
2480 | /* 01 */ V(10, 10, 2), | 2480 | /* 01 */ V(10, 10, 2), |
2481 | /* 10 */ V(14, 1, 1), | 2481 | /* 10 */ V(14, 1, 1), |
2482 | /* 11 */ V(14, 1, 1), | 2482 | /* 11 */ V(14, 1, 1), |
2483 | 2483 | ||
2484 | /* 0000 1011 1001 ... */ | 2484 | /* 0000 1011 1001 ... */ |
2485 | /* 00 */ V(13, 4, 1), /* 366 */ | 2485 | /* 00 */ V(13, 4, 1), /* 366 */ |
2486 | /* 01 */ V(13, 4, 1), | 2486 | /* 01 */ V(13, 4, 1), |
2487 | /* 10 */ V(11, 8, 2), | 2487 | /* 10 */ V(11, 8, 2), |
2488 | /* 11 */ V(10, 9, 2), | 2488 | /* 11 */ V(10, 9, 2), |
2489 | 2489 | ||
2490 | /* 0000 1011 1010 ... */ | 2490 | /* 0000 1011 1010 ... */ |
2491 | /* 00 */ V(7, 11, 1), /* 370 */ | 2491 | /* 00 */ V(7, 11, 1), /* 370 */ |
2492 | /* 01 */ V(7, 11, 1), | 2492 | /* 01 */ V(7, 11, 1), |
2493 | /* 10 */ V(11, 7, 2), | 2493 | /* 10 */ V(11, 7, 2), |
2494 | /* 11 */ V(13, 0, 2), | 2494 | /* 11 */ V(13, 0, 2), |
2495 | 2495 | ||
2496 | /* 0000 1011 1100 ... */ | 2496 | /* 0000 1011 1100 ... */ |
2497 | /* 0 */ V(0, 14, 1), /* 374 */ | 2497 | /* 0 */ V(0, 14, 1), /* 374 */ |
2498 | /* 1 */ V(14, 0, 1), | 2498 | /* 1 */ V(14, 0, 1), |
2499 | 2499 | ||
2500 | /* 0000 1011 1101 ... */ | 2500 | /* 0000 1011 1101 ... */ |
2501 | /* 0 */ V(5, 13, 1), /* 376 */ | 2501 | /* 0 */ V(5, 13, 1), /* 376 */ |
2502 | /* 1 */ V(13, 5, 1), | 2502 | /* 1 */ V(13, 5, 1), |
2503 | 2503 | ||
2504 | /* 0000 1011 1110 ... */ | 2504 | /* 0000 1011 1110 ... */ |
2505 | /* 0 */ V(7, 12, 1), /* 378 */ | 2505 | /* 0 */ V(7, 12, 1), /* 378 */ |
2506 | /* 1 */ V(12, 7, 1), | 2506 | /* 1 */ V(12, 7, 1), |
2507 | 2507 | ||
2508 | /* 0000 1011 1111 ... */ | 2508 | /* 0000 1011 1111 ... */ |
2509 | /* 0 */ V(4, 13, 1), /* 380 */ | 2509 | /* 0 */ V(4, 13, 1), /* 380 */ |
2510 | /* 1 */ V(8, 11, 1), | 2510 | /* 1 */ V(8, 11, 1), |
2511 | 2511 | ||
2512 | /* 0000 1100 0000 ... */ | 2512 | /* 0000 1100 0000 ... */ |
2513 | /* 0 */ V(9, 10, 1), /* 382 */ | 2513 | /* 0 */ V(9, 10, 1), /* 382 */ |
2514 | /* 1 */ V(6, 12, 1), | 2514 | /* 1 */ V(6, 12, 1), |
2515 | 2515 | ||
2516 | /* 0000 1100 0001 ... */ | 2516 | /* 0000 1100 0001 ... */ |
2517 | /* 0 */ V(12, 6, 1), /* 384 */ | 2517 | /* 0 */ V(12, 6, 1), /* 384 */ |
2518 | /* 1 */ V(3, 13, 1), | 2518 | /* 1 */ V(3, 13, 1), |
2519 | 2519 | ||
2520 | /* 0000 1100 0010 ... */ | 2520 | /* 0000 1100 0010 ... */ |
2521 | /* 0 */ V(5, 12, 1), /* 386 */ | 2521 | /* 0 */ V(5, 12, 1), /* 386 */ |
2522 | /* 1 */ V(12, 5, 1), | 2522 | /* 1 */ V(12, 5, 1), |
2523 | 2523 | ||
2524 | /* 0000 1100 0100 ... */ | 2524 | /* 0000 1100 0100 ... */ |
2525 | /* 0 */ V(8, 10, 1), /* 388 */ | 2525 | /* 0 */ V(8, 10, 1), /* 388 */ |
2526 | /* 1 */ V(10, 8, 1), | 2526 | /* 1 */ V(10, 8, 1), |
2527 | 2527 | ||
2528 | /* 0000 1100 0101 ... */ | 2528 | /* 0000 1100 0101 ... */ |
2529 | /* 0 */ V(9, 9, 1), /* 390 */ | 2529 | /* 0 */ V(9, 9, 1), /* 390 */ |
2530 | /* 1 */ V(4, 12, 1), | 2530 | /* 1 */ V(4, 12, 1), |
2531 | 2531 | ||
2532 | /* 0000 1100 0110 ... */ | 2532 | /* 0000 1100 0110 ... */ |
2533 | /* 0 */ V(11, 6, 1), /* 392 */ | 2533 | /* 0 */ V(11, 6, 1), /* 392 */ |
2534 | /* 1 */ V(7, 10, 1), | 2534 | /* 1 */ V(7, 10, 1), |
2535 | 2535 | ||
2536 | /* 0000 1100 1000 ... */ | 2536 | /* 0000 1100 1000 ... */ |
2537 | /* 0 */ V(5, 11, 1), /* 394 */ | 2537 | /* 0 */ V(5, 11, 1), /* 394 */ |
2538 | /* 1 */ V(8, 9, 1), | 2538 | /* 1 */ V(8, 9, 1), |
2539 | 2539 | ||
2540 | /* 0000 1100 1011 ... */ | 2540 | /* 0000 1100 1011 ... */ |
2541 | /* 0 */ V(9, 8, 1), /* 396 */ | 2541 | /* 0 */ V(9, 8, 1), /* 396 */ |
2542 | /* 1 */ V(7, 9, 1), | 2542 | /* 1 */ V(7, 9, 1), |
2543 | 2543 | ||
2544 | /* 0000 1101 0101 ... */ | 2544 | /* 0000 1101 0101 ... */ |
2545 | /* 0 */ V(9, 7, 1), /* 398 */ | 2545 | /* 0 */ V(9, 7, 1), /* 398 */ |
2546 | /* 1 */ V(8, 8, 1), | 2546 | /* 1 */ V(8, 8, 1), |
2547 | 2547 | ||
2548 | /* 0000 0110 1100 0001 ... */ | 2548 | /* 0000 0110 1100 0001 ... */ |
2549 | /* 0 */ V(14, 12, 1), /* 400 */ | 2549 | /* 0 */ V(14, 12, 1), /* 400 */ |
2550 | /* 1 */ V(13, 13, 1) | 2550 | /* 1 */ V(13, 13, 1) |
2551 | }; | 2551 | }; |
2552 | 2552 | ||
@@ -2570,7 +2570,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2570 | /* 1111 */ V(0, 0, 4), | 2570 | /* 1111 */ V(0, 0, 4), |
2571 | 2571 | ||
2572 | /* 0000 ... */ | 2572 | /* 0000 ... */ |
2573 | /* 0000 */ V(14, 15, 4), /* 16 */ | 2573 | /* 0000 */ V(14, 15, 4), /* 16 */ |
2574 | /* 0001 */ V(15, 14, 4), | 2574 | /* 0001 */ V(15, 14, 4), |
2575 | /* 0010 */ V(13, 15, 4), | 2575 | /* 0010 */ V(13, 15, 4), |
2576 | /* 0011 */ V(15, 13, 4), | 2576 | /* 0011 */ V(15, 13, 4), |
@@ -2588,7 +2588,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2588 | /* 1111 */ V(15, 8, 3), | 2588 | /* 1111 */ V(15, 8, 3), |
2589 | 2589 | ||
2590 | /* 0001 ... */ | 2590 | /* 0001 ... */ |
2591 | /* 0000 */ V(8, 15, 4), /* 32 */ | 2591 | /* 0000 */ V(8, 15, 4), /* 32 */ |
2592 | /* 0001 */ V(7, 15, 4), | 2592 | /* 0001 */ V(7, 15, 4), |
2593 | /* 0010 */ V(15, 7, 3), | 2593 | /* 0010 */ V(15, 7, 3), |
2594 | /* 0011 */ V(15, 7, 3), | 2594 | /* 0011 */ V(15, 7, 3), |
@@ -2606,7 +2606,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2606 | /* 1111 */ V(15, 4, 3), | 2606 | /* 1111 */ V(15, 4, 3), |
2607 | 2607 | ||
2608 | /* 0010 ... */ | 2608 | /* 0010 ... */ |
2609 | /* 0000 */ V(3, 15, 3), /* 48 */ | 2609 | /* 0000 */ V(3, 15, 3), /* 48 */ |
2610 | /* 0001 */ V(3, 15, 3), | 2610 | /* 0001 */ V(3, 15, 3), |
2611 | /* 0010 */ V(15, 3, 3), | 2611 | /* 0010 */ V(15, 3, 3), |
2612 | /* 0011 */ V(15, 3, 3), | 2612 | /* 0011 */ V(15, 3, 3), |
@@ -2624,7 +2624,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2624 | /* 1111 */ PTR(196, 3), | 2624 | /* 1111 */ PTR(196, 3), |
2625 | 2625 | ||
2626 | /* 0100 ... */ | 2626 | /* 0100 ... */ |
2627 | /* 0000 */ PTR(204, 4), /* 64 */ | 2627 | /* 0000 */ PTR(204, 4), /* 64 */ |
2628 | /* 0001 */ PTR(220, 3), | 2628 | /* 0001 */ PTR(220, 3), |
2629 | /* 0010 */ PTR(228, 3), | 2629 | /* 0010 */ PTR(228, 3), |
2630 | /* 0011 */ PTR(236, 3), | 2630 | /* 0011 */ PTR(236, 3), |
@@ -2642,7 +2642,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2642 | /* 1111 */ PTR(292, 2), | 2642 | /* 1111 */ PTR(292, 2), |
2643 | 2643 | ||
2644 | /* 0101 ... */ | 2644 | /* 0101 ... */ |
2645 | /* 0000 */ PTR(296, 2), /* 80 */ | 2645 | /* 0000 */ PTR(296, 2), /* 80 */ |
2646 | /* 0001 */ PTR(300, 3), | 2646 | /* 0001 */ PTR(300, 3), |
2647 | /* 0010 */ PTR(308, 2), | 2647 | /* 0010 */ PTR(308, 2), |
2648 | /* 0011 */ PTR(312, 3), | 2648 | /* 0011 */ PTR(312, 3), |
@@ -2660,7 +2660,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2660 | /* 1111 */ PTR(348, 1), | 2660 | /* 1111 */ PTR(348, 1), |
2661 | 2661 | ||
2662 | /* 0110 ... */ | 2662 | /* 0110 ... */ |
2663 | /* 0000 */ PTR(350, 1), /* 96 */ | 2663 | /* 0000 */ PTR(350, 1), /* 96 */ |
2664 | /* 0001 */ PTR(352, 1), | 2664 | /* 0001 */ PTR(352, 1), |
2665 | /* 0010 */ PTR(354, 1), | 2665 | /* 0010 */ PTR(354, 1), |
2666 | /* 0011 */ PTR(356, 1), | 2666 | /* 0011 */ PTR(356, 1), |
@@ -2678,7 +2678,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2678 | /* 1111 */ V(7, 2, 4), | 2678 | /* 1111 */ V(7, 2, 4), |
2679 | 2679 | ||
2680 | /* 0111 ... */ | 2680 | /* 0111 ... */ |
2681 | /* 0000 */ V(4, 6, 4), /* 112 */ | 2681 | /* 0000 */ V(4, 6, 4), /* 112 */ |
2682 | /* 0001 */ V(6, 4, 4), | 2682 | /* 0001 */ V(6, 4, 4), |
2683 | /* 0010 */ V(5, 5, 4), | 2683 | /* 0010 */ V(5, 5, 4), |
2684 | /* 0011 */ V(7, 1, 4), | 2684 | /* 0011 */ V(7, 1, 4), |
@@ -2696,7 +2696,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2696 | /* 1111 */ V(4, 4, 4), | 2696 | /* 1111 */ V(4, 4, 4), |
2697 | 2697 | ||
2698 | /* 1000 ... */ | 2698 | /* 1000 ... */ |
2699 | /* 0000 */ V(2, 5, 4), /* 128 */ | 2699 | /* 0000 */ V(2, 5, 4), /* 128 */ |
2700 | /* 0001 */ V(5, 2, 4), | 2700 | /* 0001 */ V(5, 2, 4), |
2701 | /* 0010 */ V(1, 5, 4), | 2701 | /* 0010 */ V(1, 5, 4), |
2702 | /* 0011 */ PTR(384, 1), | 2702 | /* 0011 */ PTR(384, 1), |
@@ -2714,7 +2714,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2714 | /* 1111 */ V(1, 4, 3), | 2714 | /* 1111 */ V(1, 4, 3), |
2715 | 2715 | ||
2716 | /* 1001 ... */ | 2716 | /* 1001 ... */ |
2717 | /* 0000 */ V(4, 1, 3), /* 144 */ | 2717 | /* 0000 */ V(4, 1, 3), /* 144 */ |
2718 | /* 0001 */ V(4, 1, 3), | 2718 | /* 0001 */ V(4, 1, 3), |
2719 | /* 0010 */ V(0, 4, 4), | 2719 | /* 0010 */ V(0, 4, 4), |
2720 | /* 0011 */ V(4, 0, 4), | 2720 | /* 0011 */ V(4, 0, 4), |
@@ -2732,7 +2732,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2732 | /* 1111 */ V(3, 1, 2), | 2732 | /* 1111 */ V(3, 1, 2), |
2733 | 2733 | ||
2734 | /* 1010 ... */ | 2734 | /* 1010 ... */ |
2735 | /* 000 */ V(0, 3, 3), /* 160 */ | 2735 | /* 000 */ V(0, 3, 3), /* 160 */ |
2736 | /* 001 */ V(3, 0, 3), | 2736 | /* 001 */ V(3, 0, 3), |
2737 | /* 010 */ V(2, 2, 2), | 2737 | /* 010 */ V(2, 2, 2), |
2738 | /* 011 */ V(2, 2, 2), | 2738 | /* 011 */ V(2, 2, 2), |
@@ -2742,13 +2742,13 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2742 | /* 111 */ V(1, 2, 1), | 2742 | /* 111 */ V(1, 2, 1), |
2743 | 2743 | ||
2744 | /* 1011 ... */ | 2744 | /* 1011 ... */ |
2745 | /* 00 */ V(2, 1, 1), /* 168 */ | 2745 | /* 00 */ V(2, 1, 1), /* 168 */ |
2746 | /* 01 */ V(2, 1, 1), | 2746 | /* 01 */ V(2, 1, 1), |
2747 | /* 10 */ V(0, 2, 2), | 2747 | /* 10 */ V(0, 2, 2), |
2748 | /* 11 */ V(2, 0, 2), | 2748 | /* 11 */ V(2, 0, 2), |
2749 | 2749 | ||
2750 | /* 0010 1100 ... */ | 2750 | /* 0010 1100 ... */ |
2751 | /* 000 */ V(0, 15, 1), /* 172 */ | 2751 | /* 000 */ V(0, 15, 1), /* 172 */ |
2752 | /* 001 */ V(0, 15, 1), | 2752 | /* 001 */ V(0, 15, 1), |
2753 | /* 010 */ V(0, 15, 1), | 2753 | /* 010 */ V(0, 15, 1), |
2754 | /* 011 */ V(0, 15, 1), | 2754 | /* 011 */ V(0, 15, 1), |
@@ -2758,7 +2758,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2758 | /* 111 */ V(12, 14, 3), | 2758 | /* 111 */ V(12, 14, 3), |
2759 | 2759 | ||
2760 | /* 0010 1101 ... */ | 2760 | /* 0010 1101 ... */ |
2761 | /* 000 */ V(14, 12, 3), /* 180 */ | 2761 | /* 000 */ V(14, 12, 3), /* 180 */ |
2762 | /* 001 */ V(13, 13, 3), | 2762 | /* 001 */ V(13, 13, 3), |
2763 | /* 010 */ V(11, 14, 3), | 2763 | /* 010 */ V(11, 14, 3), |
2764 | /* 011 */ V(14, 11, 3), | 2764 | /* 011 */ V(14, 11, 3), |
@@ -2768,7 +2768,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2768 | /* 111 */ V(14, 10, 3), | 2768 | /* 111 */ V(14, 10, 3), |
2769 | 2769 | ||
2770 | /* 0010 1110 ... */ | 2770 | /* 0010 1110 ... */ |
2771 | /* 000 */ V(11, 13, 3), /* 188 */ | 2771 | /* 000 */ V(11, 13, 3), /* 188 */ |
2772 | /* 001 */ V(13, 11, 3), | 2772 | /* 001 */ V(13, 11, 3), |
2773 | /* 010 */ V(12, 12, 3), | 2773 | /* 010 */ V(12, 12, 3), |
2774 | /* 011 */ V(9, 14, 3), | 2774 | /* 011 */ V(9, 14, 3), |
@@ -2778,7 +2778,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2778 | /* 111 */ V(11, 12, 3), | 2778 | /* 111 */ V(11, 12, 3), |
2779 | 2779 | ||
2780 | /* 0010 1111 ... */ | 2780 | /* 0010 1111 ... */ |
2781 | /* 000 */ V(12, 11, 3), /* 196 */ | 2781 | /* 000 */ V(12, 11, 3), /* 196 */ |
2782 | /* 001 */ V(8, 14, 3), | 2782 | /* 001 */ V(8, 14, 3), |
2783 | /* 010 */ V(14, 8, 3), | 2783 | /* 010 */ V(14, 8, 3), |
2784 | /* 011 */ V(9, 13, 3), | 2784 | /* 011 */ V(9, 13, 3), |
@@ -2788,7 +2788,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2788 | /* 111 */ V(10, 12, 3), | 2788 | /* 111 */ V(10, 12, 3), |
2789 | 2789 | ||
2790 | /* 0100 0000 ... */ | 2790 | /* 0100 0000 ... */ |
2791 | /* 0000 */ V(12, 10, 3), /* 204 */ | 2791 | /* 0000 */ V(12, 10, 3), /* 204 */ |
2792 | /* 0001 */ V(12, 10, 3), | 2792 | /* 0001 */ V(12, 10, 3), |
2793 | /* 0010 */ V(11, 11, 3), | 2793 | /* 0010 */ V(11, 11, 3), |
2794 | /* 0011 */ V(11, 11, 3), | 2794 | /* 0011 */ V(11, 11, 3), |
@@ -2806,7 +2806,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2806 | /* 1111 */ V(14, 6, 2), | 2806 | /* 1111 */ V(14, 6, 2), |
2807 | 2807 | ||
2808 | /* 0100 0001 ... */ | 2808 | /* 0100 0001 ... */ |
2809 | /* 000 */ V(6, 14, 3), /* 220 */ | 2809 | /* 000 */ V(6, 14, 3), /* 220 */ |
2810 | /* 001 */ V(9, 12, 3), | 2810 | /* 001 */ V(9, 12, 3), |
2811 | /* 010 */ V(12, 9, 2), | 2811 | /* 010 */ V(12, 9, 2), |
2812 | /* 011 */ V(12, 9, 2), | 2812 | /* 011 */ V(12, 9, 2), |
@@ -2816,7 +2816,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2816 | /* 111 */ V(11, 10, 2), | 2816 | /* 111 */ V(11, 10, 2), |
2817 | 2817 | ||
2818 | /* 0100 0010 ... */ | 2818 | /* 0100 0010 ... */ |
2819 | /* 000 */ V(14, 5, 2), /* 228 */ | 2819 | /* 000 */ V(14, 5, 2), /* 228 */ |
2820 | /* 001 */ V(14, 5, 2), | 2820 | /* 001 */ V(14, 5, 2), |
2821 | /* 010 */ V(10, 11, 3), | 2821 | /* 010 */ V(10, 11, 3), |
2822 | /* 011 */ V(7, 13, 3), | 2822 | /* 011 */ V(7, 13, 3), |
@@ -2826,7 +2826,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2826 | /* 111 */ V(14, 4, 2), | 2826 | /* 111 */ V(14, 4, 2), |
2827 | 2827 | ||
2828 | /* 0100 0011 ... */ | 2828 | /* 0100 0011 ... */ |
2829 | /* 000 */ V(8, 12, 2), /* 236 */ | 2829 | /* 000 */ V(8, 12, 2), /* 236 */ |
2830 | /* 001 */ V(8, 12, 2), | 2830 | /* 001 */ V(8, 12, 2), |
2831 | /* 010 */ V(12, 8, 2), | 2831 | /* 010 */ V(12, 8, 2), |
2832 | /* 011 */ V(12, 8, 2), | 2832 | /* 011 */ V(12, 8, 2), |
@@ -2836,61 +2836,61 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2836 | /* 111 */ V(3, 14, 2), | 2836 | /* 111 */ V(3, 14, 2), |
2837 | 2837 | ||
2838 | /* 0100 0100 ... */ | 2838 | /* 0100 0100 ... */ |
2839 | /* 00 */ V(6, 13, 2), /* 244 */ | 2839 | /* 00 */ V(6, 13, 2), /* 244 */ |
2840 | /* 01 */ V(13, 6, 2), | 2840 | /* 01 */ V(13, 6, 2), |
2841 | /* 10 */ V(14, 3, 2), | 2841 | /* 10 */ V(14, 3, 2), |
2842 | /* 11 */ V(9, 11, 2), | 2842 | /* 11 */ V(9, 11, 2), |
2843 | 2843 | ||
2844 | /* 0100 0101 ... */ | 2844 | /* 0100 0101 ... */ |
2845 | /* 00 */ V(11, 9, 2), /* 248 */ | 2845 | /* 00 */ V(11, 9, 2), /* 248 */ |
2846 | /* 01 */ V(10, 10, 2), | 2846 | /* 01 */ V(10, 10, 2), |
2847 | /* 10 */ V(14, 2, 2), | 2847 | /* 10 */ V(14, 2, 2), |
2848 | /* 11 */ V(1, 14, 2), | 2848 | /* 11 */ V(1, 14, 2), |
2849 | 2849 | ||
2850 | /* 0100 0110 ... */ | 2850 | /* 0100 0110 ... */ |
2851 | /* 00 */ V(14, 1, 2), /* 252 */ | 2851 | /* 00 */ V(14, 1, 2), /* 252 */ |
2852 | /* 01 */ V(5, 13, 2), | 2852 | /* 01 */ V(5, 13, 2), |
2853 | /* 10 */ V(13, 5, 2), | 2853 | /* 10 */ V(13, 5, 2), |
2854 | /* 11 */ V(7, 12, 2), | 2854 | /* 11 */ V(7, 12, 2), |
2855 | 2855 | ||
2856 | /* 0100 0111 ... */ | 2856 | /* 0100 0111 ... */ |
2857 | /* 00 */ V(12, 7, 2), /* 256 */ | 2857 | /* 00 */ V(12, 7, 2), /* 256 */ |
2858 | /* 01 */ V(4, 13, 2), | 2858 | /* 01 */ V(4, 13, 2), |
2859 | /* 10 */ V(8, 11, 2), | 2859 | /* 10 */ V(8, 11, 2), |
2860 | /* 11 */ V(11, 8, 2), | 2860 | /* 11 */ V(11, 8, 2), |
2861 | 2861 | ||
2862 | /* 0100 1000 ... */ | 2862 | /* 0100 1000 ... */ |
2863 | /* 00 */ V(13, 4, 2), /* 260 */ | 2863 | /* 00 */ V(13, 4, 2), /* 260 */ |
2864 | /* 01 */ V(9, 10, 2), | 2864 | /* 01 */ V(9, 10, 2), |
2865 | /* 10 */ V(10, 9, 2), | 2865 | /* 10 */ V(10, 9, 2), |
2866 | /* 11 */ V(6, 12, 2), | 2866 | /* 11 */ V(6, 12, 2), |
2867 | 2867 | ||
2868 | /* 0100 1001 ... */ | 2868 | /* 0100 1001 ... */ |
2869 | /* 00 */ V(12, 6, 2), /* 264 */ | 2869 | /* 00 */ V(12, 6, 2), /* 264 */ |
2870 | /* 01 */ V(3, 13, 2), | 2870 | /* 01 */ V(3, 13, 2), |
2871 | /* 10 */ V(13, 3, 2), | 2871 | /* 10 */ V(13, 3, 2), |
2872 | /* 11 */ V(2, 13, 2), | 2872 | /* 11 */ V(2, 13, 2), |
2873 | 2873 | ||
2874 | /* 0100 1010 ... */ | 2874 | /* 0100 1010 ... */ |
2875 | /* 00 */ V(13, 2, 2), /* 268 */ | 2875 | /* 00 */ V(13, 2, 2), /* 268 */ |
2876 | /* 01 */ V(1, 13, 2), | 2876 | /* 01 */ V(1, 13, 2), |
2877 | /* 10 */ V(7, 11, 2), | 2877 | /* 10 */ V(7, 11, 2), |
2878 | /* 11 */ V(11, 7, 2), | 2878 | /* 11 */ V(11, 7, 2), |
2879 | 2879 | ||
2880 | /* 0100 1011 ... */ | 2880 | /* 0100 1011 ... */ |
2881 | /* 00 */ V(13, 1, 2), /* 272 */ | 2881 | /* 00 */ V(13, 1, 2), /* 272 */ |
2882 | /* 01 */ V(5, 12, 2), | 2882 | /* 01 */ V(5, 12, 2), |
2883 | /* 10 */ V(12, 5, 2), | 2883 | /* 10 */ V(12, 5, 2), |
2884 | /* 11 */ V(8, 10, 2), | 2884 | /* 11 */ V(8, 10, 2), |
2885 | 2885 | ||
2886 | /* 0100 1100 ... */ | 2886 | /* 0100 1100 ... */ |
2887 | /* 00 */ V(10, 8, 2), /* 276 */ | 2887 | /* 00 */ V(10, 8, 2), /* 276 */ |
2888 | /* 01 */ V(9, 9, 2), | 2888 | /* 01 */ V(9, 9, 2), |
2889 | /* 10 */ V(4, 12, 2), | 2889 | /* 10 */ V(4, 12, 2), |
2890 | /* 11 */ V(12, 4, 2), | 2890 | /* 11 */ V(12, 4, 2), |
2891 | 2891 | ||
2892 | /* 0100 1101 ... */ | 2892 | /* 0100 1101 ... */ |
2893 | /* 000 */ V(6, 11, 2), /* 280 */ | 2893 | /* 000 */ V(6, 11, 2), /* 280 */ |
2894 | /* 001 */ V(6, 11, 2), | 2894 | /* 001 */ V(6, 11, 2), |
2895 | /* 010 */ V(11, 6, 2), | 2895 | /* 010 */ V(11, 6, 2), |
2896 | /* 011 */ V(11, 6, 2), | 2896 | /* 011 */ V(11, 6, 2), |
@@ -2900,25 +2900,25 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2900 | /* 111 */ V(3, 12, 2), | 2900 | /* 111 */ V(3, 12, 2), |
2901 | 2901 | ||
2902 | /* 0100 1110 ... */ | 2902 | /* 0100 1110 ... */ |
2903 | /* 00 */ V(12, 3, 2), /* 288 */ | 2903 | /* 00 */ V(12, 3, 2), /* 288 */ |
2904 | /* 01 */ V(7, 10, 2), | 2904 | /* 01 */ V(7, 10, 2), |
2905 | /* 10 */ V(10, 7, 2), | 2905 | /* 10 */ V(10, 7, 2), |
2906 | /* 11 */ V(2, 12, 2), | 2906 | /* 11 */ V(2, 12, 2), |
2907 | 2907 | ||
2908 | /* 0100 1111 ... */ | 2908 | /* 0100 1111 ... */ |
2909 | /* 00 */ V(12, 2, 2), /* 292 */ | 2909 | /* 00 */ V(12, 2, 2), /* 292 */ |
2910 | /* 01 */ V(5, 11, 2), | 2910 | /* 01 */ V(5, 11, 2), |
2911 | /* 10 */ V(11, 5, 2), | 2911 | /* 10 */ V(11, 5, 2), |
2912 | /* 11 */ V(1, 12, 2), | 2912 | /* 11 */ V(1, 12, 2), |
2913 | 2913 | ||
2914 | /* 0101 0000 ... */ | 2914 | /* 0101 0000 ... */ |
2915 | /* 00 */ V(8, 9, 2), /* 296 */ | 2915 | /* 00 */ V(8, 9, 2), /* 296 */ |
2916 | /* 01 */ V(9, 8, 2), | 2916 | /* 01 */ V(9, 8, 2), |
2917 | /* 10 */ V(12, 1, 2), | 2917 | /* 10 */ V(12, 1, 2), |
2918 | /* 11 */ V(4, 11, 2), | 2918 | /* 11 */ V(4, 11, 2), |
2919 | 2919 | ||
2920 | /* 0101 0001 ... */ | 2920 | /* 0101 0001 ... */ |
2921 | /* 000 */ V(12, 0, 3), /* 300 */ | 2921 | /* 000 */ V(12, 0, 3), /* 300 */ |
2922 | /* 001 */ V(0, 11, 3), | 2922 | /* 001 */ V(0, 11, 3), |
2923 | /* 010 */ V(3, 11, 2), | 2923 | /* 010 */ V(3, 11, 2), |
2924 | /* 011 */ V(3, 11, 2), | 2924 | /* 011 */ V(3, 11, 2), |
@@ -2928,13 +2928,13 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2928 | /* 111 */ V(1, 10, 2), | 2928 | /* 111 */ V(1, 10, 2), |
2929 | 2929 | ||
2930 | /* 0101 0010 ... */ | 2930 | /* 0101 0010 ... */ |
2931 | /* 00 */ V(11, 4, 1), /* 308 */ | 2931 | /* 00 */ V(11, 4, 1), /* 308 */ |
2932 | /* 01 */ V(11, 4, 1), | 2932 | /* 01 */ V(11, 4, 1), |
2933 | /* 10 */ V(6, 10, 2), | 2933 | /* 10 */ V(6, 10, 2), |
2934 | /* 11 */ V(10, 6, 2), | 2934 | /* 11 */ V(10, 6, 2), |
2935 | 2935 | ||
2936 | /* 0101 0011 ... */ | 2936 | /* 0101 0011 ... */ |
2937 | /* 000 */ V(7, 9, 2), /* 312 */ | 2937 | /* 000 */ V(7, 9, 2), /* 312 */ |
2938 | /* 001 */ V(7, 9, 2), | 2938 | /* 001 */ V(7, 9, 2), |
2939 | /* 010 */ V(9, 7, 2), | 2939 | /* 010 */ V(9, 7, 2), |
2940 | /* 011 */ V(9, 7, 2), | 2940 | /* 011 */ V(9, 7, 2), |
@@ -2944,125 +2944,125 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { | |||
2944 | /* 111 */ V(9, 0, 2), | 2944 | /* 111 */ V(9, 0, 2), |
2945 | 2945 | ||
2946 | /* 0101 0100 ... */ | 2946 | /* 0101 0100 ... */ |
2947 | /* 0 */ V(11, 3, 1), /* 320 */ | 2947 | /* 0 */ V(11, 3, 1), /* 320 */ |
2948 | /* 1 */ V(8, 8, 1), | 2948 | /* 1 */ V(8, 8, 1), |
2949 | 2949 | ||
2950 | /* 0101 0101 ... */ | 2950 | /* 0101 0101 ... */ |
2951 | /* 00 */ V(2, 11, 2), /* 322 */ | 2951 | /* 00 */ V(2, 11, 2), /* 322 */ |
2952 | /* 01 */ V(5, 10, 2), | 2952 | /* 01 */ V(5, 10, 2), |
2953 | /* 10 */ V(11, 2, 1), | 2953 | /* 10 */ V(11, 2, 1), |
2954 | /* 11 */ V(11, 2, 1), | 2954 | /* 11 */ V(11, 2, 1), |
2955 | 2955 | ||
2956 | /* 0101 0110 ... */ | 2956 | /* 0101 0110 ... */ |
2957 | /* 00 */ V(10, 5, 2), /* 326 */ | 2957 | /* 00 */ V(10, 5, 2), /* 326 */ |
2958 | /* 01 */ V(1, 11, 2), | 2958 | /* 01 */ V(1, 11, 2), |
2959 | /* 10 */ V(11, 1, 2), | 2959 | /* 10 */ V(11, 1, 2), |
2960 | /* 11 */ V(6, 9, 2), | 2960 | /* 11 */ V(6, 9, 2), |
2961 | 2961 | ||
2962 | /* 0101 0111 ... */ | 2962 | /* 0101 0111 ... */ |
2963 | /* 0 */ V(9, 6, 1), /* 330 */ | 2963 | /* 0 */ V(9, 6, 1), /* 330 */ |
2964 | /* 1 */ V(10, 4, 1), | 2964 | /* 1 */ V(10, 4, 1), |
2965 | 2965 | ||
2966 | /* 0101 1000 ... */ | 2966 | /* 0101 1000 ... */ |
2967 | /* 00 */ V(4, 10, 2), /* 332 */ | 2967 | /* 00 */ V(4, 10, 2), /* 332 */ |
2968 | /* 01 */ V(7, 8, 2), | 2968 | /* 01 */ V(7, 8, 2), |
2969 | /* 10 */ V(8, 7, 1), | 2969 | /* 10 */ V(8, 7, 1), |
2970 | /* 11 */ V(8, 7, 1), | 2970 | /* 11 */ V(8, 7, 1), |
2971 | 2971 | ||
2972 | /* 0101 1001 ... */ | 2972 | /* 0101 1001 ... */ |
2973 | /* 0 */ V(3, 10, 1), /* 336 */ | 2973 | /* 0 */ V(3, 10, 1), /* 336 */ |
2974 | /* 1 */ V(10, 3, 1), | 2974 | /* 1 */ V(10, 3, 1), |
2975 | 2975 | ||
2976 | /* 0101 1010 ... */ | 2976 | /* 0101 1010 ... */ |
2977 | /* 0 */ V(5, 9, 1), /* 338 */ | 2977 | /* 0 */ V(5, 9, 1), /* 338 */ |
2978 | /* 1 */ V(9, 5, 1), | 2978 | /* 1 */ V(9, 5, 1), |
2979 | 2979 | ||
2980 | /* 0101 1011 ... */ | 2980 | /* 0101 1011 ... */ |
2981 | /* 0 */ V(2, 10, 1), /* 340 */ | 2981 | /* 0 */ V(2, 10, 1), /* 340 */ |
2982 | /* 1 */ V(10, 2, 1), | 2982 | /* 1 */ V(10, 2, 1), |
2983 | 2983 | ||
2984 | /* 0101 1100 ... */ | 2984 | /* 0101 1100 ... */ |
2985 | /* 0 */ V(10, 1, 1), /* 342 */ | 2985 | /* 0 */ V(10, 1, 1), /* 342 */ |
2986 | /* 1 */ V(6, 8, 1), | 2986 | /* 1 */ V(6, 8, 1), |
2987 | 2987 | ||
2988 | /* 0101 1101 ... */ | 2988 | /* 0101 1101 ... */ |
2989 | /* 0 */ V(8, 6, 1), /* 344 */ | 2989 | /* 0 */ V(8, 6, 1), /* 344 */ |
2990 | /* 1 */ V(7, 7, 1), | 2990 | /* 1 */ V(7, 7, 1), |
2991 | 2991 | ||
2992 | /* 0101 1110 ... */ | 2992 | /* 0101 1110 ... */ |
2993 | /* 0 */ V(4, 9, 1), /* 346 */ | 2993 | /* 0 */ V(4, 9, 1), /* 346 */ |
2994 | /* 1 */ V(9, 4, 1), | 2994 | /* 1 */ V(9, 4, 1), |
2995 | 2995 | ||
2996 | /* 0101 1111 ... */ | 2996 | /* 0101 1111 ... */ |
2997 | /* 0 */ V(3, 9, 1), /* 348 */ | 2997 | /* 0 */ V(3, 9, 1), /* 348 */ |
2998 | /* 1 */ V(9, 3, 1), | 2998 | /* 1 */ V(9, 3, 1), |
2999 | 2999 | ||
3000 | /* 0110 0000 ... */ | 3000 | /* 0110 0000 ... */ |
3001 | /* 0 */ V(5, 8, 1), /* 350 */ | 3001 | /* 0 */ V(5, 8, 1), /* 350 */ |
3002 | /* 1 */ V(8, 5, 1), | 3002 | /* 1 */ V(8, 5, 1), |
3003 | 3003 | ||
3004 | /* 0110 0001 ... */ | 3004 | /* 0110 0001 ... */ |
3005 | /* 0 */ V(2, 9, 1), /* 352 */ | 3005 | /* 0 */ V(2, 9, 1), /* 352 */ |
3006 | /* 1 */ V(6, 7, 1), | 3006 | /* 1 */ V(6, 7, 1), |
3007 | 3007 | ||
3008 | /* 0110 0010 ... */ | 3008 | /* 0110 0010 ... */ |
3009 | /* 0 */ V(7, 6, 1), /* 354 */ | 3009 | /* 0 */ V(7, 6, 1), /* 354 */ |
3010 | /* 1 */ V(9, 2, 1), | 3010 | /* 1 */ V(9, 2, 1), |
3011 | 3011 | ||
3012 | /* 0110 0011 ... */ | 3012 | /* 0110 0011 ... */ |
3013 | /* 0 */ V(1, 9, 1), /* 356 */ | 3013 | /* 0 */ V(1, 9, 1), /* 356 */ |
3014 | /* 1 */ V(9, 1, 1), | 3014 | /* 1 */ V(9, 1, 1), |
3015 | 3015 | ||
3016 | /* 0110 0100 ... */ | 3016 | /* 0110 0100 ... */ |
3017 | /* 0 */ V(4, 8, 1), /* 358 */ | 3017 | /* 0 */ V(4, 8, 1), /* 358 */ |
3018 | /* 1 */ V(8, 4, 1), | 3018 | /* 1 */ V(8, 4, 1), |
3019 | 3019 | ||
3020 | /* 0110 0101 ... */ | 3020 | /* 0110 0101 ... */ |
3021 | /* 0 */ V(5, 7, 1), /* 360 */ | 3021 | /* 0 */ V(5, 7, 1), /* 360 */ |
3022 | /* 1 */ V(7, 5, 1), | 3022 | /* 1 */ V(7, 5, 1), |
3023 | 3023 | ||
3024 | /* 0110 0110 ... */ | 3024 | /* 0110 0110 ... */ |
3025 | /* 0 */ V(3, 8, 1), /* 362 */ | 3025 | /* 0 */ V(3, 8, 1), /* 362 */ |
3026 | /* 1 */ V(8, 3, 1), | 3026 | /* 1 */ V(8, 3, 1), |
3027 | 3027 | ||
3028 | /* 0110 0111 ... */ | 3028 | /* 0110 0111 ... */ |
3029 | /* 0 */ V(6, 6, 1), /* 364 */ | 3029 | /* 0 */ V(6, 6, 1), /* 364 */ |
3030 | /* 1 */ V(2, 8, 1), | 3030 | /* 1 */ V(2, 8, 1), |
3031 | 3031 | ||
3032 | /* 0110 1000 ... */ | 3032 | /* 0110 1000 ... */ |
3033 | /* 0 */ V(8, 2, 1), /* 366 */ | 3033 | /* 0 */ V(8, 2, 1), /* 366 */ |
3034 | /* 1 */ V(1, 8, 1), | 3034 | /* 1 */ V(1, 8, 1), |
3035 | 3035 | ||
3036 | /* 0110 1001 ... */ | 3036 | /* 0110 1001 ... */ |
3037 | /* 0 */ V(4, 7, 1), /* 368 */ | 3037 | /* 0 */ V(4, 7, 1), /* 368 */ |
3038 | /* 1 */ V(7, 4, 1), | 3038 | /* 1 */ V(7, 4, 1), |
3039 | 3039 | ||
3040 | /* 0110 1010 ... */ | 3040 | /* 0110 1010 ... */ |
3041 | /* 00 */ V(8, 1, 1), /* 370 */ | 3041 | /* 00 */ V(8, 1, 1), /* 370 */ |
3042 | /* 01 */ V(8, 1, 1), | 3042 | /* 01 */ V(8, 1, 1), |
3043 | /* 10 */ V(0, 8, 2), | 3043 | /* 10 */ V(0, 8, 2), |
3044 | /* 11 */ V(8, 0, 2), | 3044 | /* 11 */ V(8, 0, 2), |
3045 | 3045 | ||
3046 | /* 0110 1011 ... */ | 3046 | /* 0110 1011 ... */ |
3047 | /* 0 */ V(5, 6, 1), /* 374 */ | 3047 | /* 0 */ V(5, 6, 1), /* 374 */ |
3048 | /* 1 */ V(6, 5, 1), | 3048 | /* 1 */ V(6, 5, 1), |
3049 | 3049 | ||
3050 | /* 0110 1100 ... */ | 3050 | /* 0110 1100 ... */ |
3051 | /* 00 */ V(1, 7, 1), /* 376 */ | 3051 | /* 00 */ V(1, 7, 1), /* 376 */ |
3052 | /* 01 */ V(1, 7, 1), | 3052 | /* 01 */ V(1, 7, 1), |
3053 | /* 10 */ V(0, 7, 2), | 3053 | /* 10 */ V(0, 7, 2), |
3054 | /* 11 */ V(7, 0, 2), | 3054 | /* 11 */ V(7, 0, 2), |
3055 | 3055 | ||
3056 | /* 0110 1110 ... */ | 3056 | /* 0110 1110 ... */ |
3057 | /* 0 */ V(3, 7, 1), /* 380 */ | 3057 | /* 0 */ V(3, 7, 1), /* 380 */ |
3058 | /* 1 */ V(2, 7, 1), | 3058 | /* 1 */ V(2, 7, 1), |
3059 | 3059 | ||
3060 | /* 0111 1100 ... */ | 3060 | /* 0111 1100 ... */ |
3061 | /* 0 */ V(0, 6, 1), /* 382 */ | 3061 | /* 0 */ V(0, 6, 1), /* 382 */ |
3062 | /* 1 */ V(6, 0, 1), | 3062 | /* 1 */ V(6, 0, 1), |
3063 | 3063 | ||
3064 | /* 1000 0011 ... */ | 3064 | /* 1000 0011 ... */ |
3065 | /* 0 */ V(0, 5, 1), /* 384 */ | 3065 | /* 0 */ V(0, 5, 1), /* 384 */ |
3066 | /* 1 */ V(5, 0, 1) | 3066 | /* 1 */ V(5, 0, 1) |
3067 | }; | 3067 | }; |
3068 | 3068 | ||
diff --git a/apps/codecs/libmad/layer12.c b/apps/codecs/libmad/layer12.c index d294266e69..e00bb64530 100644 --- a/apps/codecs/libmad/layer12.c +++ b/apps/codecs/libmad/layer12.c | |||
@@ -69,7 +69,7 @@ mad_fixed_t const linear_table[14] ICONST_ATTR = { | |||
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * NAME: I_sample() | 72 | * NAME: I_sample() |
73 | * DESCRIPTION: decode one requantized Layer I sample from a bitstream | 73 | * DESCRIPTION: decode one requantized Layer I sample from a bitstream |
74 | */ | 74 | */ |
75 | static inline | 75 | static inline |
@@ -99,7 +99,7 @@ mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * NAME: layer->I() | 102 | * NAME: layer->I() |
103 | * DESCRIPTION: decode a single Layer I frame | 103 | * DESCRIPTION: decode a single Layer I frame |
104 | */ | 104 | */ |
105 | int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | 105 | int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) |
@@ -121,10 +121,10 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
121 | if (header->flags & MAD_FLAG_PROTECTION) { | 121 | if (header->flags & MAD_FLAG_PROTECTION) { |
122 | header->crc_check = | 122 | header->crc_check = |
123 | mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), | 123 | mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), |
124 | header->crc_check); | 124 | header->crc_check); |
125 | 125 | ||
126 | if (header->crc_check != header->crc_target && | 126 | if (header->crc_check != header->crc_target && |
127 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 127 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
128 | stream->error = MAD_ERROR_BADCRC; | 128 | stream->error = MAD_ERROR_BADCRC; |
129 | return -1; | 129 | return -1; |
130 | } | 130 | } |
@@ -137,8 +137,8 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
137 | nb = mad_bit_read(&stream->ptr, 4); | 137 | nb = mad_bit_read(&stream->ptr, 4); |
138 | 138 | ||
139 | if (nb == 15) { | 139 | if (nb == 15) { |
140 | stream->error = MAD_ERROR_BADBITALLOC; | 140 | stream->error = MAD_ERROR_BADBITALLOC; |
141 | return -1; | 141 | return -1; |
142 | } | 142 | } |
143 | 143 | ||
144 | allocation[ch][sb] = nb ? nb + 1 : 0; | 144 | allocation[ch][sb] = nb ? nb + 1 : 0; |
@@ -162,18 +162,18 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
162 | for (sb = 0; sb < 32; ++sb) { | 162 | for (sb = 0; sb < 32; ++sb) { |
163 | for (ch = 0; ch < nch; ++ch) { | 163 | for (ch = 0; ch < nch; ++ch) { |
164 | if (allocation[ch][sb]) { | 164 | if (allocation[ch][sb]) { |
165 | scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); | 165 | scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); |
166 | 166 | ||
167 | # if defined(OPT_STRICT) | 167 | # if defined(OPT_STRICT) |
168 | /* | 168 | /* |
169 | * Scalefactor index 63 does not appear in Table B.1 of | 169 | * Scalefactor index 63 does not appear in Table B.1 of |
170 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, | 170 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, |
171 | * so we only reject it if OPT_STRICT is defined. | 171 | * so we only reject it if OPT_STRICT is defined. |
172 | */ | 172 | */ |
173 | if (scalefactor[ch][sb] == 63) { | 173 | if (scalefactor[ch][sb] == 63) { |
174 | stream->error = MAD_ERROR_BADSCALEFACTOR; | 174 | stream->error = MAD_ERROR_BADSCALEFACTOR; |
175 | return -1; | 175 | return -1; |
176 | } | 176 | } |
177 | # endif | 177 | # endif |
178 | } | 178 | } |
179 | } | 179 | } |
@@ -184,27 +184,27 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
184 | for (s = 0; s < 12; ++s) { | 184 | for (s = 0; s < 12; ++s) { |
185 | for (sb = 0; sb < bound; ++sb) { | 185 | for (sb = 0; sb < bound; ++sb) { |
186 | for (ch = 0; ch < nch; ++ch) { | 186 | for (ch = 0; ch < nch; ++ch) { |
187 | nb = allocation[ch][sb]; | 187 | nb = allocation[ch][sb]; |
188 | (*frame->sbsample)[ch][s][sb] = nb ? | 188 | (*frame->sbsample)[ch][s][sb] = nb ? |
189 | mad_f_mul(I_sample(&stream->ptr, nb), | 189 | mad_f_mul(I_sample(&stream->ptr, nb), |
190 | sf_table[scalefactor[ch][sb]]) : 0; | 190 | sf_table[scalefactor[ch][sb]]) : 0; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | for (sb = bound; sb < 32; ++sb) { | 194 | for (sb = bound; sb < 32; ++sb) { |
195 | if ((nb = allocation[0][sb])) { | 195 | if ((nb = allocation[0][sb])) { |
196 | mad_fixed_t sample; | 196 | mad_fixed_t sample; |
197 | 197 | ||
198 | sample = I_sample(&stream->ptr, nb); | 198 | sample = I_sample(&stream->ptr, nb); |
199 | 199 | ||
200 | for (ch = 0; ch < nch; ++ch) { | 200 | for (ch = 0; ch < nch; ++ch) { |
201 | (*frame->sbsample)[ch][s][sb] = | 201 | (*frame->sbsample)[ch][s][sb] = |
202 | mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); | 202 | mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | else { | 205 | else { |
206 | for (ch = 0; ch < nch; ++ch) | 206 | for (ch = 0; ch < nch; ++ch) |
207 | (*frame->sbsample)[ch][s][sb] = 0; | 207 | (*frame->sbsample)[ch][s][sb] = 0; |
208 | } | 208 | } |
209 | } | 209 | } |
210 | } | 210 | } |
@@ -221,18 +221,18 @@ struct { | |||
221 | unsigned char const offsets[30]; | 221 | unsigned char const offsets[30]; |
222 | } const sbquant_table[5] = { | 222 | } const sbquant_table[5] = { |
223 | /* ISO/IEC 11172-3 Table B.2a */ | 223 | /* ISO/IEC 11172-3 Table B.2a */ |
224 | { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ | 224 | { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ |
225 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, | 225 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, |
226 | /* ISO/IEC 11172-3 Table B.2b */ | 226 | /* ISO/IEC 11172-3 Table B.2b */ |
227 | { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ | 227 | { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ |
228 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, | 228 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, |
229 | /* ISO/IEC 11172-3 Table B.2c */ | 229 | /* ISO/IEC 11172-3 Table B.2c */ |
230 | { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ | 230 | { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ |
231 | /* ISO/IEC 11172-3 Table B.2d */ | 231 | /* ISO/IEC 11172-3 Table B.2d */ |
232 | { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ | 232 | { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ |
233 | /* ISO/IEC 13818-3 Table B.1 */ | 233 | /* ISO/IEC 13818-3 Table B.1 */ |
234 | { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ | 234 | { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ |
235 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } | 235 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } |
236 | }; | 236 | }; |
237 | 237 | ||
238 | /* bit allocation table */ | 238 | /* bit allocation table */ |
@@ -275,13 +275,13 @@ struct quantclass { | |||
275 | }; | 275 | }; |
276 | 276 | ||
277 | /* | 277 | /* |
278 | * NAME: II_samples() | 278 | * NAME: II_samples() |
279 | * DESCRIPTION: decode three requantized Layer II samples from a bitstream | 279 | * DESCRIPTION: decode three requantized Layer II samples from a bitstream |
280 | */ | 280 | */ |
281 | static | 281 | static |
282 | void II_samples(struct mad_bitptr *ptr, | 282 | void II_samples(struct mad_bitptr *ptr, |
283 | struct quantclass const *quantclass, | 283 | struct quantclass const *quantclass, |
284 | mad_fixed_t output[3]) | 284 | mad_fixed_t output[3]) |
285 | { | 285 | { |
286 | unsigned int nb, s, sample[3]; | 286 | unsigned int nb, s, sample[3]; |
287 | 287 | ||
@@ -326,7 +326,7 @@ void II_samples(struct mad_bitptr *ptr, | |||
326 | } | 326 | } |
327 | 327 | ||
328 | /* | 328 | /* |
329 | * NAME: layer->II() | 329 | * NAME: layer->II() |
330 | * DESCRIPTION: decode a single Layer II frame | 330 | * DESCRIPTION: decode a single Layer II frame |
331 | */ | 331 | */ |
332 | int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | 332 | int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) |
@@ -358,19 +358,19 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
358 | * restriction. We enforce it if OPT_STRICT is defined. | 358 | * restriction. We enforce it if OPT_STRICT is defined. |
359 | */ | 359 | */ |
360 | if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { | 360 | if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { |
361 | stream->error = MAD_ERROR_BADMODE; | 361 | stream->error = MAD_ERROR_BADMODE; |
362 | return -1; | 362 | return -1; |
363 | } | 363 | } |
364 | # endif | 364 | # endif |
365 | } | 365 | } |
366 | else { /* nch == 1 */ | 366 | else { /* nch == 1 */ |
367 | if (bitrate_per_channel > 192000) { | 367 | if (bitrate_per_channel > 192000) { |
368 | /* | 368 | /* |
369 | * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, | 369 | * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, |
370 | * 320, or 384 kbps bitrates in Layer II. | 370 | * 320, or 384 kbps bitrates in Layer II. |
371 | */ | 371 | */ |
372 | stream->error = MAD_ERROR_BADMODE; | 372 | stream->error = MAD_ERROR_BADMODE; |
373 | return -1; | 373 | return -1; |
374 | } | 374 | } |
375 | } | 375 | } |
376 | 376 | ||
@@ -419,7 +419,7 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
419 | for (sb = 0; sb < sblimit; ++sb) { | 419 | for (sb = 0; sb < sblimit; ++sb) { |
420 | for (ch = 0; ch < nch; ++ch) { | 420 | for (ch = 0; ch < nch; ++ch) { |
421 | if (allocation[ch][sb]) | 421 | if (allocation[ch][sb]) |
422 | scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); | 422 | scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
@@ -428,10 +428,10 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
428 | if (header->flags & MAD_FLAG_PROTECTION) { | 428 | if (header->flags & MAD_FLAG_PROTECTION) { |
429 | header->crc_check = | 429 | header->crc_check = |
430 | mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), | 430 | mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), |
431 | header->crc_check); | 431 | header->crc_check); |
432 | 432 | ||
433 | if (header->crc_check != header->crc_target && | 433 | if (header->crc_check != header->crc_target && |
434 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 434 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
435 | stream->error = MAD_ERROR_BADCRC; | 435 | stream->error = MAD_ERROR_BADCRC; |
436 | return -1; | 436 | return -1; |
437 | } | 437 | } |
@@ -442,39 +442,39 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
442 | for (sb = 0; sb < sblimit; ++sb) { | 442 | for (sb = 0; sb < sblimit; ++sb) { |
443 | for (ch = 0; ch < nch; ++ch) { | 443 | for (ch = 0; ch < nch; ++ch) { |
444 | if (allocation[ch][sb]) { | 444 | if (allocation[ch][sb]) { |
445 | scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); | 445 | scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); |
446 | |||
447 | switch (scfsi[ch][sb]) { | ||
448 | case 2: | ||
449 | scalefactor[ch][sb][2] = | ||
450 | scalefactor[ch][sb][1] = | ||
451 | scalefactor[ch][sb][0]; | ||
452 | break; | ||
453 | |||
454 | case 0: | ||
455 | scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); | ||
456 | /* fall through */ | ||
457 | |||
458 | case 1: | ||
459 | case 3: | ||
460 | scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); | ||
461 | } | ||
462 | 446 | ||
463 | if (scfsi[ch][sb] & 1) | 447 | switch (scfsi[ch][sb]) { |
464 | scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; | 448 | case 2: |
449 | scalefactor[ch][sb][2] = | ||
450 | scalefactor[ch][sb][1] = | ||
451 | scalefactor[ch][sb][0]; | ||
452 | break; | ||
453 | |||
454 | case 0: | ||
455 | scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); | ||
456 | /* fall through */ | ||
457 | |||
458 | case 1: | ||
459 | case 3: | ||
460 | scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); | ||
461 | } | ||
462 | |||
463 | if (scfsi[ch][sb] & 1) | ||
464 | scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; | ||
465 | 465 | ||
466 | # if defined(OPT_STRICT) | 466 | # if defined(OPT_STRICT) |
467 | /* | 467 | /* |
468 | * Scalefactor index 63 does not appear in Table B.1 of | 468 | * Scalefactor index 63 does not appear in Table B.1 of |
469 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, | 469 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, |
470 | * so we only reject it if OPT_STRICT is defined. | 470 | * so we only reject it if OPT_STRICT is defined. |
471 | */ | 471 | */ |
472 | if (scalefactor[ch][sb][0] == 63 || | 472 | if (scalefactor[ch][sb][0] == 63 || |
473 | scalefactor[ch][sb][1] == 63 || | 473 | scalefactor[ch][sb][1] == 63 || |
474 | scalefactor[ch][sb][2] == 63) { | 474 | scalefactor[ch][sb][2] == 63) { |
475 | stream->error = MAD_ERROR_BADSCALEFACTOR; | 475 | stream->error = MAD_ERROR_BADSCALEFACTOR; |
476 | return -1; | 476 | return -1; |
477 | } | 477 | } |
478 | # endif | 478 | # endif |
479 | } | 479 | } |
480 | } | 480 | } |
@@ -485,50 +485,50 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
485 | for (gr = 0; gr < 12; ++gr) { | 485 | for (gr = 0; gr < 12; ++gr) { |
486 | for (sb = 0; sb < bound; ++sb) { | 486 | for (sb = 0; sb < bound; ++sb) { |
487 | for (ch = 0; ch < nch; ++ch) { | 487 | for (ch = 0; ch < nch; ++ch) { |
488 | if ((index = allocation[ch][sb])) { | 488 | if ((index = allocation[ch][sb])) { |
489 | int off = bitalloc_table[offsets[sb]].offset; | 489 | int off = bitalloc_table[offsets[sb]].offset; |
490 | index = offset_table[off][index - 1]; | 490 | index = offset_table[off][index - 1]; |
491 | 491 | ||
492 | II_samples(&stream->ptr, &qc_table[index], samples); | 492 | II_samples(&stream->ptr, &qc_table[index], samples); |
493 | 493 | ||
494 | for (s = 0; s < 3; ++s) { | 494 | for (s = 0; s < 3; ++s) { |
495 | (*frame->sbsample)[ch][3 * gr + s][sb] = | 495 | (*frame->sbsample)[ch][3 * gr + s][sb] = |
496 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); | 496 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); |
497 | } | 497 | } |
498 | } | 498 | } |
499 | else { | 499 | else { |
500 | for (s = 0; s < 3; ++s) | 500 | for (s = 0; s < 3; ++s) |
501 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; | 501 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; |
502 | } | 502 | } |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | for (sb = bound; sb < sblimit; ++sb) { | 506 | for (sb = bound; sb < sblimit; ++sb) { |
507 | if ((index = allocation[0][sb])) { | 507 | if ((index = allocation[0][sb])) { |
508 | int off = bitalloc_table[offsets[sb]].offset; | 508 | int off = bitalloc_table[offsets[sb]].offset; |
509 | index = offset_table[off][index - 1]; | 509 | index = offset_table[off][index - 1]; |
510 | 510 | ||
511 | II_samples(&stream->ptr, &qc_table[index], samples); | 511 | II_samples(&stream->ptr, &qc_table[index], samples); |
512 | 512 | ||
513 | for (ch = 0; ch < nch; ++ch) { | 513 | for (ch = 0; ch < nch; ++ch) { |
514 | for (s = 0; s < 3; ++s) { | 514 | for (s = 0; s < 3; ++s) { |
515 | (*frame->sbsample)[ch][3 * gr + s][sb] = | 515 | (*frame->sbsample)[ch][3 * gr + s][sb] = |
516 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); | 516 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | } | 519 | } |
520 | else { | 520 | else { |
521 | for (ch = 0; ch < nch; ++ch) { | 521 | for (ch = 0; ch < nch; ++ch) { |
522 | for (s = 0; s < 3; ++s) | 522 | for (s = 0; s < 3; ++s) |
523 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; | 523 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; |
524 | } | 524 | } |
525 | } | 525 | } |
526 | } | 526 | } |
527 | 527 | ||
528 | for (ch = 0; ch < nch; ++ch) { | 528 | for (ch = 0; ch < nch; ++ch) { |
529 | for (s = 0; s < 3; ++s) { | 529 | for (s = 0; s < 3; ++s) { |
530 | for (sb = sblimit; sb < 32; ++sb) | 530 | for (sb = sblimit; sb < 32; ++sb) |
531 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; | 531 | (*frame->sbsample)[ch][3 * gr + s][sb] = 0; |
532 | } | 532 | } |
533 | } | 533 | } |
534 | } | 534 | } |
diff --git a/apps/codecs/libmad/layer3.c b/apps/codecs/libmad/layer3.c index 2dcdeb96d4..752dbdbf63 100644 --- a/apps/codecs/libmad/layer3.c +++ b/apps/codecs/libmad/layer3.c | |||
@@ -57,7 +57,7 @@ | |||
57 | enum { | 57 | enum { |
58 | count1table_select = 0x01, | 58 | count1table_select = 0x01, |
59 | scalefac_scale = 0x02, | 59 | scalefac_scale = 0x02, |
60 | preflag = 0x04, | 60 | preflag = 0x04, |
61 | mixed_block_flag = 0x08 | 61 | mixed_block_flag = 0x08 |
62 | }; | 62 | }; |
63 | 63 | ||
@@ -88,7 +88,7 @@ struct sideinfo { | |||
88 | unsigned char region1_count; | 88 | unsigned char region1_count; |
89 | 89 | ||
90 | /* from main_data */ | 90 | /* from main_data */ |
91 | unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ | 91 | unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ |
92 | } ch[2]; | 92 | } ch[2]; |
93 | } gr[2]; | 93 | } gr[2]; |
94 | }; | 94 | }; |
@@ -502,14 +502,14 @@ mad_fixed_t const is_lsf_table[2][15] = { | |||
502 | }; | 502 | }; |
503 | 503 | ||
504 | /* | 504 | /* |
505 | * NAME: III_sideinfo() | 505 | * NAME: III_sideinfo() |
506 | * DESCRIPTION: decode frame side information from a bitstream | 506 | * DESCRIPTION: decode frame side information from a bitstream |
507 | */ | 507 | */ |
508 | static | 508 | static |
509 | enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, | 509 | enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, |
510 | int lsf, struct sideinfo *si, | 510 | int lsf, struct sideinfo *si, |
511 | unsigned int *data_bitlen, | 511 | unsigned int *data_bitlen, |
512 | unsigned int *priv_bitlen) | 512 | unsigned int *priv_bitlen) |
513 | { | 513 | { |
514 | unsigned int ngr, gr, ch, i; | 514 | unsigned int ngr, gr, ch, i; |
515 | enum mad_error result = MAD_ERROR_NONE; | 515 | enum mad_error result = MAD_ERROR_NONE; |
@@ -542,46 +542,46 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, | |||
542 | *data_bitlen += channel->part2_3_length; | 542 | *data_bitlen += channel->part2_3_length; |
543 | 543 | ||
544 | if (channel->big_values > 288 && result == 0) | 544 | if (channel->big_values > 288 && result == 0) |
545 | result = MAD_ERROR_BADBIGVALUES; | 545 | result = MAD_ERROR_BADBIGVALUES; |
546 | 546 | ||
547 | channel->flags = 0; | 547 | channel->flags = 0; |
548 | 548 | ||
549 | /* window_switching_flag */ | 549 | /* window_switching_flag */ |
550 | if (mad_bit_read(ptr, 1)) { | 550 | if (mad_bit_read(ptr, 1)) { |
551 | channel->block_type = mad_bit_read(ptr, 2); | 551 | channel->block_type = mad_bit_read(ptr, 2); |
552 | 552 | ||
553 | if (channel->block_type == 0 && result == 0) | 553 | if (channel->block_type == 0 && result == 0) |
554 | result = MAD_ERROR_BADBLOCKTYPE; | 554 | result = MAD_ERROR_BADBLOCKTYPE; |
555 | 555 | ||
556 | if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) | 556 | if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) |
557 | result = MAD_ERROR_BADSCFSI; | 557 | result = MAD_ERROR_BADSCFSI; |
558 | 558 | ||
559 | channel->region0_count = 7; | 559 | channel->region0_count = 7; |
560 | channel->region1_count = 36; | 560 | channel->region1_count = 36; |
561 | 561 | ||
562 | if (mad_bit_read(ptr, 1)) | 562 | if (mad_bit_read(ptr, 1)) |
563 | channel->flags |= mixed_block_flag; | 563 | channel->flags |= mixed_block_flag; |
564 | else if (channel->block_type == 2) | 564 | else if (channel->block_type == 2) |
565 | channel->region0_count = 8; | 565 | channel->region0_count = 8; |
566 | 566 | ||
567 | for (i = 0; i < 2; ++i) | 567 | for (i = 0; i < 2; ++i) |
568 | channel->table_select[i] = mad_bit_read(ptr, 5); | 568 | channel->table_select[i] = mad_bit_read(ptr, 5); |
569 | 569 | ||
570 | # if defined(DEBUG) | 570 | # if defined(DEBUG) |
571 | channel->table_select[2] = 4; /* not used */ | 571 | channel->table_select[2] = 4; /* not used */ |
572 | # endif | 572 | # endif |
573 | 573 | ||
574 | for (i = 0; i < 3; ++i) | 574 | for (i = 0; i < 3; ++i) |
575 | channel->subblock_gain[i] = mad_bit_read(ptr, 3); | 575 | channel->subblock_gain[i] = mad_bit_read(ptr, 3); |
576 | } | 576 | } |
577 | else { | 577 | else { |
578 | channel->block_type = 0; | 578 | channel->block_type = 0; |
579 | 579 | ||
580 | for (i = 0; i < 3; ++i) | 580 | for (i = 0; i < 3; ++i) |
581 | channel->table_select[i] = mad_bit_read(ptr, 5); | 581 | channel->table_select[i] = mad_bit_read(ptr, 5); |
582 | 582 | ||
583 | channel->region0_count = mad_bit_read(ptr, 4); | 583 | channel->region0_count = mad_bit_read(ptr, 4); |
584 | channel->region1_count = mad_bit_read(ptr, 3); | 584 | channel->region1_count = mad_bit_read(ptr, 3); |
585 | } | 585 | } |
586 | 586 | ||
587 | /* [preflag,] scalefac_scale, count1table_select */ | 587 | /* [preflag,] scalefac_scale, count1table_select */ |
@@ -593,13 +593,13 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, | |||
593 | } | 593 | } |
594 | 594 | ||
595 | /* | 595 | /* |
596 | * NAME: III_scalefactors_lsf() | 596 | * NAME: III_scalefactors_lsf() |
597 | * DESCRIPTION: decode channel scalefactors for LSF from a bitstream | 597 | * DESCRIPTION: decode channel scalefactors for LSF from a bitstream |
598 | */ | 598 | */ |
599 | static | 599 | static |
600 | unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | 600 | unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, |
601 | struct channel *channel, | 601 | struct channel *channel, |
602 | struct channel *gr1ch, int mode_extension) | 602 | struct channel *gr1ch, int mode_extension) |
603 | { | 603 | { |
604 | struct mad_bitptr start; | 604 | struct mad_bitptr start; |
605 | unsigned int scalefac_compress, index, slen[4], part, n, i; | 605 | unsigned int scalefac_compress, index, slen[4], part, n, i; |
@@ -646,7 +646,7 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | |||
646 | n = 0; | 646 | n = 0; |
647 | for (part = 0; part < 4; ++part) { | 647 | for (part = 0; part < 4; ++part) { |
648 | for (i = 0; i < nsfb[part]; ++i) | 648 | for (i = 0; i < nsfb[part]; ++i) |
649 | channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); | 649 | channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); |
650 | } | 650 | } |
651 | 651 | ||
652 | while (n < 39) | 652 | while (n < 39) |
@@ -691,10 +691,10 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | |||
691 | max = (1 << slen[part]) - 1; | 691 | max = (1 << slen[part]) - 1; |
692 | 692 | ||
693 | for (i = 0; i < nsfb[part]; ++i) { | 693 | for (i = 0; i < nsfb[part]; ++i) { |
694 | is_pos = mad_bit_read(ptr, slen[part]); | 694 | is_pos = mad_bit_read(ptr, slen[part]); |
695 | 695 | ||
696 | channel->scalefac[n] = is_pos; | 696 | channel->scalefac[n] = is_pos; |
697 | gr1ch->scalefac[n++] = (is_pos == max); | 697 | gr1ch->scalefac[n++] = (is_pos == max); |
698 | } | 698 | } |
699 | } | 699 | } |
700 | 700 | ||
@@ -708,12 +708,12 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | |||
708 | } | 708 | } |
709 | 709 | ||
710 | /* | 710 | /* |
711 | * NAME: III_scalefactors() | 711 | * NAME: III_scalefactors() |
712 | * DESCRIPTION: decode channel scalefactors of one granule from a bitstream | 712 | * DESCRIPTION: decode channel scalefactors of one granule from a bitstream |
713 | */ | 713 | */ |
714 | static | 714 | static |
715 | unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, | 715 | unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, |
716 | struct channel const *gr0ch, unsigned int scfsi) | 716 | struct channel const *gr0ch, unsigned int scfsi) |
717 | { | 717 | { |
718 | struct mad_bitptr start; | 718 | struct mad_bitptr start; |
719 | unsigned int slen1, slen2, sfbi; | 719 | unsigned int slen1, slen2, sfbi; |
@@ -743,38 +743,38 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, | |||
743 | else { /* channel->block_type != 2 */ | 743 | else { /* channel->block_type != 2 */ |
744 | if (scfsi & 0x8) { | 744 | if (scfsi & 0x8) { |
745 | for (sfbi = 0; sfbi < 6; ++sfbi) | 745 | for (sfbi = 0; sfbi < 6; ++sfbi) |
746 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 746 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
747 | } | 747 | } |
748 | else { | 748 | else { |
749 | for (sfbi = 0; sfbi < 6; ++sfbi) | 749 | for (sfbi = 0; sfbi < 6; ++sfbi) |
750 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); | 750 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); |
751 | } | 751 | } |
752 | 752 | ||
753 | if (scfsi & 0x4) { | 753 | if (scfsi & 0x4) { |
754 | for (sfbi = 6; sfbi < 11; ++sfbi) | 754 | for (sfbi = 6; sfbi < 11; ++sfbi) |
755 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 755 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
756 | } | 756 | } |
757 | else { | 757 | else { |
758 | for (sfbi = 6; sfbi < 11; ++sfbi) | 758 | for (sfbi = 6; sfbi < 11; ++sfbi) |
759 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); | 759 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); |
760 | } | 760 | } |
761 | 761 | ||
762 | if (scfsi & 0x2) { | 762 | if (scfsi & 0x2) { |
763 | for (sfbi = 11; sfbi < 16; ++sfbi) | 763 | for (sfbi = 11; sfbi < 16; ++sfbi) |
764 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 764 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
765 | } | 765 | } |
766 | else { | 766 | else { |
767 | for (sfbi = 11; sfbi < 16; ++sfbi) | 767 | for (sfbi = 11; sfbi < 16; ++sfbi) |
768 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); | 768 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); |
769 | } | 769 | } |
770 | 770 | ||
771 | if (scfsi & 0x1) { | 771 | if (scfsi & 0x1) { |
772 | for (sfbi = 16; sfbi < 21; ++sfbi) | 772 | for (sfbi = 16; sfbi < 21; ++sfbi) |
773 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 773 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
774 | } | 774 | } |
775 | else { | 775 | else { |
776 | for (sfbi = 16; sfbi < 21; ++sfbi) | 776 | for (sfbi = 16; sfbi < 21; ++sfbi) |
777 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); | 777 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); |
778 | } | 778 | } |
779 | 779 | ||
780 | channel->scalefac[21] = 0; | 780 | channel->scalefac[21] = 0; |
@@ -806,12 +806,12 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, | |||
806 | */ | 806 | */ |
807 | 807 | ||
808 | /* | 808 | /* |
809 | * NAME: III_exponents() | 809 | * NAME: III_exponents() |
810 | * DESCRIPTION: calculate scalefactor exponents | 810 | * DESCRIPTION: calculate scalefactor exponents |
811 | */ | 811 | */ |
812 | static | 812 | static |
813 | void III_exponents(struct channel const *channel, | 813 | void III_exponents(struct channel const *channel, |
814 | unsigned char const *sfbwidth, signed int exponents[39]) | 814 | unsigned char const *sfbwidth, signed int exponents[39]) |
815 | { | 815 | { |
816 | signed int gain; | 816 | signed int gain; |
817 | unsigned int scalefac_multiplier, sfbi; | 817 | unsigned int scalefac_multiplier, sfbi; |
@@ -833,11 +833,11 @@ void III_exponents(struct channel const *channel, | |||
833 | /* long block subbands 0-1 */ | 833 | /* long block subbands 0-1 */ |
834 | 834 | ||
835 | while (l < 36) { | 835 | while (l < 36) { |
836 | exponents[sfbi] = gain - | 836 | exponents[sfbi] = gain - |
837 | (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << | 837 | (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << |
838 | scalefac_multiplier); | 838 | scalefac_multiplier); |
839 | 839 | ||
840 | l += sfbwidth[sfbi++]; | 840 | l += sfbwidth[sfbi++]; |
841 | } | 841 | } |
842 | } | 842 | } |
843 | 843 | ||
@@ -849,11 +849,11 @@ void III_exponents(struct channel const *channel, | |||
849 | 849 | ||
850 | while (l < 576) { | 850 | while (l < 576) { |
851 | exponents[sfbi + 0] = gain0 - | 851 | exponents[sfbi + 0] = gain0 - |
852 | (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); | 852 | (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); |
853 | exponents[sfbi + 1] = gain1 - | 853 | exponents[sfbi + 1] = gain1 - |
854 | (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); | 854 | (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); |
855 | exponents[sfbi + 2] = gain2 - | 855 | exponents[sfbi + 2] = gain2 - |
856 | (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); | 856 | (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); |
857 | unsigned int w = sfbwidth[sfbi]; | 857 | unsigned int w = sfbwidth[sfbi]; |
858 | l += 3 * w; | 858 | l += 3 * w; |
859 | sfbi += 3; | 859 | sfbi += 3; |
@@ -862,22 +862,22 @@ void III_exponents(struct channel const *channel, | |||
862 | else { /* channel->block_type != 2 */ | 862 | else { /* channel->block_type != 2 */ |
863 | if (channel->flags & preflag) { | 863 | if (channel->flags & preflag) { |
864 | for (sfbi = 0; sfbi < 22; ++sfbi) { | 864 | for (sfbi = 0; sfbi < 22; ++sfbi) { |
865 | exponents[sfbi] = gain - | 865 | exponents[sfbi] = gain - |
866 | (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << | 866 | (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << |
867 | scalefac_multiplier); | 867 | scalefac_multiplier); |
868 | } | 868 | } |
869 | } | 869 | } |
870 | else { | 870 | else { |
871 | for (sfbi = 0; sfbi < 22; ++sfbi) { | 871 | for (sfbi = 0; sfbi < 22; ++sfbi) { |
872 | exponents[sfbi] = gain - | 872 | exponents[sfbi] = gain - |
873 | (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); | 873 | (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); |
874 | } | 874 | } |
875 | } | 875 | } |
876 | } | 876 | } |
877 | } | 877 | } |
878 | 878 | ||
879 | /* | 879 | /* |
880 | * NAME: III_requantize() | 880 | * NAME: III_requantize() |
881 | * DESCRIPTION: requantize one (positive) value | 881 | * DESCRIPTION: requantize one (positive) value |
882 | */ | 882 | */ |
883 | static | 883 | static |
@@ -910,7 +910,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
910 | /* overflow */ | 910 | /* overflow */ |
911 | # if defined(DEBUG) | 911 | # if defined(DEBUG) |
912 | fprintf(stderr, "requantize overflow (%f * 2^%d)\n", | 912 | fprintf(stderr, "requantize overflow (%f * 2^%d)\n", |
913 | mad_f_todouble(requantized), exp); | 913 | mad_f_todouble(requantized), exp); |
914 | # endif | 914 | # endif |
915 | requantized = MAD_F_MAX; | 915 | requantized = MAD_F_MAX; |
916 | } | 916 | } |
@@ -939,14 +939,14 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
939 | ((cache) & (1 << ((sz) - 1))) | 939 | ((cache) & (1 << ((sz) - 1))) |
940 | 940 | ||
941 | /* | 941 | /* |
942 | * NAME: III_huffdecode() | 942 | * NAME: III_huffdecode() |
943 | * DESCRIPTION: decode Huffman code words of one channel of one granule | 943 | * DESCRIPTION: decode Huffman code words of one channel of one granule |
944 | */ | 944 | */ |
945 | static | 945 | static |
946 | enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | 946 | enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], |
947 | struct channel *channel, | 947 | struct channel *channel, |
948 | unsigned char const *sfbwidth, | 948 | unsigned char const *sfbwidth, |
949 | unsigned int part2_length) | 949 | unsigned int part2_length) |
950 | { | 950 | { |
951 | unsigned int bits; | 951 | unsigned int bits; |
952 | signed int exponents[39], exp; | 952 | signed int exponents[39], exp; |
@@ -999,23 +999,23 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
999 | else | 999 | else |
1000 | if(region == 0) | 1000 | if(region == 0) |
1001 | rcount = channel->region1_count + 1; | 1001 | rcount = channel->region1_count + 1; |
1002 | else | 1002 | else |
1003 | rcount = 0; /* all remaining */ | 1003 | rcount = 0; /* all remaining */ |
1004 | 1004 | ||
1005 | entry = &mad_huff_pair_table[channel->table_select[++region]]; | 1005 | entry = &mad_huff_pair_table[channel->table_select[++region]]; |
1006 | table = entry->table; | 1006 | table = entry->table; |
1007 | linbits = entry->linbits; | 1007 | linbits = entry->linbits; |
1008 | startbits = entry->startbits; | 1008 | startbits = entry->startbits; |
1009 | 1009 | ||
1010 | if(table == 0) | 1010 | if(table == 0) |
1011 | return MAD_ERROR_BADHUFFTABLE; | 1011 | return MAD_ERROR_BADHUFFTABLE; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | if(exp != *expptr) | 1014 | if(exp != *expptr) |
1015 | { | 1015 | { |
1016 | exp = *expptr; | 1016 | exp = *expptr; |
1017 | /* clear cache */ | 1017 | /* clear cache */ |
1018 | memset(reqcache, 0, sizeof(reqcache)); | 1018 | memset(reqcache, 0, sizeof(reqcache)); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | ++expptr; | 1021 | ++expptr; |
@@ -1052,10 +1052,10 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1052 | 1052 | ||
1053 | cachesz -= pair->value.hlen; | 1053 | cachesz -= pair->value.hlen; |
1054 | 1054 | ||
1055 | /* x (0..14) */ | 1055 | /* x (0..14) */ |
1056 | value = pair->value.x; | 1056 | value = pair->value.x; |
1057 | if(value == 0) | 1057 | if(value == 0) |
1058 | xr[0] = 0; | 1058 | xr[0] = 0; |
1059 | else | 1059 | else |
1060 | { | 1060 | { |
1061 | if(value == 15) | 1061 | if(value == 15) |
@@ -1071,24 +1071,24 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1071 | cachesz += bits; | 1071 | cachesz += bits; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | requantized = III_requantize(15+MASK(bitcache, cachesz, linbits), exp); | 1074 | requantized = III_requantize(15+MASK(bitcache, cachesz, linbits), exp); |
1075 | cachesz -= linbits; | 1075 | cachesz -= linbits; |
1076 | } | 1076 | } |
1077 | else | 1077 | else |
1078 | { | 1078 | { |
1079 | if(reqcache[value]) | 1079 | if(reqcache[value]) |
1080 | requantized = reqcache[value]; | 1080 | requantized = reqcache[value]; |
1081 | else | 1081 | else |
1082 | requantized = reqcache[value] = III_requantize(value, exp); | 1082 | requantized = reqcache[value] = III_requantize(value, exp); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; | 1085 | xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /* y (0..14) */ | 1088 | /* y (0..14) */ |
1089 | value = pair->value.y; | 1089 | value = pair->value.y; |
1090 | if(value == 0) | 1090 | if(value == 0) |
1091 | xr[1] = 0; | 1091 | xr[1] = 0; |
1092 | else | 1092 | else |
1093 | { | 1093 | { |
1094 | if(value == 15) | 1094 | if(value == 15) |
@@ -1109,12 +1109,12 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1109 | } | 1109 | } |
1110 | else | 1110 | else |
1111 | { | 1111 | { |
1112 | if(reqcache[value]) | 1112 | if(reqcache[value]) |
1113 | requantized = reqcache[value]; | 1113 | requantized = reqcache[value]; |
1114 | else | 1114 | else |
1115 | requantized = reqcache[value] = III_requantize(value, exp); | 1115 | requantized = reqcache[value] = III_requantize(value, exp); |
1116 | } | 1116 | } |
1117 | xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; | 1117 | xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; |
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
@@ -1162,32 +1162,32 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1162 | 1162 | ||
1163 | cachesz -= pair->value.hlen; | 1163 | cachesz -= pair->value.hlen; |
1164 | 1164 | ||
1165 | /* x (0..1) */ | 1165 | /* x (0..1) */ |
1166 | value = pair->value.x; | 1166 | value = pair->value.x; |
1167 | if(value == 0) | 1167 | if(value == 0) |
1168 | xr[0] = 0; | 1168 | xr[0] = 0; |
1169 | else | 1169 | else |
1170 | { | 1170 | { |
1171 | if(reqcache[value]) | 1171 | if(reqcache[value]) |
1172 | requantized = reqcache[value]; | 1172 | requantized = reqcache[value]; |
1173 | else | 1173 | else |
1174 | requantized = reqcache[value] = III_requantize(value, exp); | 1174 | requantized = reqcache[value] = III_requantize(value, exp); |
1175 | 1175 | ||
1176 | xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; | 1176 | xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | /* y (0..1) */ | 1179 | /* y (0..1) */ |
1180 | value = pair->value.y; | 1180 | value = pair->value.y; |
1181 | if(value == 0) | 1181 | if(value == 0) |
1182 | xr[1] = 0; | 1182 | xr[1] = 0; |
1183 | else | 1183 | else |
1184 | { | 1184 | { |
1185 | if(reqcache[value]) | 1185 | if(reqcache[value]) |
1186 | requantized = reqcache[value]; | 1186 | requantized = reqcache[value]; |
1187 | else | 1187 | else |
1188 | requantized = reqcache[value] = III_requantize(value, exp); | 1188 | requantized = reqcache[value] = III_requantize(value, exp); |
1189 | 1189 | ||
1190 | xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; | 1190 | xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; |
1191 | } | 1191 | } |
1192 | } | 1192 | } |
1193 | } | 1193 | } |
@@ -1218,9 +1218,9 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1218 | if(cachesz < 0) | 1218 | if(cachesz < 0) |
1219 | return MAD_ERROR_BADHUFFDATA; /* cache underrun */ | 1219 | return MAD_ERROR_BADHUFFDATA; /* cache underrun */ |
1220 | 1220 | ||
1221 | bits = MAXLSHIFT - cachesz; | 1221 | bits = MAXLSHIFT - cachesz; |
1222 | bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); | 1222 | bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); |
1223 | cachesz += bits; | 1223 | cachesz += bits; |
1224 | bits_left -= bits; | 1224 | bits_left -= bits; |
1225 | } | 1225 | } |
1226 | 1226 | ||
@@ -1228,53 +1228,53 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1228 | 1228 | ||
1229 | /* quad tables guaranteed to have at most one extra lookup */ | 1229 | /* quad tables guaranteed to have at most one extra lookup */ |
1230 | if (!quad->final) { | 1230 | if (!quad->final) { |
1231 | cachesz -= 4; | 1231 | cachesz -= 4; |
1232 | 1232 | ||
1233 | quad = &table[quad->ptr.offset + | 1233 | quad = &table[quad->ptr.offset + |
1234 | MASK(bitcache, cachesz, quad->ptr.bits)]; | 1234 | MASK(bitcache, cachesz, quad->ptr.bits)]; |
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | cachesz -= quad->value.hlen; | 1237 | cachesz -= quad->value.hlen; |
1238 | 1238 | ||
1239 | if (xr == sfbound) { | 1239 | if (xr == sfbound) { |
1240 | sfbound += *sfbwidth++; | 1240 | sfbound += *sfbwidth++; |
1241 | 1241 | ||
1242 | if (exp != *expptr) { | 1242 | if (exp != *expptr) { |
1243 | exp = *expptr; | 1243 | exp = *expptr; |
1244 | requantized = III_requantize(1, exp); | 1244 | requantized = III_requantize(1, exp); |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | ++expptr; | 1247 | ++expptr; |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | /* v (0..1) */ | 1250 | /* v (0..1) */ |
1251 | xr[0] = quad->value.v ? | 1251 | xr[0] = quad->value.v ? |
1252 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1252 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1253 | 1253 | ||
1254 | /* w (0..1) */ | 1254 | /* w (0..1) */ |
1255 | xr[1] = quad->value.w ? | 1255 | xr[1] = quad->value.w ? |
1256 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1256 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1257 | 1257 | ||
1258 | xr += 2; | 1258 | xr += 2; |
1259 | 1259 | ||
1260 | if (xr == sfbound) { | 1260 | if (xr == sfbound) { |
1261 | sfbound += *sfbwidth++; | 1261 | sfbound += *sfbwidth++; |
1262 | 1262 | ||
1263 | if (exp != *expptr) { | 1263 | if (exp != *expptr) { |
1264 | exp = *expptr; | 1264 | exp = *expptr; |
1265 | requantized = III_requantize(1, exp); | 1265 | requantized = III_requantize(1, exp); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | ++expptr; | 1268 | ++expptr; |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | /* x (0..1) */ | 1271 | /* x (0..1) */ |
1272 | xr[0] = quad->value.x ? | 1272 | xr[0] = quad->value.x ? |
1273 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1273 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1274 | 1274 | ||
1275 | /* y (0..1) */ | 1275 | /* y (0..1) */ |
1276 | xr[1] = quad->value.y ? | 1276 | xr[1] = quad->value.y ? |
1277 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1277 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1278 | 1278 | ||
1279 | xr += 2; | 1279 | xr += 2; |
1280 | } | 1280 | } |
@@ -1282,7 +1282,7 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1282 | if(bits_left + cachesz < 0) | 1282 | if(bits_left + cachesz < 0) |
1283 | { | 1283 | { |
1284 | /* technically the bitstream is misformatted, but apparently | 1284 | /* technically the bitstream is misformatted, but apparently |
1285 | some encoders are just a bit sloppy with stuffing bits */ | 1285 | some encoders are just a bit sloppy with stuffing bits */ |
1286 | xr -= 4; | 1286 | xr -= 4; |
1287 | } | 1287 | } |
1288 | } | 1288 | } |
@@ -1297,12 +1297,12 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], | |||
1297 | # undef MASK1BIT | 1297 | # undef MASK1BIT |
1298 | 1298 | ||
1299 | /* | 1299 | /* |
1300 | * NAME: III_reorder() | 1300 | * NAME: III_reorder() |
1301 | * DESCRIPTION: reorder frequency lines of a short block into subband order | 1301 | * DESCRIPTION: reorder frequency lines of a short block into subband order |
1302 | */ | 1302 | */ |
1303 | static | 1303 | static |
1304 | void III_reorder(mad_fixed_t xr[576], struct channel const *channel, | 1304 | void III_reorder(mad_fixed_t xr[576], struct channel const *channel, |
1305 | unsigned char const sfbwidth[39]) | 1305 | unsigned char const sfbwidth[39]) |
1306 | { | 1306 | { |
1307 | mad_fixed_t tmp[32][3][6]; | 1307 | mad_fixed_t tmp[32][3][6]; |
1308 | unsigned int sb, l, f, w, sbw[3], sw[3]; | 1308 | unsigned int sb, l, f, w, sbw[3], sw[3]; |
@@ -1345,14 +1345,14 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel, | |||
1345 | } | 1345 | } |
1346 | 1346 | ||
1347 | /* | 1347 | /* |
1348 | * NAME: III_stereo() | 1348 | * NAME: III_stereo() |
1349 | * DESCRIPTION: perform joint stereo processing on a granule | 1349 | * DESCRIPTION: perform joint stereo processing on a granule |
1350 | */ | 1350 | */ |
1351 | static | 1351 | static |
1352 | enum mad_error III_stereo(mad_fixed_t xr[2][576], | 1352 | enum mad_error III_stereo(mad_fixed_t xr[2][576], |
1353 | struct granule const *granule, | 1353 | struct granule const *granule, |
1354 | struct mad_header *header, | 1354 | struct mad_header *header, |
1355 | unsigned char const *sfbwidth) | 1355 | unsigned char const *sfbwidth) |
1356 | { | 1356 | { |
1357 | short modes[39]; | 1357 | short modes[39]; |
1358 | unsigned int sfbi, l, n, i; | 1358 | unsigned int sfbi, l, n, i; |
@@ -1385,55 +1385,55 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1385 | sfbi = l = 0; | 1385 | sfbi = l = 0; |
1386 | 1386 | ||
1387 | if (right_ch->flags & mixed_block_flag) { | 1387 | if (right_ch->flags & mixed_block_flag) { |
1388 | while (l < 36) { | 1388 | while (l < 36) { |
1389 | n = sfbwidth[sfbi++]; | 1389 | n = sfbwidth[sfbi++]; |
1390 | 1390 | ||
1391 | for (i = 0; i < n; ++i) { | 1391 | for (i = 0; i < n; ++i) { |
1392 | if (right_xr[i]) { | 1392 | if (right_xr[i]) { |
1393 | lower = sfbi; | 1393 | lower = sfbi; |
1394 | break; | 1394 | break; |
1395 | } | 1395 | } |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | right_xr += n; | 1398 | right_xr += n; |
1399 | l += n; | 1399 | l += n; |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | start = sfbi; | 1402 | start = sfbi; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | w = 0; | 1405 | w = 0; |
1406 | while (l < 576) { | 1406 | while (l < 576) { |
1407 | n = sfbwidth[sfbi++]; | 1407 | n = sfbwidth[sfbi++]; |
1408 | 1408 | ||
1409 | for (i = 0; i < n; ++i) { | 1409 | for (i = 0; i < n; ++i) { |
1410 | if (right_xr[i]) { | 1410 | if (right_xr[i]) { |
1411 | max = bound[w] = sfbi; | 1411 | max = bound[w] = sfbi; |
1412 | break; | 1412 | break; |
1413 | } | 1413 | } |
1414 | } | 1414 | } |
1415 | 1415 | ||
1416 | right_xr += n; | 1416 | right_xr += n; |
1417 | l += n; | 1417 | l += n; |
1418 | w = (w + 1) % 3; | 1418 | w = (w + 1) % 3; |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | if (max) | 1421 | if (max) |
1422 | lower = start; | 1422 | lower = start; |
1423 | 1423 | ||
1424 | /* long blocks */ | 1424 | /* long blocks */ |
1425 | 1425 | ||
1426 | for (i = 0; i < lower; ++i) | 1426 | for (i = 0; i < lower; ++i) |
1427 | modes[i] = header->mode_extension & ~I_STEREO; | 1427 | modes[i] = header->mode_extension & ~I_STEREO; |
1428 | 1428 | ||
1429 | /* short blocks */ | 1429 | /* short blocks */ |
1430 | 1430 | ||
1431 | w = 0; | 1431 | w = 0; |
1432 | for (i = start; i < max; ++i) { | 1432 | for (i = start; i < max; ++i) { |
1433 | if (i < bound[w]) | 1433 | if (i < bound[w]) |
1434 | modes[i] = header->mode_extension & ~I_STEREO; | 1434 | modes[i] = header->mode_extension & ~I_STEREO; |
1435 | 1435 | ||
1436 | w = (w + 1) % 3; | 1436 | w = (w + 1) % 3; |
1437 | } | 1437 | } |
1438 | } | 1438 | } |
1439 | else { /* right_ch->block_type != 2 */ | 1439 | else { /* right_ch->block_type != 2 */ |
@@ -1441,20 +1441,20 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1441 | 1441 | ||
1442 | bound = 0; | 1442 | bound = 0; |
1443 | for (sfbi = l = 0; l < 576; l += n) { | 1443 | for (sfbi = l = 0; l < 576; l += n) { |
1444 | n = sfbwidth[sfbi++]; | 1444 | n = sfbwidth[sfbi++]; |
1445 | 1445 | ||
1446 | for (i = 0; i < n; ++i) { | 1446 | for (i = 0; i < n; ++i) { |
1447 | if (right_xr[i]) { | 1447 | if (right_xr[i]) { |
1448 | bound = sfbi; | 1448 | bound = sfbi; |
1449 | break; | 1449 | break; |
1450 | } | 1450 | } |
1451 | } | 1451 | } |
1452 | 1452 | ||
1453 | right_xr += n; | 1453 | right_xr += n; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | for (i = 0; i < bound; ++i) | 1456 | for (i = 0; i < bound; ++i) |
1457 | modes[i] = header->mode_extension & ~I_STEREO; | 1457 | modes[i] = header->mode_extension & ~I_STEREO; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | /* now do the actual processing */ | 1460 | /* now do the actual processing */ |
@@ -1467,62 +1467,62 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1467 | lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; | 1467 | lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; |
1468 | 1468 | ||
1469 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1469 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1470 | n = sfbwidth[sfbi]; | 1470 | n = sfbwidth[sfbi]; |
1471 | 1471 | ||
1472 | if (!(modes[sfbi] & I_STEREO)) | 1472 | if (!(modes[sfbi] & I_STEREO)) |
1473 | continue; | 1473 | continue; |
1474 | 1474 | ||
1475 | if (illegal_pos[sfbi]) { | 1475 | if (illegal_pos[sfbi]) { |
1476 | modes[sfbi] &= ~I_STEREO; | 1476 | modes[sfbi] &= ~I_STEREO; |
1477 | continue; | 1477 | continue; |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | is_pos = right_ch->scalefac[sfbi]; | 1480 | is_pos = right_ch->scalefac[sfbi]; |
1481 | 1481 | ||
1482 | for (i = 0; i < n; ++i) { | 1482 | for (i = 0; i < n; ++i) { |
1483 | register mad_fixed_t left; | 1483 | register mad_fixed_t left; |
1484 | 1484 | ||
1485 | left = xr[0][l + i]; | 1485 | left = xr[0][l + i]; |
1486 | 1486 | ||
1487 | if (is_pos == 0) | 1487 | if (is_pos == 0) |
1488 | xr[1][l + i] = left; | 1488 | xr[1][l + i] = left; |
1489 | else { | 1489 | else { |
1490 | register mad_fixed_t opposite; | 1490 | register mad_fixed_t opposite; |
1491 | 1491 | ||
1492 | opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); | 1492 | opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); |
1493 | 1493 | ||
1494 | if (is_pos & 1) { | 1494 | if (is_pos & 1) { |
1495 | xr[0][l + i] = opposite; | 1495 | xr[0][l + i] = opposite; |
1496 | xr[1][l + i] = left; | 1496 | xr[1][l + i] = left; |
1497 | } | ||
1498 | else | ||
1499 | xr[1][l + i] = opposite; | ||
1500 | } | ||
1497 | } | 1501 | } |
1498 | else | ||
1499 | xr[1][l + i] = opposite; | ||
1500 | } | ||
1501 | } | ||
1502 | } | 1502 | } |
1503 | } | 1503 | } |
1504 | else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ | 1504 | else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ |
1505 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1505 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1506 | n = sfbwidth[sfbi]; | 1506 | n = sfbwidth[sfbi]; |
1507 | 1507 | ||
1508 | if (!(modes[sfbi] & I_STEREO)) | 1508 | if (!(modes[sfbi] & I_STEREO)) |
1509 | continue; | 1509 | continue; |
1510 | 1510 | ||
1511 | is_pos = right_ch->scalefac[sfbi]; | 1511 | is_pos = right_ch->scalefac[sfbi]; |
1512 | 1512 | ||
1513 | if (is_pos >= 7) { /* illegal intensity position */ | 1513 | if (is_pos >= 7) { /* illegal intensity position */ |
1514 | modes[sfbi] &= ~I_STEREO; | 1514 | modes[sfbi] &= ~I_STEREO; |
1515 | continue; | 1515 | continue; |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | for (i = 0; i < n; ++i) { | 1518 | for (i = 0; i < n; ++i) { |
1519 | register mad_fixed_t left; | 1519 | register mad_fixed_t left; |
1520 | 1520 | ||
1521 | left = xr[0][l + i]; | 1521 | left = xr[0][l + i]; |
1522 | 1522 | ||
1523 | xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); | 1523 | xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); |
1524 | xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); | 1524 | xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); |
1525 | } | 1525 | } |
1526 | } | 1526 | } |
1527 | } | 1527 | } |
1528 | } | 1528 | } |
@@ -1540,16 +1540,16 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1540 | n = sfbwidth[sfbi]; | 1540 | n = sfbwidth[sfbi]; |
1541 | 1541 | ||
1542 | if (modes[sfbi] != MS_STEREO) | 1542 | if (modes[sfbi] != MS_STEREO) |
1543 | continue; | 1543 | continue; |
1544 | 1544 | ||
1545 | for (i = 0; i < n; ++i) { | 1545 | for (i = 0; i < n; ++i) { |
1546 | register mad_fixed_t m, s; | 1546 | register mad_fixed_t m, s; |
1547 | 1547 | ||
1548 | m = xr[0][l + i]; | 1548 | m = xr[0][l + i]; |
1549 | s = xr[1][l + i]; | 1549 | s = xr[1][l + i]; |
1550 | 1550 | ||
1551 | xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ | 1551 | xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ |
1552 | xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ | 1552 | xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ |
1553 | } | 1553 | } |
1554 | } | 1554 | } |
1555 | } | 1555 | } |
@@ -1561,7 +1561,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1561 | void III_aliasreduce(mad_fixed_t xr[576], int lines); | 1561 | void III_aliasreduce(mad_fixed_t xr[576], int lines); |
1562 | #else | 1562 | #else |
1563 | /* | 1563 | /* |
1564 | * NAME: III_aliasreduce() | 1564 | * NAME: III_aliasreduce() |
1565 | * DESCRIPTION: perform frequency line alias reduction | 1565 | * DESCRIPTION: perform frequency line alias reduction |
1566 | */ | 1566 | */ |
1567 | static | 1567 | static |
@@ -1598,15 +1598,15 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) | |||
1598 | xr[-1 - i] = a; | 1598 | xr[-1 - i] = a; |
1599 | xr[ i] = b; | 1599 | xr[ i] = b; |
1600 | # else | 1600 | # else |
1601 | MAD_F_ML0(hi, lo, a, cs[i]); | 1601 | MAD_F_ML0(hi, lo, a, cs[i]); |
1602 | MAD_F_MLA(hi, lo, -b, ca[i]); | 1602 | MAD_F_MLA(hi, lo, -b, ca[i]); |
1603 | 1603 | ||
1604 | xr[-1 - i] = MAD_F_MLZ(hi, lo); | 1604 | xr[-1 - i] = MAD_F_MLZ(hi, lo); |
1605 | 1605 | ||
1606 | MAD_F_ML0(hi, lo, b, cs[i]); | 1606 | MAD_F_ML0(hi, lo, b, cs[i]); |
1607 | MAD_F_MLA(hi, lo, a, ca[i]); | 1607 | MAD_F_MLA(hi, lo, a, ca[i]); |
1608 | 1608 | ||
1609 | xr[ i] = MAD_F_MLZ(hi, lo); | 1609 | xr[ i] = MAD_F_MLZ(hi, lo); |
1610 | # endif | 1610 | # endif |
1611 | # if defined(ASO_ZEROCHECK) | 1611 | # if defined(ASO_ZEROCHECK) |
1612 | } | 1612 | } |
@@ -1774,7 +1774,7 @@ void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18]) | |||
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | /* | 1776 | /* |
1777 | * NAME: imdct36 | 1777 | * NAME: imdct36 |
1778 | * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm | 1778 | * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm |
1779 | */ | 1779 | */ |
1780 | static inline | 1780 | static inline |
@@ -1807,7 +1807,7 @@ void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) | |||
1807 | } | 1807 | } |
1808 | # else | 1808 | # else |
1809 | /* | 1809 | /* |
1810 | * NAME: imdct36 | 1810 | * NAME: imdct36 |
1811 | * DESCRIPTION: perform X[18]->x[36] IMDCT | 1811 | * DESCRIPTION: perform X[18]->x[36] IMDCT |
1812 | */ | 1812 | */ |
1813 | 1813 | ||
@@ -2737,12 +2737,12 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) | |||
2737 | # endif | 2737 | # endif |
2738 | 2738 | ||
2739 | /* | 2739 | /* |
2740 | * NAME: III_imdct_l() | 2740 | * NAME: III_imdct_l() |
2741 | * DESCRIPTION: perform IMDCT and windowing for long blocks | 2741 | * DESCRIPTION: perform IMDCT and windowing for long blocks |
2742 | */ | 2742 | */ |
2743 | static | 2743 | static |
2744 | void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | 2744 | void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], |
2745 | unsigned int block_type) | 2745 | unsigned int block_type) |
2746 | { | 2746 | { |
2747 | unsigned int i; | 2747 | unsigned int i; |
2748 | 2748 | ||
@@ -2762,10 +2762,10 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
2762 | tmp2 = window_l[1]; | 2762 | tmp2 = window_l[1]; |
2763 | 2763 | ||
2764 | for (i = 0; i < 34; i += 2) { | 2764 | for (i = 0; i < 34; i += 2) { |
2765 | z[i + 0] = mad_f_mul(z[i + 0], tmp1); | 2765 | z[i + 0] = mad_f_mul(z[i + 0], tmp1); |
2766 | tmp1 = window_l[i + 2]; | 2766 | tmp1 = window_l[i + 2]; |
2767 | z[i + 1] = mad_f_mul(z[i + 1], tmp2); | 2767 | z[i + 1] = mad_f_mul(z[i + 1], tmp2); |
2768 | tmp2 = window_l[i + 3]; | 2768 | tmp2 = window_l[i + 3]; |
2769 | } | 2769 | } |
2770 | 2770 | ||
2771 | z[34] = mad_f_mul(z[34], tmp1); | 2771 | z[34] = mad_f_mul(z[34], tmp1); |
@@ -2779,9 +2779,9 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
2779 | tmp2 = window_l[0]; | 2779 | tmp2 = window_l[0]; |
2780 | 2780 | ||
2781 | for (i = 0; i < 35; ++i) { | 2781 | for (i = 0; i < 35; ++i) { |
2782 | z[i] = mad_f_mul(tmp1, tmp2); | 2782 | z[i] = mad_f_mul(tmp1, tmp2); |
2783 | tmp1 = z[i + 1]; | 2783 | tmp1 = z[i + 1]; |
2784 | tmp2 = window_l[i + 1]; | 2784 | tmp2 = window_l[i + 1]; |
2785 | } | 2785 | } |
2786 | 2786 | ||
2787 | z[35] = mad_f_mul(tmp1, tmp2); | 2787 | z[35] = mad_f_mul(tmp1, tmp2); |
@@ -2824,7 +2824,7 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
2824 | # endif /* ASO_IMDCT */ | 2824 | # endif /* ASO_IMDCT */ |
2825 | 2825 | ||
2826 | /* | 2826 | /* |
2827 | * NAME: III_imdct_s() | 2827 | * NAME: III_imdct_s() |
2828 | * DESCRIPTION: perform IMDCT and windowing for short blocks | 2828 | * DESCRIPTION: perform IMDCT and windowing for short blocks |
2829 | */ | 2829 | */ |
2830 | 2830 | ||
@@ -2911,16 +2911,16 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) | |||
2911 | 2911 | ||
2912 | #ifdef CPU_ARM | 2912 | #ifdef CPU_ARM |
2913 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | 2913 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], |
2914 | mad_fixed_t sample[18][32], unsigned int sb); | 2914 | mad_fixed_t sample[18][32], unsigned int sb); |
2915 | #else | 2915 | #else |
2916 | 2916 | ||
2917 | /* | 2917 | /* |
2918 | * NAME: III_overlap() | 2918 | * NAME: III_overlap() |
2919 | * DESCRIPTION: perform overlap-add of windowed IMDCT outputs | 2919 | * DESCRIPTION: perform overlap-add of windowed IMDCT outputs |
2920 | */ | 2920 | */ |
2921 | static | 2921 | static |
2922 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | 2922 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], |
2923 | mad_fixed_t sample[18][32], unsigned int sb) | 2923 | mad_fixed_t sample[18][32], unsigned int sb) |
2924 | { | 2924 | { |
2925 | unsigned int i; | 2925 | unsigned int i; |
2926 | 2926 | ||
@@ -2964,12 +2964,12 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
2964 | #endif | 2964 | #endif |
2965 | 2965 | ||
2966 | /* | 2966 | /* |
2967 | * NAME: III_overlap_z() | 2967 | * NAME: III_overlap_z() |
2968 | * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs | 2968 | * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs |
2969 | */ | 2969 | */ |
2970 | static inline | 2970 | static inline |
2971 | void III_overlap_z(mad_fixed_t overlap[18], | 2971 | void III_overlap_z(mad_fixed_t overlap[18], |
2972 | mad_fixed_t sample[18][32], unsigned int sb) | 2972 | mad_fixed_t sample[18][32], unsigned int sb) |
2973 | { | 2973 | { |
2974 | unsigned int i; | 2974 | unsigned int i; |
2975 | 2975 | ||
@@ -3004,7 +3004,7 @@ void III_overlap_z(mad_fixed_t overlap[18], | |||
3004 | } | 3004 | } |
3005 | 3005 | ||
3006 | /* | 3006 | /* |
3007 | * NAME: III_freqinver() | 3007 | * NAME: III_freqinver() |
3008 | * DESCRIPTION: perform subband frequency inversion for odd sample lines | 3008 | * DESCRIPTION: perform subband frequency inversion for odd sample lines |
3009 | */ | 3009 | */ |
3010 | static | 3010 | static |
@@ -3038,12 +3038,12 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) | |||
3038 | } | 3038 | } |
3039 | 3039 | ||
3040 | /* | 3040 | /* |
3041 | * NAME: III_decode() | 3041 | * NAME: III_decode() |
3042 | * DESCRIPTION: decode frame main_data | 3042 | * DESCRIPTION: decode frame main_data |
3043 | */ | 3043 | */ |
3044 | static | 3044 | static |
3045 | enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | 3045 | enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, |
3046 | struct sideinfo *si, unsigned int nch) | 3046 | struct sideinfo *si, unsigned int nch) |
3047 | { | 3047 | { |
3048 | struct mad_header *header = &frame->header; | 3048 | struct mad_header *header = &frame->header; |
3049 | unsigned int sfreqi, ngr, gr; | 3049 | unsigned int sfreqi, ngr, gr; |
@@ -3081,23 +3081,23 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3081 | 3081 | ||
3082 | sfbwidth[ch] = sfbwidth_table[sfreqi].l; | 3082 | sfbwidth[ch] = sfbwidth_table[sfreqi].l; |
3083 | if (channel->block_type == 2) { | 3083 | if (channel->block_type == 2) { |
3084 | sfbwidth[ch] = (channel->flags & mixed_block_flag) ? | 3084 | sfbwidth[ch] = (channel->flags & mixed_block_flag) ? |
3085 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; | 3085 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; |
3086 | } | 3086 | } |
3087 | 3087 | ||
3088 | if (header->flags & MAD_FLAG_LSF_EXT) { | 3088 | if (header->flags & MAD_FLAG_LSF_EXT) { |
3089 | part2_length = III_scalefactors_lsf(ptr, channel, | 3089 | part2_length = III_scalefactors_lsf(ptr, channel, |
3090 | ch == 0 ? 0 : &si->gr[1].ch[1], | 3090 | ch == 0 ? 0 : &si->gr[1].ch[1], |
3091 | header->mode_extension); | 3091 | header->mode_extension); |
3092 | } | 3092 | } |
3093 | else { | 3093 | else { |
3094 | part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], | 3094 | part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], |
3095 | gr == 0 ? 0 : si->scfsi[ch]); | 3095 | gr == 0 ? 0 : si->scfsi[ch]); |
3096 | } | 3096 | } |
3097 | 3097 | ||
3098 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); | 3098 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); |
3099 | if (error) | 3099 | if (error) |
3100 | return error; | 3100 | return error; |
3101 | } | 3101 | } |
3102 | 3102 | ||
3103 | /* joint stereo processing */ | 3103 | /* joint stereo processing */ |
@@ -3105,7 +3105,7 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3105 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { | 3105 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { |
3106 | error = III_stereo(xr, granule, header, sfbwidth[0]); | 3106 | error = III_stereo(xr, granule, header, sfbwidth[0]); |
3107 | if (error) | 3107 | if (error) |
3108 | return error; | 3108 | return error; |
3109 | } | 3109 | } |
3110 | 3110 | ||
3111 | /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ | 3111 | /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ |
@@ -3117,46 +3117,46 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3117 | mad_fixed_t output[36]; | 3117 | mad_fixed_t output[36]; |
3118 | 3118 | ||
3119 | if (channel->block_type == 2) { | 3119 | if (channel->block_type == 2) { |
3120 | III_reorder(xr[ch], channel, sfbwidth[ch]); | 3120 | III_reorder(xr[ch], channel, sfbwidth[ch]); |
3121 | 3121 | ||
3122 | # if !defined(OPT_STRICT) | 3122 | # if !defined(OPT_STRICT) |
3123 | /* | 3123 | /* |
3124 | * According to ISO/IEC 11172-3, "Alias reduction is not applied for | 3124 | * According to ISO/IEC 11172-3, "Alias reduction is not applied for |
3125 | * granules with block_type == 2 (short block)." However, other | 3125 | * granules with block_type == 2 (short block)." However, other |
3126 | * sources suggest alias reduction should indeed be performed on the | 3126 | * sources suggest alias reduction should indeed be performed on the |
3127 | * lower two subbands of mixed blocks. Most other implementations do | 3127 | * lower two subbands of mixed blocks. Most other implementations do |
3128 | * this, so by default we will too. | 3128 | * this, so by default we will too. |
3129 | */ | 3129 | */ |
3130 | if (channel->flags & mixed_block_flag) | 3130 | if (channel->flags & mixed_block_flag) |
3131 | III_aliasreduce(xr[ch], 36); | 3131 | III_aliasreduce(xr[ch], 36); |
3132 | # endif | 3132 | # endif |
3133 | } | 3133 | } |
3134 | else | 3134 | else |
3135 | III_aliasreduce(xr[ch], 576); | 3135 | III_aliasreduce(xr[ch], 576); |
3136 | 3136 | ||
3137 | l = 0; | 3137 | l = 0; |
3138 | 3138 | ||
3139 | /* subbands 0-1 */ | 3139 | /* subbands 0-1 */ |
3140 | 3140 | ||
3141 | if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { | 3141 | if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { |
3142 | unsigned int block_type; | 3142 | unsigned int block_type; |
3143 | 3143 | ||
3144 | block_type = channel->block_type; | 3144 | block_type = channel->block_type; |
3145 | if (channel->flags & mixed_block_flag) | 3145 | if (channel->flags & mixed_block_flag) |
3146 | block_type = 0; | 3146 | block_type = 0; |
3147 | 3147 | ||
3148 | /* long blocks */ | 3148 | /* long blocks */ |
3149 | for (sb = 0; sb < 2; ++sb, l += 18) { | 3149 | for (sb = 0; sb < 2; ++sb, l += 18) { |
3150 | III_imdct_l(&xr[ch][l], output, block_type); | 3150 | III_imdct_l(&xr[ch][l], output, block_type); |
3151 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 3151 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
3152 | } | 3152 | } |
3153 | } | 3153 | } |
3154 | else { | 3154 | else { |
3155 | /* short blocks */ | 3155 | /* short blocks */ |
3156 | for (sb = 0; sb < 2; ++sb, l += 18) { | 3156 | for (sb = 0; sb < 2; ++sb, l += 18) { |
3157 | III_imdct_s(&xr[ch][l], output); | 3157 | III_imdct_s(&xr[ch][l], output); |
3158 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 3158 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
3159 | } | 3159 | } |
3160 | } | 3160 | } |
3161 | 3161 | ||
3162 | III_freqinver(sample, 1); | 3162 | III_freqinver(sample, 1); |
@@ -3166,7 +3166,7 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3166 | /* | 3166 | /* |
3167 | i = 576; | 3167 | i = 576; |
3168 | while (i > 36 && xr[ch][i - 1] == 0) | 3168 | while (i > 36 && xr[ch][i - 1] == 0) |
3169 | --i; | 3169 | --i; |
3170 | */ | 3170 | */ |
3171 | 3171 | ||
3172 | { | 3172 | { |
@@ -3181,33 +3181,33 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3181 | sblimit = 32 - (576 - i) / 18; | 3181 | sblimit = 32 - (576 - i) / 18; |
3182 | 3182 | ||
3183 | if (channel->block_type != 2) { | 3183 | if (channel->block_type != 2) { |
3184 | /* long blocks */ | 3184 | /* long blocks */ |
3185 | for (sb = 2; sb < sblimit; ++sb, l += 18) { | 3185 | for (sb = 2; sb < sblimit; ++sb, l += 18) { |
3186 | III_imdct_l(&xr[ch][l], output, channel->block_type); | 3186 | III_imdct_l(&xr[ch][l], output, channel->block_type); |
3187 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 3187 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
3188 | 3188 | ||
3189 | if (sb & 1) | 3189 | if (sb & 1) |
3190 | III_freqinver(sample, sb); | 3190 | III_freqinver(sample, sb); |
3191 | } | 3191 | } |
3192 | } | 3192 | } |
3193 | else { | 3193 | else { |
3194 | /* short blocks */ | 3194 | /* short blocks */ |
3195 | for (sb = 2; sb < sblimit; ++sb, l += 18) { | 3195 | for (sb = 2; sb < sblimit; ++sb, l += 18) { |
3196 | III_imdct_s(&xr[ch][l], output); | 3196 | III_imdct_s(&xr[ch][l], output); |
3197 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 3197 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
3198 | 3198 | ||
3199 | if (sb & 1) | 3199 | if (sb & 1) |
3200 | III_freqinver(sample, sb); | 3200 | III_freqinver(sample, sb); |
3201 | } | 3201 | } |
3202 | } | 3202 | } |
3203 | 3203 | ||
3204 | /* remaining (zero) subbands */ | 3204 | /* remaining (zero) subbands */ |
3205 | 3205 | ||
3206 | for (sb = sblimit; sb < 32; ++sb) { | 3206 | for (sb = sblimit; sb < 32; ++sb) { |
3207 | III_overlap_z((*frame->overlap)[ch][sb], sample, sb); | 3207 | III_overlap_z((*frame->overlap)[ch][sb], sample, sb); |
3208 | 3208 | ||
3209 | if (sb & 1) | 3209 | if (sb & 1) |
3210 | III_freqinver(sample, sb); | 3210 | III_freqinver(sample, sb); |
3211 | } | 3211 | } |
3212 | } | 3212 | } |
3213 | } | 3213 | } |
@@ -3216,7 +3216,7 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3216 | } | 3216 | } |
3217 | 3217 | ||
3218 | /* | 3218 | /* |
3219 | * NAME: layer->III() | 3219 | * NAME: layer->III() |
3220 | * DESCRIPTION: decode a single Layer III frame | 3220 | * DESCRIPTION: decode a single Layer III frame |
3221 | */ | 3221 | */ |
3222 | int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | 3222 | int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) |
@@ -3268,7 +3268,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3268 | mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); | 3268 | mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); |
3269 | 3269 | ||
3270 | if (header->crc_check != header->crc_target && | 3270 | if (header->crc_check != header->crc_target && |
3271 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 3271 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
3272 | stream->error = MAD_ERROR_BADCRC; | 3272 | stream->error = MAD_ERROR_BADCRC; |
3273 | result = -1; | 3273 | result = -1; |
3274 | } | 3274 | } |
@@ -3277,7 +3277,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3277 | /* decode frame side information */ | 3277 | /* decode frame side information */ |
3278 | 3278 | ||
3279 | error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, | 3279 | error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, |
3280 | &si, &data_bitlen, &priv_bitlen); | 3280 | &si, &data_bitlen, &priv_bitlen); |
3281 | if (error && result == 0) { | 3281 | if (error && result == 0) { |
3282 | stream->error = error; | 3282 | stream->error = error; |
3283 | result = -1; | 3283 | result = -1; |
@@ -3297,10 +3297,10 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3297 | header = mad_bit_read(&peek, 32); | 3297 | header = mad_bit_read(&peek, 32); |
3298 | if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { | 3298 | if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { |
3299 | if (!(header & 0x00010000L)) /* protection_bit */ | 3299 | if (!(header & 0x00010000L)) /* protection_bit */ |
3300 | mad_bit_skip(&peek, 16); /* crc_check */ | 3300 | mad_bit_skip(&peek, 16); /* crc_check */ |
3301 | 3301 | ||
3302 | next_md_begin = | 3302 | next_md_begin = |
3303 | mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); | 3303 | mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | mad_bit_finish(&peek); | 3306 | mad_bit_finish(&peek); |
@@ -3326,22 +3326,22 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3326 | else { | 3326 | else { |
3327 | if (si.main_data_begin > stream->md_len) { | 3327 | if (si.main_data_begin > stream->md_len) { |
3328 | if (result == 0) { | 3328 | if (result == 0) { |
3329 | stream->error = MAD_ERROR_BADDATAPTR; | 3329 | stream->error = MAD_ERROR_BADDATAPTR; |
3330 | result = -1; | 3330 | result = -1; |
3331 | } | 3331 | } |
3332 | } | 3332 | } |
3333 | else { | 3333 | else { |
3334 | mad_bit_init(&ptr, | 3334 | mad_bit_init(&ptr, |
3335 | *stream->main_data + stream->md_len - si.main_data_begin); | 3335 | *stream->main_data + stream->md_len - si.main_data_begin); |
3336 | 3336 | ||
3337 | if (md_len > si.main_data_begin) { | 3337 | if (md_len > si.main_data_begin) { |
3338 | assert(stream->md_len + md_len - | 3338 | assert(stream->md_len + md_len - |
3339 | si.main_data_begin <= MAD_BUFFER_MDLEN); | 3339 | si.main_data_begin <= MAD_BUFFER_MDLEN); |
3340 | 3340 | ||
3341 | memcpy(*stream->main_data + stream->md_len, | 3341 | memcpy(*stream->main_data + stream->md_len, |
3342 | mad_bit_nextbyte(&stream->ptr), | 3342 | mad_bit_nextbyte(&stream->ptr), |
3343 | frame_used = md_len - si.main_data_begin); | 3343 | frame_used = md_len - si.main_data_begin); |
3344 | stream->md_len += frame_used; | 3344 | stream->md_len += frame_used; |
3345 | } | 3345 | } |
3346 | } | 3346 | } |
3347 | } | 3347 | } |
@@ -3365,17 +3365,17 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3365 | 3365 | ||
3366 | # if 0 && defined(DEBUG) | 3366 | # if 0 && defined(DEBUG) |
3367 | fprintf(stderr, | 3367 | fprintf(stderr, |
3368 | "main_data_begin:%u, md_len:%u, frame_free:%u, " | 3368 | "main_data_begin:%u, md_len:%u, frame_free:%u, " |
3369 | "data_bitlen:%u, anc_bitlen: %u\n", | 3369 | "data_bitlen:%u, anc_bitlen: %u\n", |
3370 | si.main_data_begin, md_len, frame_free, | 3370 | si.main_data_begin, md_len, frame_free, |
3371 | data_bitlen, stream->anc_bitlen); | 3371 | data_bitlen, stream->anc_bitlen); |
3372 | # endif | 3372 | # endif |
3373 | 3373 | ||
3374 | /* preload main_data buffer with up to 511 bytes for next frame(s) */ | 3374 | /* preload main_data buffer with up to 511 bytes for next frame(s) */ |
3375 | 3375 | ||
3376 | if (frame_free >= next_md_begin) { | 3376 | if (frame_free >= next_md_begin) { |
3377 | memcpy(*stream->main_data, | 3377 | memcpy(*stream->main_data, |
3378 | stream->next_frame - next_md_begin, next_md_begin); | 3378 | stream->next_frame - next_md_begin, next_md_begin); |
3379 | stream->md_len = next_md_begin; | 3379 | stream->md_len = next_md_begin; |
3380 | } | 3380 | } |
3381 | else { | 3381 | else { |
@@ -3384,19 +3384,19 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
3384 | 3384 | ||
3385 | extra = si.main_data_begin - md_len; | 3385 | extra = si.main_data_begin - md_len; |
3386 | if (extra + frame_free > next_md_begin) | 3386 | if (extra + frame_free > next_md_begin) |
3387 | extra = next_md_begin - frame_free; | 3387 | extra = next_md_begin - frame_free; |
3388 | 3388 | ||
3389 | if (extra < stream->md_len) { | 3389 | if (extra < stream->md_len) { |
3390 | memmove(*stream->main_data, | 3390 | memmove(*stream->main_data, |
3391 | *stream->main_data + stream->md_len - extra, extra); | 3391 | *stream->main_data + stream->md_len - extra, extra); |
3392 | stream->md_len = extra; | 3392 | stream->md_len = extra; |
3393 | } | 3393 | } |
3394 | } | 3394 | } |
3395 | else | 3395 | else |
3396 | stream->md_len = 0; | 3396 | stream->md_len = 0; |
3397 | 3397 | ||
3398 | memcpy(*stream->main_data + stream->md_len, | 3398 | memcpy(*stream->main_data + stream->md_len, |
3399 | stream->next_frame - frame_free, frame_free); | 3399 | stream->next_frame - frame_free, frame_free); |
3400 | stream->md_len += frame_free; | 3400 | stream->md_len += frame_free; |
3401 | } | 3401 | } |
3402 | 3402 | ||
diff --git a/apps/codecs/libmad/mad.h b/apps/codecs/libmad/mad.h index 6e75e3bf09..81ac20c373 100644 --- a/apps/codecs/libmad/mad.h +++ b/apps/codecs/libmad/mad.h | |||
@@ -27,28 +27,28 @@ extern "C" { | |||
27 | # endif | 27 | # endif |
28 | 28 | ||
29 | # define FPM_DEFAULT | 29 | # define FPM_DEFAULT |
30 | 30 | ||
31 | /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ | 31 | /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ |
32 | 32 | ||
33 | # ifndef LIBMAD_VERSION_H | 33 | # ifndef LIBMAD_VERSION_H |
34 | # define LIBMAD_VERSION_H | 34 | # define LIBMAD_VERSION_H |
35 | 35 | ||
36 | # define MAD_VERSION_MAJOR 0 | 36 | # define MAD_VERSION_MAJOR 0 |
37 | # define MAD_VERSION_MINOR 15 | 37 | # define MAD_VERSION_MINOR 15 |
38 | # define MAD_VERSION_PATCH 1 | 38 | # define MAD_VERSION_PATCH 1 |
39 | # define MAD_VERSION_EXTRA " (beta)" | 39 | # define MAD_VERSION_EXTRA " (beta)" |
40 | 40 | ||
41 | # define MAD_VERSION_STRINGIZE(str) #str | 41 | # define MAD_VERSION_STRINGIZE(str) #str |
42 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) | 42 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) |
43 | 43 | ||
44 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | 44 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ |
45 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | 45 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ |
46 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | 46 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ |
47 | MAD_VERSION_EXTRA | 47 | MAD_VERSION_EXTRA |
48 | 48 | ||
49 | # define MAD_PUBLISHYEAR "2000-2004" | 49 | # define MAD_PUBLISHYEAR "2000-2004" |
50 | # define MAD_AUTHOR "Underbit Technologies, Inc." | 50 | # define MAD_AUTHOR "Underbit Technologies, Inc." |
51 | # define MAD_EMAIL "info@underbit.com" | 51 | # define MAD_EMAIL "info@underbit.com" |
52 | 52 | ||
53 | extern char const mad_version[]; | 53 | extern char const mad_version[]; |
54 | extern char const mad_copyright[]; | 54 | extern char const mad_copyright[]; |
@@ -102,50 +102,50 @@ typedef mad_fixed_t mad_sample_t; | |||
102 | * supported, and must be done with care. | 102 | * supported, and must be done with care. |
103 | */ | 103 | */ |
104 | 104 | ||
105 | # define MAD_F_FRACBITS 28 | 105 | # define MAD_F_FRACBITS 28 |
106 | 106 | ||
107 | # if MAD_F_FRACBITS == 28 | 107 | # if MAD_F_FRACBITS == 28 |
108 | # define MAD_F(x) ((mad_fixed_t) (x##L)) | 108 | # define MAD_F(x) ((mad_fixed_t) (x##L)) |
109 | # else | 109 | # else |
110 | # if MAD_F_FRACBITS < 28 | 110 | # if MAD_F_FRACBITS < 28 |
111 | # warning "MAD_F_FRACBITS < 28" | 111 | # warning "MAD_F_FRACBITS < 28" |
112 | # define MAD_F(x) ((mad_fixed_t) \ | 112 | # define MAD_F(x) ((mad_fixed_t) \ |
113 | (((x##L) + \ | 113 | (((x##L) + \ |
114 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ | 114 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ |
115 | (28 - MAD_F_FRACBITS))) | 115 | (28 - MAD_F_FRACBITS))) |
116 | # elif MAD_F_FRACBITS > 28 | 116 | # elif MAD_F_FRACBITS > 28 |
117 | # error "MAD_F_FRACBITS > 28 not currently supported" | 117 | # error "MAD_F_FRACBITS > 28 not currently supported" |
118 | # define MAD_F(x) ((mad_fixed_t) \ | 118 | # define MAD_F(x) ((mad_fixed_t) \ |
119 | ((x##L) << (MAD_F_FRACBITS - 28))) | 119 | ((x##L) << (MAD_F_FRACBITS - 28))) |
120 | # endif | 120 | # endif |
121 | # endif | 121 | # endif |
122 | 122 | ||
123 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) | 123 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) |
124 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) | 124 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) |
125 | 125 | ||
126 | # define MAD_F_ONE MAD_F(0x10000000) | 126 | # define MAD_F_ONE MAD_F(0x10000000) |
127 | 127 | ||
128 | # define mad_f_tofixed(x) ((mad_fixed_t) \ | 128 | # define mad_f_tofixed(x) ((mad_fixed_t) \ |
129 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) | 129 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) |
130 | # define mad_f_todouble(x) ((double) \ | 130 | # define mad_f_todouble(x) ((double) \ |
131 | ((x) / (double) (1L << MAD_F_FRACBITS))) | 131 | ((x) / (double) (1L << MAD_F_FRACBITS))) |
132 | 132 | ||
133 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) | 133 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) |
134 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) | 134 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) |
135 | /* (x should be positive) */ | 135 | /* (x should be positive) */ |
136 | 136 | ||
137 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) | 137 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) |
138 | 138 | ||
139 | # define mad_f_add(x, y) ((x) + (y)) | 139 | # define mad_f_add(x, y) ((x) + (y)) |
140 | # define mad_f_sub(x, y) ((x) - (y)) | 140 | # define mad_f_sub(x, y) ((x) - (y)) |
141 | 141 | ||
142 | # if defined(FPM_FLOAT) | 142 | # if defined(FPM_FLOAT) |
143 | # error "FPM_FLOAT not yet supported" | 143 | # error "FPM_FLOAT not yet supported" |
144 | 144 | ||
145 | # undef MAD_F | 145 | # undef MAD_F |
146 | # define MAD_F(x) mad_f_todouble(x) | 146 | # define MAD_F(x) mad_f_todouble(x) |
147 | 147 | ||
148 | # define mad_f_mul(x, y) ((x) * (y)) | 148 | # define mad_f_mul(x, y) ((x) * (y)) |
149 | # define mad_f_scale64 | 149 | # define mad_f_scale64 |
150 | 150 | ||
151 | # undef ASO_ZEROCHECK | 151 | # undef ASO_ZEROCHECK |
@@ -192,7 +192,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
192 | } | 192 | } |
193 | # pragma warning(pop) | 193 | # pragma warning(pop) |
194 | 194 | ||
195 | # define mad_f_mul mad_f_mul_inline | 195 | # define mad_f_mul mad_f_mul_inline |
196 | # define mad_f_scale64 | 196 | # define mad_f_scale64 |
197 | # else | 197 | # else |
198 | /* | 198 | /* |
@@ -201,9 +201,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
201 | */ | 201 | */ |
202 | # define MAD_F_MLX(hi, lo, x, y) \ | 202 | # define MAD_F_MLX(hi, lo, x, y) \ |
203 | asm ("imull %3" \ | 203 | asm ("imull %3" \ |
204 | : "=a" (lo), "=d" (hi) \ | 204 | : "=a" (lo), "=d" (hi) \ |
205 | : "%a" (x), "rm" (y) \ | 205 | : "%a" (x), "rm" (y) \ |
206 | : "cc") | 206 | : "cc") |
207 | 207 | ||
208 | # if defined(OPT_ACCURACY) | 208 | # if defined(OPT_ACCURACY) |
209 | /* | 209 | /* |
@@ -214,10 +214,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
214 | mad_fixed64lo_t __lo; \ | 214 | mad_fixed64lo_t __lo; \ |
215 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 215 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
216 | asm ("addl %2,%0\n\t" \ | 216 | asm ("addl %2,%0\n\t" \ |
217 | "adcl %3,%1" \ | 217 | "adcl %3,%1" \ |
218 | : "=rm" (lo), "=rm" (hi) \ | 218 | : "=rm" (lo), "=rm" (hi) \ |
219 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ | 219 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ |
220 | : "cc"); \ | 220 | : "cc"); \ |
221 | }) | 221 | }) |
222 | # endif /* OPT_ACCURACY */ | 222 | # endif /* OPT_ACCURACY */ |
223 | 223 | ||
@@ -230,15 +230,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
230 | mad_fixed64lo_t __lo_; \ | 230 | mad_fixed64lo_t __lo_; \ |
231 | mad_fixed_t __result; \ | 231 | mad_fixed_t __result; \ |
232 | asm ("addl %4,%2\n\t" \ | 232 | asm ("addl %4,%2\n\t" \ |
233 | "adcl %5,%3" \ | 233 | "adcl %5,%3" \ |
234 | : "=rm" (__lo_), "=rm" (__hi_) \ | 234 | : "=rm" (__lo_), "=rm" (__hi_) \ |
235 | : "0" (lo), "1" (hi), \ | 235 | : "0" (lo), "1" (hi), \ |
236 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | 236 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ |
237 | : "cc"); \ | 237 | : "cc"); \ |
238 | asm ("shrdl %3,%2,%1" \ | 238 | asm ("shrdl %3,%2,%1" \ |
239 | : "=rm" (__result) \ | 239 | : "=rm" (__result) \ |
240 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | 240 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ |
241 | : "cc"); \ | 241 | : "cc"); \ |
242 | __result; \ | 242 | __result; \ |
243 | }) | 243 | }) |
244 | # elif defined(OPT_INTEL) | 244 | # elif defined(OPT_INTEL) |
@@ -248,21 +248,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
248 | # define mad_f_scale64(hi, lo) \ | 248 | # define mad_f_scale64(hi, lo) \ |
249 | ({ mad_fixed_t __result; \ | 249 | ({ mad_fixed_t __result; \ |
250 | asm ("shrl %3,%1\n\t" \ | 250 | asm ("shrl %3,%1\n\t" \ |
251 | "shll %4,%2\n\t" \ | 251 | "shll %4,%2\n\t" \ |
252 | "orl %2,%1" \ | 252 | "orl %2,%1" \ |
253 | : "=rm" (__result) \ | 253 | : "=rm" (__result) \ |
254 | : "0" (lo), "r" (hi), \ | 254 | : "0" (lo), "r" (hi), \ |
255 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | 255 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ |
256 | : "cc"); \ | 256 | : "cc"); \ |
257 | __result; \ | 257 | __result; \ |
258 | }) | 258 | }) |
259 | # else | 259 | # else |
260 | # define mad_f_scale64(hi, lo) \ | 260 | # define mad_f_scale64(hi, lo) \ |
261 | ({ mad_fixed_t __result; \ | 261 | ({ mad_fixed_t __result; \ |
262 | asm ("shrdl %3,%2,%1" \ | 262 | asm ("shrdl %3,%2,%1" \ |
263 | : "=rm" (__result) \ | 263 | : "=rm" (__result) \ |
264 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | 264 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ |
265 | : "cc"); \ | 265 | : "cc"); \ |
266 | __result; \ | 266 | __result; \ |
267 | }) | 267 | }) |
268 | # endif /* OPT_ACCURACY */ | 268 | # endif /* OPT_ACCURACY */ |
@@ -287,42 +287,42 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
287 | ({ mad_fixed64hi_t __hi; \ | 287 | ({ mad_fixed64hi_t __hi; \ |
288 | mad_fixed64lo_t __lo; \ | 288 | mad_fixed64lo_t __lo; \ |
289 | mad_fixed_t __result; \ | 289 | mad_fixed_t __result; \ |
290 | asm ("smull %0, %1, %3, %4\n\t" \ | 290 | asm ("smull %0, %1, %3, %4\n\t" \ |
291 | "movs %0, %0, lsr %5\n\t" \ | 291 | "movs %0, %0, lsr %5\n\t" \ |
292 | "adc %2, %0, %1, lsl %6" \ | 292 | "adc %2, %0, %1, lsl %6" \ |
293 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | 293 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ |
294 | : "%r" (x), "r" (y), \ | 294 | : "%r" (x), "r" (y), \ |
295 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 295 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
296 | : "cc"); \ | 296 | : "cc"); \ |
297 | __result; \ | 297 | __result; \ |
298 | }) | 298 | }) |
299 | # endif | 299 | # endif |
300 | 300 | ||
301 | # define MAD_F_MLX(hi, lo, x, y) \ | 301 | # define MAD_F_MLX(hi, lo, x, y) \ |
302 | asm ("smull %0, %1, %2, %3" \ | 302 | asm ("smull %0, %1, %2, %3" \ |
303 | : "=&r" (lo), "=&r" (hi) \ | 303 | : "=&r" (lo), "=&r" (hi) \ |
304 | : "%r" (x), "r" (y)) | 304 | : "%r" (x), "r" (y)) |
305 | 305 | ||
306 | # define MAD_F_MLA(hi, lo, x, y) \ | 306 | # define MAD_F_MLA(hi, lo, x, y) \ |
307 | asm ("smlal %0, %1, %2, %3" \ | 307 | asm ("smlal %0, %1, %2, %3" \ |
308 | : "+r" (lo), "+r" (hi) \ | 308 | : "+r" (lo), "+r" (hi) \ |
309 | : "%r" (x), "r" (y)) | 309 | : "%r" (x), "r" (y)) |
310 | 310 | ||
311 | # define MAD_F_MLN(hi, lo) \ | 311 | # define MAD_F_MLN(hi, lo) \ |
312 | asm ("rsbs %0, %2, #0\n\t" \ | 312 | asm ("rsbs %0, %2, #0\n\t" \ |
313 | "rsc %1, %3, #0" \ | 313 | "rsc %1, %3, #0" \ |
314 | : "=r" (lo), "=r" (hi) \ | 314 | : "=r" (lo), "=r" (hi) \ |
315 | : "0" (lo), "1" (hi) \ | 315 | : "0" (lo), "1" (hi) \ |
316 | : "cc") | 316 | : "cc") |
317 | 317 | ||
318 | # define mad_f_scale64(hi, lo) \ | 318 | # define mad_f_scale64(hi, lo) \ |
319 | ({ mad_fixed_t __result; \ | 319 | ({ mad_fixed_t __result; \ |
320 | asm ("movs %0, %1, lsr %3\n\t" \ | 320 | asm ("movs %0, %1, lsr %3\n\t" \ |
321 | "adc %0, %0, %2, lsl %4" \ | 321 | "adc %0, %0, %2, lsl %4" \ |
322 | : "=&r" (__result) \ | 322 | : "=&r" (__result) \ |
323 | : "r" (lo), "r" (hi), \ | 323 | : "r" (lo), "r" (hi), \ |
324 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 324 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
325 | : "cc"); \ | 325 | : "cc"); \ |
326 | __result; \ | 326 | __result; \ |
327 | }) | 327 | }) |
328 | 328 | ||
@@ -338,14 +338,14 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
338 | */ | 338 | */ |
339 | # define MAD_F_MLX(hi, lo, x, y) \ | 339 | # define MAD_F_MLX(hi, lo, x, y) \ |
340 | asm ("mult %2,%3" \ | 340 | asm ("mult %2,%3" \ |
341 | : "=l" (lo), "=h" (hi) \ | 341 | : "=l" (lo), "=h" (hi) \ |
342 | : "%r" (x), "r" (y)) | 342 | : "%r" (x), "r" (y)) |
343 | 343 | ||
344 | # if defined(HAVE_MADD_ASM) | 344 | # if defined(HAVE_MADD_ASM) |
345 | # define MAD_F_MLA(hi, lo, x, y) \ | 345 | # define MAD_F_MLA(hi, lo, x, y) \ |
346 | asm ("madd %2,%3" \ | 346 | asm ("madd %2,%3" \ |
347 | : "+l" (lo), "+h" (hi) \ | 347 | : "+l" (lo), "+h" (hi) \ |
348 | : "%r" (x), "r" (y)) | 348 | : "%r" (x), "r" (y)) |
349 | # elif defined(HAVE_MADD16_ASM) | 349 | # elif defined(HAVE_MADD16_ASM) |
350 | /* | 350 | /* |
351 | * This loses significant accuracy due to the 16-bit integer limit in the | 351 | * This loses significant accuracy due to the 16-bit integer limit in the |
@@ -353,12 +353,12 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
353 | */ | 353 | */ |
354 | # define MAD_F_ML0(hi, lo, x, y) \ | 354 | # define MAD_F_ML0(hi, lo, x, y) \ |
355 | asm ("mult %2,%3" \ | 355 | asm ("mult %2,%3" \ |
356 | : "=l" (lo), "=h" (hi) \ | 356 | : "=l" (lo), "=h" (hi) \ |
357 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 357 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
358 | # define MAD_F_MLA(hi, lo, x, y) \ | 358 | # define MAD_F_MLA(hi, lo, x, y) \ |
359 | asm ("madd16 %2,%3" \ | 359 | asm ("madd16 %2,%3" \ |
360 | : "+l" (lo), "+h" (hi) \ | 360 | : "+l" (lo), "+h" (hi) \ |
361 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 361 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
362 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) | 362 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) |
363 | # endif | 363 | # endif |
364 | 364 | ||
@@ -378,9 +378,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
378 | */ | 378 | */ |
379 | # define MAD_F_MLX(hi, lo, x, y) \ | 379 | # define MAD_F_MLX(hi, lo, x, y) \ |
380 | asm ("smul %2, %3, %0\n\t" \ | 380 | asm ("smul %2, %3, %0\n\t" \ |
381 | "rd %%y, %1" \ | 381 | "rd %%y, %1" \ |
382 | : "=r" (lo), "=r" (hi) \ | 382 | : "=r" (lo), "=r" (hi) \ |
383 | : "%r" (x), "rI" (y)) | 383 | : "%r" (x), "rI" (y)) |
384 | 384 | ||
385 | /* --- PowerPC ------------------------------------------------------------- */ | 385 | /* --- PowerPC ------------------------------------------------------------- */ |
386 | 386 | ||
@@ -393,11 +393,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
393 | # define MAD_F_MLX(hi, lo, x, y) \ | 393 | # define MAD_F_MLX(hi, lo, x, y) \ |
394 | do { \ | 394 | do { \ |
395 | asm ("mullw %0,%1,%2" \ | 395 | asm ("mullw %0,%1,%2" \ |
396 | : "=r" (lo) \ | 396 | : "=r" (lo) \ |
397 | : "%r" (x), "r" (y)); \ | 397 | : "%r" (x), "r" (y)); \ |
398 | asm ("mulhw %0,%1,%2" \ | 398 | asm ("mulhw %0,%1,%2" \ |
399 | : "=r" (hi) \ | 399 | : "=r" (hi) \ |
400 | : "%r" (x), "r" (y)); \ | 400 | : "%r" (x), "r" (y)); \ |
401 | } \ | 401 | } \ |
402 | while (0) | 402 | while (0) |
403 | 403 | ||
@@ -410,11 +410,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
410 | mad_fixed64lo_t __lo; \ | 410 | mad_fixed64lo_t __lo; \ |
411 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 411 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
412 | asm ("addc %0,%2,%3\n\t" \ | 412 | asm ("addc %0,%2,%3\n\t" \ |
413 | "adde %1,%4,%5" \ | 413 | "adde %1,%4,%5" \ |
414 | : "=r" (lo), "=r" (hi) \ | 414 | : "=r" (lo), "=r" (hi) \ |
415 | : "%r" (lo), "r" (__lo), \ | 415 | : "%r" (lo), "r" (__lo), \ |
416 | "%r" (hi), "r" (__hi) \ | 416 | "%r" (hi), "r" (__hi) \ |
417 | : "xer"); \ | 417 | : "xer"); \ |
418 | }) | 418 | }) |
419 | # endif | 419 | # endif |
420 | 420 | ||
@@ -425,28 +425,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
425 | # define mad_f_scale64(hi, lo) \ | 425 | # define mad_f_scale64(hi, lo) \ |
426 | ({ mad_fixed_t __result, __round; \ | 426 | ({ mad_fixed_t __result, __round; \ |
427 | asm ("rotrwi %0,%1,%2" \ | 427 | asm ("rotrwi %0,%1,%2" \ |
428 | : "=r" (__result) \ | 428 | : "=r" (__result) \ |
429 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 429 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
430 | asm ("extrwi %0,%1,1,0" \ | 430 | asm ("extrwi %0,%1,1,0" \ |
431 | : "=r" (__round) \ | 431 | : "=r" (__round) \ |
432 | : "r" (__result)); \ | 432 | : "r" (__result)); \ |
433 | asm ("insrwi %0,%1,%2,0" \ | 433 | asm ("insrwi %0,%1,%2,0" \ |
434 | : "+r" (__result) \ | 434 | : "+r" (__result) \ |
435 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 435 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
436 | asm ("add %0,%1,%2" \ | 436 | asm ("add %0,%1,%2" \ |
437 | : "=r" (__result) \ | 437 | : "=r" (__result) \ |
438 | : "%r" (__result), "r" (__round)); \ | 438 | : "%r" (__result), "r" (__round)); \ |
439 | __result; \ | 439 | __result; \ |
440 | }) | 440 | }) |
441 | # else | 441 | # else |
442 | # define mad_f_scale64(hi, lo) \ | 442 | # define mad_f_scale64(hi, lo) \ |
443 | ({ mad_fixed_t __result; \ | 443 | ({ mad_fixed_t __result; \ |
444 | asm ("rotrwi %0,%1,%2" \ | 444 | asm ("rotrwi %0,%1,%2" \ |
445 | : "=r" (__result) \ | 445 | : "=r" (__result) \ |
446 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 446 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
447 | asm ("insrwi %0,%1,%2,0" \ | 447 | asm ("insrwi %0,%1,%2,0" \ |
448 | : "+r" (__result) \ | 448 | : "+r" (__result) \ |
449 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 449 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
450 | __result; \ | 450 | __result; \ |
451 | }) | 451 | }) |
452 | # endif | 452 | # endif |
@@ -467,10 +467,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
467 | * Pre-rounding is required to stay within the limits of compliance. | 467 | * Pre-rounding is required to stay within the limits of compliance. |
468 | */ | 468 | */ |
469 | # if defined(OPT_SPEED) | 469 | # if defined(OPT_SPEED) |
470 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) | 470 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) |
471 | # else | 471 | # else |
472 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ | 472 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ |
473 | (((y) + (1L << 15)) >> 16)) | 473 | (((y) + (1L << 15)) >> 16)) |
474 | # endif | 474 | # endif |
475 | 475 | ||
476 | /* ------------------------------------------------------------------------- */ | 476 | /* ------------------------------------------------------------------------- */ |
@@ -491,22 +491,22 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
491 | # endif | 491 | # endif |
492 | 492 | ||
493 | # if !defined(MAD_F_MLA) | 493 | # if !defined(MAD_F_MLA) |
494 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) | 494 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) |
495 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) | 495 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) |
496 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | 496 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) |
497 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 497 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
498 | # endif | 498 | # endif |
499 | 499 | ||
500 | # if !defined(MAD_F_ML0) | 500 | # if !defined(MAD_F_ML0) |
501 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) | 501 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) |
502 | # endif | 502 | # endif |
503 | 503 | ||
504 | # if !defined(MAD_F_MLN) | 504 | # if !defined(MAD_F_MLN) |
505 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | 505 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) |
506 | # endif | 506 | # endif |
507 | 507 | ||
508 | # if !defined(MAD_F_MLZ) | 508 | # if !defined(MAD_F_MLZ) |
509 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) | 509 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) |
510 | # endif | 510 | # endif |
511 | 511 | ||
512 | # if !defined(mad_f_scale64) | 512 | # if !defined(mad_f_scale64) |
@@ -514,7 +514,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
514 | # define mad_f_scale64(hi, lo) \ | 514 | # define mad_f_scale64(hi, lo) \ |
515 | ((((mad_fixed_t) \ | 515 | ((((mad_fixed_t) \ |
516 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ | 516 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ |
517 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) | 517 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) |
518 | # else | 518 | # else |
519 | # define mad_f_scale64(hi, lo) \ | 519 | # define mad_f_scale64(hi, lo) \ |
520 | ((mad_fixed_t) \ | 520 | ((mad_fixed_t) \ |
@@ -544,10 +544,10 @@ struct mad_bitptr { | |||
544 | 544 | ||
545 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); | 545 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); |
546 | 546 | ||
547 | # define mad_bit_finish(bitptr) /* nothing */ | 547 | # define mad_bit_finish(bitptr) /* nothing */ |
548 | 548 | ||
549 | unsigned int mad_bit_length(struct mad_bitptr const *, | 549 | unsigned int mad_bit_length(struct mad_bitptr const *, |
550 | struct mad_bitptr const *); | 550 | struct mad_bitptr const *); |
551 | 551 | ||
552 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) | 552 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) |
553 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); | 553 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); |
@@ -566,8 +566,8 @@ unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); | |||
566 | # define LIBMAD_TIMER_H | 566 | # define LIBMAD_TIMER_H |
567 | 567 | ||
568 | typedef struct { | 568 | typedef struct { |
569 | signed long seconds; /* whole seconds */ | 569 | signed long seconds; /* whole seconds */ |
570 | unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ | 570 | unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ |
571 | } mad_timer_t; | 571 | } mad_timer_t; |
572 | 572 | ||
573 | extern mad_timer_t const mad_timer_zero; | 573 | extern mad_timer_t const mad_timer_zero; |
@@ -575,9 +575,9 @@ extern mad_timer_t const mad_timer_zero; | |||
575 | # define MAD_TIMER_RESOLUTION 352800000UL | 575 | # define MAD_TIMER_RESOLUTION 352800000UL |
576 | 576 | ||
577 | enum mad_units { | 577 | enum mad_units { |
578 | MAD_UNITS_HOURS = -2, | 578 | MAD_UNITS_HOURS = -2, |
579 | MAD_UNITS_MINUTES = -1, | 579 | MAD_UNITS_MINUTES = -1, |
580 | MAD_UNITS_SECONDS = 0, | 580 | MAD_UNITS_SECONDS = 0, |
581 | 581 | ||
582 | /* metric units */ | 582 | /* metric units */ |
583 | 583 | ||
@@ -587,7 +587,7 @@ enum mad_units { | |||
587 | 587 | ||
588 | /* audio sample units */ | 588 | /* audio sample units */ |
589 | 589 | ||
590 | MAD_UNITS_8000_HZ = 8000, | 590 | MAD_UNITS_8000_HZ = 8000, |
591 | MAD_UNITS_11025_HZ = 11025, | 591 | MAD_UNITS_11025_HZ = 11025, |
592 | MAD_UNITS_12000_HZ = 12000, | 592 | MAD_UNITS_12000_HZ = 12000, |
593 | 593 | ||
@@ -601,16 +601,16 @@ enum mad_units { | |||
601 | 601 | ||
602 | /* video frame/field units */ | 602 | /* video frame/field units */ |
603 | 603 | ||
604 | MAD_UNITS_24_FPS = 24, | 604 | MAD_UNITS_24_FPS = 24, |
605 | MAD_UNITS_25_FPS = 25, | 605 | MAD_UNITS_25_FPS = 25, |
606 | MAD_UNITS_30_FPS = 30, | 606 | MAD_UNITS_30_FPS = 30, |
607 | MAD_UNITS_48_FPS = 48, | 607 | MAD_UNITS_48_FPS = 48, |
608 | MAD_UNITS_50_FPS = 50, | 608 | MAD_UNITS_50_FPS = 50, |
609 | MAD_UNITS_60_FPS = 60, | 609 | MAD_UNITS_60_FPS = 60, |
610 | 610 | ||
611 | /* CD audio frames */ | 611 | /* CD audio frames */ |
612 | 612 | ||
613 | MAD_UNITS_75_FPS = 75, | 613 | MAD_UNITS_75_FPS = 75, |
614 | 614 | ||
615 | /* video drop-frame units */ | 615 | /* video drop-frame units */ |
616 | 616 | ||
@@ -638,7 +638,7 @@ void mad_timer_multiply(mad_timer_t *, signed long); | |||
638 | signed long mad_timer_count(mad_timer_t, enum mad_units); | 638 | signed long mad_timer_count(mad_timer_t, enum mad_units); |
639 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | 639 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); |
640 | void mad_timer_string(mad_timer_t, char *, char const *, | 640 | void mad_timer_string(mad_timer_t, char *, char const *, |
641 | enum mad_units, enum mad_units, unsigned long); | 641 | enum mad_units, enum mad_units, unsigned long); |
642 | 642 | ||
643 | # endif | 643 | # endif |
644 | 644 | ||
@@ -648,16 +648,16 @@ void mad_timer_string(mad_timer_t, char *, char const *, | |||
648 | # define LIBMAD_STREAM_H | 648 | # define LIBMAD_STREAM_H |
649 | 649 | ||
650 | 650 | ||
651 | # define MAD_BUFFER_GUARD 8 | 651 | # define MAD_BUFFER_GUARD 8 |
652 | # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) | 652 | # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) |
653 | 653 | ||
654 | enum mad_error { | 654 | enum mad_error { |
655 | MAD_ERROR_NONE = 0x0000, /* no error */ | 655 | MAD_ERROR_NONE = 0x0000, /* no error */ |
656 | 656 | ||
657 | MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ | 657 | MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ |
658 | MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ | 658 | MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ |
659 | 659 | ||
660 | MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ | 660 | MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ |
661 | 661 | ||
662 | MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ | 662 | MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ |
663 | MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ | 663 | MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ |
@@ -665,7 +665,7 @@ enum mad_error { | |||
665 | MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ | 665 | MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ |
666 | MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ | 666 | MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ |
667 | 667 | ||
668 | MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ | 668 | MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ |
669 | MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ | 669 | MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ |
670 | MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ | 670 | MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ |
671 | MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ | 671 | MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ |
@@ -677,32 +677,32 @@ enum mad_error { | |||
677 | MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ | 677 | MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ |
678 | MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ | 678 | MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ |
679 | MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ | 679 | MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ |
680 | MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ | 680 | MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ |
681 | }; | 681 | }; |
682 | 682 | ||
683 | # define MAD_RECOVERABLE(error) ((error) & 0xff00) | 683 | # define MAD_RECOVERABLE(error) ((error) & 0xff00) |
684 | 684 | ||
685 | struct mad_stream { | 685 | struct mad_stream { |
686 | unsigned char const *buffer; /* input bitstream buffer */ | 686 | unsigned char const *buffer; /* input bitstream buffer */ |
687 | unsigned char const *bufend; /* end of buffer */ | 687 | unsigned char const *bufend; /* end of buffer */ |
688 | unsigned long skiplen; /* bytes to skip before next frame */ | 688 | unsigned long skiplen; /* bytes to skip before next frame */ |
689 | 689 | ||
690 | int sync; /* stream sync found */ | 690 | int sync; /* stream sync found */ |
691 | unsigned long freerate; /* free bitrate (fixed) */ | 691 | unsigned long freerate; /* free bitrate (fixed) */ |
692 | 692 | ||
693 | unsigned char const *this_frame; /* start of current frame */ | 693 | unsigned char const *this_frame; /* start of current frame */ |
694 | unsigned char const *next_frame; /* start of next frame */ | 694 | unsigned char const *next_frame; /* start of next frame */ |
695 | struct mad_bitptr ptr; /* current processing bit pointer */ | 695 | struct mad_bitptr ptr; /* current processing bit pointer */ |
696 | 696 | ||
697 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ | 697 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ |
698 | unsigned int anc_bitlen; /* number of ancillary bits */ | 698 | unsigned int anc_bitlen; /* number of ancillary bits */ |
699 | 699 | ||
700 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; | 700 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; |
701 | /* Layer III main_data() */ | 701 | /* Layer III main_data() */ |
702 | unsigned int md_len; /* bytes in main_data */ | 702 | unsigned int md_len; /* bytes in main_data */ |
703 | 703 | ||
704 | int options; /* decoding options (see below) */ | 704 | int options; /* decoding options (see below) */ |
705 | enum mad_error error; /* error code (see above) */ | 705 | enum mad_error error; /* error code (see above) */ |
706 | }; | 706 | }; |
707 | 707 | ||
708 | enum { | 708 | enum { |
@@ -722,7 +722,7 @@ void mad_stream_finish(struct mad_stream *); | |||
722 | ((void) ((stream)->options = (opts))) | 722 | ((void) ((stream)->options = (opts))) |
723 | 723 | ||
724 | void mad_stream_buffer(struct mad_stream *, | 724 | void mad_stream_buffer(struct mad_stream *, |
725 | unsigned char const *, unsigned long); | 725 | unsigned char const *, unsigned long); |
726 | void mad_stream_skip(struct mad_stream *, unsigned long); | 726 | void mad_stream_skip(struct mad_stream *, unsigned long); |
727 | 727 | ||
728 | int mad_stream_sync(struct mad_stream *); | 728 | int mad_stream_sync(struct mad_stream *); |
@@ -738,46 +738,46 @@ char const *mad_stream_errorstr(struct mad_stream const *); | |||
738 | 738 | ||
739 | 739 | ||
740 | enum mad_layer { | 740 | enum mad_layer { |
741 | MAD_LAYER_I = 1, /* Layer I */ | 741 | MAD_LAYER_I = 1, /* Layer I */ |
742 | MAD_LAYER_II = 2, /* Layer II */ | 742 | MAD_LAYER_II = 2, /* Layer II */ |
743 | MAD_LAYER_III = 3 /* Layer III */ | 743 | MAD_LAYER_III = 3 /* Layer III */ |
744 | }; | 744 | }; |
745 | 745 | ||
746 | enum mad_mode { | 746 | enum mad_mode { |
747 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ | 747 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ |
748 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ | 748 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ |
749 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ | 749 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ |
750 | MAD_MODE_STEREO = 3 /* normal LR stereo */ | 750 | MAD_MODE_STEREO = 3 /* normal LR stereo */ |
751 | }; | 751 | }; |
752 | 752 | ||
753 | enum mad_emphasis { | 753 | enum mad_emphasis { |
754 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ | 754 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ |
755 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ | 755 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ |
756 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ | 756 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ |
757 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ | 757 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ |
758 | }; | 758 | }; |
759 | 759 | ||
760 | struct mad_header { | 760 | struct mad_header { |
761 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 761 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
762 | enum mad_mode mode; /* channel mode (see above) */ | 762 | enum mad_mode mode; /* channel mode (see above) */ |
763 | int mode_extension; /* additional mode info */ | 763 | int mode_extension; /* additional mode info */ |
764 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 764 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
765 | 765 | ||
766 | unsigned long bitrate; /* stream bitrate (bps) */ | 766 | unsigned long bitrate; /* stream bitrate (bps) */ |
767 | unsigned int samplerate; /* sampling frequency (Hz) */ | 767 | unsigned int samplerate; /* sampling frequency (Hz) */ |
768 | 768 | ||
769 | unsigned short crc_check; /* frame CRC accumulator */ | 769 | unsigned short crc_check; /* frame CRC accumulator */ |
770 | unsigned short crc_target; /* final target CRC checksum */ | 770 | unsigned short crc_target; /* final target CRC checksum */ |
771 | 771 | ||
772 | int flags; /* flags (see below) */ | 772 | int flags; /* flags (see below) */ |
773 | int private_bits; /* private bits (see below) */ | 773 | int private_bits; /* private bits (see below) */ |
774 | 774 | ||
775 | mad_timer_t duration; /* audio playing time of frame */ | 775 | mad_timer_t duration; /* audio playing time of frame */ |
776 | }; | 776 | }; |
777 | 777 | ||
778 | struct mad_frame { | 778 | struct mad_frame { |
779 | struct mad_header header; /* MPEG audio header */ | 779 | struct mad_header header; /* MPEG audio header */ |
780 | int options; /* decoding options (from stream) */ | 780 | int options; /* decoding options (from stream) */ |
781 | 781 | ||
782 | mad_fixed_t (*sbsample)[2][36][32]; /* synthesis subband filter samples */ | 782 | mad_fixed_t (*sbsample)[2][36][32]; /* synthesis subband filter samples */ |
783 | mad_fixed_t (*sbsample_prev)[2][36][32]; /* synthesis subband filter samples | 783 | mad_fixed_t (*sbsample_prev)[2][36][32]; /* synthesis subband filter samples |
@@ -787,33 +787,33 @@ struct mad_frame { | |||
787 | mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ | 787 | mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ |
788 | }; | 788 | }; |
789 | 789 | ||
790 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) | 790 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) |
791 | # define MAD_NSBSAMPLES(header) \ | 791 | # define MAD_NSBSAMPLES(header) \ |
792 | ((header)->layer == MAD_LAYER_I ? 12 : \ | 792 | ((header)->layer == MAD_LAYER_I ? 12 : \ |
793 | (((header)->layer == MAD_LAYER_III && \ | 793 | (((header)->layer == MAD_LAYER_III && \ |
794 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) | 794 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) |
795 | 795 | ||
796 | enum { | 796 | enum { |
797 | MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ | 797 | MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ |
798 | MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ | 798 | MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ |
799 | 799 | ||
800 | MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ | 800 | MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ |
801 | MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ | 801 | MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ |
802 | MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ | 802 | MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ |
803 | MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ | 803 | MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ |
804 | 804 | ||
805 | MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ | 805 | MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ |
806 | MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ | 806 | MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ |
807 | MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ | 807 | MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ |
808 | 808 | ||
809 | MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ | 809 | MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ |
810 | MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ | 810 | MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ |
811 | MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ | 811 | MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ |
812 | }; | 812 | }; |
813 | 813 | ||
814 | enum { | 814 | enum { |
815 | MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ | 815 | MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ |
816 | MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ | 816 | MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ |
817 | }; | 817 | }; |
818 | 818 | ||
819 | void mad_header_init(struct mad_header *); | 819 | void mad_header_init(struct mad_header *); |
@@ -838,19 +838,19 @@ void mad_frame_mute(struct mad_frame *); | |||
838 | 838 | ||
839 | 839 | ||
840 | struct mad_pcm { | 840 | struct mad_pcm { |
841 | unsigned int samplerate; /* sampling frequency (Hz) */ | 841 | unsigned int samplerate; /* sampling frequency (Hz) */ |
842 | unsigned short channels; /* number of channels */ | 842 | unsigned short channels; /* number of channels */ |
843 | unsigned short length; /* number of samples per channel */ | 843 | unsigned short length; /* number of samples per channel */ |
844 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ | 844 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ |
845 | }; | 845 | }; |
846 | 846 | ||
847 | struct mad_synth { | 847 | struct mad_synth { |
848 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ | 848 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ |
849 | /* [ch][eo][peo][s][v] */ | 849 | /* [ch][eo][peo][s][v] */ |
850 | 850 | ||
851 | unsigned int phase; /* current processing phase */ | 851 | unsigned int phase; /* current processing phase */ |
852 | 852 | ||
853 | struct mad_pcm pcm; /* PCM output */ | 853 | struct mad_pcm pcm; /* PCM output */ |
854 | }; | 854 | }; |
855 | 855 | ||
856 | /* single channel PCM selector */ | 856 | /* single channel PCM selector */ |
@@ -920,26 +920,26 @@ struct mad_decoder { | |||
920 | enum mad_flow (*input_func)(void *, struct mad_stream *); | 920 | enum mad_flow (*input_func)(void *, struct mad_stream *); |
921 | enum mad_flow (*header_func)(void *, struct mad_header const *); | 921 | enum mad_flow (*header_func)(void *, struct mad_header const *); |
922 | enum mad_flow (*filter_func)(void *, | 922 | enum mad_flow (*filter_func)(void *, |
923 | struct mad_stream const *, struct mad_frame *); | 923 | struct mad_stream const *, struct mad_frame *); |
924 | enum mad_flow (*output_func)(void *, | 924 | enum mad_flow (*output_func)(void *, |
925 | struct mad_header const *, struct mad_pcm *); | 925 | struct mad_header const *, struct mad_pcm *); |
926 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); | 926 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
927 | enum mad_flow (*message_func)(void *, void *, unsigned int *); | 927 | enum mad_flow (*message_func)(void *, void *, unsigned int *); |
928 | }; | 928 | }; |
929 | 929 | ||
930 | void mad_decoder_init(struct mad_decoder *, void *, | 930 | void mad_decoder_init(struct mad_decoder *, void *, |
931 | enum mad_flow (*)(void *, struct mad_stream *), | 931 | enum mad_flow (*)(void *, struct mad_stream *), |
932 | enum mad_flow (*)(void *, struct mad_header const *), | 932 | enum mad_flow (*)(void *, struct mad_header const *), |
933 | enum mad_flow (*)(void *, | 933 | enum mad_flow (*)(void *, |
934 | struct mad_stream const *, | 934 | struct mad_stream const *, |
935 | struct mad_frame *), | 935 | struct mad_frame *), |
936 | enum mad_flow (*)(void *, | 936 | enum mad_flow (*)(void *, |
937 | struct mad_header const *, | 937 | struct mad_header const *, |
938 | struct mad_pcm *), | 938 | struct mad_pcm *), |
939 | enum mad_flow (*)(void *, | 939 | enum mad_flow (*)(void *, |
940 | struct mad_stream *, | 940 | struct mad_stream *, |
941 | struct mad_frame *), | 941 | struct mad_frame *), |
942 | enum mad_flow (*)(void *, void *, unsigned int *)); | 942 | enum mad_flow (*)(void *, void *, unsigned int *)); |
943 | int mad_decoder_finish(struct mad_decoder *); | 943 | int mad_decoder_finish(struct mad_decoder *); |
944 | 944 | ||
945 | # define mad_decoder_options(decoder, opts) \ | 945 | # define mad_decoder_options(decoder, opts) \ |
diff --git a/apps/codecs/libmad/minimad.c b/apps/codecs/libmad/minimad.c index 6b443cf859..7a23b346c2 100644 --- a/apps/codecs/libmad/minimad.c +++ b/apps/codecs/libmad/minimad.c | |||
@@ -82,7 +82,7 @@ struct buffer { | |||
82 | 82 | ||
83 | static | 83 | static |
84 | enum mad_flow input(void *data, | 84 | enum mad_flow input(void *data, |
85 | struct mad_stream *stream) | 85 | struct mad_stream *stream) |
86 | { | 86 | { |
87 | struct buffer *buffer = data; | 87 | struct buffer *buffer = data; |
88 | 88 | ||
@@ -128,8 +128,8 @@ signed int scale(mad_fixed_t sample) | |||
128 | 128 | ||
129 | static | 129 | static |
130 | enum mad_flow output(void *data, | 130 | enum mad_flow output(void *data, |
131 | struct mad_header const *header, | 131 | struct mad_header const *header, |
132 | struct mad_pcm *pcm) | 132 | struct mad_pcm *pcm) |
133 | { | 133 | { |
134 | unsigned int nchannels, nsamples; | 134 | unsigned int nchannels, nsamples; |
135 | mad_fixed_t const *left_ch, *right_ch; | 135 | mad_fixed_t const *left_ch, *right_ch; |
@@ -169,14 +169,14 @@ enum mad_flow output(void *data, | |||
169 | 169 | ||
170 | static | 170 | static |
171 | enum mad_flow error(void *data, | 171 | enum mad_flow error(void *data, |
172 | struct mad_stream *stream, | 172 | struct mad_stream *stream, |
173 | struct mad_frame *frame) | 173 | struct mad_frame *frame) |
174 | { | 174 | { |
175 | struct buffer *buffer = data; | 175 | struct buffer *buffer = data; |
176 | 176 | ||
177 | fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n", | 177 | fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n", |
178 | stream->error, mad_stream_errorstr(stream), | 178 | stream->error, mad_stream_errorstr(stream), |
179 | stream->this_frame - buffer->start); | 179 | stream->this_frame - buffer->start); |
180 | 180 | ||
181 | /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */ | 181 | /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */ |
182 | 182 | ||
@@ -207,8 +207,8 @@ int decode(unsigned char const *start, unsigned long length) | |||
207 | /* configure input, output, and error functions */ | 207 | /* configure input, output, and error functions */ |
208 | 208 | ||
209 | mad_decoder_init(&decoder, &buffer, | 209 | mad_decoder_init(&decoder, &buffer, |
210 | input, 0 /* header */, 0 /* filter */, output, | 210 | input, 0 /* header */, 0 /* filter */, output, |
211 | error, 0 /* message */); | 211 | error, 0 /* message */); |
212 | 212 | ||
213 | /* start decoding */ | 213 | /* start decoding */ |
214 | 214 | ||
diff --git a/apps/codecs/libmad/stream.c b/apps/codecs/libmad/stream.c index 2936736f76..adc982650c 100644 --- a/apps/codecs/libmad/stream.c +++ b/apps/codecs/libmad/stream.c | |||
@@ -29,7 +29,7 @@ | |||
29 | # include "stream.h" | 29 | # include "stream.h" |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * NAME: stream->init() | 32 | * NAME: stream->init() |
33 | * DESCRIPTION: initialize stream struct | 33 | * DESCRIPTION: initialize stream struct |
34 | */ | 34 | */ |
35 | void mad_stream_init(struct mad_stream *stream) | 35 | void mad_stream_init(struct mad_stream *stream) |
@@ -56,7 +56,7 @@ void mad_stream_init(struct mad_stream *stream) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * NAME: stream->finish() | 59 | * NAME: stream->finish() |
60 | * DESCRIPTION: deallocate any dynamic memory associated with stream | 60 | * DESCRIPTION: deallocate any dynamic memory associated with stream |
61 | */ | 61 | */ |
62 | void mad_stream_finish(struct mad_stream *stream) | 62 | void mad_stream_finish(struct mad_stream *stream) |
@@ -71,11 +71,11 @@ void mad_stream_finish(struct mad_stream *stream) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * NAME: stream->buffer() | 74 | * NAME: stream->buffer() |
75 | * DESCRIPTION: set stream buffer pointers | 75 | * DESCRIPTION: set stream buffer pointers |
76 | */ | 76 | */ |
77 | void mad_stream_buffer(struct mad_stream *stream, | 77 | void mad_stream_buffer(struct mad_stream *stream, |
78 | unsigned char const *buffer, unsigned long length) | 78 | unsigned char const *buffer, unsigned long length) |
79 | { | 79 | { |
80 | stream->buffer = buffer; | 80 | stream->buffer = buffer; |
81 | stream->bufend = buffer + length; | 81 | stream->bufend = buffer + length; |
@@ -89,7 +89,7 @@ void mad_stream_buffer(struct mad_stream *stream, | |||
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * NAME: stream->skip() | 92 | * NAME: stream->skip() |
93 | * DESCRIPTION: arrange to skip bytes before the next frame | 93 | * DESCRIPTION: arrange to skip bytes before the next frame |
94 | */ | 94 | */ |
95 | void mad_stream_skip(struct mad_stream *stream, unsigned long length) | 95 | void mad_stream_skip(struct mad_stream *stream, unsigned long length) |
@@ -98,7 +98,7 @@ void mad_stream_skip(struct mad_stream *stream, unsigned long length) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * NAME: stream->sync() | 101 | * NAME: stream->sync() |
102 | * DESCRIPTION: locate the next stream sync word | 102 | * DESCRIPTION: locate the next stream sync word |
103 | */ | 103 | */ |
104 | int mad_stream_sync(struct mad_stream *stream) | 104 | int mad_stream_sync(struct mad_stream *stream) |
@@ -109,7 +109,7 @@ int mad_stream_sync(struct mad_stream *stream) | |||
109 | end = stream->bufend; | 109 | end = stream->bufend; |
110 | 110 | ||
111 | while (ptr < end - 1 && | 111 | while (ptr < end - 1 && |
112 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) | 112 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) |
113 | ++ptr; | 113 | ++ptr; |
114 | 114 | ||
115 | if (end - ptr < MAD_BUFFER_GUARD) | 115 | if (end - ptr < MAD_BUFFER_GUARD) |
@@ -121,38 +121,38 @@ int mad_stream_sync(struct mad_stream *stream) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | /* | 123 | /* |
124 | * NAME: stream->errorstr() | 124 | * NAME: stream->errorstr() |
125 | * DESCRIPTION: return a string description of the current error condition | 125 | * DESCRIPTION: return a string description of the current error condition |
126 | */ | 126 | */ |
127 | char const *mad_stream_errorstr(struct mad_stream const *stream) | 127 | char const *mad_stream_errorstr(struct mad_stream const *stream) |
128 | { | 128 | { |
129 | switch (stream->error) { | 129 | switch (stream->error) { |
130 | case MAD_ERROR_NONE: return "no error"; | 130 | case MAD_ERROR_NONE: return "no error"; |
131 | 131 | ||
132 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; | 132 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; |
133 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; | 133 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; |
134 | 134 | ||
135 | case MAD_ERROR_NOMEM: return "not enough memory"; | 135 | case MAD_ERROR_NOMEM: return "not enough memory"; |
136 | 136 | ||
137 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; | 137 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; |
138 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; | 138 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; |
139 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; | 139 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; |
140 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; | 140 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; |
141 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; | 141 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; |
142 | 142 | ||
143 | case MAD_ERROR_BADCRC: return "CRC check failed"; | 143 | case MAD_ERROR_BADCRC: return "CRC check failed"; |
144 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; | 144 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; |
145 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; | 145 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; |
146 | case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; | 146 | case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; |
147 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; | 147 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; |
148 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; | 148 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; |
149 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; | 149 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; |
150 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; | 150 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; |
151 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; | 151 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; |
152 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; | 152 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; |
153 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; | 153 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; |
154 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; | 154 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; |
155 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; | 155 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; |
156 | } | 156 | } |
157 | 157 | ||
158 | return 0; | 158 | return 0; |
diff --git a/apps/codecs/libmad/stream.h b/apps/codecs/libmad/stream.h index c89c40e088..be48edbd19 100644 --- a/apps/codecs/libmad/stream.h +++ b/apps/codecs/libmad/stream.h | |||
@@ -24,16 +24,16 @@ | |||
24 | 24 | ||
25 | # include "bit.h" | 25 | # include "bit.h" |
26 | 26 | ||
27 | # define MAD_BUFFER_GUARD 8 | 27 | # define MAD_BUFFER_GUARD 8 |
28 | # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) | 28 | # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) |
29 | 29 | ||
30 | enum mad_error { | 30 | enum mad_error { |
31 | MAD_ERROR_NONE = 0x0000, /* no error */ | 31 | MAD_ERROR_NONE = 0x0000, /* no error */ |
32 | 32 | ||
33 | MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ | 33 | MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ |
34 | MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ | 34 | MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ |
35 | 35 | ||
36 | MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ | 36 | MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ |
37 | 37 | ||
38 | MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ | 38 | MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ |
39 | MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ | 39 | MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ |
@@ -41,7 +41,7 @@ enum mad_error { | |||
41 | MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ | 41 | MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ |
42 | MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ | 42 | MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ |
43 | 43 | ||
44 | MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ | 44 | MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ |
45 | MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ | 45 | MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ |
46 | MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ | 46 | MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ |
47 | MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ | 47 | MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ |
@@ -53,32 +53,32 @@ enum mad_error { | |||
53 | MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ | 53 | MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ |
54 | MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ | 54 | MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ |
55 | MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ | 55 | MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ |
56 | MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ | 56 | MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | # define MAD_RECOVERABLE(error) ((error) & 0xff00) | 59 | # define MAD_RECOVERABLE(error) ((error) & 0xff00) |
60 | 60 | ||
61 | struct mad_stream { | 61 | struct mad_stream { |
62 | unsigned char const *buffer; /* input bitstream buffer */ | 62 | unsigned char const *buffer; /* input bitstream buffer */ |
63 | unsigned char const *bufend; /* end of buffer */ | 63 | unsigned char const *bufend; /* end of buffer */ |
64 | unsigned long skiplen; /* bytes to skip before next frame */ | 64 | unsigned long skiplen; /* bytes to skip before next frame */ |
65 | 65 | ||
66 | int sync; /* stream sync found */ | 66 | int sync; /* stream sync found */ |
67 | unsigned long freerate; /* free bitrate (fixed) */ | 67 | unsigned long freerate; /* free bitrate (fixed) */ |
68 | 68 | ||
69 | unsigned char const *this_frame; /* start of current frame */ | 69 | unsigned char const *this_frame; /* start of current frame */ |
70 | unsigned char const *next_frame; /* start of next frame */ | 70 | unsigned char const *next_frame; /* start of next frame */ |
71 | struct mad_bitptr ptr; /* current processing bit pointer */ | 71 | struct mad_bitptr ptr; /* current processing bit pointer */ |
72 | 72 | ||
73 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ | 73 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ |
74 | unsigned int anc_bitlen; /* number of ancillary bits */ | 74 | unsigned int anc_bitlen; /* number of ancillary bits */ |
75 | 75 | ||
76 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; | 76 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; |
77 | /* Layer III main_data() */ | 77 | /* Layer III main_data() */ |
78 | unsigned int md_len; /* bytes in main_data */ | 78 | unsigned int md_len; /* bytes in main_data */ |
79 | 79 | ||
80 | int options; /* decoding options (see below) */ | 80 | int options; /* decoding options (see below) */ |
81 | enum mad_error error; /* error code (see above) */ | 81 | enum mad_error error; /* error code (see above) */ |
82 | }; | 82 | }; |
83 | 83 | ||
84 | enum { | 84 | enum { |
@@ -98,7 +98,7 @@ void mad_stream_finish(struct mad_stream *); | |||
98 | ((void) ((stream)->options = (opts))) | 98 | ((void) ((stream)->options = (opts))) |
99 | 99 | ||
100 | void mad_stream_buffer(struct mad_stream *, | 100 | void mad_stream_buffer(struct mad_stream *, |
101 | unsigned char const *, unsigned long); | 101 | unsigned char const *, unsigned long); |
102 | void mad_stream_skip(struct mad_stream *, unsigned long); | 102 | void mad_stream_skip(struct mad_stream *, unsigned long); |
103 | 103 | ||
104 | int mad_stream_sync(struct mad_stream *); | 104 | int mad_stream_sync(struct mad_stream *); |
diff --git a/apps/codecs/libmad/synth.c b/apps/codecs/libmad/synth.c index 9b320b594d..9d1bdb7c91 100644 --- a/apps/codecs/libmad/synth.c +++ b/apps/codecs/libmad/synth.c | |||
@@ -30,7 +30,7 @@ | |||
30 | # include "synth.h" | 30 | # include "synth.h" |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * NAME: synth->init() | 33 | * NAME: synth->init() |
34 | * DESCRIPTION: initialize synth struct | 34 | * DESCRIPTION: initialize synth struct |
35 | */ | 35 | */ |
36 | void mad_synth_init(struct mad_synth *synth) | 36 | void mad_synth_init(struct mad_synth *synth) |
@@ -50,7 +50,7 @@ void mad_synth_init(struct mad_synth *synth) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * NAME: synth->mute() | 53 | * NAME: synth->mute() |
54 | * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis | 54 | * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis |
55 | */ | 55 | */ |
56 | void mad_synth_mute(struct mad_synth *synth) | 56 | void mad_synth_mute(struct mad_synth *synth) |
@@ -60,8 +60,8 @@ void mad_synth_mute(struct mad_synth *synth) | |||
60 | for (ch = 0; ch < 2; ++ch) { | 60 | for (ch = 0; ch < 2; ++ch) { |
61 | for (s = 0; s < 16; ++s) { | 61 | for (s = 0; s < 16; ++s) { |
62 | for (v = 0; v < 8; ++v) { | 62 | for (v = 0; v < 8; ++v) { |
63 | synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = | 63 | synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = |
64 | synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; | 64 | synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | } | 67 | } |
@@ -142,12 +142,12 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
142 | # endif | 142 | # endif |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * NAME: dct32() | 145 | * NAME: dct32() |
146 | * DESCRIPTION: perform fast in[32]->out[32] DCT | 146 | * DESCRIPTION: perform fast in[32]->out[32] DCT |
147 | */ | 147 | */ |
148 | static | 148 | static |
149 | void dct32(mad_fixed_t const in[32], unsigned int slot, | 149 | void dct32(mad_fixed_t const in[32], unsigned int slot, |
150 | mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) | 150 | mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) |
151 | { | 151 | { |
152 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; | 152 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; |
153 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; | 153 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; |
@@ -176,69 +176,69 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
176 | /* costab[i] = cos(PI / (2 * 32) * i) */ | 176 | /* costab[i] = cos(PI / (2 * 32) * i) */ |
177 | 177 | ||
178 | # if defined(OPT_DCTO) | 178 | # if defined(OPT_DCTO) |
179 | # define costab1 MAD_F(0x7fd8878e) | 179 | # define costab1 MAD_F(0x7fd8878e) |
180 | # define costab2 MAD_F(0x7f62368f) | 180 | # define costab2 MAD_F(0x7f62368f) |
181 | # define costab3 MAD_F(0x7e9d55fc) | 181 | # define costab3 MAD_F(0x7e9d55fc) |
182 | # define costab4 MAD_F(0x7d8a5f40) | 182 | # define costab4 MAD_F(0x7d8a5f40) |
183 | # define costab5 MAD_F(0x7c29fbee) | 183 | # define costab5 MAD_F(0x7c29fbee) |
184 | # define costab6 MAD_F(0x7a7d055b) | 184 | # define costab6 MAD_F(0x7a7d055b) |
185 | # define costab7 MAD_F(0x78848414) | 185 | # define costab7 MAD_F(0x78848414) |
186 | # define costab8 MAD_F(0x7641af3d) | 186 | # define costab8 MAD_F(0x7641af3d) |
187 | # define costab9 MAD_F(0x73b5ebd1) | 187 | # define costab9 MAD_F(0x73b5ebd1) |
188 | # define costab10 MAD_F(0x70e2cbc6) | 188 | # define costab10 MAD_F(0x70e2cbc6) |
189 | # define costab11 MAD_F(0x6dca0d14) | 189 | # define costab11 MAD_F(0x6dca0d14) |
190 | # define costab12 MAD_F(0x6a5d98a4) | 190 | # define costab12 MAD_F(0x6a5d98a4) |
191 | # define costab13 MAD_F(0x66cf8120) | 191 | # define costab13 MAD_F(0x66cf8120) |
192 | # define costab14 MAD_F(0x62f201ac) | 192 | # define costab14 MAD_F(0x62f201ac) |
193 | # define costab15 MAD_F(0x5ed77c8a) | 193 | # define costab15 MAD_F(0x5ed77c8a) |
194 | # define costab16 MAD_F(0x5a82799a) | 194 | # define costab16 MAD_F(0x5a82799a) |
195 | # define costab17 MAD_F(0x55f5a4d2) | 195 | # define costab17 MAD_F(0x55f5a4d2) |
196 | # define costab18 MAD_F(0x5133cc94) | 196 | # define costab18 MAD_F(0x5133cc94) |
197 | # define costab19 MAD_F(0x4c3fdff4) | 197 | # define costab19 MAD_F(0x4c3fdff4) |
198 | # define costab20 MAD_F(0x471cece7) | 198 | # define costab20 MAD_F(0x471cece7) |
199 | # define costab21 MAD_F(0x41ce1e65) | 199 | # define costab21 MAD_F(0x41ce1e65) |
200 | # define costab22 MAD_F(0x3c56ba70) | 200 | # define costab22 MAD_F(0x3c56ba70) |
201 | # define costab23 MAD_F(0x36ba2014) | 201 | # define costab23 MAD_F(0x36ba2014) |
202 | # define costab24 MAD_F(0x30fbc54d) | 202 | # define costab24 MAD_F(0x30fbc54d) |
203 | # define costab25 MAD_F(0x2b1f34eb) | 203 | # define costab25 MAD_F(0x2b1f34eb) |
204 | # define costab26 MAD_F(0x25280c5e) | 204 | # define costab26 MAD_F(0x25280c5e) |
205 | # define costab27 MAD_F(0x1f19f97b) | 205 | # define costab27 MAD_F(0x1f19f97b) |
206 | # define costab28 MAD_F(0x18f8b83c) | 206 | # define costab28 MAD_F(0x18f8b83c) |
207 | # define costab29 MAD_F(0x12c8106f) | 207 | # define costab29 MAD_F(0x12c8106f) |
208 | # define costab30 MAD_F(0x0c8bd35e) | 208 | # define costab30 MAD_F(0x0c8bd35e) |
209 | # define costab31 MAD_F(0x0647d97c) | 209 | # define costab31 MAD_F(0x0647d97c) |
210 | # else | 210 | # else |
211 | # define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ | 211 | # define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ |
212 | # define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ | 212 | # define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ |
213 | # define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ | 213 | # define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ |
214 | # define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ | 214 | # define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ |
215 | # define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ | 215 | # define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ |
216 | # define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ | 216 | # define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ |
217 | # define costab7 MAD_F(0x0f109082) /* 0.941544065 */ | 217 | # define costab7 MAD_F(0x0f109082) /* 0.941544065 */ |
218 | # define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ | 218 | # define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ |
219 | # define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ | 219 | # define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ |
220 | # define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ | 220 | # define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ |
221 | # define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ | 221 | # define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ |
222 | # define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ | 222 | # define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ |
223 | # define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ | 223 | # define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ |
224 | # define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ | 224 | # define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ |
225 | # define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ | 225 | # define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ |
226 | # define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ | 226 | # define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ |
227 | # define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ | 227 | # define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ |
228 | # define costab18 MAD_F(0x0a267993) /* 0.634393284 */ | 228 | # define costab18 MAD_F(0x0a267993) /* 0.634393284 */ |
229 | # define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ | 229 | # define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ |
230 | # define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ | 230 | # define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ |
231 | # define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ | 231 | # define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ |
232 | # define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ | 232 | # define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ |
233 | # define costab23 MAD_F(0x06d74402) /* 0.427555093 */ | 233 | # define costab23 MAD_F(0x06d74402) /* 0.427555093 */ |
234 | # define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ | 234 | # define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ |
235 | # define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ | 235 | # define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ |
236 | # define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ | 236 | # define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ |
237 | # define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ | 237 | # define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ |
238 | # define costab28 MAD_F(0x031f1708) /* 0.195090322 */ | 238 | # define costab28 MAD_F(0x031f1708) /* 0.195090322 */ |
239 | # define costab29 MAD_F(0x0259020e) /* 0.146730474 */ | 239 | # define costab29 MAD_F(0x0259020e) /* 0.146730474 */ |
240 | # define costab30 MAD_F(0x01917a5c) /* 0.098017140 */ | 240 | # define costab30 MAD_F(0x01917a5c) /* 0.098017140 */ |
241 | # define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ | 241 | # define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ |
242 | # endif | 242 | # endif |
243 | 243 | ||
244 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); | 244 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); |
@@ -395,7 +395,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
395 | 395 | ||
396 | /* 8 */ hi[ 7][slot] = SHIFT(t143); | 396 | /* 8 */ hi[ 7][slot] = SHIFT(t143); |
397 | /* 24 */ lo[ 8][slot] = | 397 | /* 24 */ lo[ 8][slot] = |
398 | SHIFT((MUL(t141 - t142, costab16) * 2) - t143); | 398 | SHIFT((MUL(t141 - t142, costab16) * 2) - t143); |
399 | 399 | ||
400 | t144 = MUL(t73 - t74, costab8); | 400 | t144 = MUL(t73 - t74, costab8); |
401 | t145 = MUL(t75 - t76, costab24); | 401 | t145 = MUL(t75 - t76, costab24); |
@@ -435,7 +435,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
435 | 435 | ||
436 | /* 20 */ lo[ 4][slot] = SHIFT(t160); | 436 | /* 20 */ lo[ 4][slot] = SHIFT(t160); |
437 | /* 28 */ lo[12][slot] = | 437 | /* 28 */ lo[12][slot] = |
438 | SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); | 438 | SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); |
439 | 439 | ||
440 | t161 = MUL(t94 - t95, costab8); | 440 | t161 = MUL(t94 - t95, costab8); |
441 | t162 = MUL(t96 - t97, costab24); | 441 | t162 = MUL(t96 - t97, costab24); |
@@ -473,8 +473,8 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
473 | 473 | ||
474 | /* 26 */ lo[10][slot] = SHIFT(t170); | 474 | /* 26 */ lo[10][slot] = SHIFT(t170); |
475 | /* 30 */ lo[14][slot] = | 475 | /* 30 */ lo[14][slot] = |
476 | SHIFT((((((MUL(t166 - t167, costab16) * 2) - | 476 | SHIFT((((((MUL(t166 - t167, costab16) * 2) - |
477 | t168) * 2) - t169) * 2) - t170); | 477 | t168) * 2) - t169) * 2) - t170); |
478 | 478 | ||
479 | t171 = MUL(t106 - t107, costab8); | 479 | t171 = MUL(t106 - t107, costab8); |
480 | t172 = MUL(t108 - t109, costab24); | 480 | t172 = MUL(t108 - t109, costab24); |
@@ -521,12 +521,12 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
521 | /* 27 */ lo[11][slot] = SHIFT(t165); | 521 | /* 27 */ lo[11][slot] = SHIFT(t165); |
522 | 522 | ||
523 | t176 = (((((MUL(t161 - t162, costab16) * 2) - | 523 | t176 = (((((MUL(t161 - t162, costab16) * 2) - |
524 | t163) * 2) - t164) * 2) - t165; | 524 | t163) * 2) - t164) * 2) - t165; |
525 | 525 | ||
526 | /* 29 */ lo[13][slot] = SHIFT(t176); | 526 | /* 29 */ lo[13][slot] = SHIFT(t176); |
527 | /* 31 */ lo[15][slot] = | 527 | /* 31 */ lo[15][slot] = |
528 | SHIFT((((((((MUL(t171 - t172, costab16) * 2) - | 528 | SHIFT((((((((MUL(t171 - t172, costab16) * 2) - |
529 | t173) * 2) - t174) * 2) - t175) * 2) - t176); | 529 | t173) * 2) - t174) * 2) - t175) * 2) - t176); |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * Totals: | 532 | * Totals: |
@@ -548,24 +548,24 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
548 | # if MAD_F_FRACBITS != 28 | 548 | # if MAD_F_FRACBITS != 28 |
549 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" | 549 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" |
550 | # endif | 550 | # endif |
551 | # define ML0(hi, lo, x, y) ((lo) = (x) * (y)) | 551 | # define ML0(hi, lo, x, y) ((lo) = (x) * (y)) |
552 | # define MLA(hi, lo, x, y) ((lo) += (x) * (y)) | 552 | # define MLA(hi, lo, x, y) ((lo) += (x) * (y)) |
553 | # define MLN(hi, lo) ((lo) = -(lo)) | 553 | # define MLN(hi, lo) ((lo) = -(lo)) |
554 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 554 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
555 | # define SHIFT(x) ((x) >> 2) | 555 | # define SHIFT(x) ((x) >> 2) |
556 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) | 556 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) |
557 | # else | 557 | # else |
558 | # define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) | 558 | # define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) |
559 | # define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) | 559 | # define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) |
560 | # define MLN(hi, lo) MAD_F_MLN((hi), (lo)) | 560 | # define MLN(hi, lo) MAD_F_MLN((hi), (lo)) |
561 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) | 561 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) |
562 | # define SHIFT(x) (x) | 562 | # define SHIFT(x) (x) |
563 | # if defined(MAD_F_SCALEBITS) | 563 | # if defined(MAD_F_SCALEBITS) |
564 | # undef MAD_F_SCALEBITS | 564 | # undef MAD_F_SCALEBITS |
565 | # define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) | 565 | # define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) |
566 | # define PRESHIFT(x) (MAD_F(x) >> 12) | 566 | # define PRESHIFT(x) (MAD_F(x) >> 12) |
567 | # else | 567 | # else |
568 | # define PRESHIFT(x) MAD_F(x) | 568 | # define PRESHIFT(x) MAD_F(x) |
569 | # endif | 569 | # endif |
570 | # endif | 570 | # endif |
571 | 571 | ||
@@ -576,10 +576,10 @@ mad_fixed_t const D[17][32] ICONST_ATTR = { | |||
576 | 576 | ||
577 | # if defined(ASO_SYNTH) | 577 | # if defined(ASO_SYNTH) |
578 | void synth_full(struct mad_synth *, struct mad_frame const *, | 578 | void synth_full(struct mad_synth *, struct mad_frame const *, |
579 | unsigned int, unsigned int); | 579 | unsigned int, unsigned int); |
580 | # else | 580 | # else |
581 | /* | 581 | /* |
582 | * NAME: synth->full() | 582 | * NAME: synth->full() |
583 | * DESCRIPTION: perform full frequency PCM synthesis | 583 | * DESCRIPTION: perform full frequency PCM synthesis |
584 | */ | 584 | */ |
585 | 585 | ||
@@ -587,7 +587,7 @@ void synth_full(struct mad_synth *, struct mad_frame const *, | |||
587 | # ifdef FPM_COLDFIRE_EMAC | 587 | # ifdef FPM_COLDFIRE_EMAC |
588 | static | 588 | static |
589 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | 589 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, |
590 | unsigned int nch, unsigned int ns) | 590 | unsigned int nch, unsigned int ns) |
591 | { | 591 | { |
592 | int sb; | 592 | int sb; |
593 | unsigned int phase, ch, s, p; | 593 | unsigned int phase, ch, s, p; |
@@ -606,7 +606,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
606 | 606 | ||
607 | for (s = 0; s < ns; ++s) { | 607 | for (s = 0; s < ns; ++s) { |
608 | dct32((*sbsample)[s], phase >> 1, | 608 | dct32((*sbsample)[s], phase >> 1, |
609 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 609 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
610 | 610 | ||
611 | p = (phase - 1) & 0xf; | 611 | p = (phase - 1) & 0xf; |
612 | 612 | ||
@@ -649,11 +649,11 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
649 | pcm += 16; | 649 | pcm += 16; |
650 | 650 | ||
651 | for (sb = 15; sb; sb--, fo++) { | 651 | for (sb = 15; sb; sb--, fo++) { |
652 | ++fe; | 652 | ++fe; |
653 | ++D0ptr; | 653 | ++D0ptr; |
654 | ++D1ptr; | 654 | ++D1ptr; |
655 | 655 | ||
656 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 656 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
657 | asm volatile ( | 657 | asm volatile ( |
658 | "movem.l (%0), %%d0-%%d7\n\t" | 658 | "movem.l (%0), %%d0-%%d7\n\t" |
659 | "move.l 4(%2), %%a5\n\t" | 659 | "move.l 4(%2), %%a5\n\t" |
@@ -697,8 +697,8 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
697 | "movclr.l %%acc0, %0\n\t" | 697 | "movclr.l %%acc0, %0\n\t" |
698 | "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); | 698 | "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); |
699 | 699 | ||
700 | pcm[-sb] = hi0 << 3; | 700 | pcm[-sb] = hi0 << 3; |
701 | pcm[ sb] = hi1 << 3; | 701 | pcm[ sb] = hi1 << 3; |
702 | } | 702 | } |
703 | 703 | ||
704 | ++D0ptr; | 704 | ++D0ptr; |
@@ -750,11 +750,11 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
750 | pcm += 16; | 750 | pcm += 16; |
751 | 751 | ||
752 | for (sb = 15; sb; sb--, fo++) { | 752 | for (sb = 15; sb; sb--, fo++) { |
753 | ++fe; | 753 | ++fe; |
754 | ++D0ptr; | 754 | ++D0ptr; |
755 | ++D1ptr; | 755 | ++D1ptr; |
756 | 756 | ||
757 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 757 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
758 | asm volatile ( | 758 | asm volatile ( |
759 | "movem.l (%0), %%d0-%%d7\n\t" | 759 | "movem.l (%0), %%d0-%%d7\n\t" |
760 | "move.l (%2), %%a5\n\t" | 760 | "move.l (%2), %%a5\n\t" |
@@ -798,8 +798,8 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
798 | "movclr.l %%acc0, %0\n\t" | 798 | "movclr.l %%acc0, %0\n\t" |
799 | "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); | 799 | "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); |
800 | 800 | ||
801 | pcm[-sb] = hi0 << 3; | 801 | pcm[-sb] = hi0 << 3; |
802 | pcm[ sb] = hi1 << 3; | 802 | pcm[ sb] = hi1 << 3; |
803 | } | 803 | } |
804 | 804 | ||
805 | ++D0ptr; | 805 | ++D0ptr; |
@@ -1045,10 +1045,10 @@ void synth_full2(mad_fixed_t *pcm, mad_fixed_t (*fo)[8], mad_fixed_t (*fe)[8], | |||
1045 | 1045 | ||
1046 | static | 1046 | static |
1047 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | 1047 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, |
1048 | unsigned int nch, unsigned int ns) ICODE_ATTR_MPA_SYNTH; | 1048 | unsigned int nch, unsigned int ns) ICODE_ATTR_MPA_SYNTH; |
1049 | static | 1049 | static |
1050 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | 1050 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, |
1051 | unsigned int nch, unsigned int ns) | 1051 | unsigned int nch, unsigned int ns) |
1052 | { | 1052 | { |
1053 | int p; | 1053 | int p; |
1054 | unsigned int phase, ch, s; | 1054 | unsigned int phase, ch, s; |
@@ -1068,7 +1068,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1068 | 1068 | ||
1069 | for (s = 0; s < ns; ++s) { | 1069 | for (s = 0; s < ns; ++s) { |
1070 | dct32((*sbsample)[s], phase >> 1, | 1070 | dct32((*sbsample)[s], phase >> 1, |
1071 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 1071 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
1072 | 1072 | ||
1073 | p = (phase - 1) & 0xf; | 1073 | p = (phase - 1) & 0xf; |
1074 | 1074 | ||
@@ -1189,7 +1189,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1189 | 1189 | ||
1190 | static | 1190 | static |
1191 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | 1191 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, |
1192 | unsigned int nch, unsigned int ns) | 1192 | unsigned int nch, unsigned int ns) |
1193 | { | 1193 | { |
1194 | int p, sb; | 1194 | int p, sb; |
1195 | unsigned int phase, ch, s; | 1195 | unsigned int phase, ch, s; |
@@ -1209,7 +1209,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1209 | 1209 | ||
1210 | for (s = 0; s < ns; ++s) { | 1210 | for (s = 0; s < ns; ++s) { |
1211 | dct32((*sbsample)[s], phase >> 1, | 1211 | dct32((*sbsample)[s], phase >> 1, |
1212 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 1212 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
1213 | 1213 | ||
1214 | p = (phase - 1) & 0xf; | 1214 | p = (phase - 1) & 0xf; |
1215 | 1215 | ||
@@ -1246,49 +1246,49 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1246 | 1246 | ||
1247 | for (sb = 15; sb; sb--, fo++) | 1247 | for (sb = 15; sb; sb--, fo++) |
1248 | { | 1248 | { |
1249 | ++fe; | 1249 | ++fe; |
1250 | ++D0ptr; | 1250 | ++D0ptr; |
1251 | ++D1ptr; | 1251 | ++D1ptr; |
1252 | 1252 | ||
1253 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 1253 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
1254 | ptr = *D0ptr; | 1254 | ptr = *D0ptr; |
1255 | ML0(hi, lo, (*fo)[0], ptr[ 1]); | 1255 | ML0(hi, lo, (*fo)[0], ptr[ 1]); |
1256 | MLA(hi, lo, (*fo)[1], ptr[15]); | 1256 | MLA(hi, lo, (*fo)[1], ptr[15]); |
1257 | MLA(hi, lo, (*fo)[2], ptr[13]); | 1257 | MLA(hi, lo, (*fo)[2], ptr[13]); |
1258 | MLA(hi, lo, (*fo)[3], ptr[11]); | 1258 | MLA(hi, lo, (*fo)[3], ptr[11]); |
1259 | MLA(hi, lo, (*fo)[4], ptr[ 9]); | 1259 | MLA(hi, lo, (*fo)[4], ptr[ 9]); |
1260 | MLA(hi, lo, (*fo)[5], ptr[ 7]); | 1260 | MLA(hi, lo, (*fo)[5], ptr[ 7]); |
1261 | MLA(hi, lo, (*fo)[6], ptr[ 5]); | 1261 | MLA(hi, lo, (*fo)[6], ptr[ 5]); |
1262 | MLA(hi, lo, (*fo)[7], ptr[ 3]); | 1262 | MLA(hi, lo, (*fo)[7], ptr[ 3]); |
1263 | MLN(hi, lo); | 1263 | MLN(hi, lo); |
1264 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 1264 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
1265 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 1265 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
1266 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 1266 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
1267 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 1267 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
1268 | MLA(hi, lo, (*fe)[3], ptr[10]); | 1268 | MLA(hi, lo, (*fe)[3], ptr[10]); |
1269 | MLA(hi, lo, (*fe)[2], ptr[12]); | 1269 | MLA(hi, lo, (*fe)[2], ptr[12]); |
1270 | MLA(hi, lo, (*fe)[1], ptr[14]); | 1270 | MLA(hi, lo, (*fe)[1], ptr[14]); |
1271 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 1271 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
1272 | pcm[-sb] = SHIFT(MLZ(hi, lo)); | 1272 | pcm[-sb] = SHIFT(MLZ(hi, lo)); |
1273 | 1273 | ||
1274 | ptr = *D1ptr; | 1274 | ptr = *D1ptr; |
1275 | ML0(hi, lo, (*fe)[0], ptr[31 - 16]); | 1275 | ML0(hi, lo, (*fe)[0], ptr[31 - 16]); |
1276 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); | 1276 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); |
1277 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); | 1277 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); |
1278 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); | 1278 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); |
1279 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); | 1279 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); |
1280 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); | 1280 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); |
1281 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); | 1281 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); |
1282 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); | 1282 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); |
1283 | MLA(hi, lo, (*fo)[7], ptr[31 - 3]); | 1283 | MLA(hi, lo, (*fo)[7], ptr[31 - 3]); |
1284 | MLA(hi, lo, (*fo)[6], ptr[31 - 5]); | 1284 | MLA(hi, lo, (*fo)[6], ptr[31 - 5]); |
1285 | MLA(hi, lo, (*fo)[5], ptr[31 - 7]); | 1285 | MLA(hi, lo, (*fo)[5], ptr[31 - 7]); |
1286 | MLA(hi, lo, (*fo)[4], ptr[31 - 9]); | 1286 | MLA(hi, lo, (*fo)[4], ptr[31 - 9]); |
1287 | MLA(hi, lo, (*fo)[3], ptr[31 - 11]); | 1287 | MLA(hi, lo, (*fo)[3], ptr[31 - 11]); |
1288 | MLA(hi, lo, (*fo)[2], ptr[31 - 13]); | 1288 | MLA(hi, lo, (*fo)[2], ptr[31 - 13]); |
1289 | MLA(hi, lo, (*fo)[1], ptr[31 - 15]); | 1289 | MLA(hi, lo, (*fo)[1], ptr[31 - 15]); |
1290 | MLA(hi, lo, (*fo)[0], ptr[31 - 1]); | 1290 | MLA(hi, lo, (*fo)[0], ptr[31 - 1]); |
1291 | pcm[sb] = SHIFT(MLZ(hi, lo)); | 1291 | pcm[sb] = SHIFT(MLZ(hi, lo)); |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | ptr = *(D0ptr + 1); | 1294 | ptr = *(D0ptr + 1); |
@@ -1327,49 +1327,49 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1327 | 1327 | ||
1328 | for (sb = 15; sb; sb--, fo++) | 1328 | for (sb = 15; sb; sb--, fo++) |
1329 | { | 1329 | { |
1330 | ++fe; | 1330 | ++fe; |
1331 | ++D0ptr; | 1331 | ++D0ptr; |
1332 | ++D1ptr; | 1332 | ++D1ptr; |
1333 | 1333 | ||
1334 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 1334 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
1335 | ptr = *D0ptr; | 1335 | ptr = *D0ptr; |
1336 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 1336 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
1337 | MLA(hi, lo, (*fo)[1], ptr[14]); | 1337 | MLA(hi, lo, (*fo)[1], ptr[14]); |
1338 | MLA(hi, lo, (*fo)[2], ptr[12]); | 1338 | MLA(hi, lo, (*fo)[2], ptr[12]); |
1339 | MLA(hi, lo, (*fo)[3], ptr[10]); | 1339 | MLA(hi, lo, (*fo)[3], ptr[10]); |
1340 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 1340 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
1341 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 1341 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
1342 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 1342 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
1343 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 1343 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
1344 | MLN(hi, lo); | 1344 | MLN(hi, lo); |
1345 | MLA(hi, lo, (*fe)[7], ptr[ 3]); | 1345 | MLA(hi, lo, (*fe)[7], ptr[ 3]); |
1346 | MLA(hi, lo, (*fe)[6], ptr[ 5]); | 1346 | MLA(hi, lo, (*fe)[6], ptr[ 5]); |
1347 | MLA(hi, lo, (*fe)[5], ptr[ 7]); | 1347 | MLA(hi, lo, (*fe)[5], ptr[ 7]); |
1348 | MLA(hi, lo, (*fe)[4], ptr[ 9]); | 1348 | MLA(hi, lo, (*fe)[4], ptr[ 9]); |
1349 | MLA(hi, lo, (*fe)[3], ptr[11]); | 1349 | MLA(hi, lo, (*fe)[3], ptr[11]); |
1350 | MLA(hi, lo, (*fe)[2], ptr[13]); | 1350 | MLA(hi, lo, (*fe)[2], ptr[13]); |
1351 | MLA(hi, lo, (*fe)[1], ptr[15]); | 1351 | MLA(hi, lo, (*fe)[1], ptr[15]); |
1352 | MLA(hi, lo, (*fe)[0], ptr[ 1]); | 1352 | MLA(hi, lo, (*fe)[0], ptr[ 1]); |
1353 | pcm[-sb] = SHIFT(MLZ(hi, lo)); | 1353 | pcm[-sb] = SHIFT(MLZ(hi, lo)); |
1354 | 1354 | ||
1355 | ptr = *D1ptr; | 1355 | ptr = *D1ptr; |
1356 | ML0(hi, lo, (*fe)[0], ptr[31 - 1]); | 1356 | ML0(hi, lo, (*fe)[0], ptr[31 - 1]); |
1357 | MLA(hi, lo, (*fe)[1], ptr[31 - 15]); | 1357 | MLA(hi, lo, (*fe)[1], ptr[31 - 15]); |
1358 | MLA(hi, lo, (*fe)[2], ptr[31 - 13]); | 1358 | MLA(hi, lo, (*fe)[2], ptr[31 - 13]); |
1359 | MLA(hi, lo, (*fe)[3], ptr[31 - 11]); | 1359 | MLA(hi, lo, (*fe)[3], ptr[31 - 11]); |
1360 | MLA(hi, lo, (*fe)[4], ptr[31 - 9]); | 1360 | MLA(hi, lo, (*fe)[4], ptr[31 - 9]); |
1361 | MLA(hi, lo, (*fe)[5], ptr[31 - 7]); | 1361 | MLA(hi, lo, (*fe)[5], ptr[31 - 7]); |
1362 | MLA(hi, lo, (*fe)[6], ptr[31 - 5]); | 1362 | MLA(hi, lo, (*fe)[6], ptr[31 - 5]); |
1363 | MLA(hi, lo, (*fe)[7], ptr[31 - 3]); | 1363 | MLA(hi, lo, (*fe)[7], ptr[31 - 3]); |
1364 | MLA(hi, lo, (*fo)[7], ptr[31 - 2]); | 1364 | MLA(hi, lo, (*fo)[7], ptr[31 - 2]); |
1365 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | 1365 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); |
1366 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | 1366 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); |
1367 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | 1367 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); |
1368 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | 1368 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); |
1369 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | 1369 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); |
1370 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | 1370 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); |
1371 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | 1371 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); |
1372 | pcm[sb] = SHIFT(MLZ(hi, lo)); | 1372 | pcm[sb] = SHIFT(MLZ(hi, lo)); |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | ptr = *(D0ptr + 1); | 1375 | ptr = *(D0ptr + 1); |
@@ -1394,12 +1394,12 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
1394 | # endif | 1394 | # endif |
1395 | 1395 | ||
1396 | /* | 1396 | /* |
1397 | * NAME: synth->half() | 1397 | * NAME: synth->half() |
1398 | * DESCRIPTION: perform half frequency PCM synthesis | 1398 | * DESCRIPTION: perform half frequency PCM synthesis |
1399 | */ | 1399 | */ |
1400 | static | 1400 | static |
1401 | void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | 1401 | void synth_half(struct mad_synth *synth, struct mad_frame const *frame, |
1402 | unsigned int nch, unsigned int ns) | 1402 | unsigned int nch, unsigned int ns) |
1403 | { | 1403 | { |
1404 | unsigned int phase, ch, s, sb, pe, po; | 1404 | unsigned int phase, ch, s, sb, pe, po; |
1405 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; | 1405 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; |
@@ -1417,7 +1417,7 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | |||
1417 | 1417 | ||
1418 | for (s = 0; s < ns; ++s) { | 1418 | for (s = 0; s < ns; ++s) { |
1419 | dct32((*sbsample)[s], phase >> 1, | 1419 | dct32((*sbsample)[s], phase >> 1, |
1420 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 1420 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
1421 | 1421 | ||
1422 | pe = phase & ~1; | 1422 | pe = phase & ~1; |
1423 | po = ((phase - 1) & 0xf) | 1; | 1423 | po = ((phase - 1) & 0xf) | 1; |
@@ -1456,59 +1456,59 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | |||
1456 | pcm2 = pcm1 + 14; | 1456 | pcm2 = pcm1 + 14; |
1457 | 1457 | ||
1458 | for (sb = 1; sb < 16; ++sb) { | 1458 | for (sb = 1; sb < 16; ++sb) { |
1459 | ++fe; | 1459 | ++fe; |
1460 | ++Dptr; | 1460 | ++Dptr; |
1461 | 1461 | ||
1462 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 1462 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
1463 | 1463 | ||
1464 | if (!(sb & 1)) { | 1464 | if (!(sb & 1)) { |
1465 | ptr = *Dptr + po; | 1465 | ptr = *Dptr + po; |
1466 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 1466 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
1467 | MLA(hi, lo, (*fo)[1], ptr[14]); | 1467 | MLA(hi, lo, (*fo)[1], ptr[14]); |
1468 | MLA(hi, lo, (*fo)[2], ptr[12]); | 1468 | MLA(hi, lo, (*fo)[2], ptr[12]); |
1469 | MLA(hi, lo, (*fo)[3], ptr[10]); | 1469 | MLA(hi, lo, (*fo)[3], ptr[10]); |
1470 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 1470 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
1471 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 1471 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
1472 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 1472 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
1473 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 1473 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
1474 | MLN(hi, lo); | 1474 | MLN(hi, lo); |
1475 | 1475 | ||
1476 | ptr = *Dptr + pe; | 1476 | ptr = *Dptr + pe; |
1477 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 1477 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
1478 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 1478 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
1479 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 1479 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
1480 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 1480 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
1481 | MLA(hi, lo, (*fe)[3], ptr[10]); | 1481 | MLA(hi, lo, (*fe)[3], ptr[10]); |
1482 | MLA(hi, lo, (*fe)[2], ptr[12]); | 1482 | MLA(hi, lo, (*fe)[2], ptr[12]); |
1483 | MLA(hi, lo, (*fe)[1], ptr[14]); | 1483 | MLA(hi, lo, (*fe)[1], ptr[14]); |
1484 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 1484 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
1485 | 1485 | ||
1486 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 1486 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
1487 | 1487 | ||
1488 | ptr = *Dptr - po; | 1488 | ptr = *Dptr - po; |
1489 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); | 1489 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); |
1490 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | 1490 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); |
1491 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | 1491 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); |
1492 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | 1492 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); |
1493 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | 1493 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); |
1494 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | 1494 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); |
1495 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | 1495 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); |
1496 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | 1496 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); |
1497 | 1497 | ||
1498 | ptr = *Dptr - pe; | 1498 | ptr = *Dptr - pe; |
1499 | MLA(hi, lo, (*fe)[0], ptr[31 - 16]); | 1499 | MLA(hi, lo, (*fe)[0], ptr[31 - 16]); |
1500 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); | 1500 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); |
1501 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); | 1501 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); |
1502 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); | 1502 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); |
1503 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); | 1503 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); |
1504 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); | 1504 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); |
1505 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); | 1505 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); |
1506 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); | 1506 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); |
1507 | 1507 | ||
1508 | *pcm2-- = SHIFT(MLZ(hi, lo)); | 1508 | *pcm2-- = SHIFT(MLZ(hi, lo)); |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | ++fo; | 1511 | ++fo; |
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | ++Dptr; | 1514 | ++Dptr; |
@@ -1532,14 +1532,14 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | |||
1532 | } | 1532 | } |
1533 | 1533 | ||
1534 | /* | 1534 | /* |
1535 | * NAME: synth->frame() | 1535 | * NAME: synth->frame() |
1536 | * DESCRIPTION: perform PCM synthesis of frame subband samples | 1536 | * DESCRIPTION: perform PCM synthesis of frame subband samples |
1537 | */ | 1537 | */ |
1538 | void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) | 1538 | void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) |
1539 | { | 1539 | { |
1540 | unsigned int nch, ns; | 1540 | unsigned int nch, ns; |
1541 | void (*synth_frame)(struct mad_synth *, struct mad_frame const *, | 1541 | void (*synth_frame)(struct mad_synth *, struct mad_frame const *, |
1542 | unsigned int, unsigned int); | 1542 | unsigned int, unsigned int); |
1543 | 1543 | ||
1544 | nch = MAD_NCHANNELS(&frame->header); | 1544 | nch = MAD_NCHANNELS(&frame->header); |
1545 | ns = MAD_NSBSAMPLES(&frame->header); | 1545 | ns = MAD_NSBSAMPLES(&frame->header); |
diff --git a/apps/codecs/libmad/synth.h b/apps/codecs/libmad/synth.h index 74975b9ad8..4cbcf73b2b 100644 --- a/apps/codecs/libmad/synth.h +++ b/apps/codecs/libmad/synth.h | |||
@@ -26,19 +26,19 @@ | |||
26 | # include "frame.h" | 26 | # include "frame.h" |
27 | 27 | ||
28 | struct mad_pcm { | 28 | struct mad_pcm { |
29 | unsigned int samplerate; /* sampling frequency (Hz) */ | 29 | unsigned int samplerate; /* sampling frequency (Hz) */ |
30 | unsigned short channels; /* number of channels */ | 30 | unsigned short channels; /* number of channels */ |
31 | unsigned short length; /* number of samples per channel */ | 31 | unsigned short length; /* number of samples per channel */ |
32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ | 32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct mad_synth { | 35 | struct mad_synth { |
36 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ | 36 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ |
37 | /* [ch][eo][peo][s][v] */ | 37 | /* [ch][eo][peo][s][v] */ |
38 | 38 | ||
39 | unsigned int phase; /* current processing phase */ | 39 | unsigned int phase; /* current processing phase */ |
40 | 40 | ||
41 | struct mad_pcm pcm; /* PCM output */ | 41 | struct mad_pcm pcm; /* PCM output */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* single channel PCM selector */ | 44 | /* single channel PCM selector */ |
diff --git a/apps/codecs/libmad/timer.c b/apps/codecs/libmad/timer.c index 33ea4a6fbc..a6c64795b3 100644 --- a/apps/codecs/libmad/timer.c +++ b/apps/codecs/libmad/timer.c | |||
@@ -36,7 +36,7 @@ | |||
36 | mad_timer_t const mad_timer_zero = { 0, 0 }; | 36 | mad_timer_t const mad_timer_zero = { 0, 0 }; |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * NAME: timer->compare() | 39 | * NAME: timer->compare() |
40 | * DESCRIPTION: indicate relative order of two timers | 40 | * DESCRIPTION: indicate relative order of two timers |
41 | */ | 41 | */ |
42 | int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) | 42 | int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) |
@@ -59,7 +59,7 @@ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * NAME: timer->negate() | 62 | * NAME: timer->negate() |
63 | * DESCRIPTION: invert the sign of a timer | 63 | * DESCRIPTION: invert the sign of a timer |
64 | */ | 64 | */ |
65 | void mad_timer_negate(mad_timer_t *timer) | 65 | void mad_timer_negate(mad_timer_t *timer) |
@@ -73,7 +73,7 @@ void mad_timer_negate(mad_timer_t *timer) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * NAME: timer->abs() | 76 | * NAME: timer->abs() |
77 | * DESCRIPTION: return the absolute value of a timer | 77 | * DESCRIPTION: return the absolute value of a timer |
78 | */ | 78 | */ |
79 | mad_timer_t mad_timer_abs(mad_timer_t timer) | 79 | mad_timer_t mad_timer_abs(mad_timer_t timer) |
@@ -85,7 +85,7 @@ mad_timer_t mad_timer_abs(mad_timer_t timer) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * NAME: reduce_timer() | 88 | * NAME: reduce_timer() |
89 | * DESCRIPTION: carry timer fraction into seconds | 89 | * DESCRIPTION: carry timer fraction into seconds |
90 | */ | 90 | */ |
91 | static | 91 | static |
@@ -96,7 +96,7 @@ void reduce_timer(mad_timer_t *timer) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * NAME: gcd() | 99 | * NAME: gcd() |
100 | * DESCRIPTION: compute greatest common denominator | 100 | * DESCRIPTION: compute greatest common denominator |
101 | */ | 101 | */ |
102 | static | 102 | static |
@@ -114,7 +114,7 @@ unsigned long gcd(unsigned long num1, unsigned long num2) | |||
114 | } | 114 | } |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * NAME: reduce_rational() | 117 | * NAME: reduce_rational() |
118 | * DESCRIPTION: convert rational expression to lowest terms | 118 | * DESCRIPTION: convert rational expression to lowest terms |
119 | */ | 119 | */ |
120 | static | 120 | static |
@@ -131,12 +131,12 @@ void reduce_rational(unsigned long *numer, unsigned long *denom) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * NAME: scale_rational() | 134 | * NAME: scale_rational() |
135 | * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing | 135 | * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing |
136 | */ | 136 | */ |
137 | static | 137 | static |
138 | unsigned long scale_rational(unsigned long numer, unsigned long denom, | 138 | unsigned long scale_rational(unsigned long numer, unsigned long denom, |
139 | unsigned long scale) | 139 | unsigned long scale) |
140 | { | 140 | { |
141 | reduce_rational(&numer, &denom); | 141 | reduce_rational(&numer, &denom); |
142 | reduce_rational(&scale, &denom); | 142 | reduce_rational(&scale, &denom); |
@@ -152,11 +152,11 @@ unsigned long scale_rational(unsigned long numer, unsigned long denom, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * NAME: timer->set() | 155 | * NAME: timer->set() |
156 | * DESCRIPTION: set timer to specific (positive) value | 156 | * DESCRIPTION: set timer to specific (positive) value |
157 | */ | 157 | */ |
158 | void mad_timer_set(mad_timer_t *timer, unsigned long seconds, | 158 | void mad_timer_set(mad_timer_t *timer, unsigned long seconds, |
159 | unsigned long numer, unsigned long denom) | 159 | unsigned long numer, unsigned long denom) |
160 | { | 160 | { |
161 | timer->seconds = seconds; | 161 | timer->seconds = seconds; |
162 | if (numer >= denom && denom > 0) { | 162 | if (numer >= denom && denom > 0) { |
@@ -224,7 +224,7 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds, | |||
224 | } | 224 | } |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * NAME: timer->add() | 227 | * NAME: timer->add() |
228 | * DESCRIPTION: add one timer to another | 228 | * DESCRIPTION: add one timer to another |
229 | */ | 229 | */ |
230 | void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) | 230 | void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) |
@@ -237,7 +237,7 @@ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) | |||
237 | } | 237 | } |
238 | 238 | ||
239 | /* | 239 | /* |
240 | * NAME: timer->multiply() | 240 | * NAME: timer->multiply() |
241 | * DESCRIPTION: multiply a timer by a scalar value | 241 | * DESCRIPTION: multiply a timer by a scalar value |
242 | */ | 242 | */ |
243 | void mad_timer_multiply(mad_timer_t *timer, signed long scalar) | 243 | void mad_timer_multiply(mad_timer_t *timer, signed long scalar) |
@@ -264,7 +264,7 @@ void mad_timer_multiply(mad_timer_t *timer, signed long scalar) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /* | 266 | /* |
267 | * NAME: timer->count() | 267 | * NAME: timer->count() |
268 | * DESCRIPTION: return timer value in selected units | 268 | * DESCRIPTION: return timer value in selected units |
269 | */ | 269 | */ |
270 | signed long mad_timer_count(mad_timer_t timer, enum mad_units units) | 270 | signed long mad_timer_count(mad_timer_t timer, enum mad_units units) |
@@ -302,7 +302,7 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) | |||
302 | case MAD_UNITS_75_FPS: | 302 | case MAD_UNITS_75_FPS: |
303 | return timer.seconds * (signed long) units + | 303 | return timer.seconds * (signed long) units + |
304 | (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, | 304 | (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, |
305 | units); | 305 | units); |
306 | 306 | ||
307 | case MAD_UNITS_23_976_FPS: | 307 | case MAD_UNITS_23_976_FPS: |
308 | case MAD_UNITS_24_975_FPS: | 308 | case MAD_UNITS_24_975_FPS: |
@@ -318,7 +318,7 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) | |||
318 | } | 318 | } |
319 | 319 | ||
320 | /* | 320 | /* |
321 | * NAME: timer->fraction() | 321 | * NAME: timer->fraction() |
322 | * DESCRIPTION: return fractional part of timer in arbitrary terms | 322 | * DESCRIPTION: return fractional part of timer in arbitrary terms |
323 | */ | 323 | */ |
324 | unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) | 324 | unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) |
@@ -339,12 +339,12 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | /* | 341 | /* |
342 | * NAME: timer->string() | 342 | * NAME: timer->string() |
343 | * DESCRIPTION: write a string representation of a timer using a template | 343 | * DESCRIPTION: write a string representation of a timer using a template |
344 | */ | 344 | */ |
345 | void mad_timer_string(mad_timer_t timer, | 345 | void mad_timer_string(mad_timer_t timer, |
346 | char *dest, char const *format, enum mad_units units, | 346 | char *dest, char const *format, enum mad_units units, |
347 | enum mad_units fracunits, unsigned long subparts) | 347 | enum mad_units fracunits, unsigned long subparts) |
348 | { | 348 | { |
349 | unsigned long hours, minutes, seconds, sub; | 349 | unsigned long hours, minutes, seconds, sub; |
350 | unsigned int frac; | 350 | unsigned int frac; |
@@ -413,7 +413,7 @@ void mad_timer_string(mad_timer_t timer, | |||
413 | m = frame % cycle; | 413 | m = frame % cycle; |
414 | frame += (10 - 1) * 2 * d; | 414 | frame += (10 - 1) * 2 * d; |
415 | if (m > 2) | 415 | if (m > 2) |
416 | frame += 2 * ((m - 2) / (cycle / 10)); | 416 | frame += 2 * ((m - 2) / (cycle / 10)); |
417 | 417 | ||
418 | frac = frame % -fracunits; | 418 | frac = frame % -fracunits; |
419 | seconds = frame / -fracunits; | 419 | seconds = frame / -fracunits; |
@@ -427,25 +427,25 @@ void mad_timer_string(mad_timer_t timer, | |||
427 | hours = minutes / 60; | 427 | hours = minutes / 60; |
428 | 428 | ||
429 | // sprintf(dest, format, | 429 | // sprintf(dest, format, |
430 | // hours, | 430 | // hours, |
431 | // (unsigned int) (minutes % 60), | 431 | // (unsigned int) (minutes % 60), |
432 | // (unsigned int) (seconds % 60), | 432 | // (unsigned int) (seconds % 60), |
433 | // frac, sub); | 433 | // frac, sub); |
434 | break; | 434 | break; |
435 | 435 | ||
436 | case MAD_UNITS_MINUTES: | 436 | case MAD_UNITS_MINUTES: |
437 | minutes = seconds / 60; | 437 | minutes = seconds / 60; |
438 | 438 | ||
439 | // sprintf(dest, format, | 439 | // sprintf(dest, format, |
440 | // minutes, | 440 | // minutes, |
441 | // (unsigned int) (seconds % 60), | 441 | // (unsigned int) (seconds % 60), |
442 | // frac, sub); | 442 | // frac, sub); |
443 | break; | 443 | break; |
444 | 444 | ||
445 | case MAD_UNITS_SECONDS: | 445 | case MAD_UNITS_SECONDS: |
446 | // sprintf(dest, format, | 446 | // sprintf(dest, format, |
447 | // seconds, | 447 | // seconds, |
448 | // frac, sub); | 448 | // frac, sub); |
449 | break; | 449 | break; |
450 | 450 | ||
451 | case MAD_UNITS_23_976_FPS: | 451 | case MAD_UNITS_23_976_FPS: |
diff --git a/apps/codecs/libmad/timer.h b/apps/codecs/libmad/timer.h index 23fdccf929..e890c48fe5 100644 --- a/apps/codecs/libmad/timer.h +++ b/apps/codecs/libmad/timer.h | |||
@@ -23,8 +23,8 @@ | |||
23 | # define LIBMAD_TIMER_H | 23 | # define LIBMAD_TIMER_H |
24 | 24 | ||
25 | typedef struct { | 25 | typedef struct { |
26 | signed long seconds; /* whole seconds */ | 26 | signed long seconds; /* whole seconds */ |
27 | unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ | 27 | unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ |
28 | } mad_timer_t; | 28 | } mad_timer_t; |
29 | 29 | ||
30 | extern mad_timer_t const mad_timer_zero; | 30 | extern mad_timer_t const mad_timer_zero; |
@@ -32,9 +32,9 @@ extern mad_timer_t const mad_timer_zero; | |||
32 | # define MAD_TIMER_RESOLUTION 352800000UL | 32 | # define MAD_TIMER_RESOLUTION 352800000UL |
33 | 33 | ||
34 | enum mad_units { | 34 | enum mad_units { |
35 | MAD_UNITS_HOURS = -2, | 35 | MAD_UNITS_HOURS = -2, |
36 | MAD_UNITS_MINUTES = -1, | 36 | MAD_UNITS_MINUTES = -1, |
37 | MAD_UNITS_SECONDS = 0, | 37 | MAD_UNITS_SECONDS = 0, |
38 | 38 | ||
39 | /* metric units */ | 39 | /* metric units */ |
40 | 40 | ||
@@ -44,7 +44,7 @@ enum mad_units { | |||
44 | 44 | ||
45 | /* audio sample units */ | 45 | /* audio sample units */ |
46 | 46 | ||
47 | MAD_UNITS_8000_HZ = 8000, | 47 | MAD_UNITS_8000_HZ = 8000, |
48 | MAD_UNITS_11025_HZ = 11025, | 48 | MAD_UNITS_11025_HZ = 11025, |
49 | MAD_UNITS_12000_HZ = 12000, | 49 | MAD_UNITS_12000_HZ = 12000, |
50 | 50 | ||
@@ -58,16 +58,16 @@ enum mad_units { | |||
58 | 58 | ||
59 | /* video frame/field units */ | 59 | /* video frame/field units */ |
60 | 60 | ||
61 | MAD_UNITS_24_FPS = 24, | 61 | MAD_UNITS_24_FPS = 24, |
62 | MAD_UNITS_25_FPS = 25, | 62 | MAD_UNITS_25_FPS = 25, |
63 | MAD_UNITS_30_FPS = 30, | 63 | MAD_UNITS_30_FPS = 30, |
64 | MAD_UNITS_48_FPS = 48, | 64 | MAD_UNITS_48_FPS = 48, |
65 | MAD_UNITS_50_FPS = 50, | 65 | MAD_UNITS_50_FPS = 50, |
66 | MAD_UNITS_60_FPS = 60, | 66 | MAD_UNITS_60_FPS = 60, |
67 | 67 | ||
68 | /* CD audio frames */ | 68 | /* CD audio frames */ |
69 | 69 | ||
70 | MAD_UNITS_75_FPS = 75, | 70 | MAD_UNITS_75_FPS = 75, |
71 | 71 | ||
72 | /* video drop-frame units */ | 72 | /* video drop-frame units */ |
73 | 73 | ||
@@ -95,6 +95,6 @@ void mad_timer_multiply(mad_timer_t *, signed long); | |||
95 | signed long mad_timer_count(mad_timer_t, enum mad_units); | 95 | signed long mad_timer_count(mad_timer_t, enum mad_units); |
96 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | 96 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); |
97 | void mad_timer_string(mad_timer_t, char *, char const *, | 97 | void mad_timer_string(mad_timer_t, char *, char const *, |
98 | enum mad_units, enum mad_units, unsigned long); | 98 | enum mad_units, enum mad_units, unsigned long); |
99 | 99 | ||
100 | # endif | 100 | # endif |
diff --git a/apps/codecs/libmad/version.h b/apps/codecs/libmad/version.h index 3a98543de3..0bf662fedd 100644 --- a/apps/codecs/libmad/version.h +++ b/apps/codecs/libmad/version.h | |||
@@ -22,22 +22,22 @@ | |||
22 | # ifndef LIBMAD_VERSION_H | 22 | # ifndef LIBMAD_VERSION_H |
23 | # define LIBMAD_VERSION_H | 23 | # define LIBMAD_VERSION_H |
24 | 24 | ||
25 | # define MAD_VERSION_MAJOR 0 | 25 | # define MAD_VERSION_MAJOR 0 |
26 | # define MAD_VERSION_MINOR 15 | 26 | # define MAD_VERSION_MINOR 15 |
27 | # define MAD_VERSION_PATCH 1 | 27 | # define MAD_VERSION_PATCH 1 |
28 | # define MAD_VERSION_EXTRA " (beta)" | 28 | # define MAD_VERSION_EXTRA " (beta)" |
29 | 29 | ||
30 | # define MAD_VERSION_STRINGIZE(str) #str | 30 | # define MAD_VERSION_STRINGIZE(str) #str |
31 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) | 31 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) |
32 | 32 | ||
33 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | 33 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ |
34 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | 34 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ |
35 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | 35 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ |
36 | MAD_VERSION_EXTRA | 36 | MAD_VERSION_EXTRA |
37 | 37 | ||
38 | # define MAD_PUBLISHYEAR "2000-2004" | 38 | # define MAD_PUBLISHYEAR "2000-2004" |
39 | # define MAD_AUTHOR "Underbit Technologies, Inc." | 39 | # define MAD_AUTHOR "Underbit Technologies, Inc." |
40 | # define MAD_EMAIL "info@underbit.com" | 40 | # define MAD_EMAIL "info@underbit.com" |
41 | 41 | ||
42 | extern char const mad_version[]; | 42 | extern char const mad_version[]; |
43 | extern char const mad_copyright[]; | 43 | extern char const mad_copyright[]; |