add nocache flag, use for sequential file ops
stop it caching sequential file read (eg. sequential tiff read), since you can only read sequentially once
This commit is contained in:
parent
b6f902560f
commit
1ee48e4cd6
@ -4,6 +4,7 @@
|
||||
- much faster vips_argument_map()
|
||||
- make jpeg pyramids work with tiff4
|
||||
- tiff loader always offers THINSTRIP (thanks Diuming)
|
||||
- add "nocache" operation flag, set for sequential load (thanks Diuming)
|
||||
|
||||
19/4/12 started 7.28.5
|
||||
- ifthenelse blend mode was broken
|
||||
|
@ -698,6 +698,10 @@ vips_foreign_load_temp( VipsForeignLoad *load )
|
||||
printf( "vips_foreign_load_temp: partial sequential temp\n" );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
/* You can't reuse sequential operations.
|
||||
*/
|
||||
vips_operation_set_nocache( VIPS_OPERATION( load ), TRUE );
|
||||
|
||||
return( vips_image_new() );
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,12 @@ typedef struct _VipsOperation {
|
||||
guint hash;
|
||||
gboolean found_hash;
|
||||
|
||||
/* Set this before the end of _build() to stop this operation from
|
||||
* being cached. Some things, like sequential read from a TIFF file,
|
||||
* can't be reused.
|
||||
*/
|
||||
gboolean nocache;
|
||||
|
||||
} VipsOperation;
|
||||
|
||||
typedef struct _VipsOperationClass {
|
||||
@ -89,6 +95,7 @@ void vips_call_options( GOptionGroup *group, VipsOperation *operation );
|
||||
int vips_call_argv( VipsOperation *operation, int argc, char **argv );
|
||||
|
||||
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_set_max( int max );
|
||||
|
@ -621,7 +621,7 @@ vips_cache_operation_buildp( VipsOperation **operation )
|
||||
|
||||
#ifdef VIPS_DEBUG
|
||||
printf( "vips_cache_operation_build: " );
|
||||
vips_object_print_summary_stdout( VIPS_OBJECT( *operation ) );
|
||||
vips_object_print_dump( VIPS_OBJECT( *operation ) );
|
||||
#endif /*VIPS_DEBUG*/
|
||||
|
||||
vips_cache_init();
|
||||
@ -643,15 +643,22 @@ vips_cache_operation_buildp( VipsOperation **operation )
|
||||
}
|
||||
else {
|
||||
if( vips__cache_trace ) {
|
||||
printf( "vips cache: miss %p\n ", *operation );
|
||||
if( (*operation)->nocache )
|
||||
printf( "vips cache: uncacheable %p\n ",
|
||||
*operation );
|
||||
else
|
||||
printf( "vips cache: miss %p\n ", *operation );
|
||||
vips_object_print_summary( VIPS_OBJECT( *operation ) );
|
||||
}
|
||||
|
||||
if( vips_object_build( VIPS_OBJECT( *operation ) ) )
|
||||
return( -1 );
|
||||
|
||||
vips_cache_ref( *operation );
|
||||
g_hash_table_insert( vips_cache_table, *operation, *operation );
|
||||
if( !(*operation)->nocache ) {
|
||||
vips_cache_ref( *operation );
|
||||
g_hash_table_insert( vips_cache_table,
|
||||
*operation, *operation );
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -946,3 +946,23 @@ vips_call_argv( VipsOperation *operation, int argc, char **argv )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_operation_set_nocache:
|
||||
* @operation: operation to set
|
||||
* @nocache: TRUE means don't cache this operation
|
||||
*
|
||||
* Set this before the end of _build() to stop this operation being cached.
|
||||
* Some operations, like sequential read from a TIFF file, for example, cannot
|
||||
* be reused.
|
||||
*/
|
||||
void
|
||||
vips_operation_set_nocache( VipsOperation *operation, gboolean nocache )
|
||||
{
|
||||
#ifdef VIPS_DEBUG
|
||||
printf( "vips_operation_set_nocache: " );
|
||||
vips_object_print_name( VIPS_OBJECT( operation ) );
|
||||
printf( " %d\n", nocache );
|
||||
#endif /*VIPS_DEBUG*/
|
||||
|
||||
operation->nocache = nocache;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user