Browse Source

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>
tags/n1.2
Michael Niedermayer 12 years ago
parent
commit
0b74fd1134
4 changed files with 22 additions and 12 deletions
  1. +9
    -2
      libavcodec/nuv.c
  2. +3
    -0
      libavcodec/yop.c
  3. +7
    -7
      tests/ref/fate/nuv-rtjpeg-fh
  4. +3
    -3
      tests/ref/fate/yop

+ 9
- 2
libavcodec/nuv.c View File

@@ -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;


+ 3
- 0
libavcodec/yop.c View File

@@ -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;


+ 7
- 7
tests/ref/fate/nuv-rtjpeg-fh View File

@@ -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


+ 3
- 3
tests/ref/fate/yop View File

@@ -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

Loading…
Cancel
Save