Skip to content

Commit d23a390

Browse files
committed
docs: update README and CHANGELOG for v0.6.0 release
- Add imgref and strided encoding examples to README - Document new features in Features list - Add CHANGELOG entries for 0.5.0-0.5.5 and 0.6.0 - Bump version to 0.6.0
1 parent d255f4b commit d23a390

File tree

3 files changed

+95
-2
lines changed

3 files changed

+95
-2
lines changed

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,55 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.6.0] - 2026-02-02
9+
10+
### Added
11+
- **`imgref` feature (default)** - Type-safe encoding with `encode_imgref()` accepting `ImgRef<P>` directly
12+
- Supports `RGB<u8>`, `RGBA<u8>` (alpha discarded), `Gray<u8>`, `[u8; 3]`, `[u8; 4]`, `u8`
13+
- Automatic stride handling for subimages
14+
- No dimension mix-ups (width/height baked into type)
15+
- **Strided encoding** - `encode_rgb_strided()` and `encode_gray_strided()` for:
16+
- Memory-aligned buffers (e.g., 64-byte aligned rows)
17+
- Cropping without copy (point into larger buffer)
18+
- GPU texture formats with padding
19+
- **`EncodeablePixel` trait** - Implement for custom pixel types
20+
- **`Error::InvalidStride`** - New error variant for stride validation
21+
22+
### Changed
23+
- `imgref` and `rgb` crates are now default dependencies (can be disabled with `default-features = false`)
24+
25+
## [0.5.5] - 2026-02-01
26+
27+
### Changed
28+
- Recommend `mozjpeg` crate for users who need both encoding and decoding
29+
30+
## [0.5.4] - 2026-01-13
31+
32+
### Fixed
33+
- Clippy warnings in benchmarks and examples
34+
35+
### Changed
36+
- Removed all unsafe from SIMD modules (now uses safe wrappers)
37+
38+
## [0.5.3] - 2026-01-10
39+
40+
### Changed
41+
- Migrated from archmage 0.1 to 0.4 with safe_unaligned_simd
42+
43+
## [0.5.1] - 2026-01-08
44+
45+
### Fixed
46+
- Scan optimizer parity improvements with C mozjpeg
47+
48+
## [0.5.0] - 2026-01-05
49+
50+
### Added
51+
- Improved scan optimization algorithm
52+
- Better progressive scan selection
53+
54+
### Fixed
55+
- optimize_scans parity with C mozjpeg (now within ±0.4%)
56+
857
## [0.4.1] - 2025-01-03
958

1059
### Added
@@ -102,6 +151,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
102151
- Platforms: Linux, macOS, Windows (x64 and ARM64)
103152
- Output compatible with all standard JPEG decoders
104153

154+
[0.6.0]: https://github.com/imazen/mozjpeg-rs/compare/v0.5.5...v0.6.0
155+
[0.5.5]: https://github.com/imazen/mozjpeg-rs/compare/v0.5.4...v0.5.5
156+
[0.5.4]: https://github.com/imazen/mozjpeg-rs/compare/v0.5.3...v0.5.4
157+
[0.5.3]: https://github.com/imazen/mozjpeg-rs/compare/v0.5.1...v0.5.3
158+
[0.5.1]: https://github.com/imazen/mozjpeg-rs/compare/v0.5.0...v0.5.1
159+
[0.5.0]: https://github.com/imazen/mozjpeg-rs/compare/v0.4.1...v0.5.0
105160
[0.4.1]: https://github.com/imazen/mozjpeg-rs/compare/v0.4.0...v0.4.1
106161
[0.4.0]: https://github.com/imazen/mozjpeg-rs/compare/v0.3.0...v0.4.0
107162
[0.3.0]: https://github.com/imazen/mozjpeg-rs/compare/v0.2.5...v0.3.0

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mozjpeg-rs"
3-
version = "0.5.5"
3+
version = "0.6.0"
44
edition = "2021"
55
rust-version = "1.89.0"
66
license = "BSD-3-Clause"

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,51 @@ let jpeg = Encoder::new()
117117
.encode_rgb(&pixels, width, height)?;
118118
```
119119

120+
### Type-Safe Encoding with imgref (default feature)
121+
122+
The `imgref` feature (enabled by default) provides type-safe encoding with automatic stride handling:
123+
124+
```rust
125+
use mozjpeg_rs::Encoder;
126+
use imgref::ImgVec;
127+
use rgb::RGB8;
128+
129+
// Type-safe: dimensions baked in, can't mix up width/height
130+
let pixels: Vec<RGB8> = vec![RGB8::new(128, 64, 32); 640 * 480];
131+
let img = ImgVec::new(pixels, 640, 480);
132+
let jpeg = Encoder::new().quality(85).encode_imgref(img.as_ref())?;
133+
134+
// Subimages work automatically (stride handled internally)
135+
let crop = img.sub_image(100, 100, 200, 200);
136+
let jpeg = encoder.encode_imgref(crop)?;
137+
```
138+
139+
Supported pixel types: `RGB<u8>`, `RGBA<u8>` (alpha discarded), `Gray<u8>`, `[u8; 3]`, `[u8; 4]`, `u8`.
140+
141+
### Strided Encoding
142+
143+
For memory-aligned buffers or cropping without copy:
144+
145+
```rust
146+
// Memory-aligned buffer (rows padded to 256 bytes)
147+
let stride = 256;
148+
let buffer: Vec<u8> = vec![128; stride * height];
149+
let jpeg = encoder.encode_rgb_strided(&buffer, width, height, stride)?;
150+
151+
// Crop without copy - point into larger buffer
152+
let crop_data = &full_image[crop_offset..];
153+
let jpeg = encoder.encode_rgb_strided(crop_data, crop_w, crop_h, full_stride)?;
154+
```
155+
120156
## Features
121157

122158
- **Trellis quantization** - Rate-distortion optimized coefficient selection (AC + DC)
123159
- **Progressive JPEG** - Multi-scan encoding with spectral selection
124160
- **Huffman optimization** - 2-pass encoding for optimal entropy coding
125161
- **Overshoot deringing** - Reduces ringing artifacts at sharp edges
126162
- **Chroma subsampling** - 4:4:4, 4:2:2, 4:2:0 modes
163+
- **Type-safe imgref integration** - Encode `ImgRef<RGB8>` directly with automatic stride handling
164+
- **Strided encoding** - Memory-aligned buffers, crop without copy
127165
- **Safe Rust** - `#![deny(unsafe_code)]` with exceptions only for SIMD intrinsics
128166

129167
### Encoder Settings Matrix
@@ -206,7 +244,7 @@ mozjpeg-rs uses `multiversion` for automatic vectorization by default. Optional
206244

207245
```toml
208246
[dependencies]
209-
mozjpeg-rs = { version = "0.2", features = ["simd-intrinsics"] }
247+
mozjpeg-rs = { version = "0.6", features = ["simd-intrinsics"] }
210248
```
211249

212250
In benchmarks, the difference is minimal (~2%) as `multiversion` autovectorization works well for DCT and color conversion.

0 commit comments

Comments
 (0)