diff options
author | Marti Maria <marti.maria@littlecms.com> | 2022-07-24 11:42:59 +0300 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2022-07-24 11:42:59 +0300 |
commit | 89c9d176b4349367ecd45f85b94aea3bf6f372c9 (patch) | |
tree | ac6ec6a28b7d6585db310d5d2cb0c8595e8832b5 | |
parent | 6849af422fd296cb8ce160d376978ef5d79f9417 (diff) |
Fix CMYK range on fast float plugin
Range should be in %
-rw-r--r-- | plugins/fast_float/src/fast_float_tethra.c | 20 | ||||
-rw-r--r-- | src/cmsio0.c | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/plugins/fast_float/src/fast_float_tethra.c b/plugins/fast_float/src/fast_float_tethra.c index 72c872b..ef4fccf 100644 --- a/plugins/fast_float/src/fast_float_tethra.c +++ b/plugins/fast_float/src/fast_float_tethra.c @@ -273,9 +273,29 @@ cmsBool OptimizeCLUTRGBTransform(_cmsTransform2Fn* TransformFn, // Add the CLUT to the destination LUT cmsPipelineInsertStage(OptimizedLUT, cmsAT_BEGIN, OptimizedCLUTmpe); + // If output is CMYK, add a conversion stage to get % + if (T_COLORSPACE(*OutputFormat) == PT_CMYK) { + + static const cmsFloat64Number mat[] = { 100.0, 0, 0, 0, + 0, 100.0, 0, 0, + 0, 0, 100.0, 0, + 0, 0, 0, 100.0 }; + + cmsStage* percent = cmsStageAllocMatrix(ContextID, 4, 4, mat, NULL); + if (percent == NULL) goto Error; + + cmsPipelineInsertStage(OriginalLut, cmsAT_END, percent); + } + // Resample the LUT if (!cmsStageSampleCLutFloat(OptimizedCLUTmpe, XFormSampler, (void*)OriginalLut, 0)) goto Error; + + if (T_COLORSPACE(*OutputFormat) == PT_CMYK) { + + cmsPipelineUnlinkStage(OriginalLut, cmsAT_END, NULL); + } + // Set the evaluator, copy parameters data = (_cmsStageCLutData*) cmsStageData(OptimizedCLUTmpe); diff --git a/src/cmsio0.c b/src/cmsio0.c index 205f829..545dfff 100644 --- a/src/cmsio0.c +++ b/src/cmsio0.c @@ -804,9 +804,9 @@ cmsBool _cmsReadHeader(_cmsICCPROFILE* Icc) } Icc ->TagCount++; - } + } - return TRUE; + return TRUE; } // Saves profile header |