fix some tilecache issues too
This commit is contained in:
parent
d156e34ee4
commit
044abe7986
@ -22,6 +22,7 @@
|
|||||||
- add @option_string param to thumbnail_buffer [kleisauke]
|
- add @option_string param to thumbnail_buffer [kleisauke]
|
||||||
- add XMP, IPCT, ICC, EXIF etc. support to magickload/magicksave
|
- add XMP, IPCT, ICC, EXIF etc. support to magickload/magicksave
|
||||||
- much lower memuse for gifload
|
- much lower memuse for gifload
|
||||||
|
- tilecache speedups
|
||||||
|
|
||||||
4/1/19 started 8.7.4
|
4/1/19 started 8.7.4
|
||||||
- magickload with magick6 API did not chain exceptions correctly causing a
|
- magickload with magick6 API did not chain exceptions correctly causing a
|
||||||
|
@ -218,6 +218,7 @@ vips_tile_new( VipsBlockCache *cache, int x, int y )
|
|||||||
tile->pos.width = cache->tile_width;
|
tile->pos.width = cache->tile_width;
|
||||||
tile->pos.height = cache->tile_height;
|
tile->pos.height = cache->tile_height;
|
||||||
g_hash_table_insert( cache->tiles, &tile->pos, tile );
|
g_hash_table_insert( cache->tiles, &tile->pos, tile );
|
||||||
|
g_queue_push_tail( tile->cache->recycle, tile );
|
||||||
g_assert( cache->ntiles >= 0 );
|
g_assert( cache->ntiles >= 0 );
|
||||||
cache->ntiles += 1;
|
cache->ntiles += 1;
|
||||||
|
|
||||||
@ -318,10 +319,12 @@ vips_tile_unlocked( gpointer key, gpointer value, gpointer user_data )
|
|||||||
static void
|
static void
|
||||||
vips_block_cache_minimise( VipsImage *image, VipsBlockCache *cache )
|
vips_block_cache_minimise( VipsImage *image, VipsBlockCache *cache )
|
||||||
{
|
{
|
||||||
/* We can't drop tiles that are in use.
|
printf( "vips_block_cache_minimise:\n" );
|
||||||
*/
|
|
||||||
g_mutex_lock( cache->lock );
|
g_mutex_lock( cache->lock );
|
||||||
|
|
||||||
|
/* We can't drop tiles that are in use.
|
||||||
|
*/
|
||||||
g_hash_table_foreach_remove( cache->tiles,
|
g_hash_table_foreach_remove( cache->tiles,
|
||||||
vips_tile_unlocked, NULL );
|
vips_tile_unlocked, NULL );
|
||||||
|
|
||||||
@ -434,6 +437,12 @@ vips_tile_destroy( VipsTile *tile )
|
|||||||
VIPS_DEBUG_MSG_RED( "vips_tile_destroy: tile %d, %d (%p)\n",
|
VIPS_DEBUG_MSG_RED( "vips_tile_destroy: tile %d, %d (%p)\n",
|
||||||
tile->pos.left, tile->pos.top, tile );
|
tile->pos.left, tile->pos.top, tile );
|
||||||
|
|
||||||
|
/* 0 ref tiles should be on the recycle list.
|
||||||
|
*/
|
||||||
|
g_assert( tile->ref_count == 0 );
|
||||||
|
g_assert( g_queue_find( tile->cache->recycle, tile ) );
|
||||||
|
g_queue_remove( cache->recycle, tile );
|
||||||
|
|
||||||
cache->ntiles -= 1;
|
cache->ntiles -= 1;
|
||||||
g_assert( cache->ntiles >= 0 );
|
g_assert( cache->ntiles >= 0 );
|
||||||
tile->cache = NULL;
|
tile->cache = NULL;
|
||||||
|
@ -52,9 +52,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define VIPS_DEBUG
|
|
||||||
#define DEBUG_VERBOSE
|
#define DEBUG_VERBOSE
|
||||||
*/
|
*/
|
||||||
|
#define VIPS_DEBUG
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -741,23 +741,32 @@ vips_foreign_load_gif_render( VipsForeignLoadGif *gif )
|
|||||||
*
|
*
|
||||||
* Otherwise, we must update previous.
|
* Otherwise, we must update previous.
|
||||||
*/
|
*/
|
||||||
if( gif->dispose == DISPOSE_BACKGROUND )
|
if( gif->dispose == DISPOSE_BACKGROUND ) {
|
||||||
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_render: "
|
||||||
|
"dispose clear to zero\n" );
|
||||||
memset( VIPS_IMAGE_ADDR( gif->frame, 0, 0 ), 0,
|
memset( VIPS_IMAGE_ADDR( gif->frame, 0, 0 ), 0,
|
||||||
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
||||||
else if( gif->dispose == DISPOSE_PREVIOUS )
|
}
|
||||||
|
else if( gif->dispose == DISPOSE_PREVIOUS ) {
|
||||||
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_render: "
|
||||||
|
"dispose restore from previous\n" );
|
||||||
memcpy( VIPS_IMAGE_ADDR( gif->frame, 0, 0 ),
|
memcpy( VIPS_IMAGE_ADDR( gif->frame, 0, 0 ),
|
||||||
VIPS_IMAGE_ADDR( gif->previous, 0, 0 ),
|
VIPS_IMAGE_ADDR( gif->previous, 0, 0 ),
|
||||||
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_render: "
|
||||||
|
"dispose copy to previous\n" );
|
||||||
memcpy( VIPS_IMAGE_ADDR( gif->previous, 0, 0 ),
|
memcpy( VIPS_IMAGE_ADDR( gif->previous, 0, 0 ),
|
||||||
VIPS_IMAGE_ADDR( gif->frame, 0, 0 ),
|
VIPS_IMAGE_ADDR( gif->frame, 0, 0 ),
|
||||||
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
VIPS_IMAGE_SIZEOF_IMAGE( gif->frame ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( file->Image.Interlace ) {
|
if( file->Image.Interlace ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "gifload: interlaced frame of "
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_render: "
|
||||||
"%d x %d pixels at %d x %d\n",
|
"interlaced frame of %d x %d pixels at %d x %d\n",
|
||||||
file->Image.Width, file->Image.Height,
|
file->Image.Width, file->Image.Height,
|
||||||
file->Image.Left, file->Image.Top );
|
file->Image.Left, file->Image.Top );
|
||||||
|
|
||||||
@ -784,8 +793,8 @@ vips_foreign_load_gif_render( VipsForeignLoadGif *gif )
|
|||||||
else {
|
else {
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "gifload: non-interlaced frame of "
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_render: "
|
||||||
"%d x %d pixels at %d x %d\n",
|
"non-interlaced frame of %d x %d pixels at %d x %d\n",
|
||||||
file->Image.Width, file->Image.Height,
|
file->Image.Width, file->Image.Height,
|
||||||
file->Image.Left, file->Image.Top );
|
file->Image.Left, file->Image.Top );
|
||||||
|
|
||||||
@ -813,7 +822,7 @@ vips_foreign_load_gif_extension( VipsForeignLoadGif *gif )
|
|||||||
GifByteType *extension;
|
GifByteType *extension;
|
||||||
int ext_code;
|
int ext_code;
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "gifload: EXTENSION_RECORD_TYPE\n" );
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_extension:\n" );
|
||||||
|
|
||||||
if( DGifGetExtension( gif->file, &ext_code, &extension ) ==
|
if( DGifGetExtension( gif->file, &ext_code, &extension ) ==
|
||||||
GIF_ERROR ) {
|
GIF_ERROR ) {
|
||||||
@ -836,6 +845,8 @@ vips_foreign_load_gif_extension( VipsForeignLoadGif *gif )
|
|||||||
* to set the meaning of background and transparent pixels.
|
* to set the meaning of background and transparent pixels.
|
||||||
*/
|
*/
|
||||||
gif->dispose = (extension[1] >> 2) & 0x7;
|
gif->dispose = (extension[1] >> 2) & 0x7;
|
||||||
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_extension: "
|
||||||
|
"dispose = %d\n", gif->dispose );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( extension != NULL )
|
while( extension != NULL )
|
||||||
@ -862,7 +873,8 @@ vips_foreign_load_gif_next_page( VipsForeignLoadGif *gif )
|
|||||||
|
|
||||||
switch( record ) {
|
switch( record ) {
|
||||||
case IMAGE_DESC_RECORD_TYPE:
|
case IMAGE_DESC_RECORD_TYPE:
|
||||||
VIPS_DEBUG_MSG( "gifload: IMAGE_DESC_RECORD_TYPE\n" );
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_next_page: "
|
||||||
|
"IMAGE_DESC_RECORD_TYPE\n" );
|
||||||
|
|
||||||
if( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {
|
if( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {
|
||||||
vips_foreign_load_gif_error( gif );
|
vips_foreign_load_gif_error( gif );
|
||||||
@ -882,16 +894,19 @@ vips_foreign_load_gif_next_page( VipsForeignLoadGif *gif )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TERMINATE_RECORD_TYPE:
|
case TERMINATE_RECORD_TYPE:
|
||||||
VIPS_DEBUG_MSG( "gifload: TERMINATE_RECORD_TYPE\n" );
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_next_page: "
|
||||||
|
"TERMINATE_RECORD_TYPE\n" );
|
||||||
gif->eof = TRUE;
|
gif->eof = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCREEN_DESC_RECORD_TYPE:
|
case SCREEN_DESC_RECORD_TYPE:
|
||||||
VIPS_DEBUG_MSG( "gifload: SCREEN_DESC_RECORD_TYPE\n" );
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_next_page: "
|
||||||
|
"SCREEN_DESC_RECORD_TYPE\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNDEFINED_RECORD_TYPE:
|
case UNDEFINED_RECORD_TYPE:
|
||||||
VIPS_DEBUG_MSG( "gifload: UNDEFINED_RECORD_TYPE\n" );
|
VIPS_DEBUG_MSG( "vips_foreign_load_gif_next_page: "
|
||||||
|
"UNDEFINED_RECORD_TYPE\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -921,7 +936,7 @@ vips_foreign_load_gif_generate( VipsRegion *or,
|
|||||||
VipsPel *p, *q;
|
VipsPel *p, *q;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
g_assert( line >= 0 && lines < gif->frame->Ysize );
|
g_assert( line >= 0 && line < gif->frame->Ysize );
|
||||||
g_assert( page >= 0 && page < gif->n_pages );
|
g_assert( page >= 0 && page < gif->n_pages );
|
||||||
|
|
||||||
/* current_page == 0 means we've not loaded any pages yet. So
|
/* current_page == 0 means we've not loaded any pages yet. So
|
||||||
@ -997,6 +1012,8 @@ vips_foreign_load_gif_load( VipsForeignLoad *load )
|
|||||||
if( class->open( gif ) )
|
if( class->open( gif ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
printf( "vips_foreign_load_gif_load:\n" );
|
||||||
|
|
||||||
/* Make the memory image we accumulate pixels in. We always accumulate
|
/* Make the memory image we accumulate pixels in. We always accumulate
|
||||||
* to RGBA, then trim down to whatever the output image needs on
|
* to RGBA, then trim down to whatever the output image needs on
|
||||||
* _generate.
|
* _generate.
|
||||||
|
Loading…
Reference in New Issue
Block a user