From 89f11f498b9c15bc71494a11a7ec560f4adf630d Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 30 Jan 2013 06:42:17 +0100 Subject: [PATCH] qtrle: fix the topmost line for 1bit Signed-off-by: Anton Khirnov CC:libav-stable@libav.org --- cmdutils.c | 1 - libavcodec/qtrle.c | 5 ++- tests/ref/fate/qtrle-1bit | 76 +++++++++++++++++++-------------------- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index a9523aec74..0b3724e8a6 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1566,7 +1566,6 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu /* XXX this shouldn't be needed, but some tests break without this line * those decoders are buggy and need to be fixed. * the following tests fail: - * qtrle-1bit */ memset(buf->base[0], 128, ret); diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 32ad5d66b7..5100e318fb 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -56,13 +56,16 @@ typedef struct QtrleContext { static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) { int rle_code; - int pixel_ptr = 0; + int pixel_ptr; int row_inc = s->frame.linesize[0]; unsigned char pi0, pi1; /* 2 8-pixel values */ unsigned char *rgb = s->frame.data[0]; int pixel_limit = s->frame.linesize[0] * s->avctx->height; int skip; + row_ptr -= row_inc; + pixel_ptr = row_ptr; + lines_to_change++; while (lines_to_change) { skip = bytestream2_get_byte(&s->g); rle_code = (signed char)bytestream2_get_byte(&s->g); diff --git a/tests/ref/fate/qtrle-1bit b/tests/ref/fate/qtrle-1bit index 1cbaa9c5af..a424e47765 100644 --- a/tests/ref/fate/qtrle-1bit +++ b/tests/ref/fate/qtrle-1bit @@ -1,39 +1,39 @@ #tb 0: 1/1200 -0, 0, 0, 0, 9600, 0xc1632102 -0, 100, 100, 0, 9600, 0x0f6c0521 -0, 200, 200, 0, 9600, 0x04b90b5a -0, 300, 300, 0, 9600, 0x2ebd4500 -0, 400, 400, 0, 9600, 0x726f46f4 -0, 500, 500, 0, 9600, 0x37f6968e -0, 600, 600, 0, 9600, 0x7305872e -0, 700, 700, 0, 9600, 0x222eff5e -0, 800, 800, 0, 9600, 0x9317e227 -0, 900, 900, 0, 9600, 0x421eee9d -0, 1000, 1000, 0, 9600, 0xcbcfaaff -0, 1100, 1100, 0, 9600, 0xe7d43be2 -0, 1200, 1200, 0, 9600, 0x0b71e28c -0, 1300, 1300, 0, 9600, 0xd6a050ca -0, 1400, 1400, 0, 9600, 0x0ac6dbf5 -0, 1500, 1500, 0, 9600, 0x5c036038 -0, 1600, 1600, 0, 9600, 0x6e417ed6 -0, 1700, 1700, 0, 9600, 0x8bd0dc22 -0, 1800, 1800, 0, 9600, 0xdf3b0877 -0, 1900, 1900, 0, 9600, 0xae6e7823 -0, 2000, 2000, 0, 9600, 0x8ff0ac32 -0, 2100, 2100, 0, 9600, 0xa2d9e2ce -0, 2200, 2200, 0, 9600, 0x5fd92b65 -0, 2300, 2300, 0, 9600, 0x81c1c824 -0, 2400, 2400, 0, 9600, 0xb8a2ace4 -0, 2500, 2500, 0, 9600, 0x65b70404 -0, 2600, 2600, 0, 9600, 0xc5349eb2 -0, 2700, 2700, 0, 9600, 0xf60cc2b8 -0, 2800, 2800, 0, 9600, 0x31474595 -0, 2900, 2900, 0, 9600, 0xf602635b -0, 3000, 3000, 0, 9600, 0x873cbd87 -0, 3100, 3100, 0, 9600, 0xb9793ffe -0, 3200, 3200, 0, 9600, 0x42eb2831 -0, 3300, 3300, 0, 9600, 0x44cc1dab -0, 3400, 3400, 0, 9600, 0xbdcbbb87 -0, 3500, 3500, 0, 9600, 0x29c22df7 -0, 3600, 3600, 0, 9600, 0xde502ef5 -0, 3700, 3700, 0, 9600, 0xaf311aeb +0, 0, 0, 0, 9600, 0xc5921aa2 +0, 100, 100, 0, 9600, 0x9032fc52 +0, 200, 200, 0, 9600, 0x7db0038e +0, 300, 300, 0, 9600, 0x95b73c41 +0, 400, 400, 0, 9600, 0x531e4189 +0, 500, 500, 0, 9600, 0xb73390ec +0, 600, 600, 0, 9600, 0x958e8221 +0, 700, 700, 0, 9600, 0xd393f8a6 +0, 800, 800, 0, 9600, 0xa085da1c +0, 900, 900, 0, 9600, 0x57ace74f +0, 1000, 1000, 0, 9600, 0x5d11a308 +0, 1100, 1100, 0, 9600, 0x13e133b7 +0, 1200, 1200, 0, 9600, 0x494edb86 +0, 1300, 1300, 0, 9600, 0x43a448ea +0, 1400, 1400, 0, 9600, 0x3562d35b +0, 1500, 1500, 0, 9600, 0x0bc655d2 +0, 1600, 1600, 0, 9600, 0xbece73a1 +0, 1700, 1700, 0, 9600, 0x82e7cfa1 +0, 1800, 1800, 0, 9600, 0xda29fd8f +0, 1900, 1900, 0, 9600, 0x70fb700b +0, 2000, 2000, 0, 9600, 0xaf57a6b0 +0, 2100, 2100, 0, 9600, 0x0a5ed9b9 +0, 2200, 2200, 0, 9600, 0xf7c62c38 +0, 2300, 2300, 0, 9600, 0x0aa2ccfd +0, 2400, 2400, 0, 9600, 0xc9adabae +0, 2500, 2500, 0, 9600, 0x67ff0aba +0, 2600, 2600, 0, 9600, 0xea79a465 +0, 2700, 2700, 0, 9600, 0x8928c626 +0, 2800, 2800, 0, 9600, 0x8dab4111 +0, 2900, 2900, 0, 9600, 0x81ef63f9 +0, 3000, 3000, 0, 9600, 0xf977bc5e +0, 3100, 3100, 0, 9600, 0x9e6a3f4a +0, 3200, 3200, 0, 9600, 0x77c92865 +0, 3300, 3300, 0, 9600, 0x3915170d +0, 3400, 3400, 0, 9600, 0xbe19b995 +0, 3500, 3500, 0, 9600, 0x3e8a3077 +0, 3600, 3600, 0, 9600, 0x1331342e +0, 3700, 3700, 0, 9600, 0x4d692175