#4866 closed enhancement (fixed)
Create Pyramid layers with the same compressed setting as the band for HFA
Reported by: | Sam Gillingham | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.0 |
Component: | GDAL_Raster | Version: | 1.9.2 |
Severity: | normal | Keywords: | HFA |
Cc: |
Description
Attached patch makes the Pyramid layers compressed if the source band is compressed. This is what Imagine does, and can make resulting files much smaller.
Attachments (3)
Change History (11)
by , 12 years ago
Attachment: | hfaband.cpp.compresspyramids.1.9.1.patch added |
---|
comment:2 by , 11 years ago
I'm wondering if we shouldn't look at a HFA_COMPRESS_OVR configuration option first. If not defined, then take the compression mode from the full resolution image like your proposed patch.
The advantage of the configuration option is that it can also be used when building .aux external overviews for other formats.
e.g: gdaladdo out.tif --config USE_RRD YES 2 --config HFA_COMPRESS_OVR YES
Modified patch :
Index: frmts/hfa/hfaband.cpp =================================================================== --- frmts/hfa/hfaband.cpp (révision 26132) +++ frmts/hfa/hfaband.cpp (copie de travail) @@ -2059,12 +2059,29 @@ } /* -------------------------------------------------------------------- */ +/* Are we compressed? If so, overview should be too (unless */ +/* HFA_COMPRESS_OVR is defined). */ +/* Check RasterDMS like HFAGetBandInfo */ +/* -------------------------------------------------------------------- */ + int bCompressionType = FALSE; + const char* pszCompressOvr = CPLGetConfigOption("HFA_COMPRESS_OVR", NULL); + if( pszCompressOvr != NULL ) + bCompressionType = CSLTestBoolean(pszCompressOvr); + else + { + HFAEntry *poDMS = poNode->GetNamedChild( "RasterDMS" ); + + if( poDMS != NULL ) + bCompressionType = poDMS->GetIntField( "compressionType" ) != 0; + } + +/* -------------------------------------------------------------------- */ /* Create the layer. */ /* -------------------------------------------------------------------- */ osLayerName.Printf( "_ss_%d_", nOverviewLevel ); if( !HFACreateLayer( psRRDInfo, poParent, osLayerName, - TRUE, 64, FALSE, bCreateLargeRaster, FALSE, + TRUE, 64, bCompressionType, bCreateLargeRaster, FALSE, nOXSize, nOYSize, nOverviewDataType, NULL, nValidFlagsOffset, nDataOffset, 1, 0 ) ) return -1;
What do you think of that ? It would be appropriate too to modify the frmt_hfa.html file to document the above behaviour.
comment:3 by , 11 years ago
Sounds like an excellent idea to me! It definitely would be useful to be able to compress .aux overviews also.
comment:4 by , 11 years ago
Have attached patch for frmt_hfa.html. Let me know if any other work is required to have this change accepted.
comment:5 by , 11 years ago
There's an error in the doc patch. HFA_COMPRESS_OVR is a configuration option (i.e. something you can define with --config HFA_COMPRESS_OVR YES on a GDAL command line, or through an environmenet variable), and not a creation option of the driver (i.e. something you pass with -co NAME=VALUE)
by , 11 years ago
Attachment: | frmt_hfa.html.patch added |
---|
Patch to document behaviour of HFA_COMPRESS_OVR config option in frmt_hfa.html
comment:7 by , 11 years ago
Milestone: | → 2.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Pushed in r26190.
comment:8 by , 10 years ago
Milestone: | 2.0 → 1.11.0 |
---|
Patch to hfaband.cpp to make pyramid layers compressed if band is compressed