Skip to content

Conversation

@pmady
Copy link
Contributor

@pmady pmady commented Dec 4, 2025

…order support

The WebP output plugin incorrectly assumed that scanlines would be written in sequential order, triggering the final write when y == height - 1. This violated the write_scanline API contract which allows scanlines to be written in any order (the plugin even advertises 'random_access' support).

Changes:

  • Remove premature write_complete_data() call from write_scanline()
  • Move final encoding/writing to close() where it belongs
  • Add m_image_complete flag to track write state
  • Move buffer cleanup to after write_complete_data() in close()

Fixes the issue where writing scanlines out of order would result in incomplete or corrupted WebP files.

Description

Tests

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable. (Check if there is no
    need to update the documentation, for example if this is a bug fix that
    doesn't change the API.)
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • If I added or modified a C++ API call, I have also amended the
    corresponding Python bindings (and if altering ImageBufAlgo functions, also
    exposed the new functionality as oiiotool options).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 4, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pmady / name: Pavan Madduri (9dad196)

Copy link
Contributor

@jessey-git jessey-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have 1 comment.

@pmady pmady force-pushed the fix/webp-write-scanline-order branch from bbe2145 to eee49f9 Compare December 4, 2025 21:48
@pmady pmady requested a review from jessey-git December 4, 2025 21:51
@lgritz
Copy link
Collaborator

lgritz commented Dec 6, 2025

The CI failures with messages about filling the disk are unrelated to this PR. If you rebase on the current main (or cherry pick #4974 into this PR), it will contain the fix and hopefully everything else will pass.

…order support

The WebP output plugin incorrectly assumed that scanlines would be written
in sequential order, triggering the final write when y == height - 1.
This violated the write_scanline API contract which allows scanlines to
be written in any order (the plugin even advertises 'random_access' support).

Changes:
- Remove premature write_complete_data() call from write_scanline()
- Move final encoding/writing to close() where it belongs
- Move buffer cleanup to after write_complete_data() in close()

The ioproxy_opened() check already guards against double-close, so no
additional state tracking is needed.

Fixes the issue where writing scanlines out of order would result in
incomplete or corrupted WebP files.

Signed-off-by: pmady <pavan4devops@gmail.com>
@pmady pmady force-pushed the fix/webp-write-scanline-order branch from eee49f9 to 9dad196 Compare December 6, 2025 21:08
@pmady
Copy link
Contributor Author

pmady commented Dec 6, 2025

Rebased fix/webp-write-scanline-order on upstream/main which now includes #4974 (the disk space fix). Force pushed to 9dad196

Copy link
Contributor

@jessey-git jessey-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me now.

@lgritz lgritz merged commit fd5ac81 into AcademySoftwareFoundation:main Dec 8, 2025
54 of 56 checks passed
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Dec 17, 2025
…twareFoundation#4973)

Move write_complete_data() to close() for proper scanline order support 

The WebP output plugin incorrectly assumed that scanlines would be
written in sequential order, triggering the final write when y == height
- 1. This violated the write_scanline API contract which allows
scanlines to be written in any order (the plugin even advertises
'random_access' support).

Changes:
- Remove premature write_complete_data() call from write_scanline()
- Move final encoding/writing to close() where it belongs
- Add m_image_complete flag to track write state
- Move buffer cleanup to after write_complete_data() in close()

Fixes the issue where writing scanlines out of order would result in
incomplete or corrupted WebP files.

Signed-off-by: pmady <pavan4devops@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.

3 participants