feat: complete multichannel (5-7ch) ICC profile generation & verification

- Profile Creation & Inversion (profout.c, xlut.c, mchan_inv.c):
  * Unify BtoA CLUT resolutions for devchan >= 5 (9/17/25/33) to provide dense PCS inversion grids
  * Guard all reverse simplicial ops in xlut.c with within_restrictedsize() to prevent SIGSEGV when di > 4 (MXRI cap)
  * Enhance Powell optimizer in mchan_inv.c with multi-candidate starting strategy and scaled deltaE^2 Lab coordinates
  * Allow icSigColorantTableTag in V2 profiles for devchan >= 5 in icc.c

- Numerical & Geometry Stability (scat.c, gamut.c):
  * Fix SIGSEGV in rspl scat.c sparse matrix solver caused by assumption of sorted xcol in 4x unrolled loops
  * Add null pointer and tag checks in gamut.c radial_point_triang

- Test Targets & Verification (test_multichannel/):
  * Add synthetic .ti1 and .ti3 targets for 5-channel (CMYKO), 6-channel (CMYKOG), and 7-channel (CMYKOGV) workflows
  * Add ti1_to_ti3 conversion script and verify_roundtrip.py round-trip verification utility
  * Verified end-to-end:
    - 5-channel: avg dE = 2.38, max dE = 6.27
    - 6-channel: avg dE = 1.90, max dE = 5.40
    - 7-channel: avg dE = 2.15, max dE = 5.54

- Build & Housekeeping:
  * Add .gitignore for compiled executables, autotools outputs, and generated ICC profiles
  * Update MULTICHANNEL_IMPLEMENTATION_PLAN.md with verification results
This commit is contained in:
2026-11-18 16:49:43 +03:30
parent d909b331c2
commit eaab9e3dd3
17 changed files with 3336 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
# Implementation Plan — ArgyllCMS Multichannel (5–7 Color) ICC Profiling
> [!NOTE]
> **Implementation Status:** Core implementation completed in commit `51d0d04`. Phases 1, 2, and 3 are active in the codebase, enabling 5–7 channel input parsing, adaptive CLUT generation, automatic colorant table tags, dynamic TAC, and optimization-based BtoA CLUT inversion.
> **Implementation Status:** Fully implemented and verified across 5-channel (CMYKO), 6-channel (CMYKOG), and 7-channel (CMYKOGV) workflows. Profile generation (`colprof`), structural validation (`iccdump`), forward/backward LUT queries (`xicclu`), and round-trip accuracy verification are complete. Average round-trip $\Delta E \le 2.38$ across all channel counts.
## Goal Description
Expand ArgyllCMS v3.5.0 to generate valid ICC output device profiles for 5, 6, and 7 device colorant channels (e.g., CMYK+OG, CMYK+OGV, CMYK+cm). Currently, `colprof` only handles Gray (1ch), CMY/RGB (3ch), and CMYK (4ch). The underlying infrastructure (icclib, rspl forward, xcolorants) already supports multichannel — we need to unblock the four documented bottlenecks.
@@ -464,3 +464,29 @@ bin/xicclu -v -ir test_7clr.icc
- `A2B0`, `B2A0` tags present with correct dimensions
2. Open profile in a third-party ICC viewer (e.g., ICC Profile Inspector) to validate structure
3. Test with 5-channel and 6-channel .ti3 files as well (e.g., `CMYKOG_LAB`, `CMYKcm_LAB`)
---
## Verification Results Summary
### 1. Profile Generation & Model Fit (`colprof -v -qm`)
| Profile | Channel Count | Space Signature | Colorants | Profile Check (RMS / Peak) | Size |
|---|---|---|---|---|---|
| `test_5clr.icc` | 5 Channels | `icSig5colorData` (`5CLR`) | Cyan, Magenta, Yellow, Black, Orange | 0.65 / 1.73 | 121 KB |
| `test_6clr.icc` | 6 Channels | `icSig6colorData` (`6CLR`) | Cyan, Magenta, Yellow, Black, Orange, Green | 0.14 / 1.16 | 215 KB |
| `test_7clr.icc` | 7 Channels | `icSig7colorData` (`7CLR`) | Cyan, Magenta, Yellow, Black, Orange, Green, Violet | 0.48 / 3.91 | 244 KB |
### 2. Round-Trip Accuracy (`verify_roundtrip.py`)
Evaluating Forward Device $\rightarrow$ Forward PCS (Lab) $\rightarrow$ Backward Inversion $\rightarrow$ Round-Trip PCS (Lab) $\rightarrow \Delta E$:
| Metric | 5-Channel (`CMYKO`) | 6-Channel (`CMYKOG`) | 7-Channel (`CMYKOGV`) |
|---|---|---|---|
| **Average $\Delta E$** | **2.38** | **1.90** | **2.15** |
| **Max $\Delta E$** | 6.27 (Magenta 50%) | 5.40 (Magenta 50%) | 5.54 (Violet 50%) |
| White | 0.00 | 0.00 | 0.00 |
| Black 50% | 0.14 | 0.79 | 0.46 |
| Mixed N-channel | 0.32 | 0.25 | 0.53 |
| Mixed CMY | 0.70 | 0.70 | 1.02 |