[MPlayer-dev-eng] [PATCH] decoding of MS-RLE in 4-bit is buggy

Michael Günnewig MichaelGuennewig at gmx.de
Sun Jun 29 18:59:20 CEST 2003


MichaelGuennewig at gmx.de (Michael Günnewig) writes:

> Roberto Togni <r_togni at libero.it> writes:
>
>> On 2003.06.13 20:13 Michael Günnewig wrote:
>>> Hallo.
>>> The decoding of Microsoft-RLE in 4-bit doesn't work correctly under
>>> all circumstances. As described at
>>>   http://www.pcisys.net/~melanson/codecs/msrle.txt
>>> must the code be aligned at a word-boundary when in absolute mode.

 ...

> Okay, I have it.
>
>   rle_code   = ((stream_byte + 1) & (~1)) / 2;  // same as yours
>   extra_byte = (stream_byte / 2) & 0x01 || (stream_byte % 2);
>
> extra_byte is wrong comparing to spec (see above), but Windows decodes
> it correct -- very strange. Will generate some very stupid
> test-patterns and look at the results of Windows decoder. I'm very
> interested in the results.

Okay, now I have the results. The above code works with the previous
test-video, but not with some other test-videos. I also found out that
the previous test-video was bad, but I couldn't find out why I was
possible to decode it correctly under windows -- think I have changed it
by mistacke with anotherone.

The correct code must be

   rle_code   = ((stream_byte + 1) & (~1)) / 2;
   extra_byte = rle_code & 0x01;

which is the same as the spec says.


  Michael Günnewig


The resulting patch:

  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msrle-mplayer.diff
Type: text/x-patch
Size: 1035 bytes
Desc: msrle-mplayer.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030629/f2146534/attachment.bin>


More information about the MPlayer-dev-eng mailing list