]> git.sesse.net Git - ffmpeg/commitdiff
nvenc: write the VUI signal properties for HEVC
authorAnton Khirnov <anton@khirnov.net>
Thu, 12 May 2016 07:22:29 +0000 (09:22 +0200)
committerAnton Khirnov <anton@khirnov.net>
Thu, 19 May 2016 12:17:03 +0000 (14:17 +0200)
Bump the API version requirement to 6.

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

configure
libavcodec/nvenc.c

index 664bfffc5570f4e6fd5120d77830a4cb3ca31260..d99a7c842345291a1d4bdd0526c1924752a2f36f 100755 (executable)
--- 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
index d28b347c6ba5f08beacc995a4bdabe712e2c84b8..ff852b10bb7e8e2d55429103b6850f6d02fbd339 100644 (file)
@@ -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;