Repository navigation
Conversation
gregbenz
force-pushed
the
codex/heif-avif-owned-output-current-main
branch
from
September 10, 2026 02:35
ce74204 to
6e0c915
Compare
gregbenz
force-pushed
the
codex/heif-avif-owned-output-current-main
branch
from
September 19, 2026 02:34
6e0c915 to
c1e4d0e
Compare
Retain upstream AVIF and HEIF routing coverage alongside exact output capacity assertions. The AVIF-focused unit tests pass; HEVC-only cases skip without an HEVC encoder.
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.
Why
HEIF/AVIF encoding currently keeps two output allocations alive when encoding finishes: the writer's growable buffer and a separate
uhdr_encode()result buffer reserved asmax(64 KiB, 6 * width * height). The encoded bytes are then copied from one buffer to the other.This change lets the returned compressed image take ownership of the writer's allocation. That removes the speculative result allocation and final copy, reducing peak memory use during HEIF/AVIF encoding. It also allows valid output larger than the old estimate to succeed.
What changed
free-compatible cleanup.data_szwhen a fixed destination is invalid or too small.The public C API remains unchanged, and this does not change decoder behavior.
Testing
Validated commit
c1e4d0e, rebased ontof3e3622: