Opened 16 years ago
Closed 16 years ago
#2092 closed defect (fixed)
[PATCH] Reduce TIFF JPEG-compressed or pixel-interleaved overview size
Reported by: | Even Rouault | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.0 |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | gtiff jpeg overview |
Cc: |
Description
In #2033, I noticed that jpeg-compressed tiff overviews were significantly larger in the case of pixel-interleaved dataset. This is due to the fact that when computing an overview, we compute each band separately. In the case of JPEG compression and pixel interleaving, the TIFF block data will increase for each band processed. Then libtiff needs to allocate a new block since the previous one was too small (TIFFAppendToStrip). The resulting file is much bigger than it should be. And before writing band 2, we decompress previously compressed block with data from band 1, which is bad as JPEG compression is lossily. The same also applies the case for any compressed pixel-interleaved TIFF file (LZW, etc...)
The attached patch addresses this issue in the case of internal and external overviews by creating a temporary external uncompressed overview dataset and then copying it to the destination overview bands block by block and all bands at the same time.
The exact criterion used to determine whether we should use a temporary file is
nPlanarConfig == PLANARCONFIG_CONTIG && nBands != 1 && nCompression != COMPRESSION_NONE
I'm also re-attaching my patch for GDALDatasetCopyWholeRaster as it also tries to address translation to pixel-interleaved compressed tiff.
Attachments (2)
Change History (3)
by , 16 years ago
Attachment: | gdal_svn_trunk_rework_GDALDatasetCopyWholeRaster.patch added |
---|
by , 16 years ago
Attachment: | gdal_svn_trunk_decrease_pixel_interleaved_jpeg_overviews.patch added |
---|
comment:1 by , 16 years ago
Milestone: | → 1.6.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
In r14994, I commited code that fulfills the aim of this ticket, while not requiring a temporary dataset.