Skip to main content

StripMapper

Trait StripMapper 

Source
pub trait StripMapper:
    Send
    + Sync
    + UnwindSafe
    + RefUnwindSafe
    + Debug {
    // Required method
    fn map_strip(&self, input: &[f32], output: &mut [f32]);
}
Expand description

Compiled-for-this-image strip executor.

Produced by ToneMapper::prepare with image-specific coefficients (peak-aware curve coeffs, adaptation field, LUT rebuild) already baked in. The pipeline calls map_strip for each strip in the convert plan.

§Invariants

  • Send + Sync + UnwindSafe + RefUnwindSafe + Debug — same rationale as on ToneMapper: the strip mapper rides inside a OnceCell<Arc<dyn StripMapper>> cached on the plan, which must carry its auto-traits through.
  • No allocation, no panic on well-formed inputs. Hot path — implementations should avoid heap allocation in map_strip and must not panic when the input and output slices satisfy the documented precondition.

Required Methods§

Source

fn map_strip(&self, input: &[f32], output: &mut [f32])

Apply tone mapping to an interleaved RGB strip in linear-light working space.

Precondition. Both slices are interleaved RGB triplets, i.e. input.len() % 3 == 0 and input.len() == output.len(). The strip is interpreted in the primaries the parent ToneMapper reports from working_primaries_for (default BT.2020).

In-place permitted. Implementations MAY support input.as_ptr() == output.as_ptr() (the same slice passed twice reinterpreted as immutable + mutable views by the caller), but MUST behave correctly either way.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§