Expand description
iqa provides a single, ergonomic API over the patchwork of visual
quality assessment metrics available in the Rust ecosystem.
Every metric consumes the same Image<F> type, parameterized by a
PixelFormat marker. The format fixes an image’s color space, channel
layout, and bit depth at the type level, and a metric requires its two
inputs to share one format. Comparing images that differ in any of those
properties — a classic source of meaningless scores — is therefore a
compile error, not a silent surprise. Only a dimension mismatch, which
cannot be known at compile time, remains a runtime error.
Decoding external image formats into an Image is out of scope: callers
build one directly from a sample buffer via Image::srgb8 and friends.
§Features
Each metric is gated behind a Cargo feature:
psnr(default) — peak signal-to-noise ratio, a native implementation.ssim(default) — structural similarity index (SSIM), a native implementation.dssim(default) — structural dissimilarity,(1 - SSIM) / 2, a native implementation layered onssim(which it enables).ms-ssim(default) — multi-scale SSIM (MS-SSIM), a native implementation that evaluatesssimover an image pyramid (and so enablesssim).iw-ssim(default) — information content weighted SSIM (IW-SSIM, Wang & Li 2011), a native Laplacian-pyramid extension of MS-SSIM that poolsssim’s contrast-structure maps by a Gaussian-Scale-Mixture information weight (and so enablesssim).psnr-hvs-m(default) — PSNR-HVS-M (Ponomarenko et al. 2007), a native DCT-domain PSNR with a contrast-sensitivity function and contrast masking.ciede2000(default) — CIEDE2000 (ΔE₀₀), a native implementation of the CIE’s perceptual color difference: per-pixel sRGB→CIELAB (D65), mean-pooled.ssimulacra2(default) — SSIMULACRA2, bound via FFI to the vendored C++ reference. Enabling it requires thethird_party/git submodules and a C++ toolchain; see the project README.butteraugli(default) — Butteraugli, bound via FFI to libjxl’s vendored C++. Shares the same native build asssimulacra2.
Structs§
- Butteraugli
Options - Tuning parameters for
butteraugli. - Ciede2000
Options - Options controlling a CIEDE2000 computation.
- Dssim
Options - Options controlling a DSSIM computation.
- Gray8
- 8-bit grayscale, one channel per pixel.
- Gray16
- 16-bit grayscale, one channel per pixel.
- Image
- A decoded image of pixel format
F. - Iwssim
Options - Options controlling an IW-SSIM computation.
- Msssim
Options - Options controlling an MS-SSIM computation.
- Psnr
HvsOptions - Options controlling a PSNR-HVS-M computation.
- Psnr
Options - Options controlling a PSNR computation.
- Rgba8
- 8-bit sRGB with an alpha channel, four channels per pixel (R, G, B, A).
- Rgba16
- 16-bit sRGB with an alpha channel, four channels per pixel (R, G, B, A).
- Srgb8
- 8-bit sRGB, three channels per pixel (R, G, B).
- Srgb16
- 16-bit sRGB, three channels per pixel (R, G, B).
- Ssim
Options - Options controlling an SSIM computation.
Enums§
- BitDepth
- Bits per sample of an
Image. - Channels
- Channel layout of an
Image. - Color
Space - Color space the pixel values are encoded in.
- Error
- Errors produced when constructing images or computing metrics.
- Psnr
HvsMode - Which signal PSNR-HVS-M is computed over.
- Psnr
Mode - Which signal PSNR is computed over.
- Ssim
Mode - Which signal SSIM is computed over.
Traits§
- Butteraugli
Input - A pixel format that
butterauglican score. - Pixel
Format - A compile-time description of how an
Image’s pixels are laid out and interpreted. - Sample
- A raw image sample type: either
u8oru16. - Ssimulacra2
Input - A pixel format that
ssimulacra2can score.
Functions§
- butteraugli
- Computes the Butteraugli distance between
referenceanddistorted. - ciede2000
- Computes the mean CIEDE2000 (ΔE₀₀) color difference between
referenceanddistorted. - dssim
- Computes the structural dissimilarity (DSSIM) between
referenceanddistortedas(1 - SSIM) / 2. - iwssim
- Computes the IW-SSIM between
referenceanddistorted. - msssim
- Computes the MS-SSIM between
referenceanddistorted. - psnr
- Computes the PSNR (in decibels) between
referenceanddistorted. - psnr_
hvs_ m - Computes the PSNR-HVS-M (in decibels) between
referenceanddistorted. - ssim
- Computes the mean SSIM between
referenceanddistorted. - ssimulacra2
- Computes the SSIMULACRA2 score between
referenceanddistorted.
Type Aliases§
- Result
- Convenience alias for results returned by this crate.