[FFmpeg-cvslog] h264: add support for decoding planar RGB images.
Ronald S. Bultje
git at videolan.org
Fri Nov 25 04:43:28 CET 2011
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Mon Nov 21 20:00:47 2011 -0800| [db431f7efec7467219ab370f796e01bd23bc2639] | committer: Ronald S. Bultje
h264: add support for decoding planar RGB images.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db431f7efec7467219ab370f796e01bd23bc2639
---
libavcodec/h264.c | 23 ++++++++++++++++-------
libavcodec/utils.c | 5 +++++
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7930525..ad1ab69 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{
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 3e182a1..53440e0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -138,6 +138,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int l
case PIX_FMT_YUV422P:
case PIX_FMT_YUV440P:
case PIX_FMT_YUV444P:
+ case PIX_FMT_GBRP:
case PIX_FMT_GRAY8:
case PIX_FMT_GRAY16BE:
case PIX_FMT_GRAY16LE:
@@ -158,6 +159,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int l
case PIX_FMT_YUV444P9BE:
case PIX_FMT_YUV444P10LE:
case PIX_FMT_YUV444P10BE:
+ case PIX_FMT_GBRP9LE:
+ case PIX_FMT_GBRP9BE:
+ case PIX_FMT_GBRP10LE:
+ case PIX_FMT_GBRP10BE:
w_align= 16; //FIXME check for non mpeg style codecs and use less alignment
h_align= 16;
if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP || s->codec_id == CODEC_ID_H264)
More information about the ffmpeg-cvslog
mailing list