remove lcms1 support
it had bitrotted and no longer worked properly
This commit is contained in:
parent
6343e03305
commit
e46a56e137
@ -11,6 +11,7 @@
|
|||||||
- savers support a "page_height" option for multipage save
|
- savers support a "page_height" option for multipage save
|
||||||
- rename 'disc' as 'memory' and default off
|
- rename 'disc' as 'memory' and default off
|
||||||
- add vips_find_trim(), search for non-background areas
|
- add vips_find_trim(), search for non-background areas
|
||||||
|
- remove lcms1 support, it had bitrotted
|
||||||
|
|
||||||
2/8/17 started 8.5.8
|
2/8/17 started 8.5.8
|
||||||
- fix transparency detection in merge, thanks Haida
|
- fix transparency detection in merge, thanks Haida
|
||||||
|
11
configure.ac
11
configure.ac
@ -599,7 +599,7 @@ if test x"$with_orc" != "xno"; then
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lcms ... look for lcms2 first, it has better threading support
|
# lcms ... refuse to use lcms1
|
||||||
AC_ARG_WITH([lcms],
|
AC_ARG_WITH([lcms],
|
||||||
AS_HELP_STRING([--without-lcms], [build without lcms (default: test)]))
|
AS_HELP_STRING([--without-lcms], [build without lcms (default: test)]))
|
||||||
|
|
||||||
@ -609,17 +609,10 @@ if test x"$with_lcms" != "xno"; then
|
|||||||
with_lcms="yes (lcms2)"
|
with_lcms="yes (lcms2)"
|
||||||
PACKAGES_USED="$PACKAGES_USED lcms2"
|
PACKAGES_USED="$PACKAGES_USED lcms2"
|
||||||
],
|
],
|
||||||
[PKG_CHECK_MODULES(LCMS, lcms,
|
[AC_MSG_WARN([lcms2 not found; disabling ICC profile support])
|
||||||
[AC_DEFINE(HAVE_LCMS,1,[define if you have lcms installed.])
|
|
||||||
with_lcms="yes (lcms1)"
|
|
||||||
PACKAGES_USED="$PACKAGES_USED lcms"
|
|
||||||
],
|
|
||||||
[AC_MSG_WARN([lcms2/lcms not found; disabling lcms support])
|
|
||||||
with_lcms=no
|
with_lcms=no
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OpenEXR
|
# OpenEXR
|
||||||
|
@ -752,7 +752,7 @@ vips_colour_operation_init( void )
|
|||||||
extern GType vips_scRGB2BW_get_type( void );
|
extern GType vips_scRGB2BW_get_type( void );
|
||||||
extern GType vips_XYZ2scRGB_get_type( void );
|
extern GType vips_XYZ2scRGB_get_type( void );
|
||||||
extern GType vips_scRGB2sRGB_get_type( void );
|
extern GType vips_scRGB2sRGB_get_type( void );
|
||||||
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
#ifdef HAVE_LCMS2
|
||||||
extern GType vips_icc_import_get_type( void );
|
extern GType vips_icc_import_get_type( void );
|
||||||
extern GType vips_icc_export_get_type( void );
|
extern GType vips_icc_export_get_type( void );
|
||||||
extern GType vips_icc_transform_get_type( void );
|
extern GType vips_icc_transform_get_type( void );
|
||||||
@ -786,7 +786,7 @@ vips_colour_operation_init( void )
|
|||||||
vips_HSV2sRGB_get_type();
|
vips_HSV2sRGB_get_type();
|
||||||
vips_XYZ2scRGB_get_type();
|
vips_XYZ2scRGB_get_type();
|
||||||
vips_scRGB2sRGB_get_type();
|
vips_scRGB2sRGB_get_type();
|
||||||
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
#ifdef HAVE_LCMS2
|
||||||
vips_icc_import_get_type();
|
vips_icc_import_get_type();
|
||||||
vips_icc_export_get_type();
|
vips_icc_export_get_type();
|
||||||
vips_icc_transform_get_type();
|
vips_icc_transform_get_type();
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
* James
|
* James
|
||||||
* 26/6/15
|
* 26/6/15
|
||||||
* - better profile sanity checking for icc import
|
* - better profile sanity checking for icc import
|
||||||
|
* 2/8/17
|
||||||
|
* - remove lcms1 support, it was untested
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -66,7 +68,7 @@
|
|||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
#include <vips/intl.h>
|
#include <vips/intl.h>
|
||||||
|
|
||||||
#if defined( HAVE_LCMS ) || defined( HAVE_LCMS2 )
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -74,18 +76,7 @@
|
|||||||
|
|
||||||
/* Has to be before VIPS to avoid nameclashes.
|
/* Has to be before VIPS to avoid nameclashes.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
#include <lcms2.h>
|
#include <lcms2.h>
|
||||||
#else /*HAVE_LCMS*/
|
|
||||||
#include <lcms.h>
|
|
||||||
|
|
||||||
/* Use the lcms2 names.
|
|
||||||
*/
|
|
||||||
#define cmsSigRgbData icSigRgbData
|
|
||||||
#define cmsSigLabData icSigLabData
|
|
||||||
#define cmsSigCmykData icSigCmykData
|
|
||||||
#define cmsSigXYZData icSigXYZData
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
@ -95,16 +86,6 @@
|
|||||||
*/
|
*/
|
||||||
#define PIXEL_BUFFER_SIZE (10000)
|
#define PIXEL_BUFFER_SIZE (10000)
|
||||||
|
|
||||||
/* LCMS1 was missing some stuff.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_LCMS
|
|
||||||
typedef DWORD cmsUInt32Number;
|
|
||||||
|
|
||||||
/* This doesn't exist in lcms1, just set it to zero.
|
|
||||||
*/
|
|
||||||
#define cmsFLAGS_NOCACHE (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VipsIntent:
|
* VipsIntent:
|
||||||
* @VIPS_INTENT_PERCEPTUAL: perceptual rendering intent
|
* @VIPS_INTENT_PERCEPTUAL: perceptual rendering intent
|
||||||
@ -169,10 +150,6 @@ typedef struct _VipsIcc {
|
|||||||
cmsUInt32Number out_icc_format;
|
cmsUInt32Number out_icc_format;
|
||||||
cmsHTRANSFORM trans;
|
cmsHTRANSFORM trans;
|
||||||
|
|
||||||
/* We need to single-thread calls to LCMS 1.
|
|
||||||
*/
|
|
||||||
GMutex *lock;
|
|
||||||
|
|
||||||
} VipsIcc;
|
} VipsIcc;
|
||||||
|
|
||||||
typedef VipsColourCodeClass VipsIccClass;
|
typedef VipsColourCodeClass VipsIccClass;
|
||||||
@ -182,24 +159,11 @@ G_DEFINE_ABSTRACT_TYPE( VipsIcc, vips_icc, VIPS_TYPE_COLOUR_CODE );
|
|||||||
/* Error from lcms.
|
/* Error from lcms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
static void
|
static void
|
||||||
icc_error( cmsContext context, cmsUInt32Number code, const char *text )
|
icc_error( cmsContext context, cmsUInt32Number code, const char *text )
|
||||||
{
|
{
|
||||||
vips_error( "VipsIcc", "%s", text );
|
vips_error( "VipsIcc", "%s", text );
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static int
|
|
||||||
icc_error( int code, const char *text )
|
|
||||||
{
|
|
||||||
if( code == LCMS_ERRC_WARNING )
|
|
||||||
g_warning( "%s", text );
|
|
||||||
else
|
|
||||||
vips_error( "VipsIcc", text );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_icc_dispose( GObject *gobject )
|
vips_icc_dispose( GObject *gobject )
|
||||||
@ -209,7 +173,6 @@ vips_icc_dispose( GObject *gobject )
|
|||||||
VIPS_FREEF( cmsDeleteTransform, icc->trans );
|
VIPS_FREEF( cmsDeleteTransform, icc->trans );
|
||||||
VIPS_FREEF( cmsCloseProfile, icc->in_profile );
|
VIPS_FREEF( cmsCloseProfile, icc->in_profile );
|
||||||
VIPS_FREEF( cmsCloseProfile, icc->out_profile );
|
VIPS_FREEF( cmsCloseProfile, icc->out_profile );
|
||||||
VIPS_FREEF( vips_g_mutex_free, icc->lock );
|
|
||||||
|
|
||||||
G_OBJECT_CLASS( vips_icc_parent_class )->dispose( gobject );
|
G_OBJECT_CLASS( vips_icc_parent_class )->dispose( gobject );
|
||||||
}
|
}
|
||||||
@ -251,7 +214,6 @@ vips_icc_build( VipsObject *object )
|
|||||||
TYPE_RGB_16 : TYPE_RGB_8;
|
TYPE_RGB_16 : TYPE_RGB_8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
case cmsSigGrayData:
|
case cmsSigGrayData:
|
||||||
colour->input_bands = 1;
|
colour->input_bands = 1;
|
||||||
code->input_format =
|
code->input_format =
|
||||||
@ -261,7 +223,6 @@ vips_icc_build( VipsObject *object )
|
|||||||
code->in->BandFmt == VIPS_FORMAT_USHORT ?
|
code->in->BandFmt == VIPS_FORMAT_USHORT ?
|
||||||
TYPE_GRAY_16 : TYPE_GRAY_8;
|
TYPE_GRAY_16 : TYPE_GRAY_8;
|
||||||
break;
|
break;
|
||||||
#endif /*HAVE_LCMS2*/
|
|
||||||
|
|
||||||
case cmsSigCmykData:
|
case cmsSigCmykData:
|
||||||
colour->input_bands = 4;
|
colour->input_bands = 4;
|
||||||
@ -311,7 +272,6 @@ vips_icc_build( VipsObject *object )
|
|||||||
TYPE_RGB_16 : TYPE_RGB_8;
|
TYPE_RGB_16 : TYPE_RGB_8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
case cmsSigGrayData:
|
case cmsSigGrayData:
|
||||||
colour->interpretation =
|
colour->interpretation =
|
||||||
icc->depth == 8 ?
|
icc->depth == 8 ?
|
||||||
@ -325,7 +285,6 @@ vips_icc_build( VipsObject *object )
|
|||||||
icc->depth == 16 ?
|
icc->depth == 16 ?
|
||||||
TYPE_GRAY_16 : TYPE_GRAY_8;
|
TYPE_GRAY_16 : TYPE_GRAY_8;
|
||||||
break;
|
break;
|
||||||
#endif /*HAVE_LCMS2*/
|
|
||||||
|
|
||||||
case cmsSigCmykData:
|
case cmsSigCmykData:
|
||||||
colour->interpretation = VIPS_INTERPRETATION_CMYK;
|
colour->interpretation = VIPS_INTERPRETATION_CMYK;
|
||||||
@ -414,21 +373,12 @@ vips_icc_class_init( VipsIccClass *class )
|
|||||||
G_STRUCT_OFFSET( VipsIcc, pcs ),
|
G_STRUCT_OFFSET( VipsIcc, pcs ),
|
||||||
VIPS_TYPE_PCS, VIPS_PCS_LAB );
|
VIPS_TYPE_PCS, VIPS_PCS_LAB );
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsSetLogErrorHandler( icc_error );
|
cmsSetLogErrorHandler( icc_error );
|
||||||
#else
|
|
||||||
/* Ask lcms not to abort on error.
|
|
||||||
*/
|
|
||||||
cmsErrorAction( LCMS_ERROR_IGNORE );
|
|
||||||
cmsSetErrorHandler( icc_error );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_icc_init( VipsIcc *icc )
|
vips_icc_init( VipsIcc *icc )
|
||||||
{
|
{
|
||||||
icc->lock = vips_g_mutex_new();
|
|
||||||
icc->intent = VIPS_INTENT_RELATIVE;
|
icc->intent = VIPS_INTENT_RELATIVE;
|
||||||
icc->pcs = VIPS_PCS_LAB;
|
icc->pcs = VIPS_PCS_LAB;
|
||||||
icc->depth = 8;
|
icc->depth = 8;
|
||||||
@ -466,11 +416,9 @@ vips_icc_profile_needs_bands( cmsHPROFILE profile )
|
|||||||
int needs_bands;
|
int needs_bands;
|
||||||
|
|
||||||
switch( cmsGetColorSpace( profile ) ) {
|
switch( cmsGetColorSpace( profile ) ) {
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
case cmsSigGrayData:
|
case cmsSigGrayData:
|
||||||
needs_bands = 1;
|
needs_bands = 1;
|
||||||
break;
|
break;
|
||||||
#endif /*HAVE_LCMS2*/
|
|
||||||
|
|
||||||
case cmsSigRgbData:
|
case cmsSigRgbData:
|
||||||
case cmsSigLabData:
|
case cmsSigLabData:
|
||||||
@ -631,14 +579,10 @@ vips_icc_import_build( VipsObject *object )
|
|||||||
icc->in_profile, icc->intent, LCMS_USED_AS_INPUT );
|
icc->in_profile, icc->intent, LCMS_USED_AS_INPUT );
|
||||||
|
|
||||||
if( icc->pcs == VIPS_PCS_LAB ) {
|
if( icc->pcs == VIPS_PCS_LAB ) {
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsCIExyY white;
|
cmsCIExyY white;
|
||||||
cmsWhitePointFromTemp( &white, 6500 );
|
cmsWhitePointFromTemp( &white, 6500 );
|
||||||
|
|
||||||
icc->out_profile = cmsCreateLab4Profile( &white );
|
icc->out_profile = cmsCreateLab4Profile( &white );
|
||||||
#else
|
|
||||||
icc->out_profile = cmsCreateLabProfile( NULL );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
icc->out_profile = cmsCreateXYZProfile();
|
icc->out_profile = cmsCreateXYZProfile();
|
||||||
@ -704,13 +648,7 @@ vips_icc_import_line( VipsColour *colour,
|
|||||||
for( i = 0; i < width; i += PIXEL_BUFFER_SIZE ) {
|
for( i = 0; i < width; i += PIXEL_BUFFER_SIZE ) {
|
||||||
const int chunk = VIPS_MIN( width - i, PIXEL_BUFFER_SIZE );
|
const int chunk = VIPS_MIN( width - i, PIXEL_BUFFER_SIZE );
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsDoTransform( icc->trans, p, encoded, chunk );
|
cmsDoTransform( icc->trans, p, encoded, chunk );
|
||||||
#else
|
|
||||||
g_mutex_lock( icc->lock );
|
|
||||||
cmsDoTransform( icc->trans, p, encoded, chunk );
|
|
||||||
g_mutex_unlock( icc->lock );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( icc->pcs == VIPS_PCS_LAB )
|
if( icc->pcs == VIPS_PCS_LAB )
|
||||||
decode_lab( encoded, q, chunk );
|
decode_lab( encoded, q, chunk );
|
||||||
@ -788,14 +726,10 @@ vips_icc_export_build( VipsObject *object )
|
|||||||
icc->pcs = VIPS_PCS_XYZ;
|
icc->pcs = VIPS_PCS_XYZ;
|
||||||
|
|
||||||
if( icc->pcs == VIPS_PCS_LAB ) {
|
if( icc->pcs == VIPS_PCS_LAB ) {
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsCIExyY white;
|
cmsCIExyY white;
|
||||||
cmsWhitePointFromTemp( &white, 6500 );
|
cmsWhitePointFromTemp( &white, 6500 );
|
||||||
|
|
||||||
icc->in_profile = cmsCreateLab4Profile( &white );
|
icc->in_profile = cmsCreateLab4Profile( &white );
|
||||||
#else
|
|
||||||
icc->in_profile = cmsCreateLabProfile( NULL );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
icc->in_profile = cmsCreateXYZProfile();
|
icc->in_profile = cmsCreateXYZProfile();
|
||||||
@ -940,13 +874,7 @@ vips_icc_export_line( VipsColour *colour,
|
|||||||
else
|
else
|
||||||
encode_xyz( p, encoded, chunk );
|
encode_xyz( p, encoded, chunk );
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsDoTransform( icc->trans, encoded, q, chunk );
|
cmsDoTransform( icc->trans, encoded, q, chunk );
|
||||||
#else
|
|
||||||
g_mutex_lock( icc->lock );
|
|
||||||
cmsDoTransform( icc->trans, encoded, q, chunk );
|
|
||||||
g_mutex_unlock( icc->lock );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p += PIXEL_BUFFER_SIZE * 3;
|
p += PIXEL_BUFFER_SIZE * 3;
|
||||||
q += PIXEL_BUFFER_SIZE * VIPS_IMAGE_SIZEOF_PEL( colour->out );
|
q += PIXEL_BUFFER_SIZE * VIPS_IMAGE_SIZEOF_PEL( colour->out );
|
||||||
@ -1070,13 +998,7 @@ vips_icc_transform_line( VipsColour *colour,
|
|||||||
{
|
{
|
||||||
VipsIcc *icc = (VipsIcc *) colour;
|
VipsIcc *icc = (VipsIcc *) colour;
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
cmsDoTransform( icc->trans, in[0], out, width );
|
cmsDoTransform( icc->trans, in[0], out, width );
|
||||||
#else
|
|
||||||
g_mutex_lock( icc->lock );
|
|
||||||
cmsDoTransform( icc->trans, in[0], out, width );
|
|
||||||
g_mutex_unlock( icc->lock );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1149,6 +1071,7 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
|||||||
{
|
{
|
||||||
VipsImage *t;
|
VipsImage *t;
|
||||||
cmsHPROFILE profile;
|
cmsHPROFILE profile;
|
||||||
|
cmsCIEXYZ *media;
|
||||||
double X, Y, Z;
|
double X, Y, Z;
|
||||||
double *add;
|
double *add;
|
||||||
double *mul;
|
double *mul;
|
||||||
@ -1157,10 +1080,6 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
|||||||
if( !(profile = cmsOpenProfileFromFile( profile_filename, "r" )) )
|
if( !(profile = cmsOpenProfileFromFile( profile_filename, "r" )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
|
||||||
{
|
|
||||||
cmsCIEXYZ *media;
|
|
||||||
|
|
||||||
if( !(media = cmsReadTag( profile, cmsSigMediaWhitePointTag )) ) {
|
if( !(media = cmsReadTag( profile, cmsSigMediaWhitePointTag )) ) {
|
||||||
vips_error( "vips_icc_ac2rc",
|
vips_error( "vips_icc_ac2rc",
|
||||||
"%s", _( "unable to get media white point" ) );
|
"%s", _( "unable to get media white point" ) );
|
||||||
@ -1170,22 +1089,6 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
|||||||
X = media->X;
|
X = media->X;
|
||||||
Y = media->Y;
|
Y = media->Y;
|
||||||
Z = media->Z;
|
Z = media->Z;
|
||||||
}
|
|
||||||
#else /*HAVE_LCMS*/
|
|
||||||
{
|
|
||||||
cmsCIEXYZ media;
|
|
||||||
|
|
||||||
if( !cmsTakeMediaWhitePoint( &media, profile ) ) {
|
|
||||||
vips_error( "vips_icc_ac2rc",
|
|
||||||
"%s", _( "unable to get media white point" ) );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
X = media.X;
|
|
||||||
Y = media.Y;
|
|
||||||
Z = media.Z;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cmsCloseProfile( profile );
|
cmsCloseProfile( profile );
|
||||||
|
|
||||||
@ -1223,7 +1126,7 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /*!HAVE_LCMS*/
|
#else /*!HAVE_LCMS2*/
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user