From ab7da16ea4753376149afef2307f07c828eacc2e Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 31 Jan 2012 20:18:22 +0000 Subject: [PATCH] ffv1dec: PIX_FMT_YUVA420P support Signed-off-by: Paul B Mahol Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 2ba8845d37..e496de4aa7 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1435,6 +1435,8 @@ static int decode_slice(AVCodecContext *c, void *arg){ decode_plane(fs, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); decode_plane(fs, p->data[2] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[2], 1); + if (fs->transparency) + decode_plane(fs, p->data[3] + ps*x + y*p->linesize[3], width, height, p->linesize[3], 2); }else{ decode_rgb_frame(fs, (uint32_t*)p->data[0] + ps*x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); } @@ -1571,7 +1573,7 @@ static int read_header(FFV1Context *f){ } if(f->colorspace==0){ - if(f->avctx->bits_per_raw_sample<=8){ + if(f->avctx->bits_per_raw_sample<=8 && !f->transparency){ switch(16*f->chroma_h_shift + f->chroma_v_shift){ case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break; case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break; @@ -1582,6 +1584,13 @@ static int read_header(FFV1Context *f){ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n"); return -1; } + }else if(f->avctx->bits_per_raw_sample<=8 && f->transparency){ + switch(16*f->chroma_h_shift + f->chroma_v_shift){ + case 0x11: f->avctx->pix_fmt= PIX_FMT_YUVA420P; break; + default: + av_log(f->avctx, AV_LOG_ERROR, "format not supported\n"); + return -1; + } }else if(f->avctx->bits_per_raw_sample==9) { switch(16*f->chroma_h_shift + f->chroma_v_shift){ case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;