Repository navigation
LR-IMP-FORMATS: decode Canon EOS R5 Mark II C-RAW (CRX QP-map first literal and escape) - #915
Closed
ingolfteetz wants to merge 3 commits into
Closed
ingolfteetz wants to merge 3 commits into
ingolfteetz wants to merge 3 commits into
Conversation
…iteral and escape)
The CRX 0x200 QP map opens with its first symbol as a 32-bit literal; every
later symbol is Rice coded with a limited-length escape: 23 zeros, the
terminating 1 and the symbol in 8 bits (the ITU-T T.87 layout for a 32-bit
limit and 8-bit symbols, without its minus-one offset). The old rule (an
escape after 16 zeros with a 16-bit literal) matched only the first symbol,
which is all the R8 and R7 maps need. R5 Mark II maps (QP 150-162) jump by up
to 12 where the Rice parameter is 0, giving 18- to 22-zero prefixes that
misparsed ("Canon CRX adaptive QP value -21087"): 174 of 306 sampled files
from a private R5 Mark II library opened as previews. Every QP map of its
33,665 C-RAW files now decodes to the exact end of its entropy stream; the six
oracle fixtures are unchanged. Established by black-box analysis of the
bitstream; no third-party decoder source consulted.
Adds the four CC0 R5 Mark II samples (raw.pixls.us 7881-7884) to the corpus
with pinned sensor hashes (the crop-mode framing is left to storytold#754), bumps
RENDER_CACHE_VERSION to 43, and updates cr3.md, raw-parity (235 verified
models), coverage, gaps, the checklist rows, ROADMAP, target-app-parity and
What's New.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # crates/engine/src/media.rs # crates/raw/src/vendor/crx.rs # docs/parity-checklist.md
… x 3392 framing With storytold#754 on main, the recommended crop is the valid area of the crop-mode files (raw.pixls.us 7883, 7884), so their pinned tests assert the developed size again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Landed in #981 together with #961. #829's QP 168 test and yours both pass on the merged decoder. Thanks again, @ingolfteetz! Generated by Claude Code |
EddifyBot
pushed a commit
to good-shepherd-insights/lightcraft
that referenced
this pull request
Oct 11, 2026
# Conflicts: # crates/engine/src/media.rs # crates/raw/src/vendor/crx.rs # crates/ui-egui/locales/de.json # docs/gaps.md # docs/parity-checklist.md # docs/raw-parity.md # docs/whats-new.md
EddifyBot
pushed a commit
to good-shepherd-insights/lightcraft
that referenced
this pull request
Oct 11, 2026
…t] was lost merging storytold#915 next to storytold#829) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BKWB9TCnvzJHV6xMLAj2J4
Contributor
Author
|
Thanks @bflatastic, and @radialmonster for the review! Closing this, since it landed via #981. Two small leftovers stay on this branch and can go into a later PR: the crop-mode fixtures (7883, 7884) could assert the 5088 × 3392 framing again now that #754 is in, and |
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.
Fixes the R5 Mark II part of #832: many EOS R5 Mark II C-RAW files open as previews with
Canon CRX adaptive QP value -21087(or another out-of-range value).Cause. The CRX 0x200 QP map starts with its first symbol as a 32-bit literal. Every later symbol is Rice-coded with a limited-length escape: 23 zeros, the terminating 1, then the symbol in 8 bits. That is the ITU-T T.87 escape layout for a 32-bit limit and 8-bit symbols, without its −1 offset. Main treats any 16-zero prefix as an escape followed by a 16-bit literal. That reads the first symbol the same way, which is all the R8 and R7 maps need. R5 Mark II maps (QP 150–162), though, jump by up to 12 where the Rice parameter is 0. That gives 18- to 22-zero prefixes, which are ordinary symbols, and real escapes (symbols 23 and 24). No QP value outside the verified 131–167 table is involved.
Tested with
_A3A2841.CR3, ISO 1000), fully decoded and rendered: it matches the camera's embedded 8192 × 5464 JPEG at 100 %, with no steps in the bottom rows. The Bayer planes are 2825 rows, odd at every wavelet level.What changes
crates/raw/src/vendor/crx.rs: the first QP symbol is read as a 32-bit literal, and the escape is 23 zeros, the terminating 1 and an 8-bit symbol, with tests.crates/raw/tests/cr3_corpus.rsandxtask: the four CC0 files with pinned sensor hashes. The crop-mode files also check the camera's 5088 × 3392 framing, which LR-IMP-FORMATS: EOS R5 Mark II crop-mode CR3s develop without a black band #754 gives them.RENDER_CACHE_VERSION50 → 51, so thumbnails of files whose decode changed are redrawn. Photos imported as preview-only switch over with Photo ▸ Reload from Disk.Related, now on main
cr3.rsis not touched here.With the header-only probe proposed in #832, the R5 Mark II files now probe as raws, so only their headers and QP maps are read instead of the 3 MB JPEG track.
Checks. Before merging main:
cargo xtask cipasses exceptexport_progress_and_cancel(#674). After merging main (#975):cargo fmt --check, clippy-D warningson raw and engine, the engine lib tests,cargo xtask parityandcargo test -p lightcraft-rawwith the corpus (includingcr3_corpus) pass.🤖 Generated with Claude Code