Expand description
SIMD (Single Instruction Multiple Data) optimizations for performance-critical operations
This module provides SIMD-accelerated implementations of raster operations, statistics,
resampling, and mathematical functions. It uses architecture-specific intrinsics
(std::arch) with runtime CPU feature detection and graceful scalar fallback.
§Architecture Support
- aarch64: NEON (128-bit, baseline on all aarch64 CPUs)
- x86-64: SSE2 (baseline), AVX2 (runtime detected), AVX-512 (runtime detected)
- Other: Scalar fallback with auto-vectorization hints
§Runtime Detection
On x86-64, the module uses is_x86_feature_detected! to select the best available
instruction set at runtime. On aarch64, NEON is always available as part of the
base architecture. See detect module for details.
§Performance
Expected speedups over scalar implementations:
- Raster operations: 2-8x (element-wise ops, min/max, thresholds)
- Statistics: 4-8x (sum, mean, histograms)
- Resampling: 2-4x (bilinear, bicubic interpolation)
- Math functions: 3-6x (sqrt, log, exp, trig)
§Usage
Enable SIMD optimizations with the simd feature (enabled by default):
[dependencies]
oxigdal-algorithms = { version = "0.1", features = ["simd"] }§Example
use oxigdal_algorithms::simd::raster::add_f32;
let a = vec![1.0_f32; 1000];
let b = vec![2.0_f32; 1000];
let mut result = vec![0.0_f32; 1000];
// Automatically uses best available SIMD instruction set
add_f32(&a, &b, &mut result);
assert_eq!(result[0], 3.0);§Safety
All public SIMD operations are safe. Unsafe intrinsics are encapsulated internally with proper bounds checking, alignment handling, and error propagation. Pure Rust implementation (no C/Fortran dependencies).
Modules§
- colorspace
- SIMD-accelerated color space conversions
- cost_
distance_ simd - SIMD-accelerated cost-distance and path analysis operations
- detect
- Runtime SIMD capability detection
- filters
- SIMD-accelerated convolution filters for image processing
- focal_
simd - SIMD-accelerated focal (neighborhood) statistics operations
- histogram
- SIMD-accelerated histogram computation
- hydrology_
simd - SIMD-accelerated hydrology analysis operations
- math
- SIMD-accelerated mathematical operations
- morphology
- SIMD-accelerated morphological operations
- platform
- Platform-specific SIMD configuration (compile-time constants)
- projection
- SIMD-accelerated coordinate transformations
- raster
- SIMD-accelerated raster operations
- resampling
- SIMD-accelerated resampling operations
- statistics
- SIMD-accelerated statistical operations
- terrain_
simd - SIMD-accelerated terrain analysis operations
- texture_
simd - SIMD-accelerated texture analysis using Gray-Level Co-occurrence Matrix (GLCM)
- threshold
- SIMD-accelerated thresholding operations
- util
- Utilities for working with SIMD operations