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 /libavcodec/nuv.c | |
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>
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r-- | libavcodec/nuv.c | 11 |
1 files changed, 9 insertions, 2 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; |