tuning, sort out demand hints

and disable extract_area seq mode
This commit is contained in:
John Cupitt 2012-08-24 12:46:10 +01:00
parent 70bde1dd1e
commit 39b05f5172
8 changed files with 30 additions and 33 deletions

View File

@ -13,6 +13,8 @@
- VipsSequential has an integrated cache and stalls out of order threads
- add a line cache ... sizes up dynamically with request size
- tilecache / linecache use a hash table not a linear list
- due to out of order stalling, extract_area is no longer a sequential
operation, sadly
20/7/12 started 7.30.0
- support "rs" mode in vips7

View File

@ -170,8 +170,8 @@ vips_extract_area_build( VipsObject *object )
return( 0 );
}
/* xy range we sanity check on ... just to stop crazy numbers from 1/0 etc.
* causing g_assert() failures later.
/* xy range we sanity check on ... just to stop crazy numbers from divide by 0
* etc. causing g_assert() failures later.
*/
#define RANGE (100000000)
@ -191,8 +191,6 @@ vips_extract_area_class_init( VipsExtractAreaClass *class )
vobject_class->description = _( "extract an area from an image" );
vobject_class->build = vips_extract_area_build;
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "input", 0,
_( "Input" ),
_( "Input image" ),

View File

@ -102,7 +102,7 @@ vips_sequential_generate( VipsRegion *or,
VipsRect *r = &or->valid;
VipsRegion *ir = (VipsRegion *) seq;
VIPS_DEBUG_MSG( "thread %p request for %d lines from at line %d\n",
VIPS_DEBUG_MSG( "thread %p request for %d lines, start line %d\n",
g_thread_self(), r->height, r->top );
if( sequential->trace )
@ -184,7 +184,7 @@ vips_sequential_build( VipsObject *object )
if( vips_image_copy_fields( conversion->out, t ) )
return( -1 );
vips_demand_hint( conversion->out,
VIPS_DEMAND_STYLE_FATSTRIP, t, NULL );
VIPS_DEMAND_STYLE_THINSTRIP, t, NULL );
if( vips_image_generate( conversion->out,
vips_start_one, vips_sequential_generate, vips_stop_one,
t, sequential ) )

View File

@ -48,8 +48,8 @@
*/
/*
*/
#define VIPS_DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -400,8 +400,6 @@ vips_tile_destroy( VipsTile *tile )
static void
vips_block_cache_init( VipsBlockCache *cache )
{
printf( "vips_block_cache_init\n" );
cache->tile_width = 128;
cache->tile_height = 128;
cache->max_tiles = 1000;
@ -645,6 +643,11 @@ vips_line_cache_build( VipsObject *object )
VipsBlockCache *block_cache = (VipsBlockCache *) object;
VipsLineCache *cache = (VipsLineCache *) object;
int tile_width;
int tile_height;
int nlines;
int nstrips;
VIPS_DEBUG_MSG( "vips_line_cache_build\n" );
if( VIPS_OBJECT_CLASS( vips_line_cache_parent_class )->
@ -656,6 +659,17 @@ vips_line_cache_build( VipsObject *object )
block_cache->tile_width = block_cache->in->Xsize;
block_cache->tile_height = 1;
/* Enough lines for two complete buffers.
*
* This can go up with request size, see vips_line_cache_gen().
*/
vips_get_tile_size( block_cache->in,
&tile_width, &tile_height, &nlines );
block_cache->max_tiles = 2 * nlines;
VIPS_DEBUG_MSG( "vips_line_cache_build: max_tiles = %d\n",
block_cache->max_tiles );
if( vips_image_pio_input( block_cache->in ) )
return( -1 );
@ -692,13 +706,6 @@ vips_line_cache_class_init( VipsLineCacheClass *class )
static void
vips_line_cache_init( VipsLineCache *cache )
{
printf( "vips_line_cache_init\n" );
/* This adjust with request size, see vips_line_cache_gen().
*/
((VipsBlockCache *) cache)->max_tiles = 1000;
((VipsBlockCache *) cache)->strategy = VIPS_CACHE_SEQUENTIAL;
}
/**

View File

@ -737,7 +737,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
interpretation,
xres, yres );
vips_demand_hint( out, VIPS_DEMAND_STYLE_SMALLTILE, NULL );
vips_demand_hint( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
/* Interlaced jpegs need lots of memory to read, so our caller needs
* to know.

View File

@ -1097,12 +1097,6 @@ parse_header( ReadTiff *rtiff, VipsImage *out )
(VipsCallbackFn) vips_free, data_copy, data_length );
}
/* Offer the most restrictive style. This can be changed downstream if
* necessary.
*/
vips_demand_hint( out,
VIPS_DEMAND_STYLE_THINSTRIP, NULL );
return( 0 );
}
@ -1270,14 +1264,12 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
if( parse_header( rtiff, raw ) )
return( -1 );
/* Process and save as VIPS.
*
* Even though this is a tiled reader, we hint thinstrip since with
/* Even though this is a tiled reader, we hint thinstrip since with
* the cache we are quite happy serving that if anything downstream
* would like it.
*/
vips_demand_hint( raw,
VIPS_DEMAND_STYLE_THINSTRIP, NULL );
vips_demand_hint( raw, VIPS_DEMAND_STYLE_THINSTRIP, NULL );
if( vips_image_generate( raw,
tiff_seq_start, tiff_fill_region, tiff_seq_stop,
rtiff, NULL ) )
@ -1392,8 +1384,7 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
if( parse_header( rtiff, t[0] ) )
return( -1 );
vips_demand_hint( t[0],
VIPS_DEMAND_STYLE_FATSTRIP, NULL );
vips_demand_hint( t[0], VIPS_DEMAND_STYLE_THINSTRIP, NULL );
if( !tfget32( rtiff->tiff,
TIFFTAG_ROWSPERSTRIP, &rtiff->rows_per_strip ) )

View File

@ -316,8 +316,7 @@ png2vips_header( Read *read, VipsImage *out )
/* We're always supposed to set dhint.
*/
vips_demand_hint( out,
VIPS_DEMAND_STYLE_FATSTRIP, NULL );
vips_demand_hint( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
/* Fetch the ICC profile. @name is useless, something like "icc" or
* "ICC Profile" etc. Ignore it.

View File

@ -332,7 +332,7 @@ vips_shrink_build( VipsObject *object )
* sequentiality.
*/
vips_demand_hint( resample->out,
VIPS_DEMAND_STYLE_THINSTRIP, resample->in, NULL );
VIPS_DEMAND_STYLE_ANY, resample->in, NULL );
/* Size output. Note: we round the output width down!
*/