vp6enc: split out future common parts to share them with VP7 encoder
[nihav.git] / nihav-duck / src / codecs / mod.rs
CommitLineData
1b8522d6
KS
1use nihav_core::codecs::*;
2
3macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
5}
6
7#[cfg(feature="decoder_truemotion1")]
8mod truemotion1;
9#[cfg(feature="decoder_truemotionrt")]
10mod truemotionrt;
11#[cfg(feature="decoder_truemotion2")]
47933c6d 12#[allow(clippy::needless_range_loop)]
1b8522d6
KS
13mod truemotion2;
14#[cfg(feature="decoder_truemotion2x")]
15mod truemotion2x;
3584b223
KS
16#[cfg(any(feature="decoder_vp3", feature="decoder_vp4", feature="decoder_vp5", feature="decoder_vp6", feature="decoder_vp7"))]
17#[macro_use]
47933c6d
KS
18#[allow(clippy::erasing_op)]
19#[allow(clippy::needless_range_loop)]
20#[allow(clippy::too_many_arguments)]
21#[allow(clippy::useless_let_if_seq)]
3584b223 22mod vpcommon;
40e95291 23#[cfg(any(feature="decoder_vp3", feature="decoder_vp4"))]
47933c6d
KS
24#[allow(clippy::needless_range_loop)]
25#[allow(clippy::too_many_arguments)]
40e95291
KS
26mod vp3;
27#[cfg(any(feature="decoder_vp5", feature="decoder_vp6"))]
47933c6d
KS
28#[allow(clippy::needless_range_loop)]
29#[allow(clippy::useless_let_if_seq)]
30#[allow(clippy::too_many_arguments)]
40e95291 31mod vp56;
3584b223 32#[cfg(feature="decoder_vp5")]
47933c6d 33#[allow(clippy::needless_range_loop)]
3584b223 34mod vp5;
3952bfd9 35#[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
01551716 36mod vp6data;
3952bfd9
KS
37#[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
38mod vp6dsp;
01551716 39#[cfg(feature="decoder_vp6")]
47933c6d 40#[allow(clippy::needless_range_loop)]
3584b223 41mod vp6;
40e95291 42#[cfg(feature="decoder_vp7")]
47933c6d
KS
43#[allow(clippy::needless_range_loop)]
44#[allow(clippy::useless_let_if_seq)]
40e95291 45mod vp7;
d0d21988 46#[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
0cc75664 47mod vp78data;
587a6d78 48#[cfg(feature="decoder_vp7")]
47933c6d
KS
49#[allow(clippy::erasing_op)]
50#[allow(clippy::needless_range_loop)]
51#[allow(clippy::too_many_arguments)]
52#[allow(clippy::useless_let_if_seq)]
587a6d78 53mod vp7dsp;
d0d21988 54#[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
0cc75664
KS
55#[allow(clippy::needless_range_loop)]
56#[allow(clippy::useless_let_if_seq)]
57mod vp78;
d0d21988 58#[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
0cc75664
KS
59#[allow(clippy::erasing_op)]
60#[allow(clippy::needless_range_loop)]
61#[allow(clippy::too_many_arguments)]
62#[allow(clippy::useless_let_if_seq)]
63mod vp78dsp;
d0d21988
KS
64#[cfg(feature="decoder_vp8")]
65#[allow(clippy::needless_range_loop)]
66#[allow(clippy::useless_let_if_seq)]
67mod vp8;
68#[cfg(feature="decoder_vp8")]
69#[allow(clippy::erasing_op)]
70#[allow(clippy::needless_range_loop)]
71#[allow(clippy::too_many_arguments)]
72mod vp8dsp;
1b8522d6 73
029d2552
KS
74#[cfg(any(feature="decoder_dk3_adpcm", feature="decoder_dk4_adpcm"))]
75mod dkadpcm;
1b8522d6 76#[cfg(feature="decoder_on2avc")]
47933c6d
KS
77#[allow(clippy::manual_memcpy)]
78#[allow(clippy::needless_range_loop)]
79#[allow(clippy::too_many_arguments)]
1b8522d6 80mod on2avc;
6a494288
KS
81#[cfg(feature="decoder_on2avc")]
82mod on2avcdata;
1b8522d6
KS
83
84const DUCK_CODECS: &[DecoderInfo] = &[
85#[cfg(feature="decoder_truemotion1")]
86 DecoderInfo { name: "truemotion1", get_decoder: truemotion1::get_decoder },
87#[cfg(feature="decoder_truemotionrt")]
88 DecoderInfo { name: "truemotionrt", get_decoder: truemotionrt::get_decoder },
89#[cfg(feature="decoder_truemotion2")]
90 DecoderInfo { name: "truemotion2", get_decoder: truemotion2::get_decoder },
91#[cfg(feature="decoder_truemotion2x")]
92 DecoderInfo { name: "truemotion2x", get_decoder: truemotion2x::get_decoder },
40e95291
KS
93#[cfg(feature="decoder_vp3")]
94 DecoderInfo { name: "vp3", get_decoder: vp3::get_decoder_vp3 },
95#[cfg(feature="decoder_vp4")]
96 DecoderInfo { name: "vp4", get_decoder: vp3::get_decoder_vp4 },
97#[cfg(feature="decoder_vp5")]
3584b223
KS
98 DecoderInfo { name: "vp5", get_decoder: vp5::get_decoder },
99#[cfg(feature="decoder_vp6")]
100 DecoderInfo { name: "vp6", get_decoder: vp6::get_decoder_vp6 },
40e95291 101#[cfg(feature="decoder_vp6")]
92d9fb69
KS
102 DecoderInfo { name: "vp6f", get_decoder: vp6::get_decoder_vp6f },
103#[cfg(feature="decoder_vp6")]
3584b223 104 DecoderInfo { name: "vp6a", get_decoder: vp6::get_decoder_vp6_alpha },
40e95291
KS
105#[cfg(feature="decoder_vp7")]
106 DecoderInfo { name: "vp7", get_decoder: vp7::get_decoder },
d0d21988
KS
107#[cfg(feature="decoder_vp8")]
108 DecoderInfo { name: "vp8", get_decoder: vp8::get_decoder },
1b8522d6 109
029d2552
KS
110#[cfg(feature="decoder_dk3_adpcm")]
111 DecoderInfo { name: "adpcm-dk3", get_decoder: dkadpcm::get_decoder_dk3 },
112#[cfg(feature="decoder_dk4_adpcm")]
113 DecoderInfo { name: "adpcm-dk4", get_decoder: dkadpcm::get_decoder_dk4 },
1b8522d6
KS
114#[cfg(feature="decoder_on2avc")]
115 DecoderInfo { name: "on2avc-500", get_decoder: on2avc::get_decoder_500 },
116#[cfg(feature="decoder_on2avc")]
117 DecoderInfo { name: "on2avc-501", get_decoder: on2avc::get_decoder_501 },
118];
119
e64739f8 120/// Registers all available codecs provided by this crate.
78fb6560 121pub fn duck_register_all_decoders(rd: &mut RegisteredDecoders) {
8a7352c0 122 for decoder in DUCK_CODECS.iter() {
b7c882c1 123 rd.add_decoder(*decoder);
1b8522d6
KS
124 }
125}
3952bfd9
KS
126
127#[cfg(feature="encoder_vp6")]
19cfcd2f
KS
128#[macro_use]
129mod vpenc;
130#[cfg(feature="encoder_vp6")]
3952bfd9
KS
131#[allow(clippy::needless_range_loop)]
132mod vp6enc;
133
134const DUCK_ENCODERS: &[EncoderInfo] = &[
135#[cfg(feature="encoder_vp6")]
136 EncoderInfo { name: "vp6", get_encoder: vp6enc::get_encoder },
92d9fb69
KS
137#[cfg(feature="encoder_vp6")]
138 EncoderInfo { name: "vp6f", get_encoder: vp6enc::get_encoder_flv },
3952bfd9
KS
139];
140
141/// Registers all available encoders provided by this crate.
142pub fn duck_register_all_encoders(re: &mut RegisteredEncoders) {
143 for encoder in DUCK_ENCODERS.iter() {
144 re.add_encoder(*encoder);
145 }
146}