From e4996d8dce2e6d499efaa68e79a8be13cd9275bf Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 4 Aug 2014 21:25:19 +0100 Subject: [PATCH] don't set shrink too low --- libvips/resample/bicubic.cpp | 3 +++ tools/vipsthumbnail.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libvips/resample/bicubic.cpp b/libvips/resample/bicubic.cpp index 1488f8c9..66bfa5b6 100644 --- a/libvips/resample/bicubic.cpp +++ b/libvips/resample/bicubic.cpp @@ -353,6 +353,7 @@ vips_interpolate_bicubic_interpolate( VipsInterpolate *interpolate, bicubic_int_tab( out, p, bands, lskip, cxi, cyi ); + /* Handy for benchmarking @@ -360,11 +361,13 @@ vips_interpolate_bicubic_interpolate( VipsInterpolate *interpolate, bicubic_float_tab( out, p, bands, lskip, cxf, cyf ); + bicubic_notab( out, p, bands, lskip, x - ix, y - iy ); */ + break; case VIPS_FORMAT_CHAR: diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index 14d3e908..75d4ee58 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -229,7 +229,8 @@ calculate_shrink( VipsImage *im, double *residual, * * We want to shrink by less for interpolators with larger windows. */ - int shrink = floor( factor2 ) / VIPS_MAX( window_size / 2, 1 ); + int shrink = VIPS_MAX( 1, + floor( factor2 ) / VIPS_MAX( 1, window_size / 2 ) ); if( residual && direction == VIPS_DIRECTION_HORIZONTAL ) {