Skip to content

Commit

Permalink
[Backport release/3.10] KEA: use native chunksize for copying RAT (#1…
Browse files Browse the repository at this point in the history
…1446)

Changes the chunksize used for copying the RAT to be the default native HDF5 chunksize (10000) rather and 1000. This should improve performance while copying to a KEA file.
  • Loading branch information
rouault authored Dec 6, 2024
1 parent f3e4b05 commit 4c6fb13
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions frmts/kea/keacopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ static bool KEACopyRasterData(GDALRasterBand *pBand,
return true;
}

constexpr int RAT_CHUNKSIZE = 1000;

// copies the raster attribute table
static void KEACopyRAT(GDALRasterBand *pBand, kealib::KEAImageIO *pImageIO,
int nBand)
Expand Down Expand Up @@ -233,12 +231,12 @@ static void KEACopyRAT(GDALRasterBand *pBand, kealib::KEAImageIO *pImageIO,
int numRows = gdalAtt->GetRowCount();
keaAtt->addRows(numRows);

int *pnIntBuffer = new int[RAT_CHUNKSIZE];
int64_t *pnInt64Buffer = new int64_t[RAT_CHUNKSIZE];
double *pfDoubleBuffer = new double[RAT_CHUNKSIZE];
for (int ni = 0; ni < numRows; ni += RAT_CHUNKSIZE)
int *pnIntBuffer = new int[kealib::KEA_ATT_CHUNK_SIZE];
int64_t *pnInt64Buffer = new int64_t[kealib::KEA_ATT_CHUNK_SIZE];
double *pfDoubleBuffer = new double[kealib::KEA_ATT_CHUNK_SIZE];
for (int ni = 0; ni < numRows; ni += kealib::KEA_ATT_CHUNK_SIZE)
{
int nLength = RAT_CHUNKSIZE;
int nLength = kealib::KEA_ATT_CHUNK_SIZE;
if ((ni + nLength) > numRows)
{
nLength = numRows - ni;
Expand Down

0 comments on commit 4c6fb13

Please sign in to comment.