codec_eval/metrics/prelude.rs
1//! Re-exports of metric crate types for convenience.
2//!
3//! This module provides a single place to import common types from the metrics
4//! crates (dssim-core, butteraugli, ssimulacra2, fast-ssim2), allowing zen*
5//! projects to depend only on codec-eval instead of each metric crate separately.
6//!
7//! # Example
8//!
9//! ```rust
10//! use codec_eval::metrics::prelude::*;
11//!
12//! // Now you have access to:
13//! // - Dssim, DssimImage (from dssim-core)
14//! // - butteraugli, ButteraugliParams (from butteraugli)
15//! // - compute_frame_ssimulacra2, Xyb (from ssimulacra2)
16//! // - Ssimulacra2 (from fast-ssim2)
17//! // - ImgRef, ImgVec (from imgref)
18//! // - RGB8, RGBA8, RGB16, RGBA16 (from rgb)
19//! ```
20//!
21//! # Note
22//!
23//! This is a convenience module. You can still depend on the individual metric
24//! crates directly if you prefer. This module just provides a single dependency
25//! point with consistent versions.
26
27// ============================================================================
28// DSSIM (Structural Similarity)
29// ============================================================================
30
31/// DSSIM metric calculator (from dssim-core).
32///
33/// Used for computing structural dissimilarity between images.
34pub use dssim_core::Dssim;
35
36/// DSSIM image wrapper (from dssim-core).
37///
38/// Wrap your images in this type before passing to Dssim::compare.
39pub use dssim_core::DssimImage;
40
41/// SSIM heatmap (from dssim-core).
42///
43/// Returned by Dssim::compare as the second element of the tuple.
44#[doc(hidden)]
45pub use dssim_core::SsimMap;
46
47// ============================================================================
48// Butteraugli (Perceptual Quality)
49// ============================================================================
50
51/// Butteraugli metric function (from butteraugli).
52///
53/// Compare two images and return a perceptual quality score.
54/// Scores < 1.0 indicate imperceptible difference.
55pub use butteraugli::butteraugli;
56
57/// Butteraugli parameters (from butteraugli).
58///
59/// Configure intensity target, HF asymmetry, and other parameters.
60pub use butteraugli::ButteraugliParams;
61
62/// Butteraugli result (from butteraugli).
63///
64/// Contains the overall score and optional diffmap.
65pub use butteraugli::ButteraugliResult;
66
67// ============================================================================
68// SSIMULACRA2 (Best Correlation with Human Perception)
69// ============================================================================
70
71/// Compute SSIMULACRA2 score with SIMD acceleration (from fast-ssim2).
72///
73/// This is the recommended SSIMULACRA2 implementation, providing significantly
74/// better performance than the reference implementation while producing
75/// identical results.
76pub use fast_ssim2::compute_ssimulacra2;
77
78/// SSIMULACRA2 configuration for customizing computation (from fast-ssim2).
79pub use fast_ssim2::Ssimulacra2Config;
80
81/// Precomputed reference for repeated comparisons (from fast-ssim2).
82///
83/// Use this when comparing multiple distorted images against the same reference
84/// to avoid recomputing the reference image's analysis.
85pub use fast_ssim2::Ssimulacra2Reference;
86
87// ============================================================================
88// Image Types (imgref, rgb)
89// ============================================================================
90
91/// Image reference type (from imgref).
92///
93/// Zero-copy view into an image buffer.
94pub use imgref::ImgRef;
95
96/// Owned image type (from imgref).
97///
98/// Owns its pixel buffer.
99pub use imgref::ImgVec;
100
101/// RGB pixel type with u8 components (from rgb).
102pub use rgb::RGB8;
103
104/// RGBA pixel type with u8 components (from rgb).
105pub use rgb::RGBA8;
106
107/// RGB pixel type with u16 components (from rgb).
108pub use rgb::RGB16;
109
110/// RGBA pixel type with u16 components (from rgb).
111pub use rgb::RGBA16;
112
113/// Generic RGB pixel type (from rgb).
114pub use rgb::RGB;
115
116/// Generic RGBA pixel type (from rgb).
117pub use rgb::RGBA;