Skip to content

imageio/libraw: add Canon EOS R6 Mark III CR3 support - #21433

Closed
OODesigns wants to merge 1 commit into
darktable-org:masterfrom
OODesigns:oodesigns-canon-r6-mark-iii-support
Closed

imageio/libraw: add Canon EOS R6 Mark III CR3 support - #21433
OODesigns wants to merge 1 commit into
darktable-org:masterfrom
OODesigns:oodesigns-canon-r6-mark-iii-support

Conversation

@OODesigns

Copy link
Copy Markdown

Written using copilot

Add the Canon EOS R6 Mark III to the LibRaw maker/model map so its standard full-frame RAW .CR3 files are identified and decoded. LibRaw 0.21+ recognises the sensor but ships without full calibration for this body, so two raw-level corrections are applied, scoped to CR3 only:

  • White point: LibRaw reports an implausibly low linear_max (~161) for this camera while the true 14-bit maximum is 16383. When linear_max is below a quarter of maximum it is treated as bogus and maximum is used instead, which prevents the whole frame being clipped to white. The quarter threshold is deliberately conservative: it still catches this body (whose linear_max is ~1% of maximum) while leaving any future CR3 camera that legitimately saturates low untouched. Non-CR3 formats keep the historical "linear_max when present, else maximum" behaviour.

  • Black level: LibRaw reports black=0, producing a global magenta cast after white balance. When black is zero for a CR3, per-CFA-site black levels are estimated from the masked optical-black border using a robust median, which removes the cast.

The two pure decision helpers are extracted into imageio_libraw_levels.h and covered by unit tests under src/tests/unittests/imageio, following the existing cmocka test pattern. Tests assert the non-CR3 white-point path is byte-identical to the legacy behaviour, that the CR3 path rejects the implausible linear_max at the quarter-maximum threshold, that the masked-black median ignores hot pixel tails, and that the R6 / R6 Mark II / R6 Mark III model strings resolve distinctly.

@piratenpanda

piratenpanda commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

But this will break further libraw support, right? This is not how we should add new cameras to libraw. Libraw unfortunately is really slow with new camera support. Rather use this LibRaw/LibRaw#745 as a temporary solution and do minimal changes to darktable as in #17376

@OODesigns

Copy link
Copy Markdown
Author

I just needed it for my own use, how would you like me to proceed.

@piratenpanda

Copy link
Copy Markdown
Contributor

I have no say in this but the usual way was to wait for libraw to release support and do custom builds in the meantime. Like here for the Mac https://discuss.pixls.us/t/current-osx-build/13213/1008

@OODesigns

Copy link
Copy Markdown
Author

OK, not sure how to replicate that. just did this on a whim as i need it but happy to help: I assume create github home page with builds

@piratenpanda

Copy link
Copy Markdown
Contributor

No need for you to do that. all code is basically already available. I guess it's unfortunately just waiting for r6m3 users at this point in time.

@MStraeten

Copy link
Copy Markdown
Collaborator

OK, not sure how to replicate that. just did this on a whim as i need it but happy to help: I assume create github home page with builds

You can point libraw submodule to https://github.com/MStraeten/LibRaw.git and checkout branch r6mIII which includes the pr from JuanPabloZambrano

Canon EOS R6 Mark III .CR3 files were not rendered correctly. The
LibRaw commit darktable pinned does not recognise the body, so it
mis-assigned the EOS R6 Mark II colour matrix and reported bogus
black (0) and white (linear_max) levels, clipping the raw render
to white.

Bump the LibRaw submodule to MStraeten/LibRaw r6mIII, which carries
the upstream R6 Mark III support pull request from JuanPabloZambrano
(correct camera id, colour matrix and black/white levels). With LibRaw
supplying valid calibration data, darktable needs no decoder-side
workarounds.

Also add the Canon EOS R6 Mark III entry to the imageio_libraw model
map so the camera shows its clean name and does not trigger the
"camera not fully supported" warning, matching the existing
EOS R6 / R6 Mark II / R3 entries. A small cmocka test covers the
model-map lookup.

Note: the submodule temporarily points at a personal LibRaw fork
branch for testing. This is not upstream-mergeable until the R6 Mark
III support lands in an official LibRaw release and darktable bumps
the submodule to an upstream LibRaw commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@OODesigns OODesigns force-pushed the oodesigns-canon-r6-mark-iii-support branch from fe5463c to 6cff725 Compare June 28, 2026 09:30
@MStraeten

Copy link
Copy Markdown
Collaborator

it doesn't make sense to merge something into master which is pointing to a custom fork of libraw.
Who knows how the final implementation is done (it's already available for commercial RawDigger) ...

@jenshannoschwalm jenshannoschwalm marked this pull request as draft June 28, 2026 16:24
@OODesigns

Copy link
Copy Markdown
Author

Yes will fork from "You can point libraw submodule to https://github.com/MStraeten/LibRaw.git and checkout branch r6mIII which includes the pr from JuanPabloZambrano" This PR can be closed will have own copy

@OODesigns OODesigns closed this Jun 28, 2026
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.

3 participants