various cleanups, remove liboil

This commit is contained in:
John Cupitt 2010-07-31 10:35:57 +00:00
parent b05bd38cae
commit 60280aa318
15 changed files with 62 additions and 245 deletions

View File

@ -5,6 +5,9 @@
- use GetTempPath() to pick a temp dir on Windows
- added "rd" mode to im_open()
- vipsthumbnail and vips use "rd"
- im_divide spots /0
- remove liboil dependency, we will use Orc instead
- various small cleanups (thanks Tim)
12/5/10 started 7.22.2
- the conditional image of ifthenelse can be any format, a (!=0) is added if

View File

@ -375,20 +375,6 @@ if test x"$with_magick" != "xno"; then
LIBS=$save_LIBS
fi
# liboil
AC_ARG_WITH([liboil],
AS_HELP_STRING([--without-liboil], [build without liboil (default: test)]))
if test x"$with_liboil" != "xno"; then
PKG_CHECK_MODULES(LIBOIL, liboil-0.3,
[AC_DEFINE(HAVE_LIBOIL,1,[define if you have liboil-0.3 installed.])
with_liboil=yes
PACKAGES_USED="$PACKAGES_USED liboil-0.3"],
[AC_MSG_WARN([liboil not found; disabling liboil support])
with_liboil=no
])
fi
# lcms
AC_ARG_WITH([lcms],
AS_HELP_STRING([--without-lcms], [build without lcms (default: test)]))
@ -564,14 +550,14 @@ fi
# Gather all up for VIPS_CFLAGS, VIPS_INCLUDES, VIPS_LIBS and VIPS_CXX_LIBS
# sort includes to get longer, more specific dirs first
# helps, for example, selecting graphicsmagick over imagemagick
VIPS_CFLAGS=`for i in $VIPS_CFLAGS $GTHREAD_CFLAGS $REQUIRED_CFLAGS $PANGOFT2_CFLAGS $FFTW3_CFLAGS $MAGICK_CFLAGS $PNG_CFLAGS $EXIF_CFLAGS $MATIO_CFLAGS $OPENEXR_CFLAGS $LIBOIL_CFLAGS
VIPS_CFLAGS=`for i in $VIPS_CFLAGS $GTHREAD_CFLAGS $REQUIRED_CFLAGS $PANGOFT2_CFLAGS $FFTW3_CFLAGS $MAGICK_CFLAGS $PNG_CFLAGS $EXIF_CFLAGS $MATIO_CFLAGS $OPENEXR_CFLAGS
do
echo $i
done | sort -ru`
VIPS_CFLAGS=`echo $VIPS_CFLAGS`
VIPS_CFLAGS="$VIPS_DEBUG_FLAGS $VIPS_CFLAGS"
VIPS_INCLUDES="$PNG_INCLUDES $TIFF_INCLUDES $ZIP_INCLUDES $JPEG_INCLUDES $FFTW_INCLUDES $LCMS_INCLUDES"
VIPS_LIBS="$MAGICK_LIBS $PNG_LIBS $TIFF_LIBS $ZIP_LIBS $JPEG_LIBS $GTHREAD_LIBS $REQUIRED_LIBS $PANGOFT2_LIBS $FFTW3_LIBS $FFTW_LIBS $LCMS_LIBS $LIBOIL_LIBS $OPENEXR_LIBS $MATIO_LIBS $EXIF_LIBS -lm"
VIPS_LIBS="$MAGICK_LIBS $PNG_LIBS $TIFF_LIBS $ZIP_LIBS $JPEG_LIBS $GTHREAD_LIBS $REQUIRED_LIBS $PANGOFT2_LIBS $FFTW3_LIBS $FFTW_LIBS $LCMS_LIBS $OPENEXR_LIBS $MATIO_LIBS $EXIF_LIBS -lm"
# need -lstdc++ for (eg.) the C++ format loaders
VIPS_CXX_LIBS="-lstdc++"
@ -654,7 +640,6 @@ build docs with gtkdoc $enable_gtk_doc
use fftw3 for FFT: $with_fftw3
Magick package: $with_magickpackage
file import with libMagick: $with_magick
accelerate loops with liboil: $with_liboil
ICC profile support with lcms: $with_lcms
file import with OpenEXR: $with_OpenEXR
file import with matio: $with_matio

View File

@ -20,6 +20,8 @@
* 28/8/09
* - gtkdoc
* - tiny polish
* 31/7/10
* - remove liboil
*/
/*
@ -56,15 +58,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -153,56 +150,16 @@ abs_gen( PEL *in, PEL *out, int width, IMAGE *im )
/* Abs all input types.
*/
switch( im->BandFmt ) {
case IM_BANDFMT_CHAR:
#ifdef HAVE_LIBOIL
oil_abs_u8_s8( (uint8_t *) out, sizeof( uint8_t ),
(int8_t *) in, sizeof( int8_t ), sz );
#else /*!HAVE_LIBOIL*/
intabs( signed char );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_SHORT:
#ifdef HAVE_LIBOIL
oil_abs_u16_s16( (uint16_t *) out, sizeof( uint16_t ),
(int16_t *) in, sizeof( int16_t ), sz );
#else /*!HAVE_LIBOIL*/
intabs( signed short );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_INT:
#ifdef HAVE_LIBOIL
oil_abs_u32_s32( (uint32_t *) out, sizeof( uint32_t ),
(int32_t *) in, sizeof( int32_t ), sz );
#else /*!HAVE_LIBOIL*/
intabs( signed int );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
oil_abs_f32_f32( (float *) out, sizeof( float ),
(float *) in, sizeof( float ), sz );
#else /*!HAVE_LIBOIL*/
floatabs( float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE:
#ifdef HAVE_LIBOIL
oil_abs_f64_f64( (double *) out, sizeof( double ),
(double *) in, sizeof( double ), sz );
#else /*!HAVE_LIBOIL*/
floatabs( float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_CHAR: intabs( signed char ); break;
case IM_BANDFMT_SHORT: intabs( signed short ); break;
case IM_BANDFMT_INT: intabs( signed int ); break;
case IM_BANDFMT_FLOAT: floatabs( float ); break;
case IM_BANDFMT_DOUBLE: floatabs( float ); break;
case IM_BANDFMT_COMPLEX: complexabs( float ); break;
case IM_BANDFMT_DPCOMPLEX: complexabs( double ); break;
default:
assert( 0 );
g_assert( 0 );
}
}

View File

@ -28,6 +28,8 @@
* - add complex case (needed for im_max())
* 8/9/09
* - wrapscan stuff moved here
* 31/7/10
* - remove liboil
*/
/*
@ -68,10 +70,6 @@
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -223,22 +221,7 @@ avg_scan( void *in, int n, void *seq, void *a, void *b )
case IM_BANDFMT_UINT: LOOP( unsigned int ); break;
case IM_BANDFMT_INT: LOOP( signed int ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE:
#ifdef HAVE_LIBOIL
{
double *p = (double *) in;
double t;
oil_sum_f64( &t, p, sizeof( double ), sz );
m += t;
}
#else /*!HAVE_LIBOIL*/
LOOP( double );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;

View File

@ -27,6 +27,8 @@
* - minor reformatting
* 4/9/09
* - use im__wrapscan()
* 31/7/10
* - remove liboil
*/
/*
@ -67,10 +69,6 @@
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -146,24 +144,7 @@ deviate_scan( void *in, int n, void *seq, void *a, void *b )
case IM_BANDFMT_UINT: LOOP( unsigned int ); break;
case IM_BANDFMT_INT: LOOP( signed int ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE:
#ifdef HAVE_LIBOIL
{
double *p = (double *) in;
double t;
double t2;
oil_sum_f64( &t, p, sizeof( double ), sz );
oil_squaresum_f64( &t2, p, sz );
s += t;
s2 += t2;
}
#else /*!HAVE_LIBOIL*/
LOOP( double );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
default:
g_assert( 0 );

View File

@ -23,6 +23,9 @@
* 18/8/08
* - revise upcasting system
* - add gtkdoc comments
* 31/7/10
* - remove liboil support
* - avoid /0
*/
/*
@ -64,10 +67,6 @@
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -136,7 +135,10 @@
OUT *q = (OUT *) out; \
\
for( x = 0; x < sz; x++ ) \
q[x] = p1[x] / p2[x]; \
if( p2[x] == 0.0 ) \
q[x] = 0; \
else \
q[x] = p1[x] / p2[x]; \
}
static void
@ -154,19 +156,10 @@ divide_buffer( PEL **in, PEL *out, int width, IMAGE *im )
case IM_BANDFMT_USHORT: RLOOP( unsigned short, float ); break;
case IM_BANDFMT_INT: RLOOP( signed int, float ); break;
case IM_BANDFMT_UINT: RLOOP( unsigned int, float ); break;
case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
oil_divide_f32( (float *) out,
(float *) in[0], (float *) in[1], sz );
#else /*!HAVE_LIBOIL*/
RLOOP( float, float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE: RLOOP( double, double ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;
case IM_BANDFMT_FLOAT: RLOOP( float, float ); break;
case IM_BANDFMT_DOUBLE: RLOOP( double, double ); break;
case IM_BANDFMT_COMPLEX:CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX:CLOOP( double ); break;
default:
assert( 0 );

View File

@ -33,6 +33,8 @@
* - add liboil support
* 9/9/09
* - gtkdoc comment, minor reformat
* 31/7/10
* - remove liboil
*/
/*
@ -69,15 +71,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -114,31 +111,6 @@ typedef struct {
} \
}
#ifdef HAVE_LIBOIL
/* Process granularity.
*/
#define CHUNKS (1000)
/* d[] = s[] * b + c, with liboil
*/
static void
lintra_f32( float *d, float *s, int n, float b, float c )
{
float buf[CHUNKS];
int i;
for( i = 0; i < n; i += CHUNKS ) {
oil_scalarmultiply_f32_ns( buf, s,
&b, IM_MIN( CHUNKS, n - i ) );
oil_scalaradd_f32_ns( d, buf,
&c, IM_MIN( CHUNKS, n - i ) );
s += CHUNKS;
d += CHUNKS;
}
}
#endif /*HAVE_LIBOIL*/
/* Lintra a buffer, 1 set of scale/offset.
*/
static int
@ -158,20 +130,13 @@ lintra1_gen( PEL *in, PEL *out, int width, IMAGE *im, LintraInfo *inf )
case IM_BANDFMT_SHORT: LOOP( signed short, float ); break;
case IM_BANDFMT_UINT: LOOP( unsigned int, float ); break;
case IM_BANDFMT_INT: LOOP( signed int, float ); break;
case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
lintra_f32( (float *) out, (float *) in, sz, a, b );
#else /*!HAVE_LIBOIL*/
LOOP( float, float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_FLOAT: LOOP( float, float ); break;
case IM_BANDFMT_DOUBLE: LOOP( double, double ); break;
case IM_BANDFMT_COMPLEX: LOOPCMPLX( float, float ); break;
case IM_BANDFMT_DPCOMPLEX: LOOPCMPLX( double, double ); break;
default:
assert( 0 );
g_assert( 0 );
}
return( 0 );
@ -180,28 +145,28 @@ lintra1_gen( PEL *in, PEL *out, int width, IMAGE *im, LintraInfo *inf )
/* Define what we do for each band element type. Non-complex input, any
* output.
*/
#define LOOPN( IN, OUT ) {\
IN *p = (IN *) in;\
OUT *q = (OUT *) out;\
#define LOOPN( IN, OUT ) { \
IN *p = (IN *) in; \
OUT *q = (OUT *) out; \
\
for( i = 0, x = 0; x < width; x++ )\
for( k = 0; k < nb; k++, i++ )\
q[i] = a[k] * (OUT) p[i] + b[k];\
for( i = 0, x = 0; x < width; x++ ) \
for( k = 0; k < nb; k++, i++ ) \
q[i] = a[k] * (OUT) p[i] + b[k]; \
}
/* Complex input, complex output.
*/
#define LOOPCMPLXN( IN, OUT ) {\
IN *p = (IN *) in;\
OUT *q = (OUT *) out;\
#define LOOPCMPLXN( IN, OUT ) { \
IN *p = (IN *) in; \
OUT *q = (OUT *) out; \
\
for( x = 0; x < width; x++ ) \
for( k = 0; k < nb; k++ ) {\
q[0] = a[k] * p[0] + b[k];\
q[1] = a[k] * p[1];\
q += 2;\
p += 2;\
}\
for( k = 0; k < nb; k++ ) { \
q[0] = a[k] * p[0] + b[k]; \
q[1] = a[k] * p[1]; \
q += 2; \
p += 2; \
} \
}
/* Lintra a buffer, n set of scale/offset.
@ -229,7 +194,7 @@ lintran_gen( PEL *in, PEL *out, int width, IMAGE *im, LintraInfo *inf )
case IM_BANDFMT_DPCOMPLEX: LOOPCMPLXN( double, double ); break;
default:
assert( 0 );
g_assert( 0 );
}
return( 0 );
@ -290,7 +255,7 @@ lintranv_gen( PEL *in, PEL *out, int width, IMAGE *im, LintraInfo *inf )
case IM_BANDFMT_DPCOMPLEX: LOOPCMPLXNV( double, double ); break;
default:
assert( 0 );
g_assert( 0 );
}
return( 0 );

View File

@ -23,6 +23,8 @@
* 18/8/08
* - revise upcasting system
* - add gtkdoc comments
* 31/7/10
* - remove liboil
*/
/*
@ -59,15 +61,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -123,22 +120,13 @@ multiply_buffer( PEL **in, PEL *out, int width, IMAGE *im )
case IM_BANDFMT_USHORT: RLOOP( unsigned short, unsigned int ); break;
case IM_BANDFMT_INT: RLOOP( signed int, signed int ); break;
case IM_BANDFMT_UINT: RLOOP( unsigned int, unsigned int ); break;
case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
oil_multiply_f32( (float *) out,
(float *) in[0], (float *) in[1], sz );
#else /*!HAVE_LIBOIL*/
RLOOP( float, float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_FLOAT: RLOOP( float, float ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DOUBLE: RLOOP( double, double ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;
default:
assert( 0 );
g_assert( 0 );
}
}

View File

@ -36,6 +36,8 @@
* - revise upcasting system
* - add gtkdoc comments
* - remove separate complex case, just double size
* 31/7/10
* - remove liboil
*/
/*
@ -72,15 +74,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -117,12 +114,7 @@ subtract_buffer( PEL **in, PEL *out, int width, IMAGE *im )
case IM_BANDFMT_FLOAT:
case IM_BANDFMT_COMPLEX:
#ifdef HAVE_LIBOIL
oil_subtract_f32( (float *) out,
(float *) in[0], (float *) in[1], sz );
#else /*!HAVE_LIBOIL*/
LOOP( float, float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE:
@ -131,7 +123,7 @@ subtract_buffer( PEL **in, PEL *out, int width, IMAGE *im )
break;
default:
assert( 0 );
g_assert( 0 );
}
}

View File

@ -152,7 +152,7 @@ im_Lab2LabQ( IMAGE *in, IMAGE *out )
if( im_cp_desc( out, t[0] ) )
return( -1 );
out->Bands = 4;
out->Type = IM_TYPE_LAB;
out->Type = IM_TYPE_LABQ;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_LABQ;

View File

@ -144,7 +144,7 @@ im_LabS2LabQ( IMAGE *in, IMAGE *out )
if( im_cp_desc( out, in ) )
return( -1 );
out->Bands = 4;
out->Type = IM_TYPE_LAB;
out->Type = IM_TYPE_LABQ;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_LABQ;

View File

@ -93,6 +93,6 @@ im_UCS2LCh( IMAGE *in, IMAGE *out )
{
im_col_make_tables_UCS();
return( im__colour_unary( "im_UCS2LCh", in, out, IM_TYPE_UCS,
return( im__colour_unary( "im_UCS2LCh", in, out, IM_TYPE_LCH,
(im_wrapone_fn) imb_UCS2LCh, NULL, NULL ) );
}

View File

@ -116,7 +116,6 @@ float im_col_dECMC(
float im_col_dE00(
float L1, float a1, float b1, float L2, float a2, float b2 );
int im_Lab2LCh( IMAGE *in, IMAGE *out );
int im_LCh2Lab( IMAGE *in, IMAGE *out );
int im_LabQ2XYZ( IMAGE *in, IMAGE *out );
int im_rad2float( IMAGE *in, IMAGE *out );
@ -147,8 +146,6 @@ int im_dECMC_fromLab( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_dE00_fromLab( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_dE_fromXYZ( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_dE_fromLab( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_dE_fromXYZ( IMAGE *, IMAGE *, IMAGE * );
int im_dE_fromLab( IMAGE *, IMAGE *, IMAGE * );
int im_lab_morph( IMAGE *in, IMAGE *out,
DOUBLEMASK *mask,
@ -157,11 +154,6 @@ int im_lab_morph( IMAGE *in, IMAGE *out,
void im_col_make_tables_UCS( void );
int im_lab_morph( IMAGE *in, IMAGE *out,
DOUBLEMASK *mask,
double L_offset, double L_scale,
double a_scale, double b_scale );
/* Render intents for icc wrappers.
*/
typedef enum {

View File

@ -1,4 +1,4 @@
/* convolution.h
/* morphology.h
*
* 20/9/09
* - from proto.h

View File

@ -64,10 +64,6 @@
#include <vips/thread.h>
#include <vips/internal.h>
#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
@ -227,24 +223,6 @@ im_init_world( const char *argv0 )
*/
im__buffer_init();
#ifdef HAVE_LIBOIL
{
#ifdef DEBUG
GTimer *timer = g_timer_new();
#endif /*DEBUG*/
oil_init();
#ifdef DEBUG
/* 0.3 is only about 0.1s on my laptop, but this may take longer in
* future.
*/
printf( "oil_init: %gs\n", g_timer_elapsed( timer, NULL ) );
g_timer_destroy( timer );
#endif /*DEBUG*/
}
#endif /*HAVE_LIBOIL*/
done = TRUE;
return( 0 );