pub struct SpectralOperator;Expand description
Unified spectral operator — the single entry point for all spectral operations in the Qualia engine.
This is a zero-allocation facade: it holds no state and dispatches to
the specialised submodules. All methods are &self or associated
functions.
Implementations§
Source§impl SpectralOperator
impl SpectralOperator
Sourcepub fn emf_to_spd(alpha: f32, mu: f32, sigma: f32) -> Spd
pub fn emf_to_spd(alpha: f32, mu: f32, sigma: f32) -> Spd
Convert an EMF payload [α, μ, σ] to a Spectral Power Distribution.
Sourcepub fn spd_to_xyz(spd: &Spd) -> Xyz
pub fn spd_to_xyz(spd: &Spd) -> Xyz
Project an SPD to CIE XYZ tristimulus values.
Sourcepub fn xyz_to_linear_srgb(xyz: &Xyz) -> LinearRgb
pub fn xyz_to_linear_srgb(xyz: &Xyz) -> LinearRgb
Convert CIE XYZ to linear sRGB.
Sourcepub fn emf_to_linear_rgb(alpha: f32, mu: f32, sigma: f32) -> LinearRgb
pub fn emf_to_linear_rgb(alpha: f32, mu: f32, sigma: f32) -> LinearRgb
Full EMF → linear sRGB pipeline.
Sourcepub fn linear_rgb_to_display(rgb: &LinearRgb) -> (u8, u8, u8)
pub fn linear_rgb_to_display(rgb: &LinearRgb) -> (u8, u8, u8)
Convert linear sRGB to 8-bit display sRGB (gamma-encoded).
Sourcepub fn emf_to_display_rgb(alpha: f32, mu: f32, sigma: f32) -> (u8, u8, u8)
pub fn emf_to_display_rgb(alpha: f32, mu: f32, sigma: f32) -> (u8, u8, u8)
Full EMF → 8-bit display sRGB pipeline.
Sourcepub fn delta_e(xyz_a: &Xyz, xyz_b: &Xyz) -> f32
pub fn delta_e(xyz_a: &Xyz, xyz_b: &Xyz) -> f32
CIE76 ΔE colour difference between two XYZ values.
Sourcepub fn metamer_kernel_basis(
out_basis: &mut [f32],
) -> Result<usize, MetamerError>
pub fn metamer_kernel_basis( out_basis: &mut [f32], ) -> Result<usize, MetamerError>
Compute the kernel basis for metameric-black SPDs.
Sourcepub fn min_norm_spd_for_xyz(target: &Xyz) -> Spd
pub fn min_norm_spd_for_xyz(target: &Xyz) -> Spd
Compute the minimum-norm SPD for a target XYZ.
Sourcepub fn fibre_spd(particular: &Spd, basis: &[f32], coeffs: &[f32]) -> Spd
pub fn fibre_spd(particular: &Spd, basis: &[f32], coeffs: &[f32]) -> Spd
Construct a fibre element: particular + Σ c_i · ker_i.
Sourcepub fn is_metameric(spd: &Spd, target: &Xyz, tolerance: f32) -> bool
pub fn is_metameric(spd: &Spd, target: &Xyz, tolerance: f32) -> bool
Check if an SPD is metameric to a target XYZ.
Sourcepub fn is_in_gamut(xyz: &Xyz) -> bool
pub fn is_in_gamut(xyz: &Xyz) -> bool
Check if a colour is in the sRGB gamut.
Sourcepub fn linear_srgb_to_xyz(rgb: &LinearRgb) -> Xyz
pub fn linear_srgb_to_xyz(rgb: &LinearRgb) -> Xyz
Convert linear sRGB to CIE XYZ.
Sourcepub fn spectral_blend_emf(
alpha_a: f32,
mu_a: f32,
sigma_a: f32,
alpha_b: f32,
mu_b: f32,
sigma_b: f32,
t: f32,
) -> Xyz
pub fn spectral_blend_emf( alpha_a: f32, mu_a: f32, sigma_a: f32, alpha_b: f32, mu_b: f32, sigma_b: f32, t: f32, ) -> Xyz
Blend two EMF payloads in spectral space and return XYZ.
Sourcepub fn blend_divergence(
alpha_a: f32,
mu_a: f32,
sigma_a: f32,
alpha_b: f32,
mu_b: f32,
sigma_b: f32,
t: f32,
) -> f32
pub fn blend_divergence( alpha_a: f32, mu_a: f32, sigma_a: f32, alpha_b: f32, mu_b: f32, sigma_b: f32, t: f32, ) -> f32
ΔE divergence between spectral blend and gamma-encoded sRGB lerp.
Sourcepub fn tf_surface<'a>(
raster: &'a [f32],
frame_count: usize,
bin_count: usize,
sample_rate: u32,
hop_size: usize,
) -> TfSurface<'a>
pub fn tf_surface<'a>( raster: &'a [f32], frame_count: usize, bin_count: usize, sample_rate: u32, hop_size: usize, ) -> TfSurface<'a>
Create a time-frequency surface view from a raster.
Sourcepub fn surface_gain(
surface: &TfSurface<'_>,
region: &TfRegion,
gain: f32,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_gain( surface: &TfSurface<'_>, region: &TfRegion, gain: f32, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Apply a gain to a region of the surface.
Sourcepub fn surface_gate(
surface: &TfSurface<'_>,
region: &TfRegion,
threshold: f32,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_gate( surface: &TfSurface<'_>, region: &TfRegion, threshold: f32, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Spectral gate: zero out bins below a threshold.
Sourcepub fn surface_copy_patch(
surface: &TfSurface<'_>,
src_region: &TfRegion,
dst_frame: usize,
dst_bin: usize,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_copy_patch( surface: &TfSurface<'_>, src_region: &TfRegion, dst_frame: usize, dst_bin: usize, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Copy a rectangular patch to a new location.
Sourcepub fn surface_time_stretch(
surface: &TfSurface<'_>,
factor: f32,
out: &mut [f32],
) -> Result<(usize, usize), SurfaceEditError>
pub fn surface_time_stretch( surface: &TfSurface<'_>, factor: f32, out: &mut [f32], ) -> Result<(usize, usize), SurfaceEditError>
Time-stretch by resampling along the time axis.
Sourcepub fn surface_pitch_shift(
surface: &TfSurface<'_>,
factor: f32,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_pitch_shift( surface: &TfSurface<'_>, factor: f32, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Pitch-shift by resampling along the frequency axis.
Sourcepub fn surface_crossfade(
surface_a: &TfSurface<'_>,
surface_b: &TfSurface<'_>,
t: f32,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_crossfade( surface_a: &TfSurface<'_>, surface_b: &TfSurface<'_>, t: f32, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Crossfade two surfaces.
Sourcepub fn surface_fade_in(
surface: &TfSurface<'_>,
fade_frames: usize,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_fade_in( surface: &TfSurface<'_>, fade_frames: usize, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Fade in over the first fade_frames frames.
Sourcepub fn surface_fade_out(
surface: &TfSurface<'_>,
fade_frames: usize,
out: &mut [f32],
) -> Result<usize, SurfaceEditError>
pub fn surface_fade_out( surface: &TfSurface<'_>, fade_frames: usize, out: &mut [f32], ) -> Result<usize, SurfaceEditError>
Fade out over the last fade_frames frames.
Sourcepub fn batch_emf_to_display(emf: &[f32], out: &mut [u8]) -> usize
pub fn batch_emf_to_display(emf: &[f32], out: &mut [u8]) -> usize
Batch EMF → display RGB: process N EMF payloads into N display RGB
triples. emf is [α, μ, σ] triples (3N floats), out is N3 u8.
Sourcepub fn batch_emf_to_xyz(emf: &[f32], out: &mut [f32]) -> usize
pub fn batch_emf_to_xyz(emf: &[f32], out: &mut [f32]) -> usize
Batch EMF → XYZ: process N EMF payloads into N XYZ triples.
emf is [α, μ, σ] triples (3N floats), out is N3 f32.
Sourcepub fn batch_gamut_map(xyz: &[f32], out: &mut [f32]) -> usize
pub fn batch_gamut_map(xyz: &[f32], out: &mut [f32]) -> usize
Batch gamut mapping: map N XYZ triples to in-gamut XYZ.
out is N*3 f32.
Trait Implementations§
Source§impl Clone for SpectralOperator
impl Clone for SpectralOperator
Source§fn clone(&self) -> SpectralOperator
fn clone(&self) -> SpectralOperator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpectralOperator
impl Debug for SpectralOperator
Source§impl Default for SpectralOperator
impl Default for SpectralOperator
Source§fn default() -> SpectralOperator
fn default() -> SpectralOperator
impl Copy for SpectralOperator
Auto Trait Implementations§
impl Freeze for SpectralOperator
impl RefUnwindSafe for SpectralOperator
impl Send for SpectralOperator
impl Sync for SpectralOperator
impl Unpin for SpectralOperator
impl UnsafeUnpin for SpectralOperator
impl UnwindSafe for SpectralOperator
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more