1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '685e6f2e3939f124b41c7801cc541dad8252af3d'

* commit '685e6f2e3939f124b41c7801cc541dad8252af3d':
  xxan: properly handle odd heights.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-02-06 15:26:24 +01:00
commit 68c0144d02
2 changed files with 36 additions and 21 deletions

View File

@ -45,6 +45,11 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->pix_fmt = AV_PIX_FMT_YUV420P;
if (avctx->height < 8) {
av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
return AVERROR(EINVAL);
}
s->buffer_size = avctx->width * avctx->height; s->buffer_size = avctx->width * avctx->height;
s->y_buffer = av_malloc(s->buffer_size); s->y_buffer = av_malloc(s->buffer_size);
if (!s->y_buffer) if (!s->y_buffer)
@ -212,6 +217,10 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U += s->pic.linesize[1]; U += s->pic.linesize[1];
V += s->pic.linesize[2]; V += s->pic.linesize[2];
} }
if (avctx->height & 1) {
memcpy(U, U - s->pic.linesize[1], avctx->width >> 1);
memcpy(V, V - s->pic.linesize[2], avctx->width >> 1);
}
} else { } else {
uint8_t *U2 = U + s->pic.linesize[1]; uint8_t *U2 = U + s->pic.linesize[1];
uint8_t *V2 = V + s->pic.linesize[2]; uint8_t *V2 = V + s->pic.linesize[2];
@ -236,6 +245,12 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U2 += s->pic.linesize[1] * 2; U2 += s->pic.linesize[1] * 2;
V2 += s->pic.linesize[2] * 2; V2 += s->pic.linesize[2] * 2;
} }
if (avctx->height & 3) {
int lines = ((avctx->height + 1) >> 1) - (avctx->height >> 2) * 2;
memcpy(U, U - lines * s->pic.linesize[1], lines * s->pic.linesize[1]);
memcpy(V, V - lines * s->pic.linesize[2], lines * s->pic.linesize[2]);
}
} }
return 0; return 0;

View File

@ -1,22 +1,22 @@
#tb 0: 1/15 #tb 0: 1/15
0, 0, 0, 1, 79360, 0x3b0a7d1b 0, 0, 0, 1, 79360, 0x8537821b
0, 1, 1, 1, 79360, 0x740842c3 0, 1, 1, 1, 79360, 0x110c4343
0, 2, 2, 1, 79360, 0x85160167 0, 2, 2, 1, 79360, 0xa85105bb
0, 3, 3, 1, 79360, 0xaf510e92 0, 3, 3, 1, 79360, 0x87431836
0, 4, 4, 1, 79360, 0x8e290bec 0, 4, 4, 1, 79360, 0x5c701720
0, 5, 5, 1, 79360, 0x51e981b0 0, 5, 5, 1, 79360, 0x20308ce4
0, 6, 6, 1, 79360, 0x16e52c60 0, 6, 6, 1, 79360, 0xe51d3794
0, 7, 7, 1, 79360, 0x66e1e60a 0, 7, 7, 1, 79360, 0x80e6f1e0
0, 8, 8, 1, 79360, 0x40fa58f6 0, 8, 8, 1, 79360, 0x5aff64cc
0, 9, 9, 1, 79360, 0x00388edd 0, 9, 9, 1, 79360, 0x1a3d9ab3
0, 10, 10, 1, 79360, 0xc74f95bf 0, 10, 10, 1, 79360, 0xe154a195
0, 11, 11, 1, 79360, 0xf446a3fd 0, 11, 11, 1, 79360, 0x608dafdc
0, 12, 12, 1, 79360, 0x27b5eb60 0, 12, 12, 1, 79360, 0x93edf73f
0, 13, 13, 1, 79360, 0xea9266a2 0, 13, 13, 1, 79360, 0x56d97281
0, 14, 14, 1, 79360, 0x7b6a7907 0, 14, 14, 1, 79360, 0xe7a284e6
0, 15, 15, 1, 79360, 0x2be7d946 0, 15, 15, 1, 79360, 0xd4e5e513
0, 16, 16, 1, 79360, 0x61881ee4 0, 16, 16, 1, 79360, 0x0a952ab1
0, 17, 17, 1, 79360, 0x9214bd4f 0, 17, 17, 1, 79360, 0x3b21c91c
0, 18, 18, 1, 79360, 0xeb294afe 0, 18, 18, 1, 79360, 0x943656cb
0, 19, 19, 1, 79360, 0xc861ad55 0, 19, 19, 1, 79360, 0xffbdb94b
0, 20, 20, 1, 79360, 0x3d3b6220 0, 20, 20, 1, 79360, 0x74976e16