Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bugfixes for LateD65 whitebalance and detail mask #16290

Merged
merged 4 commits into from
Feb 11, 2024

Conversation

jenshannoschwalm
Copy link
Collaborator

@jenshannoschwalm jenshannoschwalm commented Feb 11, 2024

  1. introduce the NaN aware dt_vector_max_nan() and dt_vector_clipneg_nan() vector function variants and make use of them where required.
  2. For the segmentation based HLR we also require the correction to be used in LateD65 mode.
  3. Make sure the OpenCL code for VNG demosaicers writes the scharr/detail mask if requested. Not done only in dual demoiser modes as they want the mask to be written from the "sharper" demosaicer like RCD.
  4. EDIT: make sure DT_ADAPTATION_CAT16 is used per default

Fixes #16280
Fixes #16286
Fixes #16282

Third commit would also be for 4.6.1

@jenshannoschwalm jenshannoschwalm added this to the 4.8 milestone Feb 11, 2024
@jenshannoschwalm jenshannoschwalm added bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes scope: image processing correcting pixels scope: codebase making darktable source code easier to manage OpenCL Related to darktable OpenCL code labels Feb 11, 2024
@TurboGit
Copy link
Member

Tested against 0094, the result is not identical but the diff is not visible:

Test 0094-highlight-segmentation
      Image hlrecovery.arw
 
      Expected CPU vs. current CPU report :
      ----------------------------------
      Max dE                   : 3.15145
      Avg dE                   : 0.08140
      Std dE                   : 0.25824
      ----------------------------------
      Pixels below avg + 0 std : 90.07 %
      Pixels below avg + 1 std : 90.07 %
      Pixels below avg + 3 std : 97.91 %
      Pixels below avg + 6 std : 99.95 %
      Pixels below avg + 9 std : 100.00 %
      ----------------------------------
      Pixels above tolerance   : 0.01 %
 
  FAILS: image visually changed
         see diff.png for visual difference
         (416568 pixels changed)

Diff:
image

Expected:
image

Output:
image

@AxelG-DE
Copy link

AxelG-DE commented Feb 11, 2024

I just tested this PR with regards to the adaptation only and currently there is a new "bug". The temperature is fixed at 5003 K.

  • Only when resetting the module, the actual value comes
  • I donno whether it has been done this way, but it would be better to figure out, why adaptation didn't/doesn't obey workflow settings
PR16290_20240211-2024-02-11_14.40.28.mp4

@jenshannoschwalm
Copy link
Collaborator Author

  • Only when resetting the module, the actual value comes

  • I donno whether it has been done this way, but it would be better to figure out, why adaptation didn't/doesn't obey workflow settings

Please explain. I tested here with all 4 workflow options and couldn't yet reproduce ... Any preset in color calibration used? BTW i had observed such behaviour while working on the new stuff but thought i had fixed it ...

@TurboGit
Copy link
Member

@jenshannoschwalm : The first point (Only when resetting the module, the actual value comes) is again only when resetting history from Lighttable.

Add dt_vector_max_nan() and dt_vector_clipneg_nan() variants, both make sure
we test for max even for NaNs.
The refavg for each segment also requires the correction to be applied.
Correction must be depending on late correction or not.
All VNG variants should write the scharr mask except for dual demosaicing as the use the sharper mode for the mask.
@jenshannoschwalm
Copy link
Collaborator Author

Latest commit fixed the second point in segmentation where we required valid correction data.

@TurboGit
Copy link
Member

@jenshannoschwalm : Confirmed, test 0094 pass now with the exact same value as previously.

@jenshannoschwalm
Copy link
Collaborator Author

The first point (Only when resetting the module, the actual value comes) is again only when resetting history from Lighttable.

I see. I am not sure if this was different before :-) What we have is:

  1. we don't want the module to be enabled in "legacy" or "none" mode. So we don't have data available to show some meaningful temp data
  2. "reset" - better reload defaults now works.

@TurboGit
Copy link
Member

TurboGit commented Feb 11, 2024

@jenshannoschwalm : I have this issue in "scene referred" workflow too on my side.

1. should use DT_ADAPTATION_CAT16 per default, Only not the case
   for monochromes or already applied CAT.
2. fixed wrong returned flag while checking for custom wb
@jenshannoschwalm
Copy link
Collaborator Author

Could you check again with latest force-push ?

@jenshannoschwalm
Copy link
Collaborator Author

BTW: commit (4) issues might very well be in 4.6 too, will check after we got it sorted out here.

@TurboGit
Copy link
Member

This latest version works for me, @AxelG-DE can you double check too on your side? TIA.

@AxelG-DE
Copy link

Please explain. I tested here with all 4 workflow options and couldn't yet reproduce ... Any preset in color calibration used? BTW i had observed such behaviour while working on the new stuff but thought i had fixed it ...

I would have hard time to explain better than my screencast, which is very comprehensive :-D

But anyhow I have tested last commit now (19:18 UTC+1) and

  • it behaves again as I would expect
  • I have merely tested in scene-referred (filmic)

Thanks from my side

Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

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

Thanks!

@TurboGit TurboGit merged commit a5362c7 into darktable-org:master Feb 11, 2024
6 checks passed
@jenshannoschwalm jenshannoschwalm deleted the nan_vector_functions branch April 20, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix pull request fixing a bug OpenCL Related to darktable OpenCL code priority: high core features are broken and not usable at all, software crashes scope: codebase making darktable source code easier to manage scope: image processing correcting pixels
Projects
None yet
3 participants