Skip to content

Conversation

jenshannoschwalm
Copy link
Collaborator

A final prerequisite to implement internal tiling code for the demosaicer but still very good for decent GPU cards or systems with small main memory.

  • some refactoring of details/scharr mask code for better integration into dual demosaicing
  • consequent use of width & height instead of roi for dual, capture and green equilibration
  • early OpenCL green_equilibration to support internal tiling and possibly early fallbacks
  • early calculation of capture sharpen radius with improved UI feedback
  • fixed some very unlikely but possible memleaks
  • instead of just logging direct/scaled we provide details about demosaicing (at least for now).
  • maintenance for readability and constify

Release note: Dual demosaicing now works also in tiling mode for possibly better OpenCL performance and smaller CPU memory pressure.

@TurboGit Whatever happens to my current work on demosaic internal tiling - that would basically mean details masks are also provided when we have to tile avoiding CPU fallbacks - this part is a) the last prerequisite for that and b) certainly worthwhile on it's own.

@jenshannoschwalm jenshannoschwalm added this to the 5.4 milestone Sep 3, 2025
@jenshannoschwalm jenshannoschwalm added priority: high core features are broken and not usable at all, software crashes scope: performance doing everything the same but faster scope: codebase making darktable source code easier to manage OpenCL Related to darktable OpenCL code labels Sep 3, 2025
A final prerequisite to implement internal tiling code for the demosaicer but still
very good for decent GPU cards or systems with small main memory.

- some refactoring of details/scharr mask code for better integration into dual demosaicing
- consequent use of width & height instead of roi for dual, capture and green equilibration
- early OpenCL green_equilibration to support internal tiling and possibly early fallbacks
- early calculation of capture sharpen radius with improved UI feedback
- fixed some very unlikely but possible memleaks
- instead of just logging direct/scaled we provide details about demosaicing (at least for now).
- maintenance for readability and constify
@jenshannoschwalm
Copy link
Collaborator Author

jenshannoschwalm commented Sep 3, 2025

Ready to go. Also fixed details writing, must be done before color equalizing (EDIT: first comment said greens)

@TurboGit
Copy link
Member

TurboGit commented Sep 3, 2025

For the record this introduces some diff on dual test. It seems that the diff are mostly on the sharpen edges. Examples:

image image

Is that expected?

I suppose that this is due to your fix on details writing, which are now done before green equalizing?

@jenshannoschwalm
Copy link
Collaborator Author

It is expected but there is a different reason :-)

On master we calculated the scharr mask for blending between high/low frequency demosaicer from the main demosaicer output.

Now we do capture sharpening on main demosaicer first and use that's output for scharr mask calculation. This decision might be debatable but assuming we "correct blurred sensor data" that masks a lot of sense to me.

There is also a second subtle difference. The details mask (for blending) is not calculated from main demosaicer any more but from the possibly dual-demosaiced data as that takes into account a) the capture sharpening and b) possibly less noise/moire in low contrast areas.

@TurboGit
Copy link
Member

TurboGit commented Sep 3, 2025

Ok, thanks for the detailed explanation.

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.

Good to go!

@TurboGit TurboGit merged commit c868c40 into darktable-org:master Sep 3, 2025
6 checks passed
@jenshannoschwalm jenshannoschwalm deleted the dual_demosaic_tiling branch September 3, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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: performance doing everything the same but faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants