diff --git a/ChangeLog b/ChangeLog index faf156f9..84322a8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,15 +35,19 @@ - redone im_fwfft(), im_invfft(), im_freqflt(), im_disp_ps(), im_fractsurf(), im_phasecor() as classes -20/11/13 started 7.36.5 +9/1/14 started 7.36.6 +- fix some clang compiler warnings + +20/11/13 started 7.36.5 - better cache sizing in unbuffered sequential mode - allow larger tile_size in dzsave - remove use of PATH_MAX to help gnu hurd +- fix vips_hist_match() -15/11/13 started 7.36.4 +15/11/13 started 7.36.4 - improve compat with im_init_world() -18/10/13 started 7.36.3 +18/10/13 started 7.36.3 - fix compiler warnings in ubuntu 13.10 - reverse similarity rotation direction to match the convention used elsewhere in vips diff --git a/libvips/create/buildlut.c b/libvips/create/buildlut.c index a8a4d56b..da2b1000 100644 --- a/libvips/create/buildlut.c +++ b/libvips/create/buildlut.c @@ -14,6 +14,8 @@ * - gtkdoc * 2/7/13 * - convert to a class + * 10/12/13 + * - be more forgiving about x vales not quite integers */ /* @@ -125,12 +127,16 @@ vips_buildlut_build_init( VipsBuildlut *lut ) for( y = 0; y < lut->mat->Ysize; y++ ) { double v = *VIPS_MATRIX( lut->mat, 0, y ); - if( floor( v ) != v ) { + /* Allow for being a bit off. + */ + if( abs( v - VIPS_RINT( v ) ) > 0.001 ) { vips_error( class->nickname, - "%s", _( "x value not an int" ) ); + _( "x value row %d not an int" ), y ); return( -1 ); } + v = VIPS_RINT( v ); + if( v < xlow ) xlow = v; if( v > xhigh ) @@ -189,8 +195,8 @@ vips_buildlut_build_create( VipsBuildlut *lut ) */ for( b = 0; b < bands; b++ ) { for( i = 0; i < ysize - 1; i++ ) { - const int x1 = lut->data[i][0]; - const int x2 = lut->data[i + 1][0]; + const int x1 = VIPS_RINT( lut->data[i][0] ); + const int x2 = VIPS_RINT( lut->data[i + 1][0] ); const int dx = x2 - x1; const double y1 = lut->data[i][b + 1]; const double y2 = lut->data[i + 1][b + 1]; diff --git a/libvips/foreign/ppm.c b/libvips/foreign/ppm.c index 8f49168a..95e0e544 100644 --- a/libvips/foreign/ppm.c +++ b/libvips/foreign/ppm.c @@ -512,14 +512,14 @@ vips__ppm_isppm( const char *filename ) /* ppm flags function. */ -VipsFormatFlags +VipsForeignFlags vips__ppm_flags( const char *filename ) { - VipsFormatFlags flags; + VipsForeignFlags flags; flags = 0; if( isppmmmap( filename ) ) - flags |= VIPS_FORMAT_PARTIAL; + flags |= VIPS_FOREIGN_PARTIAL; return( flags ); } diff --git a/libvips/foreign/ppm.h b/libvips/foreign/ppm.h index d672f3dd..5bbc5546 100644 --- a/libvips/foreign/ppm.h +++ b/libvips/foreign/ppm.h @@ -38,7 +38,7 @@ extern "C" { int vips__ppm_header( const char *name, VipsImage *out ); int vips__ppm_load( const char *name, VipsImage *out ); int vips__ppm_isppm( const char *filename ); -VipsFormatFlags vips__ppm_flags( const char *filename ); +VipsForeignFlags vips__ppm_flags( const char *filename ); extern const char *vips__ppm_suffs[]; int vips__ppm_save( VipsImage *in, const char *filename, diff --git a/libvips/foreign/radiance.c b/libvips/foreign/radiance.c index a540f2ef..4275375c 100644 --- a/libvips/foreign/radiance.c +++ b/libvips/foreign/radiance.c @@ -1206,7 +1206,6 @@ vips2rad_put_data_block( VipsRegion *region, Rect *area, void *a ) VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i ); if( scanline_write( (COLR *) p, area->width, write->fout ) ) - //if( scanline_write_old( (COLR *) p, area->width, write->fout ) ) return( -1 ); } diff --git a/libvips/histogram/hist_match.c b/libvips/histogram/hist_match.c index d6805da0..8f196385 100644 --- a/libvips/histogram/hist_match.c +++ b/libvips/histogram/hist_match.c @@ -14,6 +14,8 @@ * - small cleanups * 12/8/13 * - redone im_histspec() as a class, vips_hist_match() + * 19/12/13 + * - oop, upcast input */ /* @@ -138,13 +140,6 @@ vips_hist_match_build( VipsObject *object ) return( 0 ); } -#define UI VIPS_FORMAT_UINT - -static const VipsBandFormat vips_hist_match_format_table[10] = { -/* UC C US S UI I F X D DX */ - UI, UI, UI, UI, UI, UI, UI, UI, UI, UI -}; - static void vips_hist_match_class_init( VipsHistMatchClass *class ) { @@ -159,7 +154,7 @@ vips_hist_match_class_init( VipsHistMatchClass *class ) vobject_class->description = _( "match two histograms" ); vobject_class->build = vips_hist_match_build; - hclass->format_table = vips_hist_match_format_table; + hclass->input_format = VIPS_FORMAT_UINT; hclass->process = vips_hist_match_process; VIPS_ARG_IMAGE( class, "in", 1, diff --git a/libvips/histogram/histogram.c b/libvips/histogram/histogram.c index 48c1c6b3..e57fe2e5 100644 --- a/libvips/histogram/histogram.c +++ b/libvips/histogram/histogram.c @@ -145,11 +145,23 @@ vips_histogram_build( VipsObject *object ) vips_check_hist( class->nickname, histogram->in[i] ) ) return( -1 ); - /* Cast our input images up to a common format, bands and size. + /* Cast our input images up to a common format, bands and size. If + * input_format is set, cast to a fixed input type. */ - if( vips__formatalike_vec( histogram->in, format, histogram->n ) || - vips__bandalike_vec( class->nickname, - format, band, histogram->n, 1 ) || + if( hclass->input_format != VIPS_FORMAT_NOTSET ) { + for( i = 0; i < histogram->n; i++ ) + if( vips_cast( histogram->in[i], &format[i], + hclass->input_format, NULL ) ) + return( -1 ); + } + else { + if( vips__formatalike_vec( histogram->in, + format, histogram->n ) ) + return( -1 ); + } + + if( vips__bandalike_vec( class->nickname, + format, band, histogram->n, 1 ) || vips__hist_sizealike_vec( band, size, histogram->n ) ) return( -1 ); @@ -202,6 +214,8 @@ vips_histogram_class_init( VipsHistogramClass *class ) vobject_class->description = _( "histogram operations" ); vobject_class->build = vips_histogram_build; + class->input_format = VIPS_FORMAT_NOTSET; + /* Inputs set by subclassess. */ diff --git a/libvips/histogram/phistogram.h b/libvips/histogram/phistogram.h index 37d4a518..45ff77a8 100644 --- a/libvips/histogram/phistogram.h +++ b/libvips/histogram/phistogram.h @@ -81,6 +81,10 @@ typedef struct _VipsHistogramClass { */ const VipsBandFormat *format_table; + /* If not VIPS_FORMAT_NOTSET, upcast all ins to this. + */ + VipsBandFormat input_format; + VipsHistogramProcessFn process; } VipsHistogramClass; diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 00878f2f..5a59cc86 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -238,7 +238,7 @@ typedef struct _VipsImage { * guint64 so that we can guarantee to work even on systems with * strange ideas about large files. */ - guint64 sizeof_header; + gint64 sizeof_header; /* If this is a large disc image, don't map the whole thing, instead * have a set of windows shared between the regions active on the