87{
88 if (argc <= 3) {
89 printf("Usage: iccV5DspObsToV4Dsp v5DspIccPath v5ObsPcc v4DspIccPath\n");
91
92 return -1;
93 }
94
96
97 if (!dspIcc) {
98 printf("Unable to parse '%s'\n", argv[1]);
99 return -2;
100 }
101
104 printf("%s is not a V5 display profile\n", argv[1]);
105 return -2;
106 }
107
109
110 if (!pTagIn) {
111 printf("%s doesn't have an AToB1Tag of type mulitProcessElementType\n", argv[1]);
112 return -2;
113 }
114
116
120 ((curveMpe = pTagIn->
GetElement(0))==
nullptr) ||
122 ((matrixMpe = pTagIn->
GetElement(1))==
nullptr) ||
124 printf("%s doesn't have a spectral emission AToB1Tag\n", argv[1]);
125 return -2;
126 }
127
129
130 if (!pccIcc) {
131 printf("Unable to parse '%s'\n", argv[2]);
132 return -2;
133 }
134
136 printf("%s is not a V5 profile\n", argv[1]);
137 return -2;
138 }
139
142
143 if (!pTagSvcn ||
144 !pTagC2S ||
147 printf("%s doesn't have Profile Connection Conditions\n", argv[2]);
148 return -2;
149 }
150
152
153 std::shared_ptr<CIccApplyTagMpe> pApplyMpe = std::shared_ptr<CIccApplyTagMpe>(pTagIn->
GetNewApply());
154
155 auto applyList = pApplyMpe->GetList();
156 auto applyIter = applyList->begin();
157 auto curveApply = applyIter->ptr;
158 applyIter++;
159 auto mtxApply = applyIter->ptr;
160
162
163 std::shared_ptr<CIccApplyTagMpe> pAppyC2S = std::shared_ptr<CIccApplyTagMpe>(pTagC2S->
GetNewApply());
164
165
166 CIccProfilePtr pIcc = CIccProfilePtr(new CIccProfile());
167
168 pIcc->InitHeader();
171
173
175 std::string text;
177 text = std::string("Display profile from '") + argv[1] + "' and PCC '" + argv[2] + "'";
178 pDspText->
SetText(text.c_str());
179
181
183 pDspText->
SetText(
"Copyright (C) 2023 International Color Consortium");
184
186
190
194 curveMpe->
Apply(curveApply, out, in);
195 (*pTrcR)[i] = out[0];
196 (*pTrcG)[i] = out[1];
197 (*pTrcB)[i] = out[2];
198 }
199
203
205
206 matrixMpe->
Apply(mtxApply, in, rRGB);
207 pTagC2S->
Apply(pAppyC2S.get(), out, in);
208
210 (*primaryXYZ)[0] =
icDtoF(out[0]); (*primaryXYZ)[1] =
icDtoF(out[1]); (*primaryXYZ)[2] =
icDtoF(out[2]);
212
213 matrixMpe->
Apply(mtxApply, in, gRGB);
214 pTagC2S->
Apply(pAppyC2S.get(), out, in);
215
217 (*primaryXYZ)[0] =
icDtoF(out[0]); (*primaryXYZ)[1] =
icDtoF(out[1]); (*primaryXYZ)[2] =
icDtoF(out[2]);
219
220 matrixMpe->
Apply(mtxApply, in, bRGB);
221 pTagC2S->
Apply(pAppyC2S.get(), out, in);
222
224 (*primaryXYZ)[0] =
icDtoF(out[0]); (*primaryXYZ)[1] =
icDtoF(out[1]); (*primaryXYZ)[2] =
icDtoF(out[2]);
226
228 printf("%s successfully created\n", argv[3]);
229
230 return 0;
231 }
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
bool SaveIccProfile(const icChar *szFilename, CIccProfile *pIcc, icProfileIDSaveMethod nWriteId)
Name: SaveIccProfile.
CIccProfile * ReadIccProfile(const icChar *szFilename, bool bUseSubProfile)
Name: ReadIccProfile.
bool icGetTagText(const CIccTag *pTag, std::string &text)
CIccTagFixedNum< icS15Fixed16Number, icSigS15Fixed16ArrayType > CIccTagS15Fixed16
Class: CIccTagS15Fixed16.
icS15Fixed16Number icDtoF(icFloatNumber num)
std::shared_ptr< CIccProfile > CIccProfileSharedPtr
Class: CIccMultiProcessElement.
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const =0
virtual icElemTypeSignature GetType() const =0
Class: CIccTagMultiLocalizedUnicode.
void SetText(const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
Class: CIccTagMultiProcessElement.
icUInt16Number NumInputChannels() const
virtual bool Begin(icElemInterp nInterp=icElemInterpLinear, IIccProfileConnectionConditions *pProfilePCC=NULL, IIccProfileConnectionConditions *pAppliedPCC=NULL, IIccCmmEnvVarLookup *pCmmEnvVarLookup=NULL)
Name: CIccTagMultiProcessElement::Begin.
icUInt16Number NumOutputChannels() const
virtual CIccApplyTagMpe * GetNewApply()
Name: CIccTagMultiProcessElement::GetNewApply.
virtual void Apply(CIccApplyTagMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const
Name: CIccTagMultiProcessElement::Apply.
icUInt32Number NumElements() const
CIccMultiProcessElement * GetElement(int nIndex)
Name: CIccTagMultiProcessElement::GetElement.
Class: CIccTagSpectralViewingConditions.