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

@@ -3943,6 +3943,8 @@ double *nin /* Normalised center relative point */
) {
gtri *rv;
//if (trace) printf("~1 rad_pnt_tri: BSP 0x%x tag = %d, point %f %f %f\n", np,np->tag,nin[0],nin[1],nin[2]);
if (np == NULL)
return NULL;
if (np->tag == 1) { /* It's a BSP node */
gbspn *n = (gbspn *)np;
double ds;
@@ -3964,41 +3966,38 @@ double *nin /* Normalised center relative point */
}
return NULL; /* Hmm */
} else { /* It's a triangle or list of triangles */
int nt; /* Number of triangles in list */
gtri **tpp; /* Pointer to list of triangles */
} else if (np->tag == 2) { /* It's a single triangle */
gtri *t = (gtri *)np;
int j;
for (j = 0; j < 3; j++) {
double ds = t->ee[j][0] * nin[0]
+ t->ee[j][1] * nin[1]
+ t->ee[j][2] * nin[2]
+ t->ee[j][3];
if (ds > 1e-10)
break;
}
if (j >= 3)
return t;
} else if (np->tag == 3) { /* It's a triangle list */
gbspl *n = (gbspl *)np;
int i, j;
if (np->tag == 2) { /* It's a triangle */
tpp = (gtri **)&np;
nt = 1;
} else if (np->tag == 3) { /* It's a triangle list */
gbspl *n = (gbspl *)np;
tpp = n->t;
nt = n->nt;
}
/* Go through the list and stop at the first triangle */
/* that the node lies in. */
for (i = 0; i < nt; i++, tpp++) {
gtri *t = *tpp;
/* Check if the point is within this triangle */
for (i = 0; i < n->nt; i++) {
gtri *t = n->t[i];
if (t == NULL)
continue;
for (j = 0; j < 3; j++) {
double ds;
ds = t->ee[j][0] * nin[0]
+ t->ee[j][1] * nin[1]
+ t->ee[j][2] * nin[2]
+ t->ee[j][3];
double ds = t->ee[j][0] * nin[0]
+ t->ee[j][1] * nin[1]
+ t->ee[j][2] * nin[2]
+ t->ee[j][3];
if (ds > 1e-10)
break; /* Not within triangle */
break;
}
if (j >= 3) {
//if (trace) printf("~1 located triangle from list that we're in %d\n",n->t[i]->n);
if (j >= 3)
return t;
}
}
/* Hmm. */
}
//if (trace) printf("~1 failed to find a triangle\n");