[FFmpeg-cvslog] nvenc: only write the VUI signal type fields if they are set

Anton Khirnov git at videolan.org
Sat Jun 25 11:59:16 CEST 2016


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 12 09:20:19 2016 +0200| [a1df7865039b8a7743f9067300c0b367db50a727] | committer: Anton Khirnov

nvenc: only write the VUI signal type fields if they are set

Based on a patch by Agatha Hu <ahu at nvidia.com>.

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

 libavcodec/nvenc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 283a71c..d28b347 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -588,8 +588,9 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
     NV_ENC_CONFIG_H264 *h264               = &cc->encodeCodecConfig.h264Config;
     NV_ENC_CONFIG_H264_VUI_PARAMETERS *vui = &h264->h264VUIParameters;
 
-    vui->colourDescriptionPresentFlag = 1;
-    vui->videoSignalTypePresentFlag   = 1;
+    vui->colourDescriptionPresentFlag = avctx->colorspace      != AVCOL_SPC_UNSPECIFIED ||
+                                        avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+                                        avctx->color_trc       != AVCOL_TRC_UNSPECIFIED;
 
     vui->colourMatrix            = avctx->colorspace;
     vui->colourPrimaries         = avctx->color_primaries;
@@ -597,6 +598,9 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
 
     vui->videoFullRangeFlag = avctx->color_range == AVCOL_RANGE_JPEG;
 
+    vui->videoSignalTypePresentFlag = vui->colourDescriptionPresentFlag ||
+                                      vui->videoFullRangeFlag;
+
     h264->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0;
     h264->repeatSPSPPS  = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
     h264->outputAUD     = 1;



More information about the ffmpeg-cvslog mailing list