diff -Nru nv-codec-headers-9.1.23.1/debian/changelog nv-codec-headers-11.1.5.0/debian/changelog --- nv-codec-headers-9.1.23.1/debian/changelog 2020-10-09 09:11:44.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/changelog 2021-08-13 07:59:10.000000000 +0000 @@ -1,13 +1,23 @@ -nv-codec-headers (9.1.23.1-0ubuntu2) groovy; urgency=medium +nv-codec-headers (11.1.5.0-0build1~2104) hirsute; urgency=medium - * debian/libffmpeg-nvenc-dev.install: - - remove the buggy .install, it's not needed since it's a single binary - including all available files, also it's using a wrong prefix + * New upstream release. - -- Sebastien Bacher Fri, 09 Oct 2020 11:11:44 +0200 + -- pandajim (key for lives deb) Fri, 13 Aug 2021 07:59:10 +0000 -nv-codec-headers (9.1.23.1-0ubuntu1) focal; urgency=medium +nv-codec-headers (11.0.10.1-1~xtradeb1) focal; urgency=medium - * Initial release. (LP: #1866709) + * New upstream release. - -- Martin Wimpress Mon, 09 Mar 2020 21:16:35 +0000 + -- Jhonny Oliveira Sun, 02 May 2021 09:05:12 +0000 + +nv-codec-headers (11.0.10.0-1~xtradeb2) focal; urgency=medium + + * Fix upstream download URL in debian watch file + + -- Jhonny Oliveira Mon, 22 Mar 2021 21:27:40 +0000 + +nv-codec-headers (11.0.10.0-1~xtradeb1) focal; urgency=medium + + * Initial release + + -- Jhonny Oliveira Wed, 03 Feb 2021 07:12:30 +0000 diff -Nru nv-codec-headers-9.1.23.1/debian/control nv-codec-headers-11.1.5.0/debian/control --- nv-codec-headers-9.1.23.1/debian/control 2020-03-07 09:56:10.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/control 2021-05-02 09:05:12.000000000 +0000 @@ -1,14 +1,18 @@ Source: nv-codec-headers -Section: devel +Section: libs Priority: optional -Maintainer: Martin Wimpress -Rules-Requires-Root: no -Build-Depends: debhelper-compat (= 12), +Maintainer: Jhonny Oliveira +Build-Depends: debhelper-compat (= 12) Standards-Version: 4.5.0 Homepage: https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git -Package: libffmpeg-nvenc-dev +Package: nv-codec-headers Architecture: all -Depends: ${misc:Depends}, - ${shlibs:Depends}, -Description: FFmpeg headers for interfacing with NVIDIA's codec APIs +Section: libdevel +Depends: ${misc:Depends} +Description: FFmpeg version of Nvidia Codec SDK headers + FFmpeg version of headers required to interface with Nvidias codec APIs. + . + Corresponds to Video Codec SDK matching this release. + . + Minimum required driver versions: 455.28 or newer diff -Nru nv-codec-headers-9.1.23.1/debian/copyright nv-codec-headers-11.1.5.0/debian/copyright --- nv-codec-headers-9.1.23.1/debian/copyright 2020-03-09 21:15:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/copyright 2021-02-03 07:12:30.000000000 +0000 @@ -1,34 +1,71 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: nv-codec-headers -Upstream-Contact: NVIDIA Corporation -Source: https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git +Source: https://github.com/FFmpeg/nv-codec-headers -Files: ffnvcodec.pc.in - Makefile +Files: * +Copyright: 2010-2021, NVIDIA Corporation +License: MIT + +Files: Makefile README - include/* -Copyright: 2010-2019 NVIDIA Corporation -License: Expat + ffnvcodec.pc.in +Copyright: 2018, FFmpeg +License: GPL-2+ Files: debian/* -Copyright: 2020, Martin Wimpress -License: Expat +Copyright: Copyright (C) 2020 Jhonny Oliveira +License: GPL-3.0+ + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. -License: Expat - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. +License: GPL-2+ + This package is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + . + This package is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + . + You should have received a copy of the GNU General Public License along + with this program. If not, see + . + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff -Nru nv-codec-headers-9.1.23.1/debian/patches/2000_usr_prefix.patch nv-codec-headers-11.1.5.0/debian/patches/2000_usr_prefix.patch --- nv-codec-headers-9.1.23.1/debian/patches/2000_usr_prefix.patch 2020-01-28 16:20:11.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/patches/2000_usr_prefix.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -Author: Martin Wimpress -Description: Change PREFIX from /usr/local to /usr - ---- a/Makefile -+++ b/Makefile -@@ -1,4 +1,4 @@ --PREFIX = /usr/local -+PREFIX = /usr - LIBDIR = lib - INSTALL = install - SED = sed diff -Nru nv-codec-headers-9.1.23.1/debian/patches/README nv-codec-headers-11.1.5.0/debian/patches/README --- nv-codec-headers-9.1.23.1/debian/patches/README 2020-01-28 15:49:41.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/patches/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -0xxx: Grabbed from upstream development. -1xxx: Possibly relevant for upstream adoption. -2xxx: Only relevant for official Debian release. diff -Nru nv-codec-headers-9.1.23.1/debian/patches/series nv-codec-headers-11.1.5.0/debian/patches/series --- nv-codec-headers-9.1.23.1/debian/patches/series 2020-01-28 15:51:37.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -2000_usr_prefix.patch diff -Nru nv-codec-headers-9.1.23.1/debian/rules nv-codec-headers-11.1.5.0/debian/rules --- nv-codec-headers-9.1.23.1/debian/rules 2020-01-29 08:24:16.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/rules 2021-05-02 09:05:12.000000000 +0000 @@ -1,9 +1,9 @@ #!/usr/bin/make -f - -export DH_VERBOSE = 1 - %: - dh $@ --without autoreconf + dh $@ + +override_dh_auto_install: + $(MAKE) install PREFIX=/usr DESTDIR=$(CURDIR)/debian/nv-codec-headers -get-orig-source: - uscan --noconf --force-download --rename --download-current-version --destdir=.. \ No newline at end of file +override_dh_clean: + dh_clean ffnvcodec.pc diff -Nru nv-codec-headers-9.1.23.1/debian/source/format nv-codec-headers-11.1.5.0/debian/source/format --- nv-codec-headers-9.1.23.1/debian/source/format 2020-01-28 15:10:54.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/source/format 2021-02-03 07:12:30.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) \ No newline at end of file +3.0 (quilt) diff -Nru nv-codec-headers-9.1.23.1/debian/source/lintian-overrides nv-codec-headers-11.1.5.0/debian/source/lintian-overrides --- nv-codec-headers-9.1.23.1/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/source/lintian-overrides 2021-02-03 07:12:30.000000000 +0000 @@ -0,0 +1,5 @@ +source-is-missing doc/jquery.js line length is 12734 characters (>512) +source-is-missing doc/search/all_3.js line length is 514 characters (>512) +source-is-missing doc/search/all_b.js line length is 367 characters (>256) +source-is-missing doc/search/functions_2.js line length is 514 characters (>512) +source-is-missing doc/search/functions_a.js line length is 367 characters (>256) diff -Nru nv-codec-headers-9.1.23.1/debian/upstream/metadata nv-codec-headers-11.1.5.0/debian/upstream/metadata --- nv-codec-headers-9.1.23.1/debian/upstream/metadata 2020-01-28 15:18:27.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -Name: nv-codec-headers -Bug-Database: https://trac.ffmpeg.org/report/1 -Contact: linux-bugs@nvidia.com -Repository: https://git.videolan.org/git/ffmpeg/nv-codec-headers.git -Repository-Browse: https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git;a=summary -Security-Contact: linux-bugs@nvidia.com diff -Nru nv-codec-headers-9.1.23.1/debian/watch nv-codec-headers-11.1.5.0/debian/watch --- nv-codec-headers-9.1.23.1/debian/watch 2020-01-28 14:54:47.000000000 +0000 +++ nv-codec-headers-11.1.5.0/debian/watch 2021-03-22 21:27:40.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 -opts=filenamemangle=s/.+\/n?(\d\S*)\.tar\.gz/nv-codec-headers-$1\.tar\.gz/ \ - https://github.com/FFmpeg/nv-codec-headers/tags .*/n?(\d\S*)\.tar\.gz \ No newline at end of file +version=4 +https://github.com/FFmpeg/@PACKAGE@/releases/latest \ + (?:.*?/)?archive/refs/tags/n(\d[\d.]*)@ARCHIVE_EXT@ diff -Nru nv-codec-headers-9.1.23.1/ffnvcodec.pc.in nv-codec-headers-11.1.5.0/ffnvcodec.pc.in --- nv-codec-headers-9.1.23.1/ffnvcodec.pc.in 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/ffnvcodec.pc.in 2021-08-03 16:13:31.000000000 +0000 @@ -3,5 +3,5 @@ Name: ffnvcodec Description: FFmpeg version of Nvidia Codec SDK headers -Version: 9.1.23.1 +Version: 11.1.5.0 Cflags: -I${includedir} diff -Nru nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_cuda.h nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_cuda.h --- nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_cuda.h 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_cuda.h 2021-08-03 16:13:31.000000000 +0000 @@ -41,7 +41,7 @@ #define CU_CTX_SCHED_BLOCKING_SYNC 4 typedef int CUdevice; -#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined(__LP64__) +#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined(__LP64__) || defined(__aarch64__) typedef unsigned long long CUdeviceptr; #else typedef unsigned int CUdeviceptr; @@ -59,6 +59,8 @@ typedef struct CUextMemory_st *CUexternalMemory; typedef struct CUextSemaphore_st *CUexternalSemaphore; +typedef struct CUlinkState_st *CUlinkState; + typedef enum cudaError_enum { CUDA_SUCCESS = 0, CUDA_ERROR_NOT_READY = 600 @@ -69,6 +71,7 @@ */ typedef enum CUdevice_attribute_enum { CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, + CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, @@ -82,6 +85,7 @@ CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40, CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50, + CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83, @@ -156,6 +160,41 @@ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4 } CUexternalSemaphoreHandleType; +typedef enum CUjit_option_enum +{ + CU_JIT_MAX_REGISTERS = 0, + CU_JIT_THREADS_PER_BLOCK = 1, + CU_JIT_WALL_TIME = 2, + CU_JIT_INFO_LOG_BUFFER = 3, + CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4, + CU_JIT_ERROR_LOG_BUFFER = 5, + CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6, + CU_JIT_OPTIMIZATION_LEVEL = 7, + CU_JIT_TARGET_FROM_CUCONTEXT = 8, + CU_JIT_TARGET = 9, + CU_JIT_FALLBACK_STRATEGY = 10, + CU_JIT_GENERATE_DEBUG_INFO = 11, + CU_JIT_LOG_VERBOSE = 12, + CU_JIT_GENERATE_LINE_INFO = 13, + CU_JIT_CACHE_MODE = 14, + CU_JIT_NEW_SM3X_OPT = 15, + CU_JIT_FAST_COMPILE = 16, + CU_JIT_GLOBAL_SYMBOL_NAMES = 17, + CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18, + CU_JIT_GLOBAL_SYMBOL_COUNT = 19, + CU_JIT_NUM_OPTIONS +} CUjit_option; + +typedef enum CUjitInputType_enum +{ + CU_JIT_INPUT_CUBIN = 0, + CU_JIT_INPUT_PTX = 1, + CU_JIT_INPUT_FATBINARY = 2, + CU_JIT_INPUT_OBJECT = 3, + CU_JIT_INPUT_LIBRARY = 4, + CU_JIT_NUM_INPUT_TYPES +} CUjitInputType; + #ifndef CU_UUID_HAS_BEEN_DEFINED #define CU_UUID_HAS_BEEN_DEFINED typedef struct CUuuid_st { @@ -324,10 +363,19 @@ typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx); typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize); typedef CUresult CUDAAPI tcuMemAllocPitch_v2(CUdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes); +typedef CUresult CUDAAPI tcuMemAllocManaged(CUdeviceptr *dptr, size_t bytesize, unsigned int flags); typedef CUresult CUDAAPI tcuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream); typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr); +typedef CUresult CUDAAPI tcuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t bytesize); +typedef CUresult CUDAAPI tcuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t bytesize, CUstream hStream); typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy); typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D *pcopy, CUstream hStream); +typedef CUresult CUDAAPI tcuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount); +typedef CUresult CUDAAPI tcuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); +typedef CUresult CUDAAPI tcuMemcpyDtoH_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount); +typedef CUresult CUDAAPI tcuMemcpyDtoHAsync_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); +typedef CUresult CUDAAPI tcuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); +typedef CUresult CUDAAPI tcuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr); typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr); typedef CUresult CUDAAPI tcuCtxGetDevice(CUdevice *device); @@ -350,9 +398,14 @@ typedef CUresult CUDAAPI tcuEventRecord(CUevent hEvent, CUstream hStream); typedef CUresult CUDAAPI tcuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra); +typedef CUresult CUDAAPI tcuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut); +typedef CUresult CUDAAPI tcuLinkAddData(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues); +typedef CUresult CUDAAPI tcuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut); +typedef CUresult CUDAAPI tcuLinkDestroy(CUlinkState state); typedef CUresult CUDAAPI tcuModuleLoadData(CUmodule* module, const void* image); typedef CUresult CUDAAPI tcuModuleUnload(CUmodule hmod); typedef CUresult CUDAAPI tcuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name); +typedef CUresult CUDAAPI tcuModuleGetGlobal(CUdeviceptr *dptr, size_t *bytes, CUmodule hmod, const char* name); typedef CUresult CUDAAPI tcuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc); typedef CUresult CUDAAPI tcuTexObjectDestroy(CUtexObject texObject); diff -Nru nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_cuviddec.h nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_cuviddec.h --- nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_cuviddec.h 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_cuviddec.h 2021-08-03 16:13:31.000000000 +0000 @@ -1,7 +1,7 @@ /* * This copyright notice applies to this header file only: * - * Copyright (c) 2010-2019 NVIDIA Corporation + * Copyright (c) 2010-2021 NVIDIA Corporation * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -28,7 +28,6 @@ /*****************************************************************************************************/ //! \file cuviddec.h //! NVDECODE API provides video decoding interface to NVIDIA GPU devices. -//! \date 2015-2019 //! This file contains constants, structure definitions and function prototypes used for decoding. /*****************************************************************************************************/ @@ -41,7 +40,7 @@ #endif #endif -#define NVDECAPI_MAJOR_VERSION 9 +#define NVDECAPI_MAJOR_VERSION 11 #define NVDECAPI_MINOR_VERSION 1 #define NVDECAPI_VERSION (NVDECAPI_MAJOR_VERSION | (NVDECAPI_MINOR_VERSION << 24)) @@ -76,6 +75,7 @@ cudaVideoCodec_HEVC, /**< HEVC */ cudaVideoCodec_VP8, /**< VP8 */ cudaVideoCodec_VP9, /**< VP9 */ + cudaVideoCodec_AV1, /**< AV1 */ cudaVideoCodec_NumCodecs, /**< Max codecs */ // Uncompressed YUV cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), /**< Y,U,V (4:2:0) */ @@ -164,7 +164,7 @@ unsigned int reserved1[3]; /**< Reserved for future use - set to zero */ unsigned char bIsSupported; /**< OUT: 1 if codec supported, 0 if not supported */ - unsigned char reserved2; /**< Reserved for future use - set to zero */ + unsigned char nNumNVDECs; /**< OUT: Number of NVDECs that can support IN params */ unsigned short nOutputFormatMask; /**< OUT: each bit represents corresponding cudaVideoSurfaceFormat enum */ unsigned int nMaxWidth; /**< OUT: Max supported coded width in pixels */ unsigned int nMaxHeight; /**< OUT: Max supported coded height in pixels */ @@ -172,7 +172,12 @@ CodedWidth*CodedHeight/256 must be <= nMaxMBCount */ unsigned short nMinWidth; /**< OUT: Min supported coded width in pixels */ unsigned short nMinHeight; /**< OUT: Min supported coded height in pixels */ - unsigned int reserved3[11]; /**< Reserved for future use - set to zero */ + unsigned char bIsHistogramSupported; /**< OUT: 1 if Y component histogram output is supported, 0 if not + Note: histogram is computed on original picture data before + any post-processing like scaling, cropping, etc. is applied */ + unsigned char nCounterBitDepth; /**< OUT: histogram counter bit depth */ + unsigned short nMaxHistogramBins; /**< OUT: Max number of histogram bins */ + unsigned int reserved3[10]; /**< Reserved for future use - set to zero */ } CUVIDDECODECAPS; /**************************************************************************************************************/ @@ -223,7 +228,9 @@ short right; short bottom; } target_rect; - tcu_ulong Reserved2[5]; /**< Reserved for future use - set to zero */ + + tcu_ulong enableHistogram; /**< IN: enable histogram output, if supported */ + tcu_ulong Reserved2[4]; /**< Reserved for future use - set to zero */ } CUVIDDECODECREATEINFO; /*********************************************************/ @@ -722,6 +729,181 @@ } CUVIDVP9PICPARAMS; +/***********************************************************/ +//! \struct CUVIDAV1PICPARAMS +//! AV1 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +typedef struct _CUVIDAV1PICPARAMS +{ + unsigned int width; // coded width, if superres enabled then it is upscaled width + unsigned int height; // coded height + unsigned int frame_offset; // defined as order_hint in AV1 specification + int decodePicIdx; // decoded output pic index, if film grain enabled, it will keep decoded (without film grain) output + // It can be used as reference frame for future frames + + // sequence header + unsigned int profile : 3; // 0 = profile0, 1 = profile1, 2 = profile2 + unsigned int use_128x128_superblock : 1; // superblock size 0:64x64, 1: 128x128 + unsigned int subsampling_x : 1; // (subsampling_x, _y) 1,1 = 420, 1,0 = 422, 0,0 = 444 + unsigned int subsampling_y : 1; + unsigned int mono_chrome : 1; // for monochrome content, mono_chrome = 1 and (subsampling_x, _y) should be 1,1 + unsigned int bit_depth_minus8 : 4; // bit depth minus 8 + unsigned int enable_filter_intra : 1; // tool enable in seq level, 0 : disable 1: frame header control + unsigned int enable_intra_edge_filter : 1; // intra edge filtering process, 0 : disable 1: enabled + unsigned int enable_interintra_compound : 1; // interintra, 0 : not present 1: present + unsigned int enable_masked_compound : 1; // 1: mode info for inter blocks may contain the syntax element compound_type. + // 0: syntax element compound_type will not be present + unsigned int enable_dual_filter : 1; // vertical and horiz filter selection, 1: enable and 0: disable + unsigned int enable_order_hint : 1; // order hint, and related tools, 1: enable and 0: disable + unsigned int order_hint_bits_minus1 : 3; // is used to compute OrderHintBits + unsigned int enable_jnt_comp : 1; // joint compound modes, 1: enable and 0: disable + unsigned int enable_superres : 1; // superres in seq level, 0 : disable 1: frame level control + unsigned int enable_cdef : 1; // cdef filtering in seq level, 0 : disable 1: frame level control + unsigned int enable_restoration : 1; // loop restoration filtering in seq level, 0 : disable 1: frame level control + unsigned int enable_fgs : 1; // defined as film_grain_params_present in AV1 specification + unsigned int reserved0_7bits : 7; // reserved bits; must be set to 0 + + // frame header + unsigned int frame_type : 2 ; // 0:Key frame, 1:Inter frame, 2:intra only, 3:s-frame + unsigned int show_frame : 1 ; // show_frame = 1 implies that frame should be immediately output once decoded + unsigned int disable_cdf_update : 1; // CDF update during symbol decoding, 1: disabled, 0: enabled + unsigned int allow_screen_content_tools : 1; // 1: intra blocks may use palette encoding, 0: palette encoding is never used + unsigned int force_integer_mv : 1; // 1: motion vectors will always be integers, 0: can contain fractional bits + unsigned int coded_denom : 3; // coded_denom of the superres scale as specified in AV1 specification + unsigned int allow_intrabc : 1; // 1: intra block copy may be used, 0: intra block copy is not allowed + unsigned int allow_high_precision_mv : 1; // 1/8 precision mv enable + unsigned int interp_filter : 3; // interpolation filter. Refer to section 6.8.9 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned int switchable_motion_mode : 1; // defined as is_motion_mode_switchable in AV1 specification + unsigned int use_ref_frame_mvs : 1; // 1: current frame can use the previous frame mv information, 0: will not use. + unsigned int disable_frame_end_update_cdf : 1; // 1: indicates that the end of frame CDF update is disabled + unsigned int delta_q_present : 1; // quantizer index delta values are present in the block level + unsigned int delta_q_res : 2; // left shift which should be applied to decoded quantizer index delta values + unsigned int using_qmatrix : 1; // 1: quantizer matrix will be used to compute quantizers + unsigned int coded_lossless : 1; // 1: all segments use lossless coding + unsigned int use_superres : 1; // 1: superres enabled for frame + unsigned int tx_mode : 2; // 0: ONLY4x4,1:LARGEST,2:SELECT + unsigned int reference_mode : 1; // 0: SINGLE, 1: SELECT + unsigned int allow_warped_motion : 1; // 1: allow_warped_motion may be present, 0: allow_warped_motion will not be present + unsigned int reduced_tx_set : 1; // 1: frame is restricted to subset of the full set of transform types, 0: no such restriction + unsigned int skip_mode : 1; // 1: most of the mode info is skipped, 0: mode info is not skipped + unsigned int reserved1_3bits : 3; // reserved bits; must be set to 0 + + // tiling info + unsigned int num_tile_cols : 8; // number of tiles across the frame., max is 64 + unsigned int num_tile_rows : 8; // number of tiles down the frame., max is 64 + unsigned int context_update_tile_id : 16; // specifies which tile to use for the CDF update + unsigned short tile_widths[64]; // Width of each column in superblocks + unsigned short tile_heights[64]; // height of each row in superblocks + + // CDEF - refer to section 6.10.14 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned char cdef_damping_minus_3 : 2; // controls the amount of damping in the deringing filter + unsigned char cdef_bits : 2; // the number of bits needed to specify which CDEF filter to apply + unsigned char reserved2_4bits : 4; // reserved bits; must be set to 0 + unsigned char cdef_y_strength[8]; // 0-3 bits: y_pri_strength, 4-7 bits y_sec_strength + unsigned char cdef_uv_strength[8]; // 0-3 bits: uv_pri_strength, 4-7 bits uv_sec_strength + + // SkipModeFrames + unsigned char SkipModeFrame0 : 4; // specifies the frames to use for compound prediction when skip_mode is equal to 1. + unsigned char SkipModeFrame1 : 4; + + // qp information - refer to section 6.8.11 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned char base_qindex; // indicates the base frame qindex. Defined as base_q_idx in AV1 specification + char qp_y_dc_delta_q; // indicates the Y DC quantizer relative to base_q_idx. Defined as DeltaQYDc in AV1 specification + char qp_u_dc_delta_q; // indicates the U DC quantizer relative to base_q_idx. Defined as DeltaQUDc in AV1 specification + char qp_v_dc_delta_q; // indicates the V DC quantizer relative to base_q_idx. Defined as DeltaQVDc in AV1 specification + char qp_u_ac_delta_q; // indicates the U AC quantizer relative to base_q_idx. Defined as DeltaQUAc in AV1 specification + char qp_v_ac_delta_q; // indicates the V AC quantizer relative to base_q_idx. Defined as DeltaQVAc in AV1 specification + unsigned char qm_y; // specifies the level in the quantizer matrix that should be used for luma plane decoding + unsigned char qm_u; // specifies the level in the quantizer matrix that should be used for chroma U plane decoding + unsigned char qm_v; // specifies the level in the quantizer matrix that should be used for chroma V plane decoding + + // segmentation - refer to section 6.8.13 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned char segmentation_enabled : 1; // 1 indicates that this frame makes use of the segmentation tool + unsigned char segmentation_update_map : 1; // 1 indicates that the segmentation map are updated during the decoding of this frame + unsigned char segmentation_update_data : 1; // 1 indicates that new parameters are about to be specified for each segment + unsigned char segmentation_temporal_update : 1; // 1 indicates that the updates to the segmentation map are coded relative to the existing segmentation map + unsigned char reserved3_4bits : 4; // reserved bits; must be set to 0 + short segmentation_feature_data[8][8]; // specifies the feature data for a segment feature + unsigned char segmentation_feature_mask[8]; // indicates that the corresponding feature is unused or feature value is coded + + // loopfilter - refer to section 6.8.10 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned char loop_filter_level[2]; // contains loop filter strength values + unsigned char loop_filter_level_u; // loop filter strength value of U plane + unsigned char loop_filter_level_v; // loop filter strength value of V plane + unsigned char loop_filter_sharpness; // indicates the sharpness level + char loop_filter_ref_deltas[8]; // contains the adjustment needed for the filter level based on the chosen reference frame + char loop_filter_mode_deltas[2]; // contains the adjustment needed for the filter level based on the chosen mode + unsigned char loop_filter_delta_enabled : 1; // indicates that the filter level depends on the mode and reference frame used to predict a block + unsigned char loop_filter_delta_update : 1; // indicates that additional syntax elements are present that specify which mode and + // reference frame deltas are to be updated + unsigned char delta_lf_present : 1; // specifies whether loop filter delta values are present in the block level + unsigned char delta_lf_res : 2; // specifies the left shift to apply to the decoded loop filter values + unsigned char delta_lf_multi : 1; // separate loop filter deltas for Hy,Vy,U,V edges + unsigned char reserved4_2bits : 2; // reserved bits; must be set to 0 + + // restoration - refer to section 6.10.15 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned char lr_unit_size[3]; // specifies the size of loop restoration units: 0: 32, 1: 64, 2: 128, 3: 256 + unsigned char lr_type[3] ; // used to compute FrameRestorationType + + // reference frames + unsigned char primary_ref_frame; // specifies which reference frame contains the CDF values and other state that should be + // loaded at the start of the frame + unsigned char ref_frame_map[8]; // frames in dpb that can be used as reference for current or future frames + + unsigned char temporal_layer_id : 4; // temporal layer id + unsigned char spatial_layer_id : 4; // spatial layer id + + unsigned char reserved5_32bits[4]; // reserved bits; must be set to 0 + + // ref frame list + struct + { + unsigned int width; + unsigned int height; + unsigned char index; + unsigned char reserved24Bits[3]; // reserved bits; must be set to 0 + } ref_frame[7]; // frames used as reference frame for current frame. + + // global motion + struct { + unsigned char invalid : 1; + unsigned char wmtype : 2; // defined as GmType in AV1 specification + unsigned char reserved5Bits : 5; // reserved bits; must be set to 0 + char reserved24Bits[3]; // reserved bits; must be set to 0 + int wmmat[6]; // defined as gm_params[] in AV1 specification + } global_motion[7]; // global motion params for reference frames + + // film grain params - refer to section 6.8.20 of the AV1 specification Version 1.0.0 with Errata 1 + unsigned short apply_grain : 1; + unsigned short overlap_flag : 1; + unsigned short scaling_shift_minus8 : 2; + unsigned short chroma_scaling_from_luma : 1; + unsigned short ar_coeff_lag : 2; + unsigned short ar_coeff_shift_minus6 : 2; + unsigned short grain_scale_shift : 2; + unsigned short clip_to_restricted_range : 1; + unsigned short reserved6_4bits : 4; // reserved bits; must be set to 0 + unsigned char num_y_points; + unsigned char scaling_points_y[14][2]; + unsigned char num_cb_points; + unsigned char scaling_points_cb[10][2]; + unsigned char num_cr_points; + unsigned char scaling_points_cr[10][2]; + unsigned char reserved7_8bits; // reserved bits; must be set to 0 + unsigned short random_seed; + short ar_coeffs_y[24]; + short ar_coeffs_cb[25]; + short ar_coeffs_cr[25]; + unsigned char cb_mult; + unsigned char cb_luma_mult; + short cb_offset; + unsigned char cr_mult; + unsigned char cr_luma_mult; + short cr_offset; + + int reserved[7]; // reserved bits; must be set to 0 +} CUVIDAV1PICPARAMS; /******************************************************************************************/ //! \struct CUVIDPICPARAMS @@ -756,6 +938,7 @@ CUVIDHEVCPICPARAMS hevc; CUVIDVP8PICPARAMS vp8; CUVIDVP9PICPARAMS vp9; + CUVIDAV1PICPARAMS av1; unsigned int CodecReserved[1024]; } CodecSpecific; } CUVIDPICPARAMS; @@ -768,22 +951,23 @@ /******************************************************/ typedef struct _CUVIDPROCPARAMS { - int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */ - int second_field; /**< IN: Output the second field (ignored if deinterlace mode is Weave) */ - int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is bottom) */ - int unpaired_field; /**< IN: Input only contains one field (2nd field is invalid) */ + int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */ + int second_field; /**< IN: Output the second field (ignored if deinterlace mode is Weave) */ + int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is bottom) */ + int unpaired_field; /**< IN: Input only contains one field (2nd field is invalid) */ // The fields below are used for raw YUV input - unsigned int reserved_flags; /**< Reserved for future use (set to zero) */ - unsigned int reserved_zero; /**< Reserved (set to zero) */ - unsigned long long raw_input_dptr; /**< IN: Input CUdeviceptr for raw YUV extensions */ - unsigned int raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned appropriately) */ - unsigned int raw_input_format; /**< IN: Input YUV format (cudaVideoCodec_enum) */ - unsigned long long raw_output_dptr; /**< IN: Output CUdeviceptr for raw YUV extensions */ - unsigned int raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */ - unsigned int Reserved1; /**< Reserved for future use (set to zero) */ - CUstream output_stream; /**< IN: stream object used by cuvidMapVideoFrame */ - unsigned int Reserved[46]; /**< Reserved for future use (set to zero) */ - void *Reserved2[2]; /**< Reserved for future use (set to zero) */ + unsigned int reserved_flags; /**< Reserved for future use (set to zero) */ + unsigned int reserved_zero; /**< Reserved (set to zero) */ + unsigned long long raw_input_dptr; /**< IN: Input CUdeviceptr for raw YUV extensions */ + unsigned int raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned appropriately) */ + unsigned int raw_input_format; /**< IN: Input YUV format (cudaVideoCodec_enum) */ + unsigned long long raw_output_dptr; /**< IN: Output CUdeviceptr for raw YUV extensions */ + unsigned int raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */ + unsigned int Reserved1; /**< Reserved for future use (set to zero) */ + CUstream output_stream; /**< IN: stream object used by cuvidMapVideoFrame */ + unsigned int Reserved[46]; /**< Reserved for future use (set to zero) */ + unsigned long long *histogram_dptr; /**< OUT: Output CUdeviceptr for histogram extensions */ + void *Reserved2[1]; /**< Reserved for future use (set to zero) */ } CUVIDPROCPARAMS; /*********************************************************************************************************/ @@ -897,6 +1081,9 @@ /************************************************************************************************************/ //! \fn CUresult CUDAAPI cuvidGetDecodeStatus(CUvideodecoder hDecoder, int nPicIdx); //! Get the decode status for frame corresponding to nPicIdx +//! API is supported for Maxwell and above generation GPUs. +//! API is currently supported for HEVC, H264 and JPEG codecs. +//! API returns CUDA_ERROR_NOT_SUPPORTED error code for unsupported GPU or codec. /************************************************************************************************************/ typedef CUresult CUDAAPI tcuvidGetDecodeStatus(CUvideodecoder hDecoder, int nPicIdx, CUVIDGETDECODESTATUS* pDecodeStatus); diff -Nru nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_loader.h nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_loader.h --- nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_loader.h 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_loader.h 2021-08-03 16:13:31.000000000 +0000 @@ -150,10 +150,19 @@ tcuCtxDestroy_v2 *cuCtxDestroy; tcuMemAlloc_v2 *cuMemAlloc; tcuMemAllocPitch_v2 *cuMemAllocPitch; + tcuMemAllocManaged *cuMemAllocManaged; tcuMemsetD8Async *cuMemsetD8Async; tcuMemFree_v2 *cuMemFree; + tcuMemcpy *cuMemcpy; + tcuMemcpyAsync *cuMemcpyAsync; tcuMemcpy2D_v2 *cuMemcpy2D; tcuMemcpy2DAsync_v2 *cuMemcpy2DAsync; + tcuMemcpyHtoD_v2 *cuMemcpyHtoD; + tcuMemcpyHtoDAsync_v2 *cuMemcpyHtoDAsync; + tcuMemcpyDtoH_v2 *cuMemcpyDtoH; + tcuMemcpyDtoHAsync_v2 *cuMemcpyDtoHAsync; + tcuMemcpyDtoD_v2 *cuMemcpyDtoD; + tcuMemcpyDtoDAsync_v2 *cuMemcpyDtoDAsync; tcuGetErrorName *cuGetErrorName; tcuGetErrorString *cuGetErrorString; tcuCtxGetDevice *cuCtxGetDevice; @@ -176,9 +185,14 @@ tcuEventRecord *cuEventRecord; tcuLaunchKernel *cuLaunchKernel; + tcuLinkCreate *cuLinkCreate; + tcuLinkAddData *cuLinkAddData; + tcuLinkComplete *cuLinkComplete; + tcuLinkDestroy *cuLinkDestroy; tcuModuleLoadData *cuModuleLoadData; tcuModuleUnload *cuModuleUnload; tcuModuleGetFunction *cuModuleGetFunction; + tcuModuleGetGlobal *cuModuleGetGlobal; tcuTexObjectCreate *cuTexObjectCreate; tcuTexObjectDestroy *cuTexObjectDestroy; @@ -222,6 +236,7 @@ tcuvidCtxLock *cuvidCtxLock; tcuvidCtxUnlock *cuvidCtxUnlock; +#if !defined(__APPLE__) tcuvidCreateVideoSource *cuvidCreateVideoSource; tcuvidCreateVideoSourceW *cuvidCreateVideoSourceW; tcuvidDestroyVideoSource *cuvidDestroyVideoSource; @@ -229,6 +244,7 @@ tcuvidGetVideoSourceState *cuvidGetVideoSourceState; tcuvidGetSourceVideoFormat *cuvidGetSourceVideoFormat; tcuvidGetSourceAudioFormat *cuvidGetSourceAudioFormat; +#endif tcuvidCreateVideoParser *cuvidCreateVideoParser; tcuvidParseVideoData *cuvidParseVideoData; tcuvidDestroyVideoParser *cuvidDestroyVideoParser; @@ -281,10 +297,19 @@ LOAD_SYMBOL(cuCtxDestroy, tcuCtxDestroy_v2, "cuCtxDestroy_v2"); LOAD_SYMBOL(cuMemAlloc, tcuMemAlloc_v2, "cuMemAlloc_v2"); LOAD_SYMBOL(cuMemAllocPitch, tcuMemAllocPitch_v2, "cuMemAllocPitch_v2"); + LOAD_SYMBOL(cuMemAllocManaged, tcuMemAllocManaged, "cuMemAllocManaged"); LOAD_SYMBOL(cuMemsetD8Async, tcuMemsetD8Async, "cuMemsetD8Async"); LOAD_SYMBOL(cuMemFree, tcuMemFree_v2, "cuMemFree_v2"); + LOAD_SYMBOL(cuMemcpy, tcuMemcpy, "cuMemcpy"); + LOAD_SYMBOL(cuMemcpyAsync, tcuMemcpyAsync, "cuMemcpyAsync"); LOAD_SYMBOL(cuMemcpy2D, tcuMemcpy2D_v2, "cuMemcpy2D_v2"); LOAD_SYMBOL(cuMemcpy2DAsync, tcuMemcpy2DAsync_v2, "cuMemcpy2DAsync_v2"); + LOAD_SYMBOL(cuMemcpyHtoD, tcuMemcpyHtoD_v2, "cuMemcpyHtoD_v2"); + LOAD_SYMBOL(cuMemcpyHtoDAsync, tcuMemcpyHtoDAsync_v2, "cuMemcpyHtoDAsync_v2"); + LOAD_SYMBOL(cuMemcpyDtoH, tcuMemcpyDtoH_v2, "cuMemcpyDtoH_v2"); + LOAD_SYMBOL(cuMemcpyDtoHAsync, tcuMemcpyDtoHAsync_v2, "cuMemcpyDtoHAsync_v2"); + LOAD_SYMBOL(cuMemcpyDtoD, tcuMemcpyDtoD_v2, "cuMemcpyDtoD_v2"); + LOAD_SYMBOL(cuMemcpyDtoDAsync, tcuMemcpyDtoDAsync_v2, "cuMemcpyDtoDAsync_v2"); LOAD_SYMBOL(cuGetErrorName, tcuGetErrorName, "cuGetErrorName"); LOAD_SYMBOL(cuGetErrorString, tcuGetErrorString, "cuGetErrorString"); LOAD_SYMBOL(cuCtxGetDevice, tcuCtxGetDevice, "cuCtxGetDevice"); @@ -307,9 +332,14 @@ LOAD_SYMBOL(cuEventRecord, tcuEventRecord, "cuEventRecord"); LOAD_SYMBOL(cuLaunchKernel, tcuLaunchKernel, "cuLaunchKernel"); + LOAD_SYMBOL(cuLinkCreate, tcuLinkCreate, "cuLinkCreate"); + LOAD_SYMBOL(cuLinkAddData, tcuLinkAddData, "cuLinkAddData"); + LOAD_SYMBOL(cuLinkComplete, tcuLinkComplete, "cuLinkComplete"); + LOAD_SYMBOL(cuLinkDestroy, tcuLinkDestroy, "cuLinkDestroy"); LOAD_SYMBOL(cuModuleLoadData, tcuModuleLoadData, "cuModuleLoadData"); LOAD_SYMBOL(cuModuleUnload, tcuModuleUnload, "cuModuleUnload"); LOAD_SYMBOL(cuModuleGetFunction, tcuModuleGetFunction, "cuModuleGetFunction"); + LOAD_SYMBOL(cuModuleGetGlobal, tcuModuleGetGlobal, "cuModuleGetGlobal"); LOAD_SYMBOL(cuTexObjectCreate, tcuTexObjectCreate, "cuTexObjectCreate"); LOAD_SYMBOL(cuTexObjectDestroy, tcuTexObjectDestroy, "cuTexObjectDestroy"); @@ -359,6 +389,7 @@ LOAD_SYMBOL(cuvidCtxLock, tcuvidCtxLock, "cuvidCtxLock"); LOAD_SYMBOL(cuvidCtxUnlock, tcuvidCtxUnlock, "cuvidCtxUnlock"); +#if !defined(__APPLE__) LOAD_SYMBOL(cuvidCreateVideoSource, tcuvidCreateVideoSource, "cuvidCreateVideoSource"); LOAD_SYMBOL(cuvidCreateVideoSourceW, tcuvidCreateVideoSourceW, "cuvidCreateVideoSourceW"); LOAD_SYMBOL(cuvidDestroyVideoSource, tcuvidDestroyVideoSource, "cuvidDestroyVideoSource"); @@ -366,6 +397,7 @@ LOAD_SYMBOL(cuvidGetVideoSourceState, tcuvidGetVideoSourceState, "cuvidGetVideoSourceState"); LOAD_SYMBOL(cuvidGetSourceVideoFormat, tcuvidGetSourceVideoFormat, "cuvidGetSourceVideoFormat"); LOAD_SYMBOL(cuvidGetSourceAudioFormat, tcuvidGetSourceAudioFormat, "cuvidGetSourceAudioFormat"); +#endif LOAD_SYMBOL(cuvidCreateVideoParser, tcuvidCreateVideoParser, "cuvidCreateVideoParser"); LOAD_SYMBOL(cuvidParseVideoData, tcuvidParseVideoData, "cuvidParseVideoData"); LOAD_SYMBOL(cuvidDestroyVideoParser, tcuvidDestroyVideoParser, "cuvidDestroyVideoParser"); diff -Nru nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_nvcuvid.h nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_nvcuvid.h --- nv-codec-headers-9.1.23.1/include/ffnvcodec/dynlink_nvcuvid.h 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/include/ffnvcodec/dynlink_nvcuvid.h 2021-08-03 16:13:31.000000000 +0000 @@ -1,7 +1,7 @@ /* * This copyright notice applies to this header file only: * - * Copyright (c) 2010-2019 NVIDIA Corporation + * Copyright (c) 2010-2021 NVIDIA Corporation * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -28,7 +28,7 @@ /********************************************************************************************************************/ //! \file nvcuvid.h //! NVDECODE API provides video decoding interface to NVIDIA GPU devices. -//! \date 2015-2019 +//! \date 2015-2020 //! This file contains the interface constants, structure definitions and function prototypes. /********************************************************************************************************************/ @@ -150,6 +150,37 @@ /****************************************************************/ //! \ingroup STRUCTS +//! \struct CUVIDOPERATINGPOINTINFO +//! Operating point information of scalable bitstream +/****************************************************************/ +typedef struct +{ + cudaVideoCodec codec; + union + { + struct + { + unsigned char operating_points_cnt; + unsigned char reserved24_bits[3]; + unsigned short operating_points_idc[32]; + } av1; + unsigned char CodecReserved[1024]; + }; +} CUVIDOPERATINGPOINTINFO; + +/****************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDAV1SEQHDR +//! AV1 specific sequence header information +/****************************************************************/ +typedef struct { + unsigned int max_width; + unsigned int max_height; + unsigned char reserved[1016]; +} CUVIDAV1SEQHDR; + +/****************************************************************/ +//! \ingroup STRUCTS //! \struct CUVIDEOFORMATEX //! Video format including raw sequence header information //! Used in cuvidGetSourceVideoFormat API @@ -157,7 +188,10 @@ typedef struct { CUVIDEOFORMAT format; /**< OUT: CUVIDEOFORMAT structure */ - unsigned char raw_seqhdr_data[1024]; /**< OUT: Sequence header data */ + union { + CUVIDAV1SEQHDR av1; + unsigned char raw_seqhdr_data[1024]; /**< OUT: Sequence header data */ + }; } CUVIDEOFORMATEX; /****************************************************************/ @@ -221,7 +255,9 @@ typedef struct _CUVIDSOURCEPARAMS { unsigned int ulClockRate; /**< IN: Time stamp units in Hz (0=default=10000000Hz) */ - unsigned int uReserved1[7]; /**< Reserved for future use - set to zero */ + unsigned int bAnnexb : 1; /**< IN: AV1 annexB stream */ + unsigned int uReserved : 31; /**< Reserved for future use - set to zero */ + unsigned int uReserved1[6]; /**< Reserved for future use - set to zero */ void *pUserData; /**< IN: User private data passed in to the data handlers */ PFNVIDSOURCECALLBACK pfnVideoDataHandler; /**< IN: Called to deliver video packets */ PFNVIDSOURCECALLBACK pfnAudioDataHandler; /**< IN: Called to deliver audio packets. */ @@ -323,14 +359,18 @@ //! is ready to be decoded and/or displayed. First argument in functions is "void *pUserData" member of structure CUVIDSOURCEPARAMS //! Return values from these callbacks are interpreted as below. If the callbacks return failure, it will be propagated by //! cuvidParseVideoData() to the application. +//! Parser picks default operating point as 0 and outputAllLayers flag as 0 if PFNVIDOPPOINTCALLBACK is not set or return value is +//! -1 or invalid operating point. //! PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by CUVIDPARSERPARAMS::ulMaxNumDecodeSurfaces //! while creating parser) //! PFNVIDDECODECALLBACK : 0: fail, >=1: succeeded //! PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded +//! PFNVIDOPPOINTCALLBACK : <0: fail, >=0: succeeded (bit 0-9: OperatingPoint, bit 10-10: outputAllLayers, bit 11-30: reserved) /***********************************************************************************************************************/ typedef int (CUDAAPI *PFNVIDSEQUENCECALLBACK)(void *, CUVIDEOFORMAT *); typedef int (CUDAAPI *PFNVIDDECODECALLBACK)(void *, CUVIDPICPARAMS *); typedef int (CUDAAPI *PFNVIDDISPLAYCALLBACK)(void *, CUVIDPARSERDISPINFO *); +typedef int (CUDAAPI *PFNVIDOPPOINTCALLBACK)(void *, CUVIDOPERATINGPOINTINFO*); /**************************************/ //! \ingroup STRUCTS @@ -346,12 +386,16 @@ IN: call pfnDecodePicture even if picture bitstream is fully corrupted) */ unsigned int ulMaxDisplayDelay; /**< IN: Max display queue delay (improves pipelining of decode with display) 0=no delay (recommended values: 2..4) */ - unsigned int uReserved1[5]; /**< IN: Reserved for future use - set to 0 */ + unsigned int bAnnexb : 1; /**< IN: AV1 annexB stream */ + unsigned int uReserved : 31; /**< Reserved for future use - set to zero */ + unsigned int uReserved1[4]; /**< IN: Reserved for future use - set to 0 */ void *pUserData; /**< IN: User data for callbacks */ PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */ PFNVIDDECODECALLBACK pfnDecodePicture; /**< IN: Called when a picture is ready to be decoded (decode order) */ PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< IN: Called whenever a picture is ready to be displayed (display order) */ - void *pvReserved2[7]; /**< Reserved for future use - set to NULL */ + PFNVIDOPPOINTCALLBACK pfnGetOperatingPoint; /**< IN: Called from AV1 sequence header to get operating point of a AV1 + scalable bitstream */ + void *pvReserved2[6]; /**< Reserved for future use - set to NULL */ CUVIDEOFORMATEX *pExtVideoInfo; /**< IN: [Optional] sequence header data from system layer */ } CUVIDPARSERPARAMS; @@ -388,5 +432,3 @@ #endif /* __cplusplus */ #endif // __NVCUVID_H__ - - diff -Nru nv-codec-headers-9.1.23.1/include/ffnvcodec/nvEncodeAPI.h nv-codec-headers-11.1.5.0/include/ffnvcodec/nvEncodeAPI.h --- nv-codec-headers-9.1.23.1/include/ffnvcodec/nvEncodeAPI.h 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/include/ffnvcodec/nvEncodeAPI.h 2021-08-03 16:13:31.000000000 +0000 @@ -1,7 +1,7 @@ /* * This copyright notice applies to this header file only: * - * Copyright (c) 2010-2019 NVIDIA Corporation + * Copyright (c) 2010-2021 NVIDIA Corporation * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -30,7 +30,7 @@ * NVIDIA GPUs - beginning with the Kepler generation - contain a hardware-based encoder * (referred to as NVENC) which provides fully-accelerated hardware-based video encoding. * NvEncodeAPI provides the interface for NVIDIA video encoder (NVENC). - * \date 2011-2019 + * \date 2011-2020 * This file contains the interface constants, structure definitions and function prototypes. */ @@ -76,6 +76,7 @@ #ifdef _WIN32 typedef RECT NVENC_RECT; #else +#define NVENCAPI // ========================================================================================= #if !defined(GUID) && !defined(GUID_DEFINED) /*! @@ -114,7 +115,7 @@ typedef void* NV_ENC_REGISTERED_PTR; /**< A Resource that has been registered with NVENCODE API*/ typedef void* NV_ENC_CUSTREAM_PTR; /**< Pointer to CUstream*/ -#define NVENCAPI_MAJOR_VERSION 9 +#define NVENCAPI_MAJOR_VERSION 11 #define NVENCAPI_MINOR_VERSION 1 #define NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24)) @@ -129,6 +130,12 @@ #define NV_MAX_SEQ_HDR_LEN (512) +#ifdef __GNUC__ +#define NV_ENC_DEPRECATED __attribute__ ((deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION"))) +#elif defined(_MSC_VER) +#define NV_ENC_DEPRECATED __declspec(deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION")) +#endif + // ========================================================================================= // Encode Codec GUIDS supported by the NvEncodeAPI interface. // ========================================================================================= @@ -171,10 +178,6 @@ static const GUID NV_ENC_H264_PROFILE_STEREO_GUID = { 0x40847bf5, 0x33f7, 0x4601, { 0x90, 0x84, 0xe8, 0xfe, 0x3c, 0x1d, 0xb8, 0xb7 } }; -// {CE788D20-AAA9-4318-92BB-AC7E858C8D36} -static const GUID NV_ENC_H264_PROFILE_SVC_TEMPORAL_SCALABILTY = -{ 0xce788d20, 0xaaa9, 0x4318, { 0x92, 0xbb, 0xac, 0x7e, 0x85, 0x8c, 0x8d, 0x36 } }; - // {B405AFAC-F32B-417B-89C4-9ABEED3E5978} static const GUID NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID = { 0xb405afac, 0xf32b, 0x417b, { 0x89, 0xc4, 0x9a, 0xbe, 0xed, 0x3e, 0x59, 0x78 } }; @@ -200,41 +203,72 @@ // * Preset GUIDS supported by the NvEncodeAPI interface. // ========================================================================================= // {B2DFB705-4EBD-4C49-9B5F-24A777D3E587} -static const GUID NV_ENC_PRESET_DEFAULT_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_DEFAULT_GUID = { 0xb2dfb705, 0x4ebd, 0x4c49, { 0x9b, 0x5f, 0x24, 0xa7, 0x77, 0xd3, 0xe5, 0x87 } }; // {60E4C59F-E846-4484-A56D-CD45BE9FDDF6} -static const GUID NV_ENC_PRESET_HP_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HP_GUID = { 0x60e4c59f, 0xe846, 0x4484, { 0xa5, 0x6d, 0xcd, 0x45, 0xbe, 0x9f, 0xdd, 0xf6 } }; // {34DBA71D-A77B-4B8F-9C3E-B6D5DA24C012} -static const GUID NV_ENC_PRESET_HQ_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HQ_GUID = { 0x34dba71d, 0xa77b, 0x4b8f, { 0x9c, 0x3e, 0xb6, 0xd5, 0xda, 0x24, 0xc0, 0x12 } }; // {82E3E450-BDBB-4e40-989C-82A90DF9EF32} -static const GUID NV_ENC_PRESET_BD_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_BD_GUID = { 0x82e3e450, 0xbdbb, 0x4e40, { 0x98, 0x9c, 0x82, 0xa9, 0xd, 0xf9, 0xef, 0x32 } }; // {49DF21C5-6DFA-4feb-9787-6ACC9EFFB726} -static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID = { 0x49df21c5, 0x6dfa, 0x4feb, { 0x97, 0x87, 0x6a, 0xcc, 0x9e, 0xff, 0xb7, 0x26 } }; // {C5F733B9-EA97-4cf9-BEC2-BF78A74FD105} -static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID = { 0xc5f733b9, 0xea97, 0x4cf9, { 0xbe, 0xc2, 0xbf, 0x78, 0xa7, 0x4f, 0xd1, 0x5 } }; // {67082A44-4BAD-48FA-98EA-93056D150A58} -static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID = { 0x67082a44, 0x4bad, 0x48fa, { 0x98, 0xea, 0x93, 0x5, 0x6d, 0x15, 0xa, 0x58 } }; // {D5BFB716-C604-44e7-9BB8-DEA5510FC3AC} -static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID = { 0xd5bfb716, 0xc604, 0x44e7, { 0x9b, 0xb8, 0xde, 0xa5, 0x51, 0xf, 0xc3, 0xac } }; // {149998E7-2364-411d-82EF-179888093409} -static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID = +NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID = { 0x149998e7, 0x2364, 0x411d, { 0x82, 0xef, 0x17, 0x98, 0x88, 0x9, 0x34, 0x9 } }; +// Performance degrades and quality improves as we move from P1 to P7. Presets P3 to P7 for H264 and Presets P2 to P7 for HEVC have B frames enabled by default +// for HIGH_QUALITY and LOSSLESS tuning info, and will not work with Weighted Prediction enabled. In case Weighted Prediction is required, disable B frames by +// setting frameIntervalP = 1 +// {FC0A8D3E-45F8-4CF8-80C7-298871590EBF} +static const GUID NV_ENC_PRESET_P1_GUID = +{ 0xfc0a8d3e, 0x45f8, 0x4cf8, { 0x80, 0xc7, 0x29, 0x88, 0x71, 0x59, 0xe, 0xbf } }; + +// {F581CFB8-88D6-4381-93F0-DF13F9C27DAB} +static const GUID NV_ENC_PRESET_P2_GUID = +{ 0xf581cfb8, 0x88d6, 0x4381, { 0x93, 0xf0, 0xdf, 0x13, 0xf9, 0xc2, 0x7d, 0xab } }; + +// {36850110-3A07-441F-94D5-3670631F91F6} +static const GUID NV_ENC_PRESET_P3_GUID = +{ 0x36850110, 0x3a07, 0x441f, { 0x94, 0xd5, 0x36, 0x70, 0x63, 0x1f, 0x91, 0xf6 } }; + +// {90A7B826-DF06-4862-B9D2-CD6D73A08681} +static const GUID NV_ENC_PRESET_P4_GUID = +{ 0x90a7b826, 0xdf06, 0x4862, { 0xb9, 0xd2, 0xcd, 0x6d, 0x73, 0xa0, 0x86, 0x81 } }; + +// {21C6E6B4-297A-4CBA-998F-B6CBDE72ADE3} +static const GUID NV_ENC_PRESET_P5_GUID = +{ 0x21c6e6b4, 0x297a, 0x4cba, { 0x99, 0x8f, 0xb6, 0xcb, 0xde, 0x72, 0xad, 0xe3 } }; + +// {8E75C279-6299-4AB6-8302-0B215A335CF5} +static const GUID NV_ENC_PRESET_P6_GUID = +{ 0x8e75c279, 0x6299, 0x4ab6, { 0x83, 0x2, 0xb, 0x21, 0x5a, 0x33, 0x5c, 0xf5 } }; + +// {84848C12-6F71-4C13-931B-53E283F57974} +static const GUID NV_ENC_PRESET_P7_GUID = +{ 0x84848c12, 0x6f71, 0x4c13, { 0x93, 0x1b, 0x53, 0xe2, 0x83, 0xf5, 0x79, 0x74 } }; + /** * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures * @{ @@ -258,12 +292,23 @@ NV_ENC_PARAMS_RC_CONSTQP = 0x0, /**< Constant QP mode */ NV_ENC_PARAMS_RC_VBR = 0x1, /**< Variable bitrate mode */ NV_ENC_PARAMS_RC_CBR = 0x2, /**< Constant bitrate mode */ - NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ = 0x8, /**< low-delay CBR, high quality */ - NV_ENC_PARAMS_RC_CBR_HQ = 0x10, /**< CBR, high quality (slower) */ - NV_ENC_PARAMS_RC_VBR_HQ = 0x20 /**< VBR, high quality (slower) */ + NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ = 0x8, /**< Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION + + lowDelayKeyFrameScale=1 */ + NV_ENC_PARAMS_RC_CBR_HQ = 0x10, /**< Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */ + NV_ENC_PARAMS_RC_VBR_HQ = 0x20 /**< Deprecated, use NV_ENC_PARAMS_RC_VBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */ } NV_ENC_PARAMS_RC_MODE; /** + * Multi Pass encoding + */ +typedef enum _NV_ENC_MULTI_PASS +{ + NV_ENC_MULTI_PASS_DISABLED = 0x0, /**< Single Pass */ + NV_ENC_TWO_PASS_QUARTER_RESOLUTION = 0x1, /**< Two Pass encoding is enabled where first Pass is quarter resolution */ + NV_ENC_TWO_PASS_FULL_RESOLUTION = 0x2, /**< Two Pass encoding is enabled where first Pass is full resolution */ +} NV_ENC_MULTI_PASS; + +/** * Emphasis Levels */ typedef enum _NV_ENC_EMPHASIS_MAP_LEVEL @@ -282,7 +327,7 @@ typedef enum _NV_ENC_QP_MAP_MODE { NV_ENC_QP_MAP_DISABLED = 0x0, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap have no effect. */ - NV_ENC_QP_MAP_EMPHASIS = 0x1, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as Empasis level. Currently this is only supported for H264 */ + NV_ENC_QP_MAP_EMPHASIS = 0x1, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as Emphasis level. Currently this is only supported for H264 */ NV_ENC_QP_MAP_DELTA = 0x2, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP delta map. */ NV_ENC_QP_MAP = 0x3, /**< Currently This is not supported. Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP value. */ } NV_ENC_QP_MAP_MODE; @@ -324,10 +369,10 @@ */ typedef enum _NV_ENC_MV_PRECISION { - NV_ENC_MV_PRECISION_DEFAULT = 0x0, /** (if lookahead is enabled, input frames must remain available to the encoder until encode completion) */ @@ -1232,17 +1295,23 @@ uint32_t zeroReorderDelay :1; /**< [in]: Set this to 1 to indicate zero latency operation (no reordering delay, num_reorder_frames=0) */ uint32_t enableNonRefP :1; /**< [in]: Set this to 1 to enable automatic insertion of non-reference P-frames (no effect if enablePTD=0) */ uint32_t strictGOPTarget :1; /**< [in]: Set this to 1 to minimize GOP-to-GOP rate fluctuations */ - uint32_t aqStrength :4; /**< [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive). If not set, strength is autoselected by driver. */ + uint32_t aqStrength :4; /**< [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive). + If not set, strength is auto selected by driver. */ uint32_t reservedBitFields :16; /**< [in]: Reserved bitfields and must be set to 0 */ NV_ENC_QP minQP; /**< [in]: Specifies the minimum QP used for rate control. Client must set NV_ENC_CONFIG::enableMinQP to 1. */ NV_ENC_QP maxQP; /**< [in]: Specifies the maximum QP used for rate control. Client must set NV_ENC_CONFIG::enableMaxQP to 1. */ NV_ENC_QP initialRCQP; /**< [in]: Specifies the initial QP used for rate control. Client must set NV_ENC_CONFIG::enableInitialRCQP to 1. */ - uint32_t temporallayerIdxMask; /**< [in]: Specifies the temporal layers (as a bitmask) whose QPs have changed. Valid max bitmask is [2^NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS - 1] */ - uint8_t temporalLayerQP[8]; /**< [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as as the array index */ + uint32_t temporallayerIdxMask; /**< [in]: Specifies the temporal layers (as a bitmask) whose QPs have changed. Valid max bitmask is [2^NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS - 1]. + Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */ + uint8_t temporalLayerQP[8]; /**< [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as the array index. + Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */ uint8_t targetQuality; /**< [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */ uint8_t targetQualityLSB; /**< [in]: Fractional part of target quality (as 8.8 fixed point format) */ - uint16_t lookaheadDepth; /**< [in]: Maximum depth of lookahead with range 0-32 (only used if enableLookahead=1) */ - uint32_t reserved1; + uint16_t lookaheadDepth; /**< [in]: Maximum depth of lookahead with range 0-(31 - number of B frames). + lookaheadDepth is only used if enableLookahead=1.*/ + uint8_t lowDelayKeyFrameScale; /**< [in]: Specifies the ratio of I frame bits to P frame bits in case of single frame VBV and CBR rate control mode, + is set to 2 by default for low latency tuning info and 1 by default for ultra low latency tuning info */ + uint8_t reserved1[3]; NV_ENC_QP_MAP_MODE qpMapMode; /**< [in]: This flag is used to interpret values in array specified by NV_ENC_PIC_PARAMS::qpDeltaMap. Set this to NV_ENC_QP_MAP_EMPHASIS to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as Emphasis Level Map. Emphasis Level can be assigned any value specified in enum NV_ENC_EMPHASIS_MAP_LEVEL. @@ -1255,12 +1324,18 @@ This feature is not supported when AQ( Spatial/Temporal) is enabled. This feature is only supported for H264 codec currently. - Set this to NV_ENC_QP_MAP_DELTA to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as QPDelta. This specifies QP modifier to be applied on top of the QP chosen by rate control + Set this to NV_ENC_QP_MAP_DELTA to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as QP Delta. This specifies QP modifier to be applied on top of the QP chosen by rate control Set this to NV_ENC_QP_MAP_DISABLED to ignore NV_ENC_PIC_PARAMS::qpDeltaMap values. In this case, qpDeltaMap should be set to NULL. Other values are reserved for future use.*/ - uint32_t reserved[7]; + NV_ENC_MULTI_PASS multiPass; /**< [in]: This flag is used to enable multi-pass encoding for a given ::NV_ENC_PARAMS_RC_MODE. This flag is not valid for H264 and HEVC MEOnly mode */ + uint32_t alphaLayerBitrateRatio; /**< [in]: Specifies the ratio in which bitrate should be split between base and alpha layer. A value 'x' for this field will split the target bitrate in a ratio of x : 1 between base and alpha layer. + The default split ratio is 15.*/ + int8_t cbQPIndexOffset; /**< [in]: Specifies the value of 'chroma_qp_index_offset' in H264 / 'pps_cb_qp_offset' in HEVC.*/ + int8_t crQPIndexOffset; /**< [in]: Specifies the value of 'second_chroma_qp_index_offset' in H264 / 'pps_cr_qp_offset' in HEVC.*/ + uint16_t reserved2; + uint32_t reserved[4]; } NV_ENC_RC_PARAMS; /** macro for constructing the version field of ::_NV_ENC_RC_PARAMS */ @@ -1299,10 +1374,10 @@ */ typedef struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE { - uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Supported for H264,HEVC.It Specifies the number of candidates per 16x16 block. */ - uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Supported for H264 only.Specifies the number of candidates per 16x8 block. */ - uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Supported for H264 only.Specifies the number of candidates per 8x16 block. */ - uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Supported for H264,HEVC.Specifies the number of candidates per 8x8 block. */ + uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Supported for H264, HEVC. It Specifies the number of candidates per 16x16 block. */ + uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 16x8 block. */ + uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 8x16 block. */ + uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Supported for H264, HEVC. Specifies the number of candidates per 8x8 block. */ uint32_t reserved : 16; /**< [in]: Reserved for padding. */ uint32_t reserved1[3]; /**< [in]: Reserved for future use. */ } NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE; @@ -1310,7 +1385,7 @@ /** * \struct _NVENC_EXTERNAL_ME_HINT - * External Motion Vector hint structure. + * External Motion Vector hint structure for H264 and HEVC. */ typedef struct _NVENC_EXTERNAL_ME_HINT { @@ -1330,22 +1405,24 @@ */ typedef struct _NV_ENC_CONFIG_H264 { - uint32_t reserved :1; /**< [in]: Reserved and must be set to 0 */ + uint32_t enableTemporalSVC :1; /**< [in]: Set to 1 to enable SVC temporal*/ uint32_t enableStereoMVC :1; /**< [in]: Set to 1 to enable stereo MVC*/ - uint32_t hierarchicalPFrames :1; /**< [in]: Set to 1 to enable hierarchical PFrames */ - uint32_t hierarchicalBFrames :1; /**< [in]: Set to 1 to enable hierarchical BFrames */ + uint32_t hierarchicalPFrames :1; /**< [in]: Set to 1 to enable hierarchical P Frames */ + uint32_t hierarchicalBFrames :1; /**< [in]: Set to 1 to enable hierarchical B Frames */ uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set to 1 to write SEI buffering period syntax in the bitstream */ uint32_t outputPictureTimingSEI :1; /**< [in]: Set to 1 to write SEI picture timing syntax in the bitstream. When set for following rateControlMode : NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ, - NV_ENC_PARAMS_RC_CBR_HQ, filler data is inserted if needed to achieve hrd bitrate */ + NV_ENC_PARAMS_RC_CBR_HQ, filler data is inserted if needed to achieve HRD bitrate */ uint32_t outputAUD :1; /**< [in]: Set to 1 to write access unit delimiter syntax in bitstream */ uint32_t disableSPSPPS :1; /**< [in]: Set to 1 to disable writing of Sequence and Picture parameter info in bitstream */ uint32_t outputFramePackingSEI :1; /**< [in]: Set to 1 to enable writing of frame packing arrangement SEI messages to bitstream */ uint32_t outputRecoveryPointSEI :1; /**< [in]: Set to 1 to enable writing of recovery point SEI message */ uint32_t enableIntraRefresh :1; /**< [in]: Set to 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */ - uint32_t enableConstrainedEncoding :1; /**< [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constarined picture is independent of other slices + uint32_t enableConstrainedEncoding :1; /**< [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices. + Constrained encoding works only with rectangular slices. Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */ uint32_t repeatSPSPPS :1; /**< [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */ - uint32_t enableVFR :1; /**< [in]: Set to 1 to enable variable frame rate. */ + uint32_t enableVFR :1; /**< [in]: Setting enableVFR=1 currently only sets the fixed_frame_rate_flag=0 in the VUI but otherwise + has no impact on the encoder behavior. For more details please refer to E.1 VUI syntax of H.264 standard. Note, however, that NVENC does not support VFR encoding and rate control. */ uint32_t enableLTR :1; /**< [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode. LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1. Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future. @@ -1366,23 +1443,34 @@ NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set is currently not supported and will make ::NvEncInitializeEncoder() return an error. */ - uint32_t reservedBitFields :14; /**< [in]: Reserved bitfields and must be set to 0 */ + uint32_t disableSVCPrefixNalu :1; /**< [in]: Set to 1 to disable writing of SVC Prefix NALU preceding each slice in bitstream. + Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */ + uint32_t enableScalabilityInfoSEI :1; /**< [in]: Set to 1 to enable writing of Scalability Information SEI message preceding each IDR picture in bitstream + Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */ + uint32_t singleSliceIntraRefresh : 1; /**< [in]: Set to 1 to maintain single slice in frames during intra refresh. + Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps. + This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */ + uint32_t reservedBitFields : 11; /**< [in]: Reserved bitfields and must be set to 0 */ uint32_t level; /**< [in]: Specifies the encoding level. Client is recommended to set this to NV_ENC_LEVEL_AUTOSELECT in order to enable the NvEncodeAPI interface to select the correct level. */ uint32_t idrPeriod; /**< [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG.Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */ uint32_t separateColourPlaneFlag; /**< [in]: Set to 1 to enable 4:4:4 separate colour planes */ - uint32_t disableDeblockingFilterIDC; /**< [in]: Specifies the deblocking filter mode. Permissible value range: [0,2] */ - uint32_t numTemporalLayers; /**< [in]: Specifies max temporal layers to be used for hierarchical coding. Valid value range is [1,::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS] */ + uint32_t disableDeblockingFilterIDC; /**< [in]: Specifies the deblocking filter mode. Permissible value range: [0,2]. This flag corresponds + to the flag disable_deblocking_filter_idc specified in section 7.4.3 of H.264 specification, + which specifies whether the operation of the deblocking filter shall be disabled across some + block edges of the slice and specifies for which edges the filtering is disabled. See section + 7.4.3 of H.264 specification for more details.*/ + uint32_t numTemporalLayers; /**< [in]: Specifies number of temporal layers to be used for hierarchical coding / temporal SVC. Valid value range is [1,::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS] */ uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */ uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */ NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE adaptiveTransformMode; /**< [in]: Specifies the AdaptiveTransform Mode. Check support for AdaptiveTransform mode using ::NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM caps. */ NV_ENC_H264_FMO_MODE fmoMode; /**< [in]: Specified the FMO Mode. Check support for FMO using ::NV_ENC_CAPS_SUPPORT_FMO caps. */ NV_ENC_H264_BDIRECT_MODE bdirectMode; /**< [in]: Specifies the BDirect mode. Check support for BDirect mode using ::NV_ENC_CAPS_SUPPORT_BDIRECT_MODE caps.*/ NV_ENC_H264_ENTROPY_CODING_MODE entropyCodingMode; /**< [in]: Specifies the entropy coding mode. Check support for CABAC mode using ::NV_ENC_CAPS_SUPPORT_CABAC caps. */ - NV_ENC_STEREO_PACKING_MODE stereoMode; /**< [in]: Specifies the stereo frame packing mode which is to be signalled in frame packing arrangement SEI */ + NV_ENC_STEREO_PACKING_MODE stereoMode; /**< [in]: Specifies the stereo frame packing mode which is to be signaled in frame packing arrangement SEI */ uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set. Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */ uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */ - uint32_t maxNumRefFrames; /**< [in]: Specifies the DPB size used for encoding. Setting it to 0 will let driver use the default dpb size. + uint32_t maxNumRefFrames; /**< [in]: Specifies the DPB size used for encoding. Setting it to 0 will let driver use the default DPB size. The low latency application which wants to invalidate reference frame as an error resilience tool is recommended to use a large DPB size so that the encoder can keep old reference frames which can be used if recent frames are invalidated. */ @@ -1395,7 +1483,7 @@ sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice) sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ - NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters; /**< [in]: Specifies the H264 video usability info pamameters */ + NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters; /**< [in]: Specifies the H264 video usability info parameters */ uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames. This parameter has different meaning in two LTR modes. In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR. In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */ @@ -1405,7 +1493,9 @@ Set to 0 when using "LTR Per Picture" mode of LTR operation. */ uint32_t chromaFormatIDC; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input. Check support for YUV444 encoding using ::NV_ENC_CAPS_SUPPORT_YUV444_ENCODE caps.*/ - uint32_t maxTemporalLayers; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */ + uint32_t maxTemporalLayers; /**< [in]: Specifies the maximum temporal layer used for temporal SVC / hierarchical coding. + Defaut value of this field is NV_ENC_CAPS::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS. Note that the value NV_ENC_CONFIG_H264::maxNumRefFrames should + be greater than or equal to (NV_ENC_CONFIG_H264::maxTemporalLayers - 2) * 2, for NV_ENC_CONFIG_H264::maxTemporalLayers >= 2.*/ NV_ENC_BFRAME_REF_MODE useBFramesAsRef; /**< [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/ NV_ENC_NUM_REF_FRAMES numRefL0; /**< [in]: Specifies max number of reference frames in reference picture list L0, that can be used by hardware for prediction of a frame. Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */ @@ -1437,7 +1527,7 @@ ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode for using LTR. Note that LTRs are not supported if encoding session is configured with B-frames */ - uint32_t disableSPSPPS :1; /**< [in]: Set 1 to disable VPS,SPS and PPS signalling in the bitstream. */ + uint32_t disableSPSPPS :1; /**< [in]: Set 1 to disable VPS, SPS and PPS signaling in the bitstream. */ uint32_t repeatSPSPPS :1; /**< [in]: Set 1 to output VPS,SPS and PPS for every IDR frame.*/ uint32_t enableIntraRefresh :1; /**< [in]: Set 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */ uint32_t chromaFormatIDC :2; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.*/ @@ -1452,8 +1542,15 @@ NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set is currently not supported and will make ::NvEncInitializeEncoder() return an error. */ - uint32_t reserved :17; /**< [in]: Reserved bitfields.*/ - uint32_t idrPeriod; /**< [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG.Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */ + uint32_t enableConstrainedEncoding :1; /**< [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices. + Constrained encoding works only with rectangular slices. + Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */ + uint32_t enableAlphaLayerEncoding :1; /**< [in]: Set this to 1 to enable HEVC encode with alpha layer. */ + uint32_t singleSliceIntraRefresh : 1; /**< [in]: Set this to 1 to maintain single slice frames during intra refresh. + Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps. + This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */ + uint32_t reserved : 14; /**< [in]: Reserved bitfields.*/ + uint32_t idrPeriod; /**< [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG. Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */ uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set. Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */ uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */ @@ -1473,7 +1570,7 @@ sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */ - NV_ENC_CONFIG_HEVC_VUI_PARAMETERS hevcVUIParameters; /**< [in]: Specifies the HEVC video usability info pamameters */ + NV_ENC_CONFIG_HEVC_VUI_PARAMETERS hevcVUIParameters; /**< [in]: Specifies the HEVC video usability info parameters */ uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_HEVC::enableLTR for description of the two modes. Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may be deprecated in future releases. @@ -1494,11 +1591,11 @@ */ typedef struct _NV_ENC_CONFIG_H264_MEONLY { - uint32_t disablePartition16x16 :1; /**< [in]: Disable MotionEstimation on 16x16 blocks*/ - uint32_t disablePartition8x16 :1; /**< [in]: Disable MotionEstimation on 8x16 blocks*/ - uint32_t disablePartition16x8 :1; /**< [in]: Disable MotionEstimation on 16x8 blocks*/ - uint32_t disablePartition8x8 :1; /**< [in]: Disable MotionEstimation on 8x8 blocks*/ - uint32_t disableIntraSearch :1; /**< [in]: Disable Intra search during MotionEstimation*/ + uint32_t disablePartition16x16 :1; /**< [in]: Disable Motion Estimation on 16x16 blocks*/ + uint32_t disablePartition8x16 :1; /**< [in]: Disable Motion Estimation on 8x16 blocks*/ + uint32_t disablePartition16x8 :1; /**< [in]: Disable Motion Estimation on 16x8 blocks*/ + uint32_t disablePartition8x8 :1; /**< [in]: Disable Motion Estimation on 8x8 blocks*/ + uint32_t disableIntraSearch :1; /**< [in]: Disable Intra search during Motion Estimation*/ uint32_t bStereoEnable :1; /**< [in]: Enable Stereo Mode for Motion Estimation where each view is independently executed*/ uint32_t reserved :26; /**< [in]: Reserved and must be set to 0 */ uint32_t reserved1 [255]; /**< [in]: Reserved and must be set to 0 */ @@ -1538,7 +1635,7 @@ typedef struct _NV_ENC_CONFIG { uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CONFIG_VER. */ - GUID profileGUID; /**< [in]: Specifies the codec profile guid. If client specifies \p NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID the NvEncodeAPI interface will select the appropriate codec profile. */ + GUID profileGUID; /**< [in]: Specifies the codec profile GUID. If client specifies \p NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID the NvEncodeAPI interface will select the appropriate codec profile. */ uint32_t gopLength; /**< [in]: Specifies the number of pictures in one GOP. Low latency application client can set goplength to NVENC_INFINITE_GOPLENGTH so that keyframes are not inserted automatically. */ int32_t frameIntervalP; /**< [in]: Specifies the GOP pattern as follows: \p frameIntervalP = 0: I, 1: IPP, 2: IBP, 3: IBBP If goplength is set to NVENC_INFINITE_GOPLENGTH \p frameIntervalP should be set to 1. */ uint32_t monoChromeEncoding; /**< [in]: Set this to 1 to enable monochrome encoding for this session. */ @@ -1553,8 +1650,20 @@ } NV_ENC_CONFIG; /** macro for constructing the version field of ::_NV_ENC_CONFIG */ -#define NV_ENC_CONFIG_VER (NVENCAPI_STRUCT_VERSION(7) | ( 1<<31 )) +#define NV_ENC_CONFIG_VER (NVENCAPI_STRUCT_VERSION(7) | ( 1u<<31 )) +/** + * Tuning information of NVENC encoding (TuningInfo is not applicable to H264 and HEVC MEOnly mode). + */ +typedef enum NV_ENC_TUNING_INFO +{ + NV_ENC_TUNING_INFO_UNDEFINED = 0, /**< Undefined tuningInfo. Invalid value for encoding. */ + NV_ENC_TUNING_INFO_HIGH_QUALITY = 1, /**< Tune presets for latency tolerant encoding.*/ + NV_ENC_TUNING_INFO_LOW_LATENCY = 2, /**< Tune presets for low latency streaming.*/ + NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY = 3, /**< Tune presets for ultra low latency streaming.*/ + NV_ENC_TUNING_INFO_LOSSLESS = 4, /**< Tune presets for lossless encoding.*/ + NV_ENC_TUNING_INFO_COUNT /**< Count number of tuningInfos. Invalid value. */ +}NV_ENC_TUNING_INFO; /** * \struct _NV_ENC_INITIALIZE_PARAMS @@ -1574,11 +1683,15 @@ uint32_t enableEncodeAsync; /**< [in]: Set this to 1 to enable asynchronous mode and is expected to use events to get picture completion notification. */ uint32_t enablePTD; /**< [in]: Set this to 1 to enable the Picture Type Decision is be taken by the NvEncodeAPI interface. */ uint32_t reportSliceOffsets :1; /**< [in]: Set this to 1 to enable reporting slice offsets in ::_NV_ENC_LOCK_BITSTREAM. NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync must be set to 0 to use this feature. Client must set this to 0 if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs */ - uint32_t enableSubFrameWrite :1; /**< [in]: Set this to 1 to write out available bitstream to memory at subframe intervals */ + uint32_t enableSubFrameWrite :1; /**< [in]: Set this to 1 to write out available bitstream to memory at subframe intervals. + If enableSubFrameWrite = 1, then the hardware encoder returns data as soon as a slice has completed encoding. + This results in better encoding latency, but the downside is that the application has to keep polling via a call to nvEncLockBitstream API continuously to see if any encoded slice data is available. + Use this mode if you feel that the marginal reduction in latency from sub-frame encoding is worth the increase in complexity due to CPU-based polling. */ uint32_t enableExternalMEHints :1; /**< [in]: Set to 1 to enable external ME hints for the current frame. For NV_ENC_INITIALIZE_PARAMS::enablePTD=1 with B frames, programming L1 hints is optional for B frames since Client doesn't know internal GOP structure. NV_ENC_PIC_PARAMS::meHintRefPicDist should preferably be set with enablePTD=1. */ uint32_t enableMEOnlyMode :1; /**< [in]: Set to 1 to enable ME Only Mode .*/ - uint32_t enableWeightedPrediction :1; /**< [in]: Set this to 1 to enable weighted prediction. Not supported if encode session is configured for B-Frames( 'frameIntervalP' in NV_ENC_CONFIG is greater than 1).*/ + uint32_t enableWeightedPrediction :1; /**< [in]: Set this to 1 to enable weighted prediction. Not supported if encode session is configured for B-Frames (i.e. NV_ENC_CONFIG::frameIntervalP > 1 or preset >=P3 when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or + tuningInfo = ::NV_ENC_TUNING_INFO_LOSSLESS. This is because preset >=p3 internally enables B frames when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or ::NV_ENC_TUNING_INFO_LOSSLESS). */ uint32_t enableOutputInVidmem :1; /**< [in]: Set this to 1 to enable output of NVENC in video memory buffer created by application. This feature is not supported for HEVC ME only mode. */ uint32_t reservedBitFields :26; /**< [in]: Reserved bitfields and must be set to 0 */ uint32_t privDataSize; /**< [in]: Reserved private data buffer size and must be set to 0 */ @@ -1593,12 +1706,14 @@ NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE maxMEHintCountsPerBlock[2]; /**< [in]: If Client wants to pass external motion vectors in NV_ENC_PIC_PARAMS::meExternalHints buffer it must specify the maximum number of hint candidates per block per direction for the encode session. The NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[0] is for L0 predictors and NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[1] is for L1 predictors. This client must also set NV_ENC_INITIALIZE_PARAMS::enableExternalMEHints to 1. */ - uint32_t reserved [289]; /**< [in]: Reserved and must be set to 0 */ + NV_ENC_TUNING_INFO tuningInfo; /**< [in]: Tuning Info of NVENC encoding(TuningInfo is not applicable to H264 and HEVC meonly mode). */ + NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Specifies input buffer format. Client should set input buffer format only when D3D12 interface type is used. */ + uint32_t reserved[287]; /**< [in]: Reserved and must be set to 0 */ void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_INITIALIZE_PARAMS; /** macro for constructing the version field of ::_NV_ENC_INITIALIZE_PARAMS */ -#define NV_ENC_INITIALIZE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(5) | ( 1<<31 )) +#define NV_ENC_INITIALIZE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(5) | ( 1u<<31 )) /** @@ -1632,7 +1747,7 @@ }NV_ENC_RECONFIGURE_PARAMS; /** macro for constructing the version field of ::_NV_ENC_RECONFIGURE_PARAMS */ -#define NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1<<31 )) +#define NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1u<<31 )) /** * \struct _NV_ENC_PRESET_CONFIG @@ -1647,7 +1762,7 @@ }NV_ENC_PRESET_CONFIG; /** macro for constructing the version field of ::_NV_ENC_PRESET_CONFIG */ -#define NV_ENC_PRESET_CONFIG_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) +#define NV_ENC_PRESET_CONFIG_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1u<<31 )) /** @@ -1725,9 +1840,9 @@ sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term referenceframe index to use for marking this frame as LTR.*/ - uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the the associated bitmap of LTR frame indices to use when encoding this frame. */ + uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */ uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */ - uint32_t forceIntraSliceCount; /**< [in]: Specfies the number of slices to be forced to Intra in the current picture. + uint32_t forceIntraSliceCount; /**< [in]: Specifies the number of slices to be forced to Intra in the current picture. This option along with forceIntraSliceIdx[] array needs to be used with sliceMode = 3 only */ uint32_t *forceIntraSliceIdx; /**< [in]: Slice indices to be forced to intra in the current picture. Each slice index should be <= num_slices_in_picture -1. Index starts from 0 for first slice. The number of entries in this array should be equal to forceIntraSliceCount */ @@ -1796,12 +1911,14 @@ typedef struct _NV_ENC_PIC_PARAMS { uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_VER. */ - uint32_t inputWidth; /**< [in]: Specifies the input buffer width */ - uint32_t inputHeight; /**< [in]: Specifies the input buffer height */ + uint32_t inputWidth; /**< [in]: Specifies the input frame width */ + uint32_t inputHeight; /**< [in]: Specifies the input frame height */ uint32_t inputPitch; /**< [in]: Specifies the input buffer pitch. If pitch value is not known, set this to inputWidth. */ - uint32_t encodePicFlags; /**< [in]: Specifies bit-wise OR`ed encode pic flags. See ::NV_ENC_PIC_FLAGS enum. */ + uint32_t encodePicFlags; /**< [in]: Specifies bit-wise OR of encode picture flags. See ::NV_ENC_PIC_FLAGS enum. */ uint32_t frameIdx; /**< [in]: Specifies the frame index associated with the input frame [optional]. */ - uint64_t inputTimeStamp; /**< [in]: Specifies presentation timestamp associated with the input picture. */ + uint64_t inputTimeStamp; /**< [in]: Specifies opaque data which is associated with the encoded frame, but not actually encoded in the output bitstream. + This opaque data can be used later to uniquely refer to the corresponding encoded frame. For example, it can be used + for identifying the frame to be invalidated in the reference picture buffer, if lost at the client. */ uint64_t inputDuration; /**< [in]: Specifies duration of the input picture */ NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.*/ NV_ENC_OUTPUT_PTR outputBitstream; /**< [in]: Specifies the output buffer pointer. @@ -1812,33 +1929,35 @@ NV_ENC_ENCODE_OUT_PARAMS struct and twice the input frame size for lower resolution eg. CIF and 1.5 times the input frame size for higher resolutions. If encoded bitstream size is greater than the allocated buffer size for encoded bitstream, then the output buffer will have encoded bitstream data equal to buffer size. All CUDA operations on this buffer must use the default stream. */ - void* completionEvent; /**< [in]: Specifies an event to be signalled on completion of encoding of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */ + void* completionEvent; /**< [in]: Specifies an event to be signaled on completion of encoding of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */ NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */ NV_ENC_PIC_STRUCT pictureStruct; /**< [in]: Specifies structure of the input picture. */ NV_ENC_PIC_TYPE pictureType; /**< [in]: Specifies input picture type. Client required to be set explicitly by the client if the client has not set NV_ENC_INITALIZE_PARAMS::enablePTD to 1 while calling NvInitializeEncoder. */ NV_ENC_CODEC_PIC_PARAMS codecPicParams; /**< [in]: Specifies the codec specific per-picture encoding parameters. */ - NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block per direction for the current frame. meHintCountsPerBlock[0] is for L0 predictors and meHintCountsPerBlock[1] is for L1 predictors. - The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder intialization. */ - NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. + NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock[2]; /**< [in]: For H264 and Hevc, specifies the number of hint candidates per block per direction for the current frame. meHintCountsPerBlock[0] is for L0 predictors and meHintCountsPerBlock[1] is for L1 predictors. + The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */ + NVENC_EXTERNAL_ME_HINT* meExternalHints; /**< [in]: For H264 and Hevc, Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ uint32_t reserved1[6]; /**< [in]: Reserved and must be set to 0 */ void* reserved2[2]; /**< [in]: Reserved and must be set to NULL */ - int8_t *qpDeltaMap; /**< [in]: Specifies the pointer to signed byte array containing value per MB in raster scan order for the current picture, which will be interpreted depending on NV_ENC_RC_PARAMS::qpMapMode. - If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DELTA, qpDeltaMap specifies QP modifier per MB. This QP modifier will be applied on top of the QP chosen by rate control. - If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_EMPHASIS, qpDeltaMap specifies Emphasis Level Map per MB. This level value along with QP chosen by rate control is used to + int8_t *qpDeltaMap; /**< [in]: Specifies the pointer to signed byte array containing value per MB for H264 and per CTB for HEVC in raster scan order for the current picture, which will be interpreted depending on NV_ENC_RC_PARAMS::qpMapMode. + If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DELTA, qpDeltaMap specifies QP modifier per MB for H264 and per CTB for HEVC. This QP modifier will be applied on top of the QP chosen by rate control. + If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_EMPHASIS, qpDeltaMap specifies Emphasis Level Map per MB for H264. This level value along with QP chosen by rate control is used to compute the QP modifier, which in turn is applied on top of QP chosen by rate control. If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DISABLED, value in qpDeltaMap will be ignored.*/ - uint32_t qpDeltaMapSize; /**< [in]: Specifies the size in bytes of qpDeltaMap surface allocated by client and pointed to by NV_ENC_PIC_PARAMS::qpDeltaMap. Surface (array) should be picWidthInMbs * picHeightInMbs */ + uint32_t qpDeltaMapSize; /**< [in]: Specifies the size in bytes of qpDeltaMap surface allocated by client and pointed to by NV_ENC_PIC_PARAMS::qpDeltaMap. Surface (array) should be picWidthInMbs * picHeightInMbs for H264 and picWidthInCtbs * picHeightInCtbs for HEVC */ uint32_t reservedBitFields; /**< [in]: Reserved bitfields and must be set to 0 */ uint16_t meHintRefPicDist[2]; /**< [in]: Specifies temporal distance for reference picture (NVENC_EXTERNAL_ME_HINT::refidx = 0) used during external ME with NV_ENC_INITALIZE_PARAMS::enablePTD = 1 . meHintRefPicDist[0] is for L0 hints and meHintRefPicDist[1] is for L1 hints. If not set, will internally infer distance of 1. Ignored for NV_ENC_INITALIZE_PARAMS::enablePTD = 0 */ + NV_ENC_INPUT_PTR alphaBuffer; /**< [in]: Specifies the input alpha buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs. + Applicable only when encoding hevc with alpha layer is enabled. */ uint32_t reserved3[286]; /**< [in]: Reserved and must be set to 0 */ - void* reserved4[60]; /**< [in]: Reserved and must be set to NULL */ + void* reserved4[59]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_PIC_PARAMS; /** Macro for constructing the version field of ::_NV_ENC_PIC_PARAMS */ -#define NV_ENC_PIC_PARAMS_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) +#define NV_ENC_PIC_PARAMS_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1u<<31 )) /** @@ -1849,8 +1968,8 @@ typedef struct _NV_ENC_MEONLY_PARAMS { uint32_t version; /**< [in]: Struct version. Must be set to NV_ENC_MEONLY_PARAMS_VER.*/ - uint32_t inputWidth; /**< [in]: Specifies the input buffer width */ - uint32_t inputHeight; /**< [in]: Specifies the input buffer height */ + uint32_t inputWidth; /**< [in]: Specifies the input frame width */ + uint32_t inputHeight; /**< [in]: Specifies the input frame height */ NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from NvEncCreateInputBuffer() or NvEncMapInputResource() APIs. */ NV_ENC_INPUT_PTR referenceFrame; /**< [in]: Specifies the reference frame pointer */ NV_ENC_OUTPUT_PTR mvBuffer; /**< [in]: Specifies the output buffer pointer. @@ -1860,14 +1979,14 @@ be equal to total number of macroblocks multiplied by size of NV_ENC_H264_MV_DATA struct. Client should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this output buffer and assign it to NV_ENC_MEONLY_PARAMS::mvBuffer. All CUDA operations on this buffer must use the default stream. */ NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */ - void* completionEvent; /**< [in]: Specifies an event to be signalled on completion of motion estimation + void* completionEvent; /**< [in]: Specifies an event to be signaled on completion of motion estimation of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */ - uint32_t viewID; /**< [in]: Specifies left,right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set. + uint32_t viewID; /**< [in]: Specifies left or right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set. viewID can be 0,1 if bStereoEnable is set, 0 otherwise. */ NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block for the current frame. meHintCountsPerBlock[0] is for L0 predictors. - The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder intialization. */ + The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */ NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ @@ -1891,11 +2010,12 @@ uint32_t getRCStats :1; /**< [in]: If this flag is set then lockBitstream call will add additional intra-inter MB count and average MVX, MVY */ uint32_t reservedBitFields :29; /**< [in]: Reserved bit fields and must be set to 0 */ void* outputBitstream; /**< [in]: Pointer to the bitstream buffer being locked. */ - uint32_t* sliceOffsets; /**< [in,out]: Array which receives the slice offsets. This is not supported if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs. Array size must be equal to size of frame in MBs. */ + uint32_t* sliceOffsets; /**< [in, out]: Array which receives the slice offsets. This is not supported if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs. Array size must be equal to size of frame in MBs. */ uint32_t frameIdx; /**< [out]: Frame no. for which the bitstream is being retrieved. */ uint32_t hwEncodeStatus; /**< [out]: The NvEncodeAPI interface status for the locked picture. */ uint32_t numSlices; /**< [out]: Number of slices in the encoded picture. Will be reported only if NV_ENC_INITIALIZE_PARAMS::reportSliceOffsets set to 1. */ - uint32_t bitstreamSizeInBytes; /**< [out]: Actual number of bytes generated and copied to the memory pointed by bitstreamBufferPtr. */ + uint32_t bitstreamSizeInBytes; /**< [out]: Actual number of bytes generated and copied to the memory pointed by bitstreamBufferPtr. + When HEVC alpha layer encoding is enabled, this field reports the total encoded size in bytes i.e it is the encoded size of the base plus the alpha layer. */ uint64_t outputTimeStamp; /**< [out]: Presentation timestamp associated with the encoded output. */ uint64_t outputDuration; /**< [out]: Presentation duration associates with the encoded output. */ void* bitstreamBufferPtr; /**< [out]: Pointer to the generated output bitstream. @@ -1907,12 +2027,15 @@ uint32_t frameSatd; /**< [out]: Total SATD cost for whole frame. */ uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */ uint32_t ltrFrameBitmap; /**< [out]: Bitmap of LTR frames indices which were used for encoding this frame. Value of 0 if no LTR frames were used. */ - uint32_t reserved[13]; /**< [in]: Reserved and must be set to 0 */ + uint32_t temporalId; /**< [out]: TemporalId value of the frame when using temporalSVC encoding */ + uint32_t reserved[12]; /**< [in]: Reserved and must be set to 0 */ uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ uint32_t interMBCount; /**< [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ int32_t averageMVX; /**< [out]: Average Motion Vector in X direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ int32_t averageMVY; /**< [out]: Average Motion Vector in y direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ - uint32_t reserved1[219]; /**< [in]: Reserved and must be set to 0 */ + uint32_t alphaLayerSizeInBytes; /**< [out]: Number of bytes generated for the alpha layer in the encoded output. Applicable only when HEVC with alpha encoding is enabled. */ + + uint32_t reserved1[218]; /**< [in]: Reserved and must be set to 0 */ void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_LOCK_BITSTREAM; @@ -1970,6 +2093,45 @@ uint32_t target; /**< [in]: Accepted values are GL_TEXTURE_RECTANGLE and GL_TEXTURE_2D. */ } NV_ENC_INPUT_RESOURCE_OPENGL_TEX; +/** \struct NV_ENC_FENCE_POINT_D3D12 + * Fence and fence value for synchronization. + */ +typedef struct _NV_ENC_FENCE_POINT_D3D12 +{ + void* pFence; /**< [in]: Pointer to ID3D12Fence. This fence object is used for synchronization. */ + uint64_t value; /**< [in]: Fence value to reach or exceed before the GPU operation or + fence value to set the fence to, after the GPU operation. */ +} NV_ENC_FENCE_POINT_D3D12; + +/** + * \struct _NV_ENC_INPUT_RESOURCE_D3D12 + * NV_ENC_PIC_PARAMS::inputBuffer and NV_ENC_PIC_PARAMS::alphaBuffer must be a pointer to a struct of this type, + * when D3D12 interface is used + */ +typedef struct _NV_ENC_INPUT_RESOURCE_D3D12 +{ + NV_ENC_REGISTERED_PTR pInputBuffer; /**< [in]: Specifies the input surface pointer. Client must use a pointer obtained from NvEncRegisterResource() in NV_ENC_REGISTER_RESOURCE::registeredResource + when registering input surface. */ + NV_ENC_FENCE_POINT_D3D12 inputFencePoint; /**< [in]: Specifies the input fence and corresponding fence value to do GPU wait. + This fence will be used to do GPU wait until the specified fence reaches or exceeds the specified value. */ + uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */ + void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */ +} NV_ENC_INPUT_RESOURCE_D3D12; + +/** + * \struct _NV_ENC_OUTPUT_RESOURCE_D3D12 + * NV_ENC_PIC_PARAMS::outputBitstream and NV_ENC_LOCK_BITSTREAM::outputBitstream must be a pointer to a struct of this type, + * when D3D12 interface is used + */ +typedef struct _NV_ENC_OUTPUT_RESOURCE_D3D12 +{ + NV_ENC_REGISTERED_PTR pOutputBuffer; /**< [in]: Specifies the output buffer pointer. Client must use a pointer obtained from NvEncRegisterResource() in NV_ENC_REGISTER_RESOURCE::registeredResource + when registering output bitstream buffer */ + NV_ENC_FENCE_POINT_D3D12 outputFencePoint; /**< [in]: Specifies the output fence and corresponding fence value to set after GPU operation is finished.*/ + uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */ + void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */ +} NV_ENC_OUTPUT_RESOURCE_D3D12; + /** * \struct _NV_ENC_REGISTER_RESOURCE * Register a resource for future use with the Nvidia Video Encoder Interface. @@ -1982,9 +2144,9 @@ ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX, ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR, ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX */ - uint32_t width; /**< [in]: Input buffer Width. */ - uint32_t height; /**< [in]: Input buffer Height. */ - uint32_t pitch; /**< [in]: Input buffer Pitch. + uint32_t width; /**< [in]: Input frame width. */ + uint32_t height; /**< [in]: Input frame height. */ + uint32_t pitch; /**< [in]: Input buffer pitch. For ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX resources, set this to 0. For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR resources, set this to the pitch as obtained from cuMemAllocPitch(), or to the width in @@ -2001,8 +2163,15 @@ NV_ENC_REGISTERED_PTR registeredResource; /**< [out]: Registered resource handle. This should be used in future interactions with the Nvidia Video Encoder Interface. */ NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Buffer format of resource to be registered. */ NV_ENC_BUFFER_USAGE bufferUsage; /**< [in]: Usage of resource to be registered. */ + NV_ENC_FENCE_POINT_D3D12* pInputFencePoint; /**< [in]: Specifies the pointer to input fence and corresponding fence value to do GPU wait. + To be used only when NV_ENC_REGISTER_RESOURCE::resourceToRegister represents D3D12 surface and + NV_ENC_BUFFER_USAGE::bufferUsage is NV_ENC_INPUT_IMAGE. + This fence will be used to do GPU wait until the specified fence reaches or exceeds the specified value. */ + NV_ENC_FENCE_POINT_D3D12* pOutputFencePoint; /**< [in]: Specifies the pointer to output fence and corresponding fence value to set after GPU operation is finished. + To be used only when NV_ENC_REGISTER_RESOURCE::resourceToRegister represents D3D12 surface and + NV_ENC_BUFFER_USAGE::bufferUsage is NV_ENC_INPUT_IMAGE. */ uint32_t reserved1[247]; /**< [in]: Reserved and must be set to 0. */ - void* reserved2[62]; /**< [in]: Reserved and must be set to NULL. */ + void* reserved2[60]; /**< [in]: Reserved and must be set to NULL. */ } NV_ENC_REGISTER_RESOURCE; /** Macro for constructing the version field of ::_NV_ENC_REGISTER_RESOURCE */ @@ -2022,7 +2191,15 @@ uint32_t lastValidByteOffset; /**< [out]: Offset of last valid bytes of completed bitstream */ uint32_t sliceOffsets[16]; /**< [out]: Offsets of each slice */ uint32_t picIdx; /**< [out]: Picture number */ - uint32_t reserved1[233]; /**< [in]: Reserved and must be set to 0 */ + uint32_t frameAvgQP; /**< [out]: Average QP of the frame. */ + uint32_t ltrFrame :1; /**< [out]: Flag indicating this frame is marked as LTR frame */ + uint32_t reservedBitFields :31; /**< [in]: Reserved bit fields and must be set to 0 */ + uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */ + uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. */ + uint32_t interMBCount; /**< [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. */ + int32_t averageMVX; /**< [out]: Average Motion Vector in X direction for the encoded frame. */ + int32_t averageMVY; /**< [out]: Average Motion Vector in y direction for the encoded frame. */ + uint32_t reserved1[226]; /**< [in]: Reserved and must be set to 0 */ void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_STAT; @@ -2037,11 +2214,12 @@ typedef struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD { uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */ - uint32_t inBufferSize; /**< [in]: Specifies the size of the spsppsBuffer provied by the client */ + uint32_t inBufferSize; /**< [in]: Specifies the size of the spsppsBuffer provided by the client */ uint32_t spsId; /**< [in]: Specifies the SPS id to be used in sequence header. Default value is 0. */ uint32_t ppsId; /**< [in]: Specifies the PPS id to be used in picture header. Default value is 0. */ - void* spsppsBuffer; /**< [in]: Specifies bitstream header pointer of size NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. It is the client's responsibility to manage this memory. */ - uint32_t* outSPSPPSPayloadSize; /**< [out]: Size of the sequence and picture header in bytes written by the NvEncodeAPI interface to the SPSPPSBuffer. */ + void* spsppsBuffer; /**< [in]: Specifies bitstream header pointer of size NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. + It is the client's responsibility to manage this memory. */ + uint32_t* outSPSPPSPayloadSize; /**< [out]: Size of the sequence and picture header in bytes. */ uint32_t reserved [250]; /**< [in]: Reserved and must be set to 0 */ void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_SEQUENCE_PARAM_PAYLOAD; @@ -2105,7 +2283,7 @@ /** * \brief Retrieves the number of supported encode GUIDs. * - * The function returns the number of codec guids supported by the NvEncodeAPI + * The function returns the number of codec GUIDs supported by the NvEncodeAPI * interface. * * \param [in] encoder @@ -2131,12 +2309,12 @@ /** * \brief Retrieves an array of supported encoder codec GUIDs. * - * The function returns an array of codec guids supported by the NvEncodeAPI interface. + * The function returns an array of codec GUIDs supported by the NvEncodeAPI interface. * The client must allocate an array where the NvEncodeAPI interface can - * fill the supported guids and pass the pointer in \p *GUIDs parameter. + * fill the supported GUIDs and pass the pointer in \p *GUIDs parameter. * The size of the array can be determined by using ::NvEncGetEncodeGUIDCount() API. - * The Nvidia Encoding interface returns the number of codec guids it has actually - * filled in the guid array in the \p GUIDCount parameter. + * The Nvidia Encoding interface returns the number of codec GUIDs it has actually + * filled in the GUID array in the \p GUIDCount parameter. * * \param [in] encoder * Pointer to the NvEncodeAPI interface. @@ -2167,15 +2345,15 @@ * \brief Retrieves the number of supported profile GUIDs. * * The function returns the number of profile GUIDs supported for a given codec. - * The client must first enumerate the codec guids supported by the NvEncodeAPI - * interface. After determining the codec guid, it can query the NvEncodeAPI - * interface to determine the number of profile guids supported for a particular - * codec guid. + * The client must first enumerate the codec GUIDs supported by the NvEncodeAPI + * interface. After determining the codec GUID, it can query the NvEncodeAPI + * interface to determine the number of profile GUIDs supported for a particular + * codec GUID. * * \param [in] encoder * Pointer to the NvEncodeAPI interface. * \param [in] encodeGUID - * The codec guid for which the profile guids are being enumerated. + * The codec GUID for which the profile GUIDs are being enumerated. * \param [out] encodeProfileGUIDCount * Number of encode profiles supported for the given encodeGUID. * @@ -2197,9 +2375,9 @@ /** * \brief Retrieves an array of supported encode profile GUIDs. * - * The function returns an array of supported profile guids for a particular - * codec guid. The client must allocate an array where the NvEncodeAPI interface - * can populate the profile guids. The client can determine the array size using + * The function returns an array of supported profile GUIDs for a particular + * codec GUID. The client must allocate an array where the NvEncodeAPI interface + * can populate the profile GUIDs. The client can determine the array size using * ::NvEncGetEncodeProfileGUIDCount() API. The client must also validiate that the * NvEncodeAPI interface supports the GUID the client wants to pass as \p encodeGUID * parameter. @@ -2207,7 +2385,7 @@ * \param [in] encoder * Pointer to the NvEncodeAPI interface. * \param [in] encodeGUID - * The encode guid whose profile guids are being enumerated. + * The encode GUID whose profile GUIDs are being enumerated. * \param [in] guidArraySize * Number of GUIDs to be retrieved. Should be set to the number retrieved using * ::NvEncGetEncodeProfileGUIDCount. @@ -2329,7 +2507,7 @@ * \brief Retrieves the number of supported preset GUIDs. * * The function returns the number of preset GUIDs available for a given codec. - * The client must validate the codec guid using ::NvEncGetEncodeGUIDs() API + * The client must validate the codec GUID using ::NvEncGetEncodeGUIDs() API * before calling this function. * * \param [in] encoder @@ -2358,11 +2536,11 @@ /** * \brief Receives an array of supported encoder preset GUIDs. * - * The function returns an array of encode preset guids available for a given codec. - * The client can directly use one of the preset guids based upon the use case - * or target device. The preset guid chosen can be directly used in + * The function returns an array of encode preset GUIDs available for a given codec. + * The client can directly use one of the preset GUIDs based upon the use case + * or target device. The preset GUID chosen can be directly used in * NV_ENC_INITIALIZE_PARAMS::presetGUID parameter to ::NvEncEncodePicture() API. - * Alternately client can also use the preset guid to retrieve the encoding config + * Alternately client can also use the preset GUID to retrieve the encoding config * parameters being used by NvEncodeAPI interface for that given preset, using * ::NvEncGetEncodePresetConfig() API. It can then modify preset config parameters * as per its use case and send it to NvEncodeAPI interface as part of @@ -2376,7 +2554,7 @@ * Encode GUID, corresponding to which the list of supported presets is to be * retrieved. * \param [in] guidArraySize - * Size of array of preset guids passed in \p preset GUIDs + * Size of array of preset GUIDs passed in \p preset GUIDs * \param [out] presetGUIDs * Array of supported Encode preset GUIDs from the NvEncodeAPI interface * to client. @@ -2402,13 +2580,13 @@ /** * \brief Returns a preset config structure supported for given preset GUID. * - * The function returns a preset config structure for a given preset guid. Before - * using this function the client must enumerate the preset guids available for + * The function returns a preset config structure for a given preset GUID. Before + * using this function the client must enumerate the preset GUIDs available for * a given codec. The preset config structure can be modified by the client depending * upon its use case and can be then used to initialize the encoder using * ::NvEncInitializeEncoder() API. The client can use this function only if it * wants to modify the NvEncodeAPI preset configuration, otherwise it can - * directly use the preset guid. + * directly use the preset GUID. * * \param [in] encoder * Pointer to the NvEncodeAPI interface. @@ -2436,6 +2614,48 @@ */ NVENCSTATUS NVENCAPI NvEncGetEncodePresetConfig (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_PRESET_CONFIG* presetConfig); +// NvEncGetEncodePresetConfigEx +/** + * \brief Returns a preset config structure supported for given preset GUID. + * + * The function returns a preset config structure for a given preset GUID and tuning info. + * NvEncGetEncodePresetConfigEx() API is not applicable to H264 and HEVC meonly mode. + * Before using this function the client must enumerate the preset GUIDs available for + * a given codec. The preset config structure can be modified by the client depending + * upon its use case and can be then used to initialize the encoder using + * ::NvEncInitializeEncoder() API. The client can use this function only if it + * wants to modify the NvEncodeAPI preset configuration, otherwise it can + * directly use the preset GUID. + * + * \param [in] encoder + * Pointer to the NvEncodeAPI interface. + * \param [in] encodeGUID + * Encode GUID, corresponding to which the list of supported presets is to be + * retrieved. + * \param [in] presetGUID + * Preset GUID, corresponding to which the Encoding configurations is to be + * retrieved. + * \param [in] tuningInfo + * tuning info, corresponding to which the Encoding configurations is to be + * retrieved. + * \param [out] presetConfig + * The requested Preset Encoder Attribute set. Refer ::_NV_ENC_CONFIG for + * more details. + * + * \return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ +NVENCSTATUS NVENCAPI NvEncGetEncodePresetConfigEx (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_TUNING_INFO tuningInfo, NV_ENC_PRESET_CONFIG* presetConfig); + // NvEncInitializeEncoder /** * \brief Initialize the encoder. @@ -2447,15 +2667,15 @@ * - NV_ENC_INITIALIZE_PARAMS::encodeWidth * - NV_ENC_INITIALIZE_PARAMS::encodeHeight * - * The client can pass a preset guid directly to the NvEncodeAPI interface using + * The client can pass a preset GUID directly to the NvEncodeAPI interface using * NV_ENC_INITIALIZE_PARAMS::presetGUID field. If the client doesn't pass * NV_ENC_INITIALIZE_PARAMS::encodeConfig structure, the codec specific parameters - * will be selected based on the preset guid. The preset guid must have been + * will be selected based on the preset GUID. The preset GUID must have been * validated by the client using ::NvEncGetEncodePresetGUIDs() API. * If the client passes a custom ::_NV_ENC_CONFIG structure through * NV_ENC_INITIALIZE_PARAMS::encodeConfig , it will override the codec specific parameters - * based on the preset guid. It is recommended that even if the client passes a custom config, - * it should also send a preset guid. In this case, the preset guid passed by the client + * based on the preset GUID. It is recommended that even if the client passes a custom config, + * it should also send a preset GUID. In this case, the preset GUID passed by the client * will not override any of the custom config parameters programmed by the client, * it is only used as a hint by the NvEncodeAPI interface to determine certain encoder parameters * which are not exposed to the client. @@ -2471,9 +2691,9 @@ * The client operating in asynchronous mode must allocate completion event object * for each output buffer and pass the completion event object in the * ::NvEncEncodePicture() API. The client can create another thread and wait on - * the event object to be signalled by NvEncodeAPI interface on completion of the + * the event object to be signaled by NvEncodeAPI interface on completion of the * encoding process for the output frame. This should unblock the main thread from - * submitting work to the encoder. When the event is signalled the client can call + * submitting work to the encoder. When the event is signaled the client can call * NvEncodeAPI interfaces to copy the bitstream data using ::NvEncLockBitstream() * API. This is the preferred mode of operation. * @@ -2628,7 +2848,7 @@ * initialized using ::NvEncInitializeEncoder() API. The minimum number of output * buffers allocated by the client must be at least 4 more than the number of B * B frames being used for encoding. The client can only access the output - * bitsteam data by locking the \p bitstreamBuffer using the ::NvEncLockBitstream() + * bitstream data by locking the \p bitstreamBuffer using the ::NvEncLockBitstream() * function. * * \param [in] encoder @@ -2696,7 +2916,7 @@ * - NV_ENC_PIC_PARAMS_H264::refPicFlag(H264 only) * *\par MVC Encoding: - * For MVC encoding the client must call encode picture api for each view separately + * For MVC encoding the client must call encode picture API for each view separately * and must pass valid view id in NV_ENC_PIC_PARAMS_MVC::viewID field. Currently * NvEncodeAPI only support stereo MVC so client must send viewID as 0 for base * view and view ID as 1 for dependent view. @@ -2714,6 +2934,10 @@ * submitted for encoding. The NvEncodeAPI interface is responsible for any * re-ordering required for B frames and will always ensure that encoded bitstream * data is written in the same order in which output buffer is submitted. + * The NvEncodeAPI interface may return ::NV_ENC_ERR_NEED_MORE_INPUT error code for + * some ::NvEncEncodePicture() API calls but the client must not treat it as a fatal error. + * The NvEncodeAPI interface might not be able to submit an input picture buffer for encoding + * immediately due to re-ordering for B frames. *\code The below example shows how asynchronous encoding in case of 1 B frames ------------------------------------------------------------------------ @@ -2743,14 +2967,21 @@ (I3, O3, E3) ---P3 Frame c) NvEncodeAPI interface will make a copy of the input buffers to its internal - buffersfor re-ordering. These copies are done as part of nvEncEncodePicture + buffers for re-ordering. These copies are done as part of nvEncEncodePicture function call from the client and NvEncodeAPI interface is responsible for synchronization of copy operation with the actual encoding operation. I1 --> NvI1 I2 --> NvI2 I3 --> NvI3 - d) After returning from ::NvEncEncodePicture() call , the client must queue the output + d) The NvEncodeAPI encodes I1 as P frame and submits I1 to encoder HW and returns ::NV_ENC_SUCCESS. + The NvEncodeAPI tries to encode I2 as B frame and fails with ::NV_ENC_ERR_NEED_MORE_INPUT error code. + The error is not fatal and it notifies client that I2 is not submitted to encoder immediately. + The NvEncodeAPI encodes I3 as P frame and submits I3 for encoding which will be used as backward + reference frame for I2. The NvEncodeAPI then submits I2 for encoding and returns ::NV_ENC_SUCESS. + Both the submission are part of the same ::NvEncEncodePicture() function call. + + e) After returning from ::NvEncEncodePicture() call , the client must queue the output bitstream processing work to the secondary thread. The output bitstream processing for asynchronous mode consist of first waiting on completion event(E1, E2..) and then locking the output bitstream buffer(O1, O2..) for reading the encoded @@ -2761,32 +2992,32 @@ Note they are in the same order in which client calls ::NvEncEncodePicture() API in \p step a). - e) NvEncodeAPI interface will do the re-ordering such that Encoder HW will receive + f) NvEncodeAPI interface will do the re-ordering such that Encoder HW will receive the following encode commands: (NvI1, O1, E1) ---P1 Frame (NvI3, O2, E2) ---P3 Frame (NvI2, O3, E3) ---B2 frame - f) After the encoding operations are completed, the events will be signalled + g) After the encoding operations are completed, the events will be signaled by NvEncodeAPI interface in the following order : - (O1, E1) ---P1 Frame ,output bitstream copied to O1 and event E1 signalled. - (O2, E2) ---P3 Frame ,output bitstream copied to O2 and event E2 signalled. - (O3, E3) ---B2 Frame ,output bitstream copied to O3 and event E3 signalled. + (O1, E1) ---P1 Frame ,output bitstream copied to O1 and event E1 signaled. + (O2, E2) ---P3 Frame ,output bitstream copied to O2 and event E2 signaled. + (O3, E3) ---B2 Frame ,output bitstream copied to O3 and event E3 signaled. - g) The client must lock the bitstream data using ::NvEncLockBitstream() API in + h) The client must lock the bitstream data using ::NvEncLockBitstream() API in the order O1,O2,O3 to read the encoded data, after waiting for the events - to be signalled in the same order i.e E1, E2 and E3.The output processing is + to be signaled in the same order i.e E1, E2 and E3.The output processing is done in the secondary thread in the following order: Waits on E1, copies encoded bitstream from O1 Waits on E2, copies encoded bitstream from O2 Waits on E3, copies encoded bitstream from O3 - -Note the client will receive the events signalling and output buffer in the + -Note the client will receive the events signaling and output buffer in the same order in which they have submitted for encoding. -Note the LockBitstream will have picture type field which will notify the output picture type to the clients. -Note the input, output buffer and the output completion event are free to be - reused once NvEncodeAPI interfaced has signalled the event and the client has + reused once NvEncodeAPI interfaced has signaled the event and the client has copied the data from the output buffer. * \endcode @@ -3062,6 +3293,44 @@ */ NVENCSTATUS NVENCAPI NvEncGetSequenceParams (void* encoder, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload); +// NvEncGetSequenceParamEx +/** + * \brief Get sequence and picture header. + * + * This function can be used to retrieve the sequence and picture header out of band, even when + * encoder has not been initialized using ::NvEncInitializeEncoder() function. + * The client must allocate the memory where the NvEncodeAPI interface can copy the bitstream + * header and pass the pointer to the memory in NV_ENC_SEQUENCE_PARAM_PAYLOAD::spsppsBuffer. + * The size of buffer is passed in the field NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. + * If encoder has not been initialized using ::NvEncInitializeEncoder() function, client must + * send NV_ENC_INITIALIZE_PARAMS as input. The NV_ENC_INITIALIZE_PARAMS passed must be same as the + * one which will be used for initializing encoder using ::NvEncInitializeEncoder() function later. + * If encoder is already initialized using ::NvEncInitializeEncoder() function, the provided + * NV_ENC_INITIALIZE_PARAMS structure is ignored. The NvEncodeAPI interface will copy the bitstream + * header payload and returns the actual size of the bitstream header in the field + * NV_ENC_SEQUENCE_PARAM_PAYLOAD::outSPSPPSPayloadSize. The client must call ::NvEncGetSequenceParamsEx() + * function from the same thread which is being used to call ::NvEncEncodePicture() function. + * + * \param [in] encoder + * Pointer to the NvEncodeAPI interface. + * \param [in] encInitParams + * Pointer to the _NV_ENC_INITIALIZE_PARAMS structure. + * \param [in,out] sequenceParamPayload + * Pointer to the ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD structure. + * + * \return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ +NVENCSTATUS NVENCAPI NvEncGetSequenceParamEx (void* encoder, NV_ENC_INITIALIZE_PARAMS* encInitParams, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload); // NvEncRegisterAsyncEvent /** @@ -3072,7 +3341,7 @@ * work in asynchronous mode. In this mode the client needs to send a completion * event with every output buffer. The NvEncodeAPI interface will signal the * completion of the encoding process using this event. Only after the event is - * signalled the client can get the encoded data using ::NvEncLockBitstream() function. + * signaled the client can get the encoded data using ::NvEncLockBitstream() function. * * \param [in] encoder * Pointer to the NvEncodeAPI interface. @@ -3138,6 +3407,7 @@ * also true for compute (i.e. CUDA) work, provided that the previous workload using * the input resource was submitted to the default stream. * The client should not access any input buffer while they are mapped by the encoder. + * For D3D12 interface type, this function does not provide synchronization guarantee. * * \param [in] encoder * Pointer to the NvEncodeAPI interface. @@ -3170,7 +3440,7 @@ * UnMaps an input buffer which was previously mapped using ::NvEncMapInputResource() * API. The mapping created using ::NvEncMapInputResource() should be invalidated * using this API before the external resource is destroyed by the client. The client - * must unmap the buffer after ::NvEncLockBitstream() API returns succuessfully for encode + * must unmap the buffer after ::NvEncLockBitstream() API returns successfully for encode * work submitted using the mapped input buffer. * * @@ -3361,7 +3631,7 @@ * Change in GOP structure. * Change in sync-Async mode. * Change in MaxWidth & MaxHeight. - * Change in PTDmode. + * Change in PTD mode. * * Resolution change is possible only if maxEncodeWidth & maxEncodeHeight of NV_ENC_INITIALIZE_PARAMS * is set while creating encoder session. @@ -3493,7 +3763,7 @@ NVENCSTATUS NVENCAPI NvEncodeAPIGetMaxSupportedVersion (uint32_t* version); -// NvEncodeAPIGetLastErrorString +// NvEncGetLastErrorString /** * \brief Get the description of the last error reported by the API. * @@ -3524,6 +3794,7 @@ typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCOUNT) (void* encoder, GUID encodeGUID, uint32_t* encodePresetGUIDCount); typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETGUIDS) (void* encoder, GUID encodeGUID, GUID* presetGUIDs, uint32_t guidArraySize, uint32_t* encodePresetGUIDCount); typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCONFIG) (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_PRESET_CONFIG* presetConfig); +typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCONFIGEX) (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_TUNING_INFO tuningInfo, NV_ENC_PRESET_CONFIG* presetConfig); typedef NVENCSTATUS (NVENCAPI* PNVENCINITIALIZEENCODER) (void* encoder, NV_ENC_INITIALIZE_PARAMS* createEncodeParams); typedef NVENCSTATUS (NVENCAPI* PNVENCCREATEINPUTBUFFER) (void* encoder, NV_ENC_CREATE_INPUT_BUFFER* createInputBufferParams); typedef NVENCSTATUS (NVENCAPI* PNVENCDESTROYINPUTBUFFER) (void* encoder, NV_ENC_INPUT_PTR inputBuffer); @@ -3552,6 +3823,7 @@ typedef NVENCSTATUS (NVENCAPI* PNVENCRUNMOTIONESTIMATIONONLY) (void* encoder, NV_ENC_MEONLY_PARAMS* meOnlyParams); typedef const char * (NVENCAPI* PNVENCGETLASTERROR) (void* encoder); typedef NVENCSTATUS (NVENCAPI* PNVENCSETIOCUDASTREAMS) (void* encoder, NV_ENC_CUSTREAM_PTR inputStream, NV_ENC_CUSTREAM_PTR outputStream); +typedef NVENCSTATUS (NVENCAPI* PNVENCGETSEQUENCEPARAMEX) (void* encoder, NV_ENC_INITIALIZE_PARAMS* encInitParams, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload); /// \endcond @@ -3606,7 +3878,9 @@ PNVENCRUNMOTIONESTIMATIONONLY nvEncRunMotionEstimationOnly; /**< [out]: Client should access ::NvEncRunMotionEstimationOnly API through this pointer. */ PNVENCGETLASTERROR nvEncGetLastErrorString; /**< [out]: Client should access ::nvEncGetLastErrorString API through this pointer. */ PNVENCSETIOCUDASTREAMS nvEncSetIOCudaStreams; /**< [out]: Client should access ::nvEncSetIOCudaStreams API through this pointer. */ - void* reserved2[279]; /**< [in]: Reserved and must be set to NULL */ + PNVENCGETENCODEPRESETCONFIGEX nvEncGetEncodePresetConfigEx; /**< [out]: Client should access ::NvEncGetEncodePresetConfigEx() API through this pointer. */ + PNVENCGETSEQUENCEPARAMEX nvEncGetSequenceParamEx; /**< [out]: Client should access ::NvEncGetSequenceParamEx() API through this pointer. */ + void* reserved2[277]; /**< [in]: Reserved and must be set to NULL */ } NV_ENCODE_API_FUNCTION_LIST; /** Macro for constructing the version field of ::_NV_ENCODEAPI_FUNCTION_LIST. */ diff -Nru nv-codec-headers-9.1.23.1/README nv-codec-headers-11.1.5.0/README --- nv-codec-headers-9.1.23.1/README 2019-11-18 13:14:38.000000000 +0000 +++ nv-codec-headers-11.1.5.0/README 2021-08-03 16:13:31.000000000 +0000 @@ -1,7 +1,7 @@ FFmpeg version of headers required to interface with Nvidias codec APIs. -Corresponds to Video Codec SDK version 9.1.23. +Corresponds to Video Codec SDK version 11.0.10. Minimum required driver versions: -Linux: 435.21 or newer -Windows: 436.15 or newer +Linux: 470.57.02 or newer +Windows: 471.41 or newer