Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 #544

Merged
merged 3 commits into from
Apr 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/compare_images.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,8 @@ int main(int argc, char **argv)

printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n", it_comp, nbPixelDiff);
printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, sumDiff);
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);

#ifdef OPJ_HAVE_LIBPNG
{
Expand Down
18 changes: 9 additions & 9 deletions tests/nonregression/md5refs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ dbabd772b1e53959e1e1c4bdf58e0108 issue135.j2k_1.pgx
aa7461b31e14641586803b23b7fb04f2 issue142.j2k_0.pgx
a809006e7a0c1eed68bc86c96af43fe3 issue142.j2k_1.pgx
74f7a7a194a74a947245b843c62c4054 issue142.j2k_2.pgx
c44662b1f7fe01caa2ebf3ad62948e3e issue171.jp2_0.pgx
f70e8a4e5dbefeb44d50edd79b6c4cf6 issue171.jp2_1.pgx
18bc167a1c851db2fd9f8c7af3289134 issue171.jp2_2.pgx
f9d1ada7f0f16c8c4f929217a1924416 issue171.jp2_0.pgx
0d4a8507e226130bc44ef7de7e5539f6 issue171.jp2_1.pgx
fde95f3c3bd8639b2258332eb6f658e4 issue171.jp2_2.pgx
adda4f5e46845b96dd3df14a76aa7229 issue188_beach_64bitsbox.jp2_0.pgx
90a9709c166019d1e101e7b96d257ed9 issue188_beach_64bitsbox.jp2_1.pgx
37e23d2df06ee60bf0f9f5e1c16054d8 issue188_beach_64bitsbox.jp2_2.pgx
Expand Down Expand Up @@ -291,10 +291,10 @@ ddfff2ce2df4a9102518c92a362e6d25 dwt_interleave_h.gsr105.jp2_2.pgx
b01ed87dbac424bc820b2ac590e4884e issue236-ESYCC-CDEF.jp2_0.pgx
2635cc00b1e18ef11adcba09e845d459 issue236-ESYCC-CDEF.jp2_1.pgx
f9c95d0aec2f6e7b814fa1d09edcdbda issue236-ESYCC-CDEF.jp2_2.pgx
5f0c1d5c5127c1eabb86a5e0112f139b issue559-eci-090-CIELab.jp2_0.pgx
cdae87485eaada56be3671eec39452e6 issue559-eci-090-CIELab.jp2_1.pgx
e163102afcc857cf001337178241f518 issue559-eci-090-CIELab.jp2_2.pgx
b004b2e08b0dfb217c131b353cf157eb issue559-eci-091-CIELab.jp2_0.pgx
2400da6b8ed6b1747b9913af544580f9 issue559-eci-091-CIELab.jp2_1.pgx
cf73dda887967928dbcf5cc87ab204cc issue559-eci-091-CIELab.jp2_2.pgx
4c3a5c669aaaa330134c7014b26ed06f issue559-eci-090-CIELab.jp2_0.pgx
d6698c71d1ed3861edaadc430af928eb issue559-eci-090-CIELab.jp2_1.pgx
04f3ec1fea6049769c43b1ac3b05794e issue559-eci-090-CIELab.jp2_2.pgx
a190e10941e6145e69816c909f832c1a issue559-eci-091-CIELab.jp2_0.pgx
3fccf3c7ecd3b9de46b94b53a1fa0362 issue559-eci-091-CIELab.jp2_1.pgx
f3081c8e9e9a175f223382a7443b480f issue559-eci-091-CIELab.jp2_2.pgx
3bf91c974abc17e520c6a5efa883a58a issue653-zero-unknownbox.jp2.png
2 changes: 1 addition & 1 deletion thirdparty/liblcms2/COPYING
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Little CMS
Copyright (c) 1998-2010 Marti Maria Saguer
Copyright (c) 1998-2011 Marti Maria Saguer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
108 changes: 65 additions & 43 deletions thirdparty/liblcms2/include/lcms2.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
// Copyright (c) 1998-2014 Marti Maria Saguer
// Copyright (c) 1998-2016 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
Expand All @@ -23,7 +23,7 @@
//
//---------------------------------------------------------------------------------
//
// Version 2.6
// Version 2.8beta0
//

#ifndef _lcms2_H
Expand Down Expand Up @@ -75,7 +75,7 @@ extern "C" {
#endif

// Version/release
#define LCMS_VERSION 2060
#define LCMS_VERSION 2080

// I will give the chance of redefining basic types for compilers that are not fully C99 compliant
#ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
Expand Down Expand Up @@ -173,46 +173,45 @@ typedef int cmsBool;
# define CMS_IS_WINDOWS_ 1
#endif

// Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
// you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
// Try to detect big endian platforms. This list can be endless, so primarily rely on the configure script
// on Unix-like systems, and allow it to be set on the compiler command line using
// -DCMS_USE_BIG_ENDIAN or something similar
#ifdef CMS_USE_BIG_ENDIAN // set at compiler command line takes overall precedence

#if defined(__sgi__) || defined(__sgi) || defined(sparc)
# define CMS_USE_BIG_ENDIAN 1
#endif
# if CMS_USE_BIG_ENDIAN == 0
# undef CMS_USE_BIG_ENDIAN
# endif

#if defined(__s390__) || defined(__s390x__)
# define CMS_USE_BIG_ENDIAN 1
#endif
#else // CMS_USE_BIG_ENDIAN

# ifdef TARGET_CPU_PPC
# if TARGET_CPU_PPC
# ifdef WORDS_BIGENDIAN // set by configure (or explicitly on compiler command line)
# define CMS_USE_BIG_ENDIAN 1
# else // WORDS_BIGENDIAN
// Fall back to platform/compiler specific tests
# if defined(__sgi__) || defined(__sgi) || defined(sparc)
# define CMS_USE_BIG_ENDIAN 1
# endif

# if defined(__s390__) || defined(__s390x__)
# define CMS_USE_BIG_ENDIAN 1
# endif
# endif

#if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_CPU_PPC)
# define CMS_USE_BIG_ENDIAN 1
# if defined (__GNUC__) && defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN)
# if __BYTE_ORDER == __LITTLE_ENDIAN
// // Don't use big endian for PowerPC little endian mode
# undef CMS_USE_BIG_ENDIAN
# endif
# endif
#endif
# ifdef macintosh
# ifdef __BIG_ENDIAN__
# define CMS_USE_BIG_ENDIAN 1
# endif
# ifdef __LITTLE_ENDIAN__
# undef CMS_USE_BIG_ENDIAN
# endif
# endif
# endif // WORDS_BIGENDIAN

// WORDS_BIGENDIAN takes precedence
#if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
# define CMS_USE_BIG_ENDIAN 1
#endif
# if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
# define CMS_USE_BIG_ENDIAN 1
# endif

#endif // CMS_USE_BIG_ENDIAN

#ifdef macintosh
# ifdef __BIG_ENDIAN__
# define CMS_USE_BIG_ENDIAN 1
# endif
# ifdef __LITTLE_ENDIAN__
# undef CMS_USE_BIG_ENDIAN
# endif
#endif

// Calling convention -- this is hardly platform and compiler dependent
#ifdef CMS_IS_WINDOWS_
Expand All @@ -221,7 +220,7 @@ typedef int cmsBool;
# define CMSEXPORT __stdcall _export
# define CMSAPI
# else
# define CMSEXPORT _stdcall
# define CMSEXPORT __stdcall
# ifdef CMS_DLL_BUILD
# define CMSAPI __declspec(dllexport)
# else
Expand Down Expand Up @@ -383,7 +382,8 @@ typedef enum {
cmsSigViewingCondDescTag = 0x76756564, // 'vued'
cmsSigViewingConditionsTag = 0x76696577, // 'view'
cmsSigVcgtTag = 0x76636774, // 'vcgt'
cmsSigMetaTag = 0x6D657461 // 'meta'
cmsSigMetaTag = 0x6D657461, // 'meta'
cmsSigArgyllArtsTag = 0x61727473 // 'arts'

} cmsTagSignature;

Expand Down Expand Up @@ -516,15 +516,16 @@ typedef enum {
cmsSigNamedColorElemType = 0x6E636C20, // 'ncl '
cmsSigLabV2toV4 = 0x32203420, // '2 4 '
cmsSigLabV4toV2 = 0x34203220, // '4 2 '

// Identities
cmsSigIdentityElemType = 0x69646E20, // 'idn '

// Float to floatPCS
cmsSigLab2FloatPCS = 0x64326C20, // 'd2l '
cmsSigFloatPCS2Lab = 0x6C326420, // 'l2d '
cmsSigXYZ2FloatPCS = 0x64327820, // 'd2x '
cmsSigFloatPCS2XYZ = 0x78326420 // 'x2d '
cmsSigFloatPCS2XYZ = 0x78326420, // 'x2d '
cmsSigClipNegativesElemType = 0x636c7020 // 'clp '

} cmsStageSignature;

Expand Down Expand Up @@ -898,7 +899,7 @@ typedef void* cmsHTRANSFORM;
#define TYPE_ARGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
#define TYPE_BGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
#define TYPE_BGRA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
#define TYPE_ABGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
#define TYPE_ABGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))

#define TYPE_CMYK_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))

Expand Down Expand Up @@ -1002,6 +1003,10 @@ typedef struct {

} cmsICCViewingConditions;

// Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------

CMSAPI int CMSEXPORT cmsGetEncodedCMMversion(void);

// Support of non-standard functions --------------------------------------------------------------------------------------

CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
Expand Down Expand Up @@ -1380,7 +1385,7 @@ typedef struct {
typedef struct {

cmsUInt32Number n;
cmsContext ContextID;
cmsContext ContextID;
cmsPSEQDESC* seq;

} cmsSEQ;
Expand Down Expand Up @@ -1480,7 +1485,7 @@ CMSAPI int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignat

CMSAPI cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace);

// Build a suitable formatter for the colorspace of this profile
// Build a suitable formatter for the colorspace of this profile. nBytes=1 means 8 bits, nBytes=2 means 16 bits.
CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);

Expand Down Expand Up @@ -1509,6 +1514,7 @@ CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
CMSAPI cmsIOHANDLER* CMSEXPORT cmsGetProfileIOhandler(cmsHPROFILE hProfile);
CMSAPI cmsBool CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);

// MD5 message digest --------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1643,6 +1649,12 @@ CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID
#define cmsFLAGS_CLUT_POST_LINEARIZATION 0x0001 // create postlinearization tables if possible
#define cmsFLAGS_CLUT_PRE_LINEARIZATION 0x0010 // create prelinearization tables if possible

// Specific to unbounded mode
#define cmsFLAGS_NONEGATIVES 0x8000 // Prevent negative numbers in floating point transforms

// Copy alpha channels when transforming
#define cmsFLAGS_COPY_ALPHA 0x04000000 // Alpha channels are copied on cmsDoTransform()

// Fine-tune control over number of gridpoints
#define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)

Expand Down Expand Up @@ -1720,12 +1732,22 @@ CMSAPI void CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
void * OutputBuffer,
cmsUInt32Number Size);

CMSAPI void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,
CMSAPI void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform, // Deprecated
const void * InputBuffer,
void * OutputBuffer,
cmsUInt32Number Size,
cmsUInt32Number Stride);

CMSAPI void CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM Transform,
const void* InputBuffer,
void* OutputBuffer,
cmsUInt32Number PixelsPerLine,
cmsUInt32Number LineCount,
cmsUInt32Number BytesPerLineIn,
cmsUInt32Number BytesPerLineOut,
cmsUInt32Number BytesPerPlaneIn,
cmsUInt32Number BytesPerPlaneOut);


CMSAPI void CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
CMSAPI void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
Expand Down
40 changes: 34 additions & 6 deletions thirdparty/liblcms2/include/lcms2_plugin.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
// Copyright (c) 1998-2011 Marti Maria Saguer
// Copyright (c) 1998-2016 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -342,8 +342,8 @@ struct _cmstransform_struct;

typedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
register cmsUInt16Number Values[],
register cmsUInt8Number* Buffer,
register cmsUInt32Number Stride);
register cmsUInt8Number* Buffer,
register cmsUInt32Number Stride);

typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
cmsFloat32Number Values[],
Expand Down Expand Up @@ -571,11 +571,28 @@ typedef struct {

//----------------------------------------------------------------------------------------------------------
// Full xform
typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,

typedef struct {
cmsUInt32Number BytesPerLineIn;
cmsUInt32Number BytesPerLineOut;
cmsUInt32Number BytesPerPlaneIn;
cmsUInt32Number BytesPerPlaneOut;

} cmsStride;

typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, // Legacy function, handles just ONE scanline.
const void* InputBuffer,
void* OutputBuffer,
cmsUInt32Number Size,
cmsUInt32Number Stride);
cmsUInt32Number Stride); // Stride in bytes to the next plana in planar formats


typedef void (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo,
const void* InputBuffer,
void* OutputBuffer,
cmsUInt32Number PixelsPerLine,
cmsUInt32Number LineCount,
const cmsStride* Stride);

typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
void** UserData,
Expand All @@ -585,6 +602,14 @@ typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
cmsUInt32Number* OutputFormat,
cmsUInt32Number* dwFlags);

typedef cmsBool (* _cmsTransform2Factory)(_cmsTransform2Fn* xform,
void** UserData,
_cmsFreeUserDataFn* FreePrivateDataFn,
cmsPipeline** Lut,
cmsUInt32Number* InputFormat,
cmsUInt32Number* OutputFormat,
cmsUInt32Number* dwFlags);


// Retrieve user data as specified by the factory
CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
Expand All @@ -599,7 +624,10 @@ typedef struct {
cmsPluginBase base;

// Transform entry point
_cmsTransformFactory Factory;
union {
_cmsTransformFactory legacy_xform;
_cmsTransform2Factory xform;
} factories;

} cmsPluginTransform;

Expand Down
Loading