]>
Commit | Line | Data |
---|---|---|
01c971c5 | 1 | use std::mem; |
5641dccf | 2 | use nihav_core::io::bitreader::*; |
11df8d00 | 3 | //use io::intcode::*; |
5641dccf | 4 | use nihav_core::codecs::*; |
08a1fab7 | 5 | use nihav_core::frame::NABufferRef; |
01c971c5 KS |
6 | use super::ivi::*; |
7 | use super::ividsp::*; | |
8 | ||
9 | pub fn scale_mv(val: i32, scale: u8) -> i32 { | |
f2af8eca | 10 | (val + (if val > 0 { 1 } else { 0 }) + i32::from(scale) - 1) >> scale |
01c971c5 KS |
11 | } |
12 | ||
13 | #[derive(Clone,Copy)] | |
14 | pub struct IVICodebook { | |
15 | len: usize, | |
16 | bits: [u8; 16], | |
098dcca9 | 17 | offs: [u32; 16], |
01c971c5 KS |
18 | } |
19 | ||
098dcca9 | 20 | impl IVICodebook { |
01c971c5 | 21 | pub fn init(&self) -> Self { |
098dcca9 | 22 | let mut cb = *self; |
01c971c5 KS |
23 | let mut base: u32 = 0; |
24 | for i in 0..cb.len { | |
25 | cb.offs[i] = base; | |
26 | base += 1 << cb.bits[i]; | |
27 | } | |
28 | cb | |
29 | } | |
098dcca9 KS |
30 | } |
31 | ||
32 | pub const IVI_CB_ZERO: IVICodebook = IVICodebook { len: 0, bits: [0; 16], offs: [0; 16] }; | |
33 | ||
34 | const IVI_REV0: [u32; 1] = [0]; | |
35 | const IVI_REV1: [u32; 2] = [0, 1]; | |
36 | const IVI_REV2: [u32; 4] = [0, 2, 1, 3]; | |
37 | const IVI_REV3: [u32; 8] = [0, 4, 2, 6, 1, 5, 3, 7]; | |
38 | const IVI_REV4: [u32; 16] = [ 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]; | |
39 | const IVI_REV5: [u32; 32] = [ 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31]; | |
40 | const IVI_REV6: [u32; 64] = [ 0, 32, 16, 48, 8, 40, 24, 56, 4, 36, 20, 52, 12, 44, 28, 60, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62, 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63]; | |
41 | const IVI_REV7: [u32; 128] = [ 0, 64, 32, 96, 16, 80, 48, 112, 8, 72, 40, 104, 24, 88, 56, 120, 4, 68, 36, 100, 20, 84, 52, 116, 12, 76, 44, 108, 28, 92, 60, 124, 2, 66, 34, 98, 18, 82, 50, 114, 10, 74, 42, 106, 26, 90, 58, 122, 6, 70, 38, 102, 22, 86, 54, 118, 14, 78, 46, 110, 30, 94, 62, 126, 1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57, 121, 5, 69, 37, 101, 21, 85, 53, 117, 13, 77, 45, 109, 29, 93, 61, 125, 3, 67, 35, 99, 19, 83, 51, 115, 11, 75, 43, 107, 27, 91, 59, 123, 7, 71, 39, 103, 23, 87, 55, 119, 15, 79, 47, 111, 31, 95, 63, 127]; | |
42 | const IVI_REV8: [u32; 256] = [ 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255]; | |
01c971c5 | 43 | |
098dcca9 | 44 | const IVI_REVS: [&[u32]; 9] = [ &IVI_REV0, &IVI_REV1, &IVI_REV2, &IVI_REV3, &IVI_REV4, &IVI_REV5, &IVI_REV6, &IVI_REV7, &IVI_REV8]; |
01c971c5 KS |
45 | |
46 | pub trait IVICodebookReader { | |
47 | fn read_ivi_codebook_desc(&mut self, mb_cb: bool, try_default: bool) -> DecoderResult<IVICodebook>; | |
48 | fn read_ivi_cb(&mut self, cb: &IVICodebook) -> BitReaderResult<u32>; | |
49 | fn read_ivi_cb_s(&mut self, cb: &IVICodebook) -> BitReaderResult<i32>; | |
50 | } | |
51 | ||
52 | impl<'a> IVICodebookReader for BitReader<'a> { | |
53 | fn read_ivi_codebook_desc(&mut self, mb_cb: bool, desc_coded: bool) -> DecoderResult<IVICodebook> { | |
54 | if !desc_coded { | |
55 | if mb_cb { | |
098dcca9 | 56 | Ok(IVI_MB_CB[7].init()) |
01c971c5 | 57 | } else { |
098dcca9 | 58 | Ok(IVI_BLK_CB[7].init()) |
01c971c5 KS |
59 | } |
60 | } else { | |
61 | let idx = self.read(3)? as usize; | |
62 | if idx != 7 { | |
63 | if mb_cb { | |
098dcca9 | 64 | Ok(IVI_MB_CB[idx].init()) |
01c971c5 | 65 | } else { |
098dcca9 | 66 | Ok(IVI_BLK_CB[idx].init()) |
01c971c5 KS |
67 | } |
68 | } else { | |
69 | let mut cb = IVI_CB_ZERO; | |
70 | cb.len = self.read(4)? as usize; | |
71 | if cb.len == 0 { return Err(DecoderError::InvalidData); } | |
72 | for i in 0..cb.len { | |
73 | cb.bits[i] = self.read(4)? as u8; | |
74 | } | |
098dcca9 | 75 | Ok(cb.init()) |
01c971c5 KS |
76 | } |
77 | } | |
78 | } | |
098dcca9 | 79 | #[inline(always)] |
01c971c5 | 80 | fn read_ivi_cb(&mut self, cb: &IVICodebook) -> BitReaderResult<u32> { |
098dcca9 | 81 | /* let pfx = if cb.len == 1 { 0 } else { self.read_code(UintCodeType::LimitedUnary((cb.len - 1) as u32, 0))? as usize }; |
01c971c5 | 82 | let nbits = cb.bits[pfx]; |
01c971c5 KS |
83 | let mut base: u32 = 0; |
84 | for i in 0..pfx { base += 1 << cb.bits[i]; } | |
85 | let rval = self.read(nbits)?; | |
86 | let add = reverse_bits(rval, nbits); | |
098dcca9 KS |
87 | Ok(base + add)*/ |
88 | if cb.len > 1 { | |
89 | let len = (!self.peek(16)).trailing_zeros() as usize; | |
90 | let pfx; | |
91 | if len >= cb.len - 1 { | |
92 | pfx = cb.len - 1; | |
93 | self.skip((cb.len - 1) as u32)?; | |
94 | } else { | |
95 | pfx = len; | |
96 | self.skip((len + 1) as u32)?; | |
97 | } | |
98 | let nbits = cb.bits[pfx]; | |
99 | let base = cb.offs[pfx]; | |
100 | let rval = self.read(nbits)?; | |
101 | let add = IVI_REVS[nbits as usize][rval as usize]; | |
102 | Ok(base + add) | |
103 | } else { | |
104 | let nbits = cb.bits[0]; | |
f2af8eca | 105 | Ok(IVI_REVS[nbits as usize][self.read(nbits)? as usize]) |
098dcca9 | 106 | } |
01c971c5 | 107 | } |
098dcca9 | 108 | #[inline(always)] |
01c971c5 KS |
109 | fn read_ivi_cb_s(&mut self, cb: &IVICodebook) -> BitReaderResult<i32> { |
110 | let v = self.read_ivi_cb(cb)?; | |
111 | if v == 0 { | |
112 | Ok(0) | |
113 | } else { | |
114 | let sign = (v & 1) == 1; | |
115 | let val = (v >> 1) as i32; | |
116 | if sign { | |
117 | Ok(val + 1) | |
118 | } else { | |
119 | Ok(-val) | |
120 | } | |
121 | } | |
122 | } | |
123 | } | |
124 | ||
125 | pub const IVI_MB_CB: &[IVICodebook; 8] = &[ | |
098dcca9 KS |
126 | IVICodebook { len: 8, bits: [ 0, 4, 5, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0 ], offs: [0; 16] }, |
127 | IVICodebook { len: 12, bits: [ 0, 2, 2, 3, 3, 3, 3, 5, 3, 2, 2, 2, 0, 0, 0, 0 ], offs: [0; 16] }, | |
128 | IVICodebook { len: 12, bits: [ 0, 2, 3, 4, 3, 3, 3, 3, 4, 3, 2, 2, 0, 0, 0, 0 ], offs: [0; 16] }, | |
129 | IVICodebook { len: 12, bits: [ 0, 3, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 0, 0, 0, 0 ], offs: [0; 16] }, | |
130 | IVICodebook { len: 13, bits: [ 0, 4, 4, 3, 3, 3, 3, 2, 3, 3, 2, 1, 1, 0, 0, 0 ], offs: [0; 16] }, | |
131 | IVICodebook { len: 9, bits: [ 0, 4, 4, 4, 4, 3, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0 ], offs: [0; 16] }, | |
132 | IVICodebook { len: 10, bits: [ 0, 4, 4, 4, 4, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0 ], offs: [0; 16] }, | |
133 | IVICodebook { len: 12, bits: [ 0, 4, 4, 4, 3, 3, 2, 3, 2, 2, 2, 2, 0, 0, 0, 0 ], offs: [0; 16] } | |
01c971c5 KS |
134 | ]; |
135 | ||
136 | pub const IVI_BLK_CB: &[IVICodebook; 8] = &[ | |
098dcca9 KS |
137 | IVICodebook { len: 10, bits: [ 1, 2, 3, 4, 4, 7, 5, 5, 4, 1, 0, 0, 0, 0, 0, 0 ], offs: [0; 16] }, |
138 | IVICodebook { len: 11, bits: [ 2, 3, 4, 4, 4, 7, 5, 4, 3, 3, 2, 0, 0, 0, 0, 0 ], offs: [0; 16] }, | |
139 | IVICodebook { len: 12, bits: [ 2, 4, 5, 5, 5, 5, 6, 4, 4, 3, 1, 1, 0, 0, 0, 0 ], offs: [0; 16] }, | |
140 | IVICodebook { len: 13, bits: [ 3, 3, 4, 4, 5, 6, 6, 4, 4, 3, 2, 1, 1, 0, 0, 0 ], offs: [0; 16] }, | |
141 | IVICodebook { len: 11, bits: [ 3, 4, 4, 5, 5, 5, 6, 5, 4, 2, 2, 0, 0, 0, 0, 0 ], offs: [0; 16] }, | |
142 | IVICodebook { len: 13, bits: [ 3, 4, 5, 5, 5, 5, 6, 4, 3, 3, 2, 1, 1, 0, 0, 0 ], offs: [0; 16] }, | |
143 | IVICodebook { len: 13, bits: [ 3, 4, 5, 5, 5, 6, 5, 4, 3, 3, 2, 1, 1, 0, 0, 0 ], offs: [0; 16] }, | |
144 | IVICodebook { len: 9, bits: [ 3, 4, 4, 5, 5, 5, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0 ], offs: [0; 16] } | |
01c971c5 KS |
145 | ]; |
146 | ||
147 | #[allow(unused_variables)] | |
f2af8eca | 148 | #[allow(clippy::many_single_char_names)] |
01c971c5 KS |
149 | fn read_trans_band_header(br: &mut BitReader, w: usize, h: usize, dst: &mut [i16], dstride: usize) -> DecoderResult<()> { |
150 | let color_plane = br.read(2)?; | |
151 | let bit_depth = br.read(3)?; | |
152 | let dirty_rects = br.read(8)? as usize; | |
153 | for i in 0..dirty_rects { | |
154 | let x = br.read(16)?; | |
155 | let y = br.read(16)?; | |
156 | let l = br.read(16)?; | |
157 | let r = br.read(16)?; | |
158 | } | |
159 | let has_trans_color = br.read_bool()?; | |
160 | if has_trans_color { | |
161 | let r = br.read(8)?; | |
162 | let g = br.read(8)?; | |
163 | let b = br.read(8)?; | |
164 | } | |
1a151e53 | 165 | |
01c971c5 KS |
166 | br.skip(1)?; |
167 | ||
168 | let mut cb = IVI_CB_ZERO; | |
169 | cb.len = br.read(4)? as usize; | |
170 | if cb.len == 0 { return Err(DecoderError::InvalidData); } | |
171 | for i in 0..cb.len { | |
172 | cb.bits[i] = br.read(4)? as u8; | |
173 | } | |
859e6a60 | 174 | cb = cb.init(); |
01c971c5 KS |
175 | br.align(); |
176 | ||
177 | let tile_start = br.tell(); | |
178 | let empty = br.read_bool()?; | |
179 | if !empty { | |
180 | br.read_bool()?; | |
181 | let mut len = br.read(8)? as usize; | |
182 | if len == 255 { | |
183 | len = br.read(24)? as usize; | |
184 | } | |
185 | br.align(); | |
186 | let tile_end = tile_start + len * 8; | |
187 | ||
188 | let first_val = br.read_bool()?; | |
189 | ||
190 | let mut dec_size = 0; | |
191 | let mut x = 0; | |
192 | let mut y = 0; | |
193 | let mut fill = if !first_val { 255-128 } else { 0-128 }; | |
194 | let tr_w = (w + 31) & !31; | |
195 | while br.tell() < tile_end { | |
196 | let code = br.read_ivi_cb(&cb)? as usize; | |
197 | if code == 0 { | |
198 | dec_size += 255; | |
199 | for _ in 0..255 { | |
200 | if (x < w) && (y < h) { | |
201 | dst[x + y * dstride] = fill; | |
202 | } | |
203 | x += 1; | |
204 | if x == tr_w { | |
205 | x = 0; | |
206 | y += 1; | |
207 | } | |
208 | } | |
209 | } else { | |
210 | dec_size += code; | |
211 | for _ in 0..code { | |
212 | if (x < w) && (y < h) { | |
213 | dst[x + y * dstride] = fill; | |
214 | } | |
215 | x += 1; | |
216 | if x == tr_w { | |
217 | x = 0; | |
218 | y += 1; | |
219 | } | |
220 | } | |
221 | fill = !fill; | |
222 | } | |
223 | } | |
224 | br.align(); | |
225 | } else { | |
226 | } | |
227 | ||
228 | Ok(()) | |
229 | } | |
230 | ||
5a6dec5f KS |
231 | #[allow(clippy::cast_lossless)] |
232 | fn decode_block8x8(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams8x8, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: TrFunc) -> DecoderResult<()> { | |
01c971c5 KS |
233 | let mut idx: isize = -1; |
234 | let quant_mat = if is_intra { tables.quant_intra } else { tables.quant_inter }; | |
235 | while idx <= 64 { | |
236 | let c = br.read_ivi_cb(blk_cb)?; | |
237 | if c == rvmap.eob_sym { break; } | |
238 | let run; | |
239 | let val: i32; | |
240 | if c != rvmap.esc_sym { | |
241 | validate!(c < 256); | |
242 | run = rvmap.runtab[c as usize] as isize; | |
243 | val = rvmap.valtab[c as usize] as i32; | |
244 | } else { | |
245 | run = (br.read_ivi_cb(blk_cb)? as isize) + 1; | |
246 | let lo = br.read_ivi_cb(blk_cb)?; | |
247 | let hi = br.read_ivi_cb(blk_cb)?; | |
248 | let v = (hi << 6) + lo; | |
249 | if v == 0 { | |
250 | val = 0; // should not happen but still... | |
251 | } else { | |
098dcca9 | 252 | let vv = (v >> 1) as i32; |
01c971c5 | 253 | if (v & 1) != 0 { |
098dcca9 | 254 | val = vv + 1; |
01c971c5 | 255 | } else { |
098dcca9 | 256 | val = -vv; |
01c971c5 KS |
257 | } |
258 | } | |
259 | } | |
260 | idx += run; | |
261 | validate!((idx >= 0) && (idx < 64)); | |
262 | ||
263 | let spos = tables.scan[idx as usize]; | |
f2af8eca | 264 | let q = (u32::from(quant_mat[spos]) * u32::from(quant)) >> 9; |
01c971c5 KS |
265 | if q > 1 { |
266 | let qq = q as i32; | |
267 | let bias = (((q ^ 1) - 1) >> 1) as i32; | |
268 | coeffs[spos] = val * qq; | |
269 | if val > 0 { coeffs[spos] += bias; } | |
270 | else { coeffs[spos] -= bias; } | |
271 | } else { | |
272 | coeffs[spos] = val; | |
273 | } | |
274 | } | |
275 | if is_intra && is_2d { | |
276 | *prev_dc += coeffs[0]; | |
277 | coeffs[0] = *prev_dc; | |
278 | } | |
279 | (transform)(coeffs); | |
280 | Ok(()) | |
281 | } | |
5a6dec5f KS |
282 | #[allow(clippy::cast_lossless)] |
283 | fn decode_block4x4(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams4x4, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: TrFunc) -> DecoderResult<()> { | |
01c971c5 KS |
284 | let mut idx: isize = -1; |
285 | let quant_mat = if is_intra { tables.quant_intra } else { tables.quant_inter }; | |
286 | while idx <= 64 { | |
287 | let c = br.read_ivi_cb(blk_cb)?; | |
288 | if c == rvmap.eob_sym { break; } | |
289 | let run; | |
290 | let val: i32; | |
291 | if c != rvmap.esc_sym { | |
292 | validate!(c < 256); | |
293 | run = rvmap.runtab[c as usize] as isize; | |
294 | val = rvmap.valtab[c as usize] as i32; | |
295 | } else { | |
296 | run = (br.read_ivi_cb(blk_cb)? as isize) + 1; | |
297 | let lo = br.read_ivi_cb(blk_cb)?; | |
298 | let hi = br.read_ivi_cb(blk_cb)?; | |
30ac5d4e | 299 | let v = (hi << 6) + lo; |
01c971c5 KS |
300 | if v == 0 { |
301 | val = 0; // should not happen but still... | |
302 | } else { | |
303 | if (v & 1) != 0 { | |
304 | val = ((v >> 1) as i32) + 1; | |
305 | } else { | |
306 | val = -((v >> 1) as i32); | |
307 | } | |
308 | } | |
309 | } | |
310 | idx += run; | |
311 | validate!((idx >= 0) && (idx < 16)); | |
312 | ||
313 | let spos = tables.scan[idx as usize]; | |
f2af8eca | 314 | let q = (u32::from(quant_mat[spos]) * u32::from(quant)) >> 9; |
01c971c5 KS |
315 | if q > 1 { |
316 | let qq = q as i32; | |
317 | let bias = (((q ^ 1) - 1) >> 1) as i32; | |
318 | coeffs[spos] = val * qq; | |
319 | if val > 0 { coeffs[spos] += bias; } | |
320 | else { coeffs[spos] -= bias; } | |
321 | } else { | |
322 | coeffs[spos] = val; | |
323 | } | |
324 | } | |
325 | if is_intra && is_2d { | |
326 | *prev_dc += coeffs[0]; | |
327 | coeffs[0] = *prev_dc; | |
328 | } | |
329 | (transform)(coeffs); | |
330 | Ok(()) | |
331 | } | |
332 | ||
098dcca9 KS |
333 | fn put_block(frame: &mut [i16], offs: usize, stride: usize, blk: &[i32], blk_size: usize) { |
334 | unsafe { | |
f2af8eca | 335 | let mut dptr = frame.as_mut_ptr().add(offs); |
098dcca9 KS |
336 | for y in 0..blk_size { |
337 | for x in 0..blk_size { | |
f2af8eca | 338 | *dptr.add(x) = blk[x + y * blk_size] as i16; |
098dcca9 | 339 | } |
f2af8eca | 340 | dptr = dptr.add(stride); |
01c971c5 | 341 | } |
01c971c5 KS |
342 | } |
343 | } | |
344 | ||
098dcca9 KS |
345 | fn add_block(frame: &mut [i16], offs: usize, stride: usize, blk: &[i32], blk_size: usize) { |
346 | unsafe { | |
f2af8eca | 347 | let mut dptr = frame.as_mut_ptr().add(offs); |
098dcca9 KS |
348 | for y in 0..blk_size { |
349 | for x in 0..blk_size { | |
f2af8eca | 350 | *dptr.add(x) = (*dptr.add(x)).wrapping_add(blk[x + y * blk_size] as i16); |
098dcca9 | 351 | } |
f2af8eca | 352 | dptr = dptr.add(stride); |
01c971c5 | 353 | } |
01c971c5 KS |
354 | } |
355 | } | |
356 | ||
357 | struct FrameData { | |
358 | plane_buf: [Vec<i16>; 4], | |
359 | plane_stride: [usize; 4], | |
360 | pic_hdr: PictureHeader, | |
361 | } | |
362 | ||
363 | fn align(val: usize, bits: u8) -> usize { | |
364 | let mask = (1 << bits) - 1; | |
365 | (val + mask) & !mask | |
366 | } | |
367 | ||
368 | impl FrameData { | |
08a1fab7 KS |
369 | fn new() -> NABufferRef<Self> { |
370 | NABufferRef::new(FrameData { | |
01c971c5 KS |
371 | plane_buf: [Vec::new(), Vec::new(), Vec::new(), Vec::new()], |
372 | plane_stride: [0, 0, 0, 0], | |
373 | pic_hdr: PictureHeader::new_null(IVIFrameType::Intra), | |
08a1fab7 | 374 | }) |
01c971c5 KS |
375 | } |
376 | fn realloc(&mut self, pic_hdr: &PictureHeader) -> DecoderResult<()> { | |
377 | let width = align(pic_hdr.width, 6); | |
378 | let height = align(pic_hdr.height, 6); | |
379 | ||
380 | let stride = width; | |
381 | self.plane_buf[0].resize(stride * height, 0); | |
382 | self.plane_stride[0] = stride; | |
383 | for plane in 1..3 { | |
384 | self.plane_buf[plane].resize((stride >> 1) * (height >> 1), 0); | |
385 | self.plane_stride[plane] = stride >> 1; | |
386 | } | |
387 | if pic_hdr.transparent { | |
388 | self.plane_buf[3].resize(stride * height, 0); | |
389 | self.plane_stride[3] = stride; | |
390 | } | |
391 | self.pic_hdr = *pic_hdr; | |
392 | Ok(()) | |
393 | } | |
394 | fn fill_plane(&mut self, vb: &mut NAVideoBuffer<u8>, plane: usize) { | |
009a04a9 KS |
395 | let dplane = if (plane == 1) || (plane == 2) { plane ^ 3 } else { plane }; |
396 | let (w, h) = vb.get_dimensions(dplane); | |
397 | let mut didx = vb.get_offset(dplane); | |
398 | let dstride = vb.get_stride(dplane); | |
1a967e6b | 399 | let dst = vb.get_data_mut().unwrap(); |
01c971c5 KS |
400 | let src = &self.plane_buf[plane]; |
401 | let mut sidx = 0; | |
402 | let sstride = self.plane_stride[plane]; | |
403 | for _ in 0..h { | |
404 | for x in 0..w { | |
405 | dst[didx + x] = clip8(src[sidx + x] + 128); | |
406 | } | |
407 | didx += dstride; | |
408 | sidx += sstride; | |
409 | } | |
410 | } | |
411 | } | |
412 | ||
f2af8eca | 413 | #[allow(clippy::many_single_char_names)] |
01c971c5 KS |
414 | fn do_mc(dst: &mut [i16], dstride: usize, src: &[i16], sstride: usize, x: usize, y: usize, l: usize, r: usize, t: usize, b: usize, mv_x: i32, mv_y: i32, is_hpel: bool, blk_size: usize) { |
415 | let (xoff, yoff, mv_mode) = if is_hpel { | |
416 | (mv_x >> 1, mv_y >> 1, ((mv_x & 1) + (mv_y & 1) * 2) as u8) | |
417 | } else{ | |
418 | (mv_x, mv_y, 0) | |
419 | }; | |
420 | let xpos = (x as isize) + (xoff as isize); | |
421 | let ypos = (y as isize) + (yoff as isize); | |
422 | if (xpos < (l as isize)) || ((xpos as usize) + blk_size + ((mv_mode & 1) as usize) > r) || | |
423 | (ypos < (t as isize)) || ((ypos as usize) + blk_size + ((mv_mode >> 1) as usize) > b) { | |
424 | //println!(" copy from {},{} of {}-{},{}-{} {}x{}!", xpos, ypos, l,r,t,b,blk_size,blk_size); | |
425 | return; | |
426 | } | |
427 | let sidx = (xpos as usize) + (ypos as usize) * sstride; | |
098dcca9 KS |
428 | if blk_size == 8 { |
429 | ivi_mc_put(dst, dstride, &src[sidx..], sstride, mv_mode, 8, 8); | |
430 | } else { | |
431 | ivi_mc_put(dst, dstride, &src[sidx..], sstride, mv_mode, 4, 4); | |
432 | } | |
01c971c5 KS |
433 | } |
434 | ||
f2af8eca | 435 | #[allow(clippy::many_single_char_names)] |
01c971c5 KS |
436 | fn do_mc_b(dst: &mut [i16], dstride: usize, src1: &[i16], sstride1: usize, src2: &[i16], sstride2: usize, x: usize, y: usize, l: usize, r: usize, t: usize, b: usize, mv_x: i32, mv_y: i32, mv2_x: i32, mv2_y: i32, is_hpel: bool, blk_size: usize) { |
437 | let (xoff1, yoff1, mv_mode1) = if is_hpel { | |
438 | (mv_x >> 1, mv_y >> 1, ((mv_x & 1) + (mv_y & 1) * 2) as u8) | |
439 | } else{ | |
440 | (mv_x, mv_y, 0) | |
441 | }; | |
442 | let xpos1 = (x as isize) + (xoff1 as isize); | |
443 | let ypos1 = (y as isize) + (yoff1 as isize); | |
444 | if (xpos1 < (l as isize)) || ((xpos1 as usize) + blk_size + ((mv_mode1 & 1) as usize) > r) || | |
445 | (ypos1 < (t as isize)) || ((ypos1 as usize) + blk_size + ((mv_mode1 >> 1) as usize) > b) { | |
446 | return; | |
447 | } | |
448 | let sidx1 = (xpos1 as usize) + (ypos1 as usize) * sstride1; | |
449 | let (xoff2, yoff2, mv_mode2) = if is_hpel { | |
450 | (mv2_x >> 1, mv2_y >> 1, ((mv2_x & 1) + (mv2_y & 1) * 2) as u8) | |
451 | } else{ | |
452 | (mv2_x, mv2_y, 0) | |
453 | }; | |
454 | let xpos2 = (x as isize) + (xoff2 as isize); | |
455 | let ypos2 = (y as isize) + (yoff2 as isize); | |
456 | if (xpos2 < (l as isize)) || ((xpos2 as usize) + blk_size + ((mv_mode2 & 1) as usize) > r) || | |
457 | (ypos2 < (t as isize)) || ((ypos2 as usize) + blk_size + ((mv_mode2 >> 1) as usize) > b) { | |
458 | return; | |
459 | } | |
460 | let sidx2 = (xpos2 as usize) + (ypos2 as usize) * sstride2; | |
461 | ivi_mc_avg(dst, dstride, &src1[sidx1..], sstride1, mv_mode1, &src2[sidx2..], sstride2, mv_mode2, blk_size, blk_size); | |
462 | } | |
463 | ||
464 | pub trait IndeoXParser { | |
465 | fn decode_picture_header(&mut self, br: &mut BitReader) -> DecoderResult<PictureHeader>; | |
466 | fn decode_band_header(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, plane: usize, band: usize) -> DecoderResult<BandHeader>; | |
08a1fab7 | 467 | fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band_hdr: &BandHeader, tile: &mut IVITile, ref_tile: Option<&IVITile>, mv_scale: u8) -> DecoderResult<()>; |
01c971c5 KS |
468 | fn recombine_plane(&mut self, src: &[i16], sstride: usize, dst: &mut [u8], dstride: usize, w: usize, h: usize); |
469 | } | |
470 | ||
471 | const MISSING_REF: usize = 42; | |
472 | ||
473 | pub struct IVIDecoder { | |
474 | ftype: IVIFrameType, | |
08a1fab7 | 475 | frames: [NABufferRef<FrameData>; 4], |
01c971c5 KS |
476 | cur_frame: usize, |
477 | prev_frame: usize, | |
478 | next_frame: usize, | |
479 | iref_0: usize, | |
480 | iref_1: usize, | |
481 | scal_ref: usize, | |
482 | vinfo: NAVideoInfo, | |
483 | vinfoa: NAVideoInfo, | |
484 | bref: Option<NABufferType>, | |
485 | ||
486 | bands: Vec<BandHeader>, | |
01bdaf24 | 487 | tiles: Vec<IVITile>, |
01c971c5 KS |
488 | num_tiles: [[usize; 4]; 4], |
489 | tile_start: [[usize; 4]; 4], | |
490 | } | |
491 | ||
492 | impl IVIDecoder { | |
493 | pub fn new() -> Self { | |
494 | let mut bands: Vec<BandHeader> = Vec::with_capacity(12); | |
495 | bands.resize(12, BandHeader::new_empty(42, 42)); | |
496 | IVIDecoder { | |
497 | ftype: IVIFrameType::NULL, | |
498 | frames: [FrameData::new(), FrameData::new(), FrameData::new(), FrameData::new()], | |
499 | cur_frame: 0, prev_frame: MISSING_REF, next_frame: MISSING_REF, | |
500 | iref_0: MISSING_REF, iref_1: MISSING_REF, scal_ref: MISSING_REF, | |
501 | vinfo: NAVideoInfo::new(0, 0, false, YUV410_FORMAT), | |
502 | vinfoa: NAVideoInfo::new(0, 0, false, YUVA410_FORMAT), | |
503 | bref: None, | |
504 | ||
f2af8eca | 505 | bands, |
01c971c5 KS |
506 | tiles: Vec::new(), tile_start: [[0; 4]; 4], num_tiles: [[0; 4]; 4], |
507 | } | |
508 | } | |
509 | ||
510 | fn realloc(&mut self, pic_hdr: &PictureHeader) -> DecoderResult<()> { | |
511 | let planes = if pic_hdr.transparent { 4 } else { 3 }; | |
512 | ||
513 | //self.bands.truncate(0); | |
514 | self.tiles.truncate(0); | |
515 | self.num_tiles = [[0; 4]; 4]; | |
516 | self.tile_start = [[0; 4]; 4]; | |
517 | let mut tstart: usize = 0; | |
518 | for plane in 0..planes { | |
519 | let is_luma = (plane != 1) && (plane != 2); | |
520 | let bands = if is_luma { pic_hdr.luma_bands } else { pic_hdr.chroma_bands }; | |
521 | let mut band_w = if is_luma { pic_hdr.width } else { (pic_hdr.width + 3) >> 2 }; | |
522 | let mut band_h = if is_luma { pic_hdr.height } else { (pic_hdr.height + 3) >> 2 }; | |
523 | let mut tile_w = if is_luma { pic_hdr.slice_w } else { (pic_hdr.slice_w + 3) >> 2 }; | |
524 | let mut tile_h = if is_luma { pic_hdr.slice_h } else { (pic_hdr.slice_h + 3) >> 2 }; | |
525 | if bands > 1 { | |
526 | band_w = (band_w + 1) >> 1; | |
527 | band_h = (band_h + 1) >> 1; | |
528 | if plane == 0 { | |
529 | tile_w = (tile_w + 1) >> 1; | |
530 | tile_h = (tile_h + 1) >> 1; | |
531 | } | |
532 | } | |
533 | for band in 0..bands { | |
534 | self.tile_start[plane][band] = tstart; | |
535 | let band_xoff = if (band & 1) == 1 { band_w } else { 0 }; | |
536 | let band_yoff = if (band & 2) == 2 { band_h } else { 0 }; | |
537 | let mut y = 0; | |
538 | while y < band_h { | |
539 | let cur_h = if y + tile_h <= band_h { tile_h } else { band_h - y }; | |
540 | let mut x = 0; | |
541 | while x < band_w { | |
542 | let cur_w = if x + tile_w <= band_w { tile_w } else { band_w - x }; | |
543 | let tile = IVITile::new(band_xoff + x, band_yoff + y, cur_w, cur_h); | |
01bdaf24 | 544 | self.tiles.push(tile); |
01c971c5 KS |
545 | self.num_tiles[plane][band] += 1; |
546 | tstart += 1; | |
547 | x += tile_w; | |
548 | } | |
549 | y += tile_h; | |
550 | } | |
551 | } | |
552 | } | |
553 | Ok(()) | |
554 | } | |
ac818eac | 555 | fn decode_band(&mut self, pic_hdr: &PictureHeader, dec: &mut dyn IndeoXParser, br: &mut BitReader, plane_no: usize, band_no: usize) -> DecoderResult<()> { |
01c971c5 KS |
556 | let bidx = match plane_no { |
557 | 0 => { band_no }, | |
558 | _ => { pic_hdr.luma_bands + plane_no - 1 }, | |
559 | }; | |
560 | let prev_band = if bidx >= self.bands.len() { BandHeader::new_empty(plane_no, band_no) } else { self.bands[bidx].clone() }; | |
561 | let mut band = dec.decode_band_header(br, pic_hdr, plane_no, band_no)?; | |
562 | if let TxType::None = band.ttype { | |
563 | validate!(band.plane_no == prev_band.plane_no); | |
564 | validate!(band.band_no == prev_band.band_no); | |
565 | validate!(band.blk_size == prev_band.blk_size); | |
566 | band.tr = prev_band.tr; | |
567 | band.ttype = prev_band.ttype; | |
568 | }; | |
569 | ||
570 | let tstart = self.tile_start[band.plane_no][band.band_no]; | |
571 | let tend = tstart + self.num_tiles[band.plane_no][band.band_no]; | |
572 | let mb_size = band.mb_size; | |
573 | let (tr, tr_dc) = match band.ttype { | |
574 | TxType::Transform4(_) => { ivi_get_transform4x4_funcs(band.tr) }, | |
575 | TxType::Transform8(_) => { ivi_get_transform8x8_funcs(band.tr) }, | |
576 | _ => { ivi_get_transform4x4_funcs(band.tr) }, | |
577 | }; | |
578 | for tile_no in tstart..tend { | |
579 | { | |
01bdaf24 | 580 | let tile = &mut self.tiles[tile_no]; |
01c971c5 KS |
581 | let mb_w = (tile.w + mb_size - 1) / mb_size; |
582 | let mb_h = (tile.h + mb_size - 1) / mb_size; | |
583 | tile.mb_w = mb_w; | |
584 | tile.mb_h = mb_h; | |
585 | tile.mb.truncate(0); | |
586 | tile.mb.resize(mb_w * mb_h, MB::new(0, 0)); | |
587 | } | |
588 | ||
589 | let tile_start = br.tell(); | |
590 | if !br.read_bool()? { | |
591 | let res = br.read_bool()?; | |
592 | validate!(res); | |
593 | let mut len = br.read(8)? as usize; | |
594 | if len == 255 { | |
595 | len = br.read(24)? as usize; | |
596 | } | |
597 | br.align(); | |
598 | validate!(len > 0); | |
599 | let tile_end = tile_start + len * 8; | |
600 | validate!(tile_end > br.tell()); | |
601 | validate!(tile_end <= br.tell() + (br.left() as usize)); | |
602 | { | |
08a1fab7 | 603 | let ref_tile: Option<&IVITile>; |
01c971c5 KS |
604 | let mv_scale; |
605 | if (plane_no == 0) && (band_no == 0) { | |
606 | mv_scale = 0; | |
607 | } else { | |
608 | mv_scale = (((self.bands[0].mb_size >> 3) as i8) - ((band.mb_size >> 3) as i8)) as u8; | |
609 | } | |
01bdaf24 KS |
610 | let (ref_tiles, cur_tiles) = self.tiles.split_at_mut(tile_no); |
611 | let tile = &mut cur_tiles[0]; | |
01c971c5 | 612 | if plane_no != 0 || band_no != 0 { |
01bdaf24 | 613 | let rtile = &ref_tiles[0]; |
01c971c5 KS |
614 | if (tile.mb_w != rtile.mb_w) || (tile.mb_h != rtile.mb_h) { |
615 | ref_tile = None; | |
616 | } else { | |
617 | ref_tile = Some(rtile); | |
618 | } | |
619 | } else { | |
620 | ref_tile = None; | |
621 | } | |
01bdaf24 | 622 | dec.decode_mb_info(br, pic_hdr, &band, tile, ref_tile, mv_scale)?; |
01c971c5 KS |
623 | } |
624 | ||
5a6dec5f | 625 | self.decode_tile(br, &band, tile_no, tr, tr_dc)?; |
01c971c5 KS |
626 | let skip_part = tile_end - br.tell(); |
627 | br.skip(skip_part as u32)?; | |
628 | } else { | |
629 | { | |
08a1fab7 | 630 | let ref_tile: Option<&IVITile>; |
01c971c5 KS |
631 | let mv_scale; |
632 | if (plane_no == 0) && (band_no == 0) { | |
633 | mv_scale = 0; | |
634 | } else { | |
635 | mv_scale = (((self.bands[0].mb_size >> 3) as i8) - ((band.mb_size >> 3) as i8)) as u8; | |
636 | } | |
01bdaf24 KS |
637 | let (ref_tiles, cur_tiles) = self.tiles.split_at_mut(tile_no); |
638 | let tile = &mut cur_tiles[0]; | |
01c971c5 | 639 | if plane_no != 0 || band_no != 0 { |
01bdaf24 | 640 | let rtile = &ref_tiles[0]; |
01c971c5 KS |
641 | if (tile.mb_w != rtile.mb_w) || (tile.mb_h != rtile.mb_h) { |
642 | ref_tile = None; | |
643 | } else { | |
644 | ref_tile = Some(rtile); | |
645 | } | |
646 | } else { | |
647 | ref_tile = None; | |
648 | } | |
649 | let mut mb_idx = 0; | |
650 | for mb_y in 0..tile.mb_h { | |
651 | for mb_x in 0..tile.mb_w { | |
652 | let mut mb = MB::new(tile.pos_x + mb_x * band.mb_size, tile.pos_y + mb_y * band.mb_size); | |
653 | mb.mtype = MBType::Inter; | |
654 | mb.cbp = 0; | |
655 | if band.inherit_mv { | |
656 | if let Some(ref tileref) = ref_tile { | |
657 | let mx = tileref.mb[mb_idx].mv_x; | |
658 | let my = tileref.mb[mb_idx].mv_y; | |
659 | mb.mv_x = scale_mv(mx, mv_scale); | |
660 | mb.mv_y = scale_mv(my, mv_scale); | |
661 | } | |
662 | } | |
663 | tile.mb[mb_idx] = mb; | |
664 | mb_idx += 1; | |
665 | } | |
666 | } | |
667 | } | |
5a6dec5f | 668 | self.decode_tile(br, &band, tile_no, tr, tr_dc)?; |
01c971c5 KS |
669 | } |
670 | } | |
671 | self.bands[bidx] = band; | |
672 | br.align(); | |
673 | Ok(()) | |
674 | } | |
5a6dec5f | 675 | fn decode_tile(&mut self, br: &mut BitReader, band: &BandHeader, tile_no: usize, tr: TrFunc, transform_dc: TrFuncDC) -> DecoderResult<()> { |
01c971c5 KS |
676 | let mut mb_idx = 0; |
677 | let mut prev_dc: i32 = 0; | |
01bdaf24 | 678 | let tile = &mut self.tiles[tile_no]; |
08a1fab7 | 679 | let mut frame = self.frames[self.cur_frame].clone(); |
01c971c5 KS |
680 | |
681 | let stride = frame.plane_stride[band.plane_no]; | |
682 | let mut dstidx = tile.pos_x + tile.pos_y * stride; | |
683 | let mut dst = &mut frame.plane_buf[band.plane_no]; | |
684 | let pos_x = tile.pos_x; | |
685 | let pos_y = tile.pos_y; | |
686 | let tile_w = (tile.w + 15) & !15; | |
687 | let tile_h = (tile.h + 15) & !15; | |
688 | for mb_y in 0..tile.mb_h { | |
689 | for mb_x in 0..tile.mb_w { | |
690 | let mb = &mut tile.mb[mb_idx]; | |
691 | ||
692 | let is_intra = mb.mtype == MBType::Intra; | |
693 | ||
694 | if band.mb_size != band.blk_size { | |
695 | let mut cbp = mb.cbp; | |
696 | for blk_no in 0..4 { | |
697 | let mut blk: [i32; 64] = [0; 64]; | |
009a04a9 | 698 | let boff = (blk_no & 1) * band.blk_size + (blk_no >> 1) * band.blk_size * stride + mb_x * band.mb_size; |
01c971c5 KS |
699 | if !is_intra { |
700 | if mb.mtype != MBType::Bidir { | |
701 | let idx; | |
702 | if mb.mtype != MBType::Backward { | |
703 | idx = self.prev_frame; | |
704 | } else { | |
705 | idx = self.next_frame; | |
706 | } | |
08a1fab7 | 707 | let pf = &self.frames[idx]; |
01c971c5 KS |
708 | do_mc(&mut dst[dstidx + boff..], stride, |
709 | &pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no], | |
009a04a9 KS |
710 | pos_x + mb_x * band.mb_size + (blk_no & 1) * band.blk_size, |
711 | pos_y + mb_y * band.mb_size + (blk_no >> 1) * band.blk_size, | |
01c971c5 | 712 | pos_x, pos_x + tile_w, pos_y, pos_y + tile_h, |
009a04a9 | 713 | mb.mv_x, mb.mv_y, band.halfpel, band.blk_size); |
01c971c5 | 714 | } else { |
08a1fab7 KS |
715 | let pf = &self.frames[self.prev_frame]; |
716 | let nf = &self.frames[self.next_frame]; | |
01c971c5 KS |
717 | do_mc_b(&mut dst[dstidx + boff..], stride, |
718 | &pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no], | |
719 | &nf.plane_buf[band.plane_no], nf.plane_stride[band.plane_no], | |
009a04a9 KS |
720 | pos_x + mb_x * band.mb_size + (blk_no & 1) * band.blk_size, |
721 | pos_y + mb_y * band.mb_size + (blk_no >> 1) * band.blk_size, | |
01c971c5 KS |
722 | pos_x, pos_x + tile_w, pos_y, pos_y + tile_h, |
723 | mb.mv_x, mb.mv_y, mb.mv2_x, mb.mv2_y, band.halfpel, | |
724 | band.blk_size); | |
725 | } | |
726 | } | |
727 | if (cbp & 1) != 0 { | |
728 | if let TxType::Transform8(ref params) = band.ttype { | |
729 | decode_block8x8(br, &band.blk_cb, &band.rvmap, params, is_intra, band.tr.is_2d(), &mut prev_dc, mb.q, &mut blk, tr)?; | |
730 | if is_intra { | |
731 | put_block(&mut dst, dstidx + boff, stride, &blk, 8); | |
732 | } else { | |
733 | add_block(&mut dst, dstidx + boff, stride, &blk, 8); | |
734 | } | |
735 | } | |
009a04a9 KS |
736 | if let TxType::Transform4(ref params) = band.ttype { |
737 | decode_block4x4(br, &band.blk_cb, &band.rvmap, params, is_intra, band.tr.is_2d(), &mut prev_dc, mb.q, &mut blk, tr)?; | |
738 | if is_intra { | |
739 | put_block(&mut dst, dstidx + boff, stride, &blk, 4); | |
740 | } else { | |
741 | add_block(&mut dst, dstidx + boff, stride, &blk, 4); | |
742 | } | |
743 | } | |
01c971c5 KS |
744 | } else { |
745 | if is_intra { | |
746 | (transform_dc)(&mut blk, prev_dc); | |
009a04a9 | 747 | put_block(&mut dst, dstidx + boff, stride, &blk, band.blk_size); |
01c971c5 KS |
748 | } |
749 | } | |
750 | cbp >>= 1; | |
751 | } | |
752 | } else { | |
753 | let mut blk: [i32; 64] = [0; 64]; | |
754 | if !is_intra { | |
755 | if mb.mtype != MBType::Bidir { | |
756 | let idx; | |
757 | if mb.mtype != MBType::Backward { | |
758 | idx = self.prev_frame; | |
759 | } else { | |
760 | idx = self.next_frame; | |
761 | } | |
08a1fab7 | 762 | let pf = &self.frames[idx]; |
01c971c5 KS |
763 | do_mc(&mut dst[dstidx + mb_x * band.blk_size..], stride, |
764 | &pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no], | |
765 | pos_x + mb_x * band.mb_size, | |
766 | pos_y + mb_y * band.mb_size, | |
767 | pos_x, pos_x + tile_w, pos_y, pos_y + tile_h, | |
768 | mb.mv_x, mb.mv_y, band.halfpel, band.blk_size); | |
769 | } else { | |
08a1fab7 KS |
770 | let pf = &self.frames[self.prev_frame]; |
771 | let nf = &self.frames[self.next_frame]; | |
01c971c5 KS |
772 | do_mc_b(&mut dst[dstidx + mb_x * band.blk_size..], stride, |
773 | &pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no], | |
774 | &nf.plane_buf[band.plane_no], nf.plane_stride[band.plane_no], | |
775 | pos_x + mb_x * band.mb_size, | |
776 | pos_y + mb_y * band.mb_size, | |
777 | pos_x, pos_x + tile_w, pos_y, pos_y + tile_h, | |
778 | mb.mv_x, mb.mv_y, mb.mv2_x, mb.mv2_y, band.halfpel, | |
779 | band.blk_size); | |
780 | } | |
781 | } | |
782 | if mb.cbp != 0 { | |
783 | if let TxType::Transform8(ref params) = band.ttype { | |
784 | decode_block8x8(br, &band.blk_cb, &band.rvmap, params, is_intra, band.tr.is_2d(), &mut prev_dc, mb.q, &mut blk, tr)?; | |
785 | } | |
786 | if let TxType::Transform4(ref params) = band.ttype { | |
787 | decode_block4x4(br, &band.blk_cb, &band.rvmap, params, is_intra, band.tr.is_2d(), &mut prev_dc, mb.q, &mut blk, tr)?; | |
788 | } | |
789 | if is_intra { | |
098dcca9 KS |
790 | if band.blk_size == 8 { |
791 | put_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 8); | |
792 | } else { | |
793 | put_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 4); | |
794 | } | |
01c971c5 | 795 | } else { |
098dcca9 KS |
796 | if band.blk_size == 8 { |
797 | add_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 8); | |
798 | } else { | |
799 | add_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 4); | |
800 | } | |
01c971c5 KS |
801 | } |
802 | } else { | |
803 | if is_intra { | |
804 | (transform_dc)(&mut blk, prev_dc); | |
098dcca9 KS |
805 | if band.blk_size == 8 { |
806 | put_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 8); | |
807 | } else { | |
808 | put_block(&mut dst, dstidx + mb_x * band.blk_size, stride, &blk, 4); | |
809 | } | |
01c971c5 KS |
810 | } |
811 | } | |
812 | } | |
813 | mb_idx += 1; | |
814 | } | |
815 | dstidx += stride * band.mb_size; | |
816 | } | |
817 | br.align(); | |
818 | Ok(()) | |
819 | } | |
820 | ||
821 | fn find_unused_frame(&self) -> usize { | |
822 | for fno in 0..4 { | |
823 | if (fno != self.iref_0) && (fno != self.iref_1) && (fno != self.scal_ref) { | |
824 | return fno; | |
825 | } | |
826 | } | |
827 | unreachable!(); | |
828 | } | |
829 | ||
ac818eac | 830 | fn decode_single_frame<'a>(&mut self, dec: &mut dyn IndeoXParser, br: &mut BitReader<'a>) -> DecoderResult<NABufferType> { |
01c971c5 KS |
831 | let pic_hdr = dec.decode_picture_header(br)?; |
832 | self.ftype = pic_hdr.ftype; | |
833 | if pic_hdr.ftype.is_null() { | |
834 | return Ok(NABufferType::None); | |
835 | } | |
836 | ||
837 | self.cur_frame = self.find_unused_frame(); | |
838 | match self.ftype { | |
839 | IVIFrameType::Inter => { | |
840 | self.prev_frame = self.iref_0; | |
841 | if self.prev_frame == MISSING_REF { | |
842 | return Err(DecoderError::MissingReference); | |
843 | } | |
844 | }, | |
845 | IVIFrameType::InterDroppable => { | |
846 | self.prev_frame = self.scal_ref; | |
847 | if self.prev_frame == MISSING_REF { | |
848 | return Err(DecoderError::MissingReference); | |
849 | } | |
850 | }, | |
851 | IVIFrameType::InterScal => { | |
852 | self.prev_frame = self.scal_ref; | |
853 | if self.prev_frame == MISSING_REF { | |
854 | return Err(DecoderError::MissingReference); | |
855 | } | |
856 | }, | |
857 | IVIFrameType::Bidir => { | |
858 | self.prev_frame = self.iref_1; | |
859 | self.next_frame = self.iref_0; | |
860 | if (self.prev_frame == MISSING_REF) || (self.next_frame == MISSING_REF) { | |
861 | return Err(DecoderError::MissingReference); | |
862 | } | |
863 | }, | |
864 | _ => {}, | |
865 | }; | |
866 | ||
f2af8eca | 867 | let mut vinfo = if pic_hdr.transparent { self.vinfoa } else { self.vinfo }; |
01c971c5 KS |
868 | vinfo.set_width(pic_hdr.width); |
869 | vinfo.set_height(pic_hdr.height); | |
870 | let mut buftype = alloc_video_buffer(vinfo, 0)?; | |
871 | self.realloc(&pic_hdr)?; | |
08a1fab7 | 872 | self.frames[self.cur_frame].realloc(&pic_hdr)?; |
01c971c5 KS |
873 | |
874 | for plane in 0..3 { | |
875 | let num_bands = if plane == 0 { pic_hdr.luma_bands } else { pic_hdr.chroma_bands }; | |
876 | for band in 0..num_bands { | |
877 | self.decode_band(&pic_hdr, dec, br, plane, band)?; | |
878 | } | |
879 | if let NABufferType::Video(ref mut vb) = buftype { | |
08a1fab7 | 880 | let mut frame = self.frames[self.cur_frame].clone(); |
01c971c5 KS |
881 | if num_bands == 1 { |
882 | frame.fill_plane(vb, plane); | |
883 | } else { | |
009a04a9 KS |
884 | let dplane = if (plane == 1) || (plane == 2) { plane ^ 3 } else { plane }; |
885 | let (w, h) = vb.get_dimensions(dplane); | |
886 | let dstride = vb.get_stride(dplane); | |
887 | let off = vb.get_offset(dplane); | |
1a967e6b | 888 | let dst = vb.get_data_mut().unwrap(); |
01c971c5 KS |
889 | dec.recombine_plane(&frame.plane_buf[plane], frame.plane_stride[plane], &mut dst[off..], dstride, w, h); |
890 | } | |
891 | } | |
892 | } | |
893 | if pic_hdr.transparent { | |
08a1fab7 | 894 | let mut frame = self.frames[self.cur_frame].clone(); |
01c971c5 KS |
895 | let stride = frame.plane_stride[3]; |
896 | read_trans_band_header(br, pic_hdr.width, pic_hdr.height, &mut frame.plane_buf[3], stride)?; | |
897 | if let NABufferType::Video(ref mut vb) = buftype { | |
898 | frame.fill_plane(vb, 3); | |
899 | } | |
900 | } | |
901 | ||
902 | match self.ftype { | |
92193139 | 903 | IVIFrameType::Intra | IVIFrameType::Intra1 | IVIFrameType::Inter => { |
01c971c5 KS |
904 | self.iref_1 = self.iref_0; |
905 | self.iref_0 = self.cur_frame; | |
906 | self.scal_ref = self.cur_frame; | |
907 | }, | |
ac0bb254 KS |
908 | IVIFrameType::InterScal => { |
909 | self.scal_ref = self.cur_frame; | |
910 | }, | |
01c971c5 KS |
911 | _ => {}, |
912 | }; | |
913 | ||
914 | Ok(buftype) | |
915 | } | |
916 | ||
ac818eac | 917 | pub fn decode_frame<'a>(&mut self, dec: &mut dyn IndeoXParser, br: &mut BitReader<'a>) -> DecoderResult<NABufferType> { |
01c971c5 KS |
918 | let res = self.decode_single_frame(dec, br); |
919 | if res.is_err() { return res; } | |
920 | if (self.ftype == IVIFrameType::Intra) && (br.left() > 16) { | |
921 | loop { | |
922 | if br.left() < 8 { break; } | |
923 | if br.read(8)? == 0 { break; } | |
924 | } | |
925 | loop { | |
926 | if br.left() < 8 { break; } | |
927 | if br.peek(8) != 0 { break; } | |
928 | br.skip(8)?; | |
929 | } | |
930 | if br.left() > 24 { | |
931 | let seq = br.peek(21); | |
932 | if seq == 0xBFFF8 { | |
933 | let res2 = self.decode_single_frame(dec, br); | |
b7c882c1 KS |
934 | if let Ok(res) = res2 { |
935 | self.bref = Some(res); | |
01c971c5 KS |
936 | } |
937 | } | |
938 | self.ftype = IVIFrameType::Intra; | |
939 | } | |
940 | } | |
941 | if let Ok(NABufferType::None) = res { | |
942 | if self.bref.is_some() { | |
943 | let mut bref: Option<NABufferType> = None; | |
944 | mem::swap(&mut bref, &mut self.bref); | |
945 | self.ftype = IVIFrameType::Inter; | |
946 | return Ok(bref.unwrap()); | |
947 | } | |
948 | } | |
949 | res | |
950 | } | |
951 | ||
f9be4e75 KS |
952 | pub fn flush(&mut self) { |
953 | self.prev_frame = MISSING_REF; | |
954 | self.next_frame = MISSING_REF; | |
955 | self.iref_0 = MISSING_REF; | |
956 | self.iref_1 = MISSING_REF; | |
957 | self.scal_ref = MISSING_REF; | |
958 | } | |
959 | ||
f2af8eca | 960 | pub fn is_intra(&self) -> bool { |
01c971c5 KS |
961 | self.ftype.is_intra() |
962 | } | |
f2af8eca | 963 | pub fn get_frame_type(&self) -> FrameType { |
01c971c5 KS |
964 | match self.ftype { |
965 | IVIFrameType::Intra => { FrameType::I }, | |
966 | IVIFrameType::Intra1 => { FrameType::I }, | |
967 | IVIFrameType::Inter => { FrameType::P }, | |
968 | IVIFrameType::InterDroppable => { FrameType::P }, | |
969 | IVIFrameType::InterScal => { FrameType::P }, | |
970 | IVIFrameType::Bidir => { FrameType::B }, | |
971 | _ => { FrameType::Skip }, | |
972 | } | |
973 | } | |
974 | } | |
975 | ||
976 | pub struct RVMap { | |
977 | pub eob_sym: u32, | |
978 | pub esc_sym: u32, | |
979 | pub runtab: [u8; 256], | |
980 | pub valtab: [i8; 256], | |
981 | } | |
982 | ||
983 | impl Clone for RVMap { | |
984 | fn clone(&self) -> RVMap { | |
985 | let mut runtab: [u8; 256] = [0; 256]; | |
986 | let mut valtab: [i8; 256] = [0; 256]; | |
987 | runtab.copy_from_slice(&self.runtab); | |
988 | valtab.copy_from_slice(&self.valtab); | |
f2af8eca | 989 | RVMap { eob_sym: self.eob_sym, esc_sym: self.esc_sym, runtab, valtab } |
01c971c5 KS |
990 | } |
991 | } | |
992 | ||
993 | pub const IVI_ZERO_RVMAP: RVMap = RVMap { eob_sym: 0, esc_sym: 0, runtab: [0; 256], valtab: [0; 256] }; | |
994 | ||
995 | pub static IVI_RVMAPS: [RVMap; 9] = [ | |
996 | RVMap { eob_sym: 5, esc_sym: 2, runtab: [ | |
997 | 1, 1, 0, 1, 1, 0, 1, 1, 2, 2, 1, 1, 1, 1, 3, 3, | |
998 | 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 1, 1, 2, 2, 5, 5, | |
999 | 1, 1, 3, 3, 1, 1, 6, 6, 1, 2, 1, 2, 7, 7, 1, 1, | |
1000 | 8, 8, 1, 1, 4, 2, 1, 4, 2, 1, 3, 3, 1, 1, 1, 9, | |
1001 | 9, 1, 2, 1, 2, 1, 5, 5, 1, 1, 10, 10, 1, 1, 3, 3, | |
1002 | 2, 2, 1, 1, 11, 11, 6, 4, 4, 1, 6, 1, 2, 1, 2, 12, | |
1003 | 8, 1, 12, 7, 8, 7, 1, 16, 1, 16, 1, 3, 3, 13, 1, 13, | |
1004 | 2, 2, 1, 15, 1, 5, 14, 15, 1, 5, 14, 1, 17, 8, 17, 8, | |
1005 | 1, 4, 4, 2, 2, 1, 25, 25, 24, 24, 1, 3, 1, 3, 1, 8, | |
1006 | 6, 7, 6, 1, 18, 8, 18, 1, 7, 23, 2, 2, 23, 1, 1, 21, | |
1007 | 22, 9, 9, 22, 19, 1, 21, 5, 19, 5, 1, 33, 20, 33, 20, 8, | |
1008 | 4, 4, 1, 32, 2, 2, 8, 3, 32, 26, 3, 1, 7, 7, 26, 6, | |
1009 | 1, 6, 1, 1, 16, 1, 10, 1, 10, 2, 16, 29, 28, 2, 29, 28, | |
1010 | 1, 27, 5, 8, 5, 27, 1, 8, 3, 7, 3, 31, 41, 31, 1, 41, | |
1011 | 6, 1, 6, 7, 4, 4, 1, 1, 2, 1, 2, 11, 34, 30, 11, 1, | |
1012 | 30, 15, 15, 34, 36, 40, 36, 40, 35, 35, 37, 37, 39, 39, 38, 38 ], | |
1013 | valtab: [ | |
1014 | 1, -1, 0, 2, -2, 0, 3, -3, 1, -1, 4, -4, 5, -5, 1, -1, | |
1015 | 6, -6, 2, -2, 7, -7, 1, -1, 8, -8, 9, -9, 3, -3, 1, -1, | |
1016 | 10, -10, 2, -2, 11, -11, 1, -1, 12, 4, -12, -4, 1, -1, 13, -13, | |
1017 | 1, -1, 14, -14, 2, 5, 15, -2, -5, -15, -3, 3, 16, -16, 17, 1, | |
1018 | -1, -17, 6, 18, -6, -18, 2, -2, 19, -19, 1, -1, 20, -20, 4, -4, | |
1019 | 7, -7, 21, -21, 1, -1, 2, 3, -3, 22, -2, -22, 8, 23, -8, 1, | |
1020 | 2, -23, -1, 2, -2, -2, 24, 1, -24, -1, 25, 5, -5, 1, -25, -1, | |
1021 | 9, -9, 26, 1, -26, 3, 1, -1, 27, -3, -1, -27, 1, 3, -1, -3, | |
1022 | 28, -4, 4, 10, -10, -28, 1, -1, 1, -1, 29, 6, -29, -6, 30, -4, | |
1023 | 3, 3, -3, -30, 1, 4, -1, 31, -3, 1, 11, -11, -1, -31, 32, -1, | |
1024 | -1, 2, -2, 1, 1, -32, 1, 4, -1, -4, 33, -1, 1, 1, -1, 5, | |
1025 | 5, -5, -33, -1, -12, 12, -5, -7, 1, 1, 7, 34, 4, -4, -1, 4, | |
1026 | -34, -4, 35, 36, -2, -35, -2, -36, 2, 13, 2, -1, 1, -13, 1, -1, | |
1027 | 37, 1, -5, 6, 5, -1, 38, -6, -8, 5, 8, -1, 1, 1, -37, -1, | |
1028 | 5, 39, -5, -5, 6, -6, -38, -39, -14, 40, 14, 2, 1, 1, -2, -40, | |
1029 | -1, -2, 2, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1 ], | |
1030 | }, | |
1031 | RVMap { eob_sym: 0, esc_sym: 38, runtab: [ | |
1032 | 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 8, 6, 8, 7, | |
1033 | 7, 9, 9, 10, 10, 11, 11, 1, 12, 1, 12, 13, 13, 16, 14, 16, | |
1034 | 14, 15, 15, 17, 17, 18, 0, 18, 19, 20, 21, 19, 22, 21, 20, 22, | |
1035 | 25, 24, 2, 25, 24, 23, 23, 2, 26, 28, 26, 28, 29, 27, 29, 27, | |
1036 | 33, 33, 1, 32, 1, 3, 32, 30, 36, 3, 36, 30, 31, 31, 35, 34, | |
1037 | 37, 41, 34, 35, 37, 4, 41, 4, 49, 8, 8, 49, 40, 38, 5, 38, | |
1038 | 40, 39, 5, 39, 42, 43, 42, 7, 57, 6, 43, 44, 6, 50, 7, 44, | |
1039 | 57, 48, 50, 48, 45, 45, 46, 47, 51, 46, 47, 58, 1, 51, 58, 1, | |
1040 | 52, 59, 53, 9, 52, 55, 55, 59, 53, 56, 54, 56, 54, 9, 64, 64, | |
1041 | 60, 63, 60, 63, 61, 62, 61, 62, 2, 10, 2, 10, 11, 1, 11, 13, | |
1042 | 12, 1, 12, 13, 16, 16, 8, 8, 14, 3, 3, 15, 14, 15, 4, 4, | |
1043 | 1, 17, 17, 5, 1, 7, 7, 5, 6, 1, 2, 2, 6, 22, 1, 25, | |
1044 | 21, 22, 8, 24, 1, 21, 25, 24, 8, 18, 18, 23, 9, 20, 23, 33, | |
1045 | 29, 33, 20, 1, 19, 1, 29, 36, 9, 36, 19, 41, 28, 57, 32, 3, | |
1046 | 28, 3, 1, 27, 49, 49, 1, 32, 26, 26, 2, 4, 4, 7, 57, 41, | |
1047 | 2, 7, 10, 5, 37, 16, 10, 27, 8, 8, 13, 16, 37, 13, 1, 5 ], | |
1048 | valtab: [ | |
1049 | 0, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, | |
1050 | -1, 1, -1, 1, -1, 1, -1, 2, 1, -2, -1, 1, -1, 1, 1, -1, | |
1051 | -1, 1, -1, 1, -1, 1, 0, -1, 1, 1, 1, -1, 1, -1, -1, -1, | |
1052 | 1, 1, 2, -1, -1, 1, -1, -2, 1, 1, -1, -1, 1, 1, -1, -1, | |
1053 | 1, -1, 3, 1, -3, 2, -1, 1, 1, -2, -1, -1, -1, 1, 1, 1, | |
1054 | 1, 1, -1, -1, -1, 2, -1, -2, 1, 2, -2, -1, 1, 1, 2, -1, | |
1055 | -1, 1, -2, -1, 1, 1, -1, 2, 1, 2, -1, 1, -2, -1, -2, -1, | |
1056 | -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 4, -1, -1, -4, | |
1057 | 1, 1, 1, 2, -1, -1, 1, -1, -1, 1, -1, -1, 1, -2, 1, -1, | |
1058 | 1, 1, -1, -1, 1, 1, -1, -1, 3, 2, -3, -2, 2, 5, -2, 2, | |
1059 | 2, -5, -2, -2, -2, 2, -3, 3, 2, 3, -3, 2, -2, -2, 3, -3, | |
1060 | 6, 2, -2, 3, -6, 3, -3, -3, 3, 7, -4, 4, -3, 2, -7, 2, | |
1061 | 2, -2, -4, 2, 8, -2, -2, -2, 4, 2, -2, 2, 3, 2, -2, -2, | |
1062 | 2, 2, -2, -8, -2, 9, -2, 2, -3, -2, 2, -2, 2, 2, 2, 4, | |
1063 | -2, -4, 10, 2, 2, -2, -9, -2, 2, -2, 5, 4, -4, 4, -2, 2, | |
1064 | -5, -4, -3, 4, 2, -3, 3, -2, -5, 5, 3, 3, -2, -3, -10, -4 ], | |
1065 | }, | |
1066 | RVMap { eob_sym: 2, esc_sym: 11, runtab: [ | |
1067 | 1, 1, 0, 2, 2, 1, 1, 3, 3, 4, 4, 0, 1, 1, 5, 5, | |
1068 | 2, 2, 6, 6, 7, 7, 1, 8, 1, 8, 3, 3, 9, 9, 1, 2, | |
1069 | 2, 1, 4, 10, 4, 10, 11, 11, 1, 5, 12, 12, 1, 5, 13, 13, | |
1070 | 3, 3, 6, 6, 2, 2, 14, 14, 16, 16, 15, 7, 15, 8, 8, 7, | |
1071 | 1, 1, 17, 17, 4, 4, 1, 1, 18, 18, 2, 2, 5, 5, 25, 3, | |
1072 | 9, 3, 25, 9, 19, 24, 19, 24, 1, 21, 20, 1, 21, 22, 20, 22, | |
1073 | 23, 23, 8, 6, 33, 6, 8, 33, 7, 7, 26, 26, 1, 32, 1, 32, | |
1074 | 28, 4, 28, 10, 29, 27, 27, 10, 41, 4, 29, 2, 2, 41, 36, 31, | |
1075 | 49, 31, 34, 30, 34, 36, 30, 35, 1, 49, 11, 5, 35, 11, 1, 3, | |
1076 | 3, 5, 37, 37, 8, 40, 8, 40, 12, 12, 42, 42, 1, 38, 16, 57, | |
1077 | 1, 6, 16, 39, 38, 6, 7, 7, 13, 13, 39, 43, 2, 43, 57, 2, | |
1078 | 50, 9, 44, 9, 50, 4, 15, 48, 44, 4, 1, 15, 48, 14, 14, 1, | |
1079 | 45, 45, 8, 3, 5, 8, 51, 47, 3, 46, 46, 47, 5, 51, 1, 17, | |
1080 | 17, 58, 1, 58, 2, 52, 52, 2, 53, 7, 59, 6, 6, 56, 53, 55, | |
1081 | 7, 55, 1, 54, 59, 56, 54, 10, 1, 10, 4, 60, 1, 60, 8, 4, | |
1082 | 8, 64, 64, 61, 1, 63, 3, 63, 62, 61, 5, 11, 5, 3, 11, 62 ], | |
1083 | valtab: [ | |
1084 | 1, -1, 0, 1, -1, 2, -2, 1, -1, 1, -1, 0, 3, -3, 1, -1, | |
1085 | 2, -2, 1, -1, 1, -1, 4, 1, -4, -1, 2, -2, 1, -1, 5, 3, | |
1086 | -3, -5, 2, 1, -2, -1, 1, -1, 6, 2, 1, -1, -6, -2, 1, -1, | |
1087 | 3, -3, 2, -2, 4, -4, 1, -1, 1, -1, 1, 2, -1, 2, -2, -2, | |
1088 | 7, -7, 1, -1, 3, -3, 8, -8, 1, -1, 5, -5, 3, -3, 1, 4, | |
1089 | 2, -4, -1, -2, 1, 1, -1, -1, 9, 1, 1, -9, -1, 1, -1, -1, | |
1090 | 1, -1, 3, -3, 1, 3, -3, -1, 3, -3, 1, -1, 10, 1, -10, -1, | |
1091 | 1, 4, -1, 2, 1, -1, 1, -2, 1, -4, -1, 6, -6, -1, 1, 1, | |
1092 | 1, -1, 1, 1, -1, -1, -1, 1, 11, -1, -2, 4, -1, 2, -11, 5, | |
1093 | -5, -4, -1, 1, 4, 1, -4, -1, -2, 2, 1, -1, 12, 1, -2, 1, | |
1094 | -12, 4, 2, 1, -1, -4, 4, -4, 2, -2, -1, 1, 7, -1, -1, -7, | |
1095 | -1, -3, 1, 3, 1, 5, 2, 1, -1, -5, 13, -2, -1, 2, -2, -13, | |
1096 | 1, -1, 5, 6, 5, -5, 1, 1, -6, 1, -1, -1, -5, -1, 14, 2, | |
1097 | -2, 1, -14, -1, 8, 1, -1, -8, 1, 5, 1, 5, -5, 1, -1, 1, | |
1098 | -5, -1, 15, 1, -1, -1, -1, 3, -15, -3, 6, 1, 16, -1, 6, -6, | |
1099 | -6, 1, -1, 1, -16, 1, 7, -1, 1, -1, -6, -3, 6, -7, 3, -1 ] | |
1100 | }, | |
1101 | RVMap { eob_sym: 0, esc_sym: 35, runtab: [ | |
1102 | 0, 1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 5, 5, 6, 6, 7, | |
1103 | 7, 8, 8, 9, 9, 2, 2, 10, 10, 1, 1, 11, 11, 12, 12, 3, | |
1104 | 3, 13, 13, 0, 14, 14, 16, 15, 16, 15, 4, 4, 17, 1, 17, 1, | |
1105 | 5, 5, 18, 18, 2, 2, 6, 6, 8, 19, 7, 8, 7, 19, 20, 20, | |
1106 | 21, 21, 22, 24, 22, 24, 23, 23, 1, 1, 25, 25, 3, 3, 26, 26, | |
1107 | 9, 9, 27, 27, 28, 28, 33, 29, 4, 33, 29, 1, 4, 1, 32, 32, | |
1108 | 2, 2, 31, 10, 30, 10, 30, 31, 34, 34, 5, 5, 36, 36, 35, 41, | |
1109 | 35, 11, 41, 11, 37, 1, 8, 8, 37, 6, 1, 6, 40, 7, 7, 40, | |
1110 | 12, 38, 12, 39, 39, 38, 49, 13, 49, 13, 3, 42, 3, 42, 16, 16, | |
1111 | 43, 43, 14, 14, 1, 1, 44, 15, 44, 15, 2, 2, 57, 48, 50, 48, | |
1112 | 57, 50, 4, 45, 45, 4, 46, 47, 47, 46, 1, 51, 1, 17, 17, 51, | |
1113 | 8, 9, 9, 5, 58, 8, 58, 5, 52, 52, 55, 56, 53, 56, 55, 59, | |
1114 | 59, 53, 54, 1, 6, 54, 7, 7, 6, 1, 2, 3, 2, 3, 64, 60, | |
1115 | 60, 10, 10, 64, 61, 62, 61, 63, 1, 63, 62, 1, 18, 24, 18, 4, | |
1116 | 25, 4, 8, 21, 21, 1, 24, 22, 25, 22, 8, 11, 19, 11, 23, 1, | |
1117 | 20, 23, 19, 20, 5, 12, 5, 1, 16, 2, 12, 13, 2, 13, 1, 16 ], | |
1118 | valtab: [ | |
1119 | 0, 1, -1, 1, -1, 1, -1, 1, -1, 2, -2, 1, -1, 1, -1, 1, | |
1120 | -1, 1, -1, 1, -1, 2, -2, 1, -1, 3, -3, 1, -1, 1, -1, 2, | |
1121 | -2, 1, -1, 0, 1, -1, 1, 1, -1, -1, 2, -2, 1, 4, -1, -4, | |
1122 | 2, -2, 1, -1, -3, 3, 2, -2, 2, 1, 2, -2, -2, -1, 1, -1, | |
1123 | 1, -1, 1, 1, -1, -1, 1, -1, 5, -5, 1, -1, 3, -3, 1, -1, | |
1124 | 2, -2, 1, -1, 1, -1, 1, 1, 3, -1, -1, 6, -3, -6, -1, 1, | |
1125 | 4, -4, 1, 2, 1, -2, -1, -1, 1, -1, 3, -3, 1, -1, 1, 1, | |
1126 | -1, 2, -1, -2, 1, 7, -3, 3, -1, 3, -7, -3, 1, -3, 3, -1, | |
1127 | 2, 1, -2, 1, -1, -1, 1, 2, -1, -2, -4, -1, 4, 1, 2, -2, | |
1128 | 1, -1, -2, 2, 8, -8, -1, 2, 1, -2, -5, 5, 1, -1, -1, 1, | |
1129 | -1, 1, 4, -1, 1, -4, -1, -1, 1, 1, 9, 1, -9, 2, -2, -1, | |
1130 | -4, 3, -3, -4, -1, 4, 1, 4, 1, -1, 1, -1, 1, 1, -1, 1, | |
1131 | -1, -1, -1, 10, 4, 1, 4, -4, -4, -10, 6, 5, -6, -5, 1, -1, | |
1132 | 1, 3, -3, -1, 1, -1, -1, -1, 11, 1, 1, -11, -2, -2, 2, 5, | |
1133 | -2, -5, -5, 2, -2, 12, 2, -2, 2, 2, 5, -3, -2, 3, -2, -12, | |
1134 | -2, 2, 2, 2, -5, 3, 5, 13, -3, 7, -3, -3, -7, 3, -13, 3 ] | |
1135 | }, | |
1136 | RVMap { eob_sym: 0, esc_sym: 34, runtab: [ | |
1137 | 0, 1, 1, 1, 2, 2, 1, 3, 3, 1, 1, 1, 4, 4, 1, 5, | |
1138 | 2, 1, 5, 2, 1, 1, 6, 6, 1, 1, 1, 1, 1, 7, 3, 1, | |
1139 | 2, 3, 0, 1, 2, 7, 1, 1, 1, 8, 1, 1, 8, 1, 1, 1, | |
1140 | 9, 1, 9, 1, 2, 1, 1, 2, 1, 1, 10, 4, 1, 10, 1, 4, | |
1141 | 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 2, 1, 5, 1, 1, 1, | |
1142 | 2, 5, 1, 11, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
1143 | 2, 1, 6, 1, 6, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 12, | |
1144 | 3, 1, 12, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, | |
1145 | 4, 1, 1, 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 2, 1, | |
1146 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 5, | |
1147 | 1, 1, 1, 1, 1, 7, 1, 7, 1, 1, 2, 3, 1, 1, 1, 1, | |
1148 | 5, 1, 1, 1, 1, 1, 1, 2, 13, 1, 1, 1, 1, 1, 1, 1, | |
1149 | 1, 1, 1, 1, 1, 1, 1, 1, 13, 2, 1, 1, 4, 1, 1, 1, | |
1150 | 3, 1, 6, 1, 1, 1, 14, 1, 1, 1, 1, 1, 14, 6, 1, 1, | |
1151 | 1, 1, 15, 2, 4, 1, 2, 3, 15, 1, 1, 1, 8, 1, 1, 8, | |
1152 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1 ], | |
1153 | valtab: [ | |
1154 | 0, 1, -1, 2, 1, -1, -2, 1, -1, 3, -3, 4, 1, -1, -4, 1, | |
1155 | 2, 5, -1, -2, -5, 6, 1, -1, -6, 7, -7, 8, -8, 1, 2, 9, | |
1156 | 3, -2, 0, -9, -3, -1, 10, -10, 11, 1, -11, 12, -1, -12, 13, -13, | |
1157 | 1, 14, -1, -14, 4, 15, -15, -4, 16, -16, 1, 2, 17, -1, -17, -2, | |
1158 | 18, -18, 19, -19, 20, 3, -20, 21, -21, -3, 5, 22, 2, -22, -23, 23, | |
1159 | -5, -2, 24, 1, -24, -1, 25, -25, 26, -26, -27, 27, 28, 29, -28, -29, | |
1160 | 6, 30, 2, -31, -2, -30, 31, -6, -32, 32, 33, -33, 34, -35, -34, 1, | |
1161 | 4, -36, -1, 35, 37, 36, 7, -37, 38, -4, -38, 39, 41, 40, -40, -39, | |
1162 | 3, 42, -43, -41, -7, -42, 43, -3, 44, -44, 45, -45, 46, 47, 8, -47, | |
1163 | -48, -46, 50, -50, 48, 49, 51, -49, 52, -52, 5, -51, -8, -53, 53, 3, | |
1164 | -56, 56, 55, 54, -54, 2, 60, -2, -55, 58, 9, -5, 59, 57, -57, -63, | |
1165 | -3, -58, -60, -61, 61, -59, -62, -9, 1, 64, 62, 69, -64, 63, 65, -67, | |
1166 | -68, 66, -65, 68, -66, -69, 67, -70, -1, 10, 71, -71, 4, 73, 72, 70, | |
1167 | 6, -76, -3, 74, -78, -74, 1, 78, 80, -72, -75, 76, -1, 3, -73, 79, | |
1168 | 75, 77, 1, 11, -4, -79, -10, -6, -1, -77, -83, -80, 2, 81, -84, -2, | |
1169 | 83, -81, 82, -82, 84, -87, -86, 85, -11, -85, 86, -89, 87, -88, 88, 89 ] | |
1170 | }, | |
1171 | RVMap { eob_sym: 2, esc_sym: 33, runtab: [ | |
1172 | 1, 1, 0, 2, 1, 2, 1, 3, 3, 1, 1, 4, 4, 2, 2, 1, | |
1173 | 1, 5, 5, 6, 1, 6, 1, 7, 7, 3, 3, 2, 8, 2, 8, 1, | |
1174 | 1, 0, 9, 9, 1, 1, 10, 4, 10, 4, 11, 11, 2, 1, 2, 1, | |
1175 | 12, 12, 3, 3, 1, 1, 13, 5, 5, 13, 14, 1, 1, 14, 2, 2, | |
1176 | 6, 6, 15, 1, 1, 15, 16, 4, 7, 16, 4, 7, 1, 1, 3, 3, | |
1177 | 8, 8, 2, 2, 1, 1, 17, 17, 1, 1, 18, 18, 5, 5, 2, 2, | |
1178 | 1, 1, 9, 19, 9, 19, 20, 3, 3, 20, 1, 10, 21, 1, 10, 4, | |
1179 | 4, 21, 22, 6, 6, 22, 1, 1, 23, 24, 2, 2, 23, 24, 11, 1, | |
1180 | 1, 11, 7, 25, 7, 1, 1, 25, 8, 8, 3, 26, 3, 1, 12, 2, | |
1181 | 2, 26, 1, 12, 5, 5, 27, 4, 1, 4, 1, 27, 28, 1, 28, 13, | |
1182 | 1, 13, 2, 29, 2, 1, 32, 6, 1, 30, 14, 29, 14, 6, 3, 31, | |
1183 | 3, 1, 30, 1, 32, 31, 33, 9, 33, 1, 1, 7, 9, 7, 2, 2, | |
1184 | 1, 1, 4, 36, 34, 4, 5, 10, 10, 5, 34, 1, 1, 35, 8, 8, | |
1185 | 36, 3, 35, 1, 15, 3, 2, 1, 16, 15, 16, 2, 37, 1, 37, 1, | |
1186 | 1, 1, 6, 6, 38, 1, 38, 11, 1, 39, 39, 40, 11, 2, 41, 4, | |
1187 | 40, 1, 2, 4, 1, 1, 1, 41, 3, 1, 3, 1, 5, 7, 5, 7 ], | |
1188 | valtab: [ | |
1189 | 1, -1, 0, 1, 2, -1, -2, 1, -1, 3, -3, 1, -1, 2, -2, 4, | |
1190 | -4, 1, -1, 1, 5, -1, -5, 1, -1, 2, -2, 3, 1, -3, -1, 6, | |
1191 | -6, 0, 1, -1, 7, -7, 1, 2, -1, -2, 1, -1, 4, 8, -4, -8, | |
1192 | 1, -1, 3, -3, 9, -9, 1, 2, -2, -1, 1, 10, -10, -1, 5, -5, | |
1193 | 2, -2, 1, 11, -11, -1, 1, 3, 2, -1, -3, -2, 12, -12, 4, -4, | |
1194 | 2, -2, -6, 6, 13, -13, 1, -1, 14, -14, 1, -1, 3, -3, 7, -7, | |
1195 | 15, -15, 2, 1, -2, -1, 1, 5, -5, -1, -16, 2, 1, 16, -2, 4, | |
1196 | -4, -1, 1, 3, -3, -1, 17, -17, 1, 1, -8, 8, -1, -1, 2, 18, | |
1197 | -18, -2, 3, 1, -3, 19, -19, -1, 3, -3, 6, 1, -6, 20, 2, 9, | |
1198 | -9, -1, -20, -2, 4, -4, 1, -5, 21, 5, -21, -1, 1, -22, -1, 2, | |
1199 | 22, -2, 10, 1, -10, 23, 1, 4, -23, 1, 2, -1, -2, -4, -7, 1, | |
1200 | 7, -24, -1, 24, -1, -1, 1, 3, -1, -25, 25, 4, -3, -4, 11, -11, | |
1201 | 26, -26, 6, 1, 1, -6, -5, -3, 3, 5, -1, -27, 27, 1, 4, -4, | |
1202 | -1, -8, -1, 28, 2, 8, -12, -28, -2, -2, 2, 12, -1, 29, 1, -29, | |
1203 | 30, -30, 5, -5, 1, -31, -1, 3, 31, -1, 1, 1, -3, -13, 1, -7, | |
1204 | -1, -32, 13, 7, 32, 33, -33, -1, -9, -34, 9, 34, -6, 5, 6, -5 ] | |
1205 | }, | |
1206 | RVMap { eob_sym: 2, esc_sym: 13, runtab: [ | |
1207 | 1, 1, 0, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 0, 2, 2, | |
1208 | 4, 1, 4, 1, 1, 1, 5, 5, 1, 1, 6, 6, 2, 2, 1, 1, | |
1209 | 3, 3, 7, 7, 1, 1, 8, 8, 1, 1, 2, 2, 1, 9, 1, 9, | |
1210 | 4, 4, 10, 1, 1, 10, 1, 1, 11, 11, 3, 3, 1, 2, 1, 2, | |
1211 | 1, 1, 12, 12, 5, 5, 1, 1, 13, 1, 1, 13, 2, 2, 1, 1, | |
1212 | 6, 6, 1, 1, 4, 14, 4, 14, 3, 1, 3, 1, 1, 1, 15, 7, | |
1213 | 15, 2, 2, 7, 1, 1, 1, 8, 1, 8, 16, 16, 1, 1, 1, 1, | |
1214 | 2, 1, 1, 2, 1, 1, 3, 5, 5, 3, 4, 1, 1, 4, 1, 1, | |
1215 | 17, 17, 9, 1, 1, 9, 2, 2, 1, 1, 10, 10, 1, 6, 1, 1, | |
1216 | 6, 18, 1, 1, 18, 1, 1, 1, 2, 2, 3, 1, 3, 1, 1, 1, | |
1217 | 4, 1, 19, 1, 19, 7, 1, 1, 20, 1, 4, 20, 1, 7, 11, 2, | |
1218 | 1, 11, 21, 2, 8, 5, 1, 8, 1, 5, 21, 1, 1, 1, 22, 1, | |
1219 | 1, 22, 1, 1, 3, 3, 1, 23, 2, 12, 24, 1, 1, 2, 1, 1, | |
1220 | 12, 23, 1, 1, 24, 1, 1, 1, 4, 1, 1, 1, 2, 1, 6, 6, | |
1221 | 4, 2, 1, 1, 1, 1, 1, 1, 1, 14, 13, 3, 1, 25, 9, 25, | |
1222 | 14, 1, 9, 3, 13, 1, 1, 1, 1, 1, 10, 1, 1, 2, 10, 2 ], | |
1223 | valtab: [ | |
1224 | -20, -1, 0, 2, -2, 1, -1, 3, -3, 1, -1, 4, -4, 0, 2, -2, | |
1225 | 1, 5, -1, -5, 6, -6, 1, -1, 7, -7, 1, -1, 3, -3, 8, -8, | |
1226 | 2, -2, 1, -1, 9, -9, 1, -1, 10, -10, 4, -4, 11, 1, -11, -1, | |
1227 | 2, -2, 1, 12, -12, -1, 13, -13, 1, -1, 3, -3, 14, 5, -14, -5, | |
1228 | -15, 15, -1, 1, 2, -2, 16, -16, 1, 17, -17, -1, 6, -6, 18, -18, | |
1229 | 2, -2, -19, 19, -3, 1, 3, -1, 4, 20, -4, 1, -21, 21, 1, 2, | |
1230 | -1, -7, 7, -2, 22, -22, 23, 2, -23, -2, 1, -1, -24, 24, -25, 25, | |
1231 | -8, -26, 26, 8, -27, 27, 5, 3, -3, -5, -4, 28, -28, 4, 29, -29, | |
1232 | 1, -1, -2, -30, 30, 2, 9, -9, -31, 31, 2, -2, -32, 3, 32, -33, | |
1233 | -3, 1, 33, -34, -1, 34, -35, 35, -10, 10, -6, 36, 6, -36, 37, -37, | |
1234 | -5, 38, 1, -38, -1, 3, 39, -39, -1, 40, 5, 1, -40, -3, 2, -11, | |
1235 | -41, -2, 1, 11, -3, -4, 41, 3, 42, 4, -1, -43, -42, 43, 1, -44, | |
1236 | 45, -1, 44, -45, -7, 7, -46, 1, -12, 2, 1, -47, 46, 12, 47, 48, | |
1237 | -2, -1, -48, 49, -1, -50, -49, 50, -6, -51, 51, 52, -13, 53, -4, 4, | |
1238 | 6, 13, -53, -52, -54, 55, 54, -55, -56, -2, 2, -8, 56, 1, -3, -1, | |
1239 | 2, 58, 3, 8, -2, 57, -58, -60, -59, -57, -3, 60, 59, -14, 3, 14 ] | |
1240 | }, | |
1241 | RVMap { eob_sym: 2, esc_sym: 38, runtab: [ | |
1242 | 1, 1, 0, 2, 2, 1, 1, 3, 3, 4, 4, 5, 5, 1, 1, 6, | |
1243 | 6, 2, 2, 7, 7, 8, 8, 1, 1, 3, 3, 9, 9, 10, 10, 1, | |
1244 | 1, 2, 2, 4, 4, 11, 0, 11, 12, 12, 13, 13, 1, 1, 5, 5, | |
1245 | 14, 14, 15, 16, 15, 16, 3, 3, 1, 6, 1, 6, 2, 2, 7, 7, | |
1246 | 8, 8, 17, 17, 1, 1, 4, 4, 18, 18, 2, 2, 1, 19, 1, 20, | |
1247 | 19, 20, 21, 21, 3, 3, 22, 22, 5, 5, 24, 1, 1, 23, 9, 23, | |
1248 | 24, 9, 2, 2, 10, 1, 1, 10, 6, 6, 25, 4, 4, 25, 7, 7, | |
1249 | 26, 8, 1, 8, 3, 1, 26, 3, 11, 11, 27, 27, 2, 28, 1, 2, | |
1250 | 28, 1, 12, 12, 5, 5, 29, 13, 13, 29, 32, 1, 1, 33, 31, 30, | |
1251 | 32, 4, 30, 33, 4, 31, 3, 14, 1, 1, 3, 34, 34, 2, 2, 14, | |
1252 | 6, 6, 35, 36, 35, 36, 1, 15, 1, 16, 16, 15, 7, 9, 7, 9, | |
1253 | 37, 8, 8, 37, 1, 1, 39, 2, 38, 39, 2, 40, 5, 38, 40, 5, | |
1254 | 3, 3, 4, 4, 10, 10, 1, 1, 1, 1, 41, 2, 41, 2, 6, 6, | |
1255 | 1, 1, 11, 42, 11, 43, 3, 42, 3, 17, 4, 43, 1, 17, 7, 1, | |
1256 | 8, 44, 4, 7, 44, 5, 8, 2, 5, 1, 2, 48, 45, 1, 12, 45, | |
1257 | 12, 48, 13, 13, 1, 9, 9, 46, 1, 46, 47, 47, 49, 18, 18, 49 ], | |
1258 | valtab: [ | |
1259 | 1, -1, 0, 1, -1, 2, -2, 1, -1, 1, -1, 1, -1, 3, -3, 1, | |
1260 | -1, -2, 2, 1, -1, 1, -1, 4, -4, -2, 2, 1, -1, 1, -1, 5, | |
1261 | -5, -3, 3, 2, -2, 1, 0, -1, 1, -1, 1, -1, 6, -6, 2, -2, | |
1262 | 1, -1, 1, 1, -1, -1, -3, 3, 7, 2, -7, -2, -4, 4, 2, -2, | |
1263 | 2, -2, 1, -1, 8, -8, 3, -3, 1, -1, -5, 5, 9, 1, -9, 1, | |
1264 | -1, -1, 1, -1, -4, 4, 1, -1, 3, -3, 1, -10, 10, 1, 2, -1, | |
1265 | -1, -2, 6, -6, 2, 11, -11, -2, 3, -3, 1, -4, 4, -1, 3, -3, | |
1266 | 1, 3, 12, -3, -5, -12, -1, 5, 2, -2, 1, -1, -7, 1, 13, 7, | |
1267 | -1, -13, 2, -2, 4, -4, 1, 2, -2, -1, 1, 14, -14, 1, 1, 1, | |
1268 | -1, -5, -1, -1, 5, -1, -6, 2, -15, 15, 6, 1, -1, -8, 8, -2, | |
1269 | -4, 4, 1, 1, -1, -1, 16, 2, -16, -2, 2, -2, 4, 3, -4, -3, | |
1270 | -1, -4, 4, 1, -17, 17, -1, -9, 1, 1, 9, 1, -5, -1, -1, 5, | |
1271 | -7, 7, 6, -6, 3, -3, 18, -18, 19, -19, 1, -10, -1, 10, -5, 5, | |
1272 | 20, -20, -3, 1, 3, 1, 8, -1, -8, 2, 7, -1, -21, -2, 5, 21, | |
1273 | 5, -1, -7, -5, 1, -6, -5, -11, 6, 22, 11, 1, 1, -22, -3, -1, | |
1274 | 3, -1, 3, -3, -23, 4, -4, 1, 23, -1, 1, -1, 1, -2, 2, -1 ] | |
1275 | }, | |
1276 | RVMap { eob_sym: 4, esc_sym: 11, runtab: [ | |
1277 | 1, 1, 1, 1, 0, 2, 2, 1, 1, 3, 3, 0, 1, 1, 2, 2, | |
1278 | 4, 4, 1, 1, 5, 5, 1, 1, 2, 2, 3, 3, 6, 6, 1, 1, | |
1279 | 7, 7, 8, 1, 8, 2, 2, 1, 4, 4, 1, 3, 1, 3, 9, 9, | |
1280 | 2, 2, 1, 5, 1, 5, 10, 10, 1, 1, 11, 11, 3, 6, 3, 4, | |
1281 | 4, 6, 2, 2, 1, 12, 1, 12, 7, 13, 7, 13, 1, 1, 8, 8, | |
1282 | 2, 2, 14, 14, 16, 15, 16, 5, 5, 1, 3, 15, 1, 3, 4, 4, | |
1283 | 1, 1, 17, 17, 2, 2, 6, 6, 1, 18, 1, 18, 22, 21, 22, 21, | |
1284 | 25, 24, 25, 19, 9, 20, 9, 23, 19, 24, 20, 3, 23, 7, 3, 1, | |
1285 | 1, 7, 28, 26, 29, 5, 28, 26, 5, 8, 29, 4, 8, 27, 2, 2, | |
1286 | 4, 27, 1, 1, 10, 36, 10, 33, 33, 36, 30, 1, 32, 32, 1, 30, | |
1287 | 6, 31, 31, 35, 3, 6, 11, 11, 3, 2, 35, 2, 34, 1, 34, 1, | |
1288 | 37, 37, 12, 7, 12, 5, 41, 5, 4, 7, 1, 8, 13, 4, 1, 41, | |
1289 | 13, 38, 8, 38, 9, 1, 40, 40, 9, 1, 39, 2, 2, 49, 39, 42, | |
1290 | 3, 3, 14, 16, 49, 14, 16, 42, 43, 43, 6, 6, 15, 1, 1, 15, | |
1291 | 44, 44, 1, 1, 50, 48, 4, 5, 4, 7, 5, 2, 10, 10, 48, 7, | |
1292 | 50, 45, 2, 1, 45, 8, 8, 1, 46, 46, 3, 47, 47, 3, 1, 1 ], | |
1293 | valtab: [ | |
1294 | 1, -1, 2, -2, 0, 1, -1, 3, -3, 1, -1, 0, 4, -4, 2, -2, | |
1295 | 1, -1, 5, -5, 1, -1, 6, -6, 3, -3, 2, -2, 1, -1, 7, -7, | |
1296 | 1, -1, 1, 8, -1, 4, -4, -8, 2, -2, 9, 3, -9, -3, 1, -1, | |
1297 | 5, -5, 10, 2, -10, -2, 1, -1, 11, -11, 1, -1, -4, 2, 4, 3, | |
1298 | -3, -2, 6, -6, 12, 1, -12, -1, 2, 1, -2, -1, 13, -13, 2, -2, | |
1299 | 7, -7, 1, -1, 1, 1, -1, 3, -3, 14, 5, -1, -14, -5, 4, -4, | |
1300 | 15, -15, 1, -1, 8, -8, -3, 3, 16, 1, -16, -1, 1, 1, -1, -1, | |
1301 | 1, 1, -1, 1, 2, 1, -2, 1, -1, -1, -1, 6, -1, 3, -6, 17, | |
1302 | -17, -3, 1, 1, 1, 4, -1, -1, -4, 3, -1, 5, -3, -1, -9, 9, | |
1303 | -5, 1, 18, -18, 2, 1, -2, 1, -1, -1, 1, 19, -1, 1, -19, -1, | |
1304 | 4, 1, -1, 1, 7, -4, -2, 2, -7, 10, -1, -10, 1, 20, -1, -20, | |
1305 | 1, -1, 2, 4, -2, 5, 1, -5, 6, -4, 21, 4, 2, -6, -21, -1, | |
1306 | -2, 1, -4, -1, -3, 22, -1, 1, 3, -22, -1, 11, -11, 1, 1, 1, | |
1307 | 8, -8, 2, 2, -1, -2, -2, -1, 1, -1, -5, 5, 2, 23, -23, -2, | |
1308 | 1, -1, 24, -24, -1, -1, 7, 6, -7, 5, -6, 12, -3, 3, 1, -5, | |
1309 | 1, 1, -12, 25, -1, -5, 5, -25, -1, 1, 9, 1, -1, -9, 26, -26 ] | |
1310 | } | |
1311 | ]; |