pub struct ComparisonResult {
pub max_abs_diff: u32,
pub mean_abs_diff: f64,
pub psnr_db: f64,
pub rms_error: f64,
pub worst_index: usize,
pub element_count: usize,
pub differing_elements: usize,
pub diff_histogram: [u64; 256],
}Expand description
Detailed result of comparing two buffers element-by-element.
Fields§
§max_abs_diff: u32Maximum absolute difference between any two corresponding elements.
mean_abs_diff: f64Mean absolute difference.
psnr_db: f64Peak Signal-to-Noise Ratio (dB). f64::INFINITY if buffers are identical.
rms_error: f64Root Mean Square error.
worst_index: usizeIndex of the element with the largest absolute difference.
element_count: usizeTotal number of elements compared.
differing_elements: usizeNumber of elements that differ by at least 1.
diff_histogram: [u64; 256]Histogram of absolute differences (bin i = count of elements with diff == i).
Limited to the first 256 bins.
Implementations§
Source§impl ComparisonResult
impl ComparisonResult
Sourcepub fn compare_u8(a: &[u8], b: &[u8]) -> Self
pub fn compare_u8(a: &[u8], b: &[u8]) -> Self
Compare two u8 buffers element-by-element.
If the buffers have different lengths, the comparison is performed over the shorter length.
Sourcepub fn compare_f32(a: &[f32], b: &[f32]) -> Self
pub fn compare_f32(a: &[f32], b: &[f32]) -> Self
Compare two f32 buffers element-by-element.
Values are assumed to be in the range [0.0, 1.0].
Sourcepub fn passes(&self, metric: &ToleranceMetric) -> bool
pub fn passes(&self, metric: &ToleranceMetric) -> bool
Check whether this result passes a given tolerance metric.
Sourcepub fn diff_percentage(&self) -> f64
pub fn diff_percentage(&self) -> f64
Percentage of elements that differ.
Sourcepub fn is_exact_match(&self) -> bool
pub fn is_exact_match(&self) -> bool
Whether the two buffers are exactly identical.
Trait Implementations§
Source§impl Clone for ComparisonResult
impl Clone for ComparisonResult
Source§fn clone(&self) -> ComparisonResult
fn clone(&self) -> ComparisonResult
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 ComparisonResult
impl RefUnwindSafe for ComparisonResult
impl Send for ComparisonResult
impl Sync for ComparisonResult
impl Unpin for ComparisonResult
impl UnsafeUnpin for ComparisonResult
impl UnwindSafe for ComparisonResult
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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