seems to work!

This commit is contained in:
John Cupitt 2017-01-27 16:43:37 +00:00
parent 9cc868a7e3
commit 2b482fc2cf
3 changed files with 19 additions and 3 deletions

View File

@ -30,6 +30,7 @@
- add @max_slope to vips_hist_local() to implement CLAHE, thanks hunter-87 - add @max_slope to vips_hist_local() to implement CLAHE, thanks hunter-87
- vips_gaussnoise() pixels are reproducible on recalc, thanks MvGulik - vips_gaussnoise() pixels are reproducible on recalc, thanks MvGulik
- max/min sort values by y and x coordinate - max/min sort values by y and x coordinate
- tiff read uses libtiff scanline API is rows-per-strip is large
8/12/16 started 8.4.5 8/12/16 started 8.4.5
- allow libgsf-1.14.26 to help centos, thanks tdiprima - allow libgsf-1.14.26 to help centos, thanks tdiprima

View File

@ -44,8 +44,8 @@
*/ */
/* /*
*/
#define DEBUG #define DEBUG
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>

View File

@ -171,6 +171,8 @@
* - add multi-page read * - add multi-page read
* 17/1/17 * 17/1/17
* - invalidate operation on read error * - invalidate operation on read error
* 27/1/17
* - if rows_per_strip is large, read with scanline API instead
*/ */
/* /*
@ -246,10 +248,14 @@ typedef struct _RtiffHeader {
uint32 tile_height; uint32 tile_height;
/* Fields for strip images. /* Fields for strip images.
*
* If read_scanlinewise is TRUE, the strips are too large to read in a
* single lump and we need to use the scanline API.
*/ */
uint32 rows_per_strip; uint32 rows_per_strip;
tsize_t strip_size; tsize_t strip_size;
int number_of_strips; int number_of_strips;
gboolean read_scanlinewise;
} RtiffHeader; } RtiffHeader;
/* Scanline-type process function. /* Scanline-type process function.
@ -447,7 +453,13 @@ rtiff_strip_read( Rtiff *rtiff, int strip, tdata_t buf )
printf( "rtiff_strip_read: reading strip %d\n", strip ); printf( "rtiff_strip_read: reading strip %d\n", strip );
#endif /*DEBUG*/ #endif /*DEBUG*/
length = TIFFReadEncodedStrip( rtiff->tiff, strip, buf, (tsize_t) -1 ); if( rtiff->header.read_scanlinewise )
length = TIFFReadScanline( rtiff->tiff,
buf, strip, (tsize_t) -1 );
else
length = TIFFReadEncodedStrip( rtiff->tiff,
strip, buf, (tsize_t) -1 );
if( length == -1 ) { if( length == -1 ) {
vips_foreign_load_invalidate( rtiff->out ); vips_foreign_load_invalidate( rtiff->out );
vips_error( "tiff2vips", "%s", _( "read error" ) ); vips_error( "tiff2vips", "%s", _( "read error" ) );
@ -2042,6 +2054,7 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
return( -1 ); return( -1 );
header->strip_size = TIFFStripSize( rtiff->tiff ); header->strip_size = TIFFStripSize( rtiff->tiff );
header->number_of_strips = TIFFNumberOfStrips( rtiff->tiff ); header->number_of_strips = TIFFNumberOfStrips( rtiff->tiff );
header->read_scanlinewise = FALSE;
/* rows_per_strip can be 2 ** 32 - 1, meaning the whole image. /* rows_per_strip can be 2 ** 32 - 1, meaning the whole image.
* Clip this down to height to avoid confusing vips. * Clip this down to height to avoid confusing vips.
@ -2062,7 +2075,9 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
*/ */
if( header->rows_per_strip > 128 ) { if( header->rows_per_strip > 128 ) {
header->rows_per_strip = 1; header->rows_per_strip = 1;
header->strip_size = TIFFScanlineSize( rtiff->tiff );
header->number_of_strips = header->height;
header->read_scanlinewise = TRUE;
} }
} }