[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Initial patch to support video in Cairo renderer
From: |
John Gilmore |
Subject: |
Re: [Gnash-dev] Initial patch to support video in Cairo renderer |
Date: |
Tue, 10 Jul 2007 20:02:27 -0700 |
Some random ideas if anyone wants to optimize this patch:
> +// Converts from RGB image to 32-bit pixels in CAIRO_FORMAT_RGB24 format
> ...
> + for (int x = 0; x < im->m_width; x++, src += 3)
> + {
> + *dst++ = src[2]; // blue
> + *dst++ = src[1]; // green
> + *dst++ = src[0]; // red
> + *dst++; // alpha not used
> + }
I suspect it would be faster to write a zero into the alpha byte,
rather than just increment past it. This would let the CPU's write buffer
merge all the writes, rather than leaving holes that require
read-modify-write cycles on main memory.
Hmm, since the code already 32-bit aligns each scanline of the video
buffer, then the loop could instead just do:
unsigned int *dstint = dst;
...
{
*dstint++ = (src[0] << 8) | (src[1] << 16) | (src[2] << 14);
}
This would probably be significantly faster, but you'd need a second
version for little-endian machines.
John