dithr 0.2.0

Buffer-first rust dithering and halftoning library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
# 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)

| PR | New Parallel API in PR | Decision |
| --- | --- | --- |
| 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)