Skip to content

Accept reference encoder alpha end offsets - #28

Merged
jcwal1516 merged 1 commit into
frames-sg:mainfrom
domenic:codex/reference-alpha-length
Nov 13, 2026
Merged

jcwal1516 merged 1 commit into
frames-sg:mainfrom
domenic:codex/reference-alpha-length

Conversation

@domenic

@domenic domenic commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Some Microsoft reference-encoder files put the absolute alpha end offset in ALPHA_BYTE_COUNT instead of the stream length. The parser rejected these separate-alpha images because adding the offset to that value extended beyond the input.

Recognize this convention only when the stored value equals the file length and the alpha offset lies strictly inside the file. Normalize it to a length before the existing range and overlap checks; ordinary byte counts retain their existing interpretation.


My agent found this and one other issue while processing a corpus of Kindle test books. I take responsibility for the code written, but am not a domain expert.

Some Microsoft reference-encoder files put the absolute alpha end offset in ALPHA_BYTE_COUNT instead of the stream length. The parser rejected these separate-alpha images because adding the offset to that value extended beyond the input.

Recognize this convention only when the stored value equals the file length and the alpha offset lies strictly inside the file. Normalize it to a length before the existing range and overlap checks; ordinary byte counts retain their existing interpretation.

Co-authored-by: GPT-6 Astra · Extra High <codex@openai.com>
@jcwal1516

Copy link
Copy Markdown
Member

Thanks for digging into this. The reference encoder does write the end offset here, so this makes sense. I ran the regression tests, including the decode comparison, and everything passed. CI is green too. Looks good to merge.

@jcwal1516
jcwal1516 merged commit fa44d1c into frames-sg:main Nov 13, 2026
2 checks passed
jcwal1516 added a commit that referenced this pull request Nov 15, 2026
Publish the separate-alpha SCALED_FLAG fix (#30) with the reference
encoder alpha end offsets (#28) and the additional WIC pixel formats
(#27). jxr-native and jxr-metal change; jxr, jxr-image and jxr-mpsgraph
follow their exact pins to 0.5.1 and 0.6.1. jxr-core, jxr-cuda and
jxr-math are unchanged and keep their published versions. Both
lockfiles follow.

cargo semver-checks reports no semver update required for any of the
five packages. docs/releasing.md gives the publish order.
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