summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-06 16:36:08 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-06 16:40:59 +0100
commit0b74fd11341230721ef188d520e166b105fb111c (patch)
tree1a58104d6a3ed555757493112b677def569badc2 /libavcodec
parent73562f1f834ef0ec8f5f881be73a135b9348c112 (diff)
parentdff6197dfb9b2d145729885c63f865c5fdd184aa (diff)
downloadffmpeg-streaming-0b74fd11341230721ef188d520e166b105fb111c.zip
ffmpeg-streaming-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')
-rw-r--r--libavcodec/nuv.c11
-rw-r--r--libavcodec/yop.c3
2 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index bfbf793..b8796d2 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 be30fa4..234868a 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;
OpenPOWER on IntegriCloud