Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
iccApplyProfiles.cpp
Go to the documentation of this file.
1/*
2 File: CmdApplyProfiles.cpp
3
4 Contains: Console app that applies profiles
5
6 Version: V1
7
8 Copyright: (c) see below
9*/
10
11/*
12 * The ICC Software License, Version 0.2
13 *
14 *
15 * Copyright (c) 2003-2016 The International Color Consortium. All rights
16 * reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 *
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 *
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in
27 * the documentation and/or other materials provided with the
28 * distribution.
29 *
30 * 3. In the absence of prior written permission, the names "ICC" and "The
31 * International Color Consortium" must not be used to imply that the
32 * ICC organization endorses or promotes products derived from this
33 * software.
34 *
35 *
36 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 * DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
40 * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This software consists of voluntary contributions made by many
51 * individuals on behalf of the The International Color Consortium.
52 *
53 *
54 * Membership in the ICC is encouraged when this software is used for
55 * commercial purposes.
56 *
57 *
58 * For more information on The International Color Consortium, please
59 * see <http://www.color.org/>.
60 *
61 *
62 */
63
64//////////////////////////////////////////////////////////////////////
65// HISTORY:
66//
67// -Initial implementation by Max Derhak 5-15-2003
68// -Modification to support iccMAX by Max Derhak in 2014
69//
70//////////////////////////////////////////////////////////////////////
71
72
73#include <stdio.h>
74#include "IccCmm.h"
75#include "IccUtil.h"
76#include "IccDefs.h"
77#include "IccApplyBPC.h"
78#include "IccEnvVar.h"
79#include "..\IccCommon\IccCmmConfig.h"
80#include "TiffImg.h"
81#include "IccProfLibVer.h"
82
84{
85 if (v<0.0)
86 return 0.0;
87 if (v>1.0)
88 return 1.0;
89 return v;
90}
91
92
93typedef std::list<CIccProfile*> IccProfilePtrList;
94
95void Usage()
96{
97 printf("iccApplyProfiles built with IccProfLib version " ICCPROFLIBVER "\n\n");
98
99 printf("Usage: iccApplyProfiles src_tiff_file dst_tiff_file dst_sample_encoding dst_compression dst_planar dst_embed_icc interpolation {{-ENV:sig value} profile_file_path rendering_intent {-PCC connection_conditions_path}}\n\n");
100 printf(" For dst_sample_encoding:\n");
101 printf(" 0 - Same as src\n");
102 printf(" 1 - icEncode8Bit\n");
103 printf(" 2 - icEncode16Bit\n");
104 printf(" 4 - icEncodeFloat\n\n");
105
106 printf(" For dst_compression:\n");
107 printf(" 0 - No compression\n");
108 printf(" 1 - LZW compression\n\n");
109
110 printf(" For dst_planar:\n");
111 printf(" 0 - Contig\n");
112 printf(" 1 - Separation\n\n");
113
114 printf(" For dst_embed_icc:\n");
115 printf(" 0 - Do not Embed\n");
116 printf(" 1 - Embed Last ICC\n\n");
117
118 printf(" For interpolation:\n");
119 printf(" 0 - Linear\n");
120 printf(" 1 - Tetrahedral\n\n");
121
122 printf(" For rendering_intent:\n");
123 printf(" 0 - Perceptual\n");
124 printf(" 1 - Relative\n");
125 printf(" 2 - Saturation\n");
126 printf(" 3 - Absolute\n");
127 printf(" 10 - Perceptual without D2Bx/B2Dx\n");
128 printf(" 11 - Relative without D2Bx/B2Dx\n");
129 printf(" 12 - Saturation without D2Bx/B2Dx\n");
130 printf(" 13 - Absolute without D2Bx/B2Dx\n");
131 printf(" 20 - Preview Perceptual\n");
132 printf(" 21 - Preview Relative\n");
133 printf(" 22 - Preview Saturation\n");
134 printf(" 23 - Preview Absolute\n");
135 printf(" 30 - Gamut\n");
136 printf(" 33 - Gamut Absolute\n");
137 printf(" 40 - Perceptual with BPC\n");
138 printf(" 41 - Relative Colorimetric with BPC\n");
139 printf(" 42 - Saturation with BPC\n");
140 printf(" 50 - BDRF Parameters\n");
141 printf(" 60 - BDRF Direct\n");
142 printf(" 70 - BDRF MCS Parameters\n");
143 printf(" 80 - MCS connection\n");
144 printf(" +100 - Use Luminance based PCS adjustment\n");
145 printf(" +1000 - Use V5 sub-profile if present\n");
146}
147
148//===================================================
149
150int main(int argc, const char** argv)
151{
152 int minargs = 2;
153 if (argc < minargs) {
154 Usage();
155 return -1;
156 }
157
158 CIccCfgImageApply cfgApply;
159 CIccCfgProfileSequence cfgProfiles;
160
161 if (argc > 2 && !stricmp(argv[1], "-cfg")) {
162 json cfg;
163 if (!loadJsonFrom(cfg, argv[2]) || !cfg.is_object()) {
164 printf("Unable to read configuration from '%s'\n", argv[2]);
165 return -1;
166 }
167
168 if (cfg.find("imageFiles") == cfg.end() || !cfgApply.fromJson(cfg["imageFiles"])) {
169 printf("Unable to parse imageFiles configuration from '%s'\n", argv[2]);
170 return -1;
171 }
172
173 if (cfg.find("profileSequence") == cfg.end() || !cfgProfiles.fromJson(cfg["profileSequence"])) {
174 printf("Unable to parse profileSequence configuration from '%s'\n", argv[2]);
175 return -1;
176 }
177 }
178 else {
179 argv++;
180 argc--;
181
182 int nArg = cfgApply.fromArgs(&argv[0], argc);
183 if (!nArg) {
184 printf("Unable to parse configuration arguments\n");
185 Usage();
186 return -1;
187 }
188 argv += nArg;
189 argc -= nArg;
190
191 nArg = cfgProfiles.fromArgs(&argv[0], argc);
192 if (!nArg) {
193 printf("Unable to parse profile sequence arguments\n");
194 Usage();
195 return -1;
196 }
197 }
198
199 int i, j, k;
200 unsigned int sn, sphoto, photo, bps, dbps;
201 CTiffImg SrcImg, DstImg;
202 unsigned char *sptr, *dptr;
203 bool bSuccess = true;
204 bool bConvert = false;
205 const char *last_path = NULL;
206
207 //Open source image file and get information from it
208 if (!SrcImg.Open(cfgApply.m_srcImgFile.c_str())) {
209 printf("\nFile [%s] cannot be opened.\n", cfgApply.m_srcImgFile.c_str());
210 return false;
211 }
212 sn = SrcImg.GetSamples();
213 sphoto = SrcImg.GetPhoto();
214 bps = SrcImg.GetBitsPerSample();
215
216 //Setup source encoding based on bits per sample (bps) in source image
217 icFloatColorEncoding srcEncoding, destEncoding;
218 switch(bps) {
219 case 8:
220 srcEncoding = icEncode8Bit;
221 break;
222 case 16:
223 srcEncoding = icEncode16Bit;
224 break;
225 case 32:
226 srcEncoding = icEncodeFloat;
227 break;
228 default:
229 printf("Source bit depth / color data encoding not supported.\n");
230 return false;
231 }
232
233 if (cfgApply.m_dstEncoding == icEncodeUnknown) {
234 destEncoding = srcEncoding;
235 dbps = bps;
236 }
237 else {
238 destEncoding = cfgApply.m_dstEncoding;
239 switch (destEncoding) {
240 case icEncode8Bit:
241 dbps = 8;
242 break;
243 case icEncode16Bit:
244 dbps = 16;
245 break;
246 case icEncodeFloat:
247 dbps = 32;
248 break;
249 default:
250 printf("Source color data encoding not recognized.\n");
251 return false;
252 }
253 }
254 unsigned char* pSrcProfile;
255 unsigned int nSrcProfileLen;
256 bool bHasSrcProfile = SrcImg.GetIccProfile(pSrcProfile, nSrcProfileLen);
257
258 //Retrieve command line arguments
259 bool bCompress = cfgApply.m_dstCompression == icDstBoolFromSrc ? SrcImg.GetCompress() : (cfgApply.m_dstCompression != icDstBoolFalse);
260 bool bSeparation = cfgApply.m_dstPlanar == icDstBoolFromSrc ? SrcImg.GetPlanar() : (cfgApply.m_dstCompression != icDstBoolFalse);
261 bool bEmbed = cfgApply.m_dstEmbedIcc == icDstBoolFromSrc ? bHasSrcProfile : (cfgApply.m_dstEmbedIcc != icDstBoolFalse);
262
263
264 //Allocate a CIccCmm to use to apply profiles.
265 //Let profiles determine starting and ending color spaces.
266 //Third argument indicates that Input transform from first profile should be used.
267 CIccCmm theCmm(icSigUnknownData, icSigUnknownData, true);
268
269 //PCC profiles need to stay around until the CMM has been completely initialized to apply transforms.
270 //TheCmm doesn't own them so keep a list so they can be released when they aren't needed any more.
271 IccProfilePtrList pccList;
272
273 icStatusCMM stat; //status variable for CMM operations
274
275 //Remaining arguments define a sequence of profiles to be applied.
276 //Add them to theCmm one at a time providing CMM environment variables and PCC overrides as provided.
277 bool bFirst = true;
278 for (auto pProfIter = cfgProfiles.m_profiles.begin(); pProfIter != cfgProfiles.m_profiles.end(); bFirst=false, pProfIter++) {
279 CIccCfgProfile* pProfCfg = pProfIter->get();
280
281 if (!pProfCfg) {
282 printf("Invalid Profile configuration!\n");
283 return -1;
284 }
285
286 CIccProfile* pPccProfile = NULL;
287
288 //Adjust type and hint information based on rendering intent
289 CIccCreateXformHintManager Hint;
290 if (pProfCfg->m_useBPC)
291 Hint.AddHint(new CIccApplyBPCHint());
292
293 if (pProfCfg->m_adjustPcsLuminance) {
294 Hint.AddHint(new CIccLuminanceMatchingHint());
295 }
296
297 if (pProfCfg->m_pccFile.size()) {
298 pPccProfile = OpenIccProfile(pProfCfg->m_pccFile.c_str());
299 if (!pPccProfile) {
300 printf("Unable to open Profile Connections Conditions from '%s'\n", pProfCfg->m_pccFile.c_str());
301 return -1;
302 }
303 //Keep track of pPccProfile for until after cmm.Begin is called
304 pccList.push_back(pPccProfile);
305 }
306
307 //CMM Environment variables are passed in as a Hint to the Xform associated with the profile
308 if (pProfCfg->m_iccEnvVars.size() > 0) {
309 Hint.AddHint(new CIccCmmEnvVarHint(pProfCfg->m_iccEnvVars));
310 }
311
312 if (pProfCfg->m_pccEnvVars.size() > 0) {
313 Hint.AddHint(new CIccCmmPccEnvVarHint(pProfCfg->m_pccEnvVars));
314 }
315
316 //Read profile from path and add it to namedCmm
317 if (bFirst && !pProfCfg->m_iccFile.size()) {
318 if (bHasSrcProfile) {
319 if (theCmm.AddXform(pSrcProfile, (icUInt32Number)nSrcProfileLen,
320 pProfCfg->m_intent < 0 ? icUnknownIntent : (icRenderingIntent)pProfCfg->m_intent,
321 pProfCfg->m_interpolation,
322 pPccProfile,
323 pProfCfg->m_transform,
324 pProfCfg->m_useD2BxB2Dx,
325 &Hint,
326 pProfCfg->m_useV5SubProfile)) {
327 printf("Invalid embedded profile in [%s]!\n", cfgApply.m_srcImgFile.c_str());
328 return -1;
329 }
330 }
331 else {
332 printf("Source image doesn't have embedded profile!\n");
333 return -1;
334 }
335
336 }
337 else {
338 last_path = pProfCfg->m_iccFile.c_str();
339 if (theCmm.AddXform(pProfCfg->m_iccFile.c_str(),
340 pProfCfg->m_intent < 0 ? icUnknownIntent : (icRenderingIntent)pProfCfg->m_intent,
341 pProfCfg->m_interpolation,
342 pPccProfile,
343 pProfCfg->m_transform,
344 pProfCfg->m_useD2BxB2Dx,
345 &Hint,
346 pProfCfg->m_useV5SubProfile)) {
347 printf("Invalid Profile: %s\n", pProfCfg->m_iccFile.c_str());
348 return -1;
349 }
350 }
351 }
352
353
354 //All profiles have been added to CMM. Tell CMM that we are ready to begin applying colors/pixels
355 if((stat=theCmm.Begin())) {
356 printf("Error %d - Unable to begin profile application - Possibly invalid or incompatible profiles\n", stat);
357 return -1;
358 }
359
360 //Now we can release the pccProfile nodes.
361 IccProfilePtrList::iterator pcc;
362 for (pcc=pccList.begin(); pcc!=pccList.end(); pcc++) {
363 CIccProfile *pPccProfile = *pcc;
364 delete pPccProfile;
365 }
366 pccList.clear();
367
368 //Get and validate the source color space from the Cmm.
369 icColorSpaceSignature SrcspaceSig = theCmm.GetSourceSpace();
370 int nSrcSamples = icGetSpaceSamples(SrcspaceSig);
371
372 if (nSrcSamples != (int)sn) {
373 printf("Number of samples %d in image[%s] doesn't match device samples %d in first profile\n", sn, cfgApply.m_srcImgFile.c_str(), nSrcSamples);
374 return -1;
375 }
376
377 //Get and validate the destination color space from theCmm.
378 icColorSpaceSignature DestspaceSig = theCmm.GetDestSpace();
379 int nDestSamples = icGetSpaceSamples(DestspaceSig);
380
381 switch (DestspaceSig) {
382 case icSigRgbData:
383 photo = PHOTO_MINISBLACK;
384 break;
385
386 case icSigCmyData:
387 case icSigCmykData:
388 case icSig4colorData:
389 case icSig5colorData:
390 case icSig6colorData:
391 case icSig7colorData:
392 case icSig8colorData:
393 photo = PHOTO_MINISWHITE;
394 break;
395
396 case icSigXYZData:
397 bConvert = true;
398 //Fall through - No break here
399
400 case icSigLabData:
401 photo = PHOTO_CIELAB;
402 break;
403
404 default:
405 photo = PHOTO_MINISBLACK;
406 break;
407 }
408
409 unsigned long sbpp = (nSrcSamples * bps + 7) / 8;
410 unsigned long dbpp = (nDestSamples * dbps + 7)/ 8;
411
412 //Open up output image using information from SrcImg and theCmm
413 if (!DstImg.Create(cfgApply.m_dstImgFile.c_str(), SrcImg.GetWidth(), SrcImg.GetHeight(), dbps, photo, nDestSamples, SrcImg.GetXRes(), SrcImg.GetYRes(), bCompress, bSeparation)) {
414 printf("Unable to create Tiff file - '%s'\n", cfgApply.m_dstImgFile.c_str());
415 return false;
416 }
417
418 //Embed the last profile into output image as needed
419 if (bEmbed && last_path) {
420 unsigned long length = 0;
421 icUInt8Number *pDestProfile = NULL;
422
423 CIccFileIO io;
424 if (io.Open(last_path, "r")) {
425 length = io.GetLength();
426 pDestProfile = (icUInt8Number *)malloc(length);
427 if (pDestProfile) {
428 io.Read8(pDestProfile, length);
429 DstImg.SetIccProfile(pDestProfile, length);
430 free(pDestProfile);
431 }
432 io.Close();
433 }
434 }
435
436 //Allocate buffer for reading source image pixels
437 unsigned char *pSBuf = (unsigned char *)malloc(SrcImg.GetBytesPerLine());
438 if (!pSBuf) {
439 printf("Out of Memory!\n");
440 return false;
441 }
442
443 //Allocate buffer for putting color managed pixels into that will be sent to output tiff image
444 unsigned char *pDBuf = (unsigned char *)malloc(DstImg.GetBytesPerLine());
445 if (!pDBuf) {
446 printf("Out of Memory!\n");
447 free(pSBuf);
448 return false;
449 }
450
451 //Allocate pixel buffers for performing encoding transformations
452 CIccPixelBuf SrcPixel(nSrcSamples+16), DestPixel(nDestSamples+16), Pixel(icIntMax(nSrcSamples, nDestSamples)+16);
453 int lastPer = -1;
454 int curper;
455
456 //Read each line
457 for (i=0; i<(int)SrcImg.GetHeight(); i++) {
458 if (!SrcImg.ReadLine(pSBuf)) {
459 bSuccess = false;
460 break;
461 }
462 for (sptr=pSBuf, dptr=pDBuf, j=0; j<(int)SrcImg.GetWidth(); j++, sptr+=sbpp, dptr+=dbpp) {
463
464 //Special conversions need to be made to convert CIELAB and CIEXYZ to internal PCS encoding
465 switch(bps) {
466 case 8:
467 if (sphoto==PHOTO_CIELAB) {
468 unsigned char *pSPixel = sptr;
469 icFloatNumber *pPixel = SrcPixel;
470 pPixel[0]=(icFloatNumber)pSPixel[0] / 255.0f;
471 pPixel[1]=(icFloatNumber)(pSPixel[1]-128) / 255.0f;
472 pPixel[2]=(icFloatNumber)(pSPixel[2]-128) / 255.0f;
473 }
474 else {
475 unsigned char *pSPixel = sptr;
476 icFloatNumber *pPixel = SrcPixel;
477 for (k=0; k<nSrcSamples; k++) {
478 pPixel[k] = (icFloatNumber)pSPixel[k] / 255.0f;
479 }
480 }
481 break;
482
483 case 16:
484 if (sphoto==PHOTO_CIELAB) {
485 unsigned short *pSPixel = (unsigned short*)sptr;
486 icFloatNumber *pPixel = SrcPixel;
487 pPixel[0]=(icFloatNumber)pSPixel[0] / 65535.0f;
488 pPixel[1]=(icFloatNumber)(pSPixel[1]-0x8000) / 65535.0f;
489 pPixel[2]=(icFloatNumber)(pSPixel[2]-0x8000) / 65535.0f;
490 }
491 else {
492 unsigned short *pSPixel = (unsigned short*)sptr;
493 icFloatNumber *pPixel = SrcPixel;
494 for (k=0; k<nSrcSamples; k++) {
495 pPixel[k] = (icFloatNumber)pSPixel[k] / 65535.0f;
496 }
497 }
498 break;
499
500 case 32:
501 {
502 if (sizeof(icFloatNumber)==sizeof(icFloat32Number)) {
503 memcpy(SrcPixel.get(), sptr, sbpp);
504 }
505 else {
506 icFloat32Number *pSPixel = (icFloat32Number*)sptr;
507 icFloatNumber *pPixel = SrcPixel;
508 for (k=0; k<nSrcSamples; k++) {
509 pPixel[k] = (icFloatNumber)pSPixel[k];
510 }
511 }
512
513 if (sphoto==PHOTO_CIELAB || sphoto==PHOTO_ICCLAB) {
514 icLabToPcs(SrcPixel);
515 }
516 }
517 break;
518
519 default:
520 printf("Invalid source bit depth\n");
521 return -1;
522 }
523 if (sphoto == PHOTO_CIELAB && SrcspaceSig==icSigXYZData) {
524 icLabFromPcs(SrcPixel);
525 icLabtoXYZ(SrcPixel);
526 icXyzToPcs(SrcPixel);
527 }
528
529 //Use CMM to convert SrcPixel to DestPixel
530 theCmm.Apply(DestPixel, SrcPixel);
531
532 //Special conversions need to be made to convert from internal PCS encoding CIELAB
533 if (photo==PHOTO_CIELAB && DestspaceSig==icSigXYZData) {
534 icXyzFromPcs(DestPixel);
535 icXYZtoLab(DestPixel);
536 icLabToPcs(DestPixel);
537 }
538 switch(dbps) {
539 case 8:
540 if (photo==PHOTO_CIELAB) {
541 unsigned char *pDPixel = dptr;
542 icFloatNumber *pPixel = DestPixel;
543 pDPixel[0]=(icUInt8Number)(UnitClip(pPixel[0]) * 255.0f + 0.5f);
544 pDPixel[1]=(icUInt8Number)(UnitClip(pPixel[1]) * 255.0f + 0.5f)+128;
545 pDPixel[2]=(icUInt8Number)(UnitClip(pPixel[2]) * 255.0f + 0.5f)+128;
546 }
547 else {
548 icUInt8Number *pDPixel = dptr;
549 icFloatNumber *pPixel = DestPixel;
550 for (k=0; k<nDestSamples; k++) {
551 pDPixel[k] = (icUInt8Number)(UnitClip(pPixel[k]) * 255.0f + 0.5f);
552 }
553 }
554 break;
555
556 case 16:
557 if (photo==PHOTO_CIELAB) {
558 unsigned short *pDPixel = (unsigned short*)dptr;
559 icFloatNumber *pPixel = DestPixel;
560 pDPixel[0]=(icUInt16Number)(UnitClip(pPixel[0]) * 65535.0f + 0.5f);
561 pDPixel[1]=(icUInt16Number)(UnitClip(pPixel[1]) * 65535.0f + 0.5f)+0x8000;
562 pDPixel[2]=(icUInt16Number)(UnitClip(pPixel[2]) * 65535.0f + 0.5f)+0x8000;
563 }
564 else {
565 icUInt16Number *pDPixel = (icUInt16Number*)dptr;
566 icFloatNumber *pPixel = DestPixel;
567 for (k=0; k<nDestSamples; k++) {
568 pDPixel[k] = (icUInt16Number)(UnitClip(pPixel[k]) * 65535.0f+0.5f);
569 }
570 }
571 break;
572
573 case 32:
574 {
575 if (photo==PHOTO_CIELAB || photo==PHOTO_ICCLAB) {
576 icLabFromPcs(SrcPixel);
577 }
578
579 if (sizeof(icFloatNumber)==sizeof(icFloat32Number)) {
580 memcpy(dptr, DestPixel.get(), dbpp);
581 }
582 else {
583 icFloat32Number *pDPixel = (icFloat32Number*)dptr;
584 icFloatNumber *pPixel = DestPixel;
585 for (k=0; k<nDestSamples; k++) {
586 pDPixel[k] = (icFloat32Number)pPixel[k];
587 }
588 }
589 }
590 break;
591
592 default:
593 printf("Invalid source bit depth\n");
594 return -1;
595 }
596 }
597
598 //Output the converted pixels to the destination image
599 if (!DstImg.WriteLine(pDBuf)) {
600 bSuccess = false;
601 break;
602 }
603
604 //Display status of how much we have accomplished
605 curper = (int)((float)(i+1)*100.0f/(float)SrcImg.GetHeight());
606 if (curper !=lastPer) {
607 printf("\r%d%%", curper);
608 lastPer = curper;
609 }
610 }
611 printf("\n");
612
613 //Clean everything up by closeing files and freeing buffers
614 SrcImg.Close();
615
616 free(pSBuf);
617 free(pDBuf);
618
619 DstImg.Close();
620
621 return 0;
622}
623
File: IccApplyBPC.h.
File: IccCmm.h.
icStatusCMM
CMM return status values.
Definition IccCmm.h:90
@ icDstBoolFalse
@ icDstBoolFromSrc
File: IccDefs.h
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
File: IccEnvVar.h.
bool loadJsonFrom(json &j, const char *szFname)
#define stricmp
#define ICCPROFLIBVER
CIccProfile * OpenIccProfile(const icChar *szFilename, bool bUseSubProfile)
Name: OpenIccProfile.
void icXyzToPcs(icFloatNumber *XYZ)
Definition IccUtil.cpp:941
void icXyzFromPcs(icFloatNumber *XYZ)
Floating point encoding of XYZ in PCS is in range 0.0 to 1.0 (Note: X=1.0 is encoded as about 0....
Definition IccUtil.cpp:934
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
void icLabFromPcs(icFloatNumber *Lab)
Floating point encoding of Lab in PCS is in range 0.0 to 1.0.
Definition IccUtil.cpp:919
void icLabToPcs(icFloatNumber *Lab)
Definition IccUtil.cpp:927
void icLabtoXYZ(icFloatNumber *XYZ, const icFloatNumber *Lab, const icFloatNumber *WhiteXYZ)
Definition IccUtil.cpp:830
icUInt32Number icIntMax(icUInt32Number v1, icUInt32Number v2)
Definition IccUtil.cpp:913
void icXYZtoLab(icFloatNumber *Lab, const icFloatNumber *XYZ, const icFloatNumber *WhiteXYZ)
Definition IccUtil.cpp:846
File: IccUtil.h.
int main()
Core and external libraries necessary for the fuzzer functionality.
unsigned int icUInt32Number
#define PHOTO_CIELAB
Definition TiffImg.h:80
#define PHOTO_MINISBLACK
Definition TiffImg.h:78
#define PHOTO_ICCLAB
Definition TiffImg.h:81
#define PHOTO_MINISWHITE
Definition TiffImg.h:79
Type: Class.
Definition IccApplyBPC.h:89
icFloatColorEncoding m_dstEncoding
int fromArgs(const char **args, int nArg, bool bReset=false)
std::string m_dstImgFile
bool fromJson(json obj, bool bReset=false)
std::string m_srcImgFile
icDstBool m_dstCompression
icDstBool m_dstPlanar
icDstBool m_dstEmbedIcc
icCmmEnvSigMap m_pccEnvVars
icXformInterp m_interpolation
std::string m_iccFile
std::string m_pccFile
icXformLutType m_transform
icCmmEnvSigMap m_iccEnvVars
bool m_adjustPcsLuminance
CIccCfgProfileArray m_profiles
int fromArgs(const char **args, int nArg, bool bReset=false)
bool fromJson(json obj, bool bReset=false)
Type: Class.
Definition IccIO.h:150
virtual void Close()
Definition IccIO.cpp:443
virtual icInt32Number Read8(void *pBuf, icInt32Number nNum=1)
Definition IccIO.cpp:452
virtual icInt32Number GetLength()
Definition IccIO.cpp:470
bool Open(const icChar *szFilename, const icChar *szAttr)
Definition IccIO.cpp:382
float GetYRes()
Definition TiffImg.h:110
bool Open(const char *szFname)
Definition TiffImg.cpp:228
void Close()
Definition TiffImg.cpp:104
unsigned int GetBitsPerSample()
Definition TiffImg.h:103
unsigned int GetWidth()
Definition TiffImg.h:99
unsigned int GetPlanar()
Definition TiffImg.h:108
float GetXRes()
Definition TiffImg.h:109
unsigned int GetPhoto()
Definition TiffImg.cpp:391
bool Create(const char *szFname, unsigned int nWidth, unsigned int nHeight, unsigned int nBPS, unsigned int nPhoto, unsigned int nSamples, float fXRes, float fYRes, bool bCompress=true, bool bSep=false)
Definition TiffImg.cpp:124
unsigned int GetSamples()
Definition TiffImg.h:105
unsigned int GetHeight()
Definition TiffImg.h:100
bool WriteLine(unsigned char *pBuf)
Definition TiffImg.cpp:353
unsigned int GetBytesPerLine()
Definition TiffImg.h:112
bool ReadLine(unsigned char *pBuf)
Definition TiffImg.cpp:302
bool SetIccProfile(unsigned char *pProfile, unsigned int nLen)
Definition TiffImg.cpp:420
bool GetIccProfile(unsigned char *&pProfile, unsigned int &nLen)
Definition TiffImg.cpp:410
unsigned int GetCompress()
Definition TiffImg.h:107
unsigned char icUInt8Number
Number definitions.
float icFloat32Number
#define icUnknownIntent
Convenience Enum Definitions - Not defined in ICC specification.
unsigned short icUInt16Number
icColorSpaceSignature
Color Space Signatures.
@ icSigLabData
@ icSig8colorData
@ icSig7colorData
@ icSigXYZData
@ icSig6colorData
@ icSigCmykData
@ icSigRgbData
@ icSig4colorData
@ icSigCmyData
@ icSig5colorData
#define icSigUnknownData
icRenderingIntent
Rendering Intents, used in the profile header.
std::list< CIccProfile * > IccProfilePtrList
std::list< CIccProfile * > IccProfilePtrList
void Usage()
static icFloatNumber UnitClip(icFloatNumber v)