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

More efficient handling of filled channels reading tiles with scanline API #830

Merged

Conversation

peterhillman
Copy link
Contributor

Refactor to reduce memory allocation and processing:

InputFile allows reading tiled files using the Scanline API via a temporary FrameBuffer. When reading channels that are not present in the input file, the temporary buffer was being filled with the specified fillValue and then copied to the output FrameBuffer.
This change omits filled channels from the temporary buffer, and directly fills the output FrameBuffer instead.

testScanlineApi has also been expanded to test reading non-existent channels.

addresses https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25370 by avoiding allocation of a very large buffer that was causing memory exhaustion

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
@peterhillman
Copy link
Contributor Author

Copy link
Member

@cary-ilm cary-ilm left a comment

Choose a reason for hiding this comment

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

LGTM

@cary-ilm cary-ilm merged commit d80f11f into AcademySoftwareFoundation:master Sep 10, 2020
@peterhillman peterhillman deleted the optimize_tile_fill branch September 30, 2020 02:50
cary-ilm pushed a commit to cary-ilm/openexr that referenced this pull request May 12, 2021
…e API (AcademySoftwareFoundation#830)

* refactor channel filling in InputFile API with tiled source

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* handle edge-case of empty framebuffer

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>
cary-ilm pushed a commit to cary-ilm/openexr that referenced this pull request May 12, 2021
…e API (AcademySoftwareFoundation#830)

* refactor channel filling in InputFile API with tiled source

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* handle edge-case of empty framebuffer

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>
cary-ilm added a commit that referenced this pull request May 16, 2021
* double-check unpackedBuffer created in DWA uncompress

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* compute Huf codelengths using 64 bit to prevent shift overflow

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* Avoid overflow in calculateNumTiles when size=MAX_INT (#825)

* Avoid overflow in calculateNumTiles when size=MAX_INT

Signed-off-by: Cary Phillips <cary@ilm.com>

* Compute level size with 64 bits to avoid overflow

Signed-off-by: Cary Phillips <cary@ilm.com>

* More efficient handling of filled channels reading tiles with scanline API (#830)

* refactor channel filling in InputFile API with tiled source

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* handle edge-case of empty framebuffer

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* fix undefined behavior: ignore unused bits in B44 mode detection (#832)


Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* Fix overflow computing deeptile sample table size (#861)


Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* sanity check ScanlineInput bytesPerLine instead of lineOffset size (#863)

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>

* Release notes for v2.4.3

Signed-off-by: Cary Phillips <cary@ilm.com>

* Bump version for v2.4.3

Signed-off-by: Cary Phillips <cary@ilm.com>

* reduce size limit for scanline files; prevent large chunkoffset allocations (#824)

* reduce size limit for scanline files; protect against large chunkoffset allocations

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* bugfix for memory limit changes

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* rearrange chunkoffset test to protect bytesperline table too

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

* remove extraneous function declaration; tidy comments

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
Signed-off-by: Cary Phillips <cary@ilm.com>

* Change v2.4.3 release date to May 17, and clean up urls

Signed-off-by: Cary Phillips <cary@ilm.com>

Co-authored-by: Peter Hillman <peterh@wetafx.co.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants