Expand description
SIMD abstraction layer for video codec implementations.
This module provides a unified interface for SIMD operations used in video encoding and decoding. It abstracts over different SIMD instruction sets (AVX2, AVX-512, NEON) while providing a scalar fallback for portability.
§Architecture
The SIMD abstraction consists of:
- Types (
types.rs): Vector types likeI16x8,I32x4,U8x16 - Traits (
traits.rs):SimdOpsandSimdOpsExtfor SIMD operations - Architecture-specific: x86 (AVX2/AVX-512), ARM (NEON), scalar fallback
- Codec-specific: AV1 and VP9 optimized operations
- Operations: Domain-specific modules for codec operations
§Usage
ⓘ
use oximedia_codec::simd::{detect_simd, select_transform_impl};
// Detect SIMD capabilities
let caps = detect_simd();
println!("Best SIMD: {}", caps.best_level());
// Use codec-specific SIMD operations
use oximedia_codec::simd::av1::TransformSimd;
let transform = TransformSimd::new(select_transform_impl());
transform.forward_dct_8x8(&input, &mut output);§Feature Detection and Dispatch
The SIMD implementation is selected at runtime based on CPU capabilities:
ⓘ
use oximedia_codec::simd::{SimdCapabilities, detect_simd};
let caps = detect_simd();
if caps.avx512 {
// Use AVX-512 optimized path
} else if caps.avx2 {
// Use AVX2 path
} else if caps.neon {
// Use ARM NEON path
} else {
// Use scalar fallback
}Re-exports§
pub use blend::blend_ops;pub use blend::BlendOps;pub use dct::dct_ops;pub use dct::DctOps;pub use filter::filter_ops;pub use filter::FilterOps;pub use sad::sad_ops;pub use sad::SadOps;pub use traits::SimdOps;pub use traits::SimdOpsExt;pub use traits::SimdSelector;pub use types::I16x16;pub use types::I16x8;pub use types::I32x4;pub use types::I32x8;pub use types::U8x16;pub use types::U8x32;pub use arm::NeonSimd;pub use scalar::ScalarFallback;pub use x86::Avx2Simd;pub use x86::Avx512Simd;pub use av1::CdefSimd;pub use av1::IntraPredSimd;pub use av1::LoopFilterSimd;pub use av1::MotionCompSimd;pub use av1::TransformSimd;pub use vp9::Vp9DctSimd;pub use vp9::Vp9InterpolateSimd;pub use vp9::Vp9IntraPredSimd;pub use vp9::Vp9LoopFilterSimd;
Modules§
- arm
- ARM NEON SIMD implementations.
- av1
- AV1-specific SIMD operations.
- blend
- Blending operations for video codec implementations.
- dct
- Discrete Cosine Transform (DCT) operations.
- filter
- Filter operations for video codec implementations.
- pixel_
convert - SIMD-accelerated pixel format conversion.
- sad
- Sum of Absolute Differences (SAD) operations.
- scalar
- Portable scalar fallback implementation.
- traits
- SIMD operation traits for video codec implementations.
- types
- Common SIMD types and type aliases.
- vp9
- VP9-specific SIMD operations.
- x86
- x86_64 SIMD implementations (AVX2 and AVX-512).
Structs§
- Simd
Capabilities - CPU SIMD capabilities.
Enums§
- Transform
Impl - Transform implementation selection.
Functions§
- detect_
capabilities Deprecated - Legacy capabilities detection (deprecated, use
detect_simdinstead). - detect_
simd - Detect CPU SIMD capabilities at runtime.
- get_
simd - Get the best SIMD implementation for the current CPU.
- get_
simd_ ext - Get the best extended SIMD implementation for the current CPU.
- scalar_
simd Deprecated - Legacy scalar SIMD accessor (deprecated, use
ScalarFallbackdirectly). - select_
transform_ impl - Select the best transform implementation for the current CPU.