pub struct Ssimulacra2Reference { /* private fields */ }Expand description
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: ToLinearRgb>(source: T) -> Result<Self, Ssimulacra2Error>
pub fn new<T: ToLinearRgb>(source: T) -> Result<Self, Ssimulacra2Error>
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: ToLinearRgb>(
&self,
distorted: T,
) -> Result<f64, Ssimulacra2Error>
pub fn compare<T: ToLinearRgb>( &self, distorted: T, ) -> Result<f64, Ssimulacra2Error>
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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more