1#![allow(missing_abi)]
33#![allow(unused_unsafe)]
34
35#[cfg(test)]
36#[macro_use]
37extern crate pretty_assertions;
38
39pub use crate::api::color;
40pub use crate::api::{
41 Config, Context, EncoderConfig, EncoderStatus, InvalidConfig, Packet,
42};
43use crate::encoder::*;
44pub use crate::frame::Frame;
45pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
46
47#[cfg(feature = "stop")]
48pub use enough::{Stop, StopReason, Unstoppable};
49
50pub(crate) mod built_info {
51 include!(concat!(env!("OUT_DIR"), "/built.rs"));
53}
54
55mod serialize {
56 cfg_if::cfg_if! {
57 if #[cfg(feature="serialize")] {
58 pub use serde::*;
59 } else {
60 pub use noop_proc_macro::{Deserialize, Serialize};
61 }
62 }
63}
64
65mod wasm_bindgen {
66 cfg_if::cfg_if! {
67 if #[cfg(feature="wasm")] {
68 pub use wasm_bindgen::prelude::*;
69 } else {
70 pub use noop_proc_macro::wasm_bindgen;
71 }
72 }
73}
74
75#[cfg(any(cargo_c, feature = "capi"))]
76pub mod capi;
77
78#[macro_use]
79mod transform;
80#[macro_use]
81mod cpu_features;
82
83mod activity;
84pub(crate) mod asm;
85mod dist;
86mod ec;
87mod partition;
88mod predict;
89mod quantize;
90mod rdo;
91mod rdo_tables;
92#[macro_use]
93mod util;
94mod cdef;
95#[doc(hidden)]
96pub mod context;
97mod deblock;
98mod encoder;
99mod entropymode;
100mod levels;
101mod lrf;
102mod mc;
103mod me;
104mod rate;
105mod recon_intra;
106mod scan_order;
107mod segmentation;
108mod stats;
109#[doc(hidden)]
110pub mod tiling;
111mod token_cdfs;
112
113#[cfg(not(feature = "scenechange"))]
114#[path = "scenechange_stub.rs"]
115mod av_scenechange;
116
117mod api;
118mod frame;
119mod header;
120
121pub mod prelude {
123 pub use crate::api::*;
124 pub use crate::encoder::{Sequence, Tune};
125 pub use crate::frame::{
126 Frame, FrameParameters, FrameTypeOverride, Plane, PlaneConfig,
127 };
128 pub use crate::partition::BlockSize;
129 pub use crate::predict::PredictionMode;
130 pub use crate::transform::TxType;
131 pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
132}
133
134pub mod data {
136 pub use crate::api::{
137 ChromaticityPoint, EncoderStatus, FrameType, Packet, Rational,
138 };
139 pub use crate::frame::{Frame, FrameParameters};
140 pub use crate::stats::EncoderStats;
141 pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
142}
143
144pub mod config {
146 pub use crate::api::config::{
147 GrainTableSegment, NUM_UV_COEFFS, NUM_UV_POINTS, NUM_Y_COEFFS,
148 NUM_Y_POINTS, NoiseGenArgs, TransferFunction,
149 };
150 pub use crate::api::{
151 Config, EncoderConfig, InvalidConfig, PredictionModesSetting,
152 RateControlConfig, RateControlError, RateControlSummary, SpeedSettings,
153 };
154 pub use crate::cpu_features::CpuFeatureLevel;
155}
156
157pub mod version {
177 pub fn major() -> u64 {
186 env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap()
187 }
188 pub fn minor() -> u64 {
198 env!("CARGO_PKG_VERSION_MINOR").parse().unwrap()
199 }
200 pub fn patch() -> u64 {
209 env!("CARGO_PKG_VERSION_PATCH").parse().unwrap()
210 }
211
212 pub fn short() -> String {
218 env!("CARGO_PKG_VERSION").to_string()
219 }
220
221 pub fn long() -> String {
227 let s = short();
228 let hash = hash();
229
230 if hash.is_empty() { s } else { format!("{s} - {hash}") }
231 }
232
233 cfg_if::cfg_if! {
234 if #[cfg(feature="git_version")] {
235 fn git_version() -> &'static str {
236 crate::built_info::GIT_VERSION.unwrap_or_default()
237 }
238
239 fn git_hash() -> &'static str {
240 crate::built_info::GIT_COMMIT_HASH.unwrap_or_default()
241 }
242 } else {
243 fn git_version() -> &'static str {
244 "UNKNOWN"
245 }
246
247 fn git_hash() -> &'static str {
248 "UNKNOWN"
249 }
250 }
251 }
252 pub fn hash() -> String {
259 git_hash().to_string()
260 }
261
262 pub fn full() -> String {
268 format!("{} ({})", short(), git_version(),)
269 }
270}
271#[cfg(all(
272 any(test, fuzzing),
273 any(feature = "decode_test", feature = "decode_test_dav1d")
274))]
275mod test_encode_decode;
276
277#[cfg(feature = "bench")]
278pub mod bench {
279 pub mod api {
280 pub use crate::api::*;
281 }
282 pub mod cdef {
283 pub use crate::cdef::*;
284 }
285 pub mod context {
286 pub use crate::context::*;
287 }
288 pub mod dist {
289 pub use crate::dist::*;
290 }
291 pub mod ec {
292 pub use crate::ec::*;
293 }
294 pub mod encoder {
295 pub use crate::encoder::*;
296 }
297 pub mod mc {
298 pub use crate::mc::*;
299 }
300 pub mod partition {
301 pub use crate::partition::*;
302 }
303 pub mod frame {
304 pub use crate::frame::*;
305 }
306 pub mod predict {
307 pub use crate::predict::*;
308 }
309 pub mod rdo {
310 pub use crate::rdo::*;
311 }
312 pub mod tiling {
313 pub use crate::tiling::*;
314 }
315 pub mod transform {
316 pub use crate::transform::*;
317 }
318 pub mod util {
319 pub use crate::util::*;
320 }
321 pub mod cpu_features {
322 pub use crate::cpu_features::*;
323 }
324}
325
326#[cfg(fuzzing)]
327pub mod fuzzing;