From db20d70495269d1b23282f8515625c5fbdf152c5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 26 Jan 2016 15:10:46 +0000 Subject: [PATCH] fix some more compiler warnings and a bit of formatting --- ChangeLog | 9 ++++----- libvips/conversion/join.c | 13 +++++-------- libvips/convolution/im_conv.c | 8 ++++++-- libvips/convolution/im_conv_f.c | 5 ++++- libvips/resample/mapim.c | 14 +++++++------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index d44b4cdf..79a20cd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,15 +4,14 @@ - ifthenelse needs less C stack during eval - better rounding in bilinear interpolator - fix to "make check" in non-C locales [felixbuenemann] -- use builtin isnan isinf when possible [Lovell Fuller] +- use compiler builtins isnan, isinf, fabs, fmin, fmax, ceil, floor when + possible [Lovell Fuller] - tune vips_shrinkh(), 30% faster [Lovell Fuller] - remove SEQ hint from vips_subsample(), fixes cli performance [erdmann] - fix double free on attach ICC profile from file in tiff write [erdmann] -- add VIPS_FLOOR()/VIPS_CEIL(), much faster [Lovell Fuller] -- use g_assert_not_reached(); +- use g_assert_not_reached() - better vips-from-C docs -- add VIPS_FMIN() / VIPS_FMAX() / VIPS_FABS() / VIPS_FCLIP() ... use builtins - when available +- remove Duff from im_conv() / im_conv_f() for a 25% speedup [Lovell Fuller] 1/1/16 started 8.2.1 - add a compat stub [Benjamin Gilbert] diff --git a/libvips/conversion/join.c b/libvips/conversion/join.c index 31988947..8229fbca 100644 --- a/libvips/conversion/join.c +++ b/libvips/conversion/join.c @@ -99,6 +99,11 @@ vips_join_build( VipsObject *object ) if( VIPS_OBJECT_CLASS( vips_join_parent_class )->build( object ) ) return( -1 ); + /* Stop compiler warnings. + */ + x = 0; + y = 0; + switch( join->direction ) { case VIPS_DIRECTION_HORIZONTAL: x = join->in1->Xsize + join->shim; @@ -118,10 +123,6 @@ vips_join_build( VipsObject *object ) default: g_assert_not_reached(); - - /* Stop compiler warnings. - */ - y = 0; } break; @@ -144,10 +145,6 @@ vips_join_build( VipsObject *object ) default: g_assert_not_reached(); - - /* Stop compiler warnings. - */ - x = 0; } break; diff --git a/libvips/convolution/im_conv.c b/libvips/convolution/im_conv.c index 776f0773..1dc477de 100644 --- a/libvips/convolution/im_conv.c +++ b/libvips/convolution/im_conv.c @@ -67,6 +67,8 @@ * - argh typo in overflow estimation could cause errors * 15/10/11 Nicolas * - handle offset correctly in seperable convolutions + * 26/1/16 Lovell Fuller + * - remove Duff for a 25% speedup */ /* @@ -635,9 +637,10 @@ conv_start( IMAGE *out, void *a, void *b ) TYPE * restrict q = (TYPE *) IM_REGION_ADDR( or, le, y ); \ \ for( x = 0; x < sz; x++ ) { \ + int sum; \ int i; \ - int sum = 0; \ \ + sum = 0; \ for ( i = 0; i < nnz; i++ ) \ sum += t[i] * p[i][x]; \ \ @@ -656,9 +659,10 @@ conv_start( IMAGE *out, void *a, void *b ) TYPE * restrict q = (TYPE *) IM_REGION_ADDR( or, le, y ); \ \ for( x = 0; x < sz; x++ ) { \ + double sum; \ int i; \ - double sum = 0; \ \ + sum = 0; \ for ( i = 0; i < nnz; i++ ) \ sum += t[i] * p[i][x]; \ \ diff --git a/libvips/convolution/im_conv_f.c b/libvips/convolution/im_conv_f.c index 027f9fe2..0cbe104b 100644 --- a/libvips/convolution/im_conv_f.c +++ b/libvips/convolution/im_conv_f.c @@ -43,6 +43,8 @@ * keeping two versions * 15/10/11 Nicolas * - handle offset correctly in seperable convolutions + * 26/1/16 Lovell Fuller + * - remove Duff for a 25% speedup */ /* @@ -209,9 +211,10 @@ conv_start( IMAGE *out, void *a, void *b ) OTYPE * restrict q = (OTYPE *) IM_REGION_ADDR( or, le, y ); \ \ for( x = 0; x < sz; x++ ) { \ + double sum; \ int i; \ - double sum = 0; \ \ + sum = 0; \ for ( i = 0; i < nnz; i++ ) \ sum += t[i] * p[i][x]; \ \ diff --git a/libvips/resample/mapim.c b/libvips/resample/mapim.c index 6fe140b5..9187153a 100644 --- a/libvips/resample/mapim.c +++ b/libvips/resample/mapim.c @@ -112,6 +112,13 @@ vips_mapim_region_minmax( VipsRegion *region, VipsRect *r, VipsRect *bounds ) gboolean first; int x, y; + /* Stop compiler warnings. + */ + min_x = 0; + max_x = 0; + min_y = 0; + max_y = 0; + first = TRUE; for( y = 0; y < r->height; y++ ) { VipsPel * restrict p = @@ -141,13 +148,6 @@ vips_mapim_region_minmax( VipsRegion *region, VipsRect *r, VipsRect *bounds ) default: g_assert_not_reached(); - - /* Stop compiler warnings. - */ - min_x = 0; - max_x = 0; - min_y = 0; - max_y = 0; } }