|
|
@ -14,20 +14,27 @@ |
|
|
|
|
|
|
|
/** corrects a ICC profile, fixes CMM type and/or fixes profile version */ |
|
|
|
char * correct_iccprofile(unsigned long iccsize, char * iccdata) { |
|
|
|
int major=iccdata[8]; |
|
|
|
int minor=(iccdata[9]>>4) & 0x000f; |
|
|
|
int bugfix= iccdata[9] & 0x000f; |
|
|
|
|
|
|
|
if (FLAGGED == flag_be_verbose) printf("ICC profile: major=%i minor=%i bugfix=%i (iccdata [8]=%i [9]=%i [10]=%i [11]=%i)\n", major, minor, bugfix, iccdata[8], iccdata[9], iccdata[10], iccdata[11]); |
|
|
|
if (/* fixes outdated ICC 2.xx profile versions */ |
|
|
|
(iccdata[8] == 2) && /* major version */ |
|
|
|
(iccdata[9] < 4) ) { |
|
|
|
(major == 2) && /* major version */ |
|
|
|
(minor < 4) ) { |
|
|
|
/* found 2.1/2.2/2.3 */ |
|
|
|
iccdata[9] = 4; |
|
|
|
iccdata[9] = 4 << 4; |
|
|
|
iccdata[10] = 0; |
|
|
|
iccdata[11] = 0; |
|
|
|
printf("Found outdated 2.xx profile version, try to correct it\n"); |
|
|
|
} else if ( /* fixes outdated ICC 4.xx profile versions */ |
|
|
|
(iccdata[8] == 4) && /* major version */ |
|
|
|
(iccdata[9] < 3) ) { |
|
|
|
(major == 4) && /* major version */ |
|
|
|
(minor < 3) ) { |
|
|
|
/* found 4.0/4.1/4.2 */ |
|
|
|
iccdata[9] = 3; |
|
|
|
iccdata[9] = 3 << 4; |
|
|
|
iccdata[10] = 0; |
|
|
|
iccdata[11] = 0; |
|
|
|
printf("Found outdated 4.xx profile version, try to correct it\n"); |
|
|
|
} |
|
|
|
/* fixes only wrong 'APPL ' -> 'appl ' in preferredcmmtype */ |
|
|
|
char preferredcmmtype[5]=" "; memcpy(preferredcmmtype, &iccdata[4],4); |
|
|
|