Skip to main content

tealdust/
lib.rs

1/*
2 * Copyright (c) Radzivon Bartoshyk 6/2026. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1.  Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * 2.  Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * 3.  Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30//! ```no_run
31//! use tealdust::{Decoder, Settings, Data, TealdustError};
32//!
33//! let mut decoder = Decoder::open(&Settings::default()).unwrap();
34//!
35//! // Feed compressed data
36//! let obu_data: Vec<u8> = std::fs::read("input.obu").unwrap();
37//! decoder.send_data(Some(Data::wrap(obu_data))).unwrap();
38//!
39//! // Retrieve decoded pictures
40//! loop {
41//!     match decoder.get_picture() {
42//!         Ok(picture) => { /* process decoded frame */ }
43//!         Err(TealdustError::Again) => break, // need more input
44//!         Err(TealdustError::Eof) => break,   // end of stream
45//!         Err(e) => panic!("decode error: {e}"),
46//!     }
47//! }
48//! ```
49
50#![allow(clippy::too_many_arguments)]
51#![allow(clippy::needless_range_loop)]
52#![allow(clippy::needless_late_init)]
53#![allow(clippy::field_reassign_with_default)]
54#![allow(clippy::result_unit_err)]
55#![allow(clippy::while_immutable_condition)]
56#![allow(clippy::erasing_op)]
57#![allow(clippy::identity_op)]
58#![allow(clippy::enum_variant_names)]
59#![allow(clippy::precedence)]
60#![allow(clippy::unnecessary_cast)]
61#![allow(clippy::needless_borrow)]
62#![allow(clippy::collapsible_if)]
63#![allow(clippy::doc_lazy_continuation)]
64
65mod ccso;
66pub(crate) mod cdef;
67pub(crate) mod cdf;
68pub(crate) mod ctx;
69pub(crate) mod deblock;
70pub(crate) mod decode;
71pub(crate) mod dip_tables;
72pub(crate) mod env;
73pub(crate) mod exec_context;
74pub(crate) mod filmgrain;
75pub(crate) mod gdf_tables;
76pub(crate) mod getbits;
77pub(crate) mod ibp;
78pub(crate) mod internal;
79pub(crate) mod intops;
80pub(crate) mod ipred;
81pub(crate) mod ipred_prepare;
82pub(crate) mod itx;
83pub(crate) mod itx_1d;
84pub(crate) mod itx_2d;
85pub(crate) mod itx_wht_dispatch;
86pub(crate) mod lf_mask;
87pub(crate) mod looprestoration;
88pub(crate) mod mc;
89pub(crate) mod mc_dispatch;
90pub(crate) mod msac;
91pub(crate) mod mtpool;
92pub(crate) mod obu;
93pub(crate) mod output_order;
94pub(crate) mod pal;
95pub(crate) mod pixel;
96pub(crate) mod qm_tables;
97pub(crate) mod quantizer;
98pub(crate) mod recon;
99pub(crate) mod refmvs;
100pub(crate) mod scan;
101pub(crate) mod stx;
102pub(crate) mod stx_tables;
103pub(crate) mod tables;
104pub(crate) mod warpmv;
105pub(crate) mod wedge;
106
107mod avif;
108#[cfg(all(target_arch = "x86_64", feature = "avx"))]
109mod avx;
110mod cdef_dispatch;
111mod cfl_dispatch;
112mod data;
113mod deblock_dispatch;
114mod decode_partition;
115mod decoder;
116mod error;
117mod filter;
118mod headers;
119mod intra;
120mod ipred_dispatch;
121mod levels;
122#[cfg(target_arch = "aarch64")]
123mod neon;
124mod picture;
125mod rowops_dispatch;
126#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), feature = "sse"))]
127pub(crate) mod sse;
128
129pub use avif::*;
130pub use data::Data;
131pub use decoder::{
132    DEFAULT_FRAME_SIZE_LIMIT, DecodeFrameType, Decoder, InloopFilterType, MAX_FRAME_DELAY,
133    MAX_THREADS, Settings,
134};
135pub use decoder::{get_frame_delay, version, version_api};
136pub use error::TealdustError;
137pub use headers::{ColorPrimaries, ContentLightLevel, MatrixCoefficients, TransferCharacteristics};
138pub use headers::{FrameHeader, PixelLayout, SequenceHeader};
139pub use picture::{EventFlags, PicAllocator, Picture, PlaneStorage};