]>
Commit | Line | Data |
---|---|---|
e981a888 KS |
1 | use nihav_core::codecs::*; |
2 | ||
3 | #[cfg(debug_assertions)] | |
4 | macro_rules! validate { | |
5 | ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; | |
6 | } | |
7 | #[cfg(not(debug_assertions))] | |
8 | macro_rules! validate { | |
9 | ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; | |
10 | } | |
11 | ||
12 | #[allow(dead_code)] | |
13 | const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, | |
14 | comp_info: [ | |
15 | Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), | |
16 | Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), | |
17 | Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), | |
18 | None, None], | |
19 | elem_size: 2, be: false, alpha: false, palette: false }; | |
20 | ||
21 | #[allow(dead_code)] | |
22 | mod yuvtab; | |
23 | ||
24 | #[cfg(feature="decoder_movinglines")] | |
25 | mod movinglines; | |
26 | #[cfg(feature="decoder_movingblocks")] | |
27 | mod movingblocks; | |
8a350691 KS |
28 | #[cfg(feature="decoder_movingblockshq")] |
29 | mod movingblockshq; | |
e981a888 | 30 | |
672bcc7f KS |
31 | #[cfg(feature="decoder_linepack")] |
32 | mod linepack; | |
33 | ||
e981a888 KS |
34 | const ACORN_CODECS: &[DecoderInfo] = &[ |
35 | #[cfg(feature="decoder_movinglines")] | |
36 | DecoderInfo { name: "movinglines", get_decoder: movinglines::get_decoder }, | |
37 | #[cfg(feature="decoder_movingblocks")] | |
38 | DecoderInfo { name: "movingblocks", get_decoder: movingblocks::get_decoder }, | |
8a350691 KS |
39 | #[cfg(feature="decoder_movingblockshq")] |
40 | DecoderInfo { name: "movingblockshq", get_decoder: movingblockshq::get_decoder }, | |
672bcc7f KS |
41 | |
42 | #[cfg(feature="decoder_linepack")] | |
43 | DecoderInfo { name: "linepack", get_decoder: linepack::get_decoder }, | |
e981a888 KS |
44 | ]; |
45 | ||
46 | /// Registers all available codecs provided by this crate. | |
47 | pub fn acorn_register_all_decoders(rd: &mut RegisteredDecoders) { | |
48 | for decoder in ACORN_CODECS.iter() { | |
49 | rd.add_decoder(*decoder); | |
50 | } | |
51 | } | |
52 | ||
53 | const ACORN_PACKETISERS: &[PacketiserInfo] = &[ | |
54 | #[cfg(feature="decoder_movinglines")] | |
55 | PacketiserInfo { name: "movinglines", get_packetiser: movinglines::get_packetiser }, | |
56 | #[cfg(feature="decoder_movingblocks")] | |
57 | PacketiserInfo { name: "movingblocks", get_packetiser: movingblocks::get_packetiser }, | |
8a350691 KS |
58 | #[cfg(feature="decoder_movingblockshq")] |
59 | PacketiserInfo { name: "movingblockshq", get_packetiser: movingblockshq::get_packetiser }, | |
672bcc7f KS |
60 | |
61 | #[cfg(feature="decoder_linepack")] | |
62 | PacketiserInfo { name: "linepack", get_packetiser: linepack::get_packetiser }, | |
e981a888 KS |
63 | ]; |
64 | ||
65 | /// Registers all available packetisers provided by this crate. | |
66 | pub fn acorn_register_all_packetisers(rp: &mut RegisteredPacketisers) { | |
67 | for pkt in ACORN_PACKETISERS.iter() { | |
68 | rp.add_packetiser(*pkt); | |
69 | } | |
70 | } |