summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarti Maria <info@littlecms.com>2015-02-20 10:13:45 +0100
committerMarti Maria <info@littlecms.com>2015-02-20 10:13:45 +0100
commit4dbf06340d68301d541496fbabc299e1afb8dc54 (patch)
tree4520bfd1c0813ebaabc454c6270be1cc09610ab7
parent926963a73a4bcf653dc643be9b704de45c427186 (diff)
downloadlcms2-4dbf06340d68301d541496fbabc299e1afb8dc54.tar.gz
Added bounded mode on transicclcms2.7rc2
New bounded mode for transicc
-rw-r--r--ChangeLog1
-rw-r--r--utils/transicc/transicc.13
-rw-r--r--utils/transicc/transicc.c26
3 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d649d2f..b36e5ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -158,6 +158,7 @@ New project for mac
Added license for iccjpeg.c
Added a project for VS2013
Fixed wrong handling of extra channels in some formatters.
+Added an option in transicc for working in bounded mode
-----------------------
2.7 Maintenance release
diff --git a/utils/transicc/transicc.1 b/utils/transicc/transicc.1
index 4a34c79..0c50a90 100644
--- a/utils/transicc/transicc.1
+++ b/utils/transicc/transicc.1
@@ -47,6 +47,9 @@ Output profile (defaults to sRGB).
.B \-q
Quantize CGATS to 8 bits.
.TP
+.BI \-s
+Bounded mode.
+.TP
.BI \-t\ NUM
Rendering intent
.nf
diff --git a/utils/transicc/transicc.c b/utils/transicc/transicc.c
index 332696a..7a36296 100644
--- a/utils/transicc/transicc.c
+++ b/utils/transicc/transicc.c
@@ -44,6 +44,7 @@ static cmsBool Width16 = FALSE;
static cmsBool BlackPointCompensation = FALSE;
static cmsBool lIsDeviceLink = FALSE;
static cmsBool lQuantize = FALSE;
+static cmsBool lUnbounded = TRUE;
static cmsBool lIsFloat = TRUE;
static cmsUInt32Number Intent = INTENT_PERCEPTUAL;
@@ -99,9 +100,10 @@ void Help(void)
fprintf(stderr, "%ce[op] - Encoded representation of numbers\n", SW);
fprintf(stderr, "\t%cw - use 16 bits\n", SW);
- fprintf(stderr, "\t%cx - Hexadecimal\n", SW);
- fprintf(stderr, "%cq - Quantize CGATS to 8 bits\n\n", SW);
+ fprintf(stderr, "\t%cx - Hexadecimal\n\n", SW);
+ fprintf(stderr, "%cs - bounded mode (clip negatives and highliths)\n", SW);
+ fprintf(stderr, "%cq - Quantize (round decimals)\n\n", SW);
fprintf(stderr, "%ci<profile> - Input profile (defaults to sRGB)\n", SW);
fprintf(stderr, "%co<profile> - Output profile (defaults to sRGB)\n", SW);
@@ -143,7 +145,7 @@ void HandleSwitches(int argc, char *argv[])
int s;
while ((s = xgetopt(argc, argv,
- "bBC:c:d:D:eEgGI:i:L:l:m:M:nNO:o:p:P:QqT:t:V:v:WwxX!:")) != EOF) {
+ "bBC:c:d:D:eEgGI:i:L:l:m:M:nNO:o:p:P:QqSsT:t:V:v:WwxX!:")) != EOF) {
switch (s){
@@ -226,12 +228,18 @@ void HandleSwitches(int argc, char *argv[])
cProofing = xoptarg;
break;
- // Quantize to 16 bits
+ // Quantize (get rid of decimals)
case 'q':
case 'Q':
lQuantize = TRUE;
break;
+ // Inhibit unbounded mode
+ case 's':
+ case 'S':
+ lUnbounded = FALSE;
+ break;
+
// The intent
case 't':
case 'T':
@@ -661,6 +669,14 @@ void PrintFloatResults(cmsFloat64Number Value[])
if (lQuantize)
v = floor(v + 0.5);
+ if (!lUnbounded) {
+
+ if (v < 0)
+ v = 0;
+ if (v > OutputRange)
+ v = OutputRange;
+ }
+
if (Verbose <= 0)
printf("%.4f ", v);
else
@@ -1224,7 +1240,7 @@ int main(int argc, char *argv[])
int nPatch = 0;
- fprintf(stderr, "LittleCMS ColorSpace conversion calculator - 4.2 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0);
+ fprintf(stderr, "LittleCMS ColorSpace conversion calculator - 4.3 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0);
InitUtils("transicc");