Skip to content

Commit

Permalink
Added Qt experimental project
Browse files Browse the repository at this point in the history
Added Qt experimental project
Fixed minor complains of lint
  • Loading branch information
mm2 committed Aug 13, 2023
1 parent 6cabbce commit bbcdf92
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 17 deletions.
53 changes: 53 additions & 0 deletions Projects/Qt/lcms2/lcms2.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
QT -= gui

TEMPLATE = lib
CONFIG += staticlib

CONFIG += c++17

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

INCLUDEPATH += ../../../include ../../../src

HEADERS += \
../../../include/lcms2.h \
../../../include/lcms2_plugin.h \
../../../src/lcms2_internal.h

SOURCES += \
../../../src/cmsalpha.c \
../../../src/cmscam02.c \
../../../src/cmscgats.c \
../../../src/cmscnvrt.c \
../../../src/cmserr.c \
../../../src/cmsgamma.c \
../../../src/cmsgmt.c \
../../../src/cmshalf.c \
../../../src/cmsintrp.c \
../../../src/cmsio0.c \
../../../src/cmsio1.c \
../../../src/cmslut.c \
../../../src/cmsmd5.c \
../../../src/cmsmtrx.c \
../../../src/cmsnamed.c \
../../../src/cmsopt.c \
../../../src/cmspack.c \
../../../src/cmspcs.c \
../../../src/cmsplugin.c \
../../../src/cmsps2.c \
../../../src/cmssamp.c \
../../../src/cmssm.c \
../../../src/cmstypes.c \
../../../src/cmsvirt.c \
../../../src/cmswtpnt.c \
../../../src/cmsxform.c



# Default rules for deployment.
unix {
target.path = $$[QT_INSTALL_PLUGINS]/generic
}
!isEmpty(target.path): INSTALLS += target
28 changes: 16 additions & 12 deletions src/cmsalpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static cmsFormatterAlphaFn FormattersAlpha[6][6] = {

// This function computes the distance from each component to the next one in bytes.
static
void ComputeIncrementsForChunky(cmsUInt32Number Format,
cmsBool ComputeIncrementsForChunky(cmsUInt32Number Format,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
{
Expand All @@ -416,7 +416,7 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,

// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return;
return FALSE;

memset(channels, 0, sizeof(channels));

Expand Down Expand Up @@ -453,13 +453,15 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,

for (i = 0; i < extra; i++)
ComponentStartingOrder[i] = channels[i + nchannels];

return TRUE;
}



// On planar configurations, the distance is the stride added to any non-negative
static
void ComputeIncrementsForPlanar(cmsUInt32Number Format,
cmsBool ComputeIncrementsForPlanar(cmsUInt32Number Format,
cmsUInt32Number BytesPerPlane,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
Expand All @@ -473,7 +475,7 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,

// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return;
return FALSE;

memset(channels, 0, sizeof(channels));

Expand Down Expand Up @@ -509,29 +511,29 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,

for (i = 0; i < extra; i++)
ComponentStartingOrder[i] = channels[i + nchannels];

return TRUE;
}



// Dispatcher por chunky and planar RGB
static
void ComputeComponentIncrements(cmsUInt32Number Format,
cmsBool ComputeComponentIncrements(cmsUInt32Number Format,
cmsUInt32Number BytesPerPlane,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
{
if (T_PLANAR(Format)) {

ComputeIncrementsForPlanar(Format, BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
return ComputeIncrementsForPlanar(Format, BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
}
else {
ComputeIncrementsForChunky(Format, ComponentStartingOrder, ComponentPointerIncrements);
return ComputeIncrementsForChunky(Format, ComponentStartingOrder, ComponentPointerIncrements);
}

}



// Handles extra channels copying alpha if requested by the flags
void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
void* out,
Expand Down Expand Up @@ -565,9 +567,11 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
if (nExtra == 0)
return;

// Compute the increments
ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements);
ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements);
// Compute the increments
if (!ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements))
return;
if (!ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements))
return;

// Check for conversions 8, 16, half, float, dbl
copyValueFn = _cmsGetFormatterAlpha(p->ContextID, p->InputFormat, p->OutputFormat);
Expand Down
2 changes: 1 addition & 1 deletion src/cmsgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int GamutSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Nu
cmsUInt16Number Proof[cmsMAXCHANNELS], Proof2[cmsMAXCHANNELS];
cmsFloat64Number dE1, dE2, ErrorRatio;

// Assume in-gamut by default.
// Assume in-gamut by default. NEVER READ, USED FOR DEBUG PURPOSES.
ErrorRatio = 1.0;

// Convert input to Lab
Expand Down
3 changes: 3 additions & 0 deletions src/cmsnamed.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@ void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq)
{
cmsUInt32Number i;

if (pseq == NULL)
return;

for (i=0; i < pseq ->n; i++) {
if (pseq ->seq[i].Manufacturer != NULL) cmsMLUfree(pseq ->seq[i].Manufacturer);
if (pseq ->seq[i].Model != NULL) cmsMLUfree(pseq ->seq[i].Model);
Expand Down
7 changes: 5 additions & 2 deletions src/cmsopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,14 +1113,17 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Inte

// Store result in curve
for (t=0; t < OriginalLut ->InputChannels; t++)
Trans[t] ->Table16[i] = _cmsQuickSaturateWord(Out[t] * 65535.0);
{
if (Trans[t]->Table16 != NULL)
Trans[t] ->Table16[i] = _cmsQuickSaturateWord(Out[t] * 65535.0);
}
}

// Slope-limit the obtained curves
for (t = 0; t < OriginalLut ->InputChannels; t++)
SlopeLimiting(Trans[t]);

// Check for validity
// Check for validity. lIsLinear is here for debug purposes
lIsSuitable = TRUE;
lIsLinear = TRUE;
for (t=0; (lIsSuitable && (t < OriginalLut ->InputChannels)); t++) {
Expand Down
6 changes: 4 additions & 2 deletions src/cmstypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5221,11 +5221,13 @@ cmsBool WriteOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _c
}

Before = io ->Tell(io);
e ->Offsets[i] = Before - BaseOffset;
if (e->Offsets != NULL)
e ->Offsets[i] = Before - BaseOffset;

if (!Type_MLU_Write(self, io, (void*) mlu, 1)) return FALSE;

e ->Sizes[i] = io ->Tell(io) - Before;
if (e->Sizes != NULL)
e ->Sizes[i] = io ->Tell(io) - Before;
return TRUE;
}

Expand Down

0 comments on commit bbcdf92

Please sign in to comment.