View Single Post
  #1 (permalink)  
Old October 12th, 2006, 01:52 AM
ehabinl ehabinl is offline
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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;
}

Reply With Quote