Opportunity for speedup

Bobby Powers bobbypowers at gmail.com
Thu Feb 19 14:01:59 EST 2009


On Thu, Feb 19, 2009 at 1:56 PM, Wade Brainerd <wadetb at gmail.com> wrote:
> RLE (run length encoding) compresses sequences of identical pixels ("runs")
> as value/count pairs.
> So abbbbbbbbbbccc would be stored as 1a 10b 3c.
> The decompressor looks like:
> while (cur < end)
> {
>    unsigned short count = *cur++;
>    unsigned short value = *cur++;
>    while (count--)
>       *dest++ = value;
> }
> This can be faster than memcpy because you are reading significantly less
> memory than you would with memcpy, thus fewer cache misses are incurred.
> Because the startup images are mostly spans solid colors, this kind of
> compression works very well.  If that were not the case, say if there were a
> left-to-right gradient in the background, RLE would probably make things
> worse, thus you have to be careful when choosing it.
> But the smaller size on disk and in memory would probably improve
> performance in other ways as well.
> Best,
> Wade

thanks, that makes sense



More information about the Devel mailing list