diff options
author | Michael Bradshaw <mbradshaw@sorensonmedia.com> | 2011-12-02 14:39:26 -0700 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 06:21:01 +0100 |
commit | 2ba3416362345f275c63e70f44f4cfbf9b66fb35 (patch) | |
tree | 31a86bf20fd72d8d57c8204afbdcf10ecde7c1a5 | |
parent | 3f07ef1dfff036a6b35c1605e6346bad2e17da68 (diff) | |
download | ffmpeg-2ba3416362345f275c63e70f44f4cfbf9b66fb35.tar.gz |
Added yuva420p decoding support for libopenjpeg
Signed-off-by: Michael Bradshaw <mbradshaw@sorensonmedia.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/libopenjpegdec.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 08e7cd540a..07cca2547b 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -91,6 +91,15 @@ libopenjpeg_rgb: return PIX_FMT_RGB24; } +static int is_yuva420(opj_image_t *image) +{ + return image->numcomps == 4 && + image->comps[0].dx == 1 && image->comps[0].dy == 1 && + image->comps[1].dx == 2 && image->comps[1].dy == 2 && + image->comps[2].dx == 2 && image->comps[2].dy == 2 && + image->comps[3].dx == 1 && image->comps[3].dy == 1; +} + static inline int libopenjpeg_ispacked(enum PixelFormat pix_fmt) { int i, component_plane; component_plane = av_pix_fmt_descriptors[pix_fmt].comp[0].plane; @@ -253,7 +262,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, break; case 3: avctx->pix_fmt = check_image_attributes(avctx, image); break; - case 4: avctx->pix_fmt = PIX_FMT_RGBA; + case 4: avctx->pix_fmt = is_yuva420(image) ? PIX_FMT_YUVA420P : PIX_FMT_RGBA; break; default: av_log(avctx, AV_LOG_ERROR, "%d components unsupported.\n", image->numcomps); goto done; |