[FFmpeg-cvslog] nvenc: write the VUI signal properties for HEVC

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:22:29 2016 +0200| [2156c4c300971e490b5ca463d78c87c383c2b9a2] | committer: Anton Khirnov

nvenc: write the VUI signal properties for HEVC

Bump the API version requirement to 6.

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

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

 configure          |    4 ++--
 libavcodec/nvenc.c |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 664bfff..d99a7c8 100755
--- a/configure
+++ b/configure
@@ -4667,8 +4667,8 @@ fi
 if enabled nvenc; then
     enabled cuda || check_header cuda.h || die "ERROR: cuda.h not found."
     check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
-    check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 5" ||
-        die "ERROR: NVENC API version 4 or older is not supported"
+    check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
+        die "ERROR: NVENC API version 5 or older is not supported"
 fi
 
 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d28b347..ff852b1 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -652,6 +652,20 @@ static int nvenc_setup_hevc_config(AVCodecContext *avctx)
     NVENCContext *ctx                      = avctx->priv_data;
     NV_ENC_CONFIG *cc                      = &ctx->config;
     NV_ENC_CONFIG_HEVC *hevc               = &cc->encodeCodecConfig.hevcConfig;
+    NV_ENC_CONFIG_HEVC_VUI_PARAMETERS *vui = &hevc->hevcVUIParameters;
+
+    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;
+    vui->transferCharacteristics = avctx->color_trc;
+
+    vui->videoFullRangeFlag = avctx->color_range == AVCOL_RANGE_JPEG;
+
+    vui->videoSignalTypePresentFlag = vui->colourDescriptionPresentFlag ||
+                                      vui->videoFullRangeFlag;
 
     hevc->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0;
     hevc->repeatSPSPPS  = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;



More information about the ffmpeg-cvslog mailing list