pub struct CompareContext { /* private fields */ }Expand description
Reusable scratch buffers for Ssimulacra2Reference::compare_with.
Ssimulacra2Reference::compare allocates roughly 13 image-sized
Vec<f32> planes (mul, mu2, sigma2_sq, sigma12, img2_planar)
plus the Blur working memory on every call. When you compare many
distorted images against the same reference (encoder rate-distortion
search, simulated annealing, picker training), reuse a CompareContext
to amortise those allocations across all calls. Buffers grow only on
the first call and are reused thereafter; later calls do no Vec heap
allocation.
Allocated for a specific reference dimension via
Ssimulacra2Reference::compare_context; passed to
Ssimulacra2Reference::compare_with.
Send but not Sync — give each worker thread its own context.
Auto Trait Implementations§
impl Freeze for CompareContext
impl RefUnwindSafe for CompareContext
impl Send for CompareContext
impl Sync for CompareContext
impl Unpin for CompareContext
impl UnsafeUnpin for CompareContext
impl UnwindSafe for CompareContext
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