After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 790111 - shadows-highlights: Blur in monochrome
shadows-highlights: Blur in monochrome
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: operations
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2017-11-09 07:58 UTC by Debarshi Ray
Modified: 2017-11-13 14:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
CIE: Add "CIE L float" (3.05 KB, patch)
2017-11-09 08:14 UTC, Debarshi Ray
none Details | Review
operations/common/gblur-1d: Support "CIE L" and "CIE Lab" natively (1.31 KB, patch)
2017-11-09 08:22 UTC, Debarshi Ray
none Details | Review
operations/workshop/shadows-highlights: Optimize the blur (3.42 KB, patch)
2017-11-09 10:22 UTC, Debarshi Ray
none Details | Review
CIE: Add "CIE L float" (5.17 KB, patch)
2017-11-10 10:21 UTC, Debarshi Ray
committed Details | Review
operation: Use softer assertions at the public API boundary (1.10 KB, patch)
2017-11-10 10:22 UTC, Debarshi Ray
committed Details | Review
operation: Support getting the source nodes of meta-ops (1.25 KB, patch)
2017-11-10 10:22 UTC, Debarshi Ray
committed Details | Review
operations/workshop/shadows-highlights: Optimize the blur (7.11 KB, patch)
2017-11-10 10:25 UTC, Debarshi Ray
committed Details | Review
tests: Ensure that both meta and non-meta-ops can get to their sources (2.93 KB, patch)
2017-11-11 13:00 UTC, Debarshi Ray
none Details | Review
tests: Ensure that both meta and non-meta-ops can get to their sources (3.17 KB, patch)
2017-11-13 14:30 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-11-09 07:58:45 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)
Comment 1 Debarshi Ray 2017-11-09 08:04:07 UTC
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.
Comment 2 Debarshi Ray 2017-11-09 08:14:52 UTC
Created attachment 363277 [details] [review]
CIE: Add "CIE L float"
Comment 3 Debarshi Ray 2017-11-09 08:22:17 UTC
Created attachment 363279 [details] [review]
operations/common/gblur-1d: Support "CIE L" and "CIE Lab" natively
Comment 4 Debarshi Ray 2017-11-09 10:22:24 UTC
Created attachment 363285 [details] [review]
operations/workshop/shadows-highlights: Optimize the blur
Comment 5 Massimo 2017-11-09 11:21:53 UTC
(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.
Comment 6 Øyvind Kolås (pippin) 2017-11-09 11:25:02 UTC
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.
Comment 7 Debarshi Ray 2017-11-09 14:42:28 UTC
(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.
Comment 8 Debarshi Ray 2017-11-10 10:21:23 UTC
Created attachment 363328 [details] [review]
CIE: Add "CIE L float"
Comment 9 Debarshi Ray 2017-11-10 10:22:10 UTC
Created attachment 363329 [details] [review]
operation: Use softer assertions at the public API boundary
Comment 10 Debarshi Ray 2017-11-10 10:22:40 UTC
Created attachment 363330 [details] [review]
operation: Support getting the source nodes of meta-ops
Comment 11 Debarshi Ray 2017-11-10 10:25:04 UTC
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.
Comment 12 Debarshi Ray 2017-11-11 13:00:27 UTC
Created attachment 363392 [details] [review]
tests: Ensure that both meta and non-meta-ops can get to their sources
Comment 13 Debarshi Ray 2017-11-11 13:02:38 UTC
Patches are also in the gegl:wip/rishi/operation-shadhi branch.
Comment 14 Debarshi Ray 2017-11-13 14:30:08 UTC
Created attachment 363511 [details] [review]
tests: Ensure that both meta and non-meta-ops can get to their sources
Comment 15 Debarshi Ray 2017-11-13 14:33:19 UTC
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