some vips_shrink() tuning

tried an int coordinate path for vips_shrink(), no significant speedup
This commit is contained in:
John Cupitt 2012-06-21 13:11:35 +01:00
parent 352c88b0ce
commit 7a51b59016
4 changed files with 12 additions and 11 deletions

4
TODO
View File

@ -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

View File

@ -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 );

View File

@ -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 );
}

View File

@ -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 )