diff options
author | Marti Maria <info@littlecms.com> | 2011-10-24 15:51:56 +0200 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2011-10-24 15:51:56 +0200 |
commit | 8385449504700f6ffc9f7efd1c132f5ea42cd2fa (patch) | |
tree | cbc29a4fef452f958f1ebd7881fc634827cea37b /src/cmslut.c | |
parent | 8dab27371909497127ce6a783d6ce3a7dbfa6289 (diff) | |
download | lcms2-8385449504700f6ffc9f7efd1c132f5ea42cd2fa.tar.gz |
Version 2.3, rc 1lcms2.3rc1
Diffstat (limited to 'src/cmslut.c')
-rw-r--r-- | src/cmslut.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/cmslut.c b/src/cmslut.c index aaad3b4..52204be 100644 --- a/src/cmslut.c +++ b/src/cmslut.c @@ -1018,6 +1018,70 @@ cmsStage* _cmsStageAllocLabV4ToV2(cmsContext ContextID) } +// To Lab to float. Note that the MPE gives numbers in normal Lab range +// and we need 0..1.0 range for the formatters +// L* : 0...100 => 0...1.0 (L* / 100) +// ab* : -128..+127 to 0..1 ((ab* + 128) / 255) + +cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 1.0/100.0, 0, 0, + 0, 1.0/255.0, 0, + 0, 0, 1.0/255.0 + }; + + static const cmsFloat64Number o1[] = { + 0, + 128.0/255.0, + 128.0/255.0 + }; + + return cmsStageAllocMatrix(ContextID, 3, 3, a1, o1); +} + +cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 1.0/100.0, 0, 0, + 0, 1.0/100.0, 0, + 0, 0, 1.0/100.0 + }; + + + return cmsStageAllocMatrix(ContextID, 3, 3, a1, NULL); +} + +cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 100.0, 0, 0, + 0, 255.0, 0, + 0, 0, 255.0 + }; + + static const cmsFloat64Number o1[] = { + 0, + -128.0, + -128.0 + }; + + return cmsStageAllocMatrix(ContextID, 3, 3, a1, o1); +} + +cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 100.0, 0, 0, + 0, 100.0, 0, + 0, 0, 100.0 + }; + + return cmsStageAllocMatrix(ContextID, 3, 3, a1, NULL); +} + + + // ******************************************************************************** // Type cmsSigXYZ2LabElemType // ******************************************************************************** |