Expand description
Tile-based parallel frame encoding for OxiMedia codecs.
This module provides pixel-level infrastructure for splitting raw video frames into rectangular tiles, processing them concurrently, and reassembling the result into a complete frame.
Unlike crate::tile which works with crate::frame::VideoFrame and
codec-level bitstream output, this module operates on raw &[u8] / Vec<u8>
pixel buffers and is therefore codec-agnostic.
§Architecture
TileConfig ─── tile grid parameters (cols, rows, frame size)
│
▼
TileLayout ─── pre-computed TileRegion grid (handles remainder pixels)
│
▼
ParallelTileEncoder ─── split_frame → parallel encode_fn → merge_tiles§Example
use oximedia_codec::tile_encoder::{TileConfig, ParallelTileEncoder};
let config = TileConfig::new()
.tile_cols(2)
.tile_rows(2)
.frame_width(64)
.frame_height(64);
let encoder = ParallelTileEncoder::new(config);
// Create a simple 64×64 RGB frame (3 channels).
let frame: Vec<u8> = (0u8..=255).cycle().take(64 * 64 * 3).collect();
let tiles = encoder.split_frame(&frame, 3);
assert_eq!(tiles.len(), 4);
let merged = ParallelTileEncoder::merge_tiles(&tiles, 64, 64, 3);
assert_eq!(merged, frame);Structs§
- Parallel
Tile Encoder - Splits a raw pixel frame into tiles, processes them in parallel, and reassembles the result.
- Tile
BitBudget - Bit budget allocation for a single tile.
- Tile
Buffer - Raw pixel data extracted from (or destined for) a single tile.
- Tile
Complexity - Content complexity metric for a tile region.
- Tile
Config - Configuration for the tile grid and frame dimensions.
- Tile
Dependency - A dependency edge from one tile to another.
- Tile
Dependency Graph - Dependency graph for a tile layout.
- Tile
Layout - A grid of
TileRegions computed from aTileConfig. - Tile
Quality Metrics - Per-tile quality metrics.
- Tile
Region - Pixel coordinates and dimensions of a single tile within a frame.
- Tile
Work Item - A work item for the tile encode queue.
Enums§
- Tile
Dependency Kind - The type of dependency one tile has on another.
Functions§
- adaptive_
tile_ partition - Decides whether a tile should be split into sub-tiles based on complexity.
- allocate_
tile_ bits - Allocate a total bit budget across tiles based on complexity.
- analyse_
frame_ quality - Compute quality metrics for all tiles by comparing original and reconstructed frames.
- analyse_
tile_ complexity - Analyse content complexity for each tile in a frame.
- compute_
tile_ quality - Compute quality metrics between original and reconstructed tile buffers.
- encode_
tiles_ wavefront - Encodes tiles in dependency-aware waves using Rayon.