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 701677 - Artifacts along the lower edge of gegl:gaussian-blur when processed as chunks
Artifacts along the lower edge of gegl:gaussian-blur when processed as chunks
Status: RESOLVED OBSOLETE
Product: GEGL
Classification: Other
Component: core
git master
Other Linux
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2013-06-05 21:25 UTC by Dov Grobgeld
Modified: 2015-04-26 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
My modified gaussian-blur that honors the input color channels. (22.64 KB, text/x-csrc)
2013-06-05 21:25 UTC, Dov Grobgeld
Details
Image showing the difference between RGB and RGBA (3.23 KB, image/png)
2013-06-05 21:27 UTC, Dov Grobgeld
Details
The image illustrates a bug at tile boundaries. (40.55 KB, image/png)
2013-06-06 04:30 UTC, Dov Grobgeld
Details
Test case showing glitching at the edge of gaussian-blur without calling process. (1.64 KB, text/plain)
2013-06-17 23:24 UTC, Daniel Sabo
Details

Description Dov Grobgeld 2013-06-05 21:25:52 UTC
Created attachment 246116 [details]
My modified gaussian-blur that honors the input color channels.

While adapting the gaussian blur filter to only work on the channels that were given as input, did i notice that gegl_buffer_set() yield erronous results for the "RGB format". 

The test was done using my modified gaussian-blur.c operation, attached to this bug report and with the following pygegl script:

import Gegl

for gegl_format in  ['RGB','RGBA']:
  gegl    = Gegl.Node()
  
  node_uni = gegl.new_child('gegl:color')
  node_add = gegl.new_child('gegl:add', value=0.5)
  node_crop = gegl.new_child('gegl:crop',
                             x=0,y=0,width=100,height=100)
  node_blur = gegl.new_child('gegl:gaussian-blur')
  node_convert = gegl.new_child('gegl:convert-format',
                                format=gegl_format + " float")
  node_save = gegl.new_child('gegl:ppm-save',
                             path='bug-save-'+gegl_format+'.ppm')
  
  (node_uni
   >> node_add
   >> node_crop
   >> node_convert
   >> node_blur
   >> node_save).process()
  
The results for the two different formats is attached in the image RGBvsRGBA-100x100.png

Note that when the size for crop additional artifacts appear at the tile borders.
Comment 1 Dov Grobgeld 2013-06-05 21:27:10 UTC
Created attachment 246117 [details]
Image showing the difference between RGB and RGBA
Comment 2 Daniel Sabo 2013-06-06 04:06:58 UTC
When you process this graph you get a 100x100 output. gaussian-blur needs output + radius input pixels, however there are only 100x100 input pixels so it ends up reading from the abyss for those edge pixels.

When the input has an alpha channel the abyss pixels are transparent and don't affect the result, but when it's RGB they're solid black and bleed in to he result.

If you move your crop node after the gaussian-blur node you'll get the expected result, because it will generate output + padding pixels from color. Though considering all this I'm not sure non-alpha gaussian-blur is useful without extra logic to not read those abyss pixels.
Comment 3 Dov Grobgeld 2013-06-06 04:29:09 UTC
Regarding the image boundaries, it makes somewhat sense for the RGB case, though perhaps it would be nice to be able to set additional boundary conditions, like wrap around, or additional colors. On the other hand, I'm still not at ease with the RGBA case, but I have to think about. But in practice as long as you crop after your blur, that's no problem.

But, and I really should have shown that in the initial boundary report, not only do you get the effect at the image border. You get a similar darkening effect at tile borders, which is certainly wrong. You can see that by changing the size of the crop area from 100x100 to 1000x1000. I tried changing increasing the size of the area in prepare, but it didn't help.

See the attachement RGBat1000x1000.png .
Comment 4 Dov Grobgeld 2013-06-06 04:30:00 UTC
Created attachment 246126 [details]
The image illustrates a bug at tile boundaries.
Comment 5 Daniel Sabo 2013-06-06 10:23:48 UTC
Those aren't tile boundaries, there are about 4 vertical tiles in each of those bands (default tiles are 128x64). I suspect those are the work chunks process() cuts it into.

Are you sure that buffer area (area->left etc.) set in prepare matches what you're expecting? On further testing I can replicate the errors with the unmodified blur on a RGBA surface. It's easier to see with a different background, like gegl:checkerboard.

The issue goes away if I use node_blit to do the entire image as one chunk, though I think I've ruled out any errors in process() itself.
Comment 6 Daniel Sabo 2013-06-17 23:24:30 UTC
Created attachment 247078 [details]
Test case showing glitching at the edge of gaussian-blur without calling process. 

I think this a bug somewhere in gaussian blur, and probably some other area filters. I've attached my test case for blitting in chunks without involving the process() mechanics.

If the entire thing is done as one chunk there are no errors.
Comment 7 Øyvind Kolås (pippin) 2015-04-26 20:53:54 UTC
The op with the problem is not used anymore, closing bug.

commit a73037253476dca595a700d64f3c95aa877e3fad
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Sun Apr 26 16:10:51 2015 -0400

    gaussian-blur: replace with the new one from workshop