]>
Commit | Line | Data |
---|---|---|
1 | use formats; | |
2 | use super::super::*; | |
3 | use io::byteio::*; | |
4 | use std::io::SeekFrom; | |
5 | use std::mem; | |
6 | ||
7 | struct IviDeltaCB { | |
8 | quad_radix: u8, | |
9 | data: &'static [i8], | |
10 | } | |
11 | ||
12 | #[derive(Clone, Copy)] | |
13 | struct MV { | |
14 | x: i8, | |
15 | y: i8 | |
16 | } | |
17 | ||
18 | struct Buffers { | |
19 | width: usize, | |
20 | height: usize, | |
21 | buf1: Vec<u8>, | |
22 | buf2: Vec<u8>, | |
23 | fbuf: bool, | |
24 | } | |
25 | ||
26 | const DEFAULT_PIXEL: u8 = 0x40; | |
27 | ||
28 | impl Buffers { | |
29 | fn new() -> Self { Buffers { width: 0, height: 0, buf1: Vec::new(), buf2: Vec::new(), fbuf: true } } | |
30 | fn reset(&mut self) { | |
31 | self.width = 0; | |
32 | self.height = 0; | |
33 | self.buf1.truncate(0); | |
34 | self.buf2.truncate(0); | |
35 | } | |
36 | fn alloc(&mut self, w: usize, h: usize) { | |
37 | self.width = w; | |
38 | self.height = h; | |
39 | self.buf1.resize(w * h + (w >> 2) * (h >> 2) * 2, DEFAULT_PIXEL); | |
40 | self.buf2.resize(w * h + (w >> 2) * (h >> 2) * 2, DEFAULT_PIXEL); | |
41 | } | |
42 | fn flip(&mut self) { self.fbuf = !self.fbuf; } | |
43 | fn get_stride(&mut self, planeno: usize) -> usize { | |
44 | if planeno == 0 { self.width } else { self.width >> 2 } | |
45 | } | |
46 | fn get_offset(&mut self, planeno: usize) -> usize { | |
47 | match planeno { | |
48 | 1 => self.width * self.height, | |
49 | 2 => self.width * self.height + (self.width >> 2) * (self.height >> 2), | |
50 | _ => 0, | |
51 | } | |
52 | } | |
53 | fn fill_framebuf(&mut self, fbuf: &mut NAVideoBuffer<u8>) { | |
54 | for planeno in 0..3 { | |
55 | let mut soff = self.get_offset(planeno); | |
56 | let mut doff = fbuf.get_offset(planeno); | |
57 | let sstride = self.get_stride(planeno); | |
58 | let dstride = fbuf.get_stride(planeno); | |
59 | let width = if planeno == 0 { self.width } else { self.width >> 2 }; | |
60 | let height = if planeno == 0 { self.height } else { self.height >> 2 }; | |
61 | let src = if self.fbuf { &self.buf1[0..] } else { &self.buf2[0..] }; | |
62 | let mut dst = fbuf.get_data_mut(); | |
63 | for _ in 0..height { | |
64 | for x in 0..width { | |
65 | dst[doff + x] = src[soff + x] * 2; | |
66 | } | |
67 | soff += sstride; | |
68 | doff += dstride; | |
69 | } | |
70 | } | |
71 | } | |
72 | fn copy_block(&mut self, doff: usize, soff: usize, stride: usize, w: usize, h: usize) { | |
73 | let mut sidx = soff; | |
74 | let mut didx = doff; | |
75 | if self.fbuf { | |
76 | for _ in 0..h { | |
77 | for i in 0..w { self.buf1[didx + i] = self.buf2[sidx + i]; } | |
78 | sidx += stride; | |
79 | didx += stride; | |
80 | } | |
81 | } else { | |
82 | for _ in 0..h { | |
83 | for i in 0..w { self.buf2[didx + i] = self.buf1[sidx + i]; } | |
84 | sidx += stride; | |
85 | didx += stride; | |
86 | } | |
87 | } | |
88 | } | |
89 | fn fill_block(&mut self, doff: usize, stride: usize, w: usize, h: usize, topline: bool) { | |
90 | let mut didx = doff; | |
91 | let mut buf: [u8; 8] = [0; 8]; | |
92 | if topline { | |
93 | if self.fbuf { | |
94 | for _ in 0..h { | |
95 | for i in 0..w { self.buf1[didx + i] = DEFAULT_PIXEL; } | |
96 | didx += stride; | |
97 | } | |
98 | } else { | |
99 | for _ in 0..h { | |
100 | for i in 0..w { self.buf2[didx + i] = DEFAULT_PIXEL; } | |
101 | didx += stride; | |
102 | } | |
103 | } | |
104 | } else { | |
105 | if self.fbuf { | |
106 | for i in 0..w { buf[i] = self.buf1[didx - stride + i]; } | |
107 | for _ in 0..h { | |
108 | for i in 0..w { self.buf1[didx + i] = buf[i]; } | |
109 | didx += stride; | |
110 | } | |
111 | } else { | |
112 | for i in 0..w { buf[i] = self.buf2[didx - stride + i]; } | |
113 | for _ in 0..h { | |
114 | for i in 0..w { self.buf2[didx + i] = buf[i]; } | |
115 | didx += stride; | |
116 | } | |
117 | } | |
118 | } | |
119 | } | |
120 | } | |
121 | ||
122 | #[allow(unused_variables)] | |
123 | fn apply_delta4x4(bufs: &mut Buffers, off: usize, stride: usize, | |
124 | deltas: &[u8], topline: bool, first_line: bool) { | |
125 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 4)] } | |
126 | else { &mut bufs.buf2[off..(off + 4)] }; | |
127 | for i in 0..4 { dst[i] = dst[i].wrapping_add(deltas[i]) & 0x7F; } | |
128 | } | |
129 | ||
130 | #[allow(unused_variables)] | |
131 | fn apply_delta4x8(bufs: &mut Buffers, off: usize, stride: usize, | |
132 | deltas: &[u8], topline: bool, first_line: bool) { | |
133 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 4 + stride)] } | |
134 | else { &mut bufs.buf2[off..(off + 4 + stride)] }; | |
135 | for i in 0..4 { dst[i + stride] = dst[i].wrapping_add(deltas[i]) & 0x7F; } | |
136 | if !topline { | |
137 | for i in 0..4 { dst[i] = (dst[i + stride] + dst[i]) >> 1; } | |
138 | } else { | |
139 | for i in 0..4 { dst[i] = dst[i + stride]; } | |
140 | } | |
141 | } | |
142 | ||
143 | #[allow(unused_variables)] | |
144 | fn apply_delta4x8m11(bufs: &mut Buffers, off: usize, stride: usize, | |
145 | deltas: &[u8], topline: bool, first_line: bool) { | |
146 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 4 + stride)] } | |
147 | else { &mut bufs.buf2[off..(off + 4 + stride)] }; | |
148 | for i in 0..4 { dst[i] = dst[i] .wrapping_add(deltas[i]) & 0x7F; } | |
149 | for i in 0..4 { dst[i + stride] = dst[i + stride].wrapping_add(deltas[i]) & 0x7F; } | |
150 | } | |
151 | ||
152 | #[allow(unused_variables)] | |
153 | fn apply_delta8x8p(bufs: &mut Buffers, off: usize, stride: usize, | |
154 | deltas: &[u8], topline: bool, first_line: bool) { | |
155 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 8 + stride)] } | |
156 | else { &mut bufs.buf2[off..(off + 8 + stride)] }; | |
157 | for i in 0..8 { dst[i] = dst[i] .wrapping_add(deltas[i >> 1]) & 0x7F; } | |
158 | for i in 0..8 { dst[i + stride] = dst[i + stride].wrapping_add(deltas[i >> 1]) & 0x7F; } | |
159 | } | |
160 | ||
161 | fn apply_delta8x8i(bufs: &mut Buffers, off: usize, stride: usize, | |
162 | deltas: &[u8], topline: bool, firstline: bool) { | |
163 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 8 + stride)] } | |
164 | else { &mut bufs.buf2[off..(off + 8 + stride)] }; | |
165 | if !firstline { | |
166 | for i in 0..8 { dst[i + stride] = dst[i ].wrapping_add(deltas[i >> 1]) & 0x7F; } | |
167 | } else { | |
168 | for i in 0..8 { dst[i + stride] = dst[i & !1].wrapping_add(deltas[i >> 1]) & 0x7F; } | |
169 | } | |
170 | if !topline { | |
171 | for i in 0..8 { dst[i] = (dst[i + stride] + dst[i]) >> 1; } | |
172 | } else { | |
173 | for i in 0..8 { dst[i] = dst[i + stride]; } | |
174 | } | |
175 | } | |
176 | ||
177 | fn copy_line_top(bufs: &mut Buffers, off: usize, stride: usize, bw: usize, topline: bool) { | |
178 | let mut buf: [u8; 8] = [0; 8]; | |
179 | if !topline { | |
180 | let src = if bufs.fbuf { &bufs.buf1[(off - stride)..(off - stride + bw)] } | |
181 | else { &bufs.buf2[(off - stride)..(off - stride + bw)] }; | |
182 | for i in 0..bw { buf[i] = src[i]; } | |
183 | } else { | |
184 | for i in 0..bw { buf[i] = DEFAULT_PIXEL; } | |
185 | } | |
186 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + bw)] } | |
187 | else { &mut bufs.buf2[off..(off + bw)] }; | |
188 | for i in 0..bw { dst[i] = buf[i]; } | |
189 | } | |
190 | ||
191 | fn copy_line_top4x4(bufs: &mut Buffers, off: usize, stride: usize, topline: bool) { | |
192 | copy_line_top(bufs, off, stride, 4, topline); | |
193 | } | |
194 | ||
195 | fn copy_line_top4x8(bufs: &mut Buffers, off: usize, stride: usize, topline: bool) { | |
196 | copy_line_top(bufs, off, stride, 4, topline); | |
197 | copy_line_top(bufs, off + stride, stride, 4, false); | |
198 | } | |
199 | ||
200 | fn copy_line_top8x8(bufs: &mut Buffers, off: usize, stride: usize, topline: bool) { | |
201 | let mut buf: [u8; 8] = [0; 8]; | |
202 | if !topline { | |
203 | let src = if bufs.fbuf { &bufs.buf1[(off - stride)..(off - stride + 8)] } | |
204 | else { &bufs.buf2[(off - stride)..(off - stride + 8)] }; | |
205 | for i in 0..8 { buf[i] = src[i & !1]; } | |
206 | } else { | |
207 | for i in 0..8 { buf[i] = DEFAULT_PIXEL; } | |
208 | } | |
209 | let mut dst = if bufs.fbuf { &mut bufs.buf1[off..(off + 8)] } | |
210 | else { &mut bufs.buf2[off..(off + 8)] }; | |
211 | for i in 0..8 {dst[i] = buf[i]; } | |
212 | } | |
213 | ||
214 | fn fill_block8x8(bufs: &mut Buffers, doff: usize, stride: usize, h: usize, topline: bool, firstline: bool) { | |
215 | let mut didx = doff; | |
216 | let mut buf: [u8; 8] = [0; 8]; | |
217 | if firstline { | |
218 | for i in 0..8 { buf[i] = DEFAULT_PIXEL; } | |
219 | } else if bufs.fbuf { | |
220 | for i in 0..8 { buf[i] = bufs.buf1[doff - stride + i]; } | |
221 | } else { | |
222 | for i in 0..8 { buf[i] = bufs.buf1[doff - stride + i]; } | |
223 | } | |
224 | if topline && !firstline { | |
225 | for i in 0..4 { buf[i * 2 + 1] = buf[i * 2]; } | |
226 | if bufs.fbuf { | |
227 | for i in 0..8 { bufs.buf1[doff + i] = (bufs.buf1[doff - stride + i] + buf[i]) >> 1; } | |
228 | } else { | |
229 | for i in 0..8 { bufs.buf2[doff + i] = (bufs.buf2[doff - stride + i] + buf[i]) >> 1; } | |
230 | } | |
231 | } | |
232 | ||
233 | let start = if !topline { 0 } else { 1 }; | |
234 | if bufs.fbuf { | |
235 | for _ in start..h { | |
236 | for i in 0..8 { bufs.buf1[didx + i] = buf[i]; } | |
237 | didx += stride; | |
238 | } | |
239 | } else { | |
240 | for _ in start..h { | |
241 | for i in 0..8 { bufs.buf2[didx + i] = buf[i]; } | |
242 | didx += stride; | |
243 | } | |
244 | } | |
245 | } | |
246 | ||
247 | struct Indeo3Decoder { | |
248 | info: Rc<NACodecInfo>, | |
249 | bpos: u8, | |
250 | bbuf: u8, | |
251 | width: u16, | |
252 | height: u16, | |
253 | mvs: Vec<MV>, | |
254 | altquant: [u8; 16], | |
255 | vq_offset: u8, | |
256 | bufs: Buffers, | |
257 | } | |
258 | ||
259 | #[derive(Clone,Copy)] | |
260 | struct IV3Cell { | |
261 | x: u16, | |
262 | y: u16, | |
263 | w: u16, | |
264 | h: u16, | |
265 | d: u8, | |
266 | vqt: bool, | |
267 | mv: Option<MV>, | |
268 | } | |
269 | ||
270 | impl IV3Cell { | |
271 | fn new(w: u16, h: u16) -> Self { | |
272 | IV3Cell { x: 0, y: 0, w: w, h: h, d: 20, vqt: false, mv: None } | |
273 | } | |
274 | fn split_h(&self) -> (Self, Self) { | |
275 | let h1 = if self.h > 2 { ((self.h + 2) >> 2) << 1 } else { 1 }; | |
276 | let h2 = self.h - h1; | |
277 | let mut cell1 = *self; | |
278 | cell1.h = h1; | |
279 | cell1.d -= 1; | |
280 | let mut cell2 = *self; | |
281 | cell2.y += h1; | |
282 | cell2.h = h2; | |
283 | cell2.d -= 1; | |
284 | (cell1, cell2) | |
285 | } | |
286 | fn split_w(&self, stripw: u16) -> (Self, Self) { | |
287 | let w1 = if self.w > stripw { | |
288 | if self.w > stripw * 2 { stripw * 2 } else { stripw } | |
289 | } else { | |
290 | if self.w > 2 { ((self.w + 2) >> 2) << 1 } else { 1 } | |
291 | }; | |
292 | let w2 = self.w - w1; | |
293 | let mut cell1 = *self; | |
294 | cell1.w = w1; | |
295 | cell1.d -= 1; | |
296 | let mut cell2 = *self; | |
297 | cell2.x += w1; | |
298 | cell2.w = w2; | |
299 | cell2.d -= 1; | |
300 | (cell1, cell2) | |
301 | } | |
302 | fn no_mv(&self) -> bool { match self.mv { None => true, Some(_) => false } } | |
303 | } | |
304 | ||
305 | struct CellDecParams { | |
306 | tab: [usize; 2], | |
307 | bw: u16, | |
308 | bh: u16, | |
309 | swap_q: [bool; 2], | |
310 | hq: bool, | |
311 | apply_delta: fn (&mut Buffers, usize, usize, &[u8], bool, bool), | |
312 | copy_line_top: fn (&mut Buffers, usize, usize, bool), | |
313 | } | |
314 | ||
315 | const FRMH_TAG: u32 = ((b'F' as u32) << 24) | ((b'R' as u32) << 16) | |
316 | | ((b'M' as u32) << 8) | (b'H' as u32); | |
317 | ||
318 | const H_SPLIT: u8 = 0; | |
319 | const V_SPLIT: u8 = 1; | |
320 | const SKIP_OR_TREE: u8 = 2; | |
321 | ||
322 | impl Indeo3Decoder { | |
323 | fn new() -> Self { | |
324 | let dummy_info = Rc::new(DUMMY_CODEC_INFO); | |
325 | Indeo3Decoder { info: dummy_info, bpos: 0, bbuf: 0, width: 0, height: 0, | |
326 | mvs: Vec::new(), altquant: [0; 16], | |
327 | vq_offset: 0, bufs: Buffers::new() } | |
328 | } | |
329 | ||
330 | fn br_reset(&mut self) { | |
331 | self.bpos = 0; | |
332 | self.bbuf = 0; | |
333 | } | |
334 | ||
335 | fn get_2bits(&mut self, br: &mut ByteReader) -> DecoderResult<u8> { | |
336 | if self.bpos == 0 { | |
337 | self.bbuf = br.read_byte()?; | |
338 | self.bpos = 8; | |
339 | } | |
340 | self.bpos -= 2; | |
341 | Ok((self.bbuf >> self.bpos) & 0x3) | |
342 | } | |
343 | ||
344 | fn decode_cell_data(&mut self, br: &mut ByteReader, cell: IV3Cell, | |
345 | off: usize, stride: usize, params: CellDecParams) -> DecoderResult<()> { | |
346 | let blk_w = cell.w * 4 / params.bw; | |
347 | let blk_h = cell.h * 4 / params.bh; | |
348 | let scale: usize = if params.bh == 4 { 1 } else { 2 }; | |
349 | ||
350 | validate!((((cell.w * 4) % params.bw) == 0) && (((cell.h * 4) % params.bh) == 0)); | |
351 | ||
352 | let mut run_blocks = 0; | |
353 | let mut run_skip = false; | |
354 | ||
355 | let mut didx: usize = ((cell.x*4) as usize) + ((cell.y * 4) as usize) * stride + off; | |
356 | let mut sidx: usize; | |
357 | if cell.no_mv() { | |
358 | sidx = 0; | |
359 | } else { | |
360 | let mv = cell.mv.unwrap(); | |
361 | let mx = mv.x as i16; | |
362 | let my = mv.y as i16; | |
363 | let l = (cell.x as i16) * 4 + mx; | |
364 | let t = (cell.y as i16) * 4 + my; | |
365 | let r = ((cell.x + cell.w) as i16) * 4 + mx; | |
366 | let b = ((cell.y + cell.h) as i16) * 4 + my; | |
367 | validate!(l >= 0); | |
368 | validate!(t >= 0); | |
369 | validate!(r <= (self.width as i16)); | |
370 | validate!(b <= (self.height as i16)); | |
371 | sidx = (l as usize) + (t as usize) * stride + off; | |
372 | } | |
373 | for y in 0..blk_h { | |
374 | let mut xoff: usize = 0; | |
375 | for _ in 0..blk_w { | |
376 | if run_blocks > 0 { | |
377 | if !run_skip || !cell.no_mv() { | |
378 | if !(params.bw == 8 && cell.no_mv()) { | |
379 | if !cell.no_mv() { | |
380 | self.bufs.copy_block(didx + xoff, sidx + xoff, stride, | |
381 | params.bw as usize, params.bh as usize); | |
382 | } else { | |
383 | self.bufs.fill_block(didx + xoff, stride, | |
384 | params.bw as usize, params.bh as usize, | |
385 | (cell.y == 0) && (y == 0)); | |
386 | } | |
387 | } else { | |
388 | fill_block8x8(&mut self.bufs, | |
389 | didx + xoff, stride, 8, | |
390 | (y == 0), (cell.y == 0) && (y == 0)); | |
391 | } | |
392 | } | |
393 | run_blocks -= 1; | |
394 | } else { | |
395 | let mut line: usize = 0; | |
396 | while line < 4 { | |
397 | let c = br.read_byte()?; | |
398 | if c < 0xF8 { | |
399 | let delta_tab = if params.hq { | |
400 | IVI3_DELTA_CBS[params.tab[line & 1]] | |
401 | } else { | |
402 | IVI3_DELTA_CBS[params.tab[1]] | |
403 | }; | |
404 | let mut idx1; | |
405 | let mut idx2; | |
406 | if (c as usize) < delta_tab.data.len()/2 { | |
407 | idx1 = br.read_byte()? as usize; | |
408 | validate!(idx1 < delta_tab.data.len()); | |
409 | idx2 = c as usize; | |
410 | } else { | |
411 | let tmp = (c as usize) - delta_tab.data.len()/2; | |
412 | idx1 = tmp / (delta_tab.quad_radix as usize); | |
413 | idx2 = tmp % (delta_tab.quad_radix as usize); | |
414 | if params.swap_q[line & 1] { | |
415 | mem::swap(&mut idx1, &mut idx2); | |
416 | } | |
417 | } | |
418 | let deltas: [u8; 4] = [delta_tab.data[idx1 * 2] as u8, | |
419 | delta_tab.data[idx1 * 2 + 1] as u8, | |
420 | delta_tab.data[idx2 * 2 + 0] as u8, | |
421 | delta_tab.data[idx2 * 2 + 1] as u8]; | |
422 | let topline = (cell.y == 0) && (y == 0) && (line == 0); | |
423 | let first_line = (y == 0) && (line == 0); | |
424 | if cell.no_mv() { | |
425 | (params.copy_line_top)(&mut self.bufs, | |
426 | didx + xoff + line * scale * stride, | |
427 | stride, topline); | |
428 | } else { | |
429 | self.bufs.copy_block(didx + xoff + line * scale * stride, | |
430 | sidx + xoff + line * scale * stride, | |
431 | stride, params.bw as usize, scale); | |
432 | } | |
433 | (params.apply_delta)(&mut self.bufs, | |
434 | didx + xoff + line * scale * stride, | |
435 | stride, &deltas, topline, first_line); | |
436 | line += 1; | |
437 | } else { | |
438 | let mut tocopy: usize = 0; | |
439 | let mut do_copy = true; | |
440 | if c == 0xF8 { return Err(DecoderError::InvalidData); } | |
441 | if c == 0xF9 { | |
442 | run_blocks = 1; | |
443 | run_skip = true; | |
444 | validate!(line == 0); | |
445 | tocopy = 4; | |
446 | do_copy = !cell.no_mv(); | |
447 | } | |
448 | if c == 0xFA { | |
449 | validate!(line == 0); | |
450 | tocopy = 4; | |
451 | do_copy = !cell.no_mv(); | |
452 | } | |
453 | if c == 0xFB { | |
454 | let c = br.read_byte()?; | |
455 | validate!((c < 64) && ((c & 0x1F) != 0)); | |
456 | run_blocks = (c & 0x1F) - 1; | |
457 | run_skip = (c & 0x20) != 0; | |
458 | tocopy = 4 - line; | |
459 | if params.bw == 4 && cell.no_mv() && run_skip { | |
460 | do_copy = false; | |
461 | } | |
462 | } | |
463 | if c == 0xFC { | |
464 | run_skip = false; | |
465 | run_blocks = 1; | |
466 | tocopy = 4 - line; | |
467 | } | |
468 | if c >= 0xFD { | |
469 | let nl = 257 - (c as i16) - (line as i16); | |
470 | validate!(nl > 0); | |
471 | tocopy = nl as usize; | |
472 | } | |
473 | if do_copy { | |
474 | if !(params.bw == 8 && cell.no_mv()) { | |
475 | if !cell.no_mv() { | |
476 | self.bufs.copy_block(didx + xoff + line * scale * stride, | |
477 | sidx + xoff + line * scale * stride, | |
478 | stride, params.bw as usize, | |
479 | tocopy * scale); | |
480 | } else { | |
481 | self.bufs.fill_block(didx + xoff + line * scale * stride, | |
482 | stride, params.bw as usize, | |
483 | tocopy * scale, | |
484 | (cell.y == 0) && (y == 0) && (line == 0)); | |
485 | } | |
486 | } else { | |
487 | fill_block8x8(&mut self.bufs, | |
488 | didx + xoff + line * 2 * stride, | |
489 | stride, tocopy * 2, | |
490 | (y == 0) && (line == 0), | |
491 | (cell.y == 0) && (y == 0) && (line == 0)); | |
492 | } | |
493 | } | |
494 | line += tocopy; | |
495 | } | |
496 | } | |
497 | } | |
498 | xoff += params.bw as usize; | |
499 | } | |
500 | didx += stride * (params.bh as usize); | |
501 | sidx += stride * (params.bh as usize); | |
502 | } | |
503 | Ok(()) | |
504 | } | |
505 | ||
506 | fn copy_cell(&mut self, cell: IV3Cell, off: usize, stride: usize) -> DecoderResult<()> { | |
507 | if cell.no_mv() { return Err(DecoderError::InvalidData); } | |
508 | let mv = cell.mv.unwrap(); | |
509 | let mx = mv.x as i16; | |
510 | let my = mv.y as i16; | |
511 | let l = (cell.x as i16) * 4 + mx; | |
512 | let t = (cell.y as i16) * 4 + my; | |
513 | let r = ((cell.x + cell.w) as i16) * 4 + mx; | |
514 | let b = ((cell.y + cell.h) as i16) * 4 + my; | |
515 | validate!(l >= 0); | |
516 | validate!(t >= 0); | |
517 | validate!(r <= (self.width as i16)); | |
518 | validate!(b <= (self.height as i16)); | |
519 | let sidx: usize = off + (l as usize) + (t as usize) * stride; | |
520 | let didx: usize = off + ((cell.x * 4) as usize) + ((cell.y * 4) as usize) * stride; | |
521 | self.bufs.copy_block(didx, sidx, stride, (cell.w * 4) as usize, (cell.h * 4) as usize); | |
522 | Ok(()) | |
523 | } | |
524 | ||
525 | fn decode_cell(&mut self, br: &mut ByteReader, cell: IV3Cell, off: usize, | |
526 | stride: usize, intra: bool) -> DecoderResult<()> { | |
527 | let code = br.read_byte()?; | |
528 | let mode = code >> 4; | |
529 | let vq_idx = code & 0xF; | |
530 | ||
531 | let mut idx1: usize = vq_idx as usize; | |
532 | let mut idx2: usize = vq_idx as usize; | |
533 | if (mode == 1) || (mode == 4) { | |
534 | let c = self.altquant[vq_idx as usize]; | |
535 | idx1 = (c >> 4) as usize; | |
536 | idx2 = (c & 0xF) as usize; | |
537 | } | |
538 | ||
539 | idx1 += self.vq_offset as usize; | |
540 | idx2 += self.vq_offset as usize; | |
541 | validate!((idx1 < 24) && (idx2 < 24)); | |
542 | ||
543 | let mut cp = CellDecParams { | |
544 | tab: [idx2, idx1], | |
545 | bw: 0, bh: 0, | |
546 | swap_q: [idx2 >= 16, idx1 >= 16], | |
547 | hq: false, | |
548 | apply_delta: apply_delta4x4, | |
549 | copy_line_top: copy_line_top4x4, | |
550 | }; | |
551 | if (mode == 0) || (mode == 1) { | |
552 | cp.bw = 4; | |
553 | cp.bh = 4; | |
554 | cp.hq = true; | |
555 | } else if (mode == 3) || (mode == 4) { | |
556 | if !cell.no_mv() { return Err(DecoderError::InvalidData); } | |
557 | cp.bw = 4; | |
558 | cp.bh = 8; | |
559 | cp.hq = true; | |
560 | cp.apply_delta = apply_delta4x8; | |
561 | cp.copy_line_top = copy_line_top4x8; | |
562 | } else if mode == 10 { | |
563 | if !cell.no_mv() { | |
564 | validate!(!intra); | |
565 | cp.apply_delta = apply_delta8x8p; | |
566 | } else { | |
567 | cp.apply_delta = apply_delta8x8i; | |
568 | } | |
569 | cp.bw = 8; | |
570 | cp.bh = 8; | |
571 | cp.copy_line_top = copy_line_top8x8; | |
572 | } else if mode == 11 { | |
573 | if cell.no_mv() { return Err(DecoderError::InvalidData); } | |
574 | validate!(!intra); | |
575 | cp.bw = 4; | |
576 | cp.bh = 8; | |
577 | cp.apply_delta = apply_delta4x8m11; | |
578 | cp.copy_line_top = copy_line_top4x8; | |
579 | } else { | |
580 | return Err(DecoderError::InvalidData); | |
581 | } | |
582 | self.decode_cell_data(br, cell, off, stride, cp) | |
583 | } | |
584 | ||
585 | fn parse_tree(&mut self, br: &mut ByteReader, cell: IV3Cell, off: usize, | |
586 | stride: usize, stripw: u16, intra: bool) -> DecoderResult<()> { | |
587 | let op = self.get_2bits(br)?; | |
588 | if op == H_SPLIT { | |
589 | validate!(cell.h > 1); | |
590 | validate!(cell.d > 0); | |
591 | let (cell1, cell2) = cell.split_h(); | |
592 | self.parse_tree(br, cell1, off, stride, stripw, intra)?; | |
593 | self.parse_tree(br, cell2, off, stride, stripw, intra)?; | |
594 | Ok(()) | |
595 | } else if op == V_SPLIT { | |
596 | validate!(cell.w > 1); | |
597 | validate!(cell.d > 0); | |
598 | let (cell1, cell2) = cell.split_w(stripw); | |
599 | self.parse_tree(br, cell1, off, stride, stripw, intra)?; | |
600 | self.parse_tree(br, cell2, off, stride, stripw, intra)?; | |
601 | Ok(()) | |
602 | } else if op == SKIP_OR_TREE { | |
603 | if !cell.vqt { | |
604 | let mut newcell = cell; | |
605 | newcell.vqt = true; | |
606 | newcell.d -= 1; | |
607 | self.parse_tree(br, newcell, off, stride, stripw, intra) | |
608 | } else { | |
609 | validate!(!intra); | |
610 | let code = self.get_2bits(br)?; | |
611 | validate!(code < 2); | |
612 | if code == 1 { return Err(DecoderError::NotImplemented); } | |
613 | self.copy_cell(cell, off, stride) | |
614 | } | |
615 | } else { | |
616 | if !cell.vqt { | |
617 | let mut newcell = cell; | |
618 | newcell.vqt = true; | |
619 | newcell.d -= 1; | |
620 | let mv_idx = br.read_byte()? as usize; | |
621 | validate!(mv_idx < self.mvs.len()); | |
622 | newcell.mv = Some(self.mvs[mv_idx]); | |
623 | self.parse_tree(br, newcell, off, stride, stripw, intra) | |
624 | } else { | |
625 | self.decode_cell(br, cell, off, stride, intra) | |
626 | } | |
627 | } | |
628 | } | |
629 | ||
630 | fn decode_plane_intra(&mut self, br: &mut ByteReader, planeno: usize, | |
631 | start: u64, end: u64) -> DecoderResult<()> { | |
632 | let offs = self.bufs.get_offset(planeno); | |
633 | let stride = self.bufs.get_stride(planeno); | |
634 | br.seek(SeekFrom::Start(start))?; | |
635 | ||
636 | let nvec = br.read_u32le()?; | |
637 | validate!(nvec == 0); // for intra there should be no mc_vecs | |
638 | self.mvs.truncate(0); | |
639 | for _ in 0..nvec { | |
640 | let x = br.read_byte()? as i8; | |
641 | let y = br.read_byte()? as i8; | |
642 | self.mvs.push(MV{ x: x, y: y }); | |
643 | } | |
644 | ||
645 | let shift = if planeno == 0 { 2 } else { 4 }; | |
646 | let cell = IV3Cell::new((self.bufs.width >> shift) as u16, | |
647 | (self.bufs.height >> shift) as u16); | |
648 | self.br_reset(); | |
649 | self.parse_tree(br, cell, offs, stride, if planeno > 0 { 10 } else { 40 }, true)?; | |
650 | validate!(br.tell() <= end); | |
651 | Ok(()) | |
652 | } | |
653 | ||
654 | fn decode_plane_inter(&mut self, br: &mut ByteReader, planeno: usize, | |
655 | start: u64, end: u64) -> DecoderResult<()> { | |
656 | let offs = self.bufs.get_offset(planeno); | |
657 | let stride = self.bufs.get_stride(planeno); | |
658 | br.seek(SeekFrom::Start(start))?; | |
659 | ||
660 | let nvec = br.read_u32le()?; | |
661 | validate!(nvec <= 256); // for intra there should be no mc_vecs | |
662 | self.mvs.truncate(0); | |
663 | for _ in 0..nvec { | |
664 | let y = br.read_byte()? as i8; | |
665 | let x = br.read_byte()? as i8; | |
666 | self.mvs.push(MV{ x: x, y: y }); | |
667 | } | |
668 | ||
669 | let shift = if planeno == 0 { 2 } else { 4 }; | |
670 | let cell = IV3Cell::new((self.bufs.width >> shift) as u16, | |
671 | (self.bufs.height >> shift) as u16); | |
672 | self.br_reset(); | |
673 | self.parse_tree(br, cell, offs, stride, if planeno > 0 { 10 } else { 40 }, false)?; | |
674 | validate!(br.tell() <= end); | |
675 | Ok(()) | |
676 | } | |
677 | } | |
678 | ||
679 | const FLAG_KEYFRAME: u16 = 1 << 2; | |
680 | const FLAG_NONREF: u16 = 1 << 8; | |
681 | ||
682 | impl NADecoder for Indeo3Decoder { | |
683 | fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> { | |
684 | if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { | |
685 | let w = vinfo.get_width(); | |
686 | let h = vinfo.get_height(); | |
687 | let fmt = formats::YUV410_FORMAT; | |
688 | let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, false, fmt)); | |
689 | self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata())); | |
690 | self.bufs.reset(); | |
691 | Ok(()) | |
692 | } else { | |
693 | Err(DecoderError::InvalidData) | |
694 | } | |
695 | } | |
696 | fn decode(&mut self, pkt: &NAPacket) -> DecoderResult<NAFrameRef> { | |
697 | let src = pkt.get_buffer(); | |
698 | let mut mr = MemoryReader::new_read(&src); | |
699 | let mut br = ByteReader::new(&mut mr); | |
700 | let frameno = br.read_u32le()?; | |
701 | let hdr_2 = br.read_u32le()?; | |
702 | let check = br.read_u32le()?; | |
703 | let size = br.read_u32le()?; | |
704 | ||
705 | let data_start = br.tell(); | |
706 | ||
707 | if (frameno ^ hdr_2 ^ size ^ FRMH_TAG) != check { | |
708 | return Err(DecoderError::InvalidData); | |
709 | } | |
710 | if (size as i64) > br.left() { return Err(DecoderError::InvalidData); } | |
711 | let ver = br.read_u16le()?; | |
712 | if ver != 32 { return Err(DecoderError::NotImplemented); } | |
713 | let flags = br.read_u16le()?; | |
714 | let size2 = br.read_u32le()?; | |
715 | validate!(((size2 + 7) >> 3) <= size); | |
716 | let cb = br.read_byte()?; | |
717 | self.vq_offset = cb; | |
718 | br.read_skip(3)?; | |
719 | let height = br.read_u16le()?; | |
720 | let width = br.read_u16le()?; | |
721 | validate!((width >= 16) && (width <= 640)); | |
722 | validate!((height >= 16) && (height <= 640)); | |
723 | validate!(((width & 3) == 0) && ((height & 3) == 0)); | |
724 | if (self.bufs.width != (width as usize)) || (self.bufs.height != (height as usize)) { | |
725 | self.bufs.alloc(width as usize, height as usize); | |
726 | } | |
727 | self.width = width; | |
728 | self.height = height; | |
729 | ||
730 | let yoff = br.read_u32le()?; | |
731 | let uoff = br.read_u32le()?; | |
732 | let voff = br.read_u32le()?; | |
733 | if yoff > size { return Err(DecoderError::InvalidData); } | |
734 | if uoff > size { return Err(DecoderError::InvalidData); } | |
735 | if voff > size { return Err(DecoderError::InvalidData); } | |
736 | ||
737 | br.read_skip(4)?; | |
738 | br.read_buf(&mut self.altquant)?; | |
739 | ||
740 | let mut yend = src.len() as u32;//size; | |
741 | if (uoff < yend) && (uoff > yoff) { yend = uoff; } | |
742 | if (voff < yend) && (voff > yoff) { yend = voff; } | |
743 | let mut uend = size; | |
744 | if (yoff < uend) && (yoff > uoff) { uend = yoff; } | |
745 | if (voff < uend) && (voff > uoff) { uend = voff; } | |
746 | let mut vend = size; | |
747 | if (yoff < vend) && (yoff > voff) { vend = yoff; } | |
748 | if (uoff < vend) && (uoff > voff) { vend = uoff; } | |
749 | ||
750 | let intraframe = (flags & FLAG_KEYFRAME) != 0; | |
751 | let vinfo = self.info.get_properties().get_video_info().unwrap(); | |
752 | let bufret = alloc_video_buffer(vinfo, 2); | |
753 | if let Err(_) = bufret { return Err(DecoderError::InvalidData); } | |
754 | let mut bufinfo = bufret.unwrap(); | |
755 | let mut buf = bufinfo.get_vbuf().unwrap(); | |
756 | let ystart = data_start + (yoff as u64); | |
757 | let ustart = data_start + (uoff as u64); | |
758 | let vstart = data_start + (voff as u64); | |
759 | let yendpos = data_start + (yend as u64); | |
760 | let uendpos = data_start + (uend as u64); | |
761 | let vendpos = data_start + (vend as u64); | |
762 | if intraframe { | |
763 | self.decode_plane_intra(&mut br, 0, ystart, yendpos)?; | |
764 | self.decode_plane_intra(&mut br, 1, ustart, uendpos)?; | |
765 | self.decode_plane_intra(&mut br, 2, vstart, vendpos)?; | |
766 | } else { | |
767 | self.decode_plane_inter(&mut br, 0, ystart, yendpos)?; | |
768 | self.decode_plane_inter(&mut br, 1, ustart, uendpos)?; | |
769 | self.decode_plane_inter(&mut br, 2, vstart, vendpos)?; | |
770 | } | |
771 | self.bufs.fill_framebuf(&mut buf); | |
772 | if (flags & FLAG_NONREF) == 0 { self.bufs.flip(); } | |
773 | let mut frm = NAFrame::new_from_pkt(pkt, self.info.clone(), bufinfo); | |
774 | frm.set_keyframe(intraframe); | |
775 | frm.set_frame_type(if intraframe { FrameType::I } else { FrameType::P }); | |
776 | Ok(Rc::new(RefCell::new(frm))) | |
777 | } | |
778 | } | |
779 | ||
780 | pub fn get_decoder() -> Box<NADecoder> { | |
781 | Box::new(Indeo3Decoder::new()) | |
782 | } | |
783 | ||
784 | #[cfg(test)] | |
785 | mod test { | |
786 | use test::dec_video::test_file_decoding; | |
787 | #[test] | |
788 | fn test_indeo3() { | |
789 | test_file_decoding("avi", "assets/iv32_example.avi", Some(10), true, false, None); | |
790 | } | |
791 | } | |
792 | ||
793 | const DT_1_1: IviDeltaCB = IviDeltaCB{ quad_radix: 7, data: &[ | |
794 | 0, 0, 2, 2, -2, -2, -1, 3, | |
795 | 1, -3, 3, -1, -3, 1, 4, 4, | |
796 | -4, -4, 1, 5, -1, -5, 5, 1, | |
797 | -5, -1, -4, 4, 4, -4, -2, 6, | |
798 | 2, -6, 6, -2, -6, 2, 4, 9, | |
799 | -4, -9, 9, 4, -9, -4, 9, 9, | |
800 | -9, -9, 1, 10, -1, -10, 10, 1, | |
801 | -10, -1, -5, 8, 5, -8, 8, -5, | |
802 | -8, 5, 9, 15, -9, -15, 15, 9, | |
803 | -15, -9, -3, 12, 3, -12, 12, -3, | |
804 | -12, 3, 4, 16, -4, -16, 16, 4, | |
805 | -16, -4, 16, 16, -16, -16, 0, 18, | |
806 | 0, -18, 18, 0, -18, 0, -12, 12, | |
807 | 12, -12, -9, 16, 9, -16, 16, -9, | |
808 | -16, 9, 11, 27, -11, -27, 27, 11, | |
809 | -27, -11, 19, 28, -19, -28, 28, 19, | |
810 | -28, -19, -6, 22, 6, -22, 22, -6, | |
811 | -22, 6, 4, 29, -4, -29, 29, 4, | |
812 | -29, -4, 30, 30, -30, -30, -2, 33, | |
813 | 2, -33, 33, -2, -33, 2, -18, 23, | |
814 | 18, -23, 23, -18, -23, 18, -15, 30, | |
815 | 15, -30, 30, -15, -30, 15, 22, 46, | |
816 | -22, -46, 46, 22, -46, -22, 13, 47, | |
817 | -13, -47, 47, 13, -47, -13, 35, 49, | |
818 | -35, -49, 49, 35, -49, -35, -11, 41, | |
819 | 11, -41, 41, -11, -41, 11, 4, 51, | |
820 | -4, -51, 51, 4, -51, -4, 54, 54, | |
821 | -54, -54, -34, 34, 34, -34, -29, 42, | |
822 | 29, -42, 42, -29, -42, 29, -6, 60, | |
823 | 6, -60, 60, -6, -60, 6, 27, 76, | |
824 | -27, -76, 76, 27, -76, -27, 43, 77, | |
825 | -43, -77, 77, 43, -77, -43, -24, 55, | |
826 | 24, -55, 55, -24, -55, 24, 14, 79, | |
827 | -14, -79, 79, 14, -79, -14, 63, 83, | |
828 | -63, -83, 83, 63, -83, -63, -20, 74, | |
829 | 20, -74, 74, -20, -74, 20, 2, 88, | |
830 | -2, -88, 88, 2, -88, -2, 93, 93, | |
831 | -93, -93, -52, 61, 52, -61, 61, -52, | |
832 | -61, 52, 52, 120, -52, -120, 120, 52, | |
833 | -120, -52, -45, 75, 45, -75, 75, -45, | |
834 | -75, 45, 75, 125, -75, -125, 125, 75, | |
835 | -125, -75, 33, 122, -33, -122, 122, 33, | |
836 | -122, -33, -13, 103, 13, -103, 103, -13, | |
837 | -103, 13, -40, 96, 40, -96, 96, -40, | |
838 | -96, 40, -34, 127, 34, -127, 127, -34, | |
839 | -127, 34, -89, 89, 89, -89, -78, 105, | |
840 | 78, -105, 105, -78, -105, 78, 12, 12, | |
841 | -12, -12, 23, 23, -23, -23, 42, 42, | |
842 | -42, -42, 73, 73, -73, -73, | |
843 | ]}; | |
844 | ||
845 | const DT_1_2: IviDeltaCB = IviDeltaCB{ quad_radix: 9, data: &[ | |
846 | 0, 0, 3, 3, -3, -3, -1, 4, | |
847 | 1, -4, 4, -1, -4, 1, 7, 7, | |
848 | -7, -7, 2, 8, -2, -8, 8, 2, | |
849 | -8, -2, -2, 9, 2, -9, 9, -2, | |
850 | -9, 2, -6, 6, 6, -6, 6, 13, | |
851 | -6, -13, 13, 6, -13, -6, 13, 13, | |
852 | -13, -13, 1, 14, -1, -14, 14, 1, | |
853 | -14, -1, -8, 12, 8, -12, 12, -8, | |
854 | -12, 8, 14, 23, -14, -23, 23, 14, | |
855 | -23, -14, -5, 18, 5, -18, 18, -5, | |
856 | -18, 5, 6, 24, -6, -24, 24, 6, | |
857 | -24, -6, 24, 24, -24, -24, -1, 27, | |
858 | 1, -27, 27, -1, -27, 1, -17, 17, | |
859 | 17, -17, -13, 23, 13, -23, 23, -13, | |
860 | -23, 13, 16, 40, -16, -40, 40, 16, | |
861 | -40, -16, 28, 41, -28, -41, 41, 28, | |
862 | -41, -28, -9, 33, 9, -33, 33, -9, | |
863 | -33, 9, 6, 43, -6, -43, 43, 6, | |
864 | -43, -6, 46, 46, -46, -46, -4, 50, | |
865 | 4, -50, 50, -4, -50, 4, -27, 34, | |
866 | 27, -34, 34, -27, -34, 27, -22, 45, | |
867 | 22, -45, 45, -22, -45, 22, 34, 69, | |
868 | -34, -69, 69, 34, -69, -34, 19, 70, | |
869 | -19, -70, 70, 19, -70, -19, 53, 73, | |
870 | -53, -73, 73, 53, -73, -53, -17, 62, | |
871 | 17, -62, 62, -17, -62, 17, 5, 77, | |
872 | -5, -77, 77, 5, -77, -5, 82, 82, | |
873 | -82, -82, -51, 51, 51, -51, -43, 64, | |
874 | 43, -64, 64, -43, -64, 43, -10, 90, | |
875 | 10, -90, 90, -10, -90, 10, 41, 114, | |
876 | -41, -114, 114, 41, -114, -41, 64, 116, | |
877 | -64, -116, 116, 64, -116, -64, -37, 82, | |
878 | 37, -82, 82, -37, -82, 37, 22, 119, | |
879 | -22, -119, 119, 22, -119, -22, 95, 124, | |
880 | -95, -124, 124, 95, -124, -95, -30, 111, | |
881 | 30, -111, 111, -30, -111, 30, -78, 92, | |
882 | 78, -92, 92, -78, -92, 78, -68, 113, | |
883 | 68, -113, 113, -68, -113, 68, 18, 18, | |
884 | -18, -18, 34, 34, -34, -34, 63, 63, | |
885 | -63, -63, 109, 109, -109, -109, | |
886 | ]}; | |
887 | ||
888 | const DT_1_3: IviDeltaCB = IviDeltaCB{ quad_radix: 10, data: &[ | |
889 | 0, 0, 4, 4, -4, -4, -1, 5, | |
890 | 1, -5, 5, -1, -5, 1, 3, 10, | |
891 | -3, -10, 10, 3, -10, -3, 9, 9, | |
892 | -9, -9, -7, 7, 7, -7, -3, 12, | |
893 | 3, -12, 12, -3, -12, 3, 8, 17, | |
894 | -8, -17, 17, 8, -17, -8, 17, 17, | |
895 | -17, -17, 1, 19, -1, -19, 19, 1, | |
896 | -19, -1, -11, 16, 11, -16, 16, -11, | |
897 | -16, 11, -6, 23, 6, -23, 23, -6, | |
898 | -23, 6, 18, 31, -18, -31, 31, 18, | |
899 | -31, -18, 8, 32, -8, -32, 32, 8, | |
900 | -32, -8, 33, 33, -33, -33, -1, 36, | |
901 | 1, -36, 36, -1, -36, 1, -23, 23, | |
902 | 23, -23, -17, 31, 17, -31, 31, -17, | |
903 | -31, 17, 21, 54, -21, -54, 54, 21, | |
904 | -54, -21, 37, 55, -37, -55, 55, 37, | |
905 | -55, -37, -12, 44, 12, -44, 44, -12, | |
906 | -44, 12, 8, 57, -8, -57, 57, 8, | |
907 | -57, -8, 61, 61, -61, -61, -5, 66, | |
908 | 5, -66, 66, -5, -66, 5, -36, 45, | |
909 | 36, -45, 45, -36, -45, 36, -29, 60, | |
910 | 29, -60, 60, -29, -60, 29, 45, 92, | |
911 | -45, -92, 92, 45, -92, -45, 25, 93, | |
912 | -25, -93, 93, 25, -93, -25, 71, 97, | |
913 | -71, -97, 97, 71, -97, -71, -22, 83, | |
914 | 22, -83, 83, -22, -83, 22, 7, 102, | |
915 | -7, -102, 102, 7, -102, -7, 109, 109, | |
916 | -109, -109, -68, 68, 68, -68, -57, 85, | |
917 | 57, -85, 85, -57, -85, 57, -13, 120, | |
918 | 13, -120, 120, -13, -120, 13, -49, 110, | |
919 | 49, -110, 110, -49, -110, 49, -104, 123, | |
920 | 104, -123, 123, -104, -123, 104, 24, 24, | |
921 | -24, -24, 46, 46, -46, -46, 84, 84, | |
922 | -84, -84, | |
923 | ]}; | |
924 | ||
925 | const DT_1_4: IviDeltaCB = IviDeltaCB{ quad_radix: 11, data: &[ | |
926 | 0, 0, 5, 5, -5, -5, -2, 7, | |
927 | 2, -7, 7, -2, -7, 2, 11, 11, | |
928 | -11, -11, 3, 13, -3, -13, 13, 3, | |
929 | -13, -3, -9, 9, 9, -9, -4, 15, | |
930 | 4, -15, 15, -4, -15, 4, 11, 22, | |
931 | -11, -22, 22, 11, -22, -11, 21, 21, | |
932 | -21, -21, 2, 24, -2, -24, 24, 2, | |
933 | -24, -2, -14, 20, 14, -20, 20, -14, | |
934 | -20, 14, 23, 38, -23, -38, 38, 23, | |
935 | -38, -23, -8, 29, 8, -29, 29, -8, | |
936 | -29, 8, 11, 39, -11, -39, 39, 11, | |
937 | -39, -11, 41, 41, -41, -41, -1, 45, | |
938 | 1, -45, 45, -1, -45, 1, -29, 29, | |
939 | 29, -29, -22, 39, 22, -39, 39, -22, | |
940 | -39, 22, 27, 67, -27, -67, 67, 27, | |
941 | -67, -27, 47, 69, -47, -69, 69, 47, | |
942 | -69, -47, -15, 56, 15, -56, 56, -15, | |
943 | -56, 15, 11, 71, -11, -71, 71, 11, | |
944 | -71, -11, 76, 76, -76, -76, -6, 83, | |
945 | 6, -83, 83, -6, -83, 6, -45, 57, | |
946 | 45, -57, 57, -45, -57, 45, -36, 75, | |
947 | 36, -75, 75, -36, -75, 36, 56, 115, | |
948 | -56, -115, 115, 56, -115, -56, 31, 117, | |
949 | -31, -117, 117, 31, -117, -31, 88, 122, | |
950 | -88, -122, 122, 88, -122, -88, -28, 104, | |
951 | 28, -104, 104, -28, -104, 28, -85, 85, | |
952 | 85, -85, -72, 106, 72, -106, 106, -72, | |
953 | -106, 72, 30, 30, -30, -30, 58, 58, | |
954 | -58, -58, 105, 105, -105, -105, | |
955 | ]}; | |
956 | ||
957 | const DT_1_5: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
958 | 0, 0, 6, 6, -6, -6, -2, 8, | |
959 | 2, -8, 8, -2, -8, 2, 13, 13, | |
960 | -13, -13, 4, 15, -4, -15, 15, 4, | |
961 | -15, -4, -11, 11, 11, -11, -5, 18, | |
962 | 5, -18, 18, -5, -18, 5, 13, 26, | |
963 | -13, -26, 26, 13, -26, -13, 26, 26, | |
964 | -26, -26, 2, 29, -2, -29, 29, 2, | |
965 | -29, -2, -16, 24, 16, -24, 24, -16, | |
966 | -24, 16, 28, 46, -28, -46, 46, 28, | |
967 | -46, -28, -9, 35, 9, -35, 35, -9, | |
968 | -35, 9, 13, 47, -13, -47, 47, 13, | |
969 | -47, -13, 49, 49, -49, -49, -1, 54, | |
970 | 1, -54, 54, -1, -54, 1, -35, 35, | |
971 | 35, -35, -26, 47, 26, -47, 47, -26, | |
972 | -47, 26, 32, 81, -32, -81, 81, 32, | |
973 | -81, -32, 56, 83, -56, -83, 83, 56, | |
974 | -83, -56, -18, 67, 18, -67, 67, -18, | |
975 | -67, 18, 13, 86, -13, -86, 86, 13, | |
976 | -86, -13, 91, 91, -91, -91, -7, 99, | |
977 | 7, -99, 99, -7, -99, 7, -54, 68, | |
978 | 54, -68, 68, -54, -68, 54, -44, 90, | |
979 | 44, -90, 90, -44, -90, 44, -33, 124, | |
980 | 33, -124, 124, -33, -124, 33, -103, 103, | |
981 | 103, -103, -86, 127, 86, -127, 127, -86, | |
982 | -127, 86, 37, 37, -37, -37, 69, 69, | |
983 | -69, -69, | |
984 | ]}; | |
985 | ||
986 | const DT_1_6: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
987 | 0, 0, 7, 7, -7, -7, -3, 10, | |
988 | 3, -10, 10, -3, -10, 3, 16, 16, | |
989 | -16, -16, 5, 18, -5, -18, 18, 5, | |
990 | -18, -5, -13, 13, 13, -13, -6, 21, | |
991 | 6, -21, 21, -6, -21, 6, 15, 30, | |
992 | -15, -30, 30, 15, -30, -15, 30, 30, | |
993 | -30, -30, 2, 34, -2, -34, 34, 2, | |
994 | -34, -2, -19, 28, 19, -28, 28, -19, | |
995 | -28, 19, 32, 54, -32, -54, 54, 32, | |
996 | -54, -32, -11, 41, 11, -41, 41, -11, | |
997 | -41, 11, 15, 55, -15, -55, 55, 15, | |
998 | -55, -15, 57, 57, -57, -57, -1, 63, | |
999 | 1, -63, 63, -1, -63, 1, -40, 40, | |
1000 | 40, -40, -30, 55, 30, -55, 55, -30, | |
1001 | -55, 30, 37, 94, -37, -94, 94, 37, | |
1002 | -94, -37, 65, 96, -65, -96, 96, 65, | |
1003 | -96, -65, -21, 78, 21, -78, 78, -21, | |
1004 | -78, 21, 15, 100, -15, -100, 100, 15, | |
1005 | -100, -15, 106, 106, -106, -106, -8, 116, | |
1006 | 8, -116, 116, -8, -116, 8, -63, 79, | |
1007 | 63, -79, 79, -63, -79, 63, -51, 105, | |
1008 | 51, -105, 105, -51, -105, 51, -120, 120, | |
1009 | 120, -120, 43, 43, -43, -43, 80, 80, | |
1010 | -80, -80, | |
1011 | ]}; | |
1012 | ||
1013 | const DT_1_7: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
1014 | 0, 0, 8, 8, -8, -8, -3, 11, | |
1015 | 3, -11, 11, -3, -11, 3, 18, 18, | |
1016 | -18, -18, 5, 20, -5, -20, 20, 5, | |
1017 | -20, -5, -15, 15, 15, -15, -7, 24, | |
1018 | 7, -24, 24, -7, -24, 7, 17, 35, | |
1019 | -17, -35, 35, 17, -35, -17, 34, 34, | |
1020 | -34, -34, 3, 38, -3, -38, 38, 3, | |
1021 | -38, -3, -22, 32, 22, -32, 32, -22, | |
1022 | -32, 22, 37, 61, -37, -61, 61, 37, | |
1023 | -61, -37, -13, 47, 13, -47, 47, -13, | |
1024 | -47, 13, 17, 63, -17, -63, 63, 17, | |
1025 | -63, -17, 65, 65, -65, -65, -1, 72, | |
1026 | 1, -72, 72, -1, -72, 1, -46, 46, | |
1027 | 46, -46, -35, 63, 35, -63, 63, -35, | |
1028 | -63, 35, 43, 107, -43, -107, 107, 43, | |
1029 | -107, -43, 75, 110, -75, -110, 110, 75, | |
1030 | -110, -75, -24, 89, 24, -89, 89, -24, | |
1031 | -89, 24, 17, 114, -17, -114, 114, 17, | |
1032 | -114, -17, 121, 121, -121, -121, -72, 91, | |
1033 | 72, -91, 91, -72, -91, 72, -58, 120, | |
1034 | 58, -120, 120, -58, -120, 58, 49, 49, | |
1035 | -49, -49, 92, 92, -92, -92, | |
1036 | ]}; | |
1037 | ||
1038 | const DT_1_8: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1039 | 0, 0, 9, 9, -9, -9, -3, 12, | |
1040 | 3, -12, 12, -3, -12, 3, 20, 20, | |
1041 | -20, -20, 6, 23, -6, -23, 23, 6, | |
1042 | -23, -6, -17, 17, 17, -17, -7, 27, | |
1043 | 7, -27, 27, -7, -27, 7, 19, 39, | |
1044 | -19, -39, 39, 19, -39, -19, 39, 39, | |
1045 | -39, -39, 3, 43, -3, -43, 43, 3, | |
1046 | -43, -3, -24, 36, 24, -36, 36, -24, | |
1047 | -36, 24, 42, 69, -42, -69, 69, 42, | |
1048 | -69, -42, -14, 53, 14, -53, 53, -14, | |
1049 | -53, 14, 19, 71, -19, -71, 71, 19, | |
1050 | -71, -19, 73, 73, -73, -73, -2, 80, | |
1051 | 2, -80, 80, -2, -80, 2, -52, 52, | |
1052 | 52, -52, -39, 70, 39, -70, 70, -39, | |
1053 | -70, 39, 48, 121, -48, -121, 121, 48, | |
1054 | -121, -48, 84, 124, -84, -124, 124, 84, | |
1055 | -124, -84, -27, 100, 27, -100, 100, -27, | |
1056 | -100, 27, -81, 102, 81, -102, 102, -81, | |
1057 | -102, 81, 55, 55, -55, -55, 104, 104, | |
1058 | -104, -104, | |
1059 | ]}; | |
1060 | ||
1061 | const DT_2_1: IviDeltaCB = IviDeltaCB{ quad_radix: 7, data: &[ | |
1062 | 0, 0, 2, 2, -2, -2, 0, 2, | |
1063 | 0, -2, 2, 0, -2, 0, 4, 4, | |
1064 | -4, -4, 0, 4, 0, -4, 4, 0, | |
1065 | -4, 0, -4, 4, 4, -4, -2, 6, | |
1066 | 2, -6, 6, -2, -6, 2, 4, 8, | |
1067 | -4, -8, 8, 4, -8, -4, 8, 8, | |
1068 | -8, -8, 0, 10, 0, -10, 10, 0, | |
1069 | -10, 0, -4, 8, 4, -8, 8, -4, | |
1070 | -8, 4, 8, 14, -8, -14, 14, 8, | |
1071 | -14, -8, -2, 12, 2, -12, 12, -2, | |
1072 | -12, 2, 4, 16, -4, -16, 16, 4, | |
1073 | -16, -4, 16, 16, -16, -16, 0, 18, | |
1074 | 0, -18, 18, 0, -18, 0, -12, 12, | |
1075 | 12, -12, -8, 16, 8, -16, 16, -8, | |
1076 | -16, 8, 10, 26, -10, -26, 26, 10, | |
1077 | -26, -10, 18, 28, -18, -28, 28, 18, | |
1078 | -28, -18, -6, 22, 6, -22, 22, -6, | |
1079 | -22, 6, 4, 28, -4, -28, 28, 4, | |
1080 | -28, -4, 30, 30, -30, -30, -2, 32, | |
1081 | 2, -32, 32, -2, -32, 2, -18, 22, | |
1082 | 18, -22, 22, -18, -22, 18, -14, 30, | |
1083 | 14, -30, 30, -14, -30, 14, 22, 46, | |
1084 | -22, -46, 46, 22, -46, -22, 12, 46, | |
1085 | -12, -46, 46, 12, -46, -12, 34, 48, | |
1086 | -34, -48, 48, 34, -48, -34, -10, 40, | |
1087 | 10, -40, 40, -10, -40, 10, 4, 50, | |
1088 | -4, -50, 50, 4, -50, -4, 54, 54, | |
1089 | -54, -54, -34, 34, 34, -34, -28, 42, | |
1090 | 28, -42, 42, -28, -42, 28, -6, 60, | |
1091 | 6, -60, 60, -6, -60, 6, 26, 76, | |
1092 | -26, -76, 76, 26, -76, -26, 42, 76, | |
1093 | -42, -76, 76, 42, -76, -42, -24, 54, | |
1094 | 24, -54, 54, -24, -54, 24, 14, 78, | |
1095 | -14, -78, 78, 14, -78, -14, 62, 82, | |
1096 | -62, -82, 82, 62, -82, -62, -20, 74, | |
1097 | 20, -74, 74, -20, -74, 20, 2, 88, | |
1098 | -2, -88, 88, 2, -88, -2, 92, 92, | |
1099 | -92, -92, -52, 60, 52, -60, 60, -52, | |
1100 | -60, 52, 52, 118, -52, -118, 118, 52, | |
1101 | -118, -52, -44, 74, 44, -74, 74, -44, | |
1102 | -74, 44, 74, 118, -74, -118, 118, 74, | |
1103 | -118, -74, 32, 118, -32, -118, 118, 32, | |
1104 | -118, -32, -12, 102, 12, -102, 102, -12, | |
1105 | -102, 12, -40, 96, 40, -96, 96, -40, | |
1106 | -96, 40, -34, 118, 34, -118, 118, -34, | |
1107 | -118, 34, -88, 88, 88, -88, -78, 104, | |
1108 | 78, -104, 104, -78, -104, 78, 12, 12, | |
1109 | -12, -12, 22, 22, -22, -22, 42, 42, | |
1110 | -42, -42, 72, 72, -72, -72, | |
1111 | ]}; | |
1112 | ||
1113 | const DT_2_2: IviDeltaCB = IviDeltaCB{ quad_radix: 9, data: &[ | |
1114 | 0, 0, 3, 3, -3, -3, 0, 3, | |
1115 | 0, -3, 3, 0, -3, 0, 6, 6, | |
1116 | -6, -6, 3, 9, -3, -9, 9, 3, | |
1117 | -9, -3, -3, 9, 3, -9, 9, -3, | |
1118 | -9, 3, -6, 6, 6, -6, 6, 12, | |
1119 | -6, -12, 12, 6, -12, -6, 12, 12, | |
1120 | -12, -12, 0, 15, 0, -15, 15, 0, | |
1121 | -15, 0, -9, 12, 9, -12, 12, -9, | |
1122 | -12, 9, 15, 24, -15, -24, 24, 15, | |
1123 | -24, -15, -6, 18, 6, -18, 18, -6, | |
1124 | -18, 6, 6, 24, -6, -24, 24, 6, | |
1125 | -24, -6, 24, 24, -24, -24, 0, 27, | |
1126 | 0, -27, 27, 0, -27, 0, -18, 18, | |
1127 | 18, -18, -12, 24, 12, -24, 24, -12, | |
1128 | -24, 12, 15, 39, -15, -39, 39, 15, | |
1129 | -39, -15, 27, 42, -27, -42, 42, 27, | |
1130 | -42, -27, -9, 33, 9, -33, 33, -9, | |
1131 | -33, 9, 6, 42, -6, -42, 42, 6, | |
1132 | -42, -6, 45, 45, -45, -45, -3, 51, | |
1133 | 3, -51, 51, -3, -51, 3, -27, 33, | |
1134 | 27, -33, 33, -27, -33, 27, -21, 45, | |
1135 | 21, -45, 45, -21, -45, 21, 33, 69, | |
1136 | -33, -69, 69, 33, -69, -33, 18, 69, | |
1137 | -18, -69, 69, 18, -69, -18, 54, 72, | |
1138 | -54, -72, 72, 54, -72, -54, -18, 63, | |
1139 | 18, -63, 63, -18, -63, 18, 6, 78, | |
1140 | -6, -78, 78, 6, -78, -6, 81, 81, | |
1141 | -81, -81, -51, 51, 51, -51, -42, 63, | |
1142 | 42, -63, 63, -42, -63, 42, -9, 90, | |
1143 | 9, -90, 90, -9, -90, 9, 42, 114, | |
1144 | -42, -114, 114, 42, -114, -42, 63, 117, | |
1145 | -63, -117, 117, 63, -117, -63, -36, 81, | |
1146 | 36, -81, 81, -36, -81, 36, 21, 120, | |
1147 | -21, -120, 120, 21, -120, -21, 96, 123, | |
1148 | -96, -123, 123, 96, -123, -96, -30, 111, | |
1149 | 30, -111, 111, -30, -111, 30, -78, 93, | |
1150 | 78, -93, 93, -78, -93, 78, -69, 114, | |
1151 | 69, -114, 114, -69, -114, 69, 18, 18, | |
1152 | -18, -18, 33, 33, -33, -33, 63, 63, | |
1153 | -63, -63, 108, 108, -108, -108, | |
1154 | ]}; | |
1155 | ||
1156 | const DT_2_3: IviDeltaCB = IviDeltaCB{ quad_radix: 10, data: &[ | |
1157 | 0, 0, 4, 4, -4, -4, 0, 4, | |
1158 | 0, -4, 4, 0, -4, 0, 4, 8, | |
1159 | -4, -8, 8, 4, -8, -4, 8, 8, | |
1160 | -8, -8, -8, 8, 8, -8, -4, 12, | |
1161 | 4, -12, 12, -4, -12, 4, 8, 16, | |
1162 | -8, -16, 16, 8, -16, -8, 16, 16, | |
1163 | -16, -16, 0, 20, 0, -20, 20, 0, | |
1164 | -20, 0, -12, 16, 12, -16, 16, -12, | |
1165 | -16, 12, -4, 24, 4, -24, 24, -4, | |
1166 | -24, 4, 16, 32, -16, -32, 32, 16, | |
1167 | -32, -16, 8, 32, -8, -32, 32, 8, | |
1168 | -32, -8, 32, 32, -32, -32, 0, 36, | |
1169 | 0, -36, 36, 0, -36, 0, -24, 24, | |
1170 | 24, -24, -16, 32, 16, -32, 32, -16, | |
1171 | -32, 16, 20, 52, -20, -52, 52, 20, | |
1172 | -52, -20, 36, 56, -36, -56, 56, 36, | |
1173 | -56, -36, -12, 44, 12, -44, 44, -12, | |
1174 | -44, 12, 8, 56, -8, -56, 56, 8, | |
1175 | -56, -8, 60, 60, -60, -60, -4, 64, | |
1176 | 4, -64, 64, -4, -64, 4, -36, 44, | |
1177 | 36, -44, 44, -36, -44, 36, -28, 60, | |
1178 | 28, -60, 60, -28, -60, 28, 44, 92, | |
1179 | -44, -92, 92, 44, -92, -44, 24, 92, | |
1180 | -24, -92, 92, 24, -92, -24, 72, 96, | |
1181 | -72, -96, 96, 72, -96, -72, -20, 84, | |
1182 | 20, -84, 84, -20, -84, 20, 8, 100, | |
1183 | -8, -100, 100, 8, -100, -8, 108, 108, | |
1184 | -108, -108, -68, 68, 68, -68, -56, 84, | |
1185 | 56, -84, 84, -56, -84, 56, -12, 120, | |
1186 | 12, -120, 120, -12, -120, 12, -48, 108, | |
1187 | 48, -108, 108, -48, -108, 48, -104, 124, | |
1188 | 104, -124, 124, -104, -124, 104, 24, 24, | |
1189 | -24, -24, 44, 44, -44, -44, 84, 84, | |
1190 | -84, -84, | |
1191 | ]}; | |
1192 | ||
1193 | const DT_2_4: IviDeltaCB = IviDeltaCB{ quad_radix: 11, data: &[ | |
1194 | 0, 0, 5, 5, -5, -5, 0, 5, | |
1195 | 0, -5, 5, 0, -5, 0, 10, 10, | |
1196 | -10, -10, 5, 15, -5, -15, 15, 5, | |
1197 | -15, -5, -10, 10, 10, -10, -5, 15, | |
1198 | 5, -15, 15, -5, -15, 5, 10, 20, | |
1199 | -10, -20, 20, 10, -20, -10, 20, 20, | |
1200 | -20, -20, 0, 25, 0, -25, 25, 0, | |
1201 | -25, 0, -15, 20, 15, -20, 20, -15, | |
1202 | -20, 15, 25, 40, -25, -40, 40, 25, | |
1203 | -40, -25, -10, 30, 10, -30, 30, -10, | |
1204 | -30, 10, 10, 40, -10, -40, 40, 10, | |
1205 | -40, -10, 40, 40, -40, -40, 0, 45, | |
1206 | 0, -45, 45, 0, -45, 0, -30, 30, | |
1207 | 30, -30, -20, 40, 20, -40, 40, -20, | |
1208 | -40, 20, 25, 65, -25, -65, 65, 25, | |
1209 | -65, -25, 45, 70, -45, -70, 70, 45, | |
1210 | -70, -45, -15, 55, 15, -55, 55, -15, | |
1211 | -55, 15, 10, 70, -10, -70, 70, 10, | |
1212 | -70, -10, 75, 75, -75, -75, -5, 85, | |
1213 | 5, -85, 85, -5, -85, 5, -45, 55, | |
1214 | 45, -55, 55, -45, -55, 45, -35, 75, | |
1215 | 35, -75, 75, -35, -75, 35, 55, 115, | |
1216 | -55, -115, 115, 55, -115, -55, 30, 115, | |
1217 | -30, -115, 115, 30, -115, -30, 90, 120, | |
1218 | -90, -120, 120, 90, -120, -90, -30, 105, | |
1219 | 30, -105, 105, -30, -105, 30, -85, 85, | |
1220 | 85, -85, -70, 105, 70, -105, 105, -70, | |
1221 | -105, 70, 30, 30, -30, -30, 60, 60, | |
1222 | -60, -60, 105, 105, -105, -105, | |
1223 | ]}; | |
1224 | ||
1225 | const DT_2_5: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
1226 | 0, 0, 6, 6, -6, -6, 0, 6, | |
1227 | 0, -6, 6, 0, -6, 0, 12, 12, | |
1228 | -12, -12, 6, 12, -6, -12, 12, 6, | |
1229 | -12, -6, -12, 12, 12, -12, -6, 18, | |
1230 | 6, -18, 18, -6, -18, 6, 12, 24, | |
1231 | -12, -24, 24, 12, -24, -12, 24, 24, | |
1232 | -24, -24, 0, 30, 0, -30, 30, 0, | |
1233 | -30, 0, -18, 24, 18, -24, 24, -18, | |
1234 | -24, 18, 30, 48, -30, -48, 48, 30, | |
1235 | -48, -30, -6, 36, 6, -36, 36, -6, | |
1236 | -36, 6, 12, 48, -12, -48, 48, 12, | |
1237 | -48, -12, 48, 48, -48, -48, 0, 54, | |
1238 | 0, -54, 54, 0, -54, 0, -36, 36, | |
1239 | 36, -36, -24, 48, 24, -48, 48, -24, | |
1240 | -48, 24, 30, 78, -30, -78, 78, 30, | |
1241 | -78, -30, 54, 84, -54, -84, 84, 54, | |
1242 | -84, -54, -18, 66, 18, -66, 66, -18, | |
1243 | -66, 18, 12, 84, -12, -84, 84, 12, | |
1244 | -84, -12, 90, 90, -90, -90, -6, 96, | |
1245 | 6, -96, 96, -6, -96, 6, -54, 66, | |
1246 | 54, -66, 66, -54, -66, 54, -42, 90, | |
1247 | 42, -90, 90, -42, -90, 42, -30, 126, | |
1248 | 30, -126, 126, -30, -126, 30, -102, 102, | |
1249 | 102, -102, -84, 126, 84, -126, 126, -84, | |
1250 | -126, 84, 36, 36, -36, -36, 66, 66, | |
1251 | -66, -66, | |
1252 | ]}; | |
1253 | ||
1254 | const DT_2_6: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
1255 | 0, 0, 7, 7, -7, -7, 0, 7, | |
1256 | 0, -7, 7, 0, -7, 0, 14, 14, | |
1257 | -14, -14, 7, 21, -7, -21, 21, 7, | |
1258 | -21, -7, -14, 14, 14, -14, -7, 21, | |
1259 | 7, -21, 21, -7, -21, 7, 14, 28, | |
1260 | -14, -28, 28, 14, -28, -14, 28, 28, | |
1261 | -28, -28, 0, 35, 0, -35, 35, 0, | |
1262 | -35, 0, -21, 28, 21, -28, 28, -21, | |
1263 | -28, 21, 35, 56, -35, -56, 56, 35, | |
1264 | -56, -35, -14, 42, 14, -42, 42, -14, | |
1265 | -42, 14, 14, 56, -14, -56, 56, 14, | |
1266 | -56, -14, 56, 56, -56, -56, 0, 63, | |
1267 | 0, -63, 63, 0, -63, 0, -42, 42, | |
1268 | 42, -42, -28, 56, 28, -56, 56, -28, | |
1269 | -56, 28, 35, 91, -35, -91, 91, 35, | |
1270 | -91, -35, 63, 98, -63, -98, 98, 63, | |
1271 | -98, -63, -21, 77, 21, -77, 77, -21, | |
1272 | -77, 21, 14, 98, -14, -98, 98, 14, | |
1273 | -98, -14, 105, 105, -105, -105, -7, 119, | |
1274 | 7, -119, 119, -7, -119, 7, -63, 77, | |
1275 | 63, -77, 77, -63, -77, 63, -49, 105, | |
1276 | 49, -105, 105, -49, -105, 49, -119, 119, | |
1277 | 119, -119, 42, 42, -42, -42, 77, 77, | |
1278 | -77, -77, | |
1279 | ]}; | |
1280 | ||
1281 | const DT_2_7: IviDeltaCB = IviDeltaCB{ quad_radix: 12, data: &[ | |
1282 | 0, 0, 8, 8, -8, -8, 0, 8, | |
1283 | 0, -8, 8, 0, -8, 0, 16, 16, | |
1284 | -16, -16, 8, 16, -8, -16, 16, 8, | |
1285 | -16, -8, -16, 16, 16, -16, -8, 24, | |
1286 | 8, -24, 24, -8, -24, 8, 16, 32, | |
1287 | -16, -32, 32, 16, -32, -16, 32, 32, | |
1288 | -32, -32, 0, 40, 0, -40, 40, 0, | |
1289 | -40, 0, -24, 32, 24, -32, 32, -24, | |
1290 | -32, 24, 40, 64, -40, -64, 64, 40, | |
1291 | -64, -40, -16, 48, 16, -48, 48, -16, | |
1292 | -48, 16, 16, 64, -16, -64, 64, 16, | |
1293 | -64, -16, 64, 64, -64, -64, 0, 72, | |
1294 | 0, -72, 72, 0, -72, 0, -48, 48, | |
1295 | 48, -48, -32, 64, 32, -64, 64, -32, | |
1296 | -64, 32, 40, 104, -40, -104, 104, 40, | |
1297 | -104, -40, 72, 112, -72, -112, 112, 72, | |
1298 | -112, -72, -24, 88, 24, -88, 88, -24, | |
1299 | -88, 24, 16, 112, -16, -112, 112, 16, | |
1300 | -112, -16, 120, 120, -120, -120, -72, 88, | |
1301 | 72, -88, 88, -72, -88, 72, -56, 120, | |
1302 | 56, -120, 120, -56, -120, 56, 48, 48, | |
1303 | -48, -48, 88, 88, -88, -88, | |
1304 | ]}; | |
1305 | ||
1306 | const DT_2_8: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1307 | 0, 0, 9, 9, -9, -9, 0, 9, | |
1308 | 0, -9, 9, 0, -9, 0, 18, 18, | |
1309 | -18, -18, 9, 27, -9, -27, 27, 9, | |
1310 | -27, -9, -18, 18, 18, -18, -9, 27, | |
1311 | 9, -27, 27, -9, -27, 9, 18, 36, | |
1312 | -18, -36, 36, 18, -36, -18, 36, 36, | |
1313 | -36, -36, 0, 45, 0, -45, 45, 0, | |
1314 | -45, 0, -27, 36, 27, -36, 36, -27, | |
1315 | -36, 27, 45, 72, -45, -72, 72, 45, | |
1316 | -72, -45, -18, 54, 18, -54, 54, -18, | |
1317 | -54, 18, 18, 72, -18, -72, 72, 18, | |
1318 | -72, -18, 72, 72, -72, -72, 0, 81, | |
1319 | 0, -81, 81, 0, -81, 0, -54, 54, | |
1320 | 54, -54, -36, 72, 36, -72, 72, -36, | |
1321 | -72, 36, 45, 117, -45, -117, 117, 45, | |
1322 | -117, -45, 81, 126, -81, -126, 126, 81, | |
1323 | -126, -81, -27, 99, 27, -99, 99, -27, | |
1324 | -99, 27, -81, 99, 81, -99, 99, -81, | |
1325 | -99, 81, 54, 54, -54, -54, 108, 108, | |
1326 | -108, -108, | |
1327 | ]}; | |
1328 | ||
1329 | const DT_3_1: IviDeltaCB = IviDeltaCB{ quad_radix: 11, data: &[ | |
1330 | 0, 0, 2, 2, -2, -2, 0, 3, | |
1331 | 0, -3, 3, 0, -3, 0, 6, 6, | |
1332 | -6, -6, 0, 7, 0, -7, 7, 0, | |
1333 | -7, 0, -5, 5, 5, -5, 5, -5, | |
1334 | -5, 5, 6, 11, -6, -11, 11, 6, | |
1335 | -11, -6, 0, 8, 0, -8, 8, 0, | |
1336 | -8, 0, 11, 11, -11, -11, 0, 12, | |
1337 | 0, -12, 12, 0, -12, 0, 12, 17, | |
1338 | -12, -17, 17, 12, -17, -12, 17, 17, | |
1339 | -17, -17, 6, 18, -6, -18, 18, 6, | |
1340 | -18, -6, -8, 11, 8, -11, 11, -8, | |
1341 | -11, 8, 0, 15, 0, -15, 15, 0, | |
1342 | -15, 0, 0, 20, 0, -20, 20, 0, | |
1343 | -20, 0, 18, 25, -18, -25, 25, 18, | |
1344 | -25, -18, 11, 25, -11, -25, 25, 11, | |
1345 | -25, -11, 25, 25, -25, -25, -14, 14, | |
1346 | 14, -14, 14, -14, -14, 14, 0, 26, | |
1347 | 0, -26, 26, 0, -26, 0, -11, 18, | |
1348 | 11, -18, 18, -11, -18, 11, -7, 22, | |
1349 | 7, -22, 22, -7, -22, 7, 26, 34, | |
1350 | -26, -34, 34, 26, -34, -26, 18, 34, | |
1351 | -18, -34, 34, 18, -34, -18, 34, 34, | |
1352 | -34, -34, 11, 35, -11, -35, 35, 11, | |
1353 | -35, -11, 0, 29, 0, -29, 29, 0, | |
1354 | -29, 0, -19, 22, 19, -22, 22, -19, | |
1355 | -22, 19, -15, 26, 15, -26, 26, -15, | |
1356 | -26, 15, 0, 37, 0, -37, 37, 0, | |
1357 | -37, 0, 27, 44, -27, -44, 44, 27, | |
1358 | -44, -27, 36, 44, -36, -44, 44, 36, | |
1359 | -44, -36, 18, 44, -18, -44, 44, 18, | |
1360 | -44, -18, -10, 33, 10, -33, 33, -10, | |
1361 | -33, 10, 45, 45, -45, -45, 0, 0, | |
1362 | ]}; | |
1363 | ||
1364 | const DT_3_2: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1365 | 0, 0, 0, 2, 0, -2, 2, 0, | |
1366 | -2, 0, 2, 2, -2, -2, 6, 6, | |
1367 | -6, -6, 0, 6, 0, -6, 6, 0, | |
1368 | -6, 0, -4, 4, 4, -4, 10, -6, | |
1369 | -10, 6, 0, -12, 0, 12, -6, -12, | |
1370 | 6, -12, -6, 12, 6, 12, -14, 0, | |
1371 | 14, 0, 12, 12, -12, -12, 0, -18, | |
1372 | 0, 18, 14, -12, -14, 12, -18, -6, | |
1373 | 18, -6, -18, 6, 18, 6, -10, -18, | |
1374 | 10, -18, -10, 18, 10, 18, -22, 0, | |
1375 | 22, 0, 0, -24, 0, 24, -22, -12, | |
1376 | 22, -12, -22, 12, 22, 12, -8, -24, | |
1377 | 8, -24, -8, 24, 8, 24, -26, -6, | |
1378 | 26, -6, -26, 6, 26, 6, -28, 0, | |
1379 | 28, 0, 20, 20, -20, -20, -14, -26, | |
1380 | 14, 26, -30, -12, 30, 12, -10, -32, | |
1381 | 10, 32, -18, -32, 18, 32, -26, -26, | |
1382 | 26, 26, -34, -20, 34, 20, -38, -12, | |
1383 | 38, 12, -32, -32, 32, 32, 32, 32, | |
1384 | -22, -40, -34, -34, 34, 34, | |
1385 | ]}; | |
1386 | ||
1387 | const DT_3_3: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1388 | 0, 0, 0, 2, 0, -2, 2, 0, | |
1389 | -2, 0, 4, 4, -4, -4, 10, 10, | |
1390 | -10, -10, 0, 10, 0, -10, 10, 0, | |
1391 | -10, 0, -6, 6, 6, -6, 14, -8, | |
1392 | -14, 8, -18, 0, 18, 0, 10, -16, | |
1393 | -10, 16, 0, -24, 0, 24, -24, -8, | |
1394 | 24, -8, -24, 8, 24, 8, 18, 18, | |
1395 | -18, -18, 20, -16, -20, 16, -14, -26, | |
1396 | 14, -26, -14, 26, 14, 26, -30, 0, | |
1397 | 30, 0, 0, -34, 0, 34, -34, -8, | |
1398 | 34, -8, -34, 8, 34, 8, -30, -18, | |
1399 | 30, -18, -30, 18, 30, 18, -10, -34, | |
1400 | 10, -34, -10, 34, 10, 34, -20, -34, | |
1401 | 20, 34, -40, 0, 40, 0, 30, 30, | |
1402 | -30, -30, -40, -18, 40, 18, 0, -44, | |
1403 | 0, 44, -16, -44, 16, 44, -36, -36, | |
1404 | -36, -36, 36, 36, -26, -44, 26, 44, | |
1405 | -46, -26, 46, 26, -52, -18, 52, 18, | |
1406 | -20, -54, -44, -44, 44, 44, -32, -54, | |
1407 | -46, -46, -46, -46, 46, 46, | |
1408 | ]}; | |
1409 | ||
1410 | const DT_3_4: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1411 | 0, 0, 0, 4, 0, -4, 4, 0, | |
1412 | -4, 0, 4, 4, -4, -4, 12, 12, | |
1413 | -12, -12, 0, 12, 0, -12, 12, 0, | |
1414 | -12, 0, -8, 8, 8, -8, 8, -16, | |
1415 | -8, 16, 0, -24, 0, 24, -24, -8, | |
1416 | 24, -8, -24, 8, 24, 8, 20, -16, | |
1417 | -20, 16, -28, 0, 28, 0, -16, -24, | |
1418 | 16, -24, -16, 24, 16, 24, 0, -32, | |
1419 | 0, 32, -28, -16, 28, -16, -28, 16, | |
1420 | 28, 16, -8, -32, 8, -32, -32, -8, | |
1421 | 32, -8, -32, 8, 32, 8, -8, 32, | |
1422 | 8, 32, 24, 24, -24, -24, 24, -24, | |
1423 | -24, 24, -20, -32, 20, 32, -40, 0, | |
1424 | 40, 0, -40, -16, 40, 16, 0, -44, | |
1425 | 0, -44, -44, 0, 44, 0, 0, 44, | |
1426 | 0, 44, -32, -32, 32, 32, -16, -44, | |
1427 | 16, 44, -24, -44, -44, -24, 44, 24, | |
1428 | 24, 44, -48, -16, 48, 16, -36, -36, | |
1429 | -36, -36, 36, 36, 36, 36, -20, -52, | |
1430 | 40, 40, -40, -40, -32, -52, | |
1431 | ]}; | |
1432 | ||
1433 | const DT_3_5: IviDeltaCB = IviDeltaCB{ quad_radix: 13, data: &[ | |
1434 | 0, 0, 2, 2, -2, -2, 6, 6, | |
1435 | -6, -6, 12, 12, -12, -12, 20, 20, | |
1436 | -20, -20, 32, 32, -32, -32, 46, 46, | |
1437 | -46, -46, 0, 0, 0, 0, 0, 0, | |
1438 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1439 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1440 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1441 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1442 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1443 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1444 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1445 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1446 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1447 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1448 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1449 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1450 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1451 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1452 | 0, 0, 0, 0, 0, 0, 0, 0, | |
1453 | 0, 0, 0, 0, 0, 0, | |
1454 | ]}; | |
1455 | ||
1456 | const IVI3_DELTA_CBS: [&IviDeltaCB; 24] = [ | |
1457 | &DT_1_1, &DT_1_2, &DT_1_3, &DT_1_4, &DT_1_5, &DT_1_6, &DT_1_7, &DT_1_8, | |
1458 | &DT_2_1, &DT_2_2, &DT_2_3, &DT_2_4, &DT_2_5, &DT_2_6, &DT_2_7, &DT_2_8, | |
1459 | &DT_3_1, &DT_3_2, &DT_3_3, &DT_3_4, &DT_3_5, &DT_3_5, &DT_3_5, &DT_3_5 | |
1460 | ]; |