[Ffmpeg-devel] Re: QT RLE encoder (bug and patch)

Clemens Fruhwirth clemens
Thu Mar 22 00:19:20 CET 2007

At Wed, 21 Mar 2007 20:13:23 +0100,
Nicolas Ollinger <Nicolas.Ollinger at lif.univ-mrs.fr> wrote:
> Dear Clemens,
> Thank you for your QT RLE encoder which I found quiet usefull to use  
> with vnc2swf to produce screencasts. Alas, there is a small bug in  
> your encoder (as found in http://clemens.endorphin.org/patches/qtrle- 
> encoder.diff). When dumping incremental lines, if there is a  
> difference at the start of a line then genrate_skipcodes(buf,0)  
> deletes back one byte instead of writing down a skip of 0. Easy  
> patch: in generate_skipcodes replace the while(x) {} loop by a do {}  
> while(x); It seams to work with this patch.

Thanks for your improvements. I have seen that the FFmpeg team has
done some modifications to the code in order to get it merged, but I
think that effort died down. IIRC they also changed the scancode
generation and might have fixed that bug. I don't have any interest or
time to check. Thanks for reporting back though.

I'm Cc the ffmpeg devel mailing list so this information isn't lost.

> +static void generate_skipcodes(uint8_t **buf, int skippix)
> +{
> +    do {
> +        int skipped=skippix<254?skippix:254;
> +        bytestream_put_byte(buf, skipped+1); // skip code
> +        bytestream_put_byte(buf, 0);         // RLE code 0: another  
> skip code is coming.
> +        skippix-=skipped;
> +    } while(skippix);                       // skippix may be 0 in  
> the beginning
> +    (*buf)--;                              // Remove last RLE code  
> announcing a skip code
> +}

Fruhwirth Clemens - http://clemens.endorphin.org 

More information about the ffmpeg-devel mailing list