Merge pull request #2129 from Adios/8.10-add-tiff-zstd-predictor

Add tiff zstd predictor support
This commit is contained in:
John Cupitt 2021-03-04 17:27:42 +00:00 committed by GitHub
commit 4eb3c86045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -590,8 +590,8 @@ vips_foreign_save_tiff_buffer_init( VipsForeignSaveTiffBuffer *buffer )
* User @level to set the ZSTD compression level. Use @lossless to
* set WEBP lossless mode on. Use @Q to set the WEBP compression level.
*
* Use @predictor to set the predictor for lzw and deflate compression. It
* defaults to #VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL, meaning horizontal
* Use @predictor to set the predictor for lzw, deflate and zstd compression.
* It defaults to #VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL, meaning horizontal
* differencing. Please refer to the libtiff
* specifications for further discussion of various predictors.
*

View File

@ -659,8 +659,13 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
TIFFSetField( tif, TIFFTAG_WEBP_LEVEL, wtiff->Q );
TIFFSetField( tif, TIFFTAG_WEBP_LOSSLESS, wtiff->lossless );
}
if( wtiff->compression == COMPRESSION_ZSTD )
if( wtiff->compression == COMPRESSION_ZSTD ) {
TIFFSetField( tif, TIFFTAG_ZSTD_LEVEL, wtiff->level );
if( wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE )
TIFFSetField( tif, TIFFTAG_PREDICTOR,
wtiff->predictor );
}
#endif /*HAVE_TIFF_COMPRESSION_WEBP*/
if( (wtiff->compression == COMPRESSION_ADOBE_DEFLATE ||
@ -1862,8 +1867,13 @@ wtiff_copy_tiff( Wtiff *wtiff, TIFF *out, TIFF *in )
TIFFSetField( out, TIFFTAG_WEBP_LEVEL, wtiff->Q );
TIFFSetField( out, TIFFTAG_WEBP_LOSSLESS, wtiff->lossless );
}
if( wtiff->compression == COMPRESSION_ZSTD )
if( wtiff->compression == COMPRESSION_ZSTD ) {
TIFFSetField( out, TIFFTAG_ZSTD_LEVEL, wtiff->level );
if( wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE )
TIFFSetField( out, TIFFTAG_PREDICTOR,
wtiff->predictor );
}
#endif /*HAVE_TIFF_COMPRESSION_WEBP*/
if( (wtiff->compression == COMPRESSION_ADOBE_DEFLATE ||