Expand description
rusty_h265 — a pure-Rust HEVC / H.265 video decoder, no C, no FFI.
Written from ITU-T H.265 (with the JCT-VC HM reference decoder as the
transcribable source) and gated on the JCT-VC HEVC_v1 conformance suite.
Scope (v1): Main, Main 10 and Main Still Picture — 4:2:0, 8 and 10 bit.
Range extensions, screen content coding and layered profiles are parsed
and refused with a named Error::Unsupported.
The push/pull API mirrors FFmpeg’s send/receive convention:
Error::Again means “feed more input”, Error::Eof means “drained”.
use rusty_h265::{Decoder, Error};
fn decode(stream: &[u8]) -> Result<(), Error> {
let mut dec = Decoder::new();
dec.push_annexb(stream, None)?;
dec.flush();
while let Ok(frame) = dec.next_frame() {
println!("{}x{} poc {}", frame.width, frame.height, frame.poc);
}
Ok(())
}Re-exports§
pub use decoder::Decoder;pub use decoder::Stats;pub use frame::Frame;pub use frame::Picture;pub use frame::Plane;pub use rusty_h265_accel as accel;
Modules§
- bits
- MSB-first bit reader with Exp-Golomb decoding over an RBSP (emulation
prevention already removed — see
crate::nal). Ported fromrusty_h264’s reader: the one-loadpeek_bitsfast path and the cachedrbsp_stop_one_bitposition are the same design. - cabac
- CABAC (§9.3): the arithmetic decoding engine, context initialisation and the context index layout.
- ctu
- Slice segment data (§7.3.8): the CTU loop with tile/WPP substreams and
context storage/synchronisation (§9.3.1–9.3.2), SAO syntax, the coding
quadtree, coding units and prediction units. The transform tree,
residual coding and reconstruction live in the
residualchild module. - decoder
- The decoder state machine: NAL dispatch, parameter-set activation, picture boundaries, POC (§8.3.1), reference picture set marking (§8.3.2), missing reference generation (§8.3.3), reference list construction (§8.3.4) and the DPB output/bumping process (§C.5.2).
- filters
- In-loop filters, applied to a whole picture after all its slices decoded: deblocking (§8.7.2) then sample adaptive offset (§8.7.3).
- frame
- Decoded pictures: planar Y/Cb/Cr sample storage. All bit depths use
u16samples for now (the 8-bitu8plane domain is a Phase 6 speed brick); the output side hands out either width. - intra
- Intra sample prediction (§8.4.4.2): reference sample substitution, filtering (incl. strong smoothing), planar, DC and the 33 angular modes.
- itx
- Scaling (§8.6.3) and inverse transforms (§8.6.4): the 4/8/16/32-point inverse DCT, the 4x4 inverse DST, transform skip and transquant bypass. Integer only.
- md5
- MD5 (RFC 1321) for the decoded-picture-hash SEI check. Tiny, dependency-free.
- nal
- NAL units (§7.3.1), Annex-B framing (Annex B) and emulation prevention.
- pic
- Per-picture decoding state at 4×4 (minimum transform block) granularity: the z-scan order table (§6.5.2), neighbour availability (§6.4.1), and the per-block maps the syntax, intra prediction and loop filters read.
- ps
- Parameter sets: VPS (§7.3.2.1), SPS (§7.3.2.2), PPS (§7.3.2.3), with
profile_tier_level(§7.3.3),scaling_list_data(§7.3.4),st_ref_pic_set(§7.3.7) and the VUI/HRD skip (Annex E). - sei
- SEI (§7.3.5): only
decoded_picture_hash(payloadType 132, §D.3.19) is interpreted — it is the decoder’s built-in conformance self-check. - slice
- Slice segment header (§7.3.6.1),
ref_pic_lists_modification()(§7.3.6.2) andpred_weight_table()(§7.3.6.3). - tables
- Spec constant tables, built at compile time and validated by tests: scan orders (§6.5.3–6.5.5), the 32×32 DCT matrix (§8.6.4.2), the 4×4 DST, intra angles (Tables 8-4/8-5), the chroma QP map (Table 8-10), the dequantisation scale (§8.6.3) and the deblocking β/tC tables (Table 8-12).
Macros§
- prof_
scope - Time a stage, when built with the
proffeature; expand to nothing otherwise.
Enums§
- Error
- Errors (and control-flow signals) produced by the decoder.
Type Aliases§
- Result
- Crate-wide result alias.