[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Re: optimizing the scaling code
From: Casper Boemann <cbr () boemann ! dk>
Date: 2005-06-28 8:34:00
Message-ID: 200506281034.00655.cbr () boemann ! dk
[Download RAW message or body]
On Tuesday 28 June 2005 09:41, Michael Thaler wrote:
> Hello,
>
> I think the main speed problem in my current scaling code is that I read
> single pixels using
>
> QUANTUM *tmp = new QUANTUM[ pixelSize * sizeof(QUANTUM) ];
> m_dev -> readBytes(tmp, x, y, 1, 1);
>
> I am currently rewriting the code to read whole lines and I wonder what is
> the best way to do this. Casper's transform visitor does this:
>
> KisHLineIteratorPixel srcIt = src->createHLineIterator(left, y, w, true);
> int i = 0;
> while(!srcIt.isDone())
> {
> Q_UINT8 *data;
> data = srcIt.rawData();
> memcpy(&tmpLine[i*pixelSize], data, pixelSize);
> ++srcIt;
> i++;
> }
>
> which creates a temporary array with the pixel data of a line.
>
> Another method would be to just use
>
> QUANTUM *tmp = new QUANTUM[ width * pixelSize * sizeof(QUANTUM) ];
> m_dev -> readBytes(tmp, 0, y, width, 1);
>
> What is faster? Or is there any other method to read a line as fast as
> possible?
about the same.
the advantage of using an iterator could be if you need to do some per pixel
work while reading
btw I now see that I can optimize my code here, by using the number of
consequtive pixels to copy larger blocks. This is actually a reason to use
readBytes as that function is likely to be update with such fixes faster than
your own code.
--
best regards / venlig hilsen
Casper Boemann
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic