diff --git a/TODO b/TODO index cda50228..3be973d6 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -- tune shrink's chunking to try to make it handle smalltile faster - -- add a int-only path? - - vipsthumbnail should not remove profiles by default diff --git a/libvips/include/vips/operation.h b/libvips/include/vips/operation.h index 502d7e2f..56110f15 100644 --- a/libvips/include/vips/operation.h +++ b/libvips/include/vips/operation.h @@ -98,7 +98,7 @@ void vips_cache_drop_all( void ); void vips_operation_set_nocache( VipsOperation *operation, gboolean nocache ); int vips_cache_operation_buildp( VipsOperation **operation ); VipsOperation *vips_cache_operation_build( VipsOperation *operation ); -void vips_cache_print( void ): +void vips_cache_print( void ); void vips_cache_set_max( int max ); void vips_cache_set_max_mem( size_t max_mem ); int vips_cache_get_max( void ); diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index aa9aca22..8633df9d 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -567,7 +567,7 @@ vips_cache_get_lru( void ) operation = NULL; g_hash_table_foreach( vips_cache_table, - (GHFunc) vips_cache_select_cb, &operation ); + (GHFunc) vips_cache_get_lru_cb, &operation ); return( operation ); } diff --git a/libvips/resample/shrink.c b/libvips/resample/shrink.c index 920467c0..f038c28d 100644 --- a/libvips/resample/shrink.c +++ b/libvips/resample/shrink.c @@ -33,6 +33,7 @@ * 12/6/12 * - redone as a class * - warn about non-int shrinks + * - some tuning .. tried an int coordinate path, not worthwhile */ /* @@ -248,9 +249,12 @@ vips_shrink_gen( VipsRegion *or, void *vseq, void *a, void *b, gboolean *stop ) * Each pixel of *r will depend on roughly mw x mh * pixels, so we walk *r in chunks which map to the tile size. * + * Make sure we can't ask for a zero step. */ - int xstep = 1 + VIPS__TILE_WIDTH / shrink->mw; - int ystep = 1 + VIPS__TILE_HEIGHT / shrink->mh; + int xstep = shrink->mw > VIPS__TILE_WIDTH ? + 1 : VIPS__TILE_WIDTH / shrink->mw; + int ystep = shrink->mh > VIPS__TILE_HEIGHT ? + 1 : VIPS__TILE_HEIGHT / shrink->mh; int x, y; @@ -270,8 +274,8 @@ vips_shrink_gen( VipsRegion *or, void *vseq, void *a, void *b, gboolean *stop ) s.left = (r->left + x) * shrink->xshrink; s.top = (r->top + y) * shrink->yshrink; - s.width = 1 + ceil( width * shrink->xshrink ); - s.height = 1 + ceil( height * shrink->yshrink ); + s.width = ceil( width * shrink->xshrink ); + s.height = ceil( height * shrink->yshrink ); #ifdef DEBUG printf( "shrink_gen: requesting %d x %d at %d x %d\n", s.width, s.height, s.left, s.top ); @@ -313,7 +317,8 @@ vips_shrink_build( VipsObject *object ) if( (int) shrink->xshrink != shrink->xshrink || (int) shrink->yshrink != shrink->yshrink ) vips_warn( "VipsShrink", - "%s", _( "not integer shrink factors" ) ); + "%s", _( "not integer shrink factors, " + "expect poor results" ) ); if( shrink->xshrink == 1.0 && shrink->yshrink == 1.0 )