# dithr 0.2.0 - Remaining PR Context (Delta Only)
This file contains only remaining 0.2.0 work.
Already-implemented items are intentionally omitted.
## Global Rules
1. Keep deterministic behavior in all algorithm paths.
2. Keep existing public algorithm names; add new overloads/wrappers only.
3. Keep `u8` ergonomics first-class.
4. Do not merge multiple PR scopes into one.
5. Run `fmt`, `clippy`, and `test` after each PR.
6. If a golden hash changes, document the reason in the PR description.
7. Parallelism policy for 0.2.0: only Yliluoma receives new `_par` APIs; diffusion and advanced families remain serial to preserve canonical deterministic output.
## Parallelism Evaluation (All PRs)
| PR00 | No | `No` |
| PR01 | No | `No` |
| PR02 | Yes | `Yes` (`yliluoma_*_in_place_par` only) |
| PR03 | No | `No` |
| PR04 | No | `No` |
| PR05 | No | `No` |
| PR06 | No | `No` |
| PR07 | No | `No` |
| PR08 | No | `No` |
| PR09 | No | `No` |
| PR10 | No | `No` |
| PR11 | No | `No` |
| PR12 | No | `No` |
| PR13 | No | `No` |
| PR14 | No | `No` |
| PR15 | No | `No` |
| PR16 | No | `No` |
| PR17 | No | `No` |
| PR18 | No | `No` |
| PR19 | No | `No` |
| PR20 | No | `No` |
| PR21 | No | `No` |
| PR22 | No | `No` |
| PR23 | No | `No` |
| PR24 | No | `No` |
| PR25 | No | `No` |
| PR26 | No | `No` |
| PR27 | No | `No` |
| PR28 | No | `No` |
| PR29 | No | `No` |
| PR31 | No | `No` |
| PR32 | No | `No` |
| PR33 | No | `No` |
| PR34 | No | `No` |
## Consolidated Algorithm Bundles (Use These Instead of Separate PR07-PR34)
Use the consolidated bundles below for implementation planning.
They preserve full scope from the original per-algorithm PRs but reduce churn by grouping methods that share core math and file touch sets.
### CAPR-A - Ordered Adaptive/Traversal Methods
Combines:
- PR20 (adaptive ordered dither)
- PR21 (space-filling curve ordered dither)
- PR22 (ranked dither)
Why grouped:
- Same family (`src/ordered/*`)
- Shared rank-map/traversal concepts
- Shared test/golden/bench plumbing
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-B - Ordered Screen-Synthesis Methods
Combines:
- PR07 (void-and-cluster blue-noise ordered)
- PR23 (image-based dither screens)
- PR25 (stochastic clustered-dot)
- PR24 (polyomino ordered dithering)
Why grouped:
- Same family (`src/ordered/*`)
- All are threshold/screen construction pipelines feeding ordered core
- Common deterministic map/screen generation concerns
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-C - Multiscale Error-Diffusion Suite
Combines:
- PR09 (multiscale error diffusion)
- PR10 (feature-preserving MSED)
- PR11 (green-noise MSED)
Why grouped:
- Same multiscale scaffold and level traversal
- Same file set (`src/diffusion/variable.rs`, `src/diffusion/mod.rs`)
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-D - Color/Vector Error-Diffusion Suite
Combines:
- PR12 (adaptive vector ED)
- PR16 (vector + semivector ED)
- PR17 (hierarchical ED)
Why grouped:
- Shared vector-valued color error propagation and coefficient plumbing
- Same tests/fixtures and alpha-preservation concerns
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-E - Grayscale Quality-Driven ED Suite
Combines:
- PR15 (HVS-optimized ED)
- PR18 (tone-dependent ED)
- PR19 (structure-aware ED)
Why grouped:
- Shared grayscale-focused variable/quality control pathways
- Same module and bench footprint
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-F - Search/Model-Based Advanced Halftoning Suite
Combines:
- PR14 (model-based MED + LSMB)
- PR26 (clustered-dot direct multi-bit search)
- PR28 (hierarchical colorant DBS)
Why grouped:
- Shared optimization-style loops in advanced/dbs paths
- Common objective instrumentation and convergence tests
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-G - Direct Pattern Control Halftoning
Equivalent to:
- PR27 (direct pattern control)
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-H - Optimized Dot Diffusion
Equivalent to:
- PR08 (optimized dot diffusion)
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-I - MBVQ/Neugebauer Color Error-Diffusion Branch
Combines:
- PR29 (MBVQ/MBVC + Neugebauer-model color ED)
Why grouped:
- Recognizable classical color-halftoning branch
- Distinct design rule beyond scalar/vector ED and DBS-style search families
- Shared Neugebauer/MBVQ color-selection infrastructure
Parallelism:
- `No` (serial only in 0.2.0)
### CAPR-J - Block/Mask/Multitone Halftoning Suite
Combines:
- PR31 (block error diffusion)
- PR32 (multichannel green-noise mask diffusion)
- PR33 (AM/FM hybrid + clustered AM/FM)
- PR34 (blue-noise multitone dithering)
Why grouped:
- Shared halftone texture/screen design pipeline concerns
- Shared multilevel and mask-design validation needs
- Similar advanced-family benchmark/fixture footprint
Parallelism:
- `No` (serial only in 0.2.0)
---
## PR00 - Module-First Public API Cleanup
### Goal
Make module paths canonical and de-crowd crate-root exports while preserving backward compatibility during 0.2.x.
### Files
- `src/lib.rs`
- `README.md`
- `examples/gray_buffer.rs`
- `examples/rgb_buffer.rs`
- `examples/indexed_palette.rs`
- `examples/image_bayer_png.rs`
- `examples/image_palette_png.rs`
- `tests/basic.rs`
### Exact Changes
1. Keep family modules public and first-class:
- `buffer`
- `ordered`
- `diffusion`
- `stochastic`
- `dbs`
- `palette`
- `quantize`
- `riemersma`
2. Keep only core/common items prominently re-exported at root:
- buffer/value types and typed constructors
- `QuantizeMode`
- `Palette` / `IndexedImage`
- `Error` / `Result`
3. Deprecate root-level algorithm re-exports (do not remove in 0.2.x):
- `#[deprecated(since = "0.2.0", note = "use dithr::<family>::...")]`
- include explicit note targets, for example:
- `ordered::bayer_8x8_in_place`
- `diffusion::floyd_steinberg_in_place`
- `dbs::direct_binary_search_in_place`
4. Update examples/tests to import algorithm functions from family modules.
5. Update README import style to module-first paths.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo test --workspace --lib --tests --examples
```
### Sources (https)
- https://rust-lang.github.io/api-guidelines/naming.html
- https://rust-lang.github.io/api-guidelines/dependencies.html
- https://doc.rust-lang.org/cargo/reference/semver.html
- https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
---
## PR01 - DynamicImage LumaA Support Gap
### Goal
Close the adapter gap for `image::DynamicImage::ImageLumaA8` and `ImageLumaA16` without introducing new layout types in this release.
### Files
- `src/adapter.rs`
- `src/lib.rs`
- `README.md`
### Exact Changes
1. Update `dynamic_image_as_buffer` in `src/adapter.rs`:
- Stop returning `UnsupportedFormat` for `ImageLumaA8` and `ImageLumaA16`.
- For `ImageLumaA8`, convert in-place to `ImageRgba8` and return `DynamicImageBuffer::Rgba8`.
- For `ImageLumaA16`, convert in-place to `ImageRgba16` and return `DynamicImageBuffer::Rgba16`.
2. Add internal helpers in `src/adapter.rs`:
- `promote_lumaa8_to_rgba8`
- `promote_lumaa16_to_rgba16`
3. Update adapter tests:
- Replace `dynamic_image_adapter_rejects_lumaa8` with:
- `dynamic_image_adapter_promotes_lumaa8_to_rgba8`
- `dynamic_image_adapter_promotes_lumaa16_to_rgba16`
4. Update docs text only where facts changed:
- `src/lib.rs`: image adapter section should state LumaA is promoted to RGBA.
- `README.md`: remove the limitation claiming LumaA is unsupported.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo test --workspace --lib --tests --examples
```
### Sources (https)
- https://docs.rs/image/0.24.9/image/enum.DynamicImage.html
- https://docs.rs/image/0.24.9/image/enum.DynamicImage.html#variant.ImageLumaA8
- https://docs.rs/image/0.24.9/image/enum.DynamicImage.html#variant.ImageLumaA16
- https://docs.rs/image/0.24.9/image/enum.DynamicImage.html#method.into_rgba8
- https://docs.rs/image/0.24.9/image/enum.DynamicImage.html#method.into_rgba16
---
## PR02 - Yliluoma Parallel API (Deterministic Canonical-Output Safe)
### Goal
Add `rayon`-gated `_par` wrappers for Yliluoma only, with strict sequential/parallel output identity.
### Files
- `src/ordered/yliluoma.rs`
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `benches/yliluoma.rs`
- `README.md`
### Exact Changes
1. Add `#[cfg(feature = "rayon")]` wrappers in `src/ordered/yliluoma.rs`:
- `yliluoma_1_in_place_par`
- `yliluoma_2_in_place_par`
- `yliluoma_3_in_place_par`
2. Keep algorithm math unchanged.
3. Require byte-identical output vs sequential wrappers on fixed fixtures.
4. Re-export wrappers in `src/ordered/mod.rs` and `src/lib.rs` under `#[cfg(feature = "rayon")]`.
5. Add parity tests in `tests/ordered.rs`:
- `yliluoma_1_parallel_matches_sequential`
- `yliluoma_2_parallel_matches_sequential`
- `yliluoma_3_parallel_matches_sequential`
6. Add `#[cfg(feature = "rayon")]` seq/par benchmark group in `benches/yliluoma.rs`.
7. Update README parallelism section to include Yliluoma, and keep diffusion/advanced listed as serial-only.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://docs.rs/rayon/latest/rayon/iter/trait.ParallelIterator.html
- https://docs.rs/rayon/latest/rayon/slice/trait.ParallelSliceMut.html
- https://docs.rs/rayon/latest/rayon/index.html
---
## PR03 - Public API Compatibility Cleanup (Remaining)
### Goal
Finish compatibility deprecations that are still missing.
### Files
- `src/buffer.rs`
- `src/stochastic.rs`
- `src/adapter.rs`
- `src/lib.rs`
- `tests/basic.rs`
### Exact Changes
1. Mark remaining compatibility aliases as deprecated (do not remove in 0.2.0):
- `src/buffer.rs`:
- `gray_f32`
- `rgb_f32`
- `rgba_f32`
- `src/stochastic.rs`:
- `threshold_in_place`
- `random_in_place`
- `src/adapter.rs`:
- `gray_image_as_buffer`
- `rgb_image_as_buffer`
- `rgba_image_as_buffer`
2. Deprecation format:
- `#[deprecated(since = "0.2.0", note = "...")]`
3. Keep deprecated symbols exported in `src/lib.rs`.
4. Add compatibility tests in `tests/basic.rs` (`#[allow(deprecated)]` in test scope).
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
```
### Sources (https)
- https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
- https://doc.rust-lang.org/cargo/reference/semver.html
---
## PR04 - Panic-Hardening for Custom PixelLayout Paths (Remaining)
### Goal
Finish remaining custom-`PixelLayout` hardening so public entry points return typed errors instead of panicking on invalid downstream layout implementations.
### Files
- `src/core/layout.rs`
- `src/stochastic.rs`
- `src/ordered/core.rs`
- `src/diffusion/core.rs`
- `src/riemersma.rs`
- `src/dot_diffusion.rs`
- `tests/basic.rs`
- `tests/ordered.rs`
- `tests/diffusion.rs`
### Exact Changes
1. Add shared layout-invariant helper in `src/core/layout.rs`:
- `validate_layout_invariants::<L>() -> crate::Result<()>`
2. Use this helper at top-level family entry points that currently rely on partial ad-hoc checks:
- stochastic
- ordered core
- diffusion core
- riemersma
- dot diffusion
3. Keep existing behavior for valid `Gray`/`Rgb`/`Rgba` unchanged.
4. Add malformed-layout tests covering remaining untested public paths.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo test --workspace --lib --tests --examples
```
### Sources (https)
- https://doc.rust-lang.org/book/ch09-00-error-handling.html
- https://rust-lang.github.io/api-guidelines/
---
## PR05 - CI Matrix Completion (Remaining)
### Goal
Add missing `--no-default-features` coverage in CI workflows.
### Files
- `.github/workflows/ci.yml`
- `.github/workflows/scheduled.yml`
- `.github/workflows/msrv.yml`
### Exact Changes
1. `ci.yml`
- Add:
- `cargo clippy --workspace --all-targets --no-default-features -- -D warnings`
- `cargo test --workspace --lib --tests --examples --no-default-features`
2. `scheduled.yml`
- Add the same missing `--no-default-features` clippy/test runs.
3. `msrv.yml`
- Add:
- `cargo check --workspace --all-targets --no-default-features`
### Validation Commands
```bash
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace --all-targets --no-default-features -- -D warnings
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --lib --tests --examples
cargo test --workspace --lib --tests --examples --no-default-features
cargo test --workspace --all-features --lib --tests --examples
```
### Sources (https)
- https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/run-job-variations
- https://doc.rust-lang.org/cargo/commands/cargo-test.html
- https://doc.rust-lang.org/cargo/commands/cargo-check.html
- https://doc.rust-lang.org/cargo/commands/cargo-clippy.html
---
## PR06 - Bench/Golden Coverage Delta (Remaining)
### Goal
Complete remaining benchmark and golden sensitivity deltas only.
### Files
- `tests/golden.rs`
- `benches/common.rs`
- `benches/ordered.rs`
- `benches/diffusion.rs`
### Exact Changes
1. Bench coverage:
- Add at least one explicit `f32` path in `benches/ordered.rs`.
- Add at least one explicit `f32` path in `benches/diffusion.rs`.
- Add common fixture/helper utilities in `benches/common.rs` only if required to support those two additions.
2. Golden sensitivity:
- Add only missing distinction checks if any distinct algorithms still share identical canonical fixture hashes after current suite audit.
- Do not update existing u8 golden hashes unless behavior changes intentionally.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://bheisler.github.io/criterion.rs/book/
- https://crates.io/crates/criterion
---
## PR07 - Void-and-Cluster Blue-Noise Ordered Dithering
### Goal
Add blue-noise ordered dithering via a generated void-and-cluster threshold array.
### Not Already Implemented Check
- No `void`/`blue_noise` ordered algorithm exists in current `src/ordered/*`.
- Current ordered methods are Bayer/cluster-dot/custom only.
### Files
- `src/ordered/void_cluster.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `src/data/maps.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `void_and_cluster_in_place`
2. Use generic ordered core underneath.
3. Add deterministic 64x64 void-and-cluster rank-map generation utility:
- build once, cache as static map for runtime reuse.
4. Convert generated map to rank array `0..(N-1)` for direct compatibility with existing ordered core.
5. Add tests:
- deterministic map generation hash check
- output quantization invariants (`u8`, `u16`, `f32`)
6. Add one ordered bench case for `void_and_cluster_in_place`.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://cv.ulichney.com/papers/1993-void-cluster.pdf
- https://cv.ulichney.com/papers/1994-filter-design.pdf
---
## PR08 - Optimized Dot Diffusion (Beyond Knuth Variant)
### Goal
Add a second dot-diffusion implementation faithful to optimized dot-diffusion literature, separate from the existing Knuth-style variant.
### Not Already Implemented Check
- Current repository has `knuth_dot_diffusion_in_place` only.
- No optimized class-matrix + diffusion-coefficient variant exists.
### Files
- `src/dot_diffusion.rs`
- `src/lib.rs`
- `tests/advanced.rs`
- `tests/golden.rs`
- `benches/advanced.rs`
- `README.md`
### Exact Changes
1. Keep `knuth_dot_diffusion_in_place` unchanged.
2. Add new API:
- `optimized_dot_diffusion_in_place`
3. Implement optimized-class dot-diffusion path:
- deterministic class matrix selection
- deterministic neighborhood weighting consistent with reference method
- `Gray`/`Rgb`/`Rgba` support with alpha preservation for `Rgba`.
4. Add tests:
- deterministic fixture hash
- `u16`/`f32` smoke invariants
- explicit inequality vs Knuth output on canonical fixture (regression sensitivity).
5. Add one advanced bench case for optimized dot diffusion.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/18255440/
- https://doi.org/10.1109/83.841944
---
## PR09 - Multiscale Error Diffusion (MSED)
### Goal
Add canonical multiscale error diffusion as a separate grayscale family member.
### Not Already Implemented Check
- Current diffusion family has classic, extended, variable, and one gradient-based method.
- No multiscale pyramid-style error diffusion implementation exists.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `multiscale_error_diffusion_in_place`
2. Implement deterministic coarse-to-fine MSED pipeline for grayscale buffers:
- fixed downsample/upsample policy
- fixed traversal order at each level
- deterministic level count from image size.
3. Keep method grayscale-only; return `UnsupportedFormat` for non-gray layouts.
4. Add tests:
- grayscale-only guard
- deterministic output hash
- objective invariants on canonical fixtures.
5. Add one diffusion bench case for MSED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/18282943/
- https://doi.org/10.1109/83.557360
---
## PR10 - Feature-Preserving Multiscale Error Diffusion
### Goal
Add the feature-preserving MSED variant as a second multiscale method.
### Not Already Implemented Check
- No feature-preserving MSED variant exists in current codebase.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `feature_preserving_msed_in_place`
2. Implement feature-preservation term on top of MSED base:
- fixed feature metric
- deterministic modulation policy
- grayscale-only scope.
3. Add tests:
- deterministic output hash
- contrast/edge preservation invariant on canonical edge-heavy fixture
- grayscale-only guard.
4. Add one diffusion bench case for feature-preserving MSED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://ira.lib.polyu.edu.hk/bitstream/10397/1524/1/J-JEI-Feature-preserving%20multiscale%20error%20diffusion_04.pdf
---
## PR11 - Green-Noise Multiscale Error Diffusion
### Goal
Add green-noise MSED variant for clustered but artifact-controlled texture.
### Not Already Implemented Check
- No green-noise multiscale method exists in current diffusion exports.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `green_noise_msed_in_place`
2. Implement deterministic green-noise modulation over multiscale diffusion:
- fixed spectral target configuration
- deterministic seed policy.
3. Keep grayscale-only scope in 0.2.0.
4. Add tests:
- deterministic fixture hash
- spectral proxy invariant (low-frequency suppression bound)
- grayscale-only guard.
5. Add one diffusion bench case for green-noise MSED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/20215075/
- https://www.eie.polyu.edu.hk/~enyhchan/J-TIP-Green_noise_digital_halftoning_with_MED.pdf
---
## PR12 - Adaptive Vector Error Diffusion (Color)
### Goal
Add adaptive vector error diffusion for color workflows (RGB/RGBA).
### Not Already Implemented Check
- Current color diffusion uses fixed kernels and per-pixel scalar quantization decisions.
- No adaptive vector-LMS diffusion method exists.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `adaptive_vector_error_diffusion_in_place`
2. Implement adaptive coefficient update in vector form:
- deterministic update schedule
- bounded coefficient range
- RGB/RGBA support with preserved alpha lane.
3. Add tests:
- deterministic output hash
- coefficient bound/invariant test
- alpha preservation test for RGBA.
4. Add one diffusion bench case for adaptive vector ED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/18282985/
- https://doi.org/10.1109/83.597270
---
## PR13 - Linear Pixel Shuffling Error Diffusion (LPS-ED)
### Goal
Add LPS traversal as an alternative diffusion path to reduce directional artifacts from raster scanning.
### Not Already Implemented Check
- No LPS traversal strategy exists in current diffusion family.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add new API:
- `linear_pixel_shuffling_in_place`
2. Implement deterministic LPS traversal generator:
- full-image permutation with fixed seed and dimensions
- all-direction diffusion neighborhood based on published method.
3. Scope for 0.2.0:
- grayscale first; return `UnsupportedFormat` for non-gray.
4. Add tests:
- deterministic permutation stability test
- deterministic output hash
- grayscale-only guard.
5. Add one diffusion bench case for LPS-ED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://repository.rit.edu/other/391/
- https://www.imaging.org/common/uploaded%20files/pdfs/Papers/2000/PICS-0-81/1625.pdf
---
## PR14 - Model-Based Halftoning Family (MED + LSMB)
### Goal
Add model-based halftoning methods (printer + HVS model) as separate advanced algorithms.
### Not Already Implemented Check
- No model-based MED/LSMB algorithm exists in current exports.
### Files
- `src/dbs.rs`
- `src/lib.rs`
- `tests/advanced.rs`
- `tests/golden.rs`
- `benches/advanced.rs`
- `README.md`
### Exact Changes
1. Add APIs:
- `model_based_med_in_place`
- `least_squares_model_based_in_place`
2. Keep deterministic behavior with fixed eye/printer model defaults.
3. Scope for 0.2.0:
- grayscale-first implementation is acceptable.
4. Add tests:
- deterministic output hash on canonical fixture
- objective-improvement regression test vs plain thresholding baseline.
5. Add one advanced bench case for each method.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/18282991/
- https://doi.org/10.1117/12.135965
- https://users.eecs.northwestern.edu/~pappas/papers/pappas_neuhoff_tip99.pdf
---
## PR15 - HVS-Optimized Error Diffusion (Kolpatzik-Bouman)
### Goal
Add visually optimized error diffusion filter design as a distinct diffusion method.
### Not Already Implemented Check
- Current diffusion wrappers are fixed historical kernels + variable families.
- No explicit HVS-optimized filter-design method exists.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `hvs_optimized_error_diffusion_in_place`
2. Implement deterministic optimized filter-coefficient set based on published approach.
3. Keep method deterministic with fixed coefficient table in 0.2.0.
4. Add tests:
- deterministic output hash
- binary/level invariants by quantization mode.
5. Add one diffusion bench case.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://engineering.purdue.edu/~bouman/publications/pdf/jei1scan.pdf
- https://engineering.purdue.edu/~bouman/publications/pub_doc.html
---
## PR16 - Vector/Semi-Vector Color Error Diffusion
### Goal
Add canonical vector color ED and semi-vector ED as separate color diffusion algorithms.
### Not Already Implemented Check
- No explicit vector-valued color ED implementation is exported today.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add APIs:
- `vector_error_diffusion_in_place`
- `semivector_error_diffusion_in_place`
2. Implement deterministic matrix-valued error filtering in color space.
3. Preserve alpha for RGBA.
4. Add tests:
- deterministic output hash on RGB fixture
- alpha preservation for RGBA
- seq reproducibility across runs.
5. Add one diffusion bench case for vector ED.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/18255498/
- https://doi.org/10.1109/83.951540
- https://users.ece.utexas.edu/~bevans/papers/2003/colorDiffusion/index.html
---
## PR17 - Hierarchical Error Diffusion (HED)
### Goal
Add hierarchical color error diffusion (HED) as a dedicated method.
### Not Already Implemented Check
- No hierarchical ED method exists in current diffusion exports.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `hierarchical_error_diffusion_in_place`
2. Implement deterministic hierarchical control for overlap/position/color sequencing.
3. Scope:
- RGB/RGBA primary target.
4. Add tests:
- deterministic hash
- no-boundary-artifact regression fixture check
- alpha preservation for RGBA.
5. Add one diffusion bench case.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/19473943/
- https://doi.org/10.1109/TIP.2009.2019778
---
## PR18 - Tone-Dependent Error Diffusion (TDED)
### Goal
Add TDED as a separate variable-coefficient family member (distinct from Ostromoukhov/Zhou-Fang).
### Not Already Implemented Check
- TDED is not currently present by name or implementation.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `tone_dependent_error_diffusion_in_place`
2. Implement deterministic tone-trained coefficient lookup path.
3. Keep grayscale-only scope in first pass.
4. Add tests:
- deterministic hash
- coefficient index/bounds test
- grayscale-only guard.
5. Add one diffusion bench case.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/15376941/
---
## PR19 - Structure-Aware Error Diffusion (SAED)
### Goal
Add structure-aware ED to reduce worm artifacts while preserving local detail.
### Not Already Implemented Check
- No structure-aware ED method exists in current diffusion family.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `structure_aware_error_diffusion_in_place`
2. Implement deterministic structure-control term with fixed parameters.
3. Scope:
- grayscale first for 0.2.0.
4. Add tests:
- deterministic hash
- artifact-suppression proxy invariant on structure fixture
- grayscale-only guard.
5. Add one diffusion bench case.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://perso.liris.cnrs.fr/ostrom/publications/pdf/SIGGRAPH-ASIA09_saed.pdf
---
## PR20 - Adaptive Ordered Dither
### Goal
Add adaptive ordered dithering as a distinct ordered-family method.
### Parallelism Decision
`No` for 0.2.0. Keep first implementation serial to preserve canonical behavior while adaptation heuristics are stabilized.
### Not Already Implemented Check
- No adaptive ordered-dither method exists in current `src/ordered/*`.
### Files
- `src/ordered/adaptive.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `adaptive_ordered_dither_in_place`
2. Implement deterministic adaptive threshold-map selection in ordered core style.
3. Scope:
- `Gray`/`Rgb`/`Rgba` support with alpha preservation on `Rgba`.
4. Add tests:
- deterministic fixture hash
- output level invariants for `u8`/`u16`/`f32`
- alpha preservation test on RGBA.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1006/gmip.1996.0414
- https://www.sciencedirect.com/science/article/pii/S1077316996904141
---
## PR21 - Space-Filling Curve Ordered Dither
### Goal
Add ordered dithering driven by deterministic space-filling traversal.
### Parallelism Decision
`No` for 0.2.0. Keep traversal and adaptation strictly serial for canonical reproducibility.
### Not Already Implemented Check
- No space-filling-curve ordered dither method exists in current `src/ordered/*`.
### Files
- `src/ordered/space_filling.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `space_filling_curve_ordered_dither_in_place`
2. Implement deterministic curve traversal with fixed curve order policy.
3. Reuse ordered quantization core to preserve mode/layout behavior.
4. Add tests:
- deterministic traversal ordering test
- deterministic fixture hash
- quantization invariants for `u8`/`u16`/`f32`.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1016/S0097-8493(98)00043-0
- https://www.sciencedirect.com/science/article/pii/S0097849398000430
---
## PR22 - Ranked Dither (Spatially Adaptive)
### Goal
Add ranked dithering as a separate ordered-family algorithm.
### Parallelism Decision
`No` for 0.2.0. Keep serial until deterministic parity fixtures are established across all sample types.
### Not Already Implemented Check
- No ranked-dither method exists in current `src/ordered/*`.
### Files
- `src/ordered/ranked.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `ranked_dither_in_place`
2. Implement deterministic rank-map generation/usage consistent with ranked-dither references.
3. Support `Gray`/`Rgb`/`Rgba` with alpha preservation.
4. Add tests:
- deterministic rank-map check
- deterministic fixture hash
- output quantization invariants.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://www.mayagupta.org/publications/GuptaBowenSPIE07.pdf
---
## PR23 - Image-Based Dither Screens
### Goal
Add image-based dither screens as a dedicated ordered-family method.
### Parallelism Decision
`No` for 0.2.0. Keep serial first pass while screen synthesis is validated.
### Not Already Implemented Check
- No image-based-dither-screen method exists in current `src/ordered/*`.
### Files
- `src/ordered/image_based_screen.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `image_based_dither_screen_in_place`
2. Implement deterministic screen construction path and ordered application.
3. Reuse shared ordered quantization helpers and layout handling.
4. Add tests:
- deterministic generated screen check
- deterministic fixture hash
- quantization invariants for `u8`/`u16`/`f32`.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://graphicsinterface.org/wp-content/uploads/gi1999-22.pdf
- https://doi.org/10.20380/GI1999.22
---
## PR24 - Polyomino Ordered Dithering
### Goal
Add polyomino-based dithering for non-periodic ordered structures.
### Parallelism Decision
`No` for 0.2.0. Keep serial first pass while polyomino tiling and ranking are locked.
### Not Already Implemented Check
- No polyomino-based dithering method exists in current codebase.
### Files
- `src/ordered/polyomino.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `polyomino_ordered_dither_in_place`
2. Implement deterministic polyomino tiling + threshold ranking pipeline.
3. Scope:
- `Gray` first in 0.2.0, return `UnsupportedFormat` for non-gray in first pass.
4. Add tests:
- deterministic tiling/rank check
- deterministic fixture hash
- grayscale-only guard test.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://arxiv.org/abs/0812.1647
---
## PR25 - Stochastic Clustered-Dot Dithering
### Goal
Add stochastic clustered-dot screen synthesis/application as a separate method.
### Parallelism Decision
`No` for 0.2.0. Keep serial while large-screen synthesis and ranking determinism are stabilized.
### Not Already Implemented Check
- Current clustered-dot support is fixed-map ordered (`cluster_dot_4x4`, `cluster_dot_8x8`) only.
- No stochastic clustered-dot screen synthesis method exists.
### Files
- `src/ordered/stochastic_cluster.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `stochastic_clustered_dot_in_place`
2. Implement deterministic screen-dot center placement and threshold renumbering pipeline.
3. Reuse ordered core for final in-place application.
4. Add tests:
- deterministic generated-screen hash
- deterministic fixture hash
- output quantization invariants.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://perso.liris.cnrs.fr/victor.ostromoukhov/publications/pdf/SPIE99_StochasticClust.pdf
- https://pubmed.ncbi.nlm.nih.gov/18255440/
---
## PR26 - Clustered-Dot Direct Multi-Bit Search
### Goal
Add clustered-dot direct multi-bit search for multitoning workflows.
### Parallelism Decision
`No` for 0.2.0. Keep serial due iterative global optimization state.
### Not Already Implemented Check
- Current advanced family has DBS/LBM/electrostatic only.
- No direct multi-bit search variant exists.
### Files
- `src/dbs.rs`
- `src/lib.rs`
- `tests/advanced.rs`
- `tests/golden.rs`
- `benches/advanced.rs`
- `README.md`
### Exact Changes
1. Add API:
- `clustered_dot_direct_multibit_search_in_place`
2. Implement deterministic multi-bit objective/update path with fixed initialization policy.
3. Scope:
- integer grayscale first in 0.2.0.
4. Add tests:
- deterministic fixture hash
- monotonic objective-improvement test
- grayscale/integer guard test.
5. Add one advanced benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/28113172/
- https://doi.org/10.1109/TIP.2016.2552723
- https://research.ibm.com/publications/hybrid-halftoning-using-direct-multi-bit-search-dms-screen-algorithm
---
## PR27 - Direct Pattern Control Halftoning
### Goal
Add Neugebauer-primary direct pattern control as a dedicated color halftoning path.
### Parallelism Decision
`No` for 0.2.0. Keep serial due coupled pattern-control decisions.
### Not Already Implemented Check
- No direct pattern control method exists in current codebase.
### Files
- `src/dbs.rs`
- `src/lib.rs`
- `tests/advanced.rs`
- `tests/golden.rs`
- `benches/advanced.rs`
- `README.md`
### Exact Changes
1. Add API:
- `direct_pattern_control_in_place`
2. Implement deterministic NP-selection and pattern-control loop with fixed policy.
3. Scope:
- RGB/RGBA first in 0.2.0; preserve alpha for RGBA.
4. Add tests:
- deterministic fixture hash
- palette/primary membership invariant
- alpha preservation for RGBA.
5. Add one advanced benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/28613170/
- https://doi.org/10.1109/TIP.2017.2713939
- https://cv.ulichney.com/papers/2017-PARAWACS-IEEE.pdf
---
## PR28 - Hierarchical Colorant DBS (MBVQ-Guided)
### Goal
Add hierarchical colorant-based direct binary search with MBVQ-guided tone handling.
### Parallelism Decision
`No` for 0.2.0. Keep serial due hierarchical constrained optimization dependencies.
### Not Already Implemented Check
- No hierarchical colorant DBS method exists in current advanced family.
### Files
- `src/dbs.rs`
- `src/lib.rs`
- `tests/advanced.rs`
- `tests/golden.rs`
- `benches/advanced.rs`
- `README.md`
### Exact Changes
1. Add API:
- `hierarchical_colorant_dbs_in_place`
2. Implement deterministic hierarchical group ordering and constrained update path.
3. Scope:
- RGB first in 0.2.0.
4. Add tests:
- deterministic fixture hash
- hierarchy-order determinism test
- quality-regression check vs baseline colorant DBS fixture.
5. Add one advanced benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://pubmed.ncbi.nlm.nih.gov/20236895/
- https://doi.org/10.1109/TIP.2010.2045690
- https://pubmed.ncbi.nlm.nih.gov/28613170/
---
## PR29 - MBVQ/Neugebauer Color Error Diffusion
### Goal
Add an explicit MBVQ/MBVC + Neugebauer-model color error-diffusion branch as a first-class deterministic color family.
### Parallelism Decision
`No` for 0.2.0. Keep serial due per-pixel coupled color-selection and strict canonical traversal requirements.
### Not Already Implemented Check
- No explicit MBVQ/MBVC or Neugebauer-model color ED API exists in the current diffusion exports.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add APIs:
- `mbvq_color_error_diffusion_in_place`
- `neugebauer_color_error_diffusion_in_place`
2. Implement deterministic color-primary selection with MBVQ/MBVC constraints and Neugebauer-model-based color-distance evaluation.
3. Scope:
- RGB/RGBA in first pass; preserve alpha lane in RGBA.
4. Add tests:
- deterministic fixture hashes for both APIs
- MBVQ-set membership invariant test
- alpha-preservation test for RGBA.
5. Add one diffusion benchmark entry for each API.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://www.mdpi.com/2313-433X/6/4/23
- https://doi.org/10.3390/jimaging6040023
- https://patents.google.com/patent/US5991438A/en
- https://patents.google.com/patent/EP0895408A2/en
- https://users.ece.utexas.edu/~bevans/papers/2003/colorDiffusion/index.html
---
## PR31 - Block Error Diffusion
### Goal
Add block-based error diffusion for controlled dot shape/size behavior.
### Parallelism Decision
`No` for 0.2.0. Keep serial due block-neighborhood dependency and deterministic block ordering.
### Not Already Implemented Check
- No block-error-diffusion method exists in current diffusion exports.
### Files
- `src/diffusion/block.rs` (new)
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `block_error_diffusion_in_place`
2. Implement deterministic block quantization + block error propagation.
3. Scope:
- grayscale first in 0.2.0.
4. Add tests:
- deterministic fixture hash
- block-size invariant tests
- grayscale-only guard.
5. Add one diffusion benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1109/TIP.2005.859776
- https://shiftleft.com/mirrors/www.hpl.hp.com/personal/Niranjan_Damera-Venkata/files/ibc.pdf
---
## PR32 - Multichannel Green-Noise Error Diffusion
### Goal
Add generalized multichannel green-noise-mask diffusion for color workflows.
### Parallelism Decision
`No` for 0.2.0. Keep serial due coupled multichannel state and mask-index determinism.
### Not Already Implemented Check
- No dedicated multichannel green-noise-mask diffusion method exists in current color diffusion exports.
### Files
- `src/diffusion/variable.rs`
- `src/diffusion/mod.rs`
- `src/lib.rs`
- `tests/diffusion.rs`
- `tests/golden.rs`
- `benches/diffusion.rs`
- `README.md`
### Exact Changes
1. Add API:
- `multichannel_green_noise_error_diffusion_in_place`
2. Implement deterministic multichannel error-filtering with green-noise mask guidance.
3. Scope:
- RGB/RGBA with alpha preservation.
4. Add tests:
- deterministic fixture hash
- color-channel invariants
- alpha preservation on RGBA.
5. Add one diffusion benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1109/83.841537
- https://doi.org/10.1364/JOSAA.16.001575
---
## PR33 - AM/FM Hybrid Halftoning
### Goal
Add AM/FM hybrid halftoning paths with explicit clustered-AM/FM support.
### Parallelism Decision
`No` for 0.2.0. Keep serial due screen-adaptation coupling and deterministic training/runtime mapping.
### Not Already Implemented Check
- No AM/FM hybrid or clustered AM/FM method exists in current ordered/diffusion exports.
### Files
- `src/ordered/am_fm.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add APIs:
- `am_fm_hybrid_halftoning_in_place`
- `clustered_am_fm_halftoning_in_place`
2. Implement deterministic screen design and application policy.
3. Scope:
- grayscale first in 0.2.0.
4. Add tests:
- deterministic fixture hashes for both APIs
- level-invariant tests
- grayscale-only guards.
5. Add one ordered benchmark entry for each API.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1117/12.643690
- https://doi.org/10.2352/ISSN.2169-4451.2004.20.1.art00025_2
- https://dblp.org/db/conf/clrimg/clrimg2006.html
---
## PR34 - Blue-Noise Multitone Dithering
### Goal
Add a dedicated blue-noise multitoning algorithm for multilevel outputs.
### Parallelism Decision
`No` for 0.2.0. Keep serial due multitone state coupling and fixed blue-noise update order.
### Not Already Implemented Check
- No dedicated blue-noise multitone method exists in current ordered/diffusion/advanced exports.
### Files
- `src/ordered/multitone.rs` (new)
- `src/ordered/mod.rs`
- `src/lib.rs`
- `tests/ordered.rs`
- `tests/golden.rs`
- `benches/ordered.rs`
- `README.md`
### Exact Changes
1. Add API:
- `blue_noise_multitone_dither_in_place`
2. Implement deterministic multitone assignment with blue-noise guidance.
3. Scope:
- grayscale first in 0.2.0.
4. Add tests:
- deterministic fixture hash
- multilevel occupancy invariant
- grayscale-only guard.
5. Add one ordered benchmark entry.
### Validation Commands
```bash
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features --lib --tests --examples
cargo bench --workspace --all-features --no-run
```
### Sources (https)
- https://doi.org/10.1109/TIP.2008.926145
- https://www.eecis.udel.edu/~arce/files/Publications/5-Multitone.pdf
---
## Recommended Merge Order
1. PR00 (module-first public API cleanup)
2. PR01 (image LumaA support gap)
3. PR04 (remaining panic-hardening)
4. PR03 (remaining API deprecations)
5. PR02 (Yliluoma-only parallel API)
6. PR05 (remaining CI feature-matrix coverage)
7. PR06 (remaining bench/golden delta)
8. PR13 (LPS error diffusion)
9. CAPR-A (ordered adaptive/traversal suite: PR20+PR21+PR22)
10. CAPR-B (ordered screen-synthesis suite: PR07+PR23+PR25+PR24)
11. CAPR-H (optimized dot diffusion: PR08)
12. CAPR-C (multiscale diffusion suite: PR09+PR10+PR11)
13. CAPR-D (color/vector diffusion suite: PR12+PR16+PR17)
14. CAPR-E (grayscale quality diffusion suite: PR15+PR18+PR19)
15. CAPR-I (MBVQ/Neugebauer color ED branch: PR29)
16. CAPR-J (block/mask/multitone suite: PR31+PR32+PR33+PR34)
17. CAPR-F (search/model advanced suite: PR14+PR26+PR28)
18. CAPR-G (direct pattern control: PR27)