Skip to content

Commit 521ed08

Browse files
authored
Support for ICC Parametric curves type 1-4 (#1691)
* Support for ICC Parametric curves type 1-4 Signed-off-by: Rémi Achard <[email protected]> * Add warning about paraCurve characteristics, fix clamp and improve unit tests Signed-off-by: Rémi Achard <[email protected]> * Windows CI fixes Signed-off-by: Rémi Achard <[email protected]> Signed-off-by: Rémi Achard <[email protected]>
1 parent cae5850 commit 521ed08

File tree

7 files changed

+627
-28
lines changed

7 files changed

+627
-28
lines changed

ext/sampleicc/src/include/iccProfileReader.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace SampleICC
486486
class IccParametricCurveTypeReader : public IccTypeReader
487487
{
488488
public:
489-
IccParametricCurveTypeReader() : mnNumParam(0), mParam(NULL) {}
489+
IccParametricCurveTypeReader() : mFunctionType(0), mnNumParam(0), mParam(NULL) {}
490490
~IccParametricCurveTypeReader()
491491
{
492492
if (mParam)
@@ -498,7 +498,6 @@ namespace SampleICC
498498
virtual bool Read(std::istream & istream, icUInt32Number size)
499499
{
500500
// Tag size include sig that has already been read.
501-
icUInt16Number functionType;
502501
icUInt16Number res16;
503502
icUInt32Number res32;
504503

@@ -517,15 +516,10 @@ namespace SampleICC
517516
return false;
518517

519518
if (!Read32(istream, &res32, 1)
520-
|| !Read16(istream, &functionType, 1)
519+
|| !Read16(istream, &mFunctionType, 1)
521520
|| !Read16(istream, &res16, 1))
522521
return false;
523522

524-
if (0 != functionType) {
525-
// unsupported function type
526-
return false;
527-
}
528-
529523
if (!mnNumParam) {
530524
mnNumParam = (icUInt16Number)((size - nHdrSize) / sizeof(icS15Fixed16Number));
531525
mParam = new icS15Fixed16Number[mnNumParam];
@@ -535,14 +529,21 @@ namespace SampleICC
535529
if (nHdrSize + mnNumParam * sizeof(icS15Fixed16Number) > size)
536530
return false;
537531

538-
if (!Read32(istream, mParam, 1)) {
539-
return false;
532+
for (int i = 0; i < mnNumParam; ++i) {
533+
if (!Read32(istream, mParam + i, 1)) {
534+
return false;
535+
}
540536
}
541537
}
542538

543539
return true;
544540
}
545541

542+
const icUInt16Number GetFunctionType() const
543+
{
544+
return mFunctionType;
545+
}
546+
546547
const icS15Fixed16Number * GetParam() const
547548
{
548549
return mParam;
@@ -554,6 +555,7 @@ namespace SampleICC
554555
}
555556

556557
private:
558+
icUInt16Number mFunctionType;
557559
icUInt16Number mnNumParam;
558560
icS15Fixed16Number *mParam;
559561

@@ -802,4 +804,3 @@ namespace SampleICC
802804
}
803805

804806
#endif
805-

0 commit comments

Comments
 (0)