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:
@@ -1592,7 +1592,8 @@ int icxLuLut_clut_aux_locus(icxLuLut *p, double *locus, double *out, double *in)
|
||||
int nsoln; /* Number of solutions found */
|
||||
int e,f;
|
||||
|
||||
if (p->clutTable->di > p->clutTable->fdi) { /* ie. CMYK->Lab, there will be ambiguity */
|
||||
if (p->clutTable->di > p->clutTable->fdi
|
||||
&& p->clutTable->within_restrictedsize(p->clutTable)) { /* ie. CMYK->Lab, there will be ambiguity */
|
||||
double min[MXDI], max[MXDI]; /* Auxiliary locus range */
|
||||
|
||||
/* Setup for auxiliary locus lookup */
|
||||
@@ -1914,7 +1915,7 @@ int setLminmax /* Figure the L locus for inking rule */
|
||||
if (ink) {
|
||||
p->ink = *ink; /* Copy the structure */
|
||||
} else {
|
||||
p->ink.tlimit = 3.0; /* default ink limit of 300% */
|
||||
p->ink.tlimit = devchan > 4 ? (double)devchan : 3.0; /* default ink limit */
|
||||
p->ink.klimit = -1.0; /* default no black limit */
|
||||
p->ink.KonlyLmin = 0; /* default don't use K only black as Locus Lmin */
|
||||
p->ink.k_rule = icxKluma5; /* default K generation rule */
|
||||
@@ -1935,18 +1936,20 @@ int setLminmax /* Figure the L locus for inking rule */
|
||||
|
||||
/* Set the ink limit information for any reverse interpolation. */
|
||||
/* Calling this will clear the reverse interpolaton cache. */
|
||||
p->clutTable->rev_set_limit(
|
||||
p->clutTable, /* this */
|
||||
p->ink.tlimit >= 0.0 || p->ink.klimit >= 0.0 ? icxLimitD_void : NULL,
|
||||
/* Optional input space limit() function. */
|
||||
/* Function should evaluate in[0..di-1], and return */
|
||||
/* number that is not to exceed 0.0. NULL if not used. */
|
||||
(void *)p, /* Context passed to limit() */
|
||||
0.0 /* Value that limit() is not to exceed */
|
||||
);
|
||||
if (p->clutTable->within_restrictedsize(p->clutTable)) {
|
||||
p->clutTable->rev_set_limit(
|
||||
p->clutTable, /* this */
|
||||
p->ink.tlimit >= 0.0 || p->ink.klimit >= 0.0 ? icxLimitD_void : NULL,
|
||||
/* Optional input space limit() function. */
|
||||
/* Function should evaluate in[0..di-1], and return */
|
||||
/* number that is not to exceed 0.0. NULL if not used. */
|
||||
(void *)p, /* Context passed to limit() */
|
||||
0.0 /* Value that limit() is not to exceed */
|
||||
);
|
||||
}
|
||||
|
||||
/* Duplicate in the CAM clip rspl if it exists */
|
||||
if (p->cclutTable != NULL) {
|
||||
if (p->cclutTable != NULL && p->cclutTable->within_restrictedsize(p->cclutTable)) {
|
||||
p->cclutTable->rev_set_limit(
|
||||
p->cclutTable, /* this */
|
||||
p->ink.tlimit >= 0.0 || p->ink.klimit >= 0.0 ? icxLimitD_void : NULL,
|
||||
@@ -2370,7 +2373,8 @@ fprintf(stderr,"~1 Internal optimised 4D separations not yet implemented!\n");
|
||||
#ifdef USELCHWEIGHT
|
||||
/* If we are not doing camclip, but our output is an Lab like space, */
|
||||
/* then apply lchw weighting anyway. */
|
||||
if (!p->camclip && (p->outs == icSigLabData || p->outs == icxSigJabData)) {
|
||||
if (!p->camclip && (p->outs == icSigLabData || p->outs == icxSigJabData)
|
||||
&& p->clutTable->within_restrictedsize(p->clutTable)) {
|
||||
double lchw[MXRO] = { JCCWEIGHT, CCCWEIGHT, HCCWEIGHT };
|
||||
|
||||
/* Set the Nearest Neighbor clipping Weighting */
|
||||
@@ -2463,7 +2467,8 @@ icxLuLut *p) {
|
||||
|
||||
#ifdef USELCHWEIGHT
|
||||
/* Set the Nearest Neighbor clipping Weighting */
|
||||
p->cclutTable->rev_set_lchw(p->cclutTable, lchw);
|
||||
if (p->cclutTable->within_restrictedsize(p->cclutTable))
|
||||
p->cclutTable->rev_set_lchw(p->cclutTable, lchw);
|
||||
#endif /* USELCHWEIGHT */
|
||||
|
||||
if (p->plu->max_clut_res(p->plu, gres) == 0) { /* Hmm. */
|
||||
@@ -2484,15 +2489,17 @@ icxLuLut *p) {
|
||||
p->ninmin, p->ninmax, gres, cmin, cmax);
|
||||
|
||||
/* Duplicate the ink limit information for any reverse interpolation. */
|
||||
p->cclutTable->rev_set_limit(
|
||||
p->cclutTable, /* this */
|
||||
p->ink.tlimit >= 0.0 || p->ink.klimit >= 0.0 ? icxLimitD_void : NULL,
|
||||
/* Optional input space limit() function. */
|
||||
/* Function should evaluate in[0..di-1], and return */
|
||||
/* number that is not to exceed 0.0. NULL if not used. */
|
||||
(void *)p, /* Context passed to limit() */
|
||||
0.0 /* Value that limit() is not to exceed */
|
||||
);
|
||||
if (p->cclutTable->within_restrictedsize(p->cclutTable)) {
|
||||
p->cclutTable->rev_set_limit(
|
||||
p->cclutTable, /* this */
|
||||
p->ink.tlimit >= 0.0 || p->ink.klimit >= 0.0 ? icxLimitD_void : NULL,
|
||||
/* Optional input space limit() function. */
|
||||
/* Function should evaluate in[0..di-1], and return */
|
||||
/* number that is not to exceed 0.0. NULL if not used. */
|
||||
(void *)p, /* Context passed to limit() */
|
||||
0.0 /* Value that limit() is not to exceed */
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3094,6 +3101,13 @@ int ores /* Num of out-table entries */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (inputChan >= 5) {
|
||||
for (e = 0; e < inputChan; e++) {
|
||||
dwhite[e] = 0.0;
|
||||
dblack[e] = 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return icm_err(icco,ICX_ERR_BAD_DEV,
|
||||
"set_icxLuLut: can't handle color space %s",
|
||||
icm2str(icmColorSpaceSig, h->colorSpace));
|
||||
@@ -3278,6 +3292,24 @@ int ores /* Num of out-table entries */
|
||||
}
|
||||
|
||||
default:
|
||||
if (inputChan >= 5) {
|
||||
for (i = 0; i < nodpbw; i++) {
|
||||
int all_zero = 1;
|
||||
for (e = 0; e < inputChan; e++) {
|
||||
if (ipoints[i].p[e] >= 0.001) {
|
||||
all_zero = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_zero) {
|
||||
wp[0] += ipoints[i].v[0];
|
||||
wp[1] += ipoints[i].v[1];
|
||||
wp[2] += ipoints[i].v[2];
|
||||
nw++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return icm_err(icco,ICX_ERR_BAD_DEV,
|
||||
"set_icxLuLut: can't handle color space %s",
|
||||
icm2str(icmColorSpaceSig, h->colorSpace));
|
||||
|
||||
Reference in New Issue
Block a user