RLE Uncompession
I need make sure that the following code will uncompress the RLE BMP file correctly:
DWORD RLEUncompress(unsigned char *output,unsigned char *input,int length)
{
int count;
DWORD counter=0;
while (length > 0) {
count = *input++;
counter++;
if (count > 0x80) {
memset(output,*input++,count);
counter+= count;
length -= 2;
} else if (count < 0x80) {
memcpy(output,input,count);
input += count;
length -= count;
}
output += count;
}
return counter;
}
|