From 238614de679a71970c20d7c3fee08a322967ec40 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 Jan 2013 22:02:19 +0100 Subject: cdgraphics: do not rely on get_buffer() initializing the frame. Setting it to zero (instead of 128, as the default get_buffer() does) also produces more correctly-looking output. --- cmdutils.c | 2 +- libavcodec/cdgraphics.c | 2 ++ tests/ref/fate/cdgraphics | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index dc7e7b2e65..9aec9ae5ae 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1566,7 +1566,7 @@ 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: - * cdgraphics, ansi, aasc, fraps-v1, qtrle-1bit + * ansi, aasc, fraps-v1, qtrle-1bit */ memset(buf->base[0], 128, ret); diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index e4ed83b9d4..9f402cae21 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -287,6 +287,8 @@ static int cdg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } + if (!avctx->frame_number) + memset(cc->frame.data[0], 0, cc->frame.linesize[0] * avctx->height); command = bytestream_get_byte(&buf); inst = bytestream_get_byte(&buf); diff --git a/tests/ref/fate/cdgraphics b/tests/ref/fate/cdgraphics index 78a8f28880..dccb2b5c36 100644 --- a/tests/ref/fate/cdgraphics +++ b/tests/ref/fate/cdgraphics @@ -1,20 +1,20 @@ #tb 0: 1/300 -0, 0, 0, 1, 194400, 0xd919c635 -0, 1, 1, 1, 194400, 0xd919c635 -0, 2, 2, 1, 194400, 0x516a1007 -0, 3, 3, 1, 194400, 0x516a1007 -0, 4, 4, 1, 194400, 0x516a1007 -0, 5, 5, 1, 194400, 0x516a1007 -0, 6, 6, 1, 194400, 0x516a1007 -0, 7, 7, 1, 194400, 0x516a1007 -0, 8, 8, 1, 194400, 0x516a1007 -0, 9, 9, 1, 194400, 0x516a1007 -0, 10, 10, 1, 194400, 0x516a1007 -0, 11, 11, 1, 194400, 0x516a1007 -0, 12, 12, 1, 194400, 0x516a1007 -0, 13, 13, 1, 194400, 0x516a1007 -0, 14, 14, 1, 194400, 0x516a1007 -0, 15, 15, 1, 194400, 0x516a1007 +0, 0, 0, 1, 194400, 0x46ad80da +0, 1, 1, 1, 194400, 0x46ad80da +0, 2, 2, 1, 194400, 0x9392c3b9 +0, 3, 3, 1, 194400, 0x9392c3b9 +0, 4, 4, 1, 194400, 0x9392c3b9 +0, 5, 5, 1, 194400, 0x9392c3b9 +0, 6, 6, 1, 194400, 0x9392c3b9 +0, 7, 7, 1, 194400, 0x9392c3b9 +0, 8, 8, 1, 194400, 0x9392c3b9 +0, 9, 9, 1, 194400, 0x9392c3b9 +0, 10, 10, 1, 194400, 0x9392c3b9 +0, 11, 11, 1, 194400, 0x9392c3b9 +0, 12, 12, 1, 194400, 0x9392c3b9 +0, 13, 13, 1, 194400, 0x9392c3b9 +0, 14, 14, 1, 194400, 0x9392c3b9 +0, 15, 15, 1, 194400, 0x9392c3b9 0, 16, 16, 1, 194400, 0x46ad80da 0, 17, 17, 1, 194400, 0x46ad80da 0, 18, 18, 1, 194400, 0x46ad80da -- cgit v1.2.3