Skip to main content

Crate blazediff

Crate blazediff 

Source
Expand description

Fast image diffing with two-pass block optimization and SIMD.

  • Block-based: Cold pass identifies changed blocks, hot pass processes only those
  • SIMD: NEON (aarch64), SSE4.1 (x86_64), scalar fallback
  • YIQ perceptual delta: More accurate than RGB euclidean distance
  • Anti-aliasing detection: Optionally exclude AA pixels from diff count
use blazediff::{diff, load_png, save_png, DiffOptions, Image};

let img1 = load_png("a.png").unwrap();
let img2 = load_png("b.png").unwrap();
let mut output = Image::new(img1.width, img1.height);

let result = diff(&img1, &img2, Some(&mut output), &DiffOptions::default()).unwrap();
save_png(&output, "diff.png").unwrap();
println!("{} pixels differ", result.diff_count);

Re-exports§

pub use diff::diff;
pub use io::encode_png;
pub use io::load_png;
pub use io::load_pngs;
pub use io::save_png;
pub use io::save_png_with_compression;
pub use jpeg_io::load_jpeg;
pub use jpeg_io::load_jpegs;
pub use jpeg_io::save_jpeg;
pub use qoi_io::load_qoi;
pub use qoi_io::load_qois;
pub use qoi_io::save_qoi;
pub use types::DiffError;
pub use types::DiffOptions;
pub use types::DiffResult;

Modules§

antialiasing
Anti-aliasing detection based on “Anti-aliased Pixel and Intensity Slope Detector” by V. Vysniauskas (2009). Examines 3x3 neighborhood to find gradient patterns.
diff
Two-pass block-based image diff with SIMD acceleration.
io
PNG I/O.
jpeg_io
JPEG I/O.
output
Diff visualization output.
qoi_io
QOI I/O.
simd
SIMD utilities (pixel comparison, YIQ delta).
types
Core types.
yiq
YIQ color math, re-exported from the crate it now lives in so blazediff::yiq::* keeps working. YIQ color space calculations.

Structs§

Image
The RGBA8 image buffer, owned by blazediff_shared so every BlazeDiff crate can speak it without depending on this one. A decoded image: RGBA, 4 bytes per pixel, row-major.

Enums§

ImageFormat
Image decoding and encoding, re-exported from the crate it now lives in. The container formats BlazeDiff reads and writes.

Functions§

decode_image
Image decoding and encoding, re-exported from the crate it now lives in. Decode an encoded buffer, picking the decoder from its magic bytes.
decode_image_pair
Image decoding and encoding, re-exported from the crate it now lives in. Decode two encoded buffers in parallel.
load_image
Image decoding and encoding, re-exported from the crate it now lives in. Load one image, picking the decoder from the file extension.
load_image_pair
Image decoding and encoding, re-exported from the crate it now lives in. Load two images in parallel, picking each decoder from its file extension.