Skip to main content

Module simd

Module simd 

Source
Expand description

SIMD-accelerated image processing helpers.

Provides vectorized operations for hot paths in the processing pipeline. Where hardware SIMD intrinsics are not available, falls back to scalar code optimized for auto-vectorization by the compiler.

§Auto-vectorization

The scalar loops in this module are written in a style that LLVM can auto-vectorize when the crate is compiled with -C target-cpu=native or RUSTFLAGS="-C target-cpu=native". No unsafe code is needed for that level of optimization.

§Manual SIMD

On x86_64 targets that expose AVX2 at compile time (i.e. when the avx2 target feature is enabled), a hand-written fast-path is used for apply_gains_rgb. All other architectures and feature-flag combinations fall through to the scalar implementation.

Functions§

apply_gains_rgb
Apply per-channel gain to an interleaved RGB u16 buffer.
apply_matrix_rgb
Apply a 3×3 color matrix to an interleaved RGB u16 buffer.
subtract_black_level_uniform
Subtract a uniform black level from every sample in a raw buffer.