add sequential mode to vips7
the tiff and jpg readers let you give :seq as well
This commit is contained in:
parent
daac11b01c
commit
3694a2edc5
@ -8,6 +8,7 @@
|
|||||||
- vipsthumbnail no longer removes profiles by default
|
- vipsthumbnail no longer removes profiles by default
|
||||||
- much more gentle sharpening in thumbnails
|
- much more gentle sharpening in thumbnails
|
||||||
- added "minimise" signal, used by tilecache to drop
|
- added "minimise" signal, used by tilecache to drop
|
||||||
|
- add :seq support to im_tiff2vips(), im_jpeg2vips() ... helps ruby-vips
|
||||||
|
|
||||||
18/6/12 started 7.28.9
|
18/6/12 started 7.28.9
|
||||||
- slightly more memory debugging output
|
- slightly more memory debugging output
|
||||||
|
9
TODO
9
TODO
@ -1,9 +1,10 @@
|
|||||||
- tile cache doesn't need to copy if request fits within a tile
|
- vips_image_minimise_all( im );
|
||||||
|
|
||||||
though doing a copy means that we can safely drop the cache without leaving
|
call this at the end of thereadpool_run(), doesnt seem to trigger the
|
||||||
dangling pointers
|
minimise callback on tilecache?
|
||||||
|
|
||||||
|
it does trigger it if we turn OFF seq mode??! how odd
|
||||||
|
|
||||||
- could jpeg load via memory buffer support minimise too?
|
|
||||||
|
|
||||||
|
|
||||||
blocking bugs
|
blocking bugs
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
* - use im_prepare_to() and avoid making a sequence for every cache tile
|
* - use im_prepare_to() and avoid making a sequence for every cache tile
|
||||||
* 5/12/11
|
* 5/12/11
|
||||||
* - rework as a class
|
* - rework as a class
|
||||||
|
* 23/6/12
|
||||||
|
* - listen for "minimise" signal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -346,6 +348,14 @@ vips_tile_cache_gen( VipsRegion *or,
|
|||||||
|
|
||||||
g_mutex_lock( cache->lock );
|
g_mutex_lock( cache->lock );
|
||||||
|
|
||||||
|
/* If the output region fits within a tile (tiles can become quite
|
||||||
|
* large for seq caches, for example), we could save a copy by routing
|
||||||
|
* the output region directly to the tile.
|
||||||
|
*
|
||||||
|
* However this would mean that tile drop on minimise could then leave
|
||||||
|
* dangling pointers, if minimuse was called on an active pipeline.
|
||||||
|
*/
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "vips_tile_cache_gen: "
|
VIPS_DEBUG_MSG( "vips_tile_cache_gen: "
|
||||||
"left = %d, top = %d, width = %d, height = %d\n",
|
"left = %d, top = %d, width = %d, height = %d\n",
|
||||||
r->left, r->top, r->width, r->height );
|
r->left, r->top, r->width, r->height );
|
||||||
@ -383,8 +393,6 @@ vips_tile_cache_gen( VipsRegion *or,
|
|||||||
static void
|
static void
|
||||||
vips_tile_cache_minimise( VipsImage *image, VipsTileCache *cache )
|
vips_tile_cache_minimise( VipsImage *image, VipsTileCache *cache )
|
||||||
{
|
{
|
||||||
printf( "vips_tile_cache_minimise:\n" );
|
|
||||||
|
|
||||||
vips_tile_cache_drop_all( cache );
|
vips_tile_cache_drop_all( cache );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
char *p, *q;
|
char *p, *q;
|
||||||
int shrink;
|
int shrink;
|
||||||
gboolean fail_on_warn;
|
gboolean fail_on_warn;
|
||||||
|
gboolean sequential;
|
||||||
VipsImage *t;
|
VipsImage *t;
|
||||||
|
|
||||||
/* By default, we ignore any warnings. We want to get as much of
|
/* By default, we ignore any warnings. We want to get as much of
|
||||||
@ -64,6 +65,7 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
im_filename_split( name, filename, mode );
|
im_filename_split( name, filename, mode );
|
||||||
p = &mode[0];
|
p = &mode[0];
|
||||||
shrink = 1;
|
shrink = 1;
|
||||||
|
sequential = FALSE;
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
shrink = atoi( q );
|
shrink = atoi( q );
|
||||||
|
|
||||||
@ -78,10 +80,15 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
if( im_isprefix( "fail", q ) )
|
if( im_isprefix( "fail", q ) )
|
||||||
fail_on_warn = TRUE;
|
fail_on_warn = TRUE;
|
||||||
}
|
}
|
||||||
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
|
if( im_isprefix( "seq", q ) )
|
||||||
|
sequential = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_jpegload( filename, &t,
|
if( vips_jpegload( filename, &t,
|
||||||
"shrink", shrink,
|
"shrink", shrink,
|
||||||
"fail", fail_on_warn,
|
"fail", fail_on_warn,
|
||||||
|
"sequential", sequential,
|
||||||
NULL ) )
|
NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ im_tiff2vips( const char *name, IMAGE *out )
|
|||||||
char mode[FILENAME_MAX];
|
char mode[FILENAME_MAX];
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int page;
|
int page;
|
||||||
|
gboolean sequential;
|
||||||
VipsImage *t;
|
VipsImage *t;
|
||||||
|
|
||||||
im_filename_split( name, filename, mode );
|
im_filename_split( name, filename, mode );
|
||||||
@ -64,9 +65,14 @@ im_tiff2vips( const char *name, IMAGE *out )
|
|||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
page = atoi( q );
|
page = atoi( q );
|
||||||
}
|
}
|
||||||
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
|
if( im_isprefix( "seq", q ) )
|
||||||
|
sequential = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_tiffload( filename, &t,
|
if( vips_tiffload( filename, &t,
|
||||||
"page", page,
|
"page", page,
|
||||||
|
"sequential", sequential,
|
||||||
NULL ) )
|
NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_image_write( t, out ) ) {
|
if( vips_image_write( t, out ) ) {
|
||||||
|
@ -782,6 +782,12 @@ vips_foreign_load_start( VipsImage *out, void *a, void *b )
|
|||||||
*/
|
*/
|
||||||
if( !vips_foreign_load_iscompat( load->real, out ) )
|
if( !vips_foreign_load_iscompat( load->real, out ) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
|
/* We have to tell vips that out depends on real. We've set
|
||||||
|
* the demand hint below, but not given an input there.
|
||||||
|
*/
|
||||||
|
vips_demand_hint( load->out, load->out->dhint,
|
||||||
|
load->real, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( vips_region_new( load->real ) );
|
return( vips_region_new( load->real ) );
|
||||||
|
@ -905,7 +905,7 @@ read_jpeg_image( ReadJpeg *jpeg, VipsImage *out )
|
|||||||
jpeg->decompressing = TRUE;
|
jpeg->decompressing = TRUE;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf( "read_jpeg_image: starting deompress\n" );
|
printf( "read_jpeg_image: starting decompress\n" );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( vips_image_generate( t[0],
|
if( vips_image_generate( t[0],
|
||||||
|
@ -329,7 +329,7 @@ vips_demand_hint_array( VipsImage *image, VipsDemandStyle hint, VipsImage **in )
|
|||||||
for( i = 0; i < len; i++ )
|
for( i = 0; i < len; i++ )
|
||||||
vips__link_make( in[i], image );
|
vips__link_make( in[i], image );
|
||||||
|
|
||||||
/* Set a flag on the image to say we remember to call this thing.
|
/* Set a flag on the image to say we remembered to call this thing.
|
||||||
* vips_image_generate() and friends check this.
|
* vips_image_generate() and friends check this.
|
||||||
*/
|
*/
|
||||||
image->hint_set = TRUE;
|
image->hint_set = TRUE;
|
||||||
|
@ -1111,8 +1111,6 @@ vips_image_minimise_all_cb( VipsImage *image )
|
|||||||
void
|
void
|
||||||
vips_image_minimise_all( VipsImage *image )
|
vips_image_minimise_all( VipsImage *image )
|
||||||
{
|
{
|
||||||
printf( "vips_image_minimise_all:\n" );
|
|
||||||
|
|
||||||
(void) vips__link_map( image, TRUE,
|
(void) vips__link_map( image, TRUE,
|
||||||
(VipsSListMap2Fn) vips_image_minimise_all_cb, NULL, NULL );
|
(VipsSListMap2Fn) vips_image_minimise_all_cb, NULL, NULL );
|
||||||
}
|
}
|
||||||
|
@ -913,8 +913,6 @@ vips_threadpool_run( VipsImage *im,
|
|||||||
|
|
||||||
vips_threadpool_free( pool );
|
vips_threadpool_free( pool );
|
||||||
|
|
||||||
/* Ask the pipeline to drop into low-mem-use mode now we're done.
|
|
||||||
*/
|
|
||||||
vips_image_minimise_all( im );
|
vips_image_minimise_all( im );
|
||||||
|
|
||||||
return( result );
|
return( result );
|
||||||
|
Loading…
Reference in New Issue
Block a user