diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-11-22 08:00:47 +0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-11-24 20:25:36 +0400 |
commit | db431f7efec7467219ab370f796e01bd23bc2639 (patch) | |
tree | d14fc5c463058d14a315cb361b48e9c281ff2c92 /libavcodec/h264.c | |
parent | 6b0768e2021b90215a2ab55ed427bce91d148148 (diff) |
h264: add support for decoding planar RGB images.
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 793052581d..ad1ab69e29 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2727,24 +2727,33 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ switch (h->sps.bit_depth_luma) { case 9 : - if (CHROMA444) - s->avctx->pix_fmt = PIX_FMT_YUV444P9; - else if (CHROMA422) + if (CHROMA444) { + if (s->avctx->colorspace == AVCOL_SPC_RGB) { + s->avctx->pix_fmt = PIX_FMT_GBRP9; + } else + s->avctx->pix_fmt = PIX_FMT_YUV444P9; + } else if (CHROMA422) s->avctx->pix_fmt = PIX_FMT_YUV422P9; else s->avctx->pix_fmt = PIX_FMT_YUV420P9; break; case 10 : - if (CHROMA444) - s->avctx->pix_fmt = PIX_FMT_YUV444P10; - else if (CHROMA422) + if (CHROMA444) { + if (s->avctx->colorspace == AVCOL_SPC_RGB) { + s->avctx->pix_fmt = PIX_FMT_GBRP10; + } else + s->avctx->pix_fmt = PIX_FMT_YUV444P10; + } else if (CHROMA422) s->avctx->pix_fmt = PIX_FMT_YUV422P10; else s->avctx->pix_fmt = PIX_FMT_YUV420P10; break; default: if (CHROMA444){ - s->avctx->pix_fmt = s->avctx->color_range == AVCOL_RANGE_JPEG ? PIX_FMT_YUVJ444P : PIX_FMT_YUV444P; + if (s->avctx->colorspace == AVCOL_SPC_RGB) { + s->avctx->pix_fmt = PIX_FMT_GBRP; + } else + s->avctx->pix_fmt = s->avctx->color_range == AVCOL_RANGE_JPEG ? PIX_FMT_YUVJ444P : PIX_FMT_YUV444P; } else if (CHROMA422) { s->avctx->pix_fmt = s->avctx->color_range == AVCOL_RANGE_JPEG ? PIX_FMT_YUVJ422P : PIX_FMT_YUV422P; }else{ |