small fix to openexr load

This commit is contained in:
John Cupitt 2021-03-18 12:47:03 +00:00
parent 8d6f90c060
commit 7d69f6bc84
2 changed files with 9 additions and 7 deletions

View File

@ -226,7 +226,11 @@ read_header( Read *read, VipsImage *out )
VIPS_FORMAT_FLOAT, VIPS_FORMAT_FLOAT,
VIPS_CODING_NONE, VIPS_INTERPRETATION_scRGB, 1.0, 1.0 ); VIPS_CODING_NONE, VIPS_INTERPRETATION_scRGB, 1.0, 1.0 );
if( read->tiles ) if( read->tiles )
vips_image_pipelinev( out, VIPS_DEMAND_STYLE_SMALLTILE, NULL ); /* Even though this is a tiled reader, we hint thinstrip
* since with the cache we are quite happy serving that if
* anything downstream would like it.
*/
vips_image_pipelinev( out, VIPS_DEMAND_STYLE_THINSTRIP, NULL );
else else
vips_image_pipelinev( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL ); vips_image_pipelinev( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
} }
@ -363,7 +367,8 @@ vips__openexr_read( const char *filename, VipsImage *out )
VipsImage *raw; VipsImage *raw;
VipsImage *t; VipsImage *t;
/* Tile cache: keep enough for two complete rows of tiles. /* Tile cache: keep enough for two complete rows of tiles,
* plus 50%.
*/ */
raw = vips_image_new(); raw = vips_image_new();
vips_object_local( out, raw ); vips_object_local( out, raw );
@ -375,14 +380,11 @@ vips__openexr_read( const char *filename, VipsImage *out )
read, NULL ) ) read, NULL ) )
return( -1 ); return( -1 );
/* Copy to out, adding a cache. Enough tiles for a complete
* row, plus 50%.
*/
if( vips_tilecache( raw, &t, if( vips_tilecache( raw, &t,
"tile_width", read->tile_width, "tile_width", read->tile_width,
"tile_height", read->tile_height, "tile_height", read->tile_height,
"max_tiles", (int) "max_tiles", (int)
(1.5 * (1 + raw->Xsize / read->tile_width)), (2.5 * (1 + raw->Xsize / read->tile_width)),
NULL ) ) NULL ) )
return( -1 ); return( -1 );
if( vips_image_write( t, out ) ) { if( vips_image_write( t, out ) ) {

View File

@ -92,7 +92,7 @@ G_STMT_START { \
(void) g_once( ONCE, FUNC, CLIENT ); \ (void) g_once( ONCE, FUNC, CLIENT ); \
} G_STMT_END } G_STMT_END
/* VIPS_RINT() does "bankers rounding", it rounds to the nerarest even integer. /* VIPS_RINT() does "bankers rounding", it rounds to the nearest even integer.
* For things like image geometry, we want strict nearest int. * For things like image geometry, we want strict nearest int.
* *
* If you know it's unsigned, _UINT is a little faster. * If you know it's unsigned, _UINT is a little faster.