forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB30d372eTahinli3 months ago42 commits

lib.rs47 lines, 1.5 KiBHistoryRawDownload
1//! H.264 software decoder.
2//!
3//! Current scope: CAVLC-coded I slices (Intra_4x4, Intra_16x16, I_PCM) of
4//! 8-bit 4:2:0 progressive streams, with the full in-loop deblocking filter,
5//! decoded bit-exactly against the JVT conformance suite. Everything outside
6//! that scope returns a named [`Error::Unsupported`] — never wrong output.
7//!
8//! Implemented from Rec. ITU-T H.264 (V15, 08/2024) only; no third-party
9//! decoder source was consulted.
10//!
11//! Two entry surfaces over one decode core: [`Decoder`] takes NAL units, which
12//! is what a bitstream tool has, and [`H264Decoder`] implements
13//! [`ec_core::registry::Decoder`] over packets — including `avcC` extradata and
14//! length-prefixed NAL units — which is what a demuxer hands over.
15//!
16//! ```no_run
17//! use ec_core::registry::{CodecId, CodecParameters, Decoder};
18//! use ec_core::{Packet, TimeBase};
19//! use ec_h264::H264Decoder;
20//!
21//! # fn main() -> ec_core::Result<()> {
22//! let annex_b: Vec<u8> = std::fs::read("stream.264")?;
23//! let mut decoder = H264Decoder::new(CodecParameters::new(CodecId::H264))?;
24//! decoder.send_packet(&Packet::new(0, TimeBase::new(1, 25), annex_b))?;
25//! let frame = decoder.receive_frame()?; // the first decoded picture, I420
26//! # let _ = frame;
27//! # Ok(())
28//! # }
29//! ```
30
31#![forbid(unsafe_code)]
32
33mod bits;
34mod cabac;
35mod cabac_tables;
36mod cavlc;
37mod codec;
38mod deblock;
39mod decoder;
40mod entropy;
41mod pred;
42mod tables;
43mod transform;
44
45pub use codec::H264Decoder;
46pub use decoder::{Decoder, NalOutcome};
47pub use ec_core::error::{Error, Result};