featured image for gauss optim

Optimizing Circular Gaussian Mask, Krita:GSoC

Previous implementation was based on a slow scalar model, calculating each mask value per coordinate. I implement a new vectorized code using Vc library to allow a robust SIMD usage, calculating the mask values in parallel. Not all operations are implemented on Vc data types, especially erf had to be implemented for Vc data types. The new implementation shows to be up to 10 times faster (on my system) on mask generation. Given that the mask generation requires the most computing on brush stroke generation, this speed improvement holds up even in the full brush stroke benchmarks. Given the way it is implemented the code can become faster as future SIMD registers grows on future CPUs.

Circular Gauss Optimization results.

Code study and implementation of Gauss Mask Mask generator.

Phabricator task: Implement Circular Gauss Mask Optim AVX
Vc creates code from templates tailored for each processor instruction set: AVX, AVX2, SSSE2, SSSE3, SSE2, and scalar. so first a template must be declared to manage the creation of each instructions set code. Using the vectorized Default Mask implementation as a guideline, studying how the code generates is constructed to provide the functionality allowed to extend it for the other MaskGenerators
Read More »


GSoC: Krita AVX mask optimizations, setting up the environment.

Hi! GSoC student here :]. This first weeks coding for Krita have been so busy I forgot to write about them. So I’ll start to sum everything up in short posts about each step of the project implementation process.

First Steps, setting up a dev environment

I followed the steps in the 3rdparty to compile the base krita system on OSX. This easy to follow instructions helped me get a basic Krita installation in a short time. However not everything worked for me quite easily and most tests did not work or run at all on OSX with the message.

QFATAL : FreehandStrokeBenchmark::testDefaultTip() Cannot calculate the bundle path from the app path

After some digging I found out that no program that uses a GUI can run outside of an app bundle. So while not a future proof, to start working on the code I made a quick script to install the tests I’m interested inside Krita.app folder. To allow tests to run. By default all tests are linked to libraries in the build dir, but because this wont work on OSX one approach would be to install also the tests in the bundle and link to the install libraries or, another approach could be to generate an app bundle for each test.

In any case the tests could run so It was time to start working on the unit test.

Implementing Mask Similarity Test

Phabricator task: Base unit test kis_mask_similarity_test
This unit test intention is to compare the correctness of the new vectorized mask rendering by comparing it to the same settings Mask produced by the previous engine. The new versions have to be as identical as possible to ensure the painting effects the user is expecting does not change between engines (The user can’t change how the mask is produced, but we use the scalar version for smaller brush dab sizes).

Read More »

Into Google Summer of Code

Hi! I’m Iván Yossi,

I can’t believe I was selected for the Google Summer of Code program for working on Krita. The proyect I’ll be working this summer is on optimizing Krita’s brush mask to work with AVX instructions. These instructions will be coded using the Vc library, a “zero overhead C++ types for parallel computing” that enables to efficiently transform the mask’s generator code to SIMD instructions for vectorization.

Brush masks is a core process in the painting task as it creates the shape it will be imprinted in the canvas. This, depending on brush settings, can be done as much as thousends of times per second. Having this optimized will greatly improve painting enjoyment keeping the brush stroke responsive on bigger sizes.

You can see more details of the proyect here

I’ll keep you posted as te proyect advances.

See you soon :]

Krita Fundraiser campaign!

Krita Fundraiser campaign! Hola. Fue en 2012 que comencé a usar Krita para pintar. En ese entonces usaba la versión 2.5 en Windows, aunque por momentos se cerraba, era la primera aplicación de pintura digital donde realmente me sentí cómodo. Tanto me gustó que hoy día es casi la única aplicación de pintura que uso. […]

Artscript v2.1 pre-release

2.1_cuts_blogAfter quite some time I managed to close all big features requests and bugs from Artscript 2.0 Im happy with the result. The script feels a lot more snappier and with the addition of Drag and Drop its so fast to use it as an app.

About artscript
Artscript is a script app to easily convert production file images (KRA, XCF, PSD, ORA, SVG, PNG) to universal formats (JPG, PNG, GIF or WEBM).

The output format can have a watermark added and it’s possible to deploy in the same step one or many size targets. The process is made super easy with the use of a configuration and presets for instant deployment of commonly used options

Made with digital designers and painters in mind, the final images aim for high quality results, not speed of conversion. However the script remembers the last used settings to fasten deployment of several images made for a project at different moments in the preproduction stage.

When working on several projects a presets.config is available to set more than one preset, so you can have a “personal” preset, with sizes tailored for your blog and a “Client work” with your personal information as a watermark label a proper size, or sizes, for the client needs.

Download and install instructions
Project github page has all you need https://github.com/vanyossi/artscriptk


Resizing GUI, getting things right.

Artscript v2 is out, and while it looks and works smoother than the first version it does come with some big drawbacks and missed opportunities.

Resize gui problem:

Version 2 Current GUI
Version 2 Current GUI

While I was designing the new GUI I wanted something more organic that grew and shrink as sizes were selected, or deselected. And while it delivers exactly what I wanted to achieve I didn’t see the big picture on this.

The new Resize was supposed to be all about multiple sizes!

So, what are the main problems I have identified:

  • It doesn’t allow to load lists with sizes for quick deployment: This is the biggest missed opportunity. While it’s possible to load 3 or 4 sizes on demand, it’s useless to deploy a set of output sizes from your artwork, easily. This is specially true when you use common set of sizes each time. Whether it’s four or 100 sizes, the script must be able to deliver
  • It requires a lot of clicking to set custom sizes (at least 4 clicks, slower than previous version). This might not sound so bad, but the more clicks the less joy.
  • After 4 sizes it becomes difficult to manage. Because of the size, there is a physical limit on the sizes you can stack, the limit is given by the size of your screen, minus the height of the image list. And as of Tk 8.5, it is not possible to add scrolling to a frame.
  • It doesn’t allow to select a size for preview. At the moment I circumvent this by using the first size of the list, but if the user wants to know how it looks at an specific size… well, it’s not possible.
  • Up until today there was probably a nasty bug in release version. I happen to miss a huge bug in the sizes gui. If more than 9 sizes where selected. An easy fix, but that means there probably are more hidden somewhere. (bug fixed)

Read More »

Artscript v2.0, aiming for quality.

atk-v2_all_1So you finished your latest work, and you want to quickly adapt your work for sharing. Open up GImp (Inkscape, Krita), resize, add watermark, save. Repeat for the number of formats and sizes you need. Shell scriptitng is an option, as long as you know what you are doing. Gui frontends are available like Converseen and Phatch, the first a bit simplistyc and the later far more complex.

Then, there is Artscript, tailored to get high quality results for digital painters, supporting transforms from XCF, ORA, KRA and SVG using the applications you already have. GIMP, Inkscape and Krita. The advantage is that all operations are optimized for preserving your hard work intact over the downscale operation. An example of this, artscript will not degrade color quality if a low jpeg quality is selected.

Read More »

My linux applications for production [en/es]

Cuando se trata de enseñar a pintar o programar para web no hay curso en México que no vea, en el primero, la interfaz de Photoshop (o Painter) y en el segundo, la interfaz de Dreamweaver. Esto genera la falsa ilusión de que sólo usando estos programas podemos hacer pinturas o sitios web.
[ When you go to a course in Mexico about painting or web design there is no place where the first one does not contain Photoshop and the second does not dedicate half course to Dreamwaver. This generate the false illusion that without this two tools its impossible to paint or make websites ]

Mi intención con esta entrada es ayudar a romper esa ilusión mostrando todas las herramientas que uso para generar mi trabajo. No es una guía, sólo una lista detallada de todas las aplicaciones que uso.
[ My intention with this blog post is to help to break this illusion showing all the tools I use to generate my work. It’s not a tutorial but a detailed list on the applications I use and why. ]

Read More »

My Inkscape story +lots of illustrations.

When I was starting digital color, I always thought vectors were for simple and uninteresting stuff. The truth is I was not comfortable using them. Back then I tried only Illustrator, which to this date I can’t find a comfortable way of using it. After my first short migration to linux I met with Inkscape and I made some experiments with it and some more complex work.

Read More »