rotating & shearing

Michael Thaler michael.thaler at physik.tu-muenchen.de
Wed Feb 8 13:28:42 CET 2006


On Wednesday 08 February 2006 10:48, Casper Boemann wrote:

> It still does it in one function, but please keep in mind that rotating is
> nothing more than a combination of scaling and shearing.

But it is a very special case and I still think implementing both 
rotating/shearing and scaling in one function might not be the best way 
because it makes the code harder to understand and harder to optimize. Gimp 
has a lot of special case optimizations and that is one reason why gimp is 
often faster then Krita.

> Don't worry. The new code will become as fast or faster than the old.
> And the quality will be the same, Any current difference is a bug. The
> overall algorithm is the same. And rotating and shearing will be even
> greater quality.

OK, I will move my old scaling code to a plugin which I will keep for my 
personal use, then. But I wonder if you can really make your transform code 
as fast as (or faster than) the old code or are you using cashing now? (I 
thought that was not possible if you combine scaling and rotating/shearing).
(Probably my old code could be still optimised. A lot of time is still spent 
on allocating memory, so writing custom versions of new/delete might help).

> That wont work. You have n way of knowing when to use theold algorithm and
> when not to.

Why not? Can't I do something like

KisColorSpace* cs = paintDevice -> colorSpace();
KisID csid = cs -> id();

if(csid == RGB8 || csid == CMYK8)
//use highly optimized version of scaling code for RGB8/CMYK8

else if (csid == RGB16 || csid == CMYK16)
//use highly optimized version of scaling code for RGB16/CMYK16

else
//use some colorspace-independent but slower routine

Since scaling is so central and probably 90% of people use RGB8 I think it is 
really worth optimizing these cases.

> Yes as requested by boudewijn I intend to replace scaling as well

As I said, then I will keep my old code in a personal plugin, as long as your 
transform code is not as fast as my old code and I will work a little on that 
to make it colorspace independent and as fast as possible.

Greetings,
Michael


More information about the kimageshop mailing list