Diffuse or Sharpen module --- ouch!

It was only with the release of DT4.0 that I noticed the mention of Diffuse or Sharpen as ‘preferred’ to Local Contrast module and ‘preferred’ to Sharpen module, so I decided to make the shift, having a scene-referred workflow for a couple of years now.

Ouch!

2 big issues that arose are speed, and effect.

Speed. Unusable on my Mac Mini M1 Silicon with MacOS Monterey 12.4. Yes, I read the manual, it is “highly resource intensive”, and “OpenCL is therefore strongly recommended”. And yes, I noticed the OpenCL option is greyed out on my preferences panel. But gee, that is not a dog-slouch computer, and also it is supported for Metal GPUFamily, so you would think the DT developers would be able to get the action to happen in at least barely-usable levels. For example the preset for Add Local Contrast takes 20 to 40 seconds to implement. Even the Fast Local Contrast preset takes at least 10 seconds (for all the good it does: see issue 2).

And any action in ‘D or S’ module incurs the full delay, not just changing the sliders, but reset to default, or zooming the view, or changing to Colour Assessment view: full delay each time. Not only is it slow to implement an action, but any subsequent actions suffer the full delay. Close the ‘D or S’ module: full delay. Open another module eg crop: full delay. Apply crop: full delay. Close the image and then open it again: full delay.

Nowhere near to workable, IMHO.

Effect. Puny, almost invisible effect compared to the old modules Local Contrast, and Sharpen.

I thought I would be able to get similar effects to the old modules, with a bit more ‘scene-referred purity’. The default setting for the old Local Contrast module, is clearly evident and in many cases beneficial for my photos, and has become something of a go-to for my workflow. But the ‘D or S’ presets, both the single-iteration ‘Fast Local Contrast’ and the 10-iteration ‘Add Local Contrast’ presets, are so subtle that I would be challenged to tell if they were on or off, without a quick A/B/A comparison, and even then it is an eye-squinter. Same for Sharpen Demosaicing preset.

Who knows, maybe I can get a Local Contrast effect similar to the old module at Detail =125%, and at 180%, with heavy use of the sliders in the ‘D or S’ module, but the process of learning to tweak the module is so painful due to the slow operation, that it would take as many hours as it used to take minutes, and every subsequent operation with the image is slowed to a crawl too. So I can’t even play with its settings: the process is too painful!

Conclusion.

I’m not even sure what I’m asking here:
-Do I just dump the module and go back to the old equivalents? (what if they get deprecated?)
-Is there a way to use ‘D or S’ that minimises the delays?
-Is anyone working on presets that more closely deliver a magnitude of effect similar to the old modules? (and will they be even more unworkably slow eg more iterations?)
-Is there the slightest chance that a developer might use the M1 Silicon Metal support to access more GPU speed, for modern computers like mine that have fully deprecated OpenCL? Any time soon?

As you can tell, I am as disappointed at the moment as I was excited a couple of days ago, when I first decided to adopt ‘D or S’.

cheers

I’m new to diffuse and sharpen too. To start with I don’t think there’s much problem with sticking to local contrast, if it does what one wants. It’s not scene-referred etc., but by default it comes after filmic, so I don’t think it messes up the pipeline too much. (my non-technical opinion!).
I use a relatively old desktop with no OpenCL and 3 gig quad-core, and I find that diffuse and sharpen is useful with just 2 or 3 iterations, and fiddling with the first bank of sliders (‘speed’) , the radius and the edge sensitivity. It does slow things down though, so after finding the rough settings I want I switch it off until I’m ready to export.
But I’m no expert! And i use local contrast too…

Just a few remarks:

  • If the manual says “resource intensive” it means it (as you noticed)
  • There are not all that many macOS developers active for dt, and iirc Metal needs specific code (like openCL); no devs == no code…
  • One of the things I don’t like about the “local contrast” module is the increase in global contrast, which is absent from the D&S version of local contrast.
  • Deprecated modules have technical issues. Afaik, there are no such issues with the “sharpen” and “local contrast” modules. So if you prefer using them, there’s no reason not to, the more as even deprecated modules ar not removed from the code. And, existing edits are still valid, even if they use modules that are now deprecated.
  • You can also try the “contrast equaliser” module for sharpening.
  • The “sharpen demosaic” preset is supposed to be subtle, and to see the effect you have to be at 100%. It’s the equivalent of “capture sharpening” in the 3-step sharpening workflow (capture, creative, output), which in general used unsharp masking (which can cause ugly halos if pushed too far).

Also, note that “preferred” is just that: if your computer can handle it, there are technical/mathematical reasons to prefer D&S over “sharpen” and “local contrast”. That does not mean the latter are unusable all of a sudden.
For my system, D&S is perfectly usable, and I happen to prefer the more subtle effects I get with it. But that may also depend on the images, nature doesn’t really need very aggressive sharpening and local contrast (imo).

4 Likes

Stating the obvious, I usually set D or S how I like it then switch it off to complete the rest of the edit. I can then zoom, crop etc without delays.

One of my very last actions is to switch it back on.

Yes I find it slow as my CPU and GPU aren’t the most powerful but I prefer using it over the old modules.

Afaik there’re no developers porting opencl stuff to metal, so don’t hold your breeze.
If you want to make use of opencl with m1 you have to enable it via darktablerc in your darktable config directory. It seem the algo to detect if on cpu gpu gives a performance boost over cpu code doesn’t handle m1 properly. The developer doesn’t have access to m1 hardware :wink:
With OSX in general and even more m1 you need to do the performance tuning yourself. There should be some posts on that topic around here ore at darktable github.

1 Like

Perhaps these two links hold the information you need to enable openCL on your Mac Mini M1 system. Sorry being not more of a help, but I’m running on Windows and just stumbled over some openCL related information while performance tuning my own system :wink:

https://docs.darktable.org/usermanual/4.0/en/special-topics/mem-performance/

I use the lc preset…for a bump I do 20 iterations usually never more. I also add the dehaze preset with it. This pair usually makes my images nice and contrasted and as sharp as I like…on some presets you can bump the sharpness slider to go even further but some won’t even tolerate 1 or 2 percent increase …it just depends… I do have a fast enough PC so its fine to use and I have used as many as 4 instances with not much issue.

I still have a bank of presets that I fall back on when I need a look sometimes with local contrast…so I use both but usually try DS first…

Some things about the state on a Mac has already been said. Yes, Metal has been around for a while, but for a cross-platform project where most (if not all) of the real development happens on Linux, properly supporting Apple is a PITA which often throws mac support in the ‘not our problem’-category. Can’t say I blame them.

D-or-S is perfectly usable for me with something ‘as low’ as a desktop GTX 1060 card from years ago, or a RTX3050ti 35watt model in a 13" notebook. The difference with or without OpenCL is immense. So as long as the quite-descent GPU on Apple-SoC’s isn’t usable by the algorithm, yes, it’s going to be slow.

Now, wasn’t sharpen already discouraged / deprecated in 3.6 / 3.8? Anyway, I don’t even have it anymore, so I can’t look up how it behaves.
The ‘risk’ of using a module somewhere in the middle of the pipeline that isn’t properly scene-referred, means that it can’t handle ‘infinite brightness’, which means it clips data that otherwise still has to be mapped by filmic or other modules.
Now, if that isn’t the problem with ‘sharpen’, it can still be that it introduces hue-shifts or other color problems that the new scene-referred modules try so hard to prevent. But I wonder if a not-too-aggresive sharpen would really introduce lots of problems here.
But that’s up to you, of course!

As for ‘local contrast’, I know I still use the ‘old’ module all the time. Sort of for the same reason, the D-or-S module seems to work fine, but just ‘at a smaller radius’ as I would explain it. Which means the effect isn’t that strong. Also, it seems to make blacks too black for me, which causes me to apply a mask to ignore the real low shadows everytime I use D-or-S for local contrast.

Just using the older ‘local contrast’ module at the default 125% settings is so easy that I often just go with that.
But here, it’s always applied after filmic, so that it can’t clip highlights that filmic has yet to map / roll-off.
It might still introduce hue-shifts that filmic tried so hard to prevent, but since I use it subtle most of the time, I have no issues with that.
If you do, then D-or-S is the way forward.

Maybe I’ve got to dive into the manual for D-or-S again, to see to make the local-contrast preset be more to my liking and save it as a preset. I just didn’t really bother with it yet.

So, go ahead and use the older modules if you want, just know that

  • they might disappear in some future version or fork
  • if you got issues with highlights and one of these modules is in your pipeline before filmic, that’s likely your cause
  • mac performance issues are of apple forcing their own APIs, and then people without access to those APIs not being able to develop for it anymore.
2 Likes

I love the Diffuse or Sharpen module to apply the preset sharpen demosaicing (AA filter). It is now part of my standard work flow. However, If I need more sharpening I defer to other modules in addition to this initial sharpening. I don’t feel this single module is going to replace other well known modules like local contrast. However, I really appreciate the effort AP put into making this module. It is complex and with time I will find more uses for it. The presets are good starting points, but I find fast sharpness a little underwhelming at the default preset values. I suspect this is what the @T_N_Args is referring to.

1 Like

Keep in mind that “diffuse & sharpen” uses a completely different method than e.g. “sharpen”.

The latter uses an unsharp mask to enhance contrast over a zone of 2 or more pixels. That enhanced contrast gives the impression of a “sharper” image, but can also cause halo’s (increase the ration and strenght to see that). And you can actually lose some of the finest details when overdoing it

“Diffuse & sharpen” tries to undo the cause of unsharpness, so will be more limited in its effects.
I wonder if it would be a good module to use on export after the resizing to final size (and if that’s even possible).

I think this would be awesome! But I have also had good results with the RL deconvolution Lua plugin that deconvolves after downscaling.

That might be interesting. Though I’ve had some unpleasant experiences with deconvolution when pushed a bit (“ringing” artifacts due to sharp edges)

Thanks for these links. I used them to edit darktablerc and enable OpenCL option in Preferences.

However, 2 things happened after I checked the box for OpenCL.

Firstly, the speed of D or S module was not noticeably changed. It still took 40 seconds to apply the ‘Add Local Contrast’ preset.

Secondly, and this is weird, all my images in Darkroom module went crazy: specifically, much brighter and lower contrast (with no change in histogram). Irrespective of whether the Diffuse or Sharpen module is on or off. A bit of investigation and I found it was the Denoise (profiled) module! I am using its default ‘Wavelets:chroma only’ preset. Which makes no sense at all.

OpenCL off, Denoise (profiled) on:-

OpenCL on, Denoise (profiled) on:-

OpenCL on, Denoise (profiled) off:-

So I am forced to turn OpenCL off, if I want my photos to come out correctly, and retain the use of the Denoise module. I don’t know if this is a bug – but I’m not a developer or beta tester, I don’t do bug reports.

no bug report, no fix - there aren’t developers around being able to reproduce this since they don’t have access to M1 macs.
So you need to bite the bullet and stay without openCL and cross your fingers that there will be a fix if someone else reports that :wink:

2 Likes

Since this is all FOSS, a fix requires some help from users. There are no beta-tester teams like in SW companies, so it’s the user community here that provides insights and strange behaviors like you observed to the developers.

Filing a bug is really no big thing, you already have all information you would need to provide at hand, by just copying your insights into a bug report. With some luck, this gets fixed.

For further information see

So just feel being invited and welcome to the contributing community :blush:

1 Like

OK I’ll do it, but half expecting a reply like, “well duh, why do you think we turned off OpenCL? Maybe because you are not supposed to turn it on?”

As that’s the kind of information one might expect to find in the manual (or at least in release notes), a bug report could still be useful.

Maybe it’s only the display that’s corrupted (the histogram being the same). You could try exporting with OpenCL = on, denoise (profiled) enabled. If that works, disable it in your processing; create a new style with the module enabled; add that profile to your export settings in append mode (darktable 4.0 user manual - export) for images that need denoising.

As for the original post claiming that the effect is ‘almost invisible’: I actually find that unless I’m careful, the images can become oversharpened (e.g., with the dehaze preset, especially if combined with others). I continue to use the ‘old’ local contrast module, too, and if you cannot get diffuse or sharpen to run at a reasonable speed (or you just don’t like what it does), you can still use the other modules like sharpen and contrast equalizer (it was a long-time favourite of mine, before diffuse or sharpen arrived).

1 Like

It’s been said more than once in this forum: macOS is not a prioritized OS for the darktable developers. I was unhappy with performance, but I did what I had to: installed Linux after 17 years of macOS. I’m very happy with the decision. darktable runs better in its native environment. My work computer still runs macOS though…

1 Like

In version 3.8 I too used the chroma only preset. However, I now get better results in version 4.0 with the default settings of the denoise (profiled) module. It tackles most chroma and luma noise well. I even sometimes push the strength slider up to 1.5 with good results on noisy images. I am really impressed with the improvements in this module in the latest version of darktable. Test it for yourself.