Bug 245870

Summary: Gaussian Blur filter preview is blocky, the edges of the image are blurred weirdly
Product: [Applications] krita Reporter: LukasT <lukast.dev>
Component: FiltersAssignee: Sahil <nagpal.sahil01>
Status: RESOLVED FIXED    
Severity: normal CC: canaldin, cberger, dimula73, edu.rm.85, halla, nagpal.sahil01, sven.langkamp
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Blocks
Blocky artefact

Description LukasT 2010-07-27 09:37:44 UTC
Created attachment 49513 [details]
Blocks

Version:           svn trunk (using KDE 4.4.5) 
OS:                Linux

Gaussian blur is little less useful then the one in GIMP 
when I post-process my painting.

First problem is that the preview shows some big rectangular blocks on the image.
See attachment. 

Second problem is that when bluring, the image is repeated in invisible area.
It is good for some filters, but in this case it looks bad.

Reproducible: Always

Steps to Reproduce:
1. Run Krita
2. Paint some masterpiece or use gradient to fill the canvas to the edges
3. Filter-> Gaussian Blur 
4. Preview is blocky
5. Apply the filter, result is repeated and looks weird

Actual Results:  
The image looks strange when trying to post-process 
the painting. I would propose to copy behaviour from GIMP in
this case.


OS: Linux (i686) release 2.6.32.9-70.fc12.i686
Compiler: gcc
Comment 1 Dmitry Kazakov 2010-07-27 12:52:04 UTC
Gaussian Blur filter is broken for a long time. Try using "Blur" filter. It works fine. But, afair, it doesn't work without fftw3 library.
Comment 2 Sven Langkamp 2010-09-23 16:11:42 UTC
Can you check if this still happens?
Comment 3 Halla Rempt 2010-09-23 21:44:50 UTC
Just for the record, before everyone has gone to bed and forgets about it:

21:07:36 < slangkamp> why is the filter src paint device exactBounds limited to the rect that the thread is working on?
21:07:56 < boud> it is?
21:08:11 < boud> a filter should be able to read from the whole src device iirc
21:09:25 < slangkamp> I run the gausian blur filter and from applyMatrix I get src->exactBounds() I get lots of different values
21:09:55 < slangkamp> which appear to be the areas the threads are working on
21:10:08 < boud> maybe because now the filters copy the bit the thread works on onto something temporary?
21:10:59 < boud> but I've lost track of that code a bit
21:11:57 < slangkamp> the filter needs the complete bounds otherwise the repeat iterators are repeating at the wrong bounds
21:12:41 < boud> is this in the mask or mask preview, or when apply and close the filter dialog ?
21:16:20 < slangkamp> let me check
21:17:11 < slangkamp> only with preview
21:17:30 < boud> and if you create a filter mask?
21:20:42 < boud> slangkamp: but for this issue of yours, we really need dmitry. It's tied together with transactions, changerects, needrects and things
21:20:54 < slangkamp> hmm there is something else going wrong
21:21:14 < slangkamp> the preview takes several times longer than the apply
21:22:08 < boud> that's probably because the preview is done in chunks, with an initialisation cost for every chunk. Best bet is to profile it.
21:26:30 < slangkamp> boud: calculated too often http://pastebin.com/DJ4Ax9wq image is 1024x768
21:26:59  * slangkamp is away from 30 minutes
21:27:50 < boud> slangkamp: very strange
21:31:00 < dmitryK41> boud, slangkamp: yes the merger creates a temporary area to work *if needed*
21:31:24 < boud> dmitryK41: what determines the need?
21:31:35 < dmitryK41> boud, slangkamp: so the filter must be able to work locally
21:32:14 < boud> but that's always going to be a problem with convolution filters -- they need to read beyond the bounds of local areas.
21:32:21 < dmitryK41> boud: e.g. when needRect!=requestedRect!=changeRect
21:32:48 < dmitryK41> boud: this problem has been solved with needRect mechanism
21:33:16 < dmitryK41> boud: now the merger prepares some excessive area for the filter to work
21:33:57 < boud> dmitryK41: https://bugs.kde.org/show_bug.cgi?id=245870 is still a problem, and also slangkamp found that the same area seems to be calculated a lot: 
21:34:03 < bugbot> KDE bug 245870 in krita (general) "Gaussian Blur filter preview is blocky, the edges of the image are blurred weirdly" [Major,New] 
21:34:09 < boud> 21:26:30 < slangkamp> boud: calculated too often http://pastebin.com/DJ4Ax9wq image is 1024x768
21:34:38 < dmitryK41> boud: and if the convolution filter is in the middle of the masks stack you simply can't apply it on the layer directly
21:34:59 < boud> yes, I understand that
21:35:09 < boud> but we've still got a problem :-)
21:36:10 < dmitryK41> boud: as far as i remember Gaussian Blur filter was broken itself
21:36:23 < dmitryK41> boud: that is why we had these blocky results
21:36:36 < dmitryK41> boud: you can check Blur filter
21:36:44 < dmitryK41> boud: it works fine
21:37:04 < dmitryK41> boud: and it is convolution filter as well
21:37:27 < dmitryK41> boud: Blur != Gaussian Blur
21:38:30 < boud> best wait a bit -- slangkamp should be back in twenty minutes and he has more details.
Comment 4 LukasT 2010-10-18 16:39:24 UTC
Created attachment 52653 [details]
Blocky artefact

Here is showed the blocky artefact. Draw some lines throught the whole canvas and then use gaussian blur. The place of the blocky effect is both in the preview and then in the result.

The edges are nicer now.
Comment 5 LukasT 2010-10-19 15:05:17 UTC
Here is the log from valgrind
http://pastebin.ca/1966873 (temporary available)

After running Krita in valgrind, the bug is not reproducible. 
Mighty valgrind healed the bug for me.
Comment 6 LukasT 2010-10-20 15:41:37 UTC
SVN commit 1187822 by lukast:

Fix for the border artefacts

Proposed by Cyrille Berger

CCBUG:245870

 M  +5 -1      kis_gaussian_blur_filter.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1187822
Comment 7 Cyrille Berger 2010-10-20 15:53:33 UTC
It is not blocker anymore, the implementation of BORDER_WRAP (ie the behaviour near the edge of the image) is actually a new feature. And should probably be reported as a different bug report for clarity.
Comment 8 LukasT 2010-10-24 14:40:33 UTC
Ok, I will report new bug report :)
Closing as fixed then.
Comment 9 Ganesh Paramasivam 2010-12-06 18:43:38 UTC
commit 2eece610616003b494a84fcb4ae7ff084c35ab0f
branch words-change_tracking-ganeshp
Merge: 4879e17 be16917
Author: Ganesh Paramasivam <ganesh@crystalfab.com>
Date:   Thu Oct 21 08:18:21 2010 +0000

    Merged revisions 1187683,1187692,1187696,1187699,1187724,1187736,1187740-1187741,1187749,1187768-1187770,1187778,1187799-1187800,1187815,1187817,1187822,1187833,1187839,1187868,1187913,1187917,1187954,1187967,1187974 via svnmerge from
    svn+ssh://ganeshp@svn.kde.org/home/kde/trunk/koffice
    
    ........
      r1187683 | vandenoever | 2010-10-20 11:48:05 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Catch errors resulting from XML that is not wellformed.
    ........
      r1187692 | vandenoever | 2010-10-20 12:59:45 +0530 (Wed, 20 Oct 2010) | 3 lines
    
      Do not write out text:page-sequence.
    
      It is only allowed when no text elements like text:p or text:h are written. KOffice does not seem to use text:page-sequence at all.
    ........
      r1187696 | vandenoever | 2010-10-20 13:39:24 +0530 (Wed, 20 Oct 2010) | 3 lines
    
      move style:master-page-name and style:master-page-name
    
      KOffice was writing style:master-page-name and style:master-page-name attributes as part of style:paragraph-properties instead of styles:style. This is fixed now.
    ........
      r1187699 | vandenoever | 2010-10-20 13:45:47 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Do not write attribute koffice:name.
      It is not used and invalid.
    ........
      r1187724 | vandenoever | 2010-10-20 15:53:18 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Add script to validate ODF.
    ........
      r1187736 | breitmeyer | 2010-10-20 16:31:34 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      loaded axis minimum and maximum values
    ........
      r1187740 | lassin | 2010-10-20 16:52:09 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Fixed drawingML bullet color reading, patch provided by Nandita.
    ........
      r1187741 | vandenoever | 2010-10-20 16:54:51 +0530 (Wed, 20 Oct 2010) | 3 lines
    
      Save koffice:name (which is not valid ODF!)
    
      but only if it is absolutely necessary. That is, if it is not empty and not the same as the 'official' draw:name value. For future KOffice versions it might be better to store this information in an RDF graph, so that the content.xml can be valid ODF.
    ........
      r1187749 | lassin | 2010-10-20 17:05:47 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Made symbol bullets in ooxml to behave sanely in more cases.
    ........
      r1187768 | mlaurent | 2010-10-20 17:22:48 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Install as program
    ........
      r1187769 | mlaurent | 2010-10-20 17:23:03 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      install as program
    ........
      r1187770 | mlaurent | 2010-10-20 17:23:16 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Install as progrzm
    ........
      r1187778 | lassin | 2010-10-20 17:39:25 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Simplified drawingML & pptx code.
    ........
      r1187799 | vandenoever | 2010-10-20 18:31:59 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Add validation of manifest.xml
    ........
      r1187800 | vandenoever | 2010-10-20 18:32:03 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Add required manifest version number.
    ........
      r1187815 | lassin | 2010-10-20 18:57:52 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Fixed group shapes in drawingML to have a draw style.
    ........
      r1187817 | lassin | 2010-10-20 18:58:43 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Simplified pptx code.
    ........
      r1187822 | lukast | 2010-10-20 19:12:56 +0530 (Wed, 20 Oct 2010) | 5 lines
    
      Fix for the border artefacts
    
      Proposed by Cyrille Berger
    
      CCBUG:245870
    ........
      r1187833 | vandenoever | 2010-10-20 19:49:45 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Handle KeyError that is thrown if a file is missing from the document.
    ........
      r1187839 | vandenoever | 2010-10-20 19:51:17 +0530 (Wed, 20 Oct 2010) | 1 line
    
      Fix path to manifest.xml.
    ........
      r1187868 | breitmeyer | 2010-10-20 21:04:47 +0530 (Wed, 20 Oct 2010) | 2 lines
    
      Fixed loading of cell regions that contain lists of regions
    ........
      r1187913 | staniek | 2010-10-21 00:11:41 +0530 (Thu, 21 Oct 2010) | 2 lines
    
      SVN_SILENT don't use reference
    ........
      r1187917 | staniek | 2010-10-21 00:23:24 +0530 (Thu, 21 Oct 2010) | 4 lines
    
      KexiDB
      *add sanity checks to assignment operators
    ........
      r1187954 | staniek | 2010-10-21 02:32:21 +0530 (Thu, 21 Oct 2010) | 6 lines
    
      Correction for r1183552: "Make KoReport a full koffice-libs member"
    
      For TINY target reports should be switched off, as well as report plugins,
      so the change in r1183552 now applies only to the default (desktop) builds.
    ........
      r1187967 | langkamp | 2010-10-21 03:02:44 +0530 (Thu, 21 Oct 2010) | 1 line
    
      simplified code
    ........
      r1187974 | langkamp | 2010-10-21 04:08:53 +0530 (Thu, 21 Oct 2010) | 3 lines
    
      update specific color selector colorspace when image colorspace is changed
      CCBUG:252461
    ........
    
    svn path=/branches/work/koffice-change-tracking/; revision=1188051
Comment 10 Sven Langkamp 2012-04-17 19:56:04 UTC
Bug still does appear after the filter is applied.
Comment 11 Alexis 2012-04-20 12:08:50 UTC
Hello, 

I get the border's black alpha bleeding into the canvas on all sides except the left one.

reference here:  http://www.mediafire.com/?vem5vjb7c7yql5v

Thank you

I'm using Krita 2.4 on ubuntu 12.04 on a Lenovo w520 (linux certified)
Comment 12 Halla Rempt 2012-04-20 12:20:42 UTC
Seems related to 296821
Comment 13 Halla Rempt 2012-04-20 12:21:15 UTC
The thing is, this did work correctly at one point -- I wonder what the issue here is. Alexis -- you are on *buntu or windows?
Comment 14 Alexis 2012-04-20 12:49:45 UTC
ubuntu as stated
Comment 15 Halla Rempt 2012-05-08 09:17:52 UTC
*** Bug 296821 has been marked as a duplicate of this bug. ***
Comment 16 Dmitry Kazakov 2014-01-14 19:27:57 UTC
Bug is now fixed in 'krita-testing-kazakov' branch, please test and report