Repository navigation
Decode non-grid HEIC images in bounded decoding - #33
Merged
Merged
Conversation
A single hvc1/hev1 primary is decoded as a grid with one tile. Its reconstruction workspace is reserved during preflight, so an image that does not fit the budget is refused before decoding, and its payload is bounded by the budget instead of the 16 MiB grid tile cap. The bounded path also accepts a one-channel 8-bit pixi.
Author
|
@codex review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
decode_boundedonly accepted grid primaries, so non-grid HEICs, including some iPhone exports, failed with "primary item must be a HEIC grid". A singlehvc1/hev1primary is now decoded as a grid with one tile, with the same orientation, Exif and colour handling as a grid.Unlike a grid, a single image is reconstructed all at once. Its workspace is reserved during preflight from the coded size, so an image that doesn't fit the budget is refused before any decoding. Its payload is bounded by the budget rather than the 16 MiB grid tile cap. At a 512 MiB budget this admits single images up to roughly 55 MP (an estimate); grids are unaffected. The bounded path also now accepts a one-channel 8-bit
pixi, which only the incremental experiment allowed before.Measured through
ente_image::decode_boundedat a 512 MiB budget and max side 6000, against an area downsample of the full decode:1718_rotate_90_cw.HEIC7949_mirror_horizontal_rotate_270_cw.HEICAt a 32 MiB budget,
1718is refused with a 9.5 MiB peak. 119 of 172 single-image HEVC files in the local corpora now decode; the rest are 10/12-bit, 4:2:2/4:4:4, alpha or malformed. Grid output is byte-identical tomainon all 36 grid files compared.Ente's
non_grid_heic_fixtures_are_rejected_when_presenttest will need updating when it picks this up, since1718and7949now decode.Source fork PR: laurens-pilot#21
@laurenspriem