Repository navigation
Treat unci pixel_size as an exact stride for sub-byte pixel groups - #13
laurens-pilot wants to merge 1 commit into
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
handle_pixel_alignment counted whole bytes and kept any leftover bit offset, so a 30-bit RGB group in a 4-byte pixel skipped one byte and started the next pixel at bit 38 instead of bit 32. A payload of pixel_size x width bytes could fail as truncated or decode to wrong pixels with no error, depending on the group size and row width. For 30-bit RGB in a 4-byte pixel, widths divisible by 4 decoded wrongly. Generically compressed items failed the same way after decompression, and for a 2x1 image the nine bytes the old reader expected also exceeded the eight-byte decompression budget. Track the pixel start in bits and advance to exactly pixel_size bytes past it. A group that does not fit pixel_size is now rejected even when it overflows by less than a byte, as libheif and GPAC already do. This deliberately differs from libheif's generic pixel path, which starts the next pixel at bit 30 because its byte index rounds a partial byte up. That path disagrees with libheif's own tile sizing, block pixel decoder and encoder, and with GPAC. No file in the libheif or local HEIC corpora uses such a layout, and decode output for libheif's 170 unci files is unchanged.
70bd461 to
6a4a011
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Superseded by ente#25. |
pixel_sizelayouts whose components don't fill whole bytes decoded wrongly, for example 10-bit RGB inpixel_size4 or 7-bit mono inpixel_size2. The reader counted whole bytes and kept the leftover bits, so after 30 bits it skipped one byte and started the next pixel at bit 38 instead of bit 32.A stride-sized payload could fail as truncated or decode to incorrect pixels, depending on the group size and row width. For 10-bit RGB in
pixel_size4, widths divisible by 4 decoded incorrectly, including 18 of 24 pixels on an 8×3 fixture. The compressed versions showed the same failures after decompression. For the 2×1 RGB10 example, the nine-byte payload expected by the old reader also exceeded the eight-byte decompression budget. Each pixel now starts exactlypixel_sizebytes after the previous one, including multi-Y groups. A group that doesn't fit is rejected even when it overflows by less than a byte, which matches libheif and GPAC.Diverging from libheif
This intentionally differs from libheif's generic pixel path, and that is the right call. The crate never matched that path on these layouts anyway. Here is a 2x1 image of 10-bit RGB in
pixel_size4, from an 8-byte payload:block_size4)libheif's byte index rounds a partial byte up, so after 30 bits it skips nothing and
pixel_sizehas no effect. Its ownget_tile_data_sizes, block pixel decoder and encoder all use an exactpixel_sizestride, so its generic reader is the odd one out. Tested at b97c8b5f and the pinned 78638f4; upstream master has the same code.Not checked against the spec text: the public preview of ISO/IEC 23001-17:2024 stops at 5.2.1.6.2, before the pixel-interleaving clause, 5.2.1.7 and the 5.2.3 semantics. The decision rests on the implementations above, so someone with the full text should confirm the
pixel_sizewording before this goes upstream.The
verifyjob's heif-dec comparison can't see this divergence. None of 651 local HEIF/HEIC/AVIF files has a sub-byte group withpixel_sizeset, and decode output for libheif's 170 unci files is byte-identical before and after.