Skip to main content

simd_colormap_sample_8

Function simd_colormap_sample_8 

Source
pub fn simd_colormap_sample_8(
    normalized: [f64; 8],
    lut: &[[u8; 3]; 256],
    mask: [bool; 8],
) -> ([u8; 24], [bool; 8])
Expand description

Vectorized colormap LUT lookup (fast palette sampling)

Maps 8 normalized values [0, 1] to palette indices via fast LUT lookup. Input values clamped to [0, 1], then multiplied by 255 and truncated.

Input:

  • normalized: 8 values in [0, 1] (typically from scale_value)
  • lut: 256-entry RGB lookup table (pre-computed colormap)
  • mask: validity mask

Output:

  • rgb_buffer: flattened RGB buffer (8 pixels × 3 bytes = 24 bytes) Format: [R0, G0, B0, R1, G1, B1, …, R7, G7, B7]
  • out_mask: unchanged validity mask

Note: This is a scalar loop in portable SIMD version. With AVX2, could gather 8 LUT entries in parallel.