]> git.nihav.org Git - nihav.git/blame_incremental - nihav-duck/src/codecs/mod.rs
h264: cache data before use in fill_deblock()
[nihav.git] / nihav-duck / src / codecs / mod.rs
... / ...
CommitLineData
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#[cfg(feature="decoder_truemotion1")]
13mod truemotion1;
14#[cfg(any(feature="decoder_truemotion1", feature="encoder_truemotion1"))]
15mod truemotion1data;
16#[cfg(feature="decoder_truemotionrt")]
17mod truemotionrt;
18#[cfg(feature="decoder_truemotion2")]
19#[allow(clippy::needless_range_loop)]
20mod truemotion2;
21#[cfg(feature="decoder_truemotion2x")]
22mod truemotion2x;
23#[cfg(any(feature="decoder_vp3", feature="decoder_vp4", feature="decoder_vp5", feature="decoder_vp6", feature="decoder_vp7"))]
24#[macro_use]
25#[allow(clippy::erasing_op)]
26#[allow(clippy::needless_range_loop)]
27#[allow(clippy::too_many_arguments)]
28#[allow(clippy::useless_let_if_seq)]
29mod vpcommon;
30#[cfg(any(feature="decoder_vp3", feature="decoder_vp4"))]
31#[allow(clippy::needless_range_loop)]
32#[allow(clippy::too_many_arguments)]
33mod vp3;
34#[cfg(any(feature="decoder_vp5", feature="decoder_vp6"))]
35#[allow(clippy::needless_range_loop)]
36#[allow(clippy::useless_let_if_seq)]
37#[allow(clippy::too_many_arguments)]
38mod vp56;
39#[cfg(feature="decoder_vp5")]
40#[allow(clippy::needless_range_loop)]
41mod vp5;
42#[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
43mod vp6data;
44#[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
45mod vp6dsp;
46#[cfg(feature="decoder_vp6")]
47#[allow(clippy::needless_range_loop)]
48mod vp6;
49#[cfg(feature="decoder_vp7")]
50#[allow(clippy::needless_range_loop)]
51#[allow(clippy::useless_let_if_seq)]
52mod vp7;
53#[cfg(any(feature="decoder_vp7", feature="encoder_vp7"))]
54mod vp7data;
55#[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
56mod vp78data;
57#[cfg(feature="decoder_vp7")]
58#[allow(clippy::erasing_op)]
59#[allow(clippy::needless_range_loop)]
60#[allow(clippy::too_many_arguments)]
61#[allow(clippy::useless_let_if_seq)]
62mod vp7dsp;
63#[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))]
64#[allow(clippy::needless_range_loop)]
65#[allow(clippy::useless_let_if_seq)]
66mod vp78;
67#[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))]
68#[allow(clippy::erasing_op)]
69#[allow(clippy::needless_range_loop)]
70#[allow(clippy::too_many_arguments)]
71#[allow(clippy::useless_let_if_seq)]
72mod vp78dsp;
73#[cfg(feature="decoder_vp8")]
74#[allow(clippy::needless_range_loop)]
75#[allow(clippy::useless_let_if_seq)]
76mod vp8;
77#[cfg(feature="decoder_vp8")]
78#[allow(clippy::erasing_op)]
79#[allow(clippy::needless_range_loop)]
80#[allow(clippy::too_many_arguments)]
81mod vp8dsp;
82
83#[cfg(any(feature="decoder_dk3_adpcm", feature="decoder_dk4_adpcm"))]
84mod dkadpcm;
85#[cfg(feature="decoder_on2avc")]
86#[allow(clippy::manual_memcpy)]
87#[allow(clippy::needless_range_loop)]
88#[allow(clippy::too_many_arguments)]
89mod on2avc;
90#[cfg(feature="decoder_on2avc")]
91mod on2avcdata;
92
93const DUCK_CODECS: &[DecoderInfo] = &[
94#[cfg(feature="decoder_truemotion1")]
95 DecoderInfo { name: "truemotion1", get_decoder: truemotion1::get_decoder },
96#[cfg(feature="decoder_truemotionrt")]
97 DecoderInfo { name: "truemotionrt", get_decoder: truemotionrt::get_decoder },
98#[cfg(feature="decoder_truemotion2")]
99 DecoderInfo { name: "truemotion2", get_decoder: truemotion2::get_decoder },
100#[cfg(feature="decoder_truemotion2x")]
101 DecoderInfo { name: "truemotion2x", get_decoder: truemotion2x::get_decoder },
102#[cfg(feature="decoder_vp3")]
103 DecoderInfo { name: "vp3", get_decoder: vp3::get_decoder_vp3 },
104#[cfg(feature="decoder_vp4")]
105 DecoderInfo { name: "vp4", get_decoder: vp3::get_decoder_vp4 },
106#[cfg(feature="decoder_vp5")]
107 DecoderInfo { name: "vp5", get_decoder: vp5::get_decoder },
108#[cfg(feature="decoder_vp6")]
109 DecoderInfo { name: "vp6", get_decoder: vp6::get_decoder_vp6 },
110#[cfg(feature="decoder_vp6")]
111 DecoderInfo { name: "vp6f", get_decoder: vp6::get_decoder_vp6f },
112#[cfg(feature="decoder_vp6")]
113 DecoderInfo { name: "vp6a", get_decoder: vp6::get_decoder_vp6_alpha },
114#[cfg(feature="decoder_vp7")]
115 DecoderInfo { name: "vp7", get_decoder: vp7::get_decoder },
116#[cfg(feature="decoder_vp8")]
117 DecoderInfo { name: "vp8", get_decoder: vp8::get_decoder },
118
119#[cfg(feature="decoder_dk3_adpcm")]
120 DecoderInfo { name: "adpcm-dk3", get_decoder: dkadpcm::get_decoder_dk3 },
121#[cfg(feature="decoder_dk4_adpcm")]
122 DecoderInfo { name: "adpcm-dk4", get_decoder: dkadpcm::get_decoder_dk4 },
123#[cfg(feature="decoder_on2avc")]
124 DecoderInfo { name: "on2avc-500", get_decoder: on2avc::get_decoder_500 },
125#[cfg(feature="decoder_on2avc")]
126 DecoderInfo { name: "on2avc-501", get_decoder: on2avc::get_decoder_501 },
127];
128
129/// Registers all available codecs provided by this crate.
130pub fn duck_register_all_decoders(rd: &mut RegisteredDecoders) {
131 for decoder in DUCK_CODECS.iter() {
132 rd.add_decoder(*decoder);
133 }
134}
135
136#[cfg(feature="encoder_truemotion1")]
137mod truemotion1enc;
138#[cfg(feature="encoder_truemotionrt")]
139mod truemotionrtenc;
140#[cfg(feature="encoder_vp6")]
141#[macro_use]
142mod vpenc;
143#[cfg(feature="encoder_vp6")]
144#[allow(clippy::needless_range_loop)]
145mod vp6enc;
146#[cfg(feature="encoder_vp7")]
147#[allow(clippy::needless_range_loop)]
148mod vp7enc;
149
150const DUCK_ENCODERS: &[EncoderInfo] = &[
151#[cfg(feature="encoder_truemotion1")]
152 EncoderInfo { name: "truemotion1", get_encoder: truemotion1enc::get_encoder },
153#[cfg(feature="encoder_truemotionrt")]
154 EncoderInfo { name: "truemotionrt", get_encoder: truemotionrtenc::get_encoder },
155#[cfg(feature="encoder_vp6")]
156 EncoderInfo { name: "vp6", get_encoder: vp6enc::get_encoder },
157#[cfg(feature="encoder_vp6")]
158 EncoderInfo { name: "vp6f", get_encoder: vp6enc::get_encoder_flv },
159#[cfg(feature="encoder_vp7")]
160 EncoderInfo { name: "vp7", get_encoder: vp7enc::get_encoder },
161];
162
163/// Registers all available encoders provided by this crate.
164pub fn duck_register_all_encoders(re: &mut RegisteredEncoders) {
165 for encoder in DUCK_ENCODERS.iter() {
166 re.add_encoder(*encoder);
167 }
168}