Crate v_frame

Crate v_frame 

Source
Expand description

A library for handling YUV video frames and planes.

v_frame provides data structures and utilities for working with YUV video data, originally extracted from the rav1e video encoder. The library supports various chroma subsampling formats (YUV420, YUV422, YUV444, and Monochrome) and both 8-bit and high bit-depth (9-16 bit) pixel data.

§Core Components

  • Pixel: Trait abstracting over pixel data types (u8 and u16)
  • Plane: A single plane of pixel data with optional padding
  • Frame: A complete YUV frame containing Y, U, and V planes
  • ChromaSubsampling: Enum specifying chroma subsampling format

§Example

use v_frame::frame::FrameBuilder;
use v_frame::chroma::ChromaSubsampling;
use std::num::{NonZeroU8, NonZeroUsize};

// Create a 1920x1080 YUV420 8-bit frame
let width = NonZeroUsize::new(1920).unwrap();
let height = NonZeroUsize::new(1080).unwrap();
let bit_depth = NonZeroU8::new(8).unwrap();

let frame = FrameBuilder::new(width, height, ChromaSubsampling::Yuv420, bit_depth)
    .build::<u8>()
    .unwrap();

Modules§

chroma
Chroma subsampling formats for YUV video frames.
error
Error types for the v_frame crate.
frame
YUV video frame structures and builders.
pixel
Pixel data type abstractions.
plane
Plane data structure for storing two-dimensional pixel data.