tiff pyramid builder no longer copies base image
we used to make a copy of the base image ... instead, write once and append other layers at end of run
This commit is contained in:
parent
bc57962ad0
commit
be5052d0c3
57
.gitignore
vendored
57
.gitignore
vendored
@ -10,10 +10,10 @@ compile
|
||||
po/*.pot
|
||||
test-driver
|
||||
vips-*.tar.gz
|
||||
doc/reference/setup-build.stamp
|
||||
doc/reference/tmpl-build.stamp
|
||||
doc/reference/tmpl.stamp
|
||||
doc/reference/tmpl/
|
||||
doc/setup-build.stamp
|
||||
doc/tmpl-build.stamp
|
||||
doc/tmpl.stamp
|
||||
doc/tmpl/
|
||||
libvips-scan
|
||||
libvips-scan.c
|
||||
Makefile.in
|
||||
@ -39,9 +39,9 @@ config.*
|
||||
configure
|
||||
depcomp
|
||||
autom4te.cache/
|
||||
doc/reference/gtk-doc.make
|
||||
doc/reference/libvips-docs.sgml
|
||||
doc/reference/libvips-docs.xml
|
||||
doc/gtk-doc.make
|
||||
doc/libvips-docs.sgml
|
||||
doc/libvips-docs.xml
|
||||
install-sh
|
||||
libtool
|
||||
libvips/include/vips/version.h
|
||||
@ -90,7 +90,6 @@ tools/shrink_width
|
||||
# we can't ignore all Makefile since we have a couple of hand-made ones
|
||||
Makefile
|
||||
doc/Makefile
|
||||
doc/reference/Makefile
|
||||
libvips/Makefile
|
||||
libvips/acquire/Makefile
|
||||
libvips/arithmetic/Makefile
|
||||
@ -128,27 +127,25 @@ tools/other/Makefile
|
||||
tools/scripts/Makefile
|
||||
|
||||
# various things made by gtk-doc
|
||||
doc/reference/html-build.stamp
|
||||
doc/reference/html.stamp
|
||||
doc/reference/html/
|
||||
doc/reference/libvips-decl-list.txt
|
||||
doc/reference/libvips-decl.txt
|
||||
doc/reference/libvips-overrides.txt
|
||||
doc/reference/libvips-sections.txt
|
||||
doc/reference/libvips-undeclared.txt
|
||||
doc/reference/libvips-undocumented.txt
|
||||
doc/reference/libvips-unused.txt
|
||||
doc/reference/libvips.args
|
||||
doc/reference/libvips.hierarchy
|
||||
doc/reference/libvips.interfaces
|
||||
doc/reference/libvips.prerequisites
|
||||
doc/reference/libvips.signals
|
||||
doc/reference/libvips.types
|
||||
doc/reference/scan-build.stamp
|
||||
doc/reference/sgml-build.stamp
|
||||
doc/reference/sgml.stamp
|
||||
doc/reference/xml/
|
||||
doc/html
|
||||
doc/pdf
|
||||
doc/html-build.stamp
|
||||
doc/html.stamp
|
||||
doc/html/
|
||||
doc/libvips-decl-list.txt
|
||||
doc/libvips-decl.txt
|
||||
doc/libvips-overrides.txt
|
||||
doc/libvips-sections.txt
|
||||
doc/libvips-undeclared.txt
|
||||
doc/libvips-undocumented.txt
|
||||
doc/libvips-unused.txt
|
||||
doc/libvips.args
|
||||
doc/libvips.hierarchy
|
||||
doc/libvips.interfaces
|
||||
doc/libvips.prerequisites
|
||||
doc/libvips.signals
|
||||
doc/libvips.types
|
||||
doc/scan-build.stamp
|
||||
doc/sgml-build.stamp
|
||||
doc/sgml.stamp
|
||||
doc/xml/
|
||||
gtkdocerrors
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
Python
|
||||
- add shift option to cast
|
||||
- sRGB2scRGB and scRGB2sRGB scale 16-bit alpha to and from 8-bit
|
||||
- tiff pyramid writer no longer copies base image
|
||||
|
||||
6/2/15 started 7.42.3
|
||||
- bump version for back-compat ABI change
|
||||
|
@ -146,6 +146,8 @@
|
||||
* - zero out edge tile buffers before jpeg write, thanks iwbh15
|
||||
* 19/1/15
|
||||
* - disable chroma subsample if Q >= 90
|
||||
* 13/2/15
|
||||
* - append later layers, don't copy the base image
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -201,6 +203,13 @@
|
||||
|
||||
#include "tiff.h"
|
||||
|
||||
/* FIXME ... this is not the best way to organise a pyramid builder, dzsave is
|
||||
* much better.
|
||||
*
|
||||
* Rip out all the PyramidTile stuff and redo dzsave-style. We could scrap the
|
||||
* input cache as well.
|
||||
*/
|
||||
|
||||
/* Max no of tiles we buffer in a layer. Enough to buffer a line of 64x64
|
||||
* tiles on a 100k pixel across image.
|
||||
*/
|
||||
@ -1538,59 +1547,32 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Append a file to a TIFF file.
|
||||
*/
|
||||
static int
|
||||
tiff_append( TiffWrite *tw, TIFF *out, const char *name )
|
||||
{
|
||||
TIFF *in;
|
||||
|
||||
if( !(in = tiff_openin( name )) )
|
||||
return( -1 );
|
||||
|
||||
if( tiff_copy( tw, out, in ) ) {
|
||||
TIFFClose( in );
|
||||
return( -1 );
|
||||
}
|
||||
TIFFClose( in );
|
||||
|
||||
if( !TIFFWriteDirectory( out ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Gather all of the files we wrote into single output file.
|
||||
/* Append all of the lower layers we wrote to the output.
|
||||
*/
|
||||
static int
|
||||
gather_pyramid( TiffWrite *tw )
|
||||
{
|
||||
PyramidLayer *layer;
|
||||
TIFF *out;
|
||||
|
||||
for( layer = tw->layer; layer; layer = layer->below ) {
|
||||
TIFF *in;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "Starting pyramid gather ...\n" );
|
||||
printf( "Appending layer %s ...\n", layer->lname );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( !(out = tiff_openout( tw, tw->name )) )
|
||||
return( -1 );
|
||||
if( !(in = tiff_openin( layer->lname )) )
|
||||
return( -1 );
|
||||
|
||||
if( tiff_append( tw, out, tw->bname ) ) {
|
||||
TIFFClose( out );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
for( layer = tw->layer; layer; layer = layer->below )
|
||||
if( tiff_append( tw, out, layer->lname ) ) {
|
||||
TIFFClose( out );
|
||||
if( tiff_copy( tw, tw->tif, in ) ) {
|
||||
TIFFClose( in );
|
||||
return( -1 );
|
||||
}
|
||||
TIFFClose( in );
|
||||
|
||||
TIFFClose( out );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "Pyramid built\n" );
|
||||
#endif /*DEBUG*/
|
||||
if( !TIFFWriteDirectory( tw->tif ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -1621,28 +1603,16 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
||||
if( vips_check_coding_known( "vips2tiff", in ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make output image. If this is a pyramid, write the base image to
|
||||
* tmp/xx.tif rather than fred.tif.
|
||||
/* Make output image.
|
||||
*/
|
||||
if( !(tw = make_tiff_write( in, filename,
|
||||
compression, Q, predictor, profile,
|
||||
tile, tile_width, tile_height, pyramid, squash,
|
||||
resunit, xres, yres, bigtiff, rgbjpeg )) )
|
||||
return( -1 );
|
||||
if( tw->pyramid ) {
|
||||
if( !(tw->bname = vips__temp_name( "%s.tif" )) ||
|
||||
!(tw->tif = tiff_openout( tw, tw->bname )) ) {
|
||||
free_tiff_write( tw );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* No pyramid ... write straight to name.
|
||||
*/
|
||||
if( !(tw->tif = tiff_openout( tw, tw->name )) ) {
|
||||
free_tiff_write( tw );
|
||||
return( -1 );
|
||||
}
|
||||
if( !(tw->tif = tiff_openout( tw, tw->name )) ) {
|
||||
free_tiff_write( tw );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* Write the TIFF header for the full-res file.
|
||||
@ -1652,7 +1622,6 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
||||
if( tw->tile )
|
||||
res = write_tif_tilewise( tw );
|
||||
else
|
||||
@ -1662,17 +1631,16 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* Free pyramid resources ... this will TIFFClose() the intermediates,
|
||||
if( !TIFFWriteDirectory( tw->tif ) )
|
||||
return( -1 );
|
||||
|
||||
/* Free pyramid resources ... this will TIFFClose() the smaller layers
|
||||
* ready for us to read from them again.
|
||||
*/
|
||||
if( tw->layer )
|
||||
free_pyramid( tw->layer );
|
||||
if( tw->tif ) {
|
||||
TIFFClose( tw->tif );
|
||||
tw->tif = NULL;
|
||||
}
|
||||
|
||||
/* Gather layers together into final pyramid file.
|
||||
/* Append smaller layers to the main file.
|
||||
*/
|
||||
if( tw->pyramid &&
|
||||
gather_pyramid( tw ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user