Skip to content

Decode non-grid HEIC images in bounded decoding - #21

Closed
laurens-pilot wants to merge 1 commit into
mainfrom
feat/bounded-single-image
Closed

laurens-pilot wants to merge 1 commit into
mainfrom
feat/bounded-single-image

Conversation

@laurens-pilot

Copy link
Copy Markdown
Owner

decode_bounded only accepted grid primaries, so non-grid HEICs, including some iPhone exports, failed with "primary item must be a HEIC grid". A single hvc1/hev1 primary 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_bounded at a 512 MiB budget and max side 6000, against an area downsample of the full decode:

File Result Peak heap
1718_rotate_90_cw.HEIC exact match 79 MiB
7949_mirror_horizontal_rotate_270_cw.HEIC within ±1 17 MiB
8192×4320 WPP image within ±1, ~0.5 s 270 MiB

At a 32 MiB budget, 1718 is 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 to main on all 36 grid files compared.

Ente's non_grid_heic_fixtures_are_rejected_when_present test will need updating when it picks this up, since 1718 and 7949 now decode.

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.
@laurens-pilot

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T10:02:57.019573Z d372b81 Manual request
🔒 Security Review ✅ Completed 2026-11-05T10:04:43.795732Z d372b81 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: d372b81d6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: d372b81d6a

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@laurens-pilot

Copy link
Copy Markdown
Owner Author

Superseded by ente#33.

@laurens-pilot
laurens-pilot deleted the feat/bounded-single-image branch November 5, 2026 10:55
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.

2 participants