]> git.nihav.org Git - nihav.git/blame - nihav-acorn/src/codecs/mod.rs
Acorn Super Moving Blocks Decoder
[nihav.git] / nihav-acorn / src / codecs / mod.rs
CommitLineData
e981a888
KS
1use nihav_core::codecs::*;
2
3#[cfg(debug_assertions)]
4macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
6}
7#[cfg(not(debug_assertions))]
8macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
10}
11
12#[allow(dead_code)]
13const 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)]
22mod yuvtab;
23
24#[cfg(feature="decoder_movinglines")]
25mod movinglines;
26#[cfg(feature="decoder_movingblocks")]
27mod movingblocks;
8a350691
KS
28#[cfg(feature="decoder_movingblockshq")]
29mod movingblockshq;
b8ea95bc
KS
30#[cfg(feature="decoder_supermovingblocks")]
31mod supermovingblocks;
722b2933
KS
32#[cfg(feature="decoder_rawvideo")]
33mod rawvideo;
e981a888 34
672bcc7f
KS
35#[cfg(feature="decoder_linepack")]
36mod linepack;
37
41a3a050
KS
38#[cfg(feature="decoder_rawaudio")]
39mod rawaudio;
40
e981a888 41const ACORN_CODECS: &[DecoderInfo] = &[
722b2933
KS
42#[cfg(feature="decoder_rawvideo")]
43 DecoderInfo { name: "arm_rawvideo", get_decoder: rawvideo::get_decoder },
e981a888
KS
44#[cfg(feature="decoder_movinglines")]
45 DecoderInfo { name: "movinglines", get_decoder: movinglines::get_decoder },
46#[cfg(feature="decoder_movingblocks")]
47 DecoderInfo { name: "movingblocks", get_decoder: movingblocks::get_decoder },
8a350691
KS
48#[cfg(feature="decoder_movingblockshq")]
49 DecoderInfo { name: "movingblockshq", get_decoder: movingblockshq::get_decoder },
b8ea95bc
KS
50#[cfg(feature="decoder_supermovingblocks")]
51 DecoderInfo { name: "supermovingblocks", get_decoder: supermovingblocks::get_decoder },
672bcc7f
KS
52
53#[cfg(feature="decoder_linepack")]
54 DecoderInfo { name: "linepack", get_decoder: linepack::get_decoder },
41a3a050
KS
55
56#[cfg(feature="decoder_rawaudio")]
57 DecoderInfo { name: "arm_rawaudio", get_decoder: rawaudio::get_decoder },
e981a888
KS
58];
59
60/// Registers all available codecs provided by this crate.
61pub fn acorn_register_all_decoders(rd: &mut RegisteredDecoders) {
62 for decoder in ACORN_CODECS.iter() {
63 rd.add_decoder(*decoder);
64 }
65}
66
e3af9911
KS
67#[cfg(any(feature="packetiser_cinepak", feature="packetiser_msvideo1"))]
68mod wss_packetisers;
69
e981a888 70const ACORN_PACKETISERS: &[PacketiserInfo] = &[
722b2933
KS
71#[cfg(feature="decoder_rawvideo")]
72 PacketiserInfo { name: "arm_rawvideo", get_packetiser: rawvideo::get_packetiser },
e981a888
KS
73#[cfg(feature="decoder_movinglines")]
74 PacketiserInfo { name: "movinglines", get_packetiser: movinglines::get_packetiser },
75#[cfg(feature="decoder_movingblocks")]
76 PacketiserInfo { name: "movingblocks", get_packetiser: movingblocks::get_packetiser },
8a350691
KS
77#[cfg(feature="decoder_movingblockshq")]
78 PacketiserInfo { name: "movingblockshq", get_packetiser: movingblockshq::get_packetiser },
b8ea95bc
KS
79#[cfg(feature="decoder_supermovingblocks")]
80 PacketiserInfo { name: "supermovingblocks", get_packetiser: supermovingblocks::get_packetiser },
672bcc7f
KS
81
82#[cfg(feature="decoder_linepack")]
83 PacketiserInfo { name: "linepack", get_packetiser: linepack::get_packetiser },
41a3a050
KS
84
85#[cfg(feature="decoder_rawaudio")]
86 PacketiserInfo { name: "arm_rawaudio", get_packetiser: rawaudio::get_packetiser },
e3af9911
KS
87
88#[cfg(feature="packetiser_cinepak")]
89 PacketiserInfo { name: "cinepak", get_packetiser: wss_packetisers::get_packetiser_cinepak },
90#[cfg(feature="packetiser_msvideo1")]
91 PacketiserInfo { name: "msvideo1", get_packetiser: wss_packetisers::get_packetiser_msvideo1 },
e981a888
KS
92];
93
94/// Registers all available packetisers provided by this crate.
95pub fn acorn_register_all_packetisers(rp: &mut RegisteredPacketisers) {
96 for pkt in ACORN_PACKETISERS.iter() {
97 rp.add_packetiser(*pkt);
98 }
99}