tiff loader always offers thinstrip

the tiff loader now always offers thinstrip ... later stages can then
pick any demand style they like (thanks Diuming)
This commit is contained in:
John Cupitt 2012-06-03 11:44:03 +01:00
parent f65f9088f6
commit fc3d4192d7
4 changed files with 33 additions and 14 deletions

View File

@ -3,6 +3,7 @@
- use TIFF_CFLAGS output from pkg-config (thanks Jay)
- much faster vips_argument_map()
- make jpeg pyramids work with tiff4
- tiff loader always offers THINSTRIP (thanks Diuming)
19/4/12 started 7.28.5
- ifthenelse blend mode was broken

View File

@ -2151,19 +2151,10 @@ vips_fitssave( VipsImage *in, const char *filename, ... )
*
* Optional arguments:
*
* @sequential: sequential read only
*
* Read a PNG file into a VIPS image. It can read all png images, including 8-
* and 16-bit images, 1 and 3 channel, with and without an alpha channel.
*
* Setting @sequential to %TRUE means you promise to only demand tiles from
* this image top-top-bottom, ie. to read sequentially. This means the png
* loader can read directly from the image without having to generate a
* random-access intermediate. This can save a lot of time and memory for
* large images, but limits the sorts of operation you can perform. It's
* useful for things like generating thumbnails.
*
* There is no support for embedded ICC profiles.
* Any ICC profile is read and attached to the VIPS image.
*
* See also: vips_image_new_from_file().
*
@ -2202,7 +2193,9 @@ vips_pngload( const char *filename, VipsImage **out, ... )
* than an interlaced PNG can be up to 7 times slower to write than a
* non-interlaced image.
*
* There is no support for attaching ICC profiles to PNG images.
* If the VIPS header
* contains an ICC profile named VIPS_META_ICC_NAME ("icc-profile-data"), the
* profile from the VIPS header will be attached.
*
* The image is automatically converted to RGB, RGBA, Monochrome or Mono +
* alpha before saving. Images with more than one byte per band element are

View File

@ -128,6 +128,9 @@
* 18/2/12
* - switch to sequential read
* - remove the lock ... tilecache does this for us
* 3/6/12
* - always offer THINSTRIP ... later stages can ask for something more
* relaxed if they wish
*/
/*
@ -1090,6 +1093,12 @@ parse_header( ReadTiff *rtiff, VipsImage *out )
(VipsCallbackFn) vips_free, data_copy, data_length );
}
/* Offer the most restrictive style. This can be changed downstream if
* necessary.
*/
vips_demand_hint( out,
VIPS_DEMAND_STYLE_THINSTRIP, NULL );
return( 0 );
}
@ -1257,16 +1266,19 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
if( parse_header( rtiff, raw ) )
return( -1 );
/* Process and save as VIPS.
/* Process and save as VIPS.
*
* 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_demand_hint( raw,
VIPS_DEMAND_STYLE_SMALLTILE, NULL );
VIPS_DEMAND_STYLE_THINSTRIP, NULL );
if( vips_image_generate( raw,
tiff_seq_start, tiff_fill_region, tiff_seq_stop,
rtiff, NULL ) )
return( -1 );
/* Copy to out, adding a cache. Enough tiles for two complete rows.
*/
if( vips_tilecache( raw, &t,

View File

@ -58,6 +58,10 @@
*/
/*
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
@ -244,6 +248,11 @@ shrink_gen( REGION *or, void *vseq, void *a, void *b )
int x, y;
#ifdef DEBUG
printf( "shrink_gen: generating %d x %d at %d x %d\n",
r->width, r->height, r->left, r->top );
#endif /*DEBUG*/
for( y = 0; y < r->height; y += ystep )
for( x = 0; x < r->width; x += xstep ) {
/* Clip the this rect against the demand size.
@ -257,6 +266,10 @@ shrink_gen( REGION *or, void *vseq, void *a, void *b )
s.top = (r->top + y) * st->yshrink;
s.width = 1 + ceil( width * st->xshrink );
s.height = 1 + ceil( height * st->yshrink );
#ifdef DEBUG
printf( "shrink_gen: requesting %d x %d at %d x %d\n",
s.width, s.height, s.left, s.top );
#endif /*DEBUG*/
if( im_prepare( ir, &s ) )
return( -1 );