diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-06 16:36:08 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-06 16:40:59 +0100 |
commit | 0b74fd11341230721ef188d520e166b105fb111c (patch) | |
tree | 1a58104d6a3ed555757493112b677def569badc2 | |
parent | 73562f1f834ef0ec8f5f881be73a135b9348c112 (diff) | |
parent | dff6197dfb9b2d145729885c63f865c5fdd184aa (diff) | |
download | ffmpeg-0b74fd11341230721ef188d520e166b105fb111c.tar.gz |
Merge commit 'dff6197dfb9b2d145729885c63f865c5fdd184aa'
* commit 'dff6197dfb9b2d145729885c63f865c5fdd184aa':
nuv: do not rely on get_buffer() initializing the frame.
yop: initialize palette to 0
Conflicts:
libavcodec/nuv.c
tests/ref/fate/nuv-rtjpeg-fh
tests/ref/fate/yop
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/nuv.c | 11 | ||||
-rw-r--r-- | libavcodec/yop.c | 3 | ||||
-rw-r--r-- | tests/ref/fate/nuv-rtjpeg-fh | 14 | ||||
-rw-r--r-- | tests/ref/fate/yop | 6 |
4 files changed, 22 insertions, 12 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index bfbf79335b..b8796d229e 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -156,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int orig_size = buf_size; int keyframe; int size_change = 0; - int result; + int result, init_frame = !avctx->frame_number; enum { NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1', @@ -241,8 +241,10 @@ retry: buf_size -= RTJPEG_HEADER_SIZE; } - if ((size_change || keyframe) && c->pic.data[0]) + if ((size_change || keyframe) && c->pic.data[0]) { avctx->release_buffer(avctx, &c->pic); + init_frame = 1; + } c->pic.reference = 3; c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; @@ -251,6 +253,11 @@ retry: av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; } + if (init_frame) { + memset(c->pic.data[0], 0, avctx->height * c->pic.linesize[0]); + memset(c->pic.data[1], 0x80, avctx->height * c->pic.linesize[1] / 2); + memset(c->pic.data[2], 0x80, avctx->height * c->pic.linesize[2] / 2); + } c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; c->pic.key_frame = keyframe; diff --git a/libavcodec/yop.c b/libavcodec/yop.c index be30fa4064..234868abbf 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -206,6 +206,9 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; } + if (!avctx->frame_number) + memset(s->frame.data[1], 0, AVPALETTE_SIZE); + s->dstbuf = s->frame.data[0]; s->dstptr = s->frame.data[0]; s->srcptr = avpkt->data + 4; diff --git a/tests/ref/fate/nuv-rtjpeg-fh b/tests/ref/fate/nuv-rtjpeg-fh index beb6ccde06..b2e04cb015 100644 --- a/tests/ref/fate/nuv-rtjpeg-fh +++ b/tests/ref/fate/nuv-rtjpeg-fh @@ -1,11 +1,11 @@ #tb 0: 1/50 -0, 80, 80, 1, 221184, 0xf48c94f6 -0, 82, 82, 1, 221184, 0x89b625b2 -0, 83, 83, 1, 221184, 0x37e04714 -0, 84, 84, 1, 221184, 0x4f4c5224 -0, 85, 85, 1, 221184, 0x9193c9f1 -0, 86, 86, 1, 221184, 0x5d1a6197 -0, 87, 87, 1, 221184, 0x40cd51e7 +0, 80, 80, 1, 221184, 0xdaf54f83 +0, 82, 82, 1, 221184, 0xeea3e3b4 +0, 83, 83, 1, 221184, 0x5f1a8525 +0, 84, 84, 1, 221184, 0x950bb170 +0, 85, 85, 1, 221184, 0x6262e94c +0, 86, 86, 1, 221184, 0x28752197 +0, 87, 87, 1, 221184, 0x0c2811e7 0, 88, 88, 1, 221184, 0xb2c1a729 0, 90, 90, 1, 221184, 0x998d6144 0, 91, 91, 1, 221184, 0xf5d52311 diff --git a/tests/ref/fate/yop b/tests/ref/fate/yop index 758eacb864..1920281a40 100644 --- a/tests/ref/fate/yop +++ b/tests/ref/fate/yop @@ -1,7 +1,7 @@ #tb 0: 1/12 0, 0, 0, 1, 302760, 0xf24dfa37 0, 1, 1, 1, 302760, 0xcedcbb6c -0, 2, 2, 1, 302760, 0x8c2d19a2 -0, 3, 3, 1, 302760, 0xe0fc92da -0, 4, 4, 1, 302760, 0xd7699bb4 +0, 2, 2, 1, 302760, 0xc87716a2 +0, 3, 3, 1, 302760, 0x7e378e5a +0, 4, 4, 1, 302760, 0xd4a19734 0, 5, 5, 1, 302760, 0x26e93266 |