Expand description
A VP8 video decoder in pure Rust (RFC 6386).
It decodes every VP8 bitstream version (0 to 3): keyframes and interframes, all intra and inter prediction modes including split motion vectors, segmentation, the normal and simple loop filters, token partitions, probability updates and persistence, and the last, golden and alt-ref reference frames with their sign bias and buffer copies. Its output matches the WebM project’s VP8 test vectors bit for bit.
Input is one raw VP8 frame at a time, starting at the frame tag (no IVF,
WebM or RTP framing). Output is a borrowed I420 Picture.
let frames: Vec<Vec<u8>> = Vec::new(); // raw VP8 frames, in order
let mut decoder = vp8_decoder::Decoder::new();
for frame in &frames {
match decoder.decode(frame) {
Ok(Some(picture)) => { let _i420 = picture.to_i420(); }
Ok(None) => {} // a frame that only updates references
Err(vp8_decoder::DecodeError::NeedKeyframe) => {} // wait for a keyframe
Err(_) => {} // corrupt: ask the sender for a keyframe
}
}See PROVENANCE.md for how this crate was written.
Modules§
- ivf
- A reader for IVF, the simple container the VP8 test vectors use.
Structs§
- Decoder
- A VP8 decoder.
- Dimensions
- The size fields of a keyframe header.
- Frame
Info - What a frame’s uncompressed header says.
- Picture
- A borrowed planar YUV 4:2:0 (I420) picture.
Enums§
- Decode
Error - Why a frame could not be decoded.
Constants§
- DEFAULT_
MAX_ PIXELS - The default frame size limit: 4096x2304 pixels.
Functions§
- frame_
info - Parses a frame’s uncompressed header (3 bytes, 10 on a keyframe) without decoding it.