Commit 0b74fd11 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'dff6197d'

* commit 'dff6197d':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 73562f1f dff6197d
......@@ -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;
......
......@@ -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;
......
#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
......
#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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment