feat: implement multichannel (5-7 color) ICC profiling support

- Phase 1 (profout.c, colprof.c):
  * Extend COLOR_REP parsing for named (e.g. CMYKOGV_LAB) and generic (NcCLR) spaces (5-15ch)
  * Set adaptive AtoB and BtoA grid resolutions for 5-6ch and 7+ch to avoid memory explosions
  * Automatically enable ICC v2/v4 Colorant Table tag for devchan >= 5
  * Generalize verification print loops to support N channels
  * Support dynamic TAC limits up to N*100% in colprof.c

- Phase 2 & 3 (xicc/):
  * Add mchan_inv.h and mchan_inv.c implementing constrained Powell optimization for BtoA inversion
  * Dispatch devchan > 4 in xlut.c (icxLuLut_inv_clut_aux) to bypass rspl rev.c MXRI=4 dimension limit
  * Register mchan_inv.c in xicc/Jamfile and include header in xicc.c
This commit is contained in:
2026-11-11 21:46:26 +03:30
parent 8950ed596b
commit 51d0d04821
7 changed files with 401 additions and 26 deletions

View File

@@ -122,7 +122,7 @@ void usage(char *diag, ...) {
fprintf(stderr," enle: K level at Black 0.0 - 1.0\n");
fprintf(stderr," shape: 1.0 = straight, 0.0-1.0 concave, 1.0-2.0 convex\n");
fprintf(stderr," -K parameters Same as -k, but target is K locus rather than K value itself\n");
fprintf(stderr," -l tlimit override total ink limit, 0 - 400%% (default from .ti3)\n");
fprintf(stderr," -l tlimit override total ink limit, 0 - N*100%% (default from .ti3)\n");
fprintf(stderr," -L klimit override black ink limit, 0 - 100%% (default from .ti3)\n");
fprintf(stderr," -a lxXYgsmGS Algorithm type override\n");
fprintf(stderr," l = Lab cLUT (def.), x = XYZ cLUT,\n");
@@ -1117,6 +1117,7 @@ int main(int argc, char *argv[]) {
int hascal = 0; /* nz if there is a .cal in the .ti3 */
double filimit = - 1.0; /* file ink limit */
icxInk ink; /* Ink parameters */
double max_tac = 400.0; /* Max total ink limit based on channels */
/* Check if there is a .cal in the .ti3 or one provided in command line */
{
@@ -1143,9 +1144,27 @@ int main(int argc, char *argv[]) {
filimit = atoi(icg->t[0].kdata[ti]);
}
/* Determine max possible TAC based on device channels */
{
int ti2;
if ((ti2 = icg->find_kword(icg, 0, "COLOR_REP")) >= 0) {
char devpart[64];
if (sscanf(icg->t[0].kdata[ti2], "%63[^_]_", devpart) == 1) {
inkmask tmask = icx_char2inkmask(devpart);
if (tmask != 0) {
max_tac = icx_noofinks(tmask) * 100.0;
} else {
int nclr = 0;
if (sscanf(devpart, "%dCLR", &nclr) == 1 && nclr >= 1)
max_tac = nclr * 100.0;
}
}
}
}
/* Check against user set limit */
if (filimit > 0.0 && filimit <= 400.0) { /* File has limit */
if (tlimit > 0.0 && tlimit <= 400.0) { /* User has specified limit as option */
if (filimit > 0.0 && filimit <= max_tac) { /* File has limit */
if (tlimit > 0.0 && tlimit <= max_tac) { /* User has specified limit as option */
if (filimit < tlimit) {
warning("Ink limit is greater than original chart! (%.0f%% > %.0f%%)",tlimit,filimit);
}
@@ -1173,7 +1192,7 @@ int main(int argc, char *argv[]) {
}
}
if (tlimit >= 0 && tlimit < 400.0) {
if (tlimit >= 0 && tlimit < max_tac) {
if (verb) {
if (hascal)
printf("Final total ink limit being used is %.0f%%\n",tlimit);