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
|
po/*.pot
|
||||||
test-driver
|
test-driver
|
||||||
vips-*.tar.gz
|
vips-*.tar.gz
|
||||||
doc/reference/setup-build.stamp
|
doc/setup-build.stamp
|
||||||
doc/reference/tmpl-build.stamp
|
doc/tmpl-build.stamp
|
||||||
doc/reference/tmpl.stamp
|
doc/tmpl.stamp
|
||||||
doc/reference/tmpl/
|
doc/tmpl/
|
||||||
libvips-scan
|
libvips-scan
|
||||||
libvips-scan.c
|
libvips-scan.c
|
||||||
Makefile.in
|
Makefile.in
|
||||||
@ -39,9 +39,9 @@ config.*
|
|||||||
configure
|
configure
|
||||||
depcomp
|
depcomp
|
||||||
autom4te.cache/
|
autom4te.cache/
|
||||||
doc/reference/gtk-doc.make
|
doc/gtk-doc.make
|
||||||
doc/reference/libvips-docs.sgml
|
doc/libvips-docs.sgml
|
||||||
doc/reference/libvips-docs.xml
|
doc/libvips-docs.xml
|
||||||
install-sh
|
install-sh
|
||||||
libtool
|
libtool
|
||||||
libvips/include/vips/version.h
|
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
|
# we can't ignore all Makefile since we have a couple of hand-made ones
|
||||||
Makefile
|
Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
doc/reference/Makefile
|
|
||||||
libvips/Makefile
|
libvips/Makefile
|
||||||
libvips/acquire/Makefile
|
libvips/acquire/Makefile
|
||||||
libvips/arithmetic/Makefile
|
libvips/arithmetic/Makefile
|
||||||
@ -128,27 +127,25 @@ tools/other/Makefile
|
|||||||
tools/scripts/Makefile
|
tools/scripts/Makefile
|
||||||
|
|
||||||
# various things made by gtk-doc
|
# various things made by gtk-doc
|
||||||
doc/reference/html-build.stamp
|
doc/html-build.stamp
|
||||||
doc/reference/html.stamp
|
doc/html.stamp
|
||||||
doc/reference/html/
|
doc/html/
|
||||||
doc/reference/libvips-decl-list.txt
|
doc/libvips-decl-list.txt
|
||||||
doc/reference/libvips-decl.txt
|
doc/libvips-decl.txt
|
||||||
doc/reference/libvips-overrides.txt
|
doc/libvips-overrides.txt
|
||||||
doc/reference/libvips-sections.txt
|
doc/libvips-sections.txt
|
||||||
doc/reference/libvips-undeclared.txt
|
doc/libvips-undeclared.txt
|
||||||
doc/reference/libvips-undocumented.txt
|
doc/libvips-undocumented.txt
|
||||||
doc/reference/libvips-unused.txt
|
doc/libvips-unused.txt
|
||||||
doc/reference/libvips.args
|
doc/libvips.args
|
||||||
doc/reference/libvips.hierarchy
|
doc/libvips.hierarchy
|
||||||
doc/reference/libvips.interfaces
|
doc/libvips.interfaces
|
||||||
doc/reference/libvips.prerequisites
|
doc/libvips.prerequisites
|
||||||
doc/reference/libvips.signals
|
doc/libvips.signals
|
||||||
doc/reference/libvips.types
|
doc/libvips.types
|
||||||
doc/reference/scan-build.stamp
|
doc/scan-build.stamp
|
||||||
doc/reference/sgml-build.stamp
|
doc/sgml-build.stamp
|
||||||
doc/reference/sgml.stamp
|
doc/sgml.stamp
|
||||||
doc/reference/xml/
|
doc/xml/
|
||||||
doc/html
|
|
||||||
doc/pdf
|
|
||||||
gtkdocerrors
|
gtkdocerrors
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Python
|
Python
|
||||||
- add shift option to cast
|
- add shift option to cast
|
||||||
- sRGB2scRGB and scRGB2sRGB scale 16-bit alpha to and from 8-bit
|
- 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
|
6/2/15 started 7.42.3
|
||||||
- bump version for back-compat ABI change
|
- bump version for back-compat ABI change
|
||||||
|
@ -146,6 +146,8 @@
|
|||||||
* - zero out edge tile buffers before jpeg write, thanks iwbh15
|
* - zero out edge tile buffers before jpeg write, thanks iwbh15
|
||||||
* 19/1/15
|
* 19/1/15
|
||||||
* - disable chroma subsample if Q >= 90
|
* - 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"
|
#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
|
/* Max no of tiles we buffer in a layer. Enough to buffer a line of 64x64
|
||||||
* tiles on a 100k pixel across image.
|
* tiles on a 100k pixel across image.
|
||||||
*/
|
*/
|
||||||
@ -1538,59 +1547,32 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append a file to a TIFF file.
|
/* Append all of the lower layers we wrote to the output.
|
||||||
*/
|
|
||||||
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.
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
gather_pyramid( TiffWrite *tw )
|
gather_pyramid( TiffWrite *tw )
|
||||||
{
|
{
|
||||||
PyramidLayer *layer;
|
PyramidLayer *layer;
|
||||||
TIFF *out;
|
|
||||||
|
for( layer = tw->layer; layer; layer = layer->below ) {
|
||||||
|
TIFF *in;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf( "Starting pyramid gather ...\n" );
|
printf( "Appending layer %s ...\n", layer->lname );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !(out = tiff_openout( tw, tw->name )) )
|
if( !(in = tiff_openin( layer->lname )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( tiff_append( tw, out, tw->bname ) ) {
|
if( tiff_copy( tw, tw->tif, in ) ) {
|
||||||
TIFFClose( out );
|
TIFFClose( in );
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( layer = tw->layer; layer; layer = layer->below )
|
|
||||||
if( tiff_append( tw, out, layer->lname ) ) {
|
|
||||||
TIFFClose( out );
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
TIFFClose( in );
|
||||||
|
|
||||||
TIFFClose( out );
|
if( !TIFFWriteDirectory( tw->tif ) )
|
||||||
|
return( -1 );
|
||||||
#ifdef DEBUG
|
}
|
||||||
printf( "Pyramid built\n" );
|
|
||||||
#endif /*DEBUG*/
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -1621,28 +1603,16 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
|||||||
if( vips_check_coding_known( "vips2tiff", in ) )
|
if( vips_check_coding_known( "vips2tiff", in ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* Make output image. If this is a pyramid, write the base image to
|
/* Make output image.
|
||||||
* tmp/xx.tif rather than fred.tif.
|
|
||||||
*/
|
*/
|
||||||
if( !(tw = make_tiff_write( in, filename,
|
if( !(tw = make_tiff_write( in, filename,
|
||||||
compression, Q, predictor, profile,
|
compression, Q, predictor, profile,
|
||||||
tile, tile_width, tile_height, pyramid, squash,
|
tile, tile_width, tile_height, pyramid, squash,
|
||||||
resunit, xres, yres, bigtiff, rgbjpeg )) )
|
resunit, xres, yres, bigtiff, rgbjpeg )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( tw->pyramid ) {
|
if( !(tw->tif = tiff_openout( tw, tw->name )) ) {
|
||||||
if( !(tw->bname = vips__temp_name( "%s.tif" )) ||
|
free_tiff_write( tw );
|
||||||
!(tw->tif = tiff_openout( tw, tw->bname )) ) {
|
return( -1 );
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the TIFF header for the full-res file.
|
/* Write the TIFF header for the full-res file.
|
||||||
@ -1652,7 +1622,6 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( tw->tile )
|
if( tw->tile )
|
||||||
res = write_tif_tilewise( tw );
|
res = write_tif_tilewise( tw );
|
||||||
else
|
else
|
||||||
@ -1662,17 +1631,16 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
|||||||
return( -1 );
|
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.
|
* ready for us to read from them again.
|
||||||
*/
|
*/
|
||||||
if( tw->layer )
|
if( tw->layer )
|
||||||
free_pyramid( 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 &&
|
if( tw->pyramid &&
|
||||||
gather_pyramid( tw ) ) {
|
gather_pyramid( tw ) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user