oop buffer size issue

This commit is contained in:
John Cupitt 2012-02-20 21:33:14 +00:00
parent 9ea1387a68
commit 1a5b8df9be
2 changed files with 19 additions and 1 deletions

8
TODO
View File

@ -1,3 +1,11 @@
- try:
$ vips --vips-concurrency=1 --vips-tile-width=10 --vips-tile-height=10 im_benchmarkn /home/john/GIT/nip2//test/tmp/t3.v /home/john/GIT/nip2//test/tmp/t5.v 1
** VIPS:ERROR:threadpool.c:938:vips_get_tile_size: assertion failed: (*nlines % *tile_height == 0)
- interlaced jpg needs massive memory, we should have two jpg read modes, like
png

View File

@ -882,6 +882,14 @@ vips_threadpool_run( VipsImage *im,
return( result );
}
/* Round N down to P boundary.
*/
#define ROUND_DOWN(N,P) ((N) - ((N) % P))
/* Round N up to P boundary.
*/
#define ROUND_UP(N,P) (ROUND_DOWN( (N) + (P) - 1, (P) ))
/**
* vips_get_tile_size:
* @im: image to guess for
@ -926,12 +934,14 @@ vips_get_tile_size( VipsImage *im,
* the pipeline might see a different hint and we need to synchronise
* buffer sizes everywhere.
*
* Pick the maximum buffer size we might possibly need.
* Pick the maximum buffer size we might possibly need, then round up
* to a multiple of tileheight.
*/
*nlines = vips__tile_height *
(1 + nthr / VIPS_MAX( 1, im->Xsize / vips__tile_width )) * 2;
*nlines = VIPS_MAX( *nlines, vips__fatstrip_height * nthr * 2 );
*nlines = VIPS_MAX( *nlines, vips__thinstrip_height * nthr * 2 );
*nlines = ROUND_UP( *nlines, *tile_height );
/* We make this assumption in several places.
*/