much faster handling of missing heif thumbnails
Fetching the thumbnail from a heif image without a thumbnail used to reselect the image for each scanline, which was horribly slow. Thanks Kleis!
This commit is contained in:
parent
a92f0ed504
commit
1ef1b2d987
|
@ -9,6 +9,9 @@
|
||||||
* - close early on error
|
* - close early on error
|
||||||
* 1/9/19 [meyermarcel]
|
* 1/9/19 [meyermarcel]
|
||||||
* - handle alpha
|
* - handle alpha
|
||||||
|
* 30/9/19
|
||||||
|
* - much faster handling of thumbnail=TRUE and missing thumbnail ... we
|
||||||
|
* were reselecting the image for each scanline
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -216,6 +219,11 @@ static int
|
||||||
vips_foreign_load_heif_set_page( VipsForeignLoadHeif *heif,
|
vips_foreign_load_heif_set_page( VipsForeignLoadHeif *heif,
|
||||||
int page_no, gboolean thumbnail )
|
int page_no, gboolean thumbnail )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf( "vips_foreign_load_heif_set_page: %d, thumbnail = %d\n",
|
||||||
|
page_no, thumbnail );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !heif->handle ||
|
if( !heif->handle ||
|
||||||
page_no != heif->page_no ||
|
page_no != heif->page_no ||
|
||||||
thumbnail != heif->thumbnail_set ) {
|
thumbnail != heif->thumbnail_set ) {
|
||||||
|
@ -253,8 +261,17 @@ vips_foreign_load_heif_set_page( VipsForeignLoadHeif *heif,
|
||||||
VIPS_FREEF( heif_image_handle_release,
|
VIPS_FREEF( heif_image_handle_release,
|
||||||
heif->handle );
|
heif->handle );
|
||||||
heif->handle = thumb_handle;
|
heif->handle = thumb_handle;
|
||||||
heif->thumbnail_set = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we were asked to select the thumbnail, say we
|
||||||
|
* did, even if there are no thumbnails and we just
|
||||||
|
* selected the main image.
|
||||||
|
*
|
||||||
|
* If we don't do this, next time around in _generate
|
||||||
|
* we'll try to select the thumbnail again, which will
|
||||||
|
* be horribly slow.
|
||||||
|
*/
|
||||||
|
heif->thumbnail_set = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
heif->page_no = page_no;
|
heif->page_no = page_no;
|
||||||
|
|
Loading…
Reference in New Issue