zenjpeg 0.1.0

High-quality JPEG encoder combining mozjpeg and jpegli approaches for Pareto-optimal compression
Documentation
# zenjpeg

High-quality JPEG encoder combining the best techniques from mozjpeg and jpegli for Pareto-optimal compression.

## Overview

zenjpeg automatically selects the optimal encoding strategy based on quality requirements:

- **Low quality (Q < 70)**: Uses mozjpeg-style trellis quantization for best compression
- **High quality (Q >= 70)**: Uses jpegli-style adaptive quantization for perceptual quality
- **Quality targeting**: Binary search to hit specific SSIMULACRA2/Butteraugli targets

## Features

- **Adaptive strategy selection** - Automatically picks best encoder based on target quality
- **Trellis quantization** - Rate-distortion optimized coefficient selection (from mozjpeg)
- **Adaptive quantization** - Content-aware bit allocation (from jpegli)
- **Progressive encoding** - Multiple scan scripts for optimized progressive display
- **Huffman optimization** - Two-pass encoding for optimal entropy coding
- **Perceptual targeting** - Target specific quality metrics (SSIMULACRA2, Butteraugli, DSSIM)

## Usage

```rust
use zenjpeg::{Encoder, Quality};

// Basic encoding
let encoder = Encoder::new().quality(Quality::Standard(85));
let jpeg_data = encoder.encode_rgb(&pixels, width, height)?;

// Maximum compression (progressive + trellis)
let encoder = Encoder::max_compression();
let jpeg_data = encoder.encode_rgb(&pixels, width, height)?;

// Maximum quality
let encoder = Encoder::max_quality();
let jpeg_data = encoder.encode_rgb(&pixels, width, height)?;
```

## Feature Flags

- `simd` - Enable SIMD intrinsics for faster encoding
- `cms-lcms2` - Use Little CMS 2 for ICC color management
- `cms-moxcms` - Use moxcms (pure Rust) for ICC color management

## Performance

At SSIM2 >= 80 quality target:
- jpegli: 1.310 bpp (best efficiency)
- mozjpeg-oxide: 1.437 bpp
- zenjpeg: 1.458 bpp (within 1.5% of mozjpeg-oxide)

zenjpeg appears on the Pareto front at multiple quality levels, offering the best
of both encoders depending on the target.

## Requirements

- Rust 1.70.0 or later

## License

AGPL-3.0-or-later

## AI-Generated Code Notice

This crate was developed with assistance from Claude (Anthropic). While thoroughly
tested against reference implementations (mozjpeg, jpegli) with 200+ passing tests,
not all code has been manually reviewed.

Before production use:
- Review critical paths for your use case
- Run your own validation on representative images
- Consider the AGPL license implications