extract is sequential again
a hack in seq.c will skip ahead if the very first read is not at line 0
This commit is contained in:
parent
89065b391a
commit
4ef825014d
@ -13,8 +13,6 @@
|
||||
- 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
|
||||
|
@ -191,6 +191,8 @@ 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" ),
|
||||
|
@ -115,8 +115,10 @@ retry:
|
||||
|
||||
VIPS_DEBUG_MSG( "thread %p has lock ...\n", g_thread_self() );
|
||||
|
||||
if( r->top > sequential->y_pos ) {
|
||||
/* This is for stuff in the future, stall.
|
||||
if( r->top > sequential->y_pos &&
|
||||
sequential->y_pos > 0 ) {
|
||||
/* We have started reading (y_pos > 0) and this request is for
|
||||
* stuff beyond that, stall.
|
||||
*/
|
||||
VIPS_DEBUG_MSG( "thread %p stalling ...\n", g_thread_self() );
|
||||
g_cond_wait( sequential->ready, sequential->lock );
|
||||
@ -126,6 +128,28 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/* This is a request for something some way down the image, and we've
|
||||
* not read anything yet. Probably the operation is something like
|
||||
* extract_area and we should skip the initial part of the image. In
|
||||
* fact we read to cache.
|
||||
*/
|
||||
if( r->top > sequential->y_pos ) {
|
||||
VipsRect area;
|
||||
|
||||
VIPS_DEBUG_MSG( "thread %p skipping to line %d ...\n",
|
||||
g_thread_self(),
|
||||
r->top );
|
||||
|
||||
area.left = 0;
|
||||
area.top = sequential->y_pos;
|
||||
area.width = 1;
|
||||
area.height = r->top - sequential->y_pos;
|
||||
if( vips_region_prepare( ir, &area ) )
|
||||
return( -1 );
|
||||
|
||||
sequential->y_pos = VIPS_RECT_BOTTOM( &area );
|
||||
}
|
||||
|
||||
/* This is a request for old or present pixels -- serve from cache.
|
||||
* This may trigger further, sequential reads.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user