#[non_exhaustive]pub enum DiffmapWeighting {
Trained,
Balanced,
Custom([f32; 3]),
}Expand description
Channel weighting scheme for combining per-channel SSIM error into the final diffmap.
The diffmap computes SSIM error independently on each XYB channel. This enum controls how those three per-channel error values are combined into a single per-pixel value.
§Which to use
Trained— best for encoder quant loops. Matches the trained model’s view of what matters: almost pure luminance.Balanced— useful for visualization or when you want color errors to be visible in the map even if the model doesn’t weight them heavily at full resolution.Custom— full control. Weights are normalized to sum to 1.0.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Trained
Per-scale weights derived from the profile’s trained SSIM feature weights. Each scale gets its own channel weights (SSIM features per channel, normalized) and a blend weight proportional to the total weight mass at that scale.
For the default profile (v0.1), scale 0 (full res) contributes ~6% of the blend, while scales 1-3 contribute ~28-35% each. At scale 0, channel weights are Y-dominant (~99.3% luminance). At coarser scales, color channels gain more influence.
Automatically tracks the profile passed to crate::Zensim::new.
Balanced
Moderate Y-dominant weights with visible color contribution:
[0.15, 0.70, 0.15] (X, Y, B).
Useful for visualization or when you want the diffmap to show color distortion even though the trained model doesn’t weight it heavily for SSIM at scale 0.
Custom([f32; 3])
Custom weights [X, Y, B]. Automatically normalized to sum to 1.0.
All values must be non-negative.
Trait Implementations§
Source§impl Clone for DiffmapWeighting
impl Clone for DiffmapWeighting
Source§fn clone(&self) -> DiffmapWeighting
fn clone(&self) -> DiffmapWeighting
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiffmapWeighting
impl Debug for DiffmapWeighting
Source§impl From<DiffmapWeighting> for DiffmapOptions
impl From<DiffmapWeighting> for DiffmapOptions
Source§fn from(w: DiffmapWeighting) -> Self
fn from(w: DiffmapWeighting) -> Self
impl Copy for DiffmapWeighting
Auto Trait Implementations§
impl Freeze for DiffmapWeighting
impl RefUnwindSafe for DiffmapWeighting
impl Send for DiffmapWeighting
impl Sync for DiffmapWeighting
impl Unpin for DiffmapWeighting
impl UnsafeUnpin for DiffmapWeighting
impl UnwindSafe for DiffmapWeighting
Blanket Implementations§
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,
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