Why Butteraugli Is Used for AVIF Image Encoding
This article explores why Butteraugli has become a standard metric for measuring perceptual error in AVIF encoding workflows. While AVIF provides advanced compression efficiency compared to legacy formats like JPEG, traditional mathematical metrics like PSNR often fail to reflect actual human visual perception. Butteraugli bridges this gap by accurately modeling human visual biology, enabling developers and automated tools to optimize AVIF compression to the exact threshold of human noticeability without wasting bandwidth.
The Failure of Traditional Metrics
For decades, image compression relied on Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) to evaluate quality. These algorithms compute mathematical differences between pixel values. However, modern codecs like AV1 (the video codec powering AVIF) introduce complex transformations, directional smoothing, and adaptive quantization.
Under these advanced techniques, an image can yield a low PSNR score while looking completely pristine to human observers. Conversely, an image with high mathematical similarity might introduce unnatural banding or blur in areas where the human eye is extremely sensitive. Relying on PSNR or simple SSIM leads either to over-compressing visually sensitive regions or over-allocating file size to details the human eye cannot perceive.
Precise Human Visual System (HVS) Modeling
Butteraugli, developed by Google, is an image quality metric specifically engineered to simulate the human visual system. Instead of treating pixels as raw numbers, it models the biological response of the human eye:
- Photoreceptor Mechanics: It simulates how human cone cells (L, M, and S cones) respond to different wavelengths of light, accounting for the eye's asymmetrical sensitivity to color versus luminance.
- Spatial Frequency and Masking: Butteraugli accounts for visual masking—the phenomenon where high-contrast noise or complex textures hide compression artifacts, whereas smooth gradients make artifacts immediately apparent.
- Temporal and Spatial Integration: It analyzes localized differences across varying scales, mimicking how the brain perceives edges and textures.
Because AVIF uses sophisticated chroma subsampling and frequency-domain transforms, Butteraugli's biologically accurate approach ensures that compression artifacts are evaluated exactly as a viewer would experience them.
Target-Based Visual Fidelity
A primary challenge in web delivery is achieving "visually lossless" compression—the point where an image cannot be distinguished from its original uncompressed source by the human eye.
Butteraugli evaluates images using a specific scale where a score of
roughly 1.0 represents the just-noticeable difference (JND) threshold.
Any score significantly below 1.0 indicates that artifacts are virtually
imperceptible. This scalar predictability is ideal for AVIF tuning.
Instead of guessing a fixed quality factor (such as -q 60
or -q 80), automated pipelines use Butteraugli to
iteratively reduce AVIF quality until the error score nears 1.0. This
guarantees the smallest possible file size while avoiding noticeable
visual degradation.
Integration in AVIF Encoders
Because of this synergy, Butteraugli is frequently integrated into
AVIF encoding utilities (such as cavif) and benchmarking
frameworks. Encoders leverage the metric to guide Rate-Distortion
Optimization (RDO), allowing the AV1 encoder to allocate bits
intelligently across different spatial blocks. By pairing AVIF with
Butteraugli, developers can fully exploit the codec's superior
compression capabilities with the confidence that the end-user
experience remains visually uncompromised.