GNOME Bugzilla – Bug 790111
shadows-highlights: Blur in monochrome
Last modified: 2017-11-13 14:33:19 UTC
Having the Gaussian blur natively support CIE formats would avoid the need to go back and forth between RGB and CIE, which currently happens with gegl:shadows-highlights. gegl:shadows-highlights is currently structured as: --> gegl:gaussian-blur -- | (works in RGB) | | v in --> gegl:shadows-highlights-correction --> out (works in CIE)
I don't know if the algorithm needs to be adjusted for CIE pixels. As far as I can see, it doesn't mix the channels and is only doing some arithmetic with the neighbouring pixels. So I guess it should work as is? I also don't know if there is such a thing as CIE Lab with premultiplied alpha, so I am sticking to the alpha-less formats.
Created attachment 363277 [details] [review] CIE: Add "CIE L float"
Created attachment 363279 [details] [review] operations/common/gblur-1d: Support "CIE L" and "CIE Lab" natively
Created attachment 363285 [details] [review] operations/workshop/shadows-highlights: Optimize the blur
(In reply to Debarshi Ray from comment #4) > Created attachment 363285 [details] [review] [review] > operations/workshop/shadows-highlights: Optimize the blur This is not equivalent to the current operation: you're now blurring in a non linear color space. If this is better or intended, there's no need to modify gblur-1d, just replace convert-format with cast-format and add another cast-format after the blur, like GIMP does in its compatibility blur pdb procedure https://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/plug_in_compat.pdb#n4851 https://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/plug_in_compat.pdb#n4629 otherwise other gblur-1d users that are expecting a linear blur even when their input is in CIE formats will have to modify their code.
not doing the blur on premultiplied data will give rise to color bleeding problems as well. The color of fully transparent pixels/areas will bleed into more opaque neighbouring areas.
(In reply to Massimo from comment #5) > (In reply to Debarshi Ray from comment #4) > > Created attachment 363285 [details] [review] [review] [review] > > operations/workshop/shadows-highlights: Optimize the blur > > This is not equivalent to the current operation: > you're now blurring in a non linear color space. Ok, that clears it up. I have been trying to figure this out in #gegl, and in the absence of a clear understanding, decided to just try it. > If this is better or intended, there's no need to modify > gblur-1d, just replace convert-format with cast-format and > add another cast-format after the blur, like GIMP does in > its compatibility blur pdb procedure Thing is that the original algorithm from Darktable uses a Gaussian blur in CIE Lab: https://github.com/darktable-org/darktable/blob/master/src/common/gaussian.c However I am not sure if a blur in RGB actually works better than it.
Created attachment 363328 [details] [review] CIE: Add "CIE L float"
Created attachment 363329 [details] [review] operation: Use softer assertions at the public API boundary
Created attachment 363330 [details] [review] operation: Support getting the source nodes of meta-ops
Created attachment 363331 [details] [review] operations/workshop/shadows-highlights: Optimize the blur Let's stick to a RGB blur, but convert to monochrome earlier to reduce the amount of data we need to process.
Created attachment 363392 [details] [review] tests: Ensure that both meta and non-meta-ops can get to their sources
Patches are also in the gegl:wip/rishi/operation-shadhi branch.
Created attachment 363511 [details] [review] tests: Ensure that both meta and non-meta-ops can get to their sources
From #gegl on GIMPNet: <pippin> btw - feel free to push your shadi changes / additions commit ccd4609b5dfcd9101f263d36bd99b13e7b69d008 (HEAD -> master, origin/master, origin/HEAD, operation-shadhi) Author: Debarshi Ray <debarshir@gnome.org> Date: Thu Nov 9 07:59:56 2017 +0100 operations/workshop/shadows-highlights: Optimize the blur The algorithm needs a blurred CIE L channel and there is no need to spend time blurring the other components. Therefore, if the input has alpha, the blur is performed in "YaA float", else in "Y float". Bump required Babl version to 0.1.37. https://bugzilla.gnome.org/show_bug.cgi?id=790111 commit 3bf06982ff151a02caa1c5e634cd636234d80445 Author: Debarshi Ray <debarshir@gnome.org> Date: Sat Nov 11 13:35:35 2017 +0100 tests: Ensure that both meta and non-meta-ops can get to their sources https://bugzilla.gnome.org/show_bug.cgi?id=790111 commit 2c6381a02c41b466cf5a9eaf9fa6278639735e0c Author: Debarshi Ray <debarshir@gnome.org> Date: Fri Nov 10 11:09:43 2017 +0100 operation: Support getting the source nodes of meta-ops https://bugzilla.gnome.org/show_bug.cgi?id=790111 commit ceba8e415f10cff64ed35457a5b4fd19b81682a2 Author: Debarshi Ray <debarshir@gnome.org> Date: Fri Nov 10 09:36:47 2017 +0100 operation: Use softer assertions at the public API boundary It doesn't hurt to be more forgiving, and is what most GLib/GObject based APIs do. https://bugzilla.gnome.org/show_bug.cgi?id=790111