Skip to content

fix(IBA): Handle offset data windows in fillholes_pushpull#5105

Open
lgritz wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-fillholes-origin
Open

fix(IBA): Handle offset data windows in fillholes_pushpull#5105
lgritz wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-fillholes-origin

Conversation

@lgritz
Copy link
Collaborator

@lgritz lgritz commented Mar 22, 2026

Fixes #4942

IBA::fillholes_pushpull() produced incorrect results when the source image had a non-zero data window origin (such as exr files with overscan).

Two interrelated bugs:

  1. The paste() call double-applied the data window offset. paste() maps source pixel (0,0) to destination (xbegin,ybegin), but since the source data starts at (x,y), passing (x,y) as the offset shifted every pixel by an extra (x,y). Pixels in the negative-coordinate region landed outside the destination buffer and were silently lost.

  2. The top pyramid level preserved the original display/full window while all smaller levels had full=data at (0,0). Since resize() uses the full window for coordinate mapping, it only sampled the display window portion of the top level, losing all overscan data.

Fix by shifting the top pyramid level to origin (0,0) with full=data, making all levels coordinate-consistent. The initial paste translates source pixels into the origin-based pyramid, and the final paste (which was already using src origin offsets) correctly translates back.

Add test cases in testsuite/oiiotool for fillholes with an offset data window, and an offset display window, to ensure that both cases work.

Also, for the existing fillholes related test, move the source image from ref (never should have been there) to src.

Assisted-by: Claude Code / claude-opus-4-6

Fixes 4942

IBA::fillholes_pushpull() produced incorrect result when the source
image had a non-zero data window origin (such as exr files with
overscan).

Two interrelated bugs:

1. The paste() call double-applied the data window offset. paste()
   maps source pixel (0,0) to destination (xbegin,ybegin), but since
   the source data starts at (x,y), passing (x,y) as the offset
   shifted every pixel by an extra (x,y). Pixels in the
   negative-coordinate region landed outside the destination buffer
   and were silently lost.

2. The top pyramid level preserved the original display/full window
   while all smaller levels had full=data at (0,0). Since resize()
   uses the full window for coordinate mapping, it only sampled the
   display window portion of the top level, losing all overscan data.

Fix by shifting the top pyramid level to origin (0,0) with full=data,
making all levels coordinate-consistent. The initial paste translates
source pixels into the origin-based pyramid, and the final paste
(which was already using src origin offsets) correctly translates
back.

Add test cases in testsuite/oiiotool for fillholes with an offset data
window, and an offset display window, to ensure that both cases work.

Also, for the existing fillholes related test, move the source image
from ref (never should have been there) to src.

Assisted-by: Claude Code / claude-opus-4-6

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz lgritz force-pushed the lg-fillholes-origin branch from cb30232 to 1ffde5d Compare March 22, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Fillholes can't handle offseted data window

1 participant