diff mbox

[FFmpeg-devel] msrle: implement vertical offset in 4-bit RLE

Message ID 20161128080506.5713-1-daniel@drv.nu
State Accepted
Commit e856ac23732822ac04fe5dd959cff94c7249c17e
Headers show

Commit Message

Daniel Verkamp Nov. 28, 2016, 8:05 a.m. UTC
The delta escape (2) is supposed to work the same in 4-bit RLE as in
8-bit RLE.  This is documented in the MSDN Bitmap Compression page:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183383(v=vs.85).aspx

The unchecked modification of line is safe, since the loop condition
(line >= 0) will check it before any pixel data is written.

Fixes ticket #5153 (output now matches ImageMagick for the provided
sample).

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
---
 libavcodec/msrledec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 28, 2016, 8:45 a.m. UTC | #1
On 11/28/16, Daniel Verkamp <daniel@drv.nu> wrote:
> The delta escape (2) is supposed to work the same in 4-bit RLE as in
> 8-bit RLE.  This is documented in the MSDN Bitmap Compression page:
> https://msdn.microsoft.com/en-us/library/windows/desktop/dd183383(v=vs.85).aspx
>
> The unchecked modification of line is safe, since the loop condition
> (line >= 0) will check it before any pixel data is written.
>
> Fixes ticket #5153 (output now matches ImageMagick for the provided
> sample).
>
> Signed-off-by: Daniel Verkamp <daniel@drv.nu>
> ---
>  libavcodec/msrledec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
> index 805802ae18..f0cbde67ff 100644
> --- a/libavcodec/msrledec.c
> +++ b/libavcodec/msrledec.c
> @@ -63,7 +63,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx,
> AVFrame *pic,
>                  stream_byte = bytestream2_get_byte(gb);
>                  pixel_ptr += stream_byte;
>                  stream_byte = bytestream2_get_byte(gb);
> -                avpriv_request_sample(avctx, "Unused stream byte %X",
> stream_byte);
> +                line -= stream_byte;
>              } else {
>                  // copy pixels from encoded stream
>                  odd_pixel =  stream_byte & 1;
> --
> 2.11.0.rc2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

probably ok
diff mbox

Patch

diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index 805802ae18..f0cbde67ff 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -63,7 +63,7 @@  static int msrle_decode_pal4(AVCodecContext *avctx, AVFrame *pic,
                 stream_byte = bytestream2_get_byte(gb);
                 pixel_ptr += stream_byte;
                 stream_byte = bytestream2_get_byte(gb);
-                avpriv_request_sample(avctx, "Unused stream byte %X", stream_byte);
+                line -= stream_byte;
             } else {
                 // copy pixels from encoded stream
                 odd_pixel =  stream_byte & 1;