optimizing the scaling code
Michael Thaler
michael.thaler at physik.tu-muenchen.de
Tue Jun 28 09:36:14 CEST 2005
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?
More information about the kimageshop
mailing list