[FFmpeg-cvslog] avcodec/libx264: Set colorspace details correctly

Torsten Jager git at videolan.org
Mon Dec 16 17:09:14 CET 2013


ffmpeg | branch: master | Torsten Jager <t.jager at gmx.de> | Mon Dec 16 16:59:02 2013 +0100| [48d39c8786d2a1a36258d8e442602729eef0474c] | committer: Michael Niedermayer

avcodec/libx264: Set colorspace details correctly

After adding colorspace support to xine-lib, I insist in proper
settings within media files at least when they do not follow
that implicit SD/HD routine.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48d39c8786d2a1a36258d8e442602729eef0474c
---

 libavcodec/libx264.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 7f39308..8da1870 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -574,7 +574,15 @@ static av_cold int X264_init(AVCodecContext *avctx)
 
     x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
-                                 avctx->pix_fmt == AV_PIX_FMT_YUVJ444P;
+                                 avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
+                                 avctx->color_range == AVCOL_RANGE_JPEG;
+
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
+        x4->params.vui.i_colmatrix = avctx->colorspace;
+    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
+        x4->params.vui.i_colorprim = avctx->color_primaries;
+    if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
+        x4->params.vui.i_transfer  = avctx->color_trc;
 
     if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
         x4->params.b_repeat_headers = 0;



More information about the ffmpeg-cvslog mailing list