Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2022 Caleb Etemesi <etemesicaleb@gmail.com> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Copyright 2019 - 2021, Osamu Watanabe | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without modification, | ||
25 | * are permitted provided that the following conditions are met: | ||
26 | * | ||
27 | * 1. Redistributions of source code must retain the above copyright notice, this | ||
28 | * list of conditions and the following disclaimer. | ||
29 | * | ||
30 | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
31 | * this list of conditions and the following disclaimer in the documentation | ||
32 | * and/or other materials provided with the distribution. | ||
33 | * | ||
34 | * 3. Neither the name of the copyright holder nor the names of its contributors | ||
35 | * may be used to endorse or promote products derived from this software without | ||
36 | * specific prior written permission. | ||
37 | * | ||
38 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND | ||
39 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
40 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
41 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
42 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
43 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
45 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
46 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
47 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | */ | ||
49 | |||
50 | #include <stdint.h> | ||
51 | #include "libavutil/attributes.h" | ||
52 | #include "libavutil/common.h" | ||
53 | #include "libavutil/avassert.h" | ||
54 | #include "libavutil/mem.h" | ||
55 | #include "jpeg2000htdec.h" | ||
56 | #include "jpeg2000.h" | ||
57 | #include "jpeg2000dec.h" | ||
58 | |||
59 | #define J2K_Q1 0 | ||
60 | #define J2K_Q2 1 | ||
61 | |||
62 | #define HT_SHIFT_SIGMA 0 | ||
63 | #define HT_SHIFT_SCAN 4 | ||
64 | #define HT_SHIFT_REF 3 | ||
65 | #define HT_SHIFT_REF_IND 2 | ||
66 | |||
67 | /* See Rec. ITU-T T.800, Table 2 */ | ||
68 | const static uint8_t mel_e[13] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5 }; | ||
69 | |||
70 | static const uint16_t dec_cxt_vlc_table1[1024]; | ||
71 | static const uint16_t dec_cxt_vlc_table0[1024]; | ||
72 | |||
73 | typedef struct StateVars { | ||
74 | int32_t pos; | ||
75 | uint32_t bits; | ||
76 | uint32_t tmp; | ||
77 | uint32_t last; | ||
78 | uint8_t bits_left; | ||
79 | uint64_t bit_buf; | ||
80 | } StateVars; | ||
81 | |||
82 | typedef struct MelDecoderState { | ||
83 | uint8_t k; | ||
84 | uint8_t run; | ||
85 | uint8_t one; | ||
86 | } MelDecoderState; | ||
87 | |||
88 | /** | ||
89 | * Given a precomputed c, checks whether n % d == 0. c is precomputed from d | ||
90 | * using precompute_c(). | ||
91 | */ | ||
92 | av_always_inline | ||
93 | 15680 | static uint32_t is_divisible(uint32_t n, uint64_t c) | |
94 | { | ||
95 | 15680 | return n * c <= c - 1; | |
96 | } | ||
97 | |||
98 | /** | ||
99 | * Precompute the number c used by is_divisible(). | ||
100 | */ | ||
101 | av_always_inline | ||
102 | 10 | static uint64_t precompute_c(uint32_t d) | |
103 | { | ||
104 | 10 | return 1 + (0xffffffffffffffffull / d); | |
105 | } | ||
106 | |||
107 | 30 | static void jpeg2000_init_zero(StateVars *s) | |
108 | { | ||
109 | 30 | s->bits_left = 0; | |
110 | 30 | s->bit_buf = 0; | |
111 | 30 | s->tmp = 0; | |
112 | 30 | s->bits = 0; | |
113 | 30 | s->pos = 0; | |
114 | 30 | s->last = 0; | |
115 | 30 | } | |
116 | |||
117 | 10 | static void jpeg2000_init_mel(StateVars *s, uint32_t Pcup) | |
118 | { | ||
119 | 10 | jpeg2000_init_zero(s); | |
120 | 10 | s->pos = Pcup; | |
121 | 10 | } | |
122 | |||
123 | ✗ | static void jpeg2000_init_mag_ref(StateVars *s, uint32_t Lref) | |
124 | { | ||
125 | ✗ | s->pos = Lref - 1; | |
126 | ✗ | s->bits = 0; | |
127 | ✗ | s->last = 0xFF; | |
128 | ✗ | s->tmp = 0; | |
129 | ✗ | s->bits_left = 0; | |
130 | ✗ | s->bit_buf = 0; | |
131 | ✗ | } | |
132 | |||
133 | 10 | static void jpeg2000_init_mel_decoder(MelDecoderState *mel_state) | |
134 | { | ||
135 | 10 | mel_state->k = 0; | |
136 | 10 | mel_state->run = 0; | |
137 | 10 | mel_state->one = 0; | |
138 | 10 | } | |
139 | |||
140 | /** | ||
141 | * Refill the buffer backwards in little endian while skipping over stuffing | ||
142 | * bits. Stuffing bits are those that appear in the position of any byte whose | ||
143 | * LSBs are all 1's if the last consumed byte was larger than 0x8F. | ||
144 | */ | ||
145 | 6143 | static int jpeg2000_bitbuf_refill_backwards(StateVars *buffer, const uint8_t *array) | |
146 | { | ||
147 | 6143 | uint64_t tmp = 0; | |
148 | 6143 | uint32_t new_bits = 32; | |
149 | |||
150 | 6143 | buffer->last = array[buffer->pos + 1]; | |
151 | |||
152 |
2/2✓ Branch 0 taken 5343 times.
✓ Branch 1 taken 800 times.
|
6143 | if (buffer->bits_left >= 32) |
153 | 5343 | return 0; // enough data, no need to pull in more bits | |
154 | |||
155 | /** | ||
156 | * Unstuff bits. Load a temporary byte, which precedes the position we | ||
157 | * currently at, to ensure that we can also un-stuff if the stuffed bit is | ||
158 | * the bottom most bits. | ||
159 | */ | ||
160 | |||
161 |
2/2✓ Branch 0 taken 788 times.
✓ Branch 1 taken 12 times.
|
800 | if (buffer->pos >= 3) { // Common case; we have at least 4 bytes available |
162 | 788 | tmp = array[buffer->pos - 3]; | |
163 | 788 | tmp = (tmp << 8) | array[buffer->pos - 2]; | |
164 | 788 | tmp = (tmp << 8) | array[buffer->pos - 1]; | |
165 | 788 | tmp = (tmp << 8) | array[buffer->pos]; | |
166 | 788 | tmp = (tmp << 8) | buffer->last; // For stuffing bit detection | |
167 | 788 | buffer->pos -= 4; | |
168 | } else { | ||
169 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
|
12 | if (buffer->pos >= 2) |
170 | 2 | tmp = array[buffer->pos - 2]; | |
171 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 9 times.
|
12 | if (buffer->pos >= 1) |
172 | 3 | tmp = (tmp << 8) | array[buffer->pos - 1]; | |
173 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 5 times.
|
12 | if (buffer->pos >= 0) |
174 | 7 | tmp = (tmp << 8) | array[buffer->pos]; | |
175 | 12 | buffer->pos = 0; | |
176 | 12 | tmp = (tmp << 8) | buffer->last; // For stuffing bit detection | |
177 | } | ||
178 | // Now remove any stuffing bits, shifting things down as we go | ||
179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if ((tmp & 0x7FFF000000) > 0x7F8F000000) { |
180 | ✗ | tmp &= 0x7FFFFFFFFF; | |
181 | ✗ | new_bits--; | |
182 | } | ||
183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if ((tmp & 0x007FFF0000) > 0x007F8F0000) { |
184 | ✗ | tmp = (tmp & 0x007FFFFFFF) + ((tmp & 0xFF00000000) >> 1); | |
185 | ✗ | new_bits--; | |
186 | } | ||
187 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 797 times.
|
800 | if ((tmp & 0x00007FFF00) > 0x00007F8F00) { |
188 | 3 | tmp = (tmp & 0x00007FFFFF) + ((tmp & 0xFFFF000000) >> 1); | |
189 | 3 | new_bits--; | |
190 | } | ||
191 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 797 times.
|
800 | if ((tmp & 0x0000007FFF) > 0x0000007F8F) { |
192 | 3 | tmp = (tmp & 0x0000007FFF) + ((tmp & 0xFFFFFF0000) >> 1); | |
193 | 3 | new_bits--; | |
194 | } | ||
195 | 800 | tmp >>= 8; // Shifts away the extra byte we imported | |
196 | |||
197 | /* Add bits to the MSB of the bit buffer */ | ||
198 | 800 | buffer->bit_buf |= tmp << buffer->bits_left; | |
199 | 800 | buffer->bits_left += new_bits; | |
200 | 800 | return 0; | |
201 | } | ||
202 | |||
203 | /** | ||
204 | * Refill the bit-buffer reading new bits going forward | ||
205 | * in the stream while skipping over stuffed bits. | ||
206 | */ | ||
207 | 1191 | static void jpeg2000_bitbuf_refill_forward(StateVars *buffer, const uint8_t *array, | |
208 | uint32_t length) | ||
209 | { | ||
210 |
2/2✓ Branch 0 taken 4762 times.
✓ Branch 1 taken 1191 times.
|
5953 | while (buffer->bits_left < 32) { |
211 | 4762 | buffer->tmp = 0xFF; | |
212 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 4757 times.
|
4762 | buffer->bits = (buffer->last == 0xFF) ? 7 : 8; |
213 |
2/2✓ Branch 0 taken 4739 times.
✓ Branch 1 taken 23 times.
|
4762 | if (buffer->pos < length) { |
214 | 4739 | buffer->tmp = array[buffer->pos]; | |
215 | 4739 | buffer->pos += 1; | |
216 | 4739 | buffer->last = buffer->tmp; | |
217 | } | ||
218 | 4762 | buffer->bit_buf |= ((uint64_t) buffer->tmp) << buffer->bits_left; | |
219 | 4762 | buffer->bits_left += buffer->bits; | |
220 | } | ||
221 | 1191 | } | |
222 | |||
223 | /** | ||
224 | * Drops bits from lower bits in the bit buffer. buf contains the bit buffers. | ||
225 | * nbits is the number of bits to remove. | ||
226 | */ | ||
227 | av_always_inline | ||
228 | 18441 | static void jpeg2000_bitbuf_drop_bits_lsb(StateVars *buf, uint8_t nbits) | |
229 | { | ||
230 | av_assert2(buf->bits_left >= nbits); // cannot read more bits than available | ||
231 | 18441 | buf->bit_buf >>= nbits; | |
232 | 18441 | buf->bits_left -= nbits; | |
233 | 18441 | } | |
234 | |||
235 | /** | ||
236 | * Get bits from the bit buffer reading them from the least significant bits | ||
237 | * moving to the most significant bits. In case there are fewer bits, refill | ||
238 | * from buf moving backwards. | ||
239 | */ | ||
240 | av_always_inline | ||
241 | 1548 | static uint64_t jpeg2000_bitbuf_get_bits_lsb(StateVars *bit_stream, uint8_t nbits, | |
242 | const uint8_t *buf) | ||
243 | { | ||
244 | uint64_t bits; | ||
245 | 1548 | uint64_t mask = (1ull << nbits) - 1; | |
246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1548 times.
|
1548 | if (bit_stream->bits_left < nbits) |
247 | ✗ | jpeg2000_bitbuf_refill_backwards(bit_stream, buf); | |
248 | 1548 | bits = bit_stream->bit_buf & mask; | |
249 | 1548 | jpeg2000_bitbuf_drop_bits_lsb(bit_stream, nbits); | |
250 | 1548 | return bits; | |
251 | } | ||
252 | |||
253 | /** | ||
254 | * Get bits from the bit buffer reading them from the least significant bits | ||
255 | * moving to the most significant bits. In case there are fewer bits, refill from | ||
256 | * buf moving forward. | ||
257 | */ | ||
258 | av_always_inline | ||
259 | 10869 | static uint64_t jpeg2000_bitbuf_get_bits_lsb_forward(StateVars *bit_stream, | |
260 | uint8_t nbits, const uint8_t *buf, | ||
261 | uint32_t length) | ||
262 | { | ||
263 | uint64_t bits; | ||
264 | 10869 | uint64_t mask = (1ull << nbits) - 1; | |
265 | |||
266 |
2/2✓ Branch 0 taken 1181 times.
✓ Branch 1 taken 9688 times.
|
10869 | if (bit_stream->bits_left <= nbits) |
267 | 1181 | jpeg2000_bitbuf_refill_forward(bit_stream, buf, length); | |
268 | 10869 | bits = bit_stream->bit_buf & mask; | |
269 | 10869 | jpeg2000_bitbuf_drop_bits_lsb(bit_stream, nbits); | |
270 | 10869 | return bits; | |
271 | } | ||
272 | |||
273 | /** | ||
274 | * Look ahead bit buffer without discarding bits. | ||
275 | */ | ||
276 | av_always_inline | ||
277 | 1929 | static uint64_t jpeg2000_bitbuf_peek_bits_lsb(StateVars *stream, uint8_t nbits) | |
278 | { | ||
279 | 1929 | uint64_t mask = (1ull << nbits) - 1; | |
280 | 1929 | return stream->bit_buf & mask; | |
281 | } | ||
282 | |||
283 | 10 | static void jpeg2000_init_vlc(StateVars *s, uint32_t Lcup, uint32_t Pcup, | |
284 | const uint8_t *Dcup) | ||
285 | { | ||
286 | 10 | s->bits_left = 0; | |
287 | 10 | s->bit_buf = 0; | |
288 | 10 | s->pos = Lcup - 2 - Pcup; | |
289 | 10 | s->last = Dcup[Lcup - 2]; | |
290 | 10 | s->tmp = (s->last) >> 4; | |
291 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | s->bits = ((s->tmp & 7) < 7) ? 4 : 3; |
292 | |||
293 | 10 | jpeg2000_bitbuf_refill_backwards(s, Dcup + Pcup); | |
294 | 10 | jpeg2000_bitbuf_drop_bits_lsb(s, 4); | |
295 | 10 | } | |
296 | |||
297 | /** | ||
298 | * Decode prefix codes for VLC segment. See Rec. ITU-T T.814, 7.3.5. | ||
299 | */ | ||
300 | av_always_inline | ||
301 | 4085 | static int jpeg2000_decode_ctx_vlc(const Jpeg2000DecoderContext *s, | |
302 | StateVars *vlc_stream, const uint16_t *table, | ||
303 | const uint8_t *Dcup, uint8_t *sig_pat, | ||
304 | uint8_t *res_off, uint8_t *emb_pat_k, | ||
305 | uint8_t *emb_pat_1, uint8_t pos, | ||
306 | uint32_t Pcup, uint16_t context) | ||
307 | { | ||
308 | uint32_t value; | ||
309 | uint8_t len; | ||
310 | uint64_t index; | ||
311 | uint64_t code_word; | ||
312 | |||
313 | 4085 | jpeg2000_bitbuf_refill_backwards(vlc_stream, Dcup + Pcup); | |
314 | |||
315 | 4085 | code_word = vlc_stream->bit_buf & 0x7f; | |
316 | 4085 | index = code_word + (context << 7); | |
317 | |||
318 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4085 times.
|
4085 | av_assert0(index < 1024); // The CxtVLC table has 1024 entries. |
319 | |||
320 | 4085 | value = table[index]; | |
321 | |||
322 | 4085 | len = (value & 0x000F) >> 1; | |
323 | |||
324 | 4085 | res_off[pos] = (uint8_t) (value & 1); | |
325 | 4085 | sig_pat[pos] = (uint8_t) ((value & 0x00F0) >> 4); | |
326 | 4085 | emb_pat_k[pos] = (uint8_t) ((value & 0x0F00) >> 8); | |
327 | 4085 | emb_pat_1[pos] = (uint8_t) ((value & 0xF000) >> 12); | |
328 | |||
329 | 4085 | jpeg2000_bitbuf_drop_bits_lsb(vlc_stream, len); | |
330 | 4085 | return 0; | |
331 | } | ||
332 | |||
333 | /** | ||
334 | * Decode variable length u-vlc prefix. See decodeUPrefix procedure at Rec. | ||
335 | * ITU-T T.814, 7.3.6. | ||
336 | */ | ||
337 | av_always_inline | ||
338 | 1548 | static uint8_t vlc_decode_u_prefix(StateVars *vlc_stream, const uint8_t *refill_array) | |
339 | { | ||
340 | static const uint8_t return_value[8] = { 5, 1, 2, 1, 3, 1, 2, 1 }; | ||
341 | static const uint8_t drop_bits[8] = { 3, 1, 2, 1, 3, 1, 2, 1 }; | ||
342 | |||
343 | uint8_t bits; | ||
344 | |||
345 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1548 times.
|
1548 | if (vlc_stream->bits_left < 3) |
346 | ✗ | jpeg2000_bitbuf_refill_backwards(vlc_stream, refill_array); | |
347 | |||
348 | 1548 | bits = jpeg2000_bitbuf_peek_bits_lsb(vlc_stream, 3); | |
349 | |||
350 | 1548 | jpeg2000_bitbuf_drop_bits_lsb(vlc_stream, drop_bits[bits]); | |
351 | 1548 | return return_value[bits]; | |
352 | } | ||
353 | |||
354 | /** | ||
355 | * Decode variable length u-vlc suffix. See decodeUSuffix procedure at Rec. | ||
356 | * ITU-T T.814, 7.3.6. | ||
357 | */ | ||
358 | av_always_inline | ||
359 | 1548 | static uint8_t vlc_decode_u_suffix(StateVars *vlc_stream, uint8_t suffix, | |
360 | const uint8_t *refill_array) | ||
361 | { | ||
362 | static const int mask[] = { 1, 31 }; | ||
363 | static const int drop_bits[] = { 1, 5 }; | ||
364 | |||
365 | uint8_t bits; | ||
366 | 1548 | int cond = suffix != 3; | |
367 |
2/2✓ Branch 0 taken 1167 times.
✓ Branch 1 taken 381 times.
|
1548 | if (suffix < 3) |
368 | 1167 | return 0; | |
369 | |||
370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 381 times.
|
381 | if (vlc_stream->bits_left < 5) |
371 | ✗ | jpeg2000_bitbuf_refill_backwards(vlc_stream, refill_array); | |
372 | |||
373 | 381 | bits = jpeg2000_bitbuf_peek_bits_lsb(vlc_stream, 5); | |
374 | |||
375 | 381 | jpeg2000_bitbuf_drop_bits_lsb(vlc_stream, drop_bits[cond]); | |
376 | 381 | return bits & mask[cond]; | |
377 | } | ||
378 | |||
379 | /** | ||
380 | * Decode u-vlc extension values. See decodeUExtension procedure at Rec. ITU-T | ||
381 | * T.814, 7.3.6. | ||
382 | */ | ||
383 | av_always_inline | ||
384 | 1548 | static uint8_t vlc_decode_u_extension(StateVars *vlc_stream, uint8_t suffix, | |
385 | const uint8_t *refill_array) | ||
386 | { | ||
387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1548 times.
|
1548 | return jpeg2000_bitbuf_get_bits_lsb(vlc_stream, 4 * (suffix >= 28), refill_array); |
388 | } | ||
389 | |||
390 | /** | ||
391 | * Magnitude and Sign decode procedures. See decodeMagSgnValue procedure at Rec. | ||
392 | * ITU-T T.814, 7.3.8. | ||
393 | */ | ||
394 | av_always_inline | ||
395 | 16384 | static int32_t jpeg2000_decode_mag_sgn(StateVars *mag_sgn_stream, int32_t m_n, | |
396 | int32_t i_n, const uint8_t *buf, uint32_t length) | ||
397 | { | ||
398 | 16384 | int32_t val = 0; | |
399 |
2/2✓ Branch 0 taken 10869 times.
✓ Branch 1 taken 5515 times.
|
16384 | if (m_n > 0) { |
400 | 10869 | val = jpeg2000_bitbuf_get_bits_lsb_forward(mag_sgn_stream,m_n,buf,length); | |
401 | 10869 | val += (i_n << m_n); | |
402 | } | ||
403 | 16384 | return val; | |
404 | } | ||
405 | |||
406 | av_always_inline | ||
407 | 4096 | static void recover_mag_sgn(StateVars *mag_sgn, uint8_t pos, uint16_t q, int32_t m_n[2], | |
408 | int32_t known_1[2], const uint8_t emb_pat_1[2], | ||
409 | int32_t v[2][4], int32_t m[2][4], uint8_t *E, | ||
410 | uint32_t *mu_n, const uint8_t *Dcup, uint32_t Pcup, | ||
411 | uint32_t pLSB) | ||
412 | { | ||
413 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 4096 times.
|
20480 | for (int i = 0; i < 4; i++) { |
414 | 16384 | int32_t n = 4 * q + i; | |
415 | 16384 | m_n[pos] = m[pos][i]; | |
416 | 16384 | known_1[pos] = (emb_pat_1[pos] >> i) & 1; | |
417 | 16384 | v[pos][i] = jpeg2000_decode_mag_sgn(mag_sgn, m_n[pos], known_1[pos], Dcup, Pcup); | |
418 | |||
419 |
2/2✓ Branch 0 taken 10869 times.
✓ Branch 1 taken 5515 times.
|
16384 | if (m_n[pos] != 0) { |
420 | 10869 | E[n] = 32 - ff_clz(v[pos][i] | 1); | |
421 | 10869 | mu_n[n] = (v[pos][i] >> 1) + 1; | |
422 | 10869 | mu_n[n] <<= pLSB; | |
423 | 10869 | mu_n[n] |= (1 << (pLSB - 1)); // Add 0.5 (reconstruction parameter = 1/2) | |
424 | 10869 | mu_n[n] |= ((uint32_t) (v[pos][i] & 1)) << 31; // sign bit. | |
425 | } | ||
426 | } | ||
427 | 4096 | } | |
428 | |||
429 | 109 | static int jpeg2000_import_bit(StateVars *stream, const uint8_t *array, uint32_t length) | |
430 | { | ||
431 | 109 | int cond = stream->pos < length; | |
432 | 109 | int pos = FFMIN(stream->pos, length - 1); | |
433 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 90 times.
|
109 | if (stream->bits == 0) { |
434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | stream->bits = (stream->tmp == 0xFF) ? 7 : 8; |
435 | 19 | stream->pos += cond; | |
436 |
1/2✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
|
19 | stream->tmp = cond ? array[pos] : 0xFF; |
437 | } | ||
438 | 109 | stream->bits -= 1; | |
439 | 109 | return (stream->tmp >> stream->bits) & 1; | |
440 | } | ||
441 | |||
442 | ✗ | static int jpeg2000_peek_bit(StateVars *stream, const uint8_t *array, uint32_t length) | |
443 | { | ||
444 | uint8_t bit; | ||
445 | |||
446 | ✗ | if (stream->bits == 0) { | |
447 | ✗ | stream->bits = (stream->last == 0xFF) ? 7 : 8; | |
448 | ✗ | if (stream->pos < length) { | |
449 | ✗ | stream->tmp = array[stream->pos]; | |
450 | ✗ | stream->pos++; | |
451 | } else { | ||
452 | ✗ | stream->tmp = 0; | |
453 | } | ||
454 | ✗ | stream->last = stream->tmp; | |
455 | } | ||
456 | ✗ | bit = stream->tmp & 1; | |
457 | ✗ | stream->tmp >>= 1; | |
458 | ✗ | stream->bits--; | |
459 | ✗ | return bit; | |
460 | } | ||
461 | |||
462 | 109 | static int jpeg2000_decode_mel_sym(MelDecoderState *mel_state, | |
463 | StateVars *mel_stream, | ||
464 | const uint8_t *Dcup, | ||
465 | uint32_t Lcup) | ||
466 | { | ||
467 | |||
468 |
2/4✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109 times.
✗ Branch 3 not taken.
|
109 | if (mel_state->run == 0 && mel_state->one == 0) { |
469 | uint8_t eval; | ||
470 | uint8_t bit; | ||
471 | |||
472 | 109 | eval = mel_e[mel_state->k]; | |
473 | 109 | bit = jpeg2000_import_bit(mel_stream, Dcup, Lcup); | |
474 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 96 times.
|
109 | if (bit == 1) { |
475 | 13 | mel_state->run = 1 << eval; | |
476 | 13 | mel_state->k = FFMIN(12, mel_state->k + 1); | |
477 | } else { | ||
478 | 96 | mel_state->run = 0; | |
479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
|
96 | while (eval > 0) { |
480 | ✗ | bit = jpeg2000_import_bit(mel_stream, Dcup, Lcup); | |
481 | ✗ | mel_state->run = (2 * (mel_state->run)) + bit; | |
482 | ✗ | eval -= 1; | |
483 | } | ||
484 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 84 times.
|
96 | mel_state->k = FFMAX(0, mel_state->k - 1); |
485 | 96 | mel_state->one = 1; | |
486 | } | ||
487 | } | ||
488 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 96 times.
|
109 | if (mel_state->run > 0) { |
489 | 13 | mel_state->run -= 1; | |
490 | 13 | return 0; | |
491 | } else { | ||
492 | 96 | mel_state->one = 0; | |
493 | 96 | return 1; | |
494 | } | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * Magref decoding procedures. | ||
499 | */ | ||
500 | av_always_inline | ||
501 | ✗ | static int jpeg2000_import_magref_bit(StateVars *stream, const uint8_t *array, | |
502 | uint32_t length) | ||
503 | { | ||
504 | ✗ | return jpeg2000_bitbuf_get_bits_lsb(stream, 1, array); | |
505 | } | ||
506 | |||
507 | /** | ||
508 | * Signal EMB decode. | ||
509 | */ | ||
510 | 4096 | static int jpeg2000_decode_sig_emb(const Jpeg2000DecoderContext *s, MelDecoderState *mel_state, | |
511 | StateVars *mel_stream, StateVars *vlc_stream, | ||
512 | const uint16_t *vlc_table, const uint8_t *Dcup, | ||
513 | uint8_t *sig_pat, uint8_t *res_off, uint8_t *emb_pat_k, | ||
514 | uint8_t *emb_pat_1, uint8_t pos, uint16_t context, | ||
515 | uint32_t Lcup, uint32_t Pcup) | ||
516 | { | ||
517 |
2/2✓ Branch 0 taken 103 times.
✓ Branch 1 taken 3993 times.
|
4096 | if (context == 0) { |
518 | uint8_t sym; | ||
519 | 103 | sym = jpeg2000_decode_mel_sym(mel_state, mel_stream, Dcup, Lcup); | |
520 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 92 times.
|
103 | if (sym == 0) { |
521 | 11 | sig_pat[pos] = 0; | |
522 | 11 | res_off[pos] = 0; | |
523 | 11 | emb_pat_k[pos] = 0; | |
524 | 11 | emb_pat_1[pos] = 0; | |
525 | 11 | return 0; | |
526 | } | ||
527 | } | ||
528 | 4085 | return jpeg2000_decode_ctx_vlc(s, vlc_stream, vlc_table, Dcup, sig_pat, | |
529 | res_off, emb_pat_k, emb_pat_1, pos, Pcup, | ||
530 | context); | ||
531 | } | ||
532 | |||
533 | av_always_inline | ||
534 | ✗ | static int jpeg2000_get_state(int x1, int x2, int stride, int shift_by, | |
535 | const uint8_t *block_states) | ||
536 | { | ||
537 | ✗ | return (block_states[(x1 + 1) * stride + (x2 + 1)] >> shift_by) & 1; | |
538 | } | ||
539 | |||
540 | av_always_inline | ||
541 | 16384 | static void jpeg2000_modify_state(int x1, int x2, int stride, | |
542 | int value, uint8_t *block_states) | ||
543 | { | ||
544 | 16384 | block_states[(x1 + 1) * stride + (x2 + 1)] |= value; | |
545 | 16384 | } | |
546 | |||
547 | av_always_inline | ||
548 | 10 | static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, | |
549 | Jpeg2000Cblk *cblk, Jpeg2000T1Context *t1, | ||
550 | MelDecoderState *mel_state, | ||
551 | StateVars *mel_stream, StateVars *vlc_stream, | ||
552 | StateVars *mag_sgn_stream, const uint8_t *Dcup, | ||
553 | uint32_t Lcup, uint32_t Pcup, uint8_t pLSB, | ||
554 | int width, int height, const int stride, | ||
555 | int32_t *sample_buf, uint8_t *block_states) | ||
556 | { | ||
557 | 10 | uint16_t q = 0; // Represents current quad position | |
558 | uint16_t q1, q2; | ||
559 | uint16_t context1, context2; | ||
560 | 10 | uint16_t context = 0; | |
561 | |||
562 | 10 | uint8_t sig_pat[2] = { 0 }; // significance pattern | |
563 | 10 | uint8_t res_off[2] = { 0 }; // residual offset | |
564 | 10 | uint8_t emb_pat_k[2] = { 0 }; // exponent Max Bound pattern K | |
565 | 10 | uint8_t emb_pat_1[2] = { 0 }; // exponent Max Bound pattern 1 | |
566 | 10 | uint8_t gamma[2] = { 0 }; | |
567 | |||
568 | 10 | uint8_t E_n[2] = { 0 }; | |
569 | 10 | uint8_t E_ne[2] = { 0 }; | |
570 | 10 | uint8_t E_nw[2] = { 0 }; | |
571 | 10 | uint8_t E_nf[2] = { 0 }; | |
572 | |||
573 | 10 | uint8_t max_e[2] = { 0 }; | |
574 | 10 | uint8_t u_pfx[2] = { 0 }; | |
575 | 10 | uint8_t u_sfx[2] = { 0 }; | |
576 | 10 | uint8_t u_ext[2] = { 0 }; | |
577 | |||
578 | 10 | int32_t u[2] = { 0 }; | |
579 | 10 | int32_t U[2] = { 0 }; // exponent bound | |
580 | 10 | int32_t m_n[2] = { 0 }; | |
581 | 10 | int32_t known_1[2] = { 0 }; | |
582 | |||
583 | 10 | int32_t m[2][4] = { 0 }; | |
584 | 10 | int32_t v[2][4] = { 0 }; | |
585 | |||
586 | 10 | uint8_t kappa[2] = { 1, 1 }; | |
587 | |||
588 | 10 | int ret = 0; | |
589 | |||
590 | int sp; | ||
591 | |||
592 | uint64_t c; | ||
593 | |||
594 | uint8_t *sigma, *sigma_n, *E; | ||
595 | uint32_t *mu, *mu_n; | ||
596 | |||
597 | 10 | const uint8_t *vlc_buf = Dcup + Pcup; | |
598 | |||
599 | /* | ||
600 | * Bound on the precision needed to process the codeblock. The number of | ||
601 | * decoded bit planes is equal to at most cblk->zbp + 2 since S_blk = P if | ||
602 | * there are no placeholder passes or HT Sets and P = cblk->zbp. See Rec. | ||
603 | * ITU-T T.814, 7.6. | ||
604 | */ | ||
605 | 10 | int maxbp = cblk->zbp + 2; | |
606 | |||
607 | /* convert to raster-scan */ | ||
608 | 10 | const uint16_t is_border_x = width % 2; | |
609 | 10 | const uint16_t is_border_y = height % 2; | |
610 | |||
611 | 10 | const uint16_t quad_width = ff_jpeg2000_ceildivpow2(width, 1); | |
612 | 10 | const uint16_t quad_height = ff_jpeg2000_ceildivpow2(height, 1); | |
613 | |||
614 | 10 | size_t buf_size = 4 * quad_width * quad_height; | |
615 | |||
616 | /* do we have enough precision, assuming a 32-bit decoding path */ | ||
617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (maxbp >= 32) |
618 | ✗ | return AVERROR_INVALIDDATA; | |
619 | |||
620 | 10 | sigma_n = av_calloc(buf_size, sizeof(uint8_t)); | |
621 | 10 | E = av_calloc(buf_size, sizeof(uint8_t)); | |
622 | 10 | mu_n = av_calloc(buf_size, sizeof(uint32_t)); | |
623 | |||
624 |
3/6✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
|
10 | if (!sigma_n || !E || !mu_n) { |
625 | ✗ | ret = AVERROR(ENOMEM); | |
626 | ✗ | goto free; | |
627 | } | ||
628 | |||
629 | 10 | sigma = sigma_n; | |
630 | 10 | mu = mu_n; | |
631 | |||
632 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 10 times.
|
98 | while (q < quad_width - 1) { |
633 | 88 | q1 = q; | |
634 | 88 | q2 = q1 + 1; | |
635 | |||
636 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
88 | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, |
637 | dec_cxt_vlc_table0, Dcup, sig_pat, res_off, | ||
638 | emb_pat_k, emb_pat_1, J2K_Q1, context, Lcup, | ||
639 | Pcup)) < 0) | ||
640 | ✗ | goto free; | |
641 | |||
642 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 88 times.
|
440 | for (int i = 0; i < 4; i++) |
643 | 352 | sigma_n[4 * q1 + i] = (sig_pat[J2K_Q1] >> i) & 1; | |
644 | |||
645 | /* calculate context */ | ||
646 | 88 | context = sigma_n[4 * q1]; // f | |
647 | 88 | context |= sigma_n[4 * q1 + 1]; // sf | |
648 | 88 | context += sigma_n[4 * q1 + 2] << 1; // w << 1 | |
649 | 88 | context += sigma_n[4 * q1 + 3] << 2; | |
650 | |||
651 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
88 | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, |
652 | dec_cxt_vlc_table0, Dcup, sig_pat, res_off, | ||
653 | emb_pat_k, emb_pat_1, J2K_Q2, context, Lcup, | ||
654 | Pcup)) < 0) | ||
655 | ✗ | goto free; | |
656 | |||
657 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 88 times.
|
440 | for (int i = 0; i < 4; i++) |
658 | 352 | sigma_n[4 * q2 + i] = (sig_pat[J2K_Q2] >> i) & 1; | |
659 | |||
660 | /* calculate context for the next quad */ | ||
661 | 88 | context = sigma_n[4 * q2]; // f | |
662 | 88 | context |= sigma_n[4 * q2 + 1]; // sf | |
663 | 88 | context += sigma_n[4 * q2 + 2] << 1; // w << 1 | |
664 | 88 | context += sigma_n[4 * q2 + 3] << 2; // sw << 2 | |
665 | |||
666 | 88 | u[0] = 0; | |
667 | 88 | u[1] = 0; | |
668 | |||
669 | 88 | jpeg2000_bitbuf_refill_backwards(vlc_stream, vlc_buf); | |
670 | |||
671 |
4/4✓ Branch 0 taken 16 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 10 times.
|
88 | if (res_off[J2K_Q1] == 1 && res_off[J2K_Q2] == 1) { |
672 | |||
673 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 2 times.
|
12 | if (jpeg2000_decode_mel_sym(mel_state, mel_stream, Dcup, Lcup) == 1) { |
674 | |||
675 | 4 | u_pfx[J2K_Q1] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
676 | 4 | u_pfx[J2K_Q2] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
677 | |||
678 | 4 | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
679 | 4 | u_sfx[J2K_Q2] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q2], vlc_buf); | |
680 | |||
681 | 4 | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
682 | 4 | u_ext[J2K_Q2] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q2], vlc_buf); | |
683 | |||
684 | 4 | u[J2K_Q1] = 2 + u_pfx[J2K_Q1] + u_sfx[J2K_Q1] + (u_ext[J2K_Q1] * 4); | |
685 | 4 | u[J2K_Q2] = 2 + u_pfx[J2K_Q2] + u_sfx[J2K_Q2] + (u_ext[J2K_Q2] * 4); | |
686 | |||
687 | } else { | ||
688 | 2 | u_pfx[J2K_Q1] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
689 | |||
690 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (u_pfx[J2K_Q1] > 2) { |
691 | ✗ | u[J2K_Q2] = jpeg2000_bitbuf_get_bits_lsb(vlc_stream, 1, vlc_buf) + 1; | |
692 | ✗ | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
693 | ✗ | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
694 | } else { | ||
695 | 2 | u_pfx[J2K_Q2] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
696 | 2 | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
697 | 2 | u_sfx[J2K_Q2] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q2], vlc_buf); | |
698 | 2 | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
699 | 2 | u_ext[J2K_Q2] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q2], vlc_buf); | |
700 | 2 | u[J2K_Q2] = u_pfx[J2K_Q2] + u_sfx[J2K_Q2] + (u_ext[J2K_Q2] * 4); | |
701 | } | ||
702 | /* See Rec. ITU-T T.814, 7.3.6(3) */ | ||
703 | 2 | u[J2K_Q1] = u_pfx[J2K_Q1] + u_sfx[J2K_Q1] + (u_ext[J2K_Q1] * 4); | |
704 | } | ||
705 | |||
706 |
4/4✓ Branch 0 taken 72 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 21 times.
✓ Branch 3 taken 51 times.
|
82 | } else if (res_off[J2K_Q1] == 1 || res_off[J2K_Q2] == 1) { |
707 | 31 | uint8_t pos = res_off[J2K_Q1] == 1 ? 0 : 1; | |
708 | 31 | u_pfx[pos] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
709 | 31 | u_sfx[pos] = vlc_decode_u_suffix(vlc_stream, u_pfx[pos], vlc_buf); | |
710 | 31 | u_ext[pos] = vlc_decode_u_extension(vlc_stream, u_sfx[pos], vlc_buf); | |
711 | 31 | u[pos] = u_pfx[pos] + u_sfx[pos] + (u_ext[pos] * 4); | |
712 | } | ||
713 | 88 | U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; | |
714 | 88 | U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2]; | |
715 |
2/4✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 88 times.
|
88 | if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) { |
716 | ✗ | ret = AVERROR_INVALIDDATA; | |
717 | ✗ | goto free; | |
718 | } | ||
719 | |||
720 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 88 times.
|
440 | for (int i = 0; i < 4; i++) { |
721 | 352 | m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); | |
722 | 352 | m[J2K_Q2][i] = sigma_n[4 * q2 + i] * U[J2K_Q2] - ((emb_pat_k[J2K_Q2] >> i) & 1); | |
723 | } | ||
724 | |||
725 | 88 | recover_mag_sgn(mag_sgn_stream, J2K_Q1, q1, m_n, known_1, emb_pat_1, v, m, | |
726 | E, mu_n, Dcup, Pcup, pLSB); | ||
727 | |||
728 | 88 | recover_mag_sgn(mag_sgn_stream, J2K_Q2, q2, m_n, known_1, emb_pat_1, v, m, | |
729 | E, mu_n, Dcup, Pcup, pLSB); | ||
730 | |||
731 | 88 | q += 2; // Move to the next quad pair | |
732 | } | ||
733 | |||
734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (quad_width % 2 == 1) { |
735 | ✗ | q1 = q; | |
736 | |||
737 | ✗ | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, | |
738 | dec_cxt_vlc_table0, Dcup, sig_pat, res_off, | ||
739 | emb_pat_k, emb_pat_1, J2K_Q1, context, Lcup, | ||
740 | Pcup)) < 0) | ||
741 | ✗ | goto free; | |
742 | |||
743 | ✗ | for (int i = 0; i < 4; i++) | |
744 | ✗ | sigma_n[4 * q1 + i] = (sig_pat[J2K_Q1] >> i) & 1; | |
745 | |||
746 | ✗ | u[J2K_Q1] = 0; | |
747 | |||
748 | ✗ | if (res_off[J2K_Q1] == 1) { | |
749 | ✗ | u_pfx[J2K_Q1] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
750 | ✗ | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
751 | ✗ | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
752 | ✗ | u[J2K_Q1] = u_pfx[J2K_Q1] + u_sfx[J2K_Q1] + (u_ext[J2K_Q1] * 4); | |
753 | } | ||
754 | |||
755 | ✗ | U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; | |
756 | ✗ | if (U[J2K_Q1] > maxbp) { | |
757 | ✗ | ret = AVERROR_INVALIDDATA; | |
758 | ✗ | goto free; | |
759 | } | ||
760 | |||
761 | ✗ | for (int i = 0; i < 4; i++) | |
762 | ✗ | m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); | |
763 | |||
764 | ✗ | recover_mag_sgn(mag_sgn_stream, J2K_Q1, q1, m_n, known_1, emb_pat_1, v, m, | |
765 | E, mu_n, Dcup, Pcup, pLSB); | ||
766 | |||
767 | ✗ | q++; // move to next quad pair | |
768 | } | ||
769 | |||
770 | /** | ||
771 | * Initial line pair end. As an optimization, we can replace modulo | ||
772 | * operations with checking if a number is divisible , since that's the only | ||
773 | * thing we need. This is paired with is_divisible. Credits to Daniel Lemire | ||
774 | * blog post [1]. | ||
775 | * | ||
776 | * [1] | ||
777 | * https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/ | ||
778 | * | ||
779 | * It's UB on zero, but the spec doesn't allow a quad being zero, so we | ||
780 | * error out early in case that's the case. | ||
781 | */ | ||
782 | 10 | c = precompute_c(quad_width); | |
783 | |||
784 |
2/2✓ Branch 0 taken 166 times.
✓ Branch 1 taken 10 times.
|
176 | for (int row = 1; row < quad_height; row++) { |
785 |
3/4✓ Branch 0 taken 1960 times.
✓ Branch 1 taken 166 times.
✓ Branch 2 taken 1960 times.
✗ Branch 3 not taken.
|
2126 | while ((q - (row * quad_width)) < quad_width - 1 && q < (quad_height * quad_width)) { |
786 | 1960 | q1 = q; | |
787 | 1960 | q2 = q + 1; | |
788 | 1960 | context1 = sigma_n[4 * (q1 - quad_width) + 1]; | |
789 | 1960 | context1 += sigma_n[4 * (q1 - quad_width) + 3] << 2; // ne | |
790 | |||
791 |
2/2✓ Branch 1 taken 1794 times.
✓ Branch 2 taken 166 times.
|
1960 | if (!is_divisible(q1, c)) { |
792 | 1794 | context1 |= sigma_n[4 * (q1 - quad_width) - 1]; // nw | |
793 | 1794 | context1 += (sigma_n[4 * q1 - 1] | sigma_n[4 * q1 - 2]) << 1; // sw | q | |
794 | } | ||
795 |
1/2✓ Branch 1 taken 1960 times.
✗ Branch 2 not taken.
|
1960 | if (!is_divisible(q1 + 1, c)) |
796 | 1960 | context1 |= sigma_n[4 * (q1 - quad_width) + 5] << 2; | |
797 | |||
798 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1960 times.
|
1960 | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, |
799 | dec_cxt_vlc_table1, Dcup, sig_pat, res_off, | ||
800 | emb_pat_k, emb_pat_1, J2K_Q1, context1, Lcup, | ||
801 | Pcup)) | ||
802 | < 0) | ||
803 | ✗ | goto free; | |
804 | |||
805 |
2/2✓ Branch 0 taken 7840 times.
✓ Branch 1 taken 1960 times.
|
9800 | for (int i = 0; i < 4; i++) |
806 | 7840 | sigma_n[4 * q1 + i] = (sig_pat[J2K_Q1] >> i) & 1; | |
807 | |||
808 | 1960 | context2 = sigma_n[4 * (q2 - quad_width) + 1]; | |
809 | 1960 | context2 += sigma_n[4 * (q2 - quad_width) + 3] << 2; | |
810 | |||
811 |
1/2✓ Branch 1 taken 1960 times.
✗ Branch 2 not taken.
|
1960 | if (!is_divisible(q2, c)) { |
812 | 1960 | context2 |= sigma_n[4 * (q2 - quad_width) - 1]; | |
813 | 1960 | context2 += (sigma_n[4 * q2 - 1] | sigma_n[4 * q2 - 2]) << 1; | |
814 | } | ||
815 |
2/2✓ Branch 1 taken 1794 times.
✓ Branch 2 taken 166 times.
|
1960 | if (!is_divisible(q2 + 1, c)) |
816 | 1794 | context2 |= sigma_n[4 * (q2 - quad_width) + 5] << 2; | |
817 | |||
818 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1960 times.
|
1960 | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, |
819 | dec_cxt_vlc_table1, Dcup, sig_pat, res_off, | ||
820 | emb_pat_k, emb_pat_1, J2K_Q2, context2, Lcup, | ||
821 | Pcup)) | ||
822 | < 0) | ||
823 | ✗ | goto free; | |
824 | |||
825 |
2/2✓ Branch 0 taken 7840 times.
✓ Branch 1 taken 1960 times.
|
9800 | for (int i = 0; i < 4; i++) |
826 | 7840 | sigma_n[4 * q2 + i] = (sig_pat[J2K_Q2] >> i) & 1; | |
827 | |||
828 | 1960 | u[J2K_Q1] = 0; | |
829 | 1960 | u[J2K_Q2] = 0; | |
830 | |||
831 | 1960 | jpeg2000_bitbuf_refill_backwards(vlc_stream, vlc_buf); | |
832 | |||
833 |
4/4✓ Branch 0 taken 743 times.
✓ Branch 1 taken 1217 times.
✓ Branch 2 taken 461 times.
✓ Branch 3 taken 282 times.
|
1960 | if (res_off[J2K_Q1] == 1 && res_off[J2K_Q2] == 1) { |
834 | 461 | u_pfx[J2K_Q1] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
835 | 461 | u_pfx[J2K_Q2] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
836 | |||
837 | 461 | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
838 | 461 | u_sfx[J2K_Q2] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q2], vlc_buf); | |
839 | |||
840 | 461 | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
841 | 461 | u_ext[J2K_Q2] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q2], vlc_buf); | |
842 | |||
843 | 461 | u[J2K_Q1] = u_pfx[J2K_Q1] + u_sfx[J2K_Q1] + (u_ext[J2K_Q1] << 2); | |
844 | 461 | u[J2K_Q2] = u_pfx[J2K_Q2] + u_sfx[J2K_Q2] + (u_ext[J2K_Q2] << 2); | |
845 | |||
846 |
4/4✓ Branch 0 taken 1217 times.
✓ Branch 1 taken 282 times.
✓ Branch 2 taken 301 times.
✓ Branch 3 taken 916 times.
|
1499 | } else if (res_off[J2K_Q1] == 1 || res_off[J2K_Q2] == 1) { |
847 | 583 | uint8_t pos = res_off[J2K_Q1] == 1 ? 0 : 1; | |
848 | |||
849 | 583 | u_pfx[pos] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
850 | 583 | u_sfx[pos] = vlc_decode_u_suffix(vlc_stream, u_pfx[pos], vlc_buf); | |
851 | 583 | u_ext[pos] = vlc_decode_u_extension(vlc_stream, u_sfx[pos], vlc_buf); | |
852 | |||
853 | 583 | u[pos] = u_pfx[pos] + u_sfx[pos] + (u_ext[pos] << 2); | |
854 | } | ||
855 | 1960 | sp = sig_pat[J2K_Q1]; | |
856 | |||
857 | 1960 | gamma[J2K_Q1] = 1; | |
858 | |||
859 |
10/10✓ Branch 0 taken 1859 times.
✓ Branch 1 taken 101 times.
✓ Branch 2 taken 1788 times.
✓ Branch 3 taken 71 times.
✓ Branch 4 taken 1713 times.
✓ Branch 5 taken 75 times.
✓ Branch 6 taken 1631 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 72 times.
✓ Branch 9 taken 1559 times.
|
1960 | if (sp == 0 || sp == 1 || sp == 2 || sp == 4 || sp == 8) |
860 | 401 | gamma[J2K_Q1] = 0; | |
861 | |||
862 | 1960 | sp = sig_pat[J2K_Q2]; | |
863 | |||
864 | 1960 | gamma[J2K_Q2] = 1; | |
865 | |||
866 |
10/10✓ Branch 0 taken 1861 times.
✓ Branch 1 taken 99 times.
✓ Branch 2 taken 1782 times.
✓ Branch 3 taken 79 times.
✓ Branch 4 taken 1707 times.
✓ Branch 5 taken 75 times.
✓ Branch 6 taken 1630 times.
✓ Branch 7 taken 77 times.
✓ Branch 8 taken 79 times.
✓ Branch 9 taken 1551 times.
|
1960 | if (sp == 0 || sp == 1 || sp == 2 || sp == 4 || sp == 8) |
867 | 409 | gamma[J2K_Q2] = 0; | |
868 | |||
869 | 1960 | E_n[J2K_Q1] = E[4 * (q1 - quad_width) + 1]; | |
870 | 1960 | E_n[J2K_Q2] = E[4 * (q2 - quad_width) + 1]; | |
871 | |||
872 | 1960 | E_ne[J2K_Q1] = E[4 * (q1 - quad_width) + 3]; | |
873 | 1960 | E_ne[J2K_Q2] = E[4 * (q2 - quad_width) + 3]; | |
874 | |||
875 |
2/2✓ Branch 1 taken 1950 times.
✓ Branch 2 taken 10 times.
|
1960 | E_nw[J2K_Q1] = (!is_divisible(q1, c)) * E[FFMAX((4 * (q1 - quad_width) - 1), 0)]; |
876 |
1/2✓ Branch 1 taken 1960 times.
✗ Branch 2 not taken.
|
1960 | E_nw[J2K_Q2] = (!is_divisible(q2, c)) * E[FFMAX((4 * (q2 - quad_width) - 1), 0)]; |
877 | |||
878 | 1960 | E_nf[J2K_Q1] = (!is_divisible(q1 + 1, c)) * E[4 * (q1 - quad_width) + 5]; | |
879 | 1960 | E_nf[J2K_Q2] = (!is_divisible(q2 + 1, c)) * E[4 * (q2 - quad_width) + 5]; | |
880 | |||
881 | 1960 | max_e[J2K_Q1] = FFMAX(E_nw[J2K_Q1], FFMAX3(E_n[J2K_Q1], E_ne[J2K_Q1], E_nf[J2K_Q1])); | |
882 | 1960 | max_e[J2K_Q2] = FFMAX(E_nw[J2K_Q2], FFMAX3(E_n[J2K_Q2], E_ne[J2K_Q2], E_nf[J2K_Q2])); | |
883 | |||
884 | 1960 | kappa[J2K_Q1] = FFMAX(1, gamma[J2K_Q1] * (max_e[J2K_Q1] - 1)); | |
885 | 1960 | kappa[J2K_Q2] = FFMAX(1, gamma[J2K_Q2] * (max_e[J2K_Q2] - 1)); | |
886 | |||
887 | 1960 | U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; | |
888 | 1960 | U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2]; | |
889 |
2/4✓ Branch 0 taken 1960 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1960 times.
|
1960 | if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) { |
890 | ✗ | ret = AVERROR_INVALIDDATA; | |
891 | ✗ | goto free; | |
892 | } | ||
893 | |||
894 |
2/2✓ Branch 0 taken 7840 times.
✓ Branch 1 taken 1960 times.
|
9800 | for (int i = 0; i < 4; i++) { |
895 | 7840 | m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); | |
896 | 7840 | m[J2K_Q2][i] = sigma_n[4 * q2 + i] * U[J2K_Q2] - ((emb_pat_k[J2K_Q2] >> i) & 1); | |
897 | } | ||
898 | 1960 | recover_mag_sgn(mag_sgn_stream, J2K_Q1, q1, m_n, known_1, emb_pat_1, v, m, | |
899 | E, mu_n, Dcup, Pcup, pLSB); | ||
900 | |||
901 | 1960 | recover_mag_sgn(mag_sgn_stream, J2K_Q2, q2, m_n, known_1, emb_pat_1, v, m, | |
902 | E, mu_n, Dcup, Pcup, pLSB); | ||
903 | |||
904 | 1960 | q += 2; // Move to the next quad pair | |
905 | } | ||
906 | |||
907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 166 times.
|
166 | if (quad_width % 2 == 1) { |
908 | ✗ | q1 = q; | |
909 | |||
910 | /* calculate context for current quad */ | ||
911 | ✗ | context1 = sigma_n[4 * (q1 - quad_width) + 1]; | |
912 | ✗ | context1 += (sigma_n[4 * (q1 - quad_width) + 3] << 2); | |
913 | |||
914 | ✗ | if (!is_divisible(q1, c)) { | |
915 | ✗ | context1 |= sigma_n[4 * (q1 - quad_width) - 1]; | |
916 | ✗ | context1 += (sigma_n[4 * q1 - 1] | sigma_n[4 * q1 - 2]) << 1; | |
917 | } | ||
918 | ✗ | if (!is_divisible(q1 + 1, c)) | |
919 | ✗ | context1 |= sigma_n[4 * (q1 - quad_width) + 5] << 2; | |
920 | |||
921 | ✗ | if ((ret = jpeg2000_decode_sig_emb(s, mel_state, mel_stream, vlc_stream, | |
922 | dec_cxt_vlc_table1, Dcup, sig_pat, res_off, | ||
923 | emb_pat_k, emb_pat_1, J2K_Q1, context1, Lcup, | ||
924 | Pcup)) < 0) | ||
925 | ✗ | goto free; | |
926 | |||
927 | ✗ | for (int i = 0; i < 4; i++) | |
928 | ✗ | sigma_n[4 * q1 + i] = (sig_pat[J2K_Q1] >> i) & 1; | |
929 | |||
930 | ✗ | u[J2K_Q1] = 0; | |
931 | |||
932 | /* Recover mag_sgn value */ | ||
933 | ✗ | if (res_off[J2K_Q1] == 1) { | |
934 | ✗ | u_pfx[J2K_Q1] = vlc_decode_u_prefix(vlc_stream, vlc_buf); | |
935 | ✗ | u_sfx[J2K_Q1] = vlc_decode_u_suffix(vlc_stream, u_pfx[J2K_Q1], vlc_buf); | |
936 | ✗ | u_ext[J2K_Q1] = vlc_decode_u_extension(vlc_stream, u_sfx[J2K_Q1], vlc_buf); | |
937 | |||
938 | ✗ | u[J2K_Q1] = u_pfx[J2K_Q1] + u_sfx[J2K_Q1] + (u_ext[J2K_Q1] << 2); | |
939 | } | ||
940 | |||
941 | ✗ | sp = sig_pat[J2K_Q1]; | |
942 | |||
943 | ✗ | gamma[J2K_Q1] = 1; | |
944 | |||
945 | ✗ | if (sp == 0 || sp == 1 || sp == 2 || sp == 4 || sp == 8) | |
946 | ✗ | gamma[J2K_Q1] = 0; | |
947 | |||
948 | ✗ | E_n[J2K_Q1] = E[4 * (q1 - quad_width) + 1]; | |
949 | |||
950 | ✗ | E_ne[J2K_Q1] = E[4 * (q1 - quad_width) + 3]; | |
951 | |||
952 | ✗ | E_nw[J2K_Q1] = (!is_divisible(q1, c)) * E[FFMAX((4 * (q1 - quad_width) - 1), 0)]; | |
953 | |||
954 | ✗ | E_nf[J2K_Q1] = (!is_divisible(q1 + 1, c)) * E[4 * (q1 - quad_width) + 5]; | |
955 | |||
956 | ✗ | max_e[J2K_Q1] = FFMAX(E_nw[J2K_Q1], FFMAX3(E_n[J2K_Q1], E_ne[J2K_Q1], E_nf[J2K_Q1])); | |
957 | |||
958 | ✗ | kappa[J2K_Q1] = FFMAX(1, gamma[J2K_Q1] * (max_e[J2K_Q1] - 1)); | |
959 | |||
960 | ✗ | U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; | |
961 | ✗ | if (U[J2K_Q1] > maxbp) { | |
962 | ✗ | ret = AVERROR_INVALIDDATA; | |
963 | ✗ | goto free; | |
964 | } | ||
965 | |||
966 | ✗ | for (int i = 0; i < 4; i++) | |
967 | ✗ | m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); | |
968 | |||
969 | ✗ | recover_mag_sgn(mag_sgn_stream, J2K_Q1, q1, m_n, known_1, emb_pat_1, v, m, | |
970 | E, mu_n, Dcup, Pcup, pLSB); | ||
971 | ✗ | q += 1; | |
972 | } | ||
973 | } | ||
974 | |||
975 | // convert to raster-scan | ||
976 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 10 times.
|
186 | for (int y = 0; y < quad_height; y++) { |
977 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 176 times.
|
4272 | for (int x = 0; x < quad_width; x++) { |
978 | int j1, j2; | ||
979 | int x1, x2 , x3; | ||
980 | |||
981 | 4096 | j1 = 2 * y; | |
982 | 4096 | j2 = 2 * x; | |
983 | |||
984 | 4096 | sample_buf[j2 + (j1 * stride)] = (int32_t)*mu; | |
985 | 4096 | jpeg2000_modify_state(j1, j2, stride, *sigma, block_states); | |
986 | 4096 | sigma += 1; | |
987 | 4096 | mu += 1; | |
988 | |||
989 |
3/4✓ Branch 0 taken 176 times.
✓ Branch 1 taken 3920 times.
✓ Branch 2 taken 176 times.
✗ Branch 3 not taken.
|
4096 | x1 = y != quad_height - 1 || is_border_y == 0; |
990 | 4096 | sample_buf[j2 + ((j1 + 1) * stride)] = ((int32_t)*mu) * x1; | |
991 | 4096 | jpeg2000_modify_state(j1 + 1, j2, stride, (*sigma) * x1, block_states); | |
992 | 4096 | sigma += 1; | |
993 | 4096 | mu += 1; | |
994 | |||
995 |
3/4✓ Branch 0 taken 176 times.
✓ Branch 1 taken 3920 times.
✓ Branch 2 taken 176 times.
✗ Branch 3 not taken.
|
4096 | x2 = x != quad_width - 1 || is_border_x == 0; |
996 | 4096 | sample_buf[(j2 + 1) + (j1 * stride)] = ((int32_t)*mu) * x2; | |
997 | 4096 | jpeg2000_modify_state(j1, j2 + 1, stride, (*sigma) * x2, block_states); | |
998 | 4096 | sigma += 1; | |
999 | 4096 | mu += 1; | |
1000 | |||
1001 | 4096 | x3 = x1 | x2; | |
1002 | 4096 | sample_buf[(j2 + 1) + (j1 + 1) * stride] = ((int32_t)*mu) * x3; | |
1003 | 4096 | jpeg2000_modify_state(j1 + 1, j2 + 1, stride, (*sigma) * x3, block_states); | |
1004 | 4096 | sigma += 1; | |
1005 | 4096 | mu += 1; | |
1006 | } | ||
1007 | } | ||
1008 | 10 | ret = 1; | |
1009 | 10 | free: | |
1010 | 10 | av_freep(&sigma_n); | |
1011 | 10 | av_freep(&E); | |
1012 | 10 | av_freep(&mu_n); | |
1013 | 10 | return ret; | |
1014 | } | ||
1015 | |||
1016 | ✗ | static void jpeg2000_calc_mbr(uint8_t *mbr, const uint16_t i, const uint16_t j, | |
1017 | const uint32_t mbr_info, uint8_t causal_cond, | ||
1018 | uint8_t *block_states, int stride) | ||
1019 | { | ||
1020 | ✗ | uint8_t *state_p0 = block_states + i * stride + j; | |
1021 | ✗ | uint8_t *state_p1 = block_states + (i + 1) * stride + j; | |
1022 | ✗ | uint8_t *state_p2 = block_states + (i + 2) * stride + j; | |
1023 | |||
1024 | ✗ | uint8_t mbr0 = state_p0[0] | state_p0[1] | state_p0[2]; | |
1025 | ✗ | uint8_t mbr1 = state_p1[0] | state_p1[2]; | |
1026 | ✗ | uint8_t mbr2 = state_p2[0] | state_p2[1] | state_p2[2]; | |
1027 | ✗ | *mbr = mbr0 | mbr1 | (mbr2 & causal_cond); | |
1028 | ✗ | *mbr |= (mbr0 >> HT_SHIFT_REF) & (mbr0 >> HT_SHIFT_SCAN); | |
1029 | ✗ | *mbr |= (mbr1 >> HT_SHIFT_REF) & (mbr1 >> HT_SHIFT_SCAN); | |
1030 | ✗ | *mbr |= (mbr2 >> HT_SHIFT_REF) & (mbr2 >> HT_SHIFT_SCAN) & causal_cond; | |
1031 | ✗ | *mbr &= 1; | |
1032 | ✗ | } | |
1033 | |||
1034 | ✗ | static void jpeg2000_process_stripes_block(StateVars *sig_prop, int i_s, int j_s, | |
1035 | int width, int height, int stride, int pLSB, | ||
1036 | int32_t *sample_buf, uint8_t *block_states, | ||
1037 | uint8_t *magref_segment, uint32_t magref_length, | ||
1038 | uint8_t is_causal) | ||
1039 | { | ||
1040 | ✗ | for (int j = j_s; j < j_s + width; j++) { | |
1041 | ✗ | uint32_t mbr_info = 0; | |
1042 | ✗ | for (int i = i_s; i < i_s + height; i++) { | |
1043 | int modify_state; | ||
1044 | uint8_t bit; | ||
1045 | ✗ | uint8_t causal_cond = (is_causal == 0) || (i != (i_s + height - 1)); | |
1046 | ✗ | int32_t *sp = &sample_buf[j + (i * (stride))]; | |
1047 | ✗ | uint8_t mbr = 0; | |
1048 | |||
1049 | ✗ | if (jpeg2000_get_state(i, j, stride, HT_SHIFT_SIGMA, block_states) == 0) | |
1050 | ✗ | jpeg2000_calc_mbr(&mbr, i, j, mbr_info & 0x1EF, causal_cond, block_states, stride); | |
1051 | ✗ | mbr_info >>= 3; | |
1052 | |||
1053 | ✗ | modify_state = block_states[(i + 1) * stride + (j + 1)]; | |
1054 | ✗ | modify_state |= 1 << HT_SHIFT_SCAN; | |
1055 | ✗ | if (mbr != 0) { | |
1056 | ✗ | modify_state |= 1 << HT_SHIFT_REF_IND; | |
1057 | ✗ | bit = jpeg2000_peek_bit(sig_prop, magref_segment, magref_length); | |
1058 | ✗ | modify_state |= bit << HT_SHIFT_REF; | |
1059 | ✗ | *sp |= bit << pLSB; | |
1060 | ✗ | *sp |= bit << (pLSB - 1); // Add 0.5 (reconstruction parameter = 1/2) | |
1061 | } | ||
1062 | ✗ | jpeg2000_modify_state(i, j, stride, modify_state, block_states); | |
1063 | } | ||
1064 | } | ||
1065 | // decode sign | ||
1066 | ✗ | for (int j = j_s; j < j_s + width; j++) { | |
1067 | ✗ | for (int i = i_s; i < i_s + height; i++) { | |
1068 | uint8_t bit; | ||
1069 | ✗ | int32_t *sp = &sample_buf[j + (i * (stride))]; | |
1070 | ✗ | uint8_t *state_p = block_states + (i + 1) * stride + (j + 1); | |
1071 | ✗ | if ((state_p[0] >> HT_SHIFT_REF) & 1) { | |
1072 | ✗ | bit = jpeg2000_peek_bit(sig_prop, magref_segment, magref_length); | |
1073 | ✗ | *sp |= (int32_t)bit << 31; | |
1074 | } | ||
1075 | } | ||
1076 | } | ||
1077 | ✗ | } | |
1078 | |||
1079 | /** | ||
1080 | * See procedure decodeSigPropMag at Rec. ITU-T T.814, 7.4. | ||
1081 | */ | ||
1082 | av_noinline | ||
1083 | ✗ | static void jpeg2000_decode_sigprop_segment(Jpeg2000Cblk *cblk, uint16_t width, uint16_t height, | |
1084 | const int stride, uint8_t *magref_segment, | ||
1085 | uint32_t magref_length, uint8_t pLSB, | ||
1086 | int32_t *sample_buf, uint8_t *block_states) | ||
1087 | { | ||
1088 | StateVars sp_dec; | ||
1089 | |||
1090 | ✗ | const uint16_t num_v_stripe = height / 4; | |
1091 | ✗ | const uint16_t num_h_stripe = width / 4; | |
1092 | ✗ | int b_width = 4; | |
1093 | ✗ | int b_height = 4; | |
1094 | |||
1095 | int last_width; | ||
1096 | ✗ | uint16_t i = 0, j = 0; | |
1097 | ✗ | uint8_t is_causal = cblk->modes & JPEG2000_CBLK_VSC; | |
1098 | |||
1099 | ✗ | jpeg2000_init_zero(&sp_dec); | |
1100 | |||
1101 | ✗ | for (int n1 = 0; n1 < num_v_stripe; n1++) { | |
1102 | ✗ | j = 0; | |
1103 | ✗ | for (int n2 = 0; n2 < num_h_stripe; n2++) { | |
1104 | ✗ | jpeg2000_process_stripes_block(&sp_dec, i, j, b_width, b_height, stride, | |
1105 | pLSB, sample_buf, block_states, magref_segment, | ||
1106 | magref_length, is_causal); | ||
1107 | ✗ | j += 4; | |
1108 | } | ||
1109 | ✗ | last_width = width % 4; | |
1110 | ✗ | if (last_width) | |
1111 | ✗ | jpeg2000_process_stripes_block(&sp_dec, i, j, last_width, b_height, stride, | |
1112 | pLSB, sample_buf, block_states, magref_segment, | ||
1113 | magref_length, is_causal); | ||
1114 | ✗ | i += 4; | |
1115 | } | ||
1116 | |||
1117 | /* Decode remaining height stripes */ | ||
1118 | ✗ | b_height = height % 4; | |
1119 | ✗ | j = 0; | |
1120 | ✗ | for (int n2 = 0; n2 < num_h_stripe; n2++) { | |
1121 | ✗ | jpeg2000_process_stripes_block(&sp_dec, i, j, b_width, b_height, stride, | |
1122 | pLSB, sample_buf, block_states, magref_segment, | ||
1123 | magref_length, is_causal); | ||
1124 | ✗ | j += 4; | |
1125 | } | ||
1126 | ✗ | last_width = width % 4; | |
1127 | ✗ | if (last_width) | |
1128 | ✗ | jpeg2000_process_stripes_block(&sp_dec, i, j, last_width, b_height, stride, | |
1129 | pLSB, sample_buf, block_states, magref_segment, | ||
1130 | magref_length, is_causal); | ||
1131 | ✗ | } | |
1132 | |||
1133 | /** | ||
1134 | * See procedure decodeSigPropMag at Rec. ITU-T T.814, 7.5. | ||
1135 | */ | ||
1136 | static void | ||
1137 | ✗ | jpeg2000_decode_magref_segment( uint16_t width, uint16_t block_height, const int stride, | |
1138 | uint8_t *magref_segment,uint32_t magref_length, | ||
1139 | uint8_t pLSB, int32_t *sample_buf, uint8_t *block_states) | ||
1140 | { | ||
1141 | |||
1142 | ✗ | StateVars mag_ref = { 0 }; | |
1143 | ✗ | const uint16_t num_v_stripe = block_height / 4; | |
1144 | ✗ | uint16_t height = 4; | |
1145 | ✗ | uint16_t i_start = 0; | |
1146 | int32_t *sp; | ||
1147 | int32_t bit; | ||
1148 | int32_t tmp; | ||
1149 | ✗ | jpeg2000_init_mag_ref(&mag_ref, magref_length); | |
1150 | |||
1151 | ✗ | for (int n1 = 0; n1 < num_v_stripe; n1++) { | |
1152 | ✗ | for (int j = 0; j < width; j++) { | |
1153 | ✗ | for (int i = i_start; i < i_start + height; i++) { | |
1154 | /** | ||
1155 | * We move column wise, going from one quad to another. See | ||
1156 | * Rec. ITU-T T.814, Figure 7. | ||
1157 | */ | ||
1158 | ✗ | sp = &sample_buf[j + i * stride]; | |
1159 | ✗ | if (jpeg2000_get_state(i, j, stride, HT_SHIFT_SIGMA, block_states) != 0) { | |
1160 | ✗ | jpeg2000_modify_state(i, j, stride, 1 << HT_SHIFT_REF_IND, block_states); | |
1161 | ✗ | bit = jpeg2000_import_magref_bit(&mag_ref, magref_segment, magref_length); | |
1162 | ✗ | tmp = 0xFFFFFFFE | (uint32_t)bit; | |
1163 | ✗ | tmp <<= pLSB; | |
1164 | ✗ | sp[0] &= tmp; | |
1165 | ✗ | sp[0] |= 1 << (pLSB - 1); // Add 0.5 (reconstruction parameter = 1/2) | |
1166 | } | ||
1167 | } | ||
1168 | } | ||
1169 | ✗ | i_start += 4; | |
1170 | } | ||
1171 | ✗ | height = block_height % 4; | |
1172 | ✗ | for (int j = 0; j < width; j++) { | |
1173 | ✗ | for (int i = i_start; i < i_start + height; i++) { | |
1174 | ✗ | sp = &sample_buf[j + i * stride]; | |
1175 | ✗ | if (jpeg2000_get_state(i, j, stride, HT_SHIFT_SIGMA, block_states) != 0) { | |
1176 | ✗ | jpeg2000_modify_state(i, j, stride, 1 << HT_SHIFT_REF_IND, block_states); | |
1177 | ✗ | bit = jpeg2000_import_magref_bit(&mag_ref, magref_segment, magref_length); | |
1178 | ✗ | tmp = 0xFFFFFFFE | (uint32_t)bit; | |
1179 | ✗ | tmp <<= pLSB; | |
1180 | ✗ | sp[0] &= tmp; | |
1181 | ✗ | sp[0] |= 1 << (pLSB - 1); // Add 0.5 (reconstruction parameter = 1/2) | |
1182 | } | ||
1183 | } | ||
1184 | } | ||
1185 | ✗ | } | |
1186 | |||
1187 | |||
1188 | int | ||
1189 | 10 | ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, | |
1190 | int width, int height, int M_b, uint8_t roi_shift) | ||
1191 | { | ||
1192 | 10 | uint8_t p0 = 0; // 3 * p0 = Number of placeholder passes | |
1193 | uint32_t Lcup; // Length of HT cleanup segment | ||
1194 | uint32_t Lref; // Length of Refinement segment | ||
1195 | uint32_t Scup; // HT cleanup segment suffix length | ||
1196 | uint32_t Pcup; // HT cleanup segment prefix length | ||
1197 | |||
1198 | uint8_t S_blk; // Number of skipped magnitude bitplanes | ||
1199 | uint8_t pLSB; | ||
1200 | |||
1201 | uint8_t *Dcup; // Byte of an HT cleanup segment | ||
1202 | uint8_t *Dref; // Byte of an HT refinement segment | ||
1203 | |||
1204 | int z_blk; // Number of ht coding pass | ||
1205 | |||
1206 | uint8_t num_plhd_passes; // Number of placeholder passes | ||
1207 | |||
1208 | StateVars mag_sgn; // Magnitude and Sign | ||
1209 | StateVars mel; // Adaptive run-length coding | ||
1210 | StateVars vlc; // Variable Length coding | ||
1211 | StateVars sig_prop; // Significance propagation | ||
1212 | |||
1213 | MelDecoderState mel_state; | ||
1214 | |||
1215 | int ret; | ||
1216 | |||
1217 | /* Temporary buffers */ | ||
1218 | 10 | int32_t *sample_buf = NULL; | |
1219 | 10 | uint8_t *block_states = NULL; | |
1220 | |||
1221 | int32_t n, val; // Post-processing | ||
1222 | 10 | const uint32_t mask = UINT32_MAX >> (M_b + 1); // bit mask for ROI detection | |
1223 | |||
1224 | uint8_t num_rempass; | ||
1225 | |||
1226 | 10 | const int quad_buf_width = width + 4; | |
1227 | 10 | const int quad_buf_height = height + 4; | |
1228 | |||
1229 | /* codeblock size as constrained by Rec. ITU-T T.800, Table A.18 */ | ||
1230 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
|
10 | av_assert0(width <= 1024U && height <= 1024U); |
1231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | av_assert0(width * height <= 4096); |
1232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | av_assert0(width * height > 0); |
1233 | |||
1234 | 10 | memset(t1->data, 0, t1->stride * height * sizeof(*t1->data)); | |
1235 | 10 | memset(t1->flags, 0, t1->stride * (height + 2) * sizeof(*t1->flags)); | |
1236 | |||
1237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (cblk->npasses == 0) |
1238 | ✗ | return 0; | |
1239 | |||
1240 | 10 | num_rempass = cblk->npasses % 3; // Number of remainder passes | |
1241 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | num_plhd_passes = num_rempass ? cblk->npasses - num_rempass : cblk->npasses - 3; |
1242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | av_assert0(num_plhd_passes % 3 == 0); |
1243 | 10 | p0 = num_plhd_passes / 3; | |
1244 | 10 | z_blk = cblk->npasses - num_plhd_passes; | |
1245 | |||
1246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (z_blk <= 0) |
1247 | ✗ | return 0; // No passes within this set, continue | |
1248 | |||
1249 | 10 | Lcup = cblk->pass_lengths[0]; | |
1250 | 10 | Lref = cblk->pass_lengths[1]; | |
1251 | |||
1252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (Lcup < 2) { |
1253 | ✗ | av_log(s->avctx, AV_LOG_ERROR, | |
1254 | "Cleanup pass length must be at least 2 bytes in length\n"); | ||
1255 | ✗ | return AVERROR_INVALIDDATA; | |
1256 | } | ||
1257 | 10 | Dcup = cblk->data; | |
1258 | 10 | Dref = cblk->data + Lcup; // Dref comes after the refinement segment | |
1259 | |||
1260 | 10 | cblk->data[cblk->length] = 0xFF; // an extra byte for refinement segment (buffer->last) | |
1261 | |||
1262 | 10 | S_blk = p0 + cblk->zbp; | |
1263 | 10 | cblk->zbp = S_blk - 1; | |
1264 | 10 | pLSB = 30 - S_blk; | |
1265 | |||
1266 | 10 | Scup = (Dcup[Lcup - 1] << 4) + (Dcup[Lcup - 2] & 0x0F); | |
1267 | |||
1268 |
3/6✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
|
10 | if (Scup < 2 || Scup > Lcup || Scup > 4079) { |
1269 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "Cleanup pass suffix length is invalid %d\n", | |
1270 | Scup); | ||
1271 | ✗ | ret = AVERROR_INVALIDDATA; | |
1272 | ✗ | goto free; | |
1273 | } | ||
1274 | 10 | Pcup = Lcup - Scup; | |
1275 | |||
1276 | /* modDcup shall be done before the creation of vlc instance. */ | ||
1277 | 10 | Dcup[Lcup - 1] = 0xFF; | |
1278 | 10 | Dcup[Lcup - 2] |= 0x0F; | |
1279 | |||
1280 | /* Magnitude and refinement */ | ||
1281 | 10 | jpeg2000_init_zero(&mag_sgn); | |
1282 | 10 | jpeg2000_bitbuf_refill_forward(&mag_sgn, Dcup, Pcup); | |
1283 | |||
1284 | /* Significance propagation */ | ||
1285 | 10 | jpeg2000_init_zero(&sig_prop); | |
1286 | |||
1287 | /* Adaptive run length */ | ||
1288 | 10 | jpeg2000_init_mel(&mel, Pcup); | |
1289 | |||
1290 | /* Variable Length coding */ | ||
1291 | 10 | jpeg2000_init_vlc(&vlc, Lcup, Pcup, Dcup); | |
1292 | |||
1293 | 10 | jpeg2000_init_mel_decoder(&mel_state); | |
1294 | |||
1295 | 10 | sample_buf = av_calloc(quad_buf_width * quad_buf_height, sizeof(int32_t)); | |
1296 | 10 | block_states = av_calloc(quad_buf_width * quad_buf_height, sizeof(uint8_t)); | |
1297 | |||
1298 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
|
10 | if (!sample_buf || !block_states) { |
1299 | ✗ | ret = AVERROR(ENOMEM); | |
1300 | ✗ | goto free; | |
1301 | } | ||
1302 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
|
10 | if ((ret = jpeg2000_decode_ht_cleanup_segment(s, cblk, t1, &mel_state, &mel, &vlc, |
1303 | &mag_sgn, Dcup, Lcup, Pcup, pLSB, width, | ||
1304 | height, quad_buf_width, sample_buf, block_states)) < 0) { | ||
1305 | ✗ | av_log(s->avctx, AV_LOG_ERROR, "Bad HT cleanup segment\n"); | |
1306 | ✗ | goto free; | |
1307 | } | ||
1308 | |||
1309 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (z_blk > 1) |
1310 | ✗ | jpeg2000_decode_sigprop_segment(cblk, width, height, quad_buf_width, Dref, Lref, | |
1311 | ✗ | pLSB - 1, sample_buf, block_states); | |
1312 | |||
1313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (z_blk > 2) |
1314 | ✗ | jpeg2000_decode_magref_segment(width, height, quad_buf_width, Dref, Lref, | |
1315 | ✗ | pLSB - 1, sample_buf, block_states); | |
1316 | |||
1317 | /* Reconstruct the sample values */ | ||
1318 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 10 times.
|
362 | for (int y = 0; y < height; y++) { |
1319 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 352 times.
|
16736 | for (int x = 0; x < width; x++) { |
1320 | int32_t sign; | ||
1321 | |||
1322 | 16384 | n = x + (y * t1->stride); | |
1323 | 16384 | val = sample_buf[x + (y * quad_buf_width)]; | |
1324 | 16384 | sign = val & INT32_MIN; | |
1325 | 16384 | val &= INT32_MAX; | |
1326 | /* ROI shift, if necessary */ | ||
1327 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 16384 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
16384 | if (roi_shift && (((uint32_t)val & ~mask) == 0)) |
1328 | ✗ | val <<= roi_shift; | |
1329 | 16384 | t1->data[n] = val | sign; /* NOTE: Binary point for reconstruction value is located in 31 - M_b */ | |
1330 | } | ||
1331 | } | ||
1332 | 10 | free: | |
1333 | 10 | av_freep(&sample_buf); | |
1334 | 10 | av_freep(&block_states); | |
1335 | 10 | return ret; | |
1336 | } | ||
1337 | |||
1338 | /** | ||
1339 | * CtxVLC tables (see Rec. ITU-T T.800, Annex C) as found at | ||
1340 | * https://github.com/osamu620/OpenHTJ2K (author: Osamu Watanabe) | ||
1341 | */ | ||
1342 | static const uint16_t dec_cxt_vlc_table1[1024] = { | ||
1343 | 0x0016, 0x006A, 0x0046, 0x00DD, 0x0086, 0x888B, 0x0026, 0x444D, 0x0016, 0x00AA, 0x0046, 0x88AD, 0x0086, | ||
1344 | 0x003A, 0x0026, 0x00DE, 0x0016, 0x00CA, 0x0046, 0x009D, 0x0086, 0x005A, 0x0026, 0x222D, 0x0016, 0x009A, | ||
1345 | 0x0046, 0x007D, 0x0086, 0x01FD, 0x0026, 0x007E, 0x0016, 0x006A, 0x0046, 0x88CD, 0x0086, 0x888B, 0x0026, | ||
1346 | 0x111D, 0x0016, 0x00AA, 0x0046, 0x005D, 0x0086, 0x003A, 0x0026, 0x00EE, 0x0016, 0x00CA, 0x0046, 0x00BD, | ||
1347 | 0x0086, 0x005A, 0x0026, 0x11FF, 0x0016, 0x009A, 0x0046, 0x003D, 0x0086, 0x04ED, 0x0026, 0x2AAF, 0x0016, | ||
1348 | 0x006A, 0x0046, 0x00DD, 0x0086, 0x888B, 0x0026, 0x444D, 0x0016, 0x00AA, 0x0046, 0x88AD, 0x0086, 0x003A, | ||
1349 | 0x0026, 0x44EF, 0x0016, 0x00CA, 0x0046, 0x009D, 0x0086, 0x005A, 0x0026, 0x222D, 0x0016, 0x009A, 0x0046, | ||
1350 | 0x007D, 0x0086, 0x01FD, 0x0026, 0x00BE, 0x0016, 0x006A, 0x0046, 0x88CD, 0x0086, 0x888B, 0x0026, 0x111D, | ||
1351 | 0x0016, 0x00AA, 0x0046, 0x005D, 0x0086, 0x003A, 0x0026, 0x4CCF, 0x0016, 0x00CA, 0x0046, 0x00BD, 0x0086, | ||
1352 | 0x005A, 0x0026, 0x00FE, 0x0016, 0x009A, 0x0046, 0x003D, 0x0086, 0x04ED, 0x0026, 0x006F, 0x0002, 0x0088, | ||
1353 | 0x0002, 0x005C, 0x0002, 0x0018, 0x0002, 0x00DE, 0x0002, 0x0028, 0x0002, 0x009C, 0x0002, 0x004A, 0x0002, | ||
1354 | 0x007E, 0x0002, 0x0088, 0x0002, 0x00CC, 0x0002, 0x0018, 0x0002, 0x888F, 0x0002, 0x0028, 0x0002, 0x00FE, | ||
1355 | 0x0002, 0x003A, 0x0002, 0x222F, 0x0002, 0x0088, 0x0002, 0x04FD, 0x0002, 0x0018, 0x0002, 0x00BE, 0x0002, | ||
1356 | 0x0028, 0x0002, 0x00BF, 0x0002, 0x004A, 0x0002, 0x006E, 0x0002, 0x0088, 0x0002, 0x00AC, 0x0002, 0x0018, | ||
1357 | 0x0002, 0x444F, 0x0002, 0x0028, 0x0002, 0x00EE, 0x0002, 0x003A, 0x0002, 0x113F, 0x0002, 0x0088, 0x0002, | ||
1358 | 0x005C, 0x0002, 0x0018, 0x0002, 0x00CF, 0x0002, 0x0028, 0x0002, 0x009C, 0x0002, 0x004A, 0x0002, 0x006F, | ||
1359 | 0x0002, 0x0088, 0x0002, 0x00CC, 0x0002, 0x0018, 0x0002, 0x009F, 0x0002, 0x0028, 0x0002, 0x00EF, 0x0002, | ||
1360 | 0x003A, 0x0002, 0x233F, 0x0002, 0x0088, 0x0002, 0x04FD, 0x0002, 0x0018, 0x0002, 0x00AF, 0x0002, 0x0028, | ||
1361 | 0x0002, 0x44FF, 0x0002, 0x004A, 0x0002, 0x005F, 0x0002, 0x0088, 0x0002, 0x00AC, 0x0002, 0x0018, 0x0002, | ||
1362 | 0x007F, 0x0002, 0x0028, 0x0002, 0x00DF, 0x0002, 0x003A, 0x0002, 0x111F, 0x0002, 0x0028, 0x0002, 0x005C, | ||
1363 | 0x0002, 0x008A, 0x0002, 0x00BF, 0x0002, 0x0018, 0x0002, 0x00FE, 0x0002, 0x00CC, 0x0002, 0x007E, 0x0002, | ||
1364 | 0x0028, 0x0002, 0x8FFF, 0x0002, 0x004A, 0x0002, 0x007F, 0x0002, 0x0018, 0x0002, 0x00DF, 0x0002, 0x00AC, | ||
1365 | 0x0002, 0x133F, 0x0002, 0x0028, 0x0002, 0x222D, 0x0002, 0x008A, 0x0002, 0x00BE, 0x0002, 0x0018, 0x0002, | ||
1366 | 0x44EF, 0x0002, 0x2AAD, 0x0002, 0x006E, 0x0002, 0x0028, 0x0002, 0x15FF, 0x0002, 0x004A, 0x0002, 0x009E, | ||
1367 | 0x0002, 0x0018, 0x0002, 0x00CF, 0x0002, 0x003C, 0x0002, 0x223F, 0x0002, 0x0028, 0x0002, 0x005C, 0x0002, | ||
1368 | 0x008A, 0x0002, 0x2BBF, 0x0002, 0x0018, 0x0002, 0x04EF, 0x0002, 0x00CC, 0x0002, 0x006F, 0x0002, 0x0028, | ||
1369 | 0x0002, 0x27FF, 0x0002, 0x004A, 0x0002, 0x009F, 0x0002, 0x0018, 0x0002, 0x00DE, 0x0002, 0x00AC, 0x0002, | ||
1370 | 0x444F, 0x0002, 0x0028, 0x0002, 0x222D, 0x0002, 0x008A, 0x0002, 0x8AAF, 0x0002, 0x0018, 0x0002, 0x00EE, | ||
1371 | 0x0002, 0x2AAD, 0x0002, 0x005F, 0x0002, 0x0028, 0x0002, 0x44FF, 0x0002, 0x004A, 0x0002, 0x888F, 0x0002, | ||
1372 | 0x0018, 0x0002, 0xAAAF, 0x0002, 0x003C, 0x0002, 0x111F, 0x0004, 0x8FFD, 0x0028, 0x005C, 0x0004, 0x00BC, | ||
1373 | 0x008A, 0x66FF, 0x0004, 0x00CD, 0x0018, 0x111D, 0x0004, 0x009C, 0x003A, 0x8AAF, 0x0004, 0x00FC, 0x0028, | ||
1374 | 0x133D, 0x0004, 0x00AC, 0x004A, 0x3BBF, 0x0004, 0x2BBD, 0x0018, 0x5FFF, 0x0004, 0x006C, 0x157D, 0x455F, | ||
1375 | 0x0004, 0x2FFD, 0x0028, 0x222D, 0x0004, 0x22AD, 0x008A, 0x44EF, 0x0004, 0x00CC, 0x0018, 0x4FFF, 0x0004, | ||
1376 | 0x007C, 0x003A, 0x447F, 0x0004, 0x04DD, 0x0028, 0x233D, 0x0004, 0x009D, 0x004A, 0x00DE, 0x0004, 0x88BD, | ||
1377 | 0x0018, 0xAFFF, 0x0004, 0x115D, 0x1FFD, 0x444F, 0x0004, 0x8FFD, 0x0028, 0x005C, 0x0004, 0x00BC, 0x008A, | ||
1378 | 0x8CEF, 0x0004, 0x00CD, 0x0018, 0x111D, 0x0004, 0x009C, 0x003A, 0x888F, 0x0004, 0x00FC, 0x0028, 0x133D, | ||
1379 | 0x0004, 0x00AC, 0x004A, 0x44DF, 0x0004, 0x2BBD, 0x0018, 0x8AFF, 0x0004, 0x006C, 0x157D, 0x006F, 0x0004, | ||
1380 | 0x2FFD, 0x0028, 0x222D, 0x0004, 0x22AD, 0x008A, 0x00EE, 0x0004, 0x00CC, 0x0018, 0x2EEF, 0x0004, 0x007C, | ||
1381 | 0x003A, 0x277F, 0x0004, 0x04DD, 0x0028, 0x233D, 0x0004, 0x009D, 0x004A, 0x1BBF, 0x0004, 0x88BD, 0x0018, | ||
1382 | 0x37FF, 0x0004, 0x115D, 0x1FFD, 0x333F, 0x0002, 0x0088, 0x0002, 0x02ED, 0x0002, 0x00CA, 0x0002, 0x4CCF, | ||
1383 | 0x0002, 0x0048, 0x0002, 0x23FF, 0x0002, 0x001A, 0x0002, 0x888F, 0x0002, 0x0088, 0x0002, 0x006C, 0x0002, | ||
1384 | 0x002A, 0x0002, 0x00AF, 0x0002, 0x0048, 0x0002, 0x22EF, 0x0002, 0x00AC, 0x0002, 0x005F, 0x0002, 0x0088, | ||
1385 | 0x0002, 0x444D, 0x0002, 0x00CA, 0x0002, 0xCCCF, 0x0002, 0x0048, 0x0002, 0x00FE, 0x0002, 0x001A, 0x0002, | ||
1386 | 0x006F, 0x0002, 0x0088, 0x0002, 0x005C, 0x0002, 0x002A, 0x0002, 0x009F, 0x0002, 0x0048, 0x0002, 0x00DF, | ||
1387 | 0x0002, 0x03FD, 0x0002, 0x222F, 0x0002, 0x0088, 0x0002, 0x02ED, 0x0002, 0x00CA, 0x0002, 0x8CCF, 0x0002, | ||
1388 | 0x0048, 0x0002, 0x11FF, 0x0002, 0x001A, 0x0002, 0x007E, 0x0002, 0x0088, 0x0002, 0x006C, 0x0002, 0x002A, | ||
1389 | 0x0002, 0x007F, 0x0002, 0x0048, 0x0002, 0x00EE, 0x0002, 0x00AC, 0x0002, 0x003E, 0x0002, 0x0088, 0x0002, | ||
1390 | 0x444D, 0x0002, 0x00CA, 0x0002, 0x00BE, 0x0002, 0x0048, 0x0002, 0x00BF, 0x0002, 0x001A, 0x0002, 0x003F, | ||
1391 | 0x0002, 0x0088, 0x0002, 0x005C, 0x0002, 0x002A, 0x0002, 0x009E, 0x0002, 0x0048, 0x0002, 0x00DE, 0x0002, | ||
1392 | 0x03FD, 0x0002, 0x111F, 0x0004, 0x8AED, 0x0048, 0x888D, 0x0004, 0x00DC, 0x00CA, 0x3FFF, 0x0004, 0xCFFD, | ||
1393 | 0x002A, 0x003D, 0x0004, 0x00BC, 0x005A, 0x8DDF, 0x0004, 0x8FFD, 0x0048, 0x006C, 0x0004, 0x027D, 0x008A, | ||
1394 | 0x99FF, 0x0004, 0x00EC, 0x00FA, 0x003C, 0x0004, 0x00AC, 0x001A, 0x009F, 0x0004, 0x2FFD, 0x0048, 0x007C, | ||
1395 | 0x0004, 0x44CD, 0x00CA, 0x67FF, 0x0004, 0x1FFD, 0x002A, 0x444D, 0x0004, 0x00AD, 0x005A, 0x8CCF, 0x0004, | ||
1396 | 0x4FFD, 0x0048, 0x445D, 0x0004, 0x01BD, 0x008A, 0x4EEF, 0x0004, 0x45DD, 0x00FA, 0x111D, 0x0004, 0x009C, | ||
1397 | 0x001A, 0x222F, 0x0004, 0x8AED, 0x0048, 0x888D, 0x0004, 0x00DC, 0x00CA, 0xAFFF, 0x0004, 0xCFFD, 0x002A, | ||
1398 | 0x003D, 0x0004, 0x00BC, 0x005A, 0x11BF, 0x0004, 0x8FFD, 0x0048, 0x006C, 0x0004, 0x027D, 0x008A, 0x22EF, | ||
1399 | 0x0004, 0x00EC, 0x00FA, 0x003C, 0x0004, 0x00AC, 0x001A, 0x227F, 0x0004, 0x2FFD, 0x0048, 0x007C, 0x0004, | ||
1400 | 0x44CD, 0x00CA, 0x5DFF, 0x0004, 0x1FFD, 0x002A, 0x444D, 0x0004, 0x00AD, 0x005A, 0x006F, 0x0004, 0x4FFD, | ||
1401 | 0x0048, 0x445D, 0x0004, 0x01BD, 0x008A, 0x11DF, 0x0004, 0x45DD, 0x00FA, 0x111D, 0x0004, 0x009C, 0x001A, | ||
1402 | 0x155F, 0x0006, 0x00FC, 0x0018, 0x111D, 0x0048, 0x888D, 0x00AA, 0x4DDF, 0x0006, 0x2AAD, 0x005A, 0x67FF, | ||
1403 | 0x0028, 0x223D, 0x00BC, 0xAAAF, 0x0006, 0x00EC, 0x0018, 0x5FFF, 0x0048, 0x006C, 0x008A, 0xCCCF, 0x0006, | ||
1404 | 0x009D, 0x00CA, 0x44EF, 0x0028, 0x003C, 0x8FFD, 0x137F, 0x0006, 0x8EED, 0x0018, 0x1FFF, 0x0048, 0x007C, | ||
1405 | 0x00AA, 0x4CCF, 0x0006, 0x227D, 0x005A, 0x1DDF, 0x0028, 0x444D, 0x4FFD, 0x155F, 0x0006, 0x00DC, 0x0018, | ||
1406 | 0x2EEF, 0x0048, 0x445D, 0x008A, 0x22BF, 0x0006, 0x009C, 0x00CA, 0x8CDF, 0x0028, 0x222D, 0x2FFD, 0x226F, | ||
1407 | 0x0006, 0x00FC, 0x0018, 0x111D, 0x0048, 0x888D, 0x00AA, 0x1BBF, 0x0006, 0x2AAD, 0x005A, 0x33FF, 0x0028, | ||
1408 | 0x223D, 0x00BC, 0x8AAF, 0x0006, 0x00EC, 0x0018, 0x9BFF, 0x0048, 0x006C, 0x008A, 0x8ABF, 0x0006, 0x009D, | ||
1409 | 0x00CA, 0x4EEF, 0x0028, 0x003C, 0x8FFD, 0x466F, 0x0006, 0x8EED, 0x0018, 0xCFFF, 0x0048, 0x007C, 0x00AA, | ||
1410 | 0x8CCF, 0x0006, 0x227D, 0x005A, 0xAEEF, 0x0028, 0x444D, 0x4FFD, 0x477F, 0x0006, 0x00DC, 0x0018, 0xAFFF, | ||
1411 | 0x0048, 0x445D, 0x008A, 0x2BBF, 0x0006, 0x009C, 0x00CA, 0x44DF, 0x0028, 0x222D, 0x2FFD, 0x133F, 0x00F6, | ||
1412 | 0xAFFD, 0x1FFB, 0x003C, 0x0008, 0x23BD, 0x007A, 0x11DF, 0x00F6, 0x45DD, 0x2FFB, 0x4EEF, 0x00DA, 0x177D, | ||
1413 | 0xCFFD, 0x377F, 0x00F6, 0x3FFD, 0x8FFB, 0x111D, 0x0008, 0x009C, 0x005A, 0x1BBF, 0x00F6, 0x00CD, 0x00BA, | ||
1414 | 0x8DDF, 0x4FFB, 0x006C, 0x9BFD, 0x455F, 0x00F6, 0x67FD, 0x1FFB, 0x002C, 0x0008, 0x00AC, 0x007A, 0x009F, | ||
1415 | 0x00F6, 0x00AD, 0x2FFB, 0x7FFF, 0x00DA, 0x004C, 0x5FFD, 0x477F, 0x00F6, 0x00EC, 0x8FFB, 0x001C, 0x0008, | ||
1416 | 0x008C, 0x005A, 0x888F, 0x00F6, 0x00CC, 0x00BA, 0x2EEF, 0x4FFB, 0x115D, 0x8AED, 0x113F, 0x00F6, 0xAFFD, | ||
1417 | 0x1FFB, 0x003C, 0x0008, 0x23BD, 0x007A, 0x1DDF, 0x00F6, 0x45DD, 0x2FFB, 0xBFFF, 0x00DA, 0x177D, 0xCFFD, | ||
1418 | 0x447F, 0x00F6, 0x3FFD, 0x8FFB, 0x111D, 0x0008, 0x009C, 0x005A, 0x277F, 0x00F6, 0x00CD, 0x00BA, 0x22EF, | ||
1419 | 0x4FFB, 0x006C, 0x9BFD, 0x444F, 0x00F6, 0x67FD, 0x1FFB, 0x002C, 0x0008, 0x00AC, 0x007A, 0x11BF, 0x00F6, | ||
1420 | 0x00AD, 0x2FFB, 0xFFFF, 0x00DA, 0x004C, 0x5FFD, 0x233F, 0x00F6, 0x00EC, 0x8FFB, 0x001C, 0x0008, 0x008C, | ||
1421 | 0x005A, 0x006F, 0x00F6, 0x00CC, 0x00BA, 0x8BBF, 0x4FFB, 0x115D, 0x8AED, 0x222F}; | ||
1422 | |||
1423 | static const uint16_t dec_cxt_vlc_table0[1024] = { | ||
1424 | 0x0026, 0x00AA, 0x0046, 0x006C, 0x0086, 0x8AED, 0x0018, 0x8DDF, 0x0026, 0x01BD, 0x0046, 0x5FFF, 0x0086, | ||
1425 | 0x027D, 0x005A, 0x155F, 0x0026, 0x003A, 0x0046, 0x444D, 0x0086, 0x4CCD, 0x0018, 0xCCCF, 0x0026, 0x2EFD, | ||
1426 | 0x0046, 0x99FF, 0x0086, 0x009C, 0x00CA, 0x133F, 0x0026, 0x00AA, 0x0046, 0x445D, 0x0086, 0x8CCD, 0x0018, | ||
1427 | 0x11DF, 0x0026, 0x4FFD, 0x0046, 0xCFFF, 0x0086, 0x009D, 0x005A, 0x007E, 0x0026, 0x003A, 0x0046, 0x1FFF, | ||
1428 | 0x0086, 0x88AD, 0x0018, 0x00BE, 0x0026, 0x8FFD, 0x0046, 0x4EEF, 0x0086, 0x888D, 0x00CA, 0x111F, 0x0026, | ||
1429 | 0x00AA, 0x0046, 0x006C, 0x0086, 0x8AED, 0x0018, 0x45DF, 0x0026, 0x01BD, 0x0046, 0x22EF, 0x0086, 0x027D, | ||
1430 | 0x005A, 0x227F, 0x0026, 0x003A, 0x0046, 0x444D, 0x0086, 0x4CCD, 0x0018, 0x11BF, 0x0026, 0x2EFD, 0x0046, | ||
1431 | 0x00FE, 0x0086, 0x009C, 0x00CA, 0x223F, 0x0026, 0x00AA, 0x0046, 0x445D, 0x0086, 0x8CCD, 0x0018, 0x00DE, | ||
1432 | 0x0026, 0x4FFD, 0x0046, 0xABFF, 0x0086, 0x009D, 0x005A, 0x006F, 0x0026, 0x003A, 0x0046, 0x6EFF, 0x0086, | ||
1433 | 0x88AD, 0x0018, 0x2AAF, 0x0026, 0x8FFD, 0x0046, 0x00EE, 0x0086, 0x888D, 0x00CA, 0x222F, 0x0004, 0x00CA, | ||
1434 | 0x0088, 0x027D, 0x0004, 0x4CCD, 0x0028, 0x00FE, 0x0004, 0x2AFD, 0x0048, 0x005C, 0x0004, 0x009D, 0x0018, | ||
1435 | 0x00DE, 0x0004, 0x01BD, 0x0088, 0x006C, 0x0004, 0x88AD, 0x0028, 0x11DF, 0x0004, 0x8AED, 0x0048, 0x003C, | ||
1436 | 0x0004, 0x888D, 0x0018, 0x111F, 0x0004, 0x00CA, 0x0088, 0x006D, 0x0004, 0x88CD, 0x0028, 0x88FF, 0x0004, | ||
1437 | 0x8BFD, 0x0048, 0x444D, 0x0004, 0x009C, 0x0018, 0x00BE, 0x0004, 0x4EFD, 0x0088, 0x445D, 0x0004, 0x00AC, | ||
1438 | 0x0028, 0x00EE, 0x0004, 0x45DD, 0x0048, 0x222D, 0x0004, 0x003D, 0x0018, 0x007E, 0x0004, 0x00CA, 0x0088, | ||
1439 | 0x027D, 0x0004, 0x4CCD, 0x0028, 0x1FFF, 0x0004, 0x2AFD, 0x0048, 0x005C, 0x0004, 0x009D, 0x0018, 0x11BF, | ||
1440 | 0x0004, 0x01BD, 0x0088, 0x006C, 0x0004, 0x88AD, 0x0028, 0x22EF, 0x0004, 0x8AED, 0x0048, 0x003C, 0x0004, | ||
1441 | 0x888D, 0x0018, 0x227F, 0x0004, 0x00CA, 0x0088, 0x006D, 0x0004, 0x88CD, 0x0028, 0x4EEF, 0x0004, 0x8BFD, | ||
1442 | 0x0048, 0x444D, 0x0004, 0x009C, 0x0018, 0x2AAF, 0x0004, 0x4EFD, 0x0088, 0x445D, 0x0004, 0x00AC, 0x0028, | ||
1443 | 0x8DDF, 0x0004, 0x45DD, 0x0048, 0x222D, 0x0004, 0x003D, 0x0018, 0x155F, 0x0004, 0x005A, 0x0088, 0x006C, | ||
1444 | 0x0004, 0x88DD, 0x0028, 0x23FF, 0x0004, 0x11FD, 0x0048, 0x444D, 0x0004, 0x00AD, 0x0018, 0x00BE, 0x0004, | ||
1445 | 0x137D, 0x0088, 0x155D, 0x0004, 0x00CC, 0x0028, 0x00DE, 0x0004, 0x02ED, 0x0048, 0x111D, 0x0004, 0x009D, | ||
1446 | 0x0018, 0x007E, 0x0004, 0x005A, 0x0088, 0x455D, 0x0004, 0x44CD, 0x0028, 0x00EE, 0x0004, 0x1FFD, 0x0048, | ||
1447 | 0x003C, 0x0004, 0x00AC, 0x0018, 0x555F, 0x0004, 0x47FD, 0x0088, 0x113D, 0x0004, 0x02BD, 0x0028, 0x477F, | ||
1448 | 0x0004, 0x4CDD, 0x0048, 0x8FFF, 0x0004, 0x009C, 0x0018, 0x222F, 0x0004, 0x005A, 0x0088, 0x006C, 0x0004, | ||
1449 | 0x88DD, 0x0028, 0x00FE, 0x0004, 0x11FD, 0x0048, 0x444D, 0x0004, 0x00AD, 0x0018, 0x888F, 0x0004, 0x137D, | ||
1450 | 0x0088, 0x155D, 0x0004, 0x00CC, 0x0028, 0x8CCF, 0x0004, 0x02ED, 0x0048, 0x111D, 0x0004, 0x009D, 0x0018, | ||
1451 | 0x006F, 0x0004, 0x005A, 0x0088, 0x455D, 0x0004, 0x44CD, 0x0028, 0x1DDF, 0x0004, 0x1FFD, 0x0048, 0x003C, | ||
1452 | 0x0004, 0x00AC, 0x0018, 0x227F, 0x0004, 0x47FD, 0x0088, 0x113D, 0x0004, 0x02BD, 0x0028, 0x22BF, 0x0004, | ||
1453 | 0x4CDD, 0x0048, 0x22EF, 0x0004, 0x009C, 0x0018, 0x233F, 0x0006, 0x4DDD, 0x4FFB, 0xCFFF, 0x0018, 0x113D, | ||
1454 | 0x005A, 0x888F, 0x0006, 0x23BD, 0x008A, 0x00EE, 0x002A, 0x155D, 0xAAFD, 0x277F, 0x0006, 0x44CD, 0x8FFB, | ||
1455 | 0x44EF, 0x0018, 0x467D, 0x004A, 0x2AAF, 0x0006, 0x00AC, 0x555B, 0x99DF, 0x1FFB, 0x003C, 0x5FFD, 0x266F, | ||
1456 | 0x0006, 0x1DDD, 0x4FFB, 0x6EFF, 0x0018, 0x177D, 0x005A, 0x1BBF, 0x0006, 0x88AD, 0x008A, 0x5DDF, 0x002A, | ||
1457 | 0x444D, 0x2FFD, 0x667F, 0x0006, 0x00CC, 0x8FFB, 0x2EEF, 0x0018, 0x455D, 0x004A, 0x119F, 0x0006, 0x009C, | ||
1458 | 0x555B, 0x8CCF, 0x1FFB, 0x111D, 0x8CED, 0x006E, 0x0006, 0x4DDD, 0x4FFB, 0x3FFF, 0x0018, 0x113D, 0x005A, | ||
1459 | 0x11BF, 0x0006, 0x23BD, 0x008A, 0x8DDF, 0x002A, 0x155D, 0xAAFD, 0x222F, 0x0006, 0x44CD, 0x8FFB, 0x00FE, | ||
1460 | 0x0018, 0x467D, 0x004A, 0x899F, 0x0006, 0x00AC, 0x555B, 0x00DE, 0x1FFB, 0x003C, 0x5FFD, 0x446F, 0x0006, | ||
1461 | 0x1DDD, 0x4FFB, 0x9BFF, 0x0018, 0x177D, 0x005A, 0x00BE, 0x0006, 0x88AD, 0x008A, 0xCDDF, 0x002A, 0x444D, | ||
1462 | 0x2FFD, 0x007E, 0x0006, 0x00CC, 0x8FFB, 0x4EEF, 0x0018, 0x455D, 0x004A, 0x377F, 0x0006, 0x009C, 0x555B, | ||
1463 | 0x8BBF, 0x1FFB, 0x111D, 0x8CED, 0x233F, 0x0004, 0x00AA, 0x0088, 0x047D, 0x0004, 0x01DD, 0x0028, 0x11DF, | ||
1464 | 0x0004, 0x27FD, 0x0048, 0x005C, 0x0004, 0x8AAD, 0x0018, 0x2BBF, 0x0004, 0x009C, 0x0088, 0x006C, 0x0004, | ||
1465 | 0x00CC, 0x0028, 0x00EE, 0x0004, 0x8CED, 0x0048, 0x222D, 0x0004, 0x888D, 0x0018, 0x007E, 0x0004, 0x00AA, | ||
1466 | 0x0088, 0x006D, 0x0004, 0x88CD, 0x0028, 0x00FE, 0x0004, 0x19FD, 0x0048, 0x003C, 0x0004, 0x2AAD, 0x0018, | ||
1467 | 0xAAAF, 0x0004, 0x8BFD, 0x0088, 0x005D, 0x0004, 0x00BD, 0x0028, 0x4CCF, 0x0004, 0x44ED, 0x0048, 0x4FFF, | ||
1468 | 0x0004, 0x223D, 0x0018, 0x111F, 0x0004, 0x00AA, 0x0088, 0x047D, 0x0004, 0x01DD, 0x0028, 0x99FF, 0x0004, | ||
1469 | 0x27FD, 0x0048, 0x005C, 0x0004, 0x8AAD, 0x0018, 0x00BE, 0x0004, 0x009C, 0x0088, 0x006C, 0x0004, 0x00CC, | ||
1470 | 0x0028, 0x00DE, 0x0004, 0x8CED, 0x0048, 0x222D, 0x0004, 0x888D, 0x0018, 0x444F, 0x0004, 0x00AA, 0x0088, | ||
1471 | 0x006D, 0x0004, 0x88CD, 0x0028, 0x2EEF, 0x0004, 0x19FD, 0x0048, 0x003C, 0x0004, 0x2AAD, 0x0018, 0x447F, | ||
1472 | 0x0004, 0x8BFD, 0x0088, 0x005D, 0x0004, 0x00BD, 0x0028, 0x009F, 0x0004, 0x44ED, 0x0048, 0x67FF, 0x0004, | ||
1473 | 0x223D, 0x0018, 0x133F, 0x0006, 0x00CC, 0x008A, 0x9DFF, 0x2FFB, 0x467D, 0x1FFD, 0x99BF, 0x0006, 0x2AAD, | ||
1474 | 0x002A, 0x66EF, 0x4FFB, 0x005C, 0x2EED, 0x377F, 0x0006, 0x89BD, 0x004A, 0x00FE, 0x8FFB, 0x006C, 0x67FD, | ||
1475 | 0x889F, 0x0006, 0x888D, 0x001A, 0x5DDF, 0x00AA, 0x222D, 0x89DD, 0x444F, 0x0006, 0x2BBD, 0x008A, 0xCFFF, | ||
1476 | 0x2FFB, 0x226D, 0x009C, 0x00BE, 0x0006, 0xAAAD, 0x002A, 0x1DDF, 0x4FFB, 0x003C, 0x4DDD, 0x466F, 0x0006, | ||
1477 | 0x8AAD, 0x004A, 0xAEEF, 0x8FFB, 0x445D, 0x8EED, 0x177F, 0x0006, 0x233D, 0x001A, 0x4CCF, 0x00AA, 0xAFFF, | ||
1478 | 0x88CD, 0x133F, 0x0006, 0x00CC, 0x008A, 0x77FF, 0x2FFB, 0x467D, 0x1FFD, 0x3BBF, 0x0006, 0x2AAD, 0x002A, | ||
1479 | 0x00EE, 0x4FFB, 0x005C, 0x2EED, 0x007E, 0x0006, 0x89BD, 0x004A, 0x4EEF, 0x8FFB, 0x006C, 0x67FD, 0x667F, | ||
1480 | 0x0006, 0x888D, 0x001A, 0x00DE, 0x00AA, 0x222D, 0x89DD, 0x333F, 0x0006, 0x2BBD, 0x008A, 0x57FF, 0x2FFB, | ||
1481 | 0x226D, 0x009C, 0x199F, 0x0006, 0xAAAD, 0x002A, 0x99DF, 0x4FFB, 0x003C, 0x4DDD, 0x155F, 0x0006, 0x8AAD, | ||
1482 | 0x004A, 0xCEEF, 0x8FFB, 0x445D, 0x8EED, 0x277F, 0x0006, 0x233D, 0x001A, 0x1BBF, 0x00AA, 0x3FFF, 0x88CD, | ||
1483 | 0x111F, 0x0006, 0x45DD, 0x2FFB, 0x111D, 0x0018, 0x467D, 0x8FFD, 0xCCCF, 0x0006, 0x19BD, 0x004A, 0x22EF, | ||
1484 | 0x002A, 0x222D, 0x3FFD, 0x888F, 0x0006, 0x00CC, 0x008A, 0x00FE, 0x0018, 0x115D, 0xCFFD, 0x8AAF, 0x0006, | ||
1485 | 0x00AC, 0x003A, 0x8CDF, 0x1FFB, 0x133D, 0x66FD, 0x466F, 0x0006, 0x8CCD, 0x2FFB, 0x5FFF, 0x0018, 0x006C, | ||
1486 | 0x4FFD, 0xABBF, 0x0006, 0x22AD, 0x004A, 0x00EE, 0x002A, 0x233D, 0xAEFD, 0x377F, 0x0006, 0x2BBD, 0x008A, | ||
1487 | 0x55DF, 0x0018, 0x005C, 0x177D, 0x119F, 0x0006, 0x009C, 0x003A, 0x4CCF, 0x1FFB, 0x333D, 0x8EED, 0x444F, | ||
1488 | 0x0006, 0x45DD, 0x2FFB, 0x111D, 0x0018, 0x467D, 0x8FFD, 0x99BF, 0x0006, 0x19BD, 0x004A, 0x2EEF, 0x002A, | ||
1489 | 0x222D, 0x3FFD, 0x667F, 0x0006, 0x00CC, 0x008A, 0x4EEF, 0x0018, 0x115D, 0xCFFD, 0x899F, 0x0006, 0x00AC, | ||
1490 | 0x003A, 0x00DE, 0x1FFB, 0x133D, 0x66FD, 0x226F, 0x0006, 0x8CCD, 0x2FFB, 0x9BFF, 0x0018, 0x006C, 0x4FFD, | ||
1491 | 0x00BE, 0x0006, 0x22AD, 0x004A, 0x1DDF, 0x002A, 0x233D, 0xAEFD, 0x007E, 0x0006, 0x2BBD, 0x008A, 0xCEEF, | ||
1492 | 0x0018, 0x005C, 0x177D, 0x277F, 0x0006, 0x009C, 0x003A, 0x8BBF, 0x1FFB, 0x333D, 0x8EED, 0x455F, 0x1FF9, | ||
1493 | 0x1DDD, 0xAFFB, 0x00DE, 0x8FF9, 0x001C, 0xFFFB, 0x477F, 0x4FF9, 0x177D, 0x3FFB, 0x3BBF, 0x2FF9, 0xAEEF, | ||
1494 | 0x8EED, 0x444F, 0x1FF9, 0x22AD, 0x000A, 0x8BBF, 0x8FF9, 0x00FE, 0xCFFD, 0x007E, 0x4FF9, 0x115D, 0x5FFB, | ||
1495 | 0x577F, 0x2FF9, 0x8DDF, 0x2EED, 0x333F, 0x1FF9, 0x2BBD, 0xAFFB, 0x88CF, 0x8FF9, 0xBFFF, 0xFFFB, 0x377F, | ||
1496 | 0x4FF9, 0x006D, 0x3FFB, 0x00BE, 0x2FF9, 0x66EF, 0x9FFD, 0x133F, 0x1FF9, 0x009D, 0x000A, 0xABBF, 0x8FF9, | ||
1497 | 0xDFFF, 0x6FFD, 0x006E, 0x4FF9, 0x002C, 0x5FFB, 0x888F, 0x2FF9, 0xCDDF, 0x4DDD, 0x222F, 0x1FF9, 0x1DDD, | ||
1498 | 0xAFFB, 0x4CCF, 0x8FF9, 0x001C, 0xFFFB, 0x277F, 0x4FF9, 0x177D, 0x3FFB, 0x99BF, 0x2FF9, 0xCEEF, 0x8EED, | ||
1499 | 0x004E, 0x1FF9, 0x22AD, 0x000A, 0x00AE, 0x8FF9, 0x7FFF, 0xCFFD, 0x005E, 0x4FF9, 0x115D, 0x5FFB, 0x009E, | ||
1500 | 0x2FF9, 0x5DDF, 0x2EED, 0x003E, 0x1FF9, 0x2BBD, 0xAFFB, 0x00CE, 0x8FF9, 0xEFFF, 0xFFFB, 0x667F, 0x4FF9, | ||
1501 | 0x006D, 0x3FFB, 0x8AAF, 0x2FF9, 0x00EE, 0x9FFD, 0x233F, 0x1FF9, 0x009D, 0x000A, 0x1BBF, 0x8FF9, 0x4EEF, | ||
1502 | 0x6FFD, 0x455F, 0x4FF9, 0x002C, 0x5FFB, 0x008E, 0x2FF9, 0x99DF, 0x4DDD, 0x111F}; | ||
1503 |