cmsHANDLE CMSEXPORT cmsCIECAM02Init(cmsContext ContextID, const cmsViewingConditions* pVC) { cmsCIECAM02* lpMod; _cmsAssert(pVC != NULL); if((lpMod = (cmsCIECAM02*) _cmsMallocZero(ContextID, sizeof(cmsCIECAM02))) == NULL) { return NULL; } lpMod ->ContextID = ContextID; lpMod ->adoptedWhite.XYZ[0] = pVC ->whitePoint.X; lpMod ->adoptedWhite.XYZ[1] = pVC ->whitePoint.Y; lpMod ->adoptedWhite.XYZ[2] = pVC ->whitePoint.Z; lpMod -> LA = pVC ->La; lpMod -> Yb = pVC ->Yb; lpMod -> D = pVC ->D_value; lpMod -> surround = pVC ->surround; switch (lpMod -> surround) { case CUTSHEET_SURROUND: lpMod->F = 0.8; lpMod->c = 0.41; lpMod->Nc = 0.8; break; case DARK_SURROUND: lpMod -> F = 0.8; lpMod -> c = 0.525; lpMod -> Nc = 0.8; break; case DIM_SURROUND: lpMod -> F = 0.9; lpMod -> c = 0.59; lpMod -> Nc = 0.95; break; default: // Average surround lpMod -> F = 1.0; lpMod -> c = 0.69; lpMod -> Nc = 1.0; } lpMod -> n = compute_n(lpMod); lpMod -> z = compute_z(lpMod); lpMod -> Nbb = computeNbb(lpMod); lpMod -> FL = computeFL(lpMod); if (lpMod -> D == D_CALCULATE) { lpMod -> D = computeD(lpMod); } lpMod -> Ncb = lpMod -> Nbb; lpMod -> adoptedWhite = XYZtoCAT02(lpMod -> adoptedWhite); lpMod -> adoptedWhite = ChromaticAdaptation(lpMod -> adoptedWhite, lpMod); lpMod -> adoptedWhite = CAT02toHPE(lpMod -> adoptedWhite); lpMod -> adoptedWhite = NonlinearCompression(lpMod -> adoptedWhite, lpMod); return (cmsHANDLE) lpMod; }
LCMSHANDLE LCMSEXPORT cmsCIECAM02Init(LPcmsViewingConditions pVC) { LPcmsCIECAM02 lpMod; if((lpMod = (LPcmsCIECAM02) malloc(sizeof(cmsCIECAM02))) == NULL) { return (LCMSHANDLE) NULL; } ZeroMemory(lpMod, sizeof(cmsCIECAM02)); lpMod ->adoptedWhite.XYZ[0] = pVC ->whitePoint.X; lpMod ->adoptedWhite.XYZ[1] = pVC ->whitePoint.Y; lpMod ->adoptedWhite.XYZ[2] = pVC ->whitePoint.Z; lpMod -> LA = pVC ->La; lpMod -> Yb = pVC ->Yb; lpMod -> D = pVC ->D_value; lpMod -> surround = pVC ->surround; switch (lpMod -> surround) { case AVG_SURROUND_4: lpMod->F = 1.0; // Not included in CAM02 lpMod->c = 0.69; lpMod->Nc = 1.0; break; case CUTSHEET_SURROUND: lpMod->F = 0.8; lpMod->c = 0.41; lpMod->Nc = 0.8; break; case DARK_SURROUND: lpMod -> F = 0.8; lpMod -> c = 0.525; lpMod -> Nc = 0.8; break; case DIM_SURROUND: lpMod -> F = 0.9; lpMod -> c = 0.59; lpMod -> Nc = 0.95; break; default: // Average surround lpMod -> F = 1.0; lpMod -> c = 0.69; lpMod -> Nc = 1.0; } lpMod -> n = compute_n(lpMod); lpMod -> z = compute_z(lpMod); lpMod -> Nbb = computeNbb(lpMod); lpMod -> FL = computeFL(lpMod); lpMod -> D = computeD(lpMod); lpMod -> Ncb = lpMod -> Nbb; lpMod -> adoptedWhite = XYZtoCAT02(lpMod -> adoptedWhite); lpMod -> adoptedWhite = ChromaticAdaptation(lpMod -> adoptedWhite, lpMod); lpMod -> adoptedWhite = CAT02toHPE(lpMod -> adoptedWhite); lpMod -> adoptedWhite = NonlinearCompression(lpMod -> adoptedWhite, lpMod); lpMod -> adoptedWhite = ComputeCorrelates(lpMod -> adoptedWhite, lpMod); return (LCMSHANDLE) lpMod; }