Skip to content

Commit

Permalink
Avoid redundant reads of pixel-interleaved files
Browse files Browse the repository at this point in the history
Uses the same block data for all bands.  Fixes #376.
  • Loading branch information
jcphill committed Aug 2, 2023
1 parent d6b48ad commit b1c46d1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/geotiffimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,18 @@ class GeoTIFFImage {

for (let yTile = minYTile; yTile < maxYTile; ++yTile) {
for (let xTile = minXTile; xTile < maxXTile; ++xTile) {
let getPromise;
if (this.planarConfiguration === 1) {
getPromise = this.getTileOrStrip(xTile, yTile, 0, poolOrDecoder, signal);
}
for (let sampleIndex = 0; sampleIndex < samples.length; ++sampleIndex) {
const si = sampleIndex;
const sample = samples[sampleIndex];
if (this.planarConfiguration === 2) {
bytesPerPixel = this.getSampleByteSize(sampleIndex);
bytesPerPixel = this.getSampleByteSize(sample);
getPromise = this.getTileOrStrip(xTile, yTile, sample, poolOrDecoder, signal);
}
const promise = this.getTileOrStrip(xTile, yTile, sample, poolOrDecoder, signal).then((tile) => {
const promise = getPromise.then((tile) => {
const buffer = tile.data;
const dataView = new DataView(buffer);
const blockHeight = this.getBlockHeight(tile.y);
Expand Down

0 comments on commit b1c46d1

Please sign in to comment.