108 bool bAddBlankLine =
false;
110 long pos = ftell(
m_f);
113 if (line[0] ==
'-' || line[0] ==
'.' || (line[0] >=
'0' && line[0] <=
'9')) {
115 fseek(
m_f, pos, SEEK_SET);
121 bAddBlankLine =
true;
124 else if (line.substr(0, 6) ==
"TITLE ") {
130 else if (line[0] ==
'#') {
140 bAddBlankLine =
false;
142 else if (line.substr(0, 12) ==
"LUT_1D_SiZE ") {
143 printf(
"1DLUTs are not supported\n");
146 else if (line.substr(0, 12) ==
"LUT_3D_SIZE ") {
149 else if (line.substr(0, 19) ==
"LUT_3D_INPUT_RANGE ") {
151 const char* next =
getNext(line.c_str() + 19);
156 else if (line.substr(0, 11) ==
"DOMAIN_MIN ") {
158 const char* next =
getNext(line.c_str());
172 else if (line.substr(0, 11) ==
"DOMAIN_MAX ") {
174 const char* next =
getNext(line.c_str());
188 else if (line.substr(0, 18) ==
"LUT_IN_VIDEO_RANGE")
190 else if (line.substr(0, 19) ==
"LUT_OUT_VIDEO_RANGE")
193 printf(
"Unknown keyword '%s'\n", line.c_str());
225 for (
auto n = 0u; n < num && !
isEOF();) {
229 if (line[0] ==
'#' || line.size() == 0)
234 printf(
"Invalid 3DLUT entry\n");
240 printf(
"Invalid 3DLUT entry\n");
259 fseek(
m_f, 0, SEEK_SET);
261 return m_f !=
nullptr;
267 bool bNeedQuote =
false;
272 while (*str && (!bNeedQuote || *str !=
'\"')) {
281 while (*str && *str ==
' ') str++;
282 while (*str && *str !=
' ') str++;
283 while (*str && *str ==
' ') str++;
291 while (*str && *str !=
'\"') {
300#define MAX_LINE_LEN 255
308 if ((c < 0 && feof(
m_f)) || c ==
'\n')
314 rv += (
unsigned char)c;
333int main(
int argc,
char* argv[])
336 long int verbosity = 100;
339 printf(
"Usage: iccFromCube cube_file output_icc_file\n");
348 printf(
"Unable to parse '%s'\n", argv[1]);
353 printf(
"3DLUT not found in '%s'\n", argv[1]);
360 profile.InitHeader();
381 if (minVal[1] != minVal[0] || maxVal[1] != maxVal[0]) {
393 if (minVal[2] != minVal[0] || maxVal[2] != maxVal[0]) {
394 if (minVal[2] == minVal[1] && maxVal[2] == maxVal[1])
423 printf(
"Unable to parse LUT from '%s'\n", argv[1]);
431 pTextTag->
SetText(desc.c_str());
434 pTextTag->
SetText((std::string(
"Device link created from ") + argv[1]).c_str());
447 printf(
"'%s' successfully created\n", argv[2]);
450 printf(
"Unable to save profile '%s'\n", argv[2]);
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.
bool icIsNear(icFloatNumber v1, icFloatNumber v2, icFloatNumber nearRange)
Name: icIsNear.
int main()
Core and external libraries necessary for the fuzzer functionality.
unsigned int icUInt32Number
icUInt32Number NumPoints() const
icFloatNumber * GetData(int index)
bool Init(icUInt8Number nGridPoints, icUInt32Number nMaxSize=0, icUInt8Number nBytesPerPoint=4)
Name: CIccCLUT::Init.
void SetCLUT(CIccCLUT *pCLUT)
Name: CIccMpeCLUT::SetCLUT.
bool SetCurve(int nIndex, icCurveSetCurvePtr newCurve)
Name: CIccMpeCurveSet::SetCurve.
Class: CIccSingleSampledCurve.
virtual icFloatNumber * GetSamples()
virtual bool SetSize(icUInt32Number nSize, bool bZeroAlloc=true)
Name: CIccSingleSampledCurve::SetSize.
Class: CIccTagMultiLocalizedUnicode.
void SetText(const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
Class: CIccTagMultiProcessElement.
virtual void Attach(CIccMultiProcessElement *pElement)
Name: CIccTagMultiProcessElement::Attach.
std::string getTitle(const char *str)
const char * getNext(const char *str)
std::string toEnd(const char *str)
std::string getDescription()
bool isCustomInputRange()
std::string getNextLine()
std::string getCopyright()
bool parse3DTable(icFloatNumber *toLut, icUInt32Number nSizeLut)
icFloatNumber * getMinInput()
icFloatNumber * getMaxInput()
icFloatNumber m_fMaxInput[3]
CubeFile(const char *szFilename)
icFloatNumber m_fMinInput[3]