Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release/3.10] KEA: use native chunksize for copying RAT #11446

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading