pub struct DiffmapOptions {
pub weighting: DiffmapWeighting,
pub masking_strength: Option<f32>,
pub sqrt: bool,
pub include_edge_mse: bool,
pub include_hf: bool,
}Expand description
Post-processing options for the diffmap signal.
These are applied after multi-scale fusion to shape the diffmap for specific use cases. All options default to off (raw SSIM error signal).
Fields§
§weighting: DiffmapWeightingChannel weighting scheme (default: Trained).
masking_strength: Option<f32>Apply contrast masking to suppress errors in complex/textured regions.
When enabled, each diffmap value is divided by a local complexity mask
derived from the source image’s luminance variance:
mask = 1 + strength × local_variance(Y_src).
This matches the perceptual intuition that errors in smooth areas (sky, gradients) are more visible than in textured areas (foliage, hair).
Default: None (no masking). Typical values: 2.0–8.0.
sqrt: boolApply sqrt to diffmap values after masking.
Compresses the dynamic range so that the diffmap is more linearly
proportional to perceived distortion intensity. Similar to butteraugli’s
sqrt(dc_masked + ac_masked) combination.
Default: false.
include_edge_mse: boolInclude edge artifact, edge detail loss, and MSE features in the diffmap.
When false (default), the diffmap only includes SSIM error.
When true, each pixel also accumulates:
- Edge artifact:
max(0, residual_dst² − residual_src²)— structure added by distortion (ringing, blocking). - Edge detail loss:
max(0, residual_src² − residual_dst²)— structure removed by distortion (blurring, smoothing). - MSE:
(src − dst)²— raw per-pixel squared difference.
Feature contributions are weighted by the profile’s trained weights for each feature type and channel. This makes the diffmap a more complete representation of the metric’s per-pixel view.
include_hf: boolInclude high-frequency energy features in the diffmap.
When true, each pixel also accumulates HF texture loss/gain signals:
- HF energy loss:
max(0, (src−μ)² − (dst−μ)²)— texture energy removed by distortion (smoothing, quantization). - HF magnitude loss:
max(0, |src−μ| − |dst−μ|)— texture magnitude removed (L1 variant, more robust to outliers). - HF energy gain:
max(0, (dst−μ)² − (src−μ)²)— texture energy added by distortion (ringing, noise).
These correspond to trained features 10–12 and help encoder quantization
loops (especially JXL AC coefficient tuning) see where HF texture is
being lost or gained. Requires mu1/mu2 storage (same as include_edge_mse).
Default: false.
Trait Implementations§
Source§impl Clone for DiffmapOptions
impl Clone for DiffmapOptions
Source§fn clone(&self) -> DiffmapOptions
fn clone(&self) -> DiffmapOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiffmapOptions
impl Debug for DiffmapOptions
Source§impl Default for DiffmapOptions
impl Default for DiffmapOptions
Source§fn default() -> DiffmapOptions
fn default() -> DiffmapOptions
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 DiffmapOptions
Auto Trait Implementations§
impl Freeze for DiffmapOptions
impl RefUnwindSafe for DiffmapOptions
impl Send for DiffmapOptions
impl Sync for DiffmapOptions
impl Unpin for DiffmapOptions
impl UnsafeUnpin for DiffmapOptions
impl UnwindSafe for DiffmapOptions
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