tiny cleanup
some left-over pyramid detection code in tiff2vips
This commit is contained in:
parent
53b43e0497
commit
8482aa3ff1
@ -2345,25 +2345,7 @@ rtiff_new_buffer( const void *buf, size_t len, VipsImage *out,
|
||||
return( rtiff );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
FIXME ... Unused for now, perhaps if we add another format flag.
|
||||
|
||||
static int
|
||||
istiffpyramid( const char *name )
|
||||
{
|
||||
TIFF *tif;
|
||||
|
||||
vips__tiff_init();
|
||||
|
||||
if( (tif = get_directory( name, 2 )) ) {
|
||||
// We can see page 2 ... assume it is.
|
||||
TIFFClose( tif );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
/* For istiffpyramid(), see vips_thumbnail_get_tiff_pyramid().
|
||||
*/
|
||||
|
||||
int
|
||||
@ -2379,7 +2361,8 @@ vips__tiff_read( const char *filename, VipsImage *out,
|
||||
|
||||
vips__tiff_init();
|
||||
|
||||
if( !(rtiff = rtiff_new_filename( filename, out, page, n, autorotate )) )
|
||||
if( !(rtiff = rtiff_new_filename( filename, out,
|
||||
page, n, autorotate )) )
|
||||
return( -1 );
|
||||
|
||||
if( rtiff->header.tiled ) {
|
||||
@ -2394,7 +2377,7 @@ vips__tiff_read( const char *filename, VipsImage *out,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* On a header-only read, we can just swap width/height if orientaion is 6 or
|
||||
/* On a header-only read, we can just swap width/height if orientation is 6 or
|
||||
* 8.
|
||||
*/
|
||||
static void
|
||||
|
@ -226,6 +226,7 @@ vips_thumbnail_read_header( VipsThumbnail *thumbnail, VipsImage *image )
|
||||
}
|
||||
|
||||
/* This may not be a pyr tiff, so no error if we can't find the layers.
|
||||
* We just look for two or more pages following roughly /2 shrinks.
|
||||
*/
|
||||
static void
|
||||
vips_thumbnail_get_tiff_pyramid( VipsThumbnail *thumbnail )
|
||||
@ -233,6 +234,11 @@ vips_thumbnail_get_tiff_pyramid( VipsThumbnail *thumbnail )
|
||||
VipsThumbnailClass *class = VIPS_THUMBNAIL_GET_CLASS( thumbnail );
|
||||
int i;
|
||||
|
||||
/* Only one page? Can't be.
|
||||
*/
|
||||
if( thumbnail->n_pages < 2 )
|
||||
return;
|
||||
|
||||
for( i = 0; i < thumbnail->n_pages; i++ ) {
|
||||
VipsImage *page;
|
||||
int level_width;
|
||||
@ -246,9 +252,6 @@ vips_thumbnail_get_tiff_pyramid( VipsThumbnail *thumbnail )
|
||||
level_height = page->Ysize;
|
||||
VIPS_UNREF( page );
|
||||
|
||||
/* Try to sanity-check the size of the pages. Do they look
|
||||
* like a pyramid?
|
||||
*/
|
||||
expected_level_width = thumbnail->input_width / (1 << i);
|
||||
expected_level_height = thumbnail->input_height / (1 << i);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user