Skip to main content

Crate oximedia_accel

Crate oximedia_accel 

Source
Expand description

Hardware acceleration abstraction layer for OxiMedia.

oximedia-accel provides GPU-accelerated computation for video processing operations using Vulkan compute shaders. It includes CPU fallback paths for systems without GPU support.

§Features

  • Device Management: Automatic GPU device enumeration and selection
  • Buffer Management: Efficient GPU memory allocation and transfer
  • Compute Kernels: Image scaling, color conversion, motion estimation
  • CPU Fallback: Automatic fallback to CPU implementations
  • Safe Vulkan: Uses vulkano for safe Vulkan API access

§Architecture

The acceleration layer is designed around the HardwareAccel trait, which provides a unified interface for both GPU and CPU implementations.

┌─────────────────────────────────────────┐
│         HardwareAccel Trait             │
└─────────────────────────────────────────┘
         │                      │
         ▼                      ▼
  ┌────────────┐         ┌────────────┐
  │ VulkanAccel│         │ CpuFallback│
  └────────────┘         └────────────┘

§Example

use oximedia_accel::{AccelContext, HardwareAccel, ScaleFilter};
use oximedia_core::types::PixelFormat;

// Create acceleration context (automatically selects GPU or CPU)
let accel = AccelContext::new()?;

// Perform image scaling
let input = vec![0u8; 1920 * 1080 * 3];
let output = accel.scale_image(
    &input,
    1920, 1080,
    1280, 720,
    PixelFormat::Rgb24,
    ScaleFilter::Bilinear,
)?;

Re-exports§

pub use error::AccelError;
pub use error::AccelResult;
pub use traits::HardwareAccel;
pub use traits::ScaleFilter;
pub use accel_stats::AccelProfiler;
pub use accel_stats::ProfileEntry;
pub use memory_arena::MemoryPressureMonitor;
pub use memory_arena::MemoryPressurePolicy;
pub use memory_arena::PressureLevel;
pub use ops::convolution::ConvolutionConfig;
pub use ops::convolution::ConvolutionFilter;
pub use ops::convolution::EdgeMode;
pub use ops::deinterlace::DeinterlaceConfig;
pub use ops::deinterlace::DeinterlaceMethod;
pub use ops::deinterlace::FieldOrder;
pub use ops::color::hlg_to_sdr_tonemap;
pub use ops::color::pq_to_sdr_tonemap;
pub use ops::color::rgb_to_yuv420;
pub use ops::color::yuv420_to_rgb;
pub use ops::color::YuvRange;
pub use ops::color::YuvStandard;
pub use ops::alpha_blend;
pub use ops::alpha_blend_rgba;
pub use workgroup::compute_optimal_workgroup;
pub use workgroup::OpType;

Modules§

accel_profile
Acceleration target profiles for oximedia-accel.
accel_stats
Performance statistics and counters for the acceleration layer.
buffer
GPU buffer management for efficient data transfer.
cache
LRU cache for accelerated processing results.
cpu_fallback
CPU fallback implementations for hardware acceleration operations.
descriptor_pool
Descriptor set pooling for Vulkan compute pipelines.
device
GPU device enumeration and selection.
device_caps
GPU device capability detection and feature reporting.
dispatch
CPU capability detection and runtime dispatch selection.
error
Error types for hardware acceleration.
fence_timeline
GPU fence / timeline synchronisation primitives.
kernels
High-level kernel interfaces for compute operations.
memory_arena
GPU-style memory arena allocator.
memory_bandwidth
Memory-bandwidth measurement utilities for oximedia-accel.
ops
High-level operations built on compute kernels.
pipeline_accel
Pipeline acceleration helpers.
pool
Thread-pool abstraction for accelerated work items.
prefetch
Memory prefetching helpers.
shaders
Vulkan compute shaders for image processing operations.
task_graph
Directed acyclic graph (DAG) for expressing GPU/CPU task dependencies.
task_scheduler
Task scheduler for hardware-accelerated operations in oximedia-accel.
traits
Traits for hardware acceleration.
vulkan
Vulkan-based hardware acceleration implementation.
workgroup
Compute workgroup size management for GPU dispatch.

Structs§

AccelContext
Main acceleration context that automatically selects GPU or CPU backend.