Cargo Features

[dependencies]
mozjpeg-rs = { version = "0.9.0", default-features = false, features = ["fast-yuv", "simd-intrinsics", "simd", "png", "mozjpeg-sys-config", "imgref"] }
default = fast-yuv, imgref

These default features are set whenever mozjpeg-rs is added without default-features = false somewhere in the dependency tree.

fast-yuv default

Use the yuv crate for SIMD color conversion (AVX-512/AVX2/SSE/NEON/WASM). ~60% faster than hand-written AVX2, with ±1 level precision (invisible after JPEG quantization).

Enables yuv

Optional: yuv crate for fast SIMD color conversion (AVX-512/AVX2/SSE/NEON/WASM)

Affects color::convert_rgb_to_ycbcr

simd-intrinsics simd?

Use hand-written SIMD intrinsics for ~15% better DCT/color performance. Without this, uses autoversion autovectorization (safe, ~87% of intrinsics perf).

simd = simd-intrinsics

Legacy alias

png

Enable PNG loading in corpus module (enabled by default in dev)

Enables png

Optional PNG support for corpus loading

Affects corpus::load_png_as_rgb

mozjpeg-sys-config

Enables mozjpeg-sys configuration: configure a C mozjpeg encoder from our Encoder

Enables libc and mozjpeg-sys

mozjpeg-sys:

Optional: mozjpeg-sys configuration (configure C encoder from our settings)

Affects mozjpeg-rs::compat

imgref default

Enables imgref integration for type-safe pixel formats with automatic stride handling.
Provides encode() method that accepts ImgRef<RGB8>, ImgRef<RGBA8>, etc.

Enables imgref and rgb

imgref:

Optional: imgref integration for type-safe pixel formats

Affects mozjpeg-rs::imgref_ext