Commit 769eba75 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '89f11f49'

* commit '89f11f49':
  qtrle: fix the topmost line for 1bit

Conflicts:
	tests/ref/fate/qtrle-1bit

See: 1af91978Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 68c0144d 89f11f49
...@@ -1856,7 +1856,6 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu ...@@ -1856,7 +1856,6 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu
/* XXX this shouldn't be needed, but some tests break without this line /* XXX this shouldn't be needed, but some tests break without this line
* those decoders are buggy and need to be fixed. * those decoders are buggy and need to be fixed.
* the following tests fail: * the following tests fail:
* qtrle-1bit
*/ */
memset(buf->base[0], 128, ret); memset(buf->base[0], 128, ret);
......
...@@ -56,7 +56,7 @@ typedef struct QtrleContext { ...@@ -56,7 +56,7 @@ typedef struct QtrleContext {
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{ {
int rle_code; int rle_code;
int pixel_ptr = 0; int pixel_ptr;
int row_inc = s->frame.linesize[0]; int row_inc = s->frame.linesize[0];
unsigned char pi0, pi1; /* 2 8-pixel values */ unsigned char pi0, pi1; /* 2 8-pixel values */
unsigned char *rgb = s->frame.data[0]; unsigned char *rgb = s->frame.data[0];
...@@ -70,8 +70,10 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) ...@@ -70,8 +70,10 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
* See: https://ffmpeg.org/trac/ffmpeg/ticket/226 * See: https://ffmpeg.org/trac/ffmpeg/ticket/226
* In the following decoding loop, row_ptr will be the position of the * In the following decoding loop, row_ptr will be the position of the
* _next_ row. */ * _next_ row. */
lines_to_change++;
row_ptr -= row_inc;
pixel_ptr = row_ptr;
lines_to_change++;
while (lines_to_change) { while (lines_to_change) {
skip = bytestream2_get_byte(&s->g); skip = bytestream2_get_byte(&s->g);
rle_code = (signed char)bytestream2_get_byte(&s->g); rle_code = (signed char)bytestream2_get_byte(&s->g);
...@@ -79,8 +81,8 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) ...@@ -79,8 +81,8 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
break; break;
if(skip & 0x80) { if(skip & 0x80) {
lines_to_change--; lines_to_change--;
pixel_ptr = row_ptr + 2 * (skip & 0x7f);
row_ptr += row_inc; row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * (skip & 0x7f);
} else } else
pixel_ptr += 2 * skip; pixel_ptr += 2 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment