Skip to content

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

Merged
lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-fillholes-origin
Mar 30, 2026
Merged

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

Conversation

@lgritz
Copy link
Copy Markdown
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
@lgritz
Copy link
Copy Markdown
Collaborator Author

lgritz commented Mar 28, 2026

Any comments?

@lgritz
Copy link
Copy Markdown
Collaborator Author

lgritz commented Mar 30, 2026

No objections for over a week -> merging, to have it in time for the patch releases this week

@lgritz lgritz merged commit b7580f4 into AcademySoftwareFoundation:main Mar 30, 2026
31 checks passed
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Mar 31, 2026
…ftwareFoundation#5105)

Fixes AcademySoftwareFoundation#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

Signed-off-by: Larry Gritz <lg@larrygritz.com>
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Mar 31, 2026
…ftwareFoundation#5105)

Fixes AcademySoftwareFoundation#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

Signed-off-by: Larry Gritz <lg@larrygritz.com>
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Mar 31, 2026
…ftwareFoundation#5105)

Fixes AcademySoftwareFoundation#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

Signed-off-by: Larry Gritz <lg@larrygritz.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ftwareFoundation#5105)

Fixes AcademySoftwareFoundation#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

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ftwareFoundation#5105)

Fixes AcademySoftwareFoundation#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

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
Signed-off-by: Vlad <shaamaan@gmail.com>
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