X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-duck%2Fsrc%2Fcodecs%2Ftruemotion1.rs;h=858ef3d4951fb33370a1a5b9c4474d3488d9d608;hb=fafc32ef4ac761d2219881a6ab750ce913aa318a;hp=c01fcaa6372b7cbc2ff75b8e5df49bc004437827;hpb=6011e20199143f519881660144a4ca95ba77fd2d;p=nihav.git diff --git a/nihav-duck/src/codecs/truemotion1.rs b/nihav-duck/src/codecs/truemotion1.rs index c01fcaa..858ef3d 100644 --- a/nihav-duck/src/codecs/truemotion1.rs +++ b/nihav-duck/src/codecs/truemotion1.rs @@ -1,5 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; +use super::truemotion1data::*; struct MaskState<'a> { is_intra: bool, @@ -128,6 +129,7 @@ impl Default for DeltaTables { } } +#[derive(Default)] struct FrameBuf { last16: Option>, last24: Option>, @@ -160,12 +162,6 @@ impl FrameBuf { } } -impl Default for FrameBuf { - fn default() -> Self { - Self { last16: None, last24: None } - } -} - #[derive(Default)] struct TM1Decoder { info: NACodecInfoRef, @@ -178,21 +174,6 @@ struct TM1Decoder { lastframe: FrameBuf, } -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; -const BGR0_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 2, next_elem: 4 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 1, next_elem: 4 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 0, next_elem: 4 }), - None, None], - elem_size: 4, be: false, alpha: false, palette: false }; - impl TM1Decoder { fn new() -> Self { Self::default() } fn set_delta_tables(&mut self, delta_set: usize, table_idx: usize, is_24bit: bool) { @@ -203,7 +184,7 @@ impl TM1Decoder { let cfdt = DUCK_C_FAT_DELTAS[delta_set]; let vec = DUCK_VECTABLES[table_idx - 1]; - let mut vec_iter = vec.into_iter(); + let mut vec_iter = vec.iter(); for i in 0..256 { let len = (*vec_iter.next().unwrap() as usize) >> 1; for j in 0..len { @@ -315,9 +296,9 @@ impl TM1Decoder { _ => unreachable!(), }; } else { - let cur = (dst[off + x + 0] as u32) | ((dst[off + x + 1] as u32) << 16); + let cur = u32::from(dst[off + x + 0]) | (u32::from(dst[off + x + 1]) << 16); self.vert_pred[(x >> 1) + 0] = cur; - let cur = (dst[off + x + 2] as u32) | ((dst[off + x + 3] as u32) << 16); + let cur = u32::from(dst[off + x + 2]) | (u32::from(dst[off + x + 3]) << 16); hor_pred = cur.wrapping_sub(self.vert_pred[(x >> 1) + 1]); self.vert_pred[(x >> 1) + 1] = cur; } @@ -490,15 +471,15 @@ impl TM1Decoder { _ => unreachable!(), }; } else { - let cur = (dst[off + x*4 + 0] as u32) - | ((dst[off + x*4 + 1] as u32) << 8) - | ((dst[off + x*4 + 2] as u32) << 16) - | ((dst[off + x*4 + 3] as u32) << 24); + let cur = u32::from(dst[off + x*4 + 0]) + | (u32::from(dst[off + x*4 + 1]) << 8) + | (u32::from(dst[off + x*4 + 2]) << 16) + | (u32::from(dst[off + x*4 + 3]) << 24); self.vert_pred[x + 0] = cur; - let cur = (dst[off + x*4 + 4] as u32) - | ((dst[off + x*4 + 5] as u32) << 8) - | ((dst[off + x*4 + 6] as u32) << 16) - | ((dst[off + x*4 + 7] as u32) << 24); + let cur = u32::from(dst[off + x*4 + 4]) + | (u32::from(dst[off + x*4 + 5]) << 8) + | (u32::from(dst[off + x*4 + 6]) << 16) + | (u32::from(dst[off + x*4 + 7]) << 24); hor_pred = cur.wrapping_sub(self.vert_pred[x + 1]); self.vert_pred[x + 1] = cur; } @@ -599,15 +580,13 @@ impl NADecoder for TM1Decoder { let mask_bits = &src[hdr_size..][..mask_size]; let index_bytes = &src[hdr_size+mask_size..]; validate!(src.len() >= hdr_size + mask_size); - self.vert_pred.truncate(0); + self.vert_pred.clear(); self.vert_pred.resize(out_width, 0); if is_intra || is_sprite { let fmt = if is_24bit { BGR0_FORMAT } else { RGB555_FORMAT }; let myinfo = NAVideoInfo::new(out_width, height, false, fmt); - let bufret = alloc_video_buffer(myinfo, 2); - if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let bufinfo = bufret.unwrap(); + let bufinfo = alloc_video_buffer(myinfo, 2)?; self.lastframe.reset(); if !is_24bit { self.lastframe.set16(bufinfo.get_vbuf16().unwrap()); @@ -618,8 +597,8 @@ impl NADecoder for TM1Decoder { self.blk_w = compr_info.block_w; self.blk_h = compr_info.block_h; - let mut mask = MaskState::new(is_intra && !is_sprite, &mask_bits, mask_row_size); - let mut index = IndexState::new(&index_bytes); + let mut mask = MaskState::new(is_intra && !is_sprite, mask_bits, mask_row_size); + let mut index = IndexState::new(index_bytes); let bufinfo; if !is_24bit { if let Some(mut buf) = self.lastframe.get16() { @@ -640,17 +619,15 @@ impl NADecoder for TM1Decoder { } else { return Err(DecoderError::MissingReference); } - } else { - if let Some(mut buf) = self.lastframe.get24() { - let stride = buf.get_stride(0); - { - let data = buf.get_data_mut().unwrap(); - self.decode_24bit(data.as_mut_slice(), stride, out_width, height, &mut mask, &mut index)?; - } - bufinfo = NABufferType::VideoPacked(buf); - } else { - return Err(DecoderError::MissingReference); + } else if let Some(mut buf) = self.lastframe.get24() { + let stride = buf.get_stride(0); + { + let data = buf.get_data_mut().unwrap(); + self.decode_24bit(data.as_mut_slice(), stride, out_width, height, &mut mask, &mut index)?; } + bufinfo = NABufferType::VideoPacked(buf); + } else { + return Err(DecoderError::MissingReference); } let mut frm = NAFrame::new_from_pkt(pkt, self.info.clone(), bufinfo); @@ -658,9 +635,18 @@ impl NADecoder for TM1Decoder { frm.set_frame_type(if is_intra { FrameType::I } else { FrameType::P }); Ok(frm.into_ref()) } + fn flush(&mut self) { + self.lastframe.reset(); + } +} + +impl NAOptionHandler for TM1Decoder { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } } -pub fn get_decoder() -> Box { +pub fn get_decoder() -> Box { Box::new(TM1Decoder::new()) } @@ -668,852 +654,41 @@ pub fn get_decoder() -> Box { mod test { use nihav_core::codecs::RegisteredDecoders; use nihav_core::demuxers::RegisteredDemuxers; - use nihav_core::test::dec_video::*; - use crate::codecs::duck_register_all_codecs; - use nihav_commonfmt::demuxers::generic_register_all_demuxers; + use nihav_codec_support::test::dec_video::*; + use crate::duck_register_all_decoders; + use nihav_commonfmt::generic_register_all_demuxers; #[test] fn test_tm1() { let mut dmx_reg = RegisteredDemuxers::new(); generic_register_all_demuxers(&mut dmx_reg); let mut dec_reg = RegisteredDecoders::new(); - duck_register_all_codecs(&mut dec_reg); - + duck_register_all_decoders(&mut dec_reg); + + // sample: https://samples.mplayerhq.hu/V-codecs/DUCK/phant2-940.duk + test_decoding("avi", "truemotion1", "assets/Duck/phant2-940.duk", Some(12), &dmx_reg, &dec_reg, + ExpectedTestResult::MD5Frames(vec![ + [0x989e62b8, 0x5d85c23c, 0x1cffba6d, 0xe599f1c4], + [0xc4231321, 0x25561487, 0x9db11f57, 0x4faeb9a5], + [0x36e3a831, 0xdbd21f89, 0x0a446071, 0xf6d31ee7], + [0x0af640af, 0x64bc2bac, 0x0e95dd72, 0x9e55360b], + [0xbc9c5f8b, 0x6c06f2bc, 0x216f4129, 0x3a421337], + [0xd8ea7297, 0xce5f79fc, 0x46071f4c, 0xaed7fb7a], + [0x87617060, 0x72ce8df8, 0xde42eaa6, 0x804a6f45], + [0xfd8c45b3, 0xf424b683, 0xb4d6a9bd, 0xc622d0b9], + [0x6c233746, 0xba8ed68e, 0xc0ed0e85, 0xc99e1dc0], + [0x5842aac0, 0xd3d78242, 0x5da21218, 0xea1ed0ad], + [0xdea0db20, 0xe2ce3586, 0xf7386649, 0xecc374f9], + [0xb80ae9cb, 0x04eb938e, 0xd8a337ee, 0x0054b5ed], + [0xf8b80e1d, 0xd8eb3d6c, 0xa99b23ff, 0x562851a1]])); + test_decoding("avi", "truemotion1", "assets/Duck/SPRITES.AVI", Some(2), &dmx_reg, &dec_reg, + ExpectedTestResult::MD5([0xb89a4275, 0xf9797f5f, 0xe53c1ccd, 0xfa163e02])); //let file = "assets/Duck/AVI-DUCK-dk3.duk"; - let file = "assets/Duck/phant2-940.duk"; + //let file = "assets/Duck/phant2-940.duk"; //let file = "assets/Duck/bugsampler-m01-16bit.avi"; //let file = "assets/Duck/sonic3dblast_intro.avi"; //let file = "assets/Duck/BUTTONS.AVI"; //let file = "assets/Duck/SPRITES.AVI"; //let file = "assets/Duck/TRICORD.AVI"; - test_file_decoding("avi", file, Some(42), true, false, None/*Some("tm1-")*/, &dmx_reg, &dec_reg); + //test_file_decoding("avi", file, Some(42), true, false, None/*Some("tm1-")*/, &dmx_reg, &dec_reg); } } - -#[derive(Clone,Copy)] -struct TM1ComprInfo { - is_24bit: bool, - block_w: usize, - block_h: usize, -} - -const TM1_COMPR_TYPES: [Option; 17] = [ - None, - Some(TM1ComprInfo { is_24bit: false, block_w: 4, block_h: 4 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 4, block_h: 4 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 4, block_h: 2 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 4, block_h: 2 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 2, block_h: 4 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 2, block_h: 4 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 2, block_h: 2 }), - Some(TM1ComprInfo { is_24bit: false, block_w: 2, block_h: 2 }), - None, - Some(TM1ComprInfo { is_24bit: true, block_w: 4, block_h: 4 }), - None, - Some(TM1ComprInfo { is_24bit: true, block_w: 4, block_h: 2 }), - None, - Some(TM1ComprInfo { is_24bit: true, block_w: 2, block_h: 4 }), - None, - Some(TM1ComprInfo { is_24bit: true, block_w: 2, block_h: 2 }), -]; - -const DUCK_Y_DELTAS: [[i32; 8]; 4] = [ - [ 0, -1, 1, -3, 3, -6, 6, -6 ], - [ 0, -1, 2, -3, 4, -6, 6, -6 ], - [ 2, -3, 10, -10, 23, -23, 47, -47 ], - [ 0, -2, 2, -8, 8, -18, 18, -40 ] -]; -const DUCK_Y_FAT_DELTA3: [i32; 8] = [ 0, -15, 50, -50, 115, -115, 235, -235 ]; -const DUCK_Y_FAT_DELTA4: [i32; 8] = [ 0, 40, 80, -76, 160, -154, 236, -236 ]; -const DUCK_Y_FAT_DELTAS: [&[i32]; 4] = [ - &DUCK_Y_FAT_DELTA3, &DUCK_Y_FAT_DELTA3, &DUCK_Y_FAT_DELTA3, &DUCK_Y_FAT_DELTA4 -]; - -const DUCK_C_DELTAS: [[i32; 8]; 4] = [ - [ 0, -1, 1, -2, 3, -4, 5, -4 ], - [ 0, -1, 1, -2, 3, -4, 5, -4 ], - [ 0, -4, 3, -16, 20, -32, 36, -32 ], - [ 0, -2, 2, -8, 8, -18, 18, -40 ] -]; -const DUCK_C_FAT_DELTA3: [i32; 8] = [ 0, -20, 15, -80, 100, -160, 180, -160 ]; -const DUCK_C_FAT_DELTAS: [&[i32]; 4] = [ - &DUCK_C_FAT_DELTA3, &DUCK_C_FAT_DELTA3, &DUCK_C_FAT_DELTA3, &DUCK_Y_FAT_DELTA4 -]; - -const DUCK_VECTBL2: &[u8] = &[ -0x8,0x00,0x00,0x00,0x00, -0x8,0x00,0x00,0x00,0x00, -0x8,0x10,0x00,0x00,0x00, -0x8,0x01,0x00,0x00,0x00, -0x8,0x00,0x10,0x00,0x00, -0x8,0x00,0x01,0x00,0x00, -0x8,0x00,0x00,0x10,0x00, -0x8,0x00,0x00,0x01,0x00, -0x8,0x00,0x00,0x00,0x10, -0x8,0x00,0x00,0x00,0x01, -0x6,0x00,0x00,0x00, -0x6,0x10,0x00,0x00, -0x6,0x01,0x00,0x00, -0x6,0x00,0x10,0x00, -0x6,0x00,0x01,0x00, -0x6,0x00,0x00,0x01, -0x6,0x00,0x00,0x10, -0x6,0x00,0x00,0x02, -0x6,0x00,0x00,0x20, -0x6,0x20,0x10,0x00, -0x6,0x00,0x02,0x01, -0x6,0x00,0x20,0x10, -0x6,0x02,0x01,0x00, -0x6,0x11,0x00,0x00, -0x6,0x00,0x20,0x00, -0x6,0x00,0x02,0x00, -0x6,0x20,0x00,0x00, -0x6,0x01,0x10,0x00, -0x6,0x02,0x00,0x00, -0x6,0x01,0x00,0x02, -0x6,0x10,0x00,0x20, -0x6,0x00,0x01,0x02, -0x6,0x10,0x01,0x00, -0x6,0x00,0x10,0x20, -0x6,0x10,0x10,0x00, -0x6,0x10,0x00,0x01, -0x6,0x20,0x00,0x10, -0x6,0x02,0x00,0x01, -0x6,0x01,0x01,0x00, -0x6,0x01,0x00,0x10, -0x6,0x00,0x11,0x00, -0x6,0x10,0x00,0x02, -0x6,0x00,0x01,0x10, -0x6,0x00,0x00,0x11, -0x6,0x10,0x00,0x10, -0x6,0x01,0x00,0x01, -0x6,0x00,0x00,0x22, -0x6,0x02,0x01,0x01, -0x6,0x10,0x20,0x10, -0x6,0x01,0x02,0x01, -0x6,0x20,0x10,0x10, -0x6,0x01,0x00,0x20, -0x6,0x00,0x10,0x01, -0x6,0x21,0x10,0x00, -0x6,0x10,0x02,0x01, -0x6,0x12,0x01,0x00, -0x6,0x01,0x20,0x10, -0x6,0x01,0x02,0x00, -0x6,0x10,0x20,0x00, -0x6,0x00,0x10,0x02, -0x6,0x00,0x01,0x20, -0x6,0x00,0x02,0x21, -0x6,0x00,0x02,0x20, -0x6,0x00,0x00,0x12, -0x6,0x00,0x00,0x21, -0x6,0x20,0x11,0x00, -0x6,0x00,0x01,0x01, -0x6,0x11,0x10,0x00, -0x6,0x00,0x20,0x12, -0x6,0x00,0x20,0x11, -0x6,0x20,0x10,0x02, -0x6,0x02,0x01,0x20, -0x6,0x00,0x22,0x11, -0x6,0x00,0x10,0x10, -0x6,0x02,0x11,0x00, -0x6,0x00,0x21,0x10, -0x6,0x00,0x02,0x03, -0x6,0x20,0x10,0x01, -0x6,0x00,0x12,0x01, -0x4,0x11,0x00, -0x4,0x00,0x22, -0x4,0x20,0x00, -0x4,0x01,0x10, -0x4,0x02,0x20, -0x4,0x00,0x20, -0x4,0x02,0x00, -0x4,0x10,0x01, -0x4,0x00,0x11, -0x4,0x02,0x01, -0x4,0x02,0x21, -0x4,0x00,0x02, -0x4,0x20,0x02, -0x4,0x01,0x01, -0x4,0x10,0x10, -0x4,0x10,0x02, -0x4,0x22,0x00, -0x4,0x10,0x00, -0x4,0x01,0x00, -0x4,0x21,0x00, -0x4,0x12,0x00, -0x4,0x00,0x10, -0x4,0x20,0x12, -0x4,0x01,0x11, -0x4,0x00,0x01, -0x4,0x01,0x02, -0x4,0x11,0x02, -0x4,0x11,0x01, -0x4,0x10,0x20, -0x4,0x20,0x01, -0x4,0x22,0x11, -0x4,0x00,0x12, -0x4,0x20,0x10, -0x4,0x22,0x01, -0x4,0x01,0x20, -0x4,0x00,0x21, -0x4,0x10,0x11, -0x4,0x21,0x10, -0x4,0x10,0x22, -0x4,0x02,0x03, -0x4,0x12,0x01, -0x4,0x20,0x11, -0x4,0x11,0x10, -0x4,0x20,0x30, -0x4,0x11,0x20, -0x4,0x02,0x10, -0x4,0x22,0x10, -0x4,0x11,0x11, -0x4,0x30,0x20, -0x4,0x30,0x00, -0x4,0x01,0x22, -0x4,0x01,0x12, -0x4,0x02,0x11, -0x4,0x03,0x02, -0x4,0x03,0x00, -0x4,0x10,0x21, -0x4,0x12,0x20, -0x4,0x00,0x00, -0x4,0x12,0x21, -0x4,0x21,0x11, -0x4,0x02,0x22, -0x4,0x10,0x12, -0x4,0x31,0x00, -0x4,0x20,0x20, -0x4,0x00,0x03, -0x4,0x02,0x02, -0x4,0x22,0x20, -0x4,0x01,0x21, -0x4,0x21,0x02, -0x4,0x21,0x12, -0x4,0x11,0x22, -0x4,0x00,0x30, -0x4,0x12,0x11, -0x4,0x20,0x22, -0x4,0x31,0x20, -0x4,0x21,0x30, -0x4,0x22,0x02, -0x4,0x22,0x22, -0x4,0x20,0x31, -0x4,0x13,0x02, -0x4,0x03,0x10, -0x4,0x11,0x12, -0x4,0x00,0x13, -0x4,0x21,0x01, -0x4,0x12,0x03, -0x4,0x13,0x00, -0x4,0x13,0x10, -0x4,0x02,0x13, -0x4,0x30,0x01, -0x4,0x12,0x10, -0x4,0x22,0x13, -0x4,0x03,0x12, -0x4,0x31,0x01, -0x4,0x30,0x22, -0x4,0x00,0x31, -0x4,0x01,0x31, -0x4,0x02,0x23, -0x4,0x01,0x30, -0x4,0x11,0x21, -0x4,0x22,0x21, -0x4,0x01,0x13, -0x4,0x10,0x03, -0x4,0x22,0x03, -0x4,0x30,0x21, -0x4,0x21,0x31, -0x4,0x33,0x00, -0x4,0x13,0x12, -0x4,0x11,0x31, -0x4,0x30,0x02, -0x4,0x12,0x02, -0x4,0x11,0x13, -0x4,0x12,0x22, -0x4,0x20,0x32, -0x4,0x10,0x13, -0x4,0x22,0x31, -0x4,0x21,0x20, -0x4,0x01,0x33, -0x4,0x33,0x10, -0x4,0x20,0x13, -0x4,0x31,0x22, -0x4,0x13,0x30, -0x4,0x01,0x03, -0x4,0x11,0x33, -0x4,0x20,0x21, -0x4,0x13,0x31, -0x4,0x03,0x22, -0x4,0x31,0x02, -0x4,0x00,0x24, -0x2,0x00, -0x2,0x10, -0x2,0x20, -0x2,0x30, -0x2,0x40, -0x2,0x50, -0x2,0x60, -0x2,0x01, -0x2,0x11, -0x2,0x21, -0x2,0x31, -0x2,0x41, -0x2,0x51, -0x2,0x61, -0x2,0x02, -0x2,0x12, -0x2,0x22, -0x2,0x32, -0x2,0x42, -0x2,0x52, -0x2,0x62, -0x2,0x03, -0x2,0x13, -0x2,0x23, -0x2,0x33, -0x2,0x43, -0x2,0x53, -0x2,0x63, -0x2,0x04, -0x2,0x14, -0x2,0x24, -0x2,0x34, -0x2,0x44, -0x2,0x54, -0x2,0x64, -0x2,0x05, -0x2,0x15, -0x2,0x25, -0x2,0x35, -0x2,0x45, -0x2,0x55, -0x2,0x65, -0x2,0x06, -0x2,0x16, -0x2,0x26, -0x2,0x36, -0x2,0x46, -0x2,0x56, -0x2,0x66 -]; - -const DUCK_VECTBL3: &[u8] = &[ -0x6,0x00,0x00,0x00, -0x6,0x00,0x00,0x00, -0x6,0x00,0x00,0x01, -0x6,0x00,0x00,0x10, -0x6,0x00,0x00,0x11, -0x6,0x00,0x01,0x00, -0x6,0x00,0x01,0x01, -0x6,0x00,0x01,0x10, -0x6,0x00,0x01,0x11, -0x6,0x00,0x10,0x00, -0x6,0x00,0x10,0x01, -0x6,0x00,0x10,0x10, -0x6,0x00,0x10,0x11, -0x6,0x00,0x11,0x00, -0x6,0x00,0x11,0x01, -0x6,0x00,0x11,0x10, -0x6,0x00,0x11,0x11, -0x6,0x01,0x00,0x00, -0x6,0x01,0x00,0x01, -0x6,0x01,0x00,0x10, -0x6,0x01,0x00,0x11, -0x6,0x01,0x01,0x00, -0x6,0x01,0x01,0x01, -0x6,0x01,0x01,0x10, -0x6,0x01,0x01,0x11, -0x6,0x01,0x10,0x00, -0x6,0x01,0x10,0x01, -0x6,0x01,0x10,0x10, -0x6,0x01,0x10,0x11, -0x6,0x01,0x11,0x00, -0x6,0x01,0x11,0x01, -0x6,0x01,0x11,0x10, -0x6,0x01,0x11,0x11, -0x6,0x10,0x00,0x00, -0x6,0x10,0x00,0x01, -0x6,0x10,0x00,0x10, -0x6,0x10,0x00,0x11, -0x6,0x10,0x01,0x00, -0x6,0x10,0x01,0x01, -0x6,0x10,0x01,0x10, -0x6,0x10,0x01,0x11, -0x6,0x10,0x10,0x00, -0x6,0x10,0x10,0x01, -0x6,0x10,0x10,0x10, -0x6,0x10,0x10,0x11, -0x6,0x10,0x11,0x00, -0x6,0x10,0x11,0x01, -0x6,0x10,0x11,0x10, -0x6,0x10,0x11,0x11, -0x6,0x11,0x00,0x00, -0x6,0x11,0x00,0x01, -0x6,0x11,0x00,0x10, -0x6,0x11,0x00,0x11, -0x6,0x11,0x01,0x00, -0x6,0x11,0x01,0x01, -0x6,0x11,0x01,0x10, -0x6,0x11,0x01,0x11, -0x6,0x11,0x10,0x00, -0x6,0x11,0x10,0x01, -0x6,0x11,0x10,0x10, -0x6,0x11,0x10,0x11, -0x6,0x11,0x11,0x00, -0x6,0x11,0x11,0x01, -0x6,0x11,0x11,0x10, -0x4,0x00,0x00, -0x4,0x00,0x01, -0x4,0x00,0x02, -0x4,0x00,0x03, -0x4,0x00,0x10, -0x4,0x00,0x11, -0x4,0x00,0x12, -0x4,0x00,0x13, -0x4,0x00,0x20, -0x4,0x00,0x21, -0x4,0x00,0x22, -0x4,0x00,0x23, -0x4,0x00,0x30, -0x4,0x00,0x31, -0x4,0x00,0x32, -0x4,0x00,0x33, -0x4,0x01,0x00, -0x4,0x01,0x01, -0x4,0x01,0x02, -0x4,0x01,0x03, -0x4,0x01,0x10, -0x4,0x01,0x11, -0x4,0x01,0x12, -0x4,0x01,0x13, -0x4,0x01,0x20, -0x4,0x01,0x21, -0x4,0x01,0x22, -0x4,0x01,0x23, -0x4,0x01,0x30, -0x4,0x01,0x31, -0x4,0x01,0x32, -0x4,0x01,0x33, -0x4,0x02,0x00, -0x4,0x02,0x01, -0x4,0x02,0x02, -0x4,0x02,0x03, -0x4,0x02,0x10, -0x4,0x02,0x11, -0x4,0x02,0x12, -0x4,0x02,0x13, -0x4,0x02,0x20, -0x4,0x02,0x21, -0x4,0x02,0x22, -0x4,0x02,0x23, -0x4,0x02,0x30, -0x4,0x02,0x31, -0x4,0x02,0x32, -0x4,0x02,0x33, -0x4,0x03,0x00, -0x4,0x03,0x01, -0x4,0x03,0x02, -0x4,0x03,0x03, -0x4,0x03,0x10, -0x4,0x03,0x11, -0x4,0x03,0x12, -0x4,0x03,0x13, -0x4,0x03,0x20, -0x4,0x03,0x21, -0x4,0x03,0x22, -0x4,0x03,0x23, -0x4,0x03,0x30, -0x4,0x03,0x31, -0x4,0x03,0x32, -0x4,0x03,0x33, -0x4,0x10,0x00, -0x4,0x10,0x01, -0x4,0x10,0x02, -0x4,0x10,0x03, -0x4,0x10,0x10, -0x4,0x10,0x11, -0x4,0x10,0x12, -0x4,0x10,0x13, -0x4,0x10,0x20, -0x4,0x10,0x21, -0x4,0x10,0x22, -0x4,0x10,0x23, -0x4,0x10,0x30, -0x4,0x10,0x31, -0x4,0x10,0x32, -0x4,0x10,0x33, -0x4,0x11,0x00, -0x4,0x11,0x01, -0x4,0x11,0x02, -0x4,0x11,0x03, -0x4,0x11,0x10, -0x4,0x11,0x11, -0x4,0x11,0x12, -0x4,0x11,0x13, -0x4,0x11,0x20, -0x4,0x11,0x21, -0x4,0x11,0x22, -0x4,0x11,0x23, -0x4,0x11,0x30, -0x4,0x11,0x31, -0x4,0x11,0x32, -0x4,0x11,0x33, -0x4,0x12,0x00, -0x4,0x12,0x01, -0x4,0x12,0x02, -0x4,0x12,0x03, -0x4,0x12,0x10, -0x4,0x12,0x11, -0x4,0x12,0x12, -0x4,0x12,0x13, -0x4,0x12,0x20, -0x4,0x12,0x21, -0x4,0x12,0x22, -0x4,0x12,0x23, -0x4,0x12,0x30, -0x4,0x12,0x31, -0x4,0x12,0x32, -0x4,0x12,0x33, -0x4,0x13,0x00, -0x4,0x13,0x01, -0x4,0x13,0x02, -0x4,0x13,0x03, -0x4,0x13,0x10, -0x4,0x13,0x11, -0x4,0x13,0x12, -0x4,0x13,0x13, -0x4,0x13,0x20, -0x4,0x13,0x21, -0x4,0x13,0x22, -0x4,0x13,0x23, -0x4,0x13,0x30, -0x4,0x13,0x31, -0x4,0x13,0x32, -0x4,0x13,0x33, -0x2,0x00, -0x2,0x10, -0x2,0x20, -0x2,0x30, -0x2,0x40, -0x2,0x50, -0x2,0x60, -0x2,0x70, -0x2,0x01, -0x2,0x11, -0x2,0x21, -0x2,0x31, -0x2,0x41, -0x2,0x51, -0x2,0x61, -0x2,0x71, -0x2,0x02, -0x2,0x12, -0x2,0x22, -0x2,0x32, -0x2,0x42, -0x2,0x52, -0x2,0x62, -0x2,0x72, -0x2,0x03, -0x2,0x13, -0x2,0x23, -0x2,0x33, -0x2,0x43, -0x2,0x53, -0x2,0x63, -0x2,0x73, -0x2,0x04, -0x2,0x14, -0x2,0x24, -0x2,0x34, -0x2,0x44, -0x2,0x54, -0x2,0x64, -0x2,0x74, -0x2,0x05, -0x2,0x15, -0x2,0x25, -0x2,0x35, -0x2,0x45, -0x2,0x55, -0x2,0x65, -0x2,0x75, -0x2,0x06, -0x2,0x16, -0x2,0x26, -0x2,0x36, -0x2,0x46, -0x2,0x56, -0x2,0x66, -0x2,0x76, -0x2,0x07, -0x2,0x17, -0x2,0x27, -0x2,0x37, -0x2,0x47, -0x2,0x57, -0x2,0x67, -0x2,0x77 -]; - -const DUCK_VECTBL4: &[u8] = &[ -0x8,0x00,0x00,0x00,0x00, -0x8,0x00,0x00,0x00,0x00, -0x8,0x20,0x00,0x00,0x00, -0x8,0x00,0x00,0x00,0x01, -0x8,0x10,0x00,0x00,0x00, -0x8,0x00,0x00,0x00,0x02, -0x8,0x01,0x00,0x00,0x00, -0x8,0x00,0x00,0x00,0x10, -0x8,0x02,0x00,0x00,0x00, -0x6,0x00,0x00,0x00, -0x6,0x20,0x00,0x00, -0x6,0x00,0x00,0x01, -0x6,0x10,0x00,0x00, -0x6,0x00,0x00,0x02, -0x6,0x00,0x10,0x00, -0x6,0x00,0x20,0x00, -0x6,0x00,0x02,0x00, -0x6,0x00,0x01,0x00, -0x6,0x01,0x00,0x00, -0x6,0x00,0x00,0x20, -0x6,0x02,0x00,0x00, -0x6,0x00,0x00,0x10, -0x6,0x10,0x00,0x20, -0x6,0x01,0x00,0x02, -0x6,0x20,0x00,0x10, -0x6,0x02,0x00,0x01, -0x6,0x20,0x10,0x00, -0x6,0x00,0x12,0x00, -0x6,0x00,0x02,0x01, -0x6,0x02,0x01,0x00, -0x6,0x00,0x21,0x00, -0x6,0x00,0x01,0x02, -0x6,0x00,0x20,0x10, -0x6,0x00,0x00,0x21, -0x6,0x00,0x00,0x12, -0x6,0x00,0x01,0x20, -0x6,0x12,0x00,0x00, -0x6,0x00,0x10,0x20, -0x6,0x01,0x20,0x00, -0x6,0x02,0x10,0x00, -0x6,0x10,0x20,0x00, -0x6,0x01,0x02,0x00, -0x6,0x21,0x00,0x00, -0x6,0x00,0x02,0x10, -0x6,0x20,0x01,0x00, -0x6,0x00,0x22,0x00, -0x6,0x10,0x02,0x00, -0x6,0x00,0x10,0x02, -0x6,0x11,0x00,0x00, -0x6,0x00,0x11,0x00, -0x6,0x22,0x00,0x00, -0x6,0x20,0x00,0x02, -0x6,0x10,0x00,0x01, -0x6,0x00,0x20,0x01, -0x6,0x02,0x20,0x00, -0x6,0x01,0x10,0x00, -0x6,0x01,0x00,0x20, -0x6,0x00,0x20,0x02, -0x6,0x01,0x20,0x02, -0x6,0x10,0x01,0x00, -0x6,0x02,0x00,0x10, -0x6,0x00,0x10,0x01, -0x6,0x10,0x01,0x20, -0x6,0x20,0x02,0x10, -0x6,0x00,0x00,0x22, -0x6,0x10,0x00,0x02, -0x6,0x00,0x02,0x20, -0x6,0x20,0x02,0x00, -0x6,0x00,0x00,0x11, -0x6,0x02,0x10,0x01, -0x6,0x00,0x01,0x10, -0x6,0x00,0x02,0x11, -0x4,0x01,0x02, -0x4,0x02,0x01, -0x4,0x01,0x00, -0x4,0x10,0x20, -0x4,0x20,0x10, -0x4,0x20,0x00, -0x4,0x11,0x00, -0x4,0x02,0x00, -0x4,0x12,0x00, -0x4,0x00,0x21, -0x4,0x22,0x00, -0x4,0x00,0x12, -0x4,0x21,0x00, -0x4,0x02,0x11, -0x4,0x00,0x01, -0x4,0x10,0x02, -0x4,0x02,0x20, -0x4,0x20,0x11, -0x4,0x01,0x10, -0x4,0x21,0x10, -0x4,0x10,0x00, -0x4,0x10,0x22, -0x4,0x20,0x20, -0x4,0x00,0x22, -0x4,0x01,0x22, -0x4,0x20,0x01, -0x4,0x02,0x02, -0x4,0x00,0x20, -0x4,0x00,0x10, -0x4,0x00,0x11, -0x4,0x22,0x01, -0x4,0x11,0x20, -0x4,0x12,0x01, -0x4,0x12,0x20, -0x4,0x11,0x02, -0x4,0x10,0x10, -0x4,0x01,0x01, -0x4,0x02,0x21, -0x4,0x20,0x12, -0x4,0x01,0x12, -0x4,0x22,0x11, -0x4,0x21,0x12, -0x4,0x22,0x10, -0x4,0x21,0x02, -0x4,0x20,0x02, -0x4,0x10,0x01, -0x4,0x00,0x02, -0x4,0x10,0x21, -0x4,0x01,0x20, -0x4,0x11,0x22, -0x4,0x12,0x21, -0x4,0x22,0x20, -0x4,0x02,0x10, -0x4,0x02,0x22, -0x4,0x11,0x10, -0x4,0x22,0x02, -0x4,0x20,0x21, -0x4,0x01,0x11, -0x4,0x11,0x01, -0x4,0x10,0x12, -0x4,0x02,0x12, -0x4,0x20,0x22, -0x4,0x21,0x20, -0x4,0x01,0x21, -0x4,0x12,0x02, -0x4,0x21,0x11, -0x4,0x12,0x22, -0x4,0x12,0x10, -0x4,0x22,0x21, -0x4,0x10,0x11, -0x4,0x21,0x01, -0x4,0x11,0x12, -0x4,0x12,0x11, -0x4,0x66,0x66, -0x4,0x22,0x22, -0x4,0x11,0x21, -0x4,0x11,0x11, -0x4,0x21,0x22, -0x4,0x00,0x00, -0x4,0x22,0x12, -0x4,0x12,0x12, -0x4,0x21,0x21, -0x4,0x42,0x00, -0x4,0x00,0x04, -0x4,0x40,0x00, -0x4,0x30,0x00, -0x4,0x31,0x00, -0x4,0x00,0x03, -0x4,0x00,0x14, -0x4,0x00,0x13, -0x4,0x01,0x24, -0x4,0x20,0x13, -0x4,0x01,0x42, -0x4,0x14,0x20, -0x4,0x42,0x02, -0x4,0x13,0x00, -0x4,0x00,0x24, -0x4,0x31,0x20, -0x4,0x22,0x13, -0x4,0x11,0x24, -0x4,0x12,0x66, -0x4,0x30,0x01, -0x4,0x02,0x13, -0x4,0x12,0x42, -0x4,0x40,0x10, -0x4,0x40,0x02, -0x4,0x01,0x04, -0x4,0x24,0x00, -0x4,0x42,0x10, -0x4,0x21,0x13, -0x4,0x13,0x12, -0x4,0x31,0x21, -0x4,0x21,0x24, -0x4,0x00,0x40, -0x4,0x10,0x24, -0x4,0x10,0x42, -0x4,0x32,0x01, -0x4,0x11,0x42, -0x4,0x20,0x31, -0x4,0x12,0x40, -0x2,0x00, -0x2,0x10, -0x2,0x20, -0x2,0x30, -0x2,0x40, -0x2,0x50, -0x2,0x60, -0x2,0x70, -0x2,0x01, -0x2,0x11, -0x2,0x21, -0x2,0x31, -0x2,0x41, -0x2,0x51, -0x2,0x61, -0x2,0x71, -0x2,0x02, -0x2,0x12, -0x2,0x22, -0x2,0x32, -0x2,0x42, -0x2,0x52, -0x2,0x62, -0x2,0x72, -0x2,0x03, -0x2,0x13, -0x2,0x23, -0x2,0x33, -0x2,0x43, -0x2,0x53, -0x2,0x63, -0x2,0x73, -0x2,0x04, -0x2,0x14, -0x2,0x24, -0x2,0x34, -0x2,0x44, -0x2,0x54, -0x2,0x64, -0x2,0x74, -0x2,0x05, -0x2,0x15, -0x2,0x25, -0x2,0x35, -0x2,0x45, -0x2,0x55, -0x2,0x65, -0x2,0x75, -0x2,0x06, -0x2,0x16, -0x2,0x26, -0x2,0x36, -0x2,0x46, -0x2,0x56, -0x2,0x66, -0x2,0x76, -0x2,0x07, -0x2,0x17, -0x2,0x27, -0x2,0x37, -0x2,0x47, -0x2,0x57, -0x2,0x67, -0x2,0x77 -]; - -const DUCK_VECTABLES: [&[u8]; 3] = [ DUCK_VECTBL2, DUCK_VECTBL3, DUCK_VECTBL4 ];