Krita brush mask AVX Optim, Unit test scalar vs vectorized.

Dmitry Kazakov dimula73 at gmail.com
Sat Apr 28 14:31:12 UTC 2018


Hi, Ivan!

1) It is not much possible to compare the brushes at the level of 
KisBrush, because there are too many things and options involved. I 
would suggest to make your
KisMaskSimilarityTester to accept two KisBrushMaskApplicatorBase* 
objects and a rect with the expected bounding rect of the brush. That 
would be much easier to control.

2) The second problem is forcing the scalar version of the code. Right 
now one cannot choose the the scalar version, there is no API for that, 
but nothing stops you from making one :) Just an idea on how it can be 
implemetned:
2.1) Define a special createOptimizedClass() function that accepts not 
only 'param' but also 'forceScalarImplemetation' flag
2.2) Then the default implementation of createOptimizedClass() can be 
refactored in terms of this new function (internally it has the same 
switch for AMD CPUs)
2.3) Add a special method to KisCircleMaskGenerator, like 'void 
resetMaskApplicator(bool forceScalar)' and call it from the unittest
2.4) In the unittest just create two KisCircleMaskGenerator objects and 
ask them to create corresponding applicators

3) For QImage comparison operations I would recommend you to use 
TestUtil::compareQImages() from qimage_test_util.h. It does exactly what 
you try to implement there :)

On 28.04.2018 07:43, Iván Yossi wrote:
> Hi!
>
> I’ve been working on the unit test for comparing both scalar and 
> vectorized mask. I create a mask and convert it to an image to later 
> compare pixel by pixel to ensure the mask is within the error limit.
>
> The patch along side the first Gauss AVX optimization is here
> https://phabricator.kde.org/P200
>
> I’m not sure if the way I implemented it is the recomended way as I 
> force the use of scalar by initialiazing the brush with 3 spikes. The 
> names I used for variables, I’m mostly sure I adhere to the naming 
> convention but I probably skip something. This test generates an image 
> of the masks for visual aid, I made it this way so i could asses if 
> the difference is visually detectable while in production to fine tune 
> the error.
>
> The current test will pass for the Default Brush and Fail for the 
> GaussBrush as it uses my dummy vectorized code. However it should pass 
> if only the test is integrated as both mask would be generated using 
> the scalar process.
>
> I reach to you for any advice and recommendation to make the test more 
> robust.
>
> Thanks!
>
>
> Iván Yossi
> <ghevan at gmail.com>
> IRC: ivanyossi
>

-- 
Dmitry Kazakov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20180428/9312a382/attachment.html>


More information about the kimageshop mailing list