Skip to content

Support compensation for Canon's Highlight tone priority#21371

Open
piratenpanda wants to merge 3 commits into
darktable-org:masterfrom
piratenpanda:patch-7
Open

Support compensation for Canon's Highlight tone priority#21371
piratenpanda wants to merge 3 commits into
darktable-org:masterfrom
piratenpanda:patch-7

Conversation

@piratenpanda

@piratenpanda piratenpanda commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Checked independently of ALO since both tags can be set simultaneously on modern Canon bodies. On my R5m2 with HTP on, ALO doesn't seem to affect the raw files though.

+1 EV yielded perfect compensation for D+ and in my scene as well for D+2 but results may vary for different scenes. +1 EV is a good starting point still and better than the nothing we currently have.

Checked independently of ALO since both tags can be set simultaneously on modern Canon bodies. On My R5m2 with HTP on, ALO doesn't seem to affect the raw files.

+1 EV yielded perfect compensation for D+ and in my scene as well for D+2 but results may vary for different scenes. +1 EV is a good starting point still and better than the nothing we currently have.

@ralfbrown ralfbrown left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. As written, if both HTP and ALO are active, ALO overrides the HTP setting. Is that what you intended? If you add an "else" to the start of the "if" checking for LightingOpt, then HTP will take priority when both are present.

@piratenpanda

piratenpanda commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

I dont't think ALO overrides HTP in the camera. I tried with both and the HTP correction value was the right one. I'll do more tests but it seemed fine here. But good to double check that. But I understand what you mean and rn I'm unsure.

@wpferguson

Copy link
Copy Markdown
Member

How would this effect shooting in HDR PQ mode? One of the recommendations in the camera manual is to turn on HTP when shooting HDR PQ.

@piratenpanda

piratenpanda commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

you're right. My testing was obviously flawed. But wouldn't

    {
       const long state = pos->toLong(0);
       if(state > 0)
          img->exif_highlight_preservation = 1.0f;      // D+ or D+2: ~1 EV underexposure
    }

    if(img->exif_highlight_preservation == 0.0f)  // only check ALO if HTP is not active
    {
       if(FIND_EXIF_TAG("Exif.Canon.LightingOpt"))
       ...
       else if(FIND_EXIF_TAG("Exif.CanonLiOp.AutoLightingOptimizer"))
       ...
       else if(FIND_EXIF_TAG("Exif.Fujifilm..."))
       ...
    }

be better? HTP should always be preferred to my testing. I manually shot a neutral grey and compared exposure changes needed to keep it the same exposure

@piratenpanda

Copy link
Copy Markdown
Contributor Author

How would this effect shooting in HDR PQ mode? One of the recommendations in the camera manual is to turn on HTP when shooting HDR PQ.

I'll need to try that as well

@piratenpanda

Copy link
Copy Markdown
Contributor Author

The PQ RAW looks fine with +1 EV to me. Completely the same exposure as D+ without PQ. Don't know if I should see a difference in darktable tbh

@piratenpanda

Copy link
Copy Markdown
Contributor Author

So best way would be to have ALO first and the let HTP override right?

@wpferguson

wpferguson commented Jun 20, 2026

Copy link
Copy Markdown
Member

I updated my firmware to 1.8.0 and now I have some new settings including Highlight Tone Priority 😁

Tested with ALO set to low and HTP set to D+. The correction to the raw was 0.3 EV

EDIT: Tomorrow I'll shoot sets of images with all the combinations and see what I get.

@piratenpanda

piratenpanda commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

The correction to the raw was 0.3 EV

with the current darktable? That's expected. Also with the current version of my PR because it's wrong I think. The test you need to do is take a picture without ALO or HTP and use this as reference. Now enable ALO and or HTP and check how much EV you have to change to make the exposure the same. For me it's always 1 EV when HTP is on.

@piratenpanda

Copy link
Copy Markdown
Contributor Author

I've updated the PR to my findings. please test with other cams. For me this gives the same exposure for ALO and HTP off, HTP on, ALO + HTP on. ALO alone results in higher exposures which maybe should be discussed too. Or maybe that's expected behaviour.

@ralfbrown

Copy link
Copy Markdown
Collaborator

You'll note the comments that say "estimated strength". I'd be happy to have someone supply better numbers based on actual analyses.

@piratenpanda

Copy link
Copy Markdown
Contributor Author

I'll run some tests. For my indoor grey card tests it was 0 EV difference for none, low, standard and high. Will test outdoor tomorrow.

@piratenpanda piratenpanda marked this pull request as draft June 22, 2026 04:57
@piratenpanda

Copy link
Copy Markdown
Contributor Author

My testing was flawed as ALO doesn't work in manual mode. Yet manual mode has to be excluded from the corrections then. Will redo the patch and do more testing before

@piratenpanda

Copy link
Copy Markdown
Contributor Author

I just did more reading. So ALO does not affect raw data. Why are we even applying exposure compensation then?

@ralfbrown

Copy link
Copy Markdown
Collaborator

Because it does affect the overall (perceived) brightness of the image. This can involve just a tone-curve change without an actual exposure change, but matching that will be both more difficult to determine and to implement.

@piratenpanda piratenpanda marked this pull request as ready for review June 22, 2026 13:33
@piratenpanda

piratenpanda commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Ok, then HTP needs to be additive. Ready from my side I guess

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