pub struct Ssimulacra2Reference { /* private fields */ }Expand description
Precomputed reference for repeated comparisons (from fast-ssim2).
Use this when comparing multiple distorted images against the same reference to avoid recomputing the reference image’s analysis. Precomputed SSIMULACRA2 reference data for fast repeated comparisons.
This struct stores precomputed data for the reference image at all scales, allowing you to quickly compare multiple distorted images against the same reference without recomputing the reference-side data each time.
For simulated annealing or other optimization where you compare many variations against the same source, this provides approximately 2x speedup.
Implementations§
Source§impl Ssimulacra2Reference
impl Ssimulacra2Reference
Sourcepub fn new<T>(source: T) -> Result<Ssimulacra2Reference, Ssimulacra2Error>where
T: ToLinearRgb,
pub fn new<T>(source: T) -> Result<Ssimulacra2Reference, Ssimulacra2Error>where
T: ToLinearRgb,
Precompute reference data for the given source image.
Supports:
imgreftypes (with theimgreffeature):ImgRef<[u8; 3]>,ImgRef<[f32; 3]>, etc.yuvxybtypes:Rgb,LinearRgb- Custom types implementing
ToLinearRgb
§Errors
- If the image is smaller than 8x8 pixels
Sourcepub fn compare<T>(&self, distorted: T) -> Result<f64, Ssimulacra2Error>where
T: ToLinearRgb,
pub fn compare<T>(&self, distorted: T) -> Result<f64, Ssimulacra2Error>where
T: ToLinearRgb,
Compare a distorted image against the precomputed reference.
This is approximately 2x faster than calling compute_ssimulacra2
because it only needs to process the distorted image and compute cross-terms.
§Errors
- If the distorted image dimensions don’t match the reference
Sourcepub fn num_scales(&self) -> usize
pub fn num_scales(&self) -> usize
Get the number of scales that were precomputed.
Trait Implementations§
Source§impl Clone for Ssimulacra2Reference
impl Clone for Ssimulacra2Reference
Source§fn clone(&self) -> Ssimulacra2Reference
fn clone(&self) -> Ssimulacra2Reference
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for Ssimulacra2Reference
impl RefUnwindSafe for Ssimulacra2Reference
impl Send for Ssimulacra2Reference
impl Sync for Ssimulacra2Reference
impl Unpin for Ssimulacra2Reference
impl UnwindSafe for Ssimulacra2Reference
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