tuning, sort out demand hints
and disable extract_area seq mode
This commit is contained in:
parent
70bde1dd1e
commit
39b05f5172
@ -13,6 +13,8 @@
|
|||||||
- VipsSequential has an integrated cache and stalls out of order threads
|
- VipsSequential has an integrated cache and stalls out of order threads
|
||||||
- add a line cache ... sizes up dynamically with request size
|
- add a line cache ... sizes up dynamically with request size
|
||||||
- tilecache / linecache use a hash table not a linear list
|
- 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
|
20/7/12 started 7.30.0
|
||||||
- support "rs" mode in vips7
|
- support "rs" mode in vips7
|
||||||
|
@ -170,8 +170,8 @@ vips_extract_area_build( VipsObject *object )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* xy range we sanity check on ... just to stop crazy numbers from 1/0 etc.
|
/* xy range we sanity check on ... just to stop crazy numbers from divide by 0
|
||||||
* causing g_assert() failures later.
|
* etc. causing g_assert() failures later.
|
||||||
*/
|
*/
|
||||||
#define RANGE (100000000)
|
#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->description = _( "extract an area from an image" );
|
||||||
vobject_class->build = vips_extract_area_build;
|
vobject_class->build = vips_extract_area_build;
|
||||||
|
|
||||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
|
|
||||||
|
|
||||||
VIPS_ARG_IMAGE( class, "input", 0,
|
VIPS_ARG_IMAGE( class, "input", 0,
|
||||||
_( "Input" ),
|
_( "Input" ),
|
||||||
_( "Input image" ),
|
_( "Input image" ),
|
||||||
|
@ -102,7 +102,7 @@ vips_sequential_generate( VipsRegion *or,
|
|||||||
VipsRect *r = &or->valid;
|
VipsRect *r = &or->valid;
|
||||||
VipsRegion *ir = (VipsRegion *) seq;
|
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 );
|
g_thread_self(), r->height, r->top );
|
||||||
|
|
||||||
if( sequential->trace )
|
if( sequential->trace )
|
||||||
@ -184,7 +184,7 @@ vips_sequential_build( VipsObject *object )
|
|||||||
if( vips_image_copy_fields( conversion->out, t ) )
|
if( vips_image_copy_fields( conversion->out, t ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
vips_demand_hint( conversion->out,
|
vips_demand_hint( conversion->out,
|
||||||
VIPS_DEMAND_STYLE_FATSTRIP, t, NULL );
|
VIPS_DEMAND_STYLE_THINSTRIP, t, NULL );
|
||||||
if( vips_image_generate( conversion->out,
|
if( vips_image_generate( conversion->out,
|
||||||
vips_start_one, vips_sequential_generate, vips_stop_one,
|
vips_start_one, vips_sequential_generate, vips_stop_one,
|
||||||
t, sequential ) )
|
t, sequential ) )
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
|
||||||
#define VIPS_DEBUG
|
#define VIPS_DEBUG
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -400,8 +400,6 @@ vips_tile_destroy( VipsTile *tile )
|
|||||||
static void
|
static void
|
||||||
vips_block_cache_init( VipsBlockCache *cache )
|
vips_block_cache_init( VipsBlockCache *cache )
|
||||||
{
|
{
|
||||||
printf( "vips_block_cache_init\n" );
|
|
||||||
|
|
||||||
cache->tile_width = 128;
|
cache->tile_width = 128;
|
||||||
cache->tile_height = 128;
|
cache->tile_height = 128;
|
||||||
cache->max_tiles = 1000;
|
cache->max_tiles = 1000;
|
||||||
@ -645,6 +643,11 @@ vips_line_cache_build( VipsObject *object )
|
|||||||
VipsBlockCache *block_cache = (VipsBlockCache *) object;
|
VipsBlockCache *block_cache = (VipsBlockCache *) object;
|
||||||
VipsLineCache *cache = (VipsLineCache *) object;
|
VipsLineCache *cache = (VipsLineCache *) object;
|
||||||
|
|
||||||
|
int tile_width;
|
||||||
|
int tile_height;
|
||||||
|
int nlines;
|
||||||
|
int nstrips;
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "vips_line_cache_build\n" );
|
VIPS_DEBUG_MSG( "vips_line_cache_build\n" );
|
||||||
|
|
||||||
if( VIPS_OBJECT_CLASS( vips_line_cache_parent_class )->
|
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_width = block_cache->in->Xsize;
|
||||||
block_cache->tile_height = 1;
|
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 ) )
|
if( vips_image_pio_input( block_cache->in ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -692,13 +706,6 @@ vips_line_cache_class_init( VipsLineCacheClass *class )
|
|||||||
static void
|
static void
|
||||||
vips_line_cache_init( VipsLineCache *cache )
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -737,7 +737,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
|
|||||||
interpretation,
|
interpretation,
|
||||||
xres, yres );
|
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
|
/* Interlaced jpegs need lots of memory to read, so our caller needs
|
||||||
* to know.
|
* to know.
|
||||||
|
@ -1097,12 +1097,6 @@ parse_header( ReadTiff *rtiff, VipsImage *out )
|
|||||||
(VipsCallbackFn) vips_free, data_copy, data_length );
|
(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 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1270,14 +1264,12 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
|
|||||||
if( parse_header( rtiff, raw ) )
|
if( parse_header( rtiff, raw ) )
|
||||||
return( -1 );
|
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
|
* the cache we are quite happy serving that if anything downstream
|
||||||
* would like it.
|
* would like it.
|
||||||
*/
|
*/
|
||||||
vips_demand_hint( raw,
|
vips_demand_hint( raw, VIPS_DEMAND_STYLE_THINSTRIP, NULL );
|
||||||
VIPS_DEMAND_STYLE_THINSTRIP, NULL );
|
|
||||||
if( vips_image_generate( raw,
|
if( vips_image_generate( raw,
|
||||||
tiff_seq_start, tiff_fill_region, tiff_seq_stop,
|
tiff_seq_start, tiff_fill_region, tiff_seq_stop,
|
||||||
rtiff, NULL ) )
|
rtiff, NULL ) )
|
||||||
@ -1392,8 +1384,7 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
|
|||||||
if( parse_header( rtiff, t[0] ) )
|
if( parse_header( rtiff, t[0] ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
vips_demand_hint( t[0],
|
vips_demand_hint( t[0], VIPS_DEMAND_STYLE_THINSTRIP, NULL );
|
||||||
VIPS_DEMAND_STYLE_FATSTRIP, NULL );
|
|
||||||
|
|
||||||
if( !tfget32( rtiff->tiff,
|
if( !tfget32( rtiff->tiff,
|
||||||
TIFFTAG_ROWSPERSTRIP, &rtiff->rows_per_strip ) )
|
TIFFTAG_ROWSPERSTRIP, &rtiff->rows_per_strip ) )
|
||||||
|
@ -316,8 +316,7 @@ png2vips_header( Read *read, VipsImage *out )
|
|||||||
|
|
||||||
/* We're always supposed to set dhint.
|
/* We're always supposed to set dhint.
|
||||||
*/
|
*/
|
||||||
vips_demand_hint( out,
|
vips_demand_hint( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
|
||||||
VIPS_DEMAND_STYLE_FATSTRIP, NULL );
|
|
||||||
|
|
||||||
/* Fetch the ICC profile. @name is useless, something like "icc" or
|
/* Fetch the ICC profile. @name is useless, something like "icc" or
|
||||||
* "ICC Profile" etc. Ignore it.
|
* "ICC Profile" etc. Ignore it.
|
||||||
|
@ -332,7 +332,7 @@ vips_shrink_build( VipsObject *object )
|
|||||||
* sequentiality.
|
* sequentiality.
|
||||||
*/
|
*/
|
||||||
vips_demand_hint( resample->out,
|
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!
|
/* Size output. Note: we round the output width down!
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user