changeset 10451:e97b59049b4c

Fix M$RLE 4bit. Patch by Michael Guennewig <michaelguennewig(at)gmx(dot)de>
author rtognimp
date Mon, 21 Jul 2003 19:04:12 +0000
parents 2d3f6a2996da
children 4eaf6fa120b1
files libmpcodecs/vd_msrle.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_msrle.c	Sun Jul 20 15:29:40 2003 +0000
+++ b/libmpcodecs/vd_msrle.c	Mon Jul 21 19:04:12 2003 +0000
@@ -137,10 +137,9 @@
       else
       {
         // copy pixels from encoded stream
-        rle_code = stream_byte;
-        rle_code /= 2;
+        rle_code = ((stream_byte + 1) & (~1)) / 2;
         extra_byte = rle_code & 0x01;
-        if ((row_ptr + pixel_ptr + rle_code * bytes_per_pixel > frame_size) ||
+        if ((row_ptr + pixel_ptr + stream_byte * bytes_per_pixel > frame_size) ||
             (row_ptr < 0))
         {
           mp_msg(MSGT_DECVIDEO, MSGL_WARN,
@@ -170,6 +169,8 @@
           }
           pixel_ptr += bytes_per_pixel;
 
+	  if (i + 1 == rle_code && (stream_byte & 1) != 0)
+	    break;
           if (pixel_ptr >= row_dec)
             break;
           if (bytes_per_pixel == 2)