summaryrefslogtreecommitdiff
path: root/src/cmsio1.c
diff options
context:
space:
mode:
authorMarti Maria <info@littlecms.com>2010-05-20 18:59:13 +0200
committerMarti Maria <info@littlecms.com>2010-05-20 18:59:13 +0200
commit96c149005d21a79dcb2ed7b2106827ebe918d663 (patch)
tree2093496a5d8d44f37a871430ba5793c0b3405919 /src/cmsio1.c
parent0cc1927ed1d7777310f6f1f7ae48429484090df0 (diff)
downloadlcms2-96c149005d21a79dcb2ed7b2106827ebe918d663.tar.gz
Trilinear interpolation (II)
Diffstat (limited to 'src/cmsio1.c')
-rw-r--r--src/cmsio1.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cmsio1.c b/src/cmsio1.c
index 91cf06d..c367627 100644
--- a/src/cmsio1.c
+++ b/src/cmsio1.c
@@ -386,6 +386,27 @@ cmsPipeline* BuildRGBOutputMatrixShaper(cmsHPROFILE hProfile)
return Lut;
}
+
+// Change CLUT interpolation to trilinear
+static
+void ChangeInterpolationToTrilinear(cmsPipeline* Lut)
+{
+ cmsStage* Stage;
+
+ for (Stage = cmsPipelineGetPtrToFirstStage(Lut);
+ Stage != NULL;
+ Stage = cmsStageNext(Stage)) {
+
+ if (cmsStageType(Stage) == cmsSigCLutElemType) {
+
+ _cmsStageCLutData* CLUT = (_cmsStageCLutData*) Stage ->Data;
+
+ CLUT ->Params->dwFlags |= CMS_LERP_FLAGS_TRILINEAR;
+ _cmsSetInterpolationRoutine(CLUT ->Params);
+ }
+ }
+}
+
// Create an output MPE LUT from agiven profile. Version mismatches are handled here
cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent)
{
@@ -419,6 +440,12 @@ cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent)
// The profile owns the Lut, so we need to copy it
Lut = cmsPipelineDup(Lut);
+ // Now it is time for a controversial stuff. I found that for 3D LUTS using
+ // Lab used as indexer space, trilinear interpolation should be used
+
+ if (cmsGetPCS(hProfile) == cmsSigLabData)
+ ChangeInterpolationToTrilinear(Lut);
+
// We need to adjust data only for Lab and Lut16 type
if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
return Lut;