BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / src / nvidia / NvCodec / include / nvEncodeAPI.h

nvEncodeAPI.h

nvEncodeAPI.h 271.7 KiB Download Raw
1/*
2 * This copyright notice applies to this header file only:
3 *
4 * Copyright (c) 2010-2022 NVIDIA Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the software, and to permit persons to whom the
12 * software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28/**
29 * \file nvEncodeAPI.h
30 * NVIDIA GPUs - beginning with the Kepler generation - contain a hardware-based encoder
31 * (referred to as NVENC) which provides fully-accelerated hardware-based video encoding.
32 * NvEncodeAPI provides the interface for NVIDIA video encoder (NVENC).
33 * \date 2011-2022
34 * This file contains the interface constants, structure definitions and function prototypes.
35 */
36
37#ifndef _NV_ENCODEAPI_H_
38#define _NV_ENCODEAPI_H_
39
40#include <stdlib.h>
41
42#ifdef _WIN32
43#include <windows.h>
44#endif
45
46#ifdef _MSC_VER
47#ifndef _STDINT
48typedef __int32 int32_t;
49typedef unsigned __int32 uint32_t;
50typedef __int64 int64_t;
51typedef unsigned __int64 uint64_t;
52typedef signed char int8_t;
53typedef unsigned char uint8_t;
54typedef short int16_t;
55typedef unsigned short uint16_t;
56#endif
57#else
58#include <stdint.h>
59#endif
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65/**
66 * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
67 * @{
68 */
69
70#ifdef _WIN32
71#define NVENCAPI __stdcall
72typedef RECT NVENC_RECT;
73#else
74#define NVENCAPI
75// =========================================================================================
76#ifndef GUID_DEFINED
77#define GUID_DEFINED
78/*!
79 * \struct GUID
80 * Abstracts the GUID structure for non-windows platforms.
81 */
82// =========================================================================================
83typedef struct _GUID
84{
85 uint32_t Data1; /**< [in]: Specifies the first 8 hexadecimal digits of the GUID. */
86 uint16_t Data2; /**< [in]: Specifies the first group of 4 hexadecimal digits. */
87 uint16_t Data3; /**< [in]: Specifies the second group of 4 hexadecimal digits. */
88 uint8_t Data4[8]; /**< [in]: Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits.
89 The remaining 6 bytes contain the final 12 hexadecimal digits. */
90} GUID, *LPGUID;
91#endif // GUID
92
93/**
94 * \struct _NVENC_RECT
95 * Defines a Rectangle. Used in ::NV_ENC_PREPROCESS_FRAME.
96 */
97typedef struct _NVENC_RECT
98{
99 uint32_t left; /**< [in]: X coordinate of the upper left corner of rectangular area to be specified. */
100 uint32_t top; /**< [in]: Y coordinate of the upper left corner of the rectangular area to be specified. */
101 uint32_t right; /**< [in]: X coordinate of the bottom right corner of the rectangular area to be specified. */
102 uint32_t bottom; /**< [in]: Y coordinate of the bottom right corner of the rectangular area to be specified. */
103} NVENC_RECT;
104
105#endif // _WIN32
106
107/** @} */ /* End of GUID and NVENC_RECT structure grouping*/
108
109typedef void* NV_ENC_INPUT_PTR; /**< NVENCODE API input buffer */
110typedef void* NV_ENC_OUTPUT_PTR; /**< NVENCODE API output buffer*/
111typedef void* NV_ENC_REGISTERED_PTR; /**< A Resource that has been registered with NVENCODE API*/
112typedef void* NV_ENC_CUSTREAM_PTR; /**< Pointer to CUstream*/
113
114#define NVENCAPI_MAJOR_VERSION 12
115#define NVENCAPI_MINOR_VERSION 0
116
117#define NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24))
118
119/**
120 * Macro to generate per-structure version for use with API.
121 */
122#define NVENCAPI_STRUCT_VERSION(ver) ((uint32_t)NVENCAPI_VERSION | ((ver)<<16) | (0x7 << 28))
123
124
125#define NVENC_INFINITE_GOPLENGTH 0xffffffff
126
127#define NV_MAX_SEQ_HDR_LEN (512)
128
129#ifdef __GNUC__
130#define NV_ENC_DEPRECATED __attribute__ ((deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION")))
131#elif defined(_MSC_VER)
132#define NV_ENC_DEPRECATED __declspec(deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION"))
133#endif
134
135// =========================================================================================
136// Encode Codec GUIDS supported by the NvEncodeAPI interface.
137// =========================================================================================
138
139// {6BC82762-4E63-4ca4-AA85-1E50F321F6BF}
140static const GUID NV_ENC_CODEC_H264_GUID =
141{ 0x6bc82762, 0x4e63, 0x4ca4, { 0xaa, 0x85, 0x1e, 0x50, 0xf3, 0x21, 0xf6, 0xbf } };
142
143// {790CDC88-4522-4d7b-9425-BDA9975F7603}
144static const GUID NV_ENC_CODEC_HEVC_GUID =
145{ 0x790cdc88, 0x4522, 0x4d7b, { 0x94, 0x25, 0xbd, 0xa9, 0x97, 0x5f, 0x76, 0x3 } };
146
147// {0A352289-0AA7-4759-862D-5D15CD16D254}
148static const GUID NV_ENC_CODEC_AV1_GUID =
149{ 0x0a352289, 0x0aa7, 0x4759, { 0x86, 0x2d, 0x5d, 0x15, 0xcd, 0x16, 0xd2, 0x54 } };
150
151
152
153// =========================================================================================
154// * Encode Profile GUIDS supported by the NvEncodeAPI interface.
155// =========================================================================================
156
157// {BFD6F8E7-233C-4341-8B3E-4818523803F4}
158static const GUID NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID =
159{ 0xbfd6f8e7, 0x233c, 0x4341, { 0x8b, 0x3e, 0x48, 0x18, 0x52, 0x38, 0x3, 0xf4 } };
160
161// {0727BCAA-78C4-4c83-8C2F-EF3DFF267C6A}
162static const GUID NV_ENC_H264_PROFILE_BASELINE_GUID =
163{ 0x727bcaa, 0x78c4, 0x4c83, { 0x8c, 0x2f, 0xef, 0x3d, 0xff, 0x26, 0x7c, 0x6a } };
164
165// {60B5C1D4-67FE-4790-94D5-C4726D7B6E6D}
166static const GUID NV_ENC_H264_PROFILE_MAIN_GUID =
167{ 0x60b5c1d4, 0x67fe, 0x4790, { 0x94, 0xd5, 0xc4, 0x72, 0x6d, 0x7b, 0x6e, 0x6d } };
168
169// {E7CBC309-4F7A-4b89-AF2A-D537C92BE310}
170static const GUID NV_ENC_H264_PROFILE_HIGH_GUID =
171{ 0xe7cbc309, 0x4f7a, 0x4b89, { 0xaf, 0x2a, 0xd5, 0x37, 0xc9, 0x2b, 0xe3, 0x10 } };
172
173// {7AC663CB-A598-4960-B844-339B261A7D52}
174static const GUID NV_ENC_H264_PROFILE_HIGH_444_GUID =
175{ 0x7ac663cb, 0xa598, 0x4960, { 0xb8, 0x44, 0x33, 0x9b, 0x26, 0x1a, 0x7d, 0x52 } };
176
177// {40847BF5-33F7-4601-9084-E8FE3C1DB8B7}
178static const GUID NV_ENC_H264_PROFILE_STEREO_GUID =
179{ 0x40847bf5, 0x33f7, 0x4601, { 0x90, 0x84, 0xe8, 0xfe, 0x3c, 0x1d, 0xb8, 0xb7 } };
180
181// {B405AFAC-F32B-417B-89C4-9ABEED3E5978}
182static const GUID NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID =
183{ 0xb405afac, 0xf32b, 0x417b, { 0x89, 0xc4, 0x9a, 0xbe, 0xed, 0x3e, 0x59, 0x78 } };
184
185// {AEC1BD87-E85B-48f2-84C3-98BCA6285072}
186static const GUID NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID =
187{ 0xaec1bd87, 0xe85b, 0x48f2, { 0x84, 0xc3, 0x98, 0xbc, 0xa6, 0x28, 0x50, 0x72 } };
188
189// {B514C39A-B55B-40fa-878F-F1253B4DFDEC}
190static const GUID NV_ENC_HEVC_PROFILE_MAIN_GUID =
191{ 0xb514c39a, 0xb55b, 0x40fa, { 0x87, 0x8f, 0xf1, 0x25, 0x3b, 0x4d, 0xfd, 0xec } };
192
193// {fa4d2b6c-3a5b-411a-8018-0a3f5e3c9be5}
194static const GUID NV_ENC_HEVC_PROFILE_MAIN10_GUID =
195{ 0xfa4d2b6c, 0x3a5b, 0x411a, { 0x80, 0x18, 0x0a, 0x3f, 0x5e, 0x3c, 0x9b, 0xe5 } };
196
197// For HEVC Main 444 8 bit and HEVC Main 444 10 bit profiles only
198// {51ec32b5-1b4c-453c-9cbd-b616bd621341}
199static const GUID NV_ENC_HEVC_PROFILE_FREXT_GUID =
200{ 0x51ec32b5, 0x1b4c, 0x453c, { 0x9c, 0xbd, 0xb6, 0x16, 0xbd, 0x62, 0x13, 0x41 } };
201
202// {5f2a39f5-f14e-4f95-9a9e-b76d568fcf97}
203static const GUID NV_ENC_AV1_PROFILE_MAIN_GUID =
204{ 0x5f2a39f5, 0xf14e, 0x4f95, { 0x9a, 0x9e, 0xb7, 0x6d, 0x56, 0x8f, 0xcf, 0x97 } };
205
206// =========================================================================================
207// * Preset GUIDS supported by the NvEncodeAPI interface.
208// =========================================================================================
209// {B2DFB705-4EBD-4C49-9B5F-24A777D3E587}
210NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_DEFAULT_GUID =
211{ 0xb2dfb705, 0x4ebd, 0x4c49, { 0x9b, 0x5f, 0x24, 0xa7, 0x77, 0xd3, 0xe5, 0x87 } };
212
213// {60E4C59F-E846-4484-A56D-CD45BE9FDDF6}
214NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HP_GUID =
215{ 0x60e4c59f, 0xe846, 0x4484, { 0xa5, 0x6d, 0xcd, 0x45, 0xbe, 0x9f, 0xdd, 0xf6 } };
216
217// {34DBA71D-A77B-4B8F-9C3E-B6D5DA24C012}
218NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HQ_GUID =
219{ 0x34dba71d, 0xa77b, 0x4b8f, { 0x9c, 0x3e, 0xb6, 0xd5, 0xda, 0x24, 0xc0, 0x12 } };
220
221// {82E3E450-BDBB-4e40-989C-82A90DF9EF32}
222NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_BD_GUID =
223{ 0x82e3e450, 0xbdbb, 0x4e40, { 0x98, 0x9c, 0x82, 0xa9, 0xd, 0xf9, 0xef, 0x32 } };
224
225// {49DF21C5-6DFA-4feb-9787-6ACC9EFFB726}
226NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID =
227{ 0x49df21c5, 0x6dfa, 0x4feb, { 0x97, 0x87, 0x6a, 0xcc, 0x9e, 0xff, 0xb7, 0x26 } };
228
229// {C5F733B9-EA97-4cf9-BEC2-BF78A74FD105}
230NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID =
231{ 0xc5f733b9, 0xea97, 0x4cf9, { 0xbe, 0xc2, 0xbf, 0x78, 0xa7, 0x4f, 0xd1, 0x5 } };
232
233// {67082A44-4BAD-48FA-98EA-93056D150A58}
234NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID =
235{ 0x67082a44, 0x4bad, 0x48fa, { 0x98, 0xea, 0x93, 0x5, 0x6d, 0x15, 0xa, 0x58 } };
236
237// {D5BFB716-C604-44e7-9BB8-DEA5510FC3AC}
238NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID =
239{ 0xd5bfb716, 0xc604, 0x44e7, { 0x9b, 0xb8, 0xde, 0xa5, 0x51, 0xf, 0xc3, 0xac } };
240
241// {149998E7-2364-411d-82EF-179888093409}
242NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID =
243{ 0x149998e7, 0x2364, 0x411d, { 0x82, 0xef, 0x17, 0x98, 0x88, 0x9, 0x34, 0x9 } };
244
245// 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
246// 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
247// setting frameIntervalP = 1
248// {FC0A8D3E-45F8-4CF8-80C7-298871590EBF}
249static const GUID NV_ENC_PRESET_P1_GUID =
250{ 0xfc0a8d3e, 0x45f8, 0x4cf8, { 0x80, 0xc7, 0x29, 0x88, 0x71, 0x59, 0xe, 0xbf } };
251
252// {F581CFB8-88D6-4381-93F0-DF13F9C27DAB}
253static const GUID NV_ENC_PRESET_P2_GUID =
254{ 0xf581cfb8, 0x88d6, 0x4381, { 0x93, 0xf0, 0xdf, 0x13, 0xf9, 0xc2, 0x7d, 0xab } };
255
256// {36850110-3A07-441F-94D5-3670631F91F6}
257static const GUID NV_ENC_PRESET_P3_GUID =
258{ 0x36850110, 0x3a07, 0x441f, { 0x94, 0xd5, 0x36, 0x70, 0x63, 0x1f, 0x91, 0xf6 } };
259
260// {90A7B826-DF06-4862-B9D2-CD6D73A08681}
261static const GUID NV_ENC_PRESET_P4_GUID =
262{ 0x90a7b826, 0xdf06, 0x4862, { 0xb9, 0xd2, 0xcd, 0x6d, 0x73, 0xa0, 0x86, 0x81 } };
263
264// {21C6E6B4-297A-4CBA-998F-B6CBDE72ADE3}
265static const GUID NV_ENC_PRESET_P5_GUID =
266{ 0x21c6e6b4, 0x297a, 0x4cba, { 0x99, 0x8f, 0xb6, 0xcb, 0xde, 0x72, 0xad, 0xe3 } };
267
268// {8E75C279-6299-4AB6-8302-0B215A335CF5}
269static const GUID NV_ENC_PRESET_P6_GUID =
270{ 0x8e75c279, 0x6299, 0x4ab6, { 0x83, 0x2, 0xb, 0x21, 0x5a, 0x33, 0x5c, 0xf5 } };
271
272// {84848C12-6F71-4C13-931B-53E283F57974}
273static const GUID NV_ENC_PRESET_P7_GUID =
274{ 0x84848c12, 0x6f71, 0x4c13, { 0x93, 0x1b, 0x53, 0xe2, 0x83, 0xf5, 0x79, 0x74 } };
275
276/**
277 * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
278 * @{
279 */
280
281/**
282 * Input frame encode modes
283 */
284typedef enum _NV_ENC_PARAMS_FRAME_FIELD_MODE
285{
286 NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME = 0x01, /**< Frame mode */
287 NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD = 0x02, /**< Field mode */
288 NV_ENC_PARAMS_FRAME_FIELD_MODE_MBAFF = 0x03 /**< MB adaptive frame/field */
289} NV_ENC_PARAMS_FRAME_FIELD_MODE;
290
291/**
292 * Rate Control Modes
293 */
294typedef enum _NV_ENC_PARAMS_RC_MODE
295{
296 NV_ENC_PARAMS_RC_CONSTQP = 0x0, /**< Constant QP mode */
297 NV_ENC_PARAMS_RC_VBR = 0x1, /**< Variable bitrate mode */
298 NV_ENC_PARAMS_RC_CBR = 0x2, /**< Constant bitrate mode */
299 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 +
300 lowDelayKeyFrameScale=1 */
301 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 */
302 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 */
303} NV_ENC_PARAMS_RC_MODE;
304
305/**
306 * Multi Pass encoding
307 */
308typedef enum _NV_ENC_MULTI_PASS
309{
310 NV_ENC_MULTI_PASS_DISABLED = 0x0, /**< Single Pass */
311 NV_ENC_TWO_PASS_QUARTER_RESOLUTION = 0x1, /**< Two Pass encoding is enabled where first Pass is quarter resolution */
312 NV_ENC_TWO_PASS_FULL_RESOLUTION = 0x2, /**< Two Pass encoding is enabled where first Pass is full resolution */
313} NV_ENC_MULTI_PASS;
314
315/**
316 * Emphasis Levels
317 */
318typedef enum _NV_ENC_EMPHASIS_MAP_LEVEL
319{
320 NV_ENC_EMPHASIS_MAP_LEVEL_0 = 0x0, /**< Emphasis Map Level 0, for zero Delta QP value */
321 NV_ENC_EMPHASIS_MAP_LEVEL_1 = 0x1, /**< Emphasis Map Level 1, for very low Delta QP value */
322 NV_ENC_EMPHASIS_MAP_LEVEL_2 = 0x2, /**< Emphasis Map Level 2, for low Delta QP value */
323 NV_ENC_EMPHASIS_MAP_LEVEL_3 = 0x3, /**< Emphasis Map Level 3, for medium Delta QP value */
324 NV_ENC_EMPHASIS_MAP_LEVEL_4 = 0x4, /**< Emphasis Map Level 4, for high Delta QP value */
325 NV_ENC_EMPHASIS_MAP_LEVEL_5 = 0x5 /**< Emphasis Map Level 5, for very high Delta QP value */
326} NV_ENC_EMPHASIS_MAP_LEVEL;
327
328/**
329 * QP MAP MODE
330 */
331typedef enum _NV_ENC_QP_MAP_MODE
332{
333 NV_ENC_QP_MAP_DISABLED = 0x0, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap have no effect. */
334 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 */
335 NV_ENC_QP_MAP_DELTA = 0x2, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP delta map. */
336 NV_ENC_QP_MAP = 0x3, /**< Currently This is not supported. Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP value. */
337} NV_ENC_QP_MAP_MODE;
338
339#define NV_ENC_PARAMS_RC_VBR_MINQP (NV_ENC_PARAMS_RC_MODE)0x4 /**< Deprecated */
340#define NV_ENC_PARAMS_RC_2_PASS_QUALITY NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ /**< Deprecated */
341#define NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP NV_ENC_PARAMS_RC_CBR_HQ /**< Deprecated */
342#define NV_ENC_PARAMS_RC_2_PASS_VBR NV_ENC_PARAMS_RC_VBR_HQ /**< Deprecated */
343#define NV_ENC_PARAMS_RC_CBR2 NV_ENC_PARAMS_RC_CBR /**< Deprecated */
344
345/**
346 * Input picture structure
347 */
348typedef enum _NV_ENC_PIC_STRUCT
349{
350 NV_ENC_PIC_STRUCT_FRAME = 0x01, /**< Progressive frame */
351 NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM = 0x02, /**< Field encoding top field first */
352 NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP = 0x03 /**< Field encoding bottom field first */
353} NV_ENC_PIC_STRUCT;
354
355/**
356 * Display picture structure
357 * Currently, this enum is only used for deciding the number of clock timestamp sets in Picture Timing SEI / Time Code SEI
358 * Otherwise, this has no impact on encoder behavior
359 */
360typedef enum _NV_ENC_DISPLAY_PIC_STRUCT
361{
362 NV_ENC_PIC_STRUCT_DISPLAY_FRAME = 0x00, /**< Field encoding top field first */
363 NV_ENC_PIC_STRUCT_DISPLAY_FIELD_TOP_BOTTOM = 0x01, /**< Field encoding top field first */
364 NV_ENC_PIC_STRUCT_DISPLAY_FIELD_BOTTOM_TOP = 0x02, /**< Field encoding bottom field first */
365 NV_ENC_PIC_STRUCT_DISPLAY_FRAME_DOUBLING = 0x03, /**< Frame doubling */
366 NV_ENC_PIC_STRUCT_DISPLAY_FRAME_TRIPLING = 0x04 /**< Field tripling */
367} NV_ENC_DISPLAY_PIC_STRUCT;
368
369/**
370 * Input picture type
371 */
372typedef enum _NV_ENC_PIC_TYPE
373{
374 NV_ENC_PIC_TYPE_P = 0x0, /**< Forward predicted */
375 NV_ENC_PIC_TYPE_B = 0x01, /**< Bi-directionally predicted picture */
376 NV_ENC_PIC_TYPE_I = 0x02, /**< Intra predicted picture */
377 NV_ENC_PIC_TYPE_IDR = 0x03, /**< IDR picture */
378 NV_ENC_PIC_TYPE_BI = 0x04, /**< Bi-directionally predicted with only Intra MBs */
379 NV_ENC_PIC_TYPE_SKIPPED = 0x05, /**< Picture is skipped */
380 NV_ENC_PIC_TYPE_INTRA_REFRESH = 0x06, /**< First picture in intra refresh cycle */
381 NV_ENC_PIC_TYPE_NONREF_P = 0x07, /**< Non reference P picture */
382 NV_ENC_PIC_TYPE_UNKNOWN = 0xFF /**< Picture type unknown */
383} NV_ENC_PIC_TYPE;
384
385/**
386 * Motion vector precisions
387 */
388typedef enum _NV_ENC_MV_PRECISION
389{
390 NV_ENC_MV_PRECISION_DEFAULT = 0x0, /**< Driver selects Quarter-Pel motion vector precision by default */
391 NV_ENC_MV_PRECISION_FULL_PEL = 0x01, /**< Full-Pel motion vector precision */
392 NV_ENC_MV_PRECISION_HALF_PEL = 0x02, /**< Half-Pel motion vector precision */
393 NV_ENC_MV_PRECISION_QUARTER_PEL = 0x03 /**< Quarter-Pel motion vector precision */
394} NV_ENC_MV_PRECISION;
395
396
397/**
398 * Input buffer formats
399 */
400typedef enum _NV_ENC_BUFFER_FORMAT
401{
402 NV_ENC_BUFFER_FORMAT_UNDEFINED = 0x00000000, /**< Undefined buffer format */
403
404 NV_ENC_BUFFER_FORMAT_NV12 = 0x00000001, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
405 NV_ENC_BUFFER_FORMAT_YV12 = 0x00000010, /**< Planar YUV [Y plane followed by V and U planes] */
406 NV_ENC_BUFFER_FORMAT_IYUV = 0x00000100, /**< Planar YUV [Y plane followed by U and V planes] */
407 NV_ENC_BUFFER_FORMAT_YUV444 = 0x00001000, /**< Planar YUV [Y plane followed by U and V planes] */
408 NV_ENC_BUFFER_FORMAT_YUV420_10BIT = 0x00010000, /**< 10 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */
409 NV_ENC_BUFFER_FORMAT_YUV444_10BIT = 0x00100000, /**< 10 bit Planar YUV444 [Y plane followed by U and V planes]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */
410 NV_ENC_BUFFER_FORMAT_ARGB = 0x01000000, /**< 8 bit Packed A8R8G8B8. This is a word-ordered format
411 where a pixel is represented by a 32-bit word with B
412 in the lowest 8 bits, G in the next 8 bits, R in the
413 8 bits after that and A in the highest 8 bits. */
414 NV_ENC_BUFFER_FORMAT_ARGB10 = 0x02000000, /**< 10 bit Packed A2R10G10B10. This is a word-ordered format
415 where a pixel is represented by a 32-bit word with B
416 in the lowest 10 bits, G in the next 10 bits, R in the
417 10 bits after that and A in the highest 2 bits. */
418 NV_ENC_BUFFER_FORMAT_AYUV = 0x04000000, /**< 8 bit Packed A8Y8U8V8. This is a word-ordered format
419 where a pixel is represented by a 32-bit word with V
420 in the lowest 8 bits, U in the next 8 bits, Y in the
421 8 bits after that and A in the highest 8 bits. */
422 NV_ENC_BUFFER_FORMAT_ABGR = 0x10000000, /**< 8 bit Packed A8B8G8R8. This is a word-ordered format
423 where a pixel is represented by a 32-bit word with R
424 in the lowest 8 bits, G in the next 8 bits, B in the
425 8 bits after that and A in the highest 8 bits. */
426 NV_ENC_BUFFER_FORMAT_ABGR10 = 0x20000000, /**< 10 bit Packed A2B10G10R10. This is a word-ordered format
427 where a pixel is represented by a 32-bit word with R
428 in the lowest 10 bits, G in the next 10 bits, B in the
429 10 bits after that and A in the highest 2 bits. */
430 NV_ENC_BUFFER_FORMAT_U8 = 0x40000000, /**< Buffer format representing one-dimensional buffer.
431 This format should be used only when registering the
432 resource as output buffer, which will be used to write
433 the encoded bit stream or H.264 ME only mode output. */
434} NV_ENC_BUFFER_FORMAT;
435
436#define NV_ENC_BUFFER_FORMAT_NV12_PL NV_ENC_BUFFER_FORMAT_NV12
437#define NV_ENC_BUFFER_FORMAT_YV12_PL NV_ENC_BUFFER_FORMAT_YV12
438#define NV_ENC_BUFFER_FORMAT_IYUV_PL NV_ENC_BUFFER_FORMAT_IYUV
439#define NV_ENC_BUFFER_FORMAT_YUV444_PL NV_ENC_BUFFER_FORMAT_YUV444
440
441/**
442 * Encoding levels
443 */
444typedef enum _NV_ENC_LEVEL
445{
446 NV_ENC_LEVEL_AUTOSELECT = 0,
447
448 NV_ENC_LEVEL_H264_1 = 10,
449 NV_ENC_LEVEL_H264_1b = 9,
450 NV_ENC_LEVEL_H264_11 = 11,
451 NV_ENC_LEVEL_H264_12 = 12,
452 NV_ENC_LEVEL_H264_13 = 13,
453 NV_ENC_LEVEL_H264_2 = 20,
454 NV_ENC_LEVEL_H264_21 = 21,
455 NV_ENC_LEVEL_H264_22 = 22,
456 NV_ENC_LEVEL_H264_3 = 30,
457 NV_ENC_LEVEL_H264_31 = 31,
458 NV_ENC_LEVEL_H264_32 = 32,
459 NV_ENC_LEVEL_H264_4 = 40,
460 NV_ENC_LEVEL_H264_41 = 41,
461 NV_ENC_LEVEL_H264_42 = 42,
462 NV_ENC_LEVEL_H264_5 = 50,
463 NV_ENC_LEVEL_H264_51 = 51,
464 NV_ENC_LEVEL_H264_52 = 52,
465 NV_ENC_LEVEL_H264_60 = 60,
466 NV_ENC_LEVEL_H264_61 = 61,
467 NV_ENC_LEVEL_H264_62 = 62,
468
469 NV_ENC_LEVEL_HEVC_1 = 30,
470 NV_ENC_LEVEL_HEVC_2 = 60,
471 NV_ENC_LEVEL_HEVC_21 = 63,
472 NV_ENC_LEVEL_HEVC_3 = 90,
473 NV_ENC_LEVEL_HEVC_31 = 93,
474 NV_ENC_LEVEL_HEVC_4 = 120,
475 NV_ENC_LEVEL_HEVC_41 = 123,
476 NV_ENC_LEVEL_HEVC_5 = 150,
477 NV_ENC_LEVEL_HEVC_51 = 153,
478 NV_ENC_LEVEL_HEVC_52 = 156,
479 NV_ENC_LEVEL_HEVC_6 = 180,
480 NV_ENC_LEVEL_HEVC_61 = 183,
481 NV_ENC_LEVEL_HEVC_62 = 186,
482
483 NV_ENC_TIER_HEVC_MAIN = 0,
484 NV_ENC_TIER_HEVC_HIGH = 1,
485
486 NV_ENC_LEVEL_AV1_2 = 0,
487 NV_ENC_LEVEL_AV1_21 = 1,
488 NV_ENC_LEVEL_AV1_22 = 2,
489 NV_ENC_LEVEL_AV1_23 = 3,
490 NV_ENC_LEVEL_AV1_3 = 4,
491 NV_ENC_LEVEL_AV1_31 = 5,
492 NV_ENC_LEVEL_AV1_32 = 6,
493 NV_ENC_LEVEL_AV1_33 = 7,
494 NV_ENC_LEVEL_AV1_4 = 8,
495 NV_ENC_LEVEL_AV1_41 = 9,
496 NV_ENC_LEVEL_AV1_42 = 10,
497 NV_ENC_LEVEL_AV1_43 = 11,
498 NV_ENC_LEVEL_AV1_5 = 12,
499 NV_ENC_LEVEL_AV1_51 = 13,
500 NV_ENC_LEVEL_AV1_52 = 14,
501 NV_ENC_LEVEL_AV1_53 = 15,
502 NV_ENC_LEVEL_AV1_6 = 16,
503 NV_ENC_LEVEL_AV1_61 = 17,
504 NV_ENC_LEVEL_AV1_62 = 18,
505 NV_ENC_LEVEL_AV1_63 = 19,
506 NV_ENC_LEVEL_AV1_7 = 20,
507 NV_ENC_LEVEL_AV1_71 = 21,
508 NV_ENC_LEVEL_AV1_72 = 22,
509 NV_ENC_LEVEL_AV1_73 = 23,
510 NV_ENC_LEVEL_AV1_AUTOSELECT ,
511
512 NV_ENC_TIER_AV1_0 = 0,
513 NV_ENC_TIER_AV1_1 = 1
514} NV_ENC_LEVEL;
515
516/**
517 * Error Codes
518 */
519typedef enum _NVENCSTATUS
520{
521 /**
522 * This indicates that API call returned with no errors.
523 */
524 NV_ENC_SUCCESS,
525
526 /**
527 * This indicates that no encode capable devices were detected.
528 */
529 NV_ENC_ERR_NO_ENCODE_DEVICE,
530
531 /**
532 * This indicates that devices pass by the client is not supported.
533 */
534 NV_ENC_ERR_UNSUPPORTED_DEVICE,
535
536 /**
537 * This indicates that the encoder device supplied by the client is not
538 * valid.
539 */
540 NV_ENC_ERR_INVALID_ENCODERDEVICE,
541
542 /**
543 * This indicates that device passed to the API call is invalid.
544 */
545 NV_ENC_ERR_INVALID_DEVICE,
546
547 /**
548 * This indicates that device passed to the API call is no longer available and
549 * needs to be reinitialized. The clients need to destroy the current encoder
550 * session by freeing the allocated input output buffers and destroying the device
551 * and create a new encoding session.
552 */
553 NV_ENC_ERR_DEVICE_NOT_EXIST,
554
555 /**
556 * This indicates that one or more of the pointers passed to the API call
557 * is invalid.
558 */
559 NV_ENC_ERR_INVALID_PTR,
560
561 /**
562 * This indicates that completion event passed in ::NvEncEncodePicture() call
563 * is invalid.
564 */
565 NV_ENC_ERR_INVALID_EVENT,
566
567 /**
568 * This indicates that one or more of the parameter passed to the API call
569 * is invalid.
570 */
571 NV_ENC_ERR_INVALID_PARAM,
572
573 /**
574 * This indicates that an API call was made in wrong sequence/order.
575 */
576 NV_ENC_ERR_INVALID_CALL,
577
578 /**
579 * This indicates that the API call failed because it was unable to allocate
580 * enough memory to perform the requested operation.
581 */
582 NV_ENC_ERR_OUT_OF_MEMORY,
583
584 /**
585 * This indicates that the encoder has not been initialized with
586 * ::NvEncInitializeEncoder() or that initialization has failed.
587 * The client cannot allocate input or output buffers or do any encoding
588 * related operation before successfully initializing the encoder.
589 */
590 NV_ENC_ERR_ENCODER_NOT_INITIALIZED,
591
592 /**
593 * This indicates that an unsupported parameter was passed by the client.
594 */
595 NV_ENC_ERR_UNSUPPORTED_PARAM,
596
597 /**
598 * This indicates that the ::NvEncLockBitstream() failed to lock the output
599 * buffer. This happens when the client makes a non blocking lock call to
600 * access the output bitstream by passing NV_ENC_LOCK_BITSTREAM::doNotWait flag.
601 * This is not a fatal error and client should retry the same operation after
602 * few milliseconds.
603 */
604 NV_ENC_ERR_LOCK_BUSY,
605
606 /**
607 * This indicates that the size of the user buffer passed by the client is
608 * insufficient for the requested operation.
609 */
610 NV_ENC_ERR_NOT_ENOUGH_BUFFER,
611
612 /**
613 * This indicates that an invalid struct version was used by the client.
614 */
615 NV_ENC_ERR_INVALID_VERSION,
616
617 /**
618 * This indicates that ::NvEncMapInputResource() API failed to map the client
619 * provided input resource.
620 */
621 NV_ENC_ERR_MAP_FAILED,
622
623 /**
624 * This indicates encode driver requires more input buffers to produce an output
625 * bitstream. If this error is returned from ::NvEncEncodePicture() API, this
626 * is not a fatal error. If the client is encoding with B frames then,
627 * ::NvEncEncodePicture() API might be buffering the input frame for re-ordering.
628 *
629 * A client operating in synchronous mode cannot call ::NvEncLockBitstream()
630 * API on the output bitstream buffer if ::NvEncEncodePicture() returned the
631 * ::NV_ENC_ERR_NEED_MORE_INPUT error code.
632 * The client must continue providing input frames until encode driver returns
633 * ::NV_ENC_SUCCESS. After receiving ::NV_ENC_SUCCESS status the client can call
634 * ::NvEncLockBitstream() API on the output buffers in the same order in which
635 * it has called ::NvEncEncodePicture().
636 */
637 NV_ENC_ERR_NEED_MORE_INPUT,
638
639 /**
640 * This indicates that the HW encoder is busy encoding and is unable to encode
641 * the input. The client should call ::NvEncEncodePicture() again after few
642 * milliseconds.
643 */
644 NV_ENC_ERR_ENCODER_BUSY,
645
646 /**
647 * This indicates that the completion event passed in ::NvEncEncodePicture()
648 * API has not been registered with encoder driver using ::NvEncRegisterAsyncEvent().
649 */
650 NV_ENC_ERR_EVENT_NOT_REGISTERD,
651
652 /**
653 * This indicates that an unknown internal error has occurred.
654 */
655 NV_ENC_ERR_GENERIC,
656
657 /**
658 * This indicates that the client is attempting to use a feature
659 * that is not available for the license type for the current system.
660 */
661 NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY,
662
663 /**
664 * This indicates that the client is attempting to use a feature
665 * that is not implemented for the current version.
666 */
667 NV_ENC_ERR_UNIMPLEMENTED,
668
669 /**
670 * This indicates that the ::NvEncRegisterResource API failed to register the resource.
671 */
672 NV_ENC_ERR_RESOURCE_REGISTER_FAILED,
673
674 /**
675 * This indicates that the client is attempting to unregister a resource
676 * that has not been successfully registered.
677 */
678 NV_ENC_ERR_RESOURCE_NOT_REGISTERED,
679
680 /**
681 * This indicates that the client is attempting to unmap a resource
682 * that has not been successfully mapped.
683 */
684 NV_ENC_ERR_RESOURCE_NOT_MAPPED,
685
686} NVENCSTATUS;
687
688/**
689 * Encode Picture encode flags.
690 */
691typedef enum _NV_ENC_PIC_FLAGS
692{
693 NV_ENC_PIC_FLAG_FORCEINTRA = 0x1, /**< Encode the current picture as an Intra picture */
694 NV_ENC_PIC_FLAG_FORCEIDR = 0x2, /**< Encode the current picture as an IDR picture.
695 This flag is only valid when Picture type decision is taken by the Encoder
696 [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */
697 NV_ENC_PIC_FLAG_OUTPUT_SPSPPS = 0x4, /**< Write the sequence and picture header in encoded bitstream of the current picture */
698 NV_ENC_PIC_FLAG_EOS = 0x8, /**< Indicates end of the input stream */
699} NV_ENC_PIC_FLAGS;
700
701/**
702 * Memory heap to allocate input and output buffers.
703 */
704typedef enum _NV_ENC_MEMORY_HEAP
705{
706 NV_ENC_MEMORY_HEAP_AUTOSELECT = 0, /**< Memory heap to be decided by the encoder driver based on the usage */
707 NV_ENC_MEMORY_HEAP_VID = 1, /**< Memory heap is in local video memory */
708 NV_ENC_MEMORY_HEAP_SYSMEM_CACHED = 2, /**< Memory heap is in cached system memory */
709 NV_ENC_MEMORY_HEAP_SYSMEM_UNCACHED = 3 /**< Memory heap is in uncached system memory */
710} NV_ENC_MEMORY_HEAP;
711
712/**
713 * B-frame used as reference modes
714 */
715typedef enum _NV_ENC_BFRAME_REF_MODE
716{
717 NV_ENC_BFRAME_REF_MODE_DISABLED = 0x0, /**< B frame is not used for reference */
718 NV_ENC_BFRAME_REF_MODE_EACH = 0x1, /**< Each B-frame will be used for reference */
719 NV_ENC_BFRAME_REF_MODE_MIDDLE = 0x2, /**< Only(Number of B-frame)/2 th B-frame will be used for reference */
720} NV_ENC_BFRAME_REF_MODE;
721
722/**
723 * H.264 entropy coding modes.
724 */
725typedef enum _NV_ENC_H264_ENTROPY_CODING_MODE
726{
727 NV_ENC_H264_ENTROPY_CODING_MODE_AUTOSELECT = 0x0, /**< Entropy coding mode is auto selected by the encoder driver */
728 NV_ENC_H264_ENTROPY_CODING_MODE_CABAC = 0x1, /**< Entropy coding mode is CABAC */
729 NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC = 0x2 /**< Entropy coding mode is CAVLC */
730} NV_ENC_H264_ENTROPY_CODING_MODE;
731
732/**
733 * H.264 specific BDirect modes
734 */
735typedef enum _NV_ENC_H264_BDIRECT_MODE
736{
737 NV_ENC_H264_BDIRECT_MODE_AUTOSELECT = 0x0, /**< BDirect mode is auto selected by the encoder driver */
738 NV_ENC_H264_BDIRECT_MODE_DISABLE = 0x1, /**< Disable BDirect mode */
739 NV_ENC_H264_BDIRECT_MODE_TEMPORAL = 0x2, /**< Temporal BDirect mode */
740 NV_ENC_H264_BDIRECT_MODE_SPATIAL = 0x3 /**< Spatial BDirect mode */
741} NV_ENC_H264_BDIRECT_MODE;
742
743/**
744 * H.264 specific FMO usage
745 */
746typedef enum _NV_ENC_H264_FMO_MODE
747{
748 NV_ENC_H264_FMO_AUTOSELECT = 0x0, /**< FMO usage is auto selected by the encoder driver */
749 NV_ENC_H264_FMO_ENABLE = 0x1, /**< Enable FMO */
750 NV_ENC_H264_FMO_DISABLE = 0x2, /**< Disable FMO */
751} NV_ENC_H264_FMO_MODE;
752
753/**
754 * H.264 specific Adaptive Transform modes
755 */
756typedef enum _NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE
757{
758 NV_ENC_H264_ADAPTIVE_TRANSFORM_AUTOSELECT = 0x0, /**< Adaptive Transform 8x8 mode is auto selected by the encoder driver*/
759 NV_ENC_H264_ADAPTIVE_TRANSFORM_DISABLE = 0x1, /**< Adaptive Transform 8x8 mode disabled */
760 NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE = 0x2, /**< Adaptive Transform 8x8 mode should be used */
761} NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE;
762
763/**
764 * Stereo frame packing modes.
765 */
766typedef enum _NV_ENC_STEREO_PACKING_MODE
767{
768 NV_ENC_STEREO_PACKING_MODE_NONE = 0x0, /**< No Stereo packing required */
769 NV_ENC_STEREO_PACKING_MODE_CHECKERBOARD = 0x1, /**< Checkerboard mode for packing stereo frames */
770 NV_ENC_STEREO_PACKING_MODE_COLINTERLEAVE = 0x2, /**< Column Interleave mode for packing stereo frames */
771 NV_ENC_STEREO_PACKING_MODE_ROWINTERLEAVE = 0x3, /**< Row Interleave mode for packing stereo frames */
772 NV_ENC_STEREO_PACKING_MODE_SIDEBYSIDE = 0x4, /**< Side-by-side mode for packing stereo frames */
773 NV_ENC_STEREO_PACKING_MODE_TOPBOTTOM = 0x5, /**< Top-Bottom mode for packing stereo frames */
774 NV_ENC_STEREO_PACKING_MODE_FRAMESEQ = 0x6 /**< Frame Sequential mode for packing stereo frames */
775} NV_ENC_STEREO_PACKING_MODE;
776
777/**
778 * Input Resource type
779 */
780typedef enum _NV_ENC_INPUT_RESOURCE_TYPE
781{
782 NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX = 0x0, /**< input resource type is a directx9 surface*/
783 NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR = 0x1, /**< input resource type is a cuda device pointer surface*/
784 NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY = 0x2, /**< input resource type is a cuda array surface.
785 This array must be a 2D array and the CUDA_ARRAY3D_SURFACE_LDST
786 flag must have been specified when creating it. */
787 NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX = 0x3 /**< input resource type is an OpenGL texture */
788} NV_ENC_INPUT_RESOURCE_TYPE;
789
790/**
791 * Buffer usage
792 */
793typedef enum _NV_ENC_BUFFER_USAGE
794{
795 NV_ENC_INPUT_IMAGE = 0x0, /**< Registered surface will be used for input image */
796 NV_ENC_OUTPUT_MOTION_VECTOR = 0x1, /**< Registered surface will be used for output of H.264 ME only mode.
797 This buffer usage type is not supported for HEVC ME only mode. */
798 NV_ENC_OUTPUT_BITSTREAM = 0x2, /**< Registered surface will be used for output bitstream in encoding */
799} NV_ENC_BUFFER_USAGE;
800
801/**
802 * Encoder Device type
803 */
804typedef enum _NV_ENC_DEVICE_TYPE
805{
806 NV_ENC_DEVICE_TYPE_DIRECTX = 0x0, /**< encode device type is a directx9 device */
807 NV_ENC_DEVICE_TYPE_CUDA = 0x1, /**< encode device type is a cuda device */
808 NV_ENC_DEVICE_TYPE_OPENGL = 0x2 /**< encode device type is an OpenGL device.
809 Use of this device type is supported only on Linux */
810} NV_ENC_DEVICE_TYPE;
811
812/**
813 * Number of reference frames
814 */
815typedef enum _NV_ENC_NUM_REF_FRAMES
816{
817 NV_ENC_NUM_REF_FRAMES_AUTOSELECT = 0x0, /**< Number of reference frames is auto selected by the encoder driver */
818 NV_ENC_NUM_REF_FRAMES_1 = 0x1, /**< Number of reference frames equal to 1 */
819 NV_ENC_NUM_REF_FRAMES_2 = 0x2, /**< Number of reference frames equal to 2 */
820 NV_ENC_NUM_REF_FRAMES_3 = 0x3, /**< Number of reference frames equal to 3 */
821 NV_ENC_NUM_REF_FRAMES_4 = 0x4, /**< Number of reference frames equal to 4 */
822 NV_ENC_NUM_REF_FRAMES_5 = 0x5, /**< Number of reference frames equal to 5 */
823 NV_ENC_NUM_REF_FRAMES_6 = 0x6, /**< Number of reference frames equal to 6 */
824 NV_ENC_NUM_REF_FRAMES_7 = 0x7 /**< Number of reference frames equal to 7 */
825} NV_ENC_NUM_REF_FRAMES;
826
827/**
828 * Encoder capabilities enumeration.
829 */
830typedef enum _NV_ENC_CAPS
831{
832 /**
833 * Maximum number of B-Frames supported.
834 */
835 NV_ENC_CAPS_NUM_MAX_BFRAMES,
836
837 /**
838 * Rate control modes supported.
839 * \n The API return value is a bitmask of the values in NV_ENC_PARAMS_RC_MODE.
840 */
841 NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES,
842
843 /**
844 * Indicates HW support for field mode encoding.
845 * \n 0 : Interlaced mode encoding is not supported.
846 * \n 1 : Interlaced field mode encoding is supported.
847 * \n 2 : Interlaced frame encoding and field mode encoding are both supported.
848 */
849 NV_ENC_CAPS_SUPPORT_FIELD_ENCODING,
850
851 /**
852 * Indicates HW support for monochrome mode encoding.
853 * \n 0 : Monochrome mode not supported.
854 * \n 1 : Monochrome mode supported.
855 */
856 NV_ENC_CAPS_SUPPORT_MONOCHROME,
857
858 /**
859 * Indicates HW support for FMO.
860 * \n 0 : FMO not supported.
861 * \n 1 : FMO supported.
862 */
863 NV_ENC_CAPS_SUPPORT_FMO,
864
865 /**
866 * Indicates HW capability for Quarter pel motion estimation.
867 * \n 0 : Quarter-Pel Motion Estimation not supported.
868 * \n 1 : Quarter-Pel Motion Estimation supported.
869 */
870 NV_ENC_CAPS_SUPPORT_QPELMV,
871
872 /**
873 * H.264 specific. Indicates HW support for BDirect modes.
874 * \n 0 : BDirect mode encoding not supported.
875 * \n 1 : BDirect mode encoding supported.
876 */
877 NV_ENC_CAPS_SUPPORT_BDIRECT_MODE,
878
879 /**
880 * H264 specific. Indicates HW support for CABAC entropy coding mode.
881 * \n 0 : CABAC entropy coding not supported.
882 * \n 1 : CABAC entropy coding supported.
883 */
884 NV_ENC_CAPS_SUPPORT_CABAC,
885
886 /**
887 * Indicates HW support for Adaptive Transform.
888 * \n 0 : Adaptive Transform not supported.
889 * \n 1 : Adaptive Transform supported.
890 */
891 NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM,
892
893 /**
894 * Indicates HW support for Multi View Coding.
895 * \n 0 : Multi View Coding not supported.
896 * \n 1 : Multi View Coding supported.
897 */
898 NV_ENC_CAPS_SUPPORT_STEREO_MVC,
899
900 /**
901 * Indicates HW support for encoding Temporal layers.
902 * \n 0 : Encoding Temporal layers not supported.
903 * \n 1 : Encoding Temporal layers supported.
904 */
905 NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS,
906
907 /**
908 * Indicates HW support for Hierarchical P frames.
909 * \n 0 : Hierarchical P frames not supported.
910 * \n 1 : Hierarchical P frames supported.
911 */
912 NV_ENC_CAPS_SUPPORT_HIERARCHICAL_PFRAMES,
913
914 /**
915 * Indicates HW support for Hierarchical B frames.
916 * \n 0 : Hierarchical B frames not supported.
917 * \n 1 : Hierarchical B frames supported.
918 */
919 NV_ENC_CAPS_SUPPORT_HIERARCHICAL_BFRAMES,
920
921 /**
922 * Maximum Encoding level supported (See ::NV_ENC_LEVEL for details).
923 */
924 NV_ENC_CAPS_LEVEL_MAX,
925
926 /**
927 * Minimum Encoding level supported (See ::NV_ENC_LEVEL for details).
928 */
929 NV_ENC_CAPS_LEVEL_MIN,
930
931 /**
932 * Indicates HW support for separate colour plane encoding.
933 * \n 0 : Separate colour plane encoding not supported.
934 * \n 1 : Separate colour plane encoding supported.
935 */
936 NV_ENC_CAPS_SEPARATE_COLOUR_PLANE,
937
938 /**
939 * Maximum output width supported.
940 */
941 NV_ENC_CAPS_WIDTH_MAX,
942
943 /**
944 * Maximum output height supported.
945 */
946 NV_ENC_CAPS_HEIGHT_MAX,
947
948 /**
949 * Indicates Temporal Scalability Support.
950 * \n 0 : Temporal SVC encoding not supported.
951 * \n 1 : Temporal SVC encoding supported.
952 */
953 NV_ENC_CAPS_SUPPORT_TEMPORAL_SVC,
954
955 /**
956 * Indicates Dynamic Encode Resolution Change Support.
957 * Support added from NvEncodeAPI version 2.0.
958 * \n 0 : Dynamic Encode Resolution Change not supported.
959 * \n 1 : Dynamic Encode Resolution Change supported.
960 */
961 NV_ENC_CAPS_SUPPORT_DYN_RES_CHANGE,
962
963 /**
964 * Indicates Dynamic Encode Bitrate Change Support.
965 * Support added from NvEncodeAPI version 2.0.
966 * \n 0 : Dynamic Encode bitrate change not supported.
967 * \n 1 : Dynamic Encode bitrate change supported.
968 */
969 NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE,
970
971 /**
972 * Indicates Forcing Constant QP On The Fly Support.
973 * Support added from NvEncodeAPI version 2.0.
974 * \n 0 : Forcing constant QP on the fly not supported.
975 * \n 1 : Forcing constant QP on the fly supported.
976 */
977 NV_ENC_CAPS_SUPPORT_DYN_FORCE_CONSTQP,
978
979 /**
980 * Indicates Dynamic rate control mode Change Support.
981 * \n 0 : Dynamic rate control mode change not supported.
982 * \n 1 : Dynamic rate control mode change supported.
983 */
984 NV_ENC_CAPS_SUPPORT_DYN_RCMODE_CHANGE,
985
986 /**
987 * Indicates Subframe readback support for slice-based encoding. If this feature is supported, it can be enabled by setting enableSubFrameWrite = 1.
988 * \n 0 : Subframe readback not supported.
989 * \n 1 : Subframe readback supported.
990 */
991 NV_ENC_CAPS_SUPPORT_SUBFRAME_READBACK,
992
993 /**
994 * Indicates Constrained Encoding mode support.
995 * Support added from NvEncodeAPI version 2.0.
996 * \n 0 : Constrained encoding mode not supported.
997 * \n 1 : Constrained encoding mode supported.
998 * If this mode is supported client can enable this during initialization.
999 * Client can then force a picture to be coded as constrained picture where
1000 * in-loop filtering is disabled across slice boundaries and prediction vectors for inter
1001 * macroblocks in each slice will be restricted to the slice region.
1002 */
1003 NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING,
1004
1005 /**
1006 * Indicates Intra Refresh Mode Support.
1007 * Support added from NvEncodeAPI version 2.0.
1008 * \n 0 : Intra Refresh Mode not supported.
1009 * \n 1 : Intra Refresh Mode supported.
1010 */
1011 NV_ENC_CAPS_SUPPORT_INTRA_REFRESH,
1012
1013 /**
1014 * Indicates Custom VBV Buffer Size support. It can be used for capping frame size.
1015 * Support added from NvEncodeAPI version 2.0.
1016 * \n 0 : Custom VBV buffer size specification from client, not supported.
1017 * \n 1 : Custom VBV buffer size specification from client, supported.
1018 */
1019 NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE,
1020
1021 /**
1022 * Indicates Dynamic Slice Mode Support.
1023 * Support added from NvEncodeAPI version 2.0.
1024 * \n 0 : Dynamic Slice Mode not supported.
1025 * \n 1 : Dynamic Slice Mode supported.
1026 */
1027 NV_ENC_CAPS_SUPPORT_DYNAMIC_SLICE_MODE,
1028
1029 /**
1030 * Indicates Reference Picture Invalidation Support.
1031 * Support added from NvEncodeAPI version 2.0.
1032 * \n 0 : Reference Picture Invalidation not supported.
1033 * \n 1 : Reference Picture Invalidation supported.
1034 */
1035 NV_ENC_CAPS_SUPPORT_REF_PIC_INVALIDATION,
1036
1037 /**
1038 * Indicates support for Pre-Processing.
1039 * The API return value is a bitmask of the values defined in ::NV_ENC_PREPROC_FLAGS
1040 */
1041 NV_ENC_CAPS_PREPROC_SUPPORT,
1042
1043 /**
1044 * Indicates support Async mode.
1045 * \n 0 : Async Encode mode not supported.
1046 * \n 1 : Async Encode mode supported.
1047 */
1048 NV_ENC_CAPS_ASYNC_ENCODE_SUPPORT,
1049
1050 /**
1051 * Maximum MBs per frame supported.
1052 */
1053 NV_ENC_CAPS_MB_NUM_MAX,
1054
1055 /**
1056 * Maximum aggregate throughput in MBs per sec.
1057 */
1058 NV_ENC_CAPS_MB_PER_SEC_MAX,
1059
1060 /**
1061 * Indicates HW support for YUV444 mode encoding.
1062 * \n 0 : YUV444 mode encoding not supported.
1063 * \n 1 : YUV444 mode encoding supported.
1064 */
1065 NV_ENC_CAPS_SUPPORT_YUV444_ENCODE,
1066
1067 /**
1068 * Indicates HW support for lossless encoding.
1069 * \n 0 : lossless encoding not supported.
1070 * \n 1 : lossless encoding supported.
1071 */
1072 NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE,
1073
1074 /**
1075 * Indicates HW support for Sample Adaptive Offset.
1076 * \n 0 : SAO not supported.
1077 * \n 1 : SAO encoding supported.
1078 */
1079 NV_ENC_CAPS_SUPPORT_SAO,
1080
1081 /**
1082 * Indicates HW support for Motion Estimation Only Mode.
1083 * \n 0 : MEOnly Mode not supported.
1084 * \n 1 : MEOnly Mode supported for I and P frames.
1085 * \n 2 : MEOnly Mode supported for I, P and B frames.
1086 */
1087 NV_ENC_CAPS_SUPPORT_MEONLY_MODE,
1088
1089 /**
1090 * Indicates HW support for lookahead encoding (enableLookahead=1).
1091 * \n 0 : Lookahead not supported.
1092 * \n 1 : Lookahead supported.
1093 */
1094 NV_ENC_CAPS_SUPPORT_LOOKAHEAD,
1095
1096 /**
1097 * Indicates HW support for temporal AQ encoding (enableTemporalAQ=1).
1098 * \n 0 : Temporal AQ not supported.
1099 * \n 1 : Temporal AQ supported.
1100 */
1101 NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ,
1102 /**
1103 * Indicates HW support for 10 bit encoding.
1104 * \n 0 : 10 bit encoding not supported.
1105 * \n 1 : 10 bit encoding supported.
1106 */
1107 NV_ENC_CAPS_SUPPORT_10BIT_ENCODE,
1108 /**
1109 * Maximum number of Long Term Reference frames supported
1110 */
1111 NV_ENC_CAPS_NUM_MAX_LTR_FRAMES,
1112
1113 /**
1114 * Indicates HW support for Weighted Prediction.
1115 * \n 0 : Weighted Prediction not supported.
1116 * \n 1 : Weighted Prediction supported.
1117 */
1118 NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION,
1119
1120
1121 /**
1122 * On managed (vGPU) platforms (Windows only), this API, in conjunction with other GRID Management APIs, can be used
1123 * to estimate the residual capacity of the hardware encoder on the GPU as a percentage of the total available encoder capacity.
1124 * This API can be called at any time; i.e. during the encode session or before opening the encode session.
1125 * If the available encoder capacity is returned as zero, applications may choose to switch to software encoding
1126 * and continue to call this API (e.g. polling once per second) until capacity becomes available.
1127 *
1128 * On bare metal (non-virtualized GPU) and linux platforms, this API always returns 100.
1129 */
1130 NV_ENC_CAPS_DYNAMIC_QUERY_ENCODER_CAPACITY,
1131
1132 /**
1133 * Indicates B as reference support.
1134 * \n 0 : B as reference is not supported.
1135 * \n 1 : each B-Frame as reference is supported.
1136 * \n 2 : only Middle B-frame as reference is supported.
1137 */
1138 NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE,
1139
1140 /**
1141 * Indicates HW support for Emphasis Level Map based delta QP computation.
1142 * \n 0 : Emphasis Level Map based delta QP not supported.
1143 * \n 1 : Emphasis Level Map based delta QP is supported.
1144 */
1145 NV_ENC_CAPS_SUPPORT_EMPHASIS_LEVEL_MAP,
1146
1147 /**
1148 * Minimum input width supported.
1149 */
1150 NV_ENC_CAPS_WIDTH_MIN,
1151
1152 /**
1153 * Minimum input height supported.
1154 */
1155 NV_ENC_CAPS_HEIGHT_MIN,
1156
1157 /**
1158 * Indicates HW support for multiple reference frames.
1159 */
1160 NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES,
1161
1162 /**
1163 * Indicates HW support for HEVC with alpha encoding.
1164 * \n 0 : HEVC with alpha encoding not supported.
1165 * \n 1 : HEVC with alpha encoding is supported.
1166 */
1167 NV_ENC_CAPS_SUPPORT_ALPHA_LAYER_ENCODING,
1168
1169 /**
1170 * Indicates number of Encoding engines present on GPU.
1171 */
1172 NV_ENC_CAPS_NUM_ENCODER_ENGINES,
1173
1174 /**
1175 * Indicates single slice intra refresh support.
1176 */
1177 NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH,
1178
1179 /**
1180 * Reserved - Not to be used by clients.
1181 */
1182 NV_ENC_CAPS_EXPOSED_COUNT
1183
1184} NV_ENC_CAPS;
1185
1186/**
1187 * HEVC CU SIZE
1188 */
1189typedef enum _NV_ENC_HEVC_CUSIZE
1190{
1191 NV_ENC_HEVC_CUSIZE_AUTOSELECT = 0,
1192 NV_ENC_HEVC_CUSIZE_8x8 = 1,
1193 NV_ENC_HEVC_CUSIZE_16x16 = 2,
1194 NV_ENC_HEVC_CUSIZE_32x32 = 3,
1195 NV_ENC_HEVC_CUSIZE_64x64 = 4,
1196}NV_ENC_HEVC_CUSIZE;
1197
1198/**
1199* AV1 PART SIZE
1200*/
1201typedef enum _NV_ENC_AV1_PART_SIZE
1202{
1203 NV_ENC_AV1_PART_SIZE_AUTOSELECT = 0,
1204 NV_ENC_AV1_PART_SIZE_4x4 = 1,
1205 NV_ENC_AV1_PART_SIZE_8x8 = 2,
1206 NV_ENC_AV1_PART_SIZE_16x16 = 3,
1207 NV_ENC_AV1_PART_SIZE_32x32 = 4,
1208 NV_ENC_AV1_PART_SIZE_64x64 = 5,
1209}NV_ENC_AV1_PART_SIZE;
1210
1211/**
1212* Enums related to fields in VUI parameters.
1213*/
1214typedef enum _NV_ENC_VUI_VIDEO_FORMAT
1215{
1216 NV_ENC_VUI_VIDEO_FORMAT_COMPONENT = 0,
1217 NV_ENC_VUI_VIDEO_FORMAT_PAL = 1,
1218 NV_ENC_VUI_VIDEO_FORMAT_NTSC = 2,
1219 NV_ENC_VUI_VIDEO_FORMAT_SECAM = 3,
1220 NV_ENC_VUI_VIDEO_FORMAT_MAC = 4,
1221 NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED = 5,
1222}NV_ENC_VUI_VIDEO_FORMAT;
1223
1224typedef enum _NV_ENC_VUI_COLOR_PRIMARIES
1225{
1226 NV_ENC_VUI_COLOR_PRIMARIES_UNDEFINED = 0,
1227 NV_ENC_VUI_COLOR_PRIMARIES_BT709 = 1,
1228 NV_ENC_VUI_COLOR_PRIMARIES_UNSPECIFIED = 2,
1229 NV_ENC_VUI_COLOR_PRIMARIES_RESERVED = 3,
1230 NV_ENC_VUI_COLOR_PRIMARIES_BT470M = 4,
1231 NV_ENC_VUI_COLOR_PRIMARIES_BT470BG = 5,
1232 NV_ENC_VUI_COLOR_PRIMARIES_SMPTE170M = 6,
1233 NV_ENC_VUI_COLOR_PRIMARIES_SMPTE240M = 7,
1234 NV_ENC_VUI_COLOR_PRIMARIES_FILM = 8,
1235 NV_ENC_VUI_COLOR_PRIMARIES_BT2020 = 9,
1236 NV_ENC_VUI_COLOR_PRIMARIES_SMPTE428 = 10,
1237 NV_ENC_VUI_COLOR_PRIMARIES_SMPTE431 = 11,
1238 NV_ENC_VUI_COLOR_PRIMARIES_SMPTE432 = 12,
1239 NV_ENC_VUI_COLOR_PRIMARIES_JEDEC_P22 = 22,
1240}NV_ENC_VUI_COLOR_PRIMARIES;
1241
1242typedef enum _NV_ENC_VUI_TRANSFER_CHARACTERISTIC
1243{
1244 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_UNDEFINED = 0,
1245 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT709 = 1,
1246 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
1247 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_RESERVED = 3,
1248 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT470M = 4,
1249 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT470BG = 5,
1250 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE170M = 6,
1251 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE240M = 7,
1252 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LINEAR = 8,
1253 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LOG = 9,
1254 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,
1255 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_IEC61966_2_4 = 11,
1256 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT1361_ECG = 12,
1257 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SRGB = 13,
1258 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT2020_10 = 14,
1259 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT2020_12 = 15,
1260 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE2084 = 16,
1261 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE428 = 17,
1262 NV_ENC_VUI_TRANSFER_CHARACTERISTIC_ARIB_STD_B67 = 18,
1263}NV_ENC_VUI_TRANSFER_CHARACTERISTIC;
1264
1265typedef enum _NV_ENC_VUI_MATRIX_COEFFS
1266{
1267 NV_ENC_VUI_MATRIX_COEFFS_RGB = 0,
1268 NV_ENC_VUI_MATRIX_COEFFS_BT709 = 1,
1269 NV_ENC_VUI_MATRIX_COEFFS_UNSPECIFIED = 2,
1270 NV_ENC_VUI_MATRIX_COEFFS_RESERVED = 3,
1271 NV_ENC_VUI_MATRIX_COEFFS_FCC = 4,
1272 NV_ENC_VUI_MATRIX_COEFFS_BT470BG = 5,
1273 NV_ENC_VUI_MATRIX_COEFFS_SMPTE170M = 6,
1274 NV_ENC_VUI_MATRIX_COEFFS_SMPTE240M = 7,
1275 NV_ENC_VUI_MATRIX_COEFFS_YCGCO = 8,
1276 NV_ENC_VUI_MATRIX_COEFFS_BT2020_NCL = 9,
1277 NV_ENC_VUI_MATRIX_COEFFS_BT2020_CL = 10,
1278 NV_ENC_VUI_MATRIX_COEFFS_SMPTE2085 = 11,
1279}NV_ENC_VUI_MATRIX_COEFFS;
1280
1281/**
1282 * Input struct for querying Encoding capabilities.
1283 */
1284typedef struct _NV_ENC_CAPS_PARAM
1285{
1286 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CAPS_PARAM_VER */
1287 NV_ENC_CAPS capsToQuery; /**< [in]: Specifies the encode capability to be queried. Client should pass a member for ::NV_ENC_CAPS enum. */
1288 uint32_t reserved[62]; /**< [in]: Reserved and must be set to 0 */
1289} NV_ENC_CAPS_PARAM;
1290
1291/** NV_ENC_CAPS_PARAM struct version. */
1292#define NV_ENC_CAPS_PARAM_VER NVENCAPI_STRUCT_VERSION(1)
1293
1294
1295/**
1296 * Encoder Output parameters
1297 */
1298typedef struct _NV_ENC_ENCODE_OUT_PARAMS
1299{
1300 uint32_t version; /**< [out]: Struct version. */
1301 uint32_t bitstreamSizeInBytes; /**< [out]: Encoded bitstream size in bytes */
1302 uint32_t reserved[62]; /**< [out]: Reserved and must be set to 0 */
1303} NV_ENC_ENCODE_OUT_PARAMS;
1304
1305/** NV_ENC_ENCODE_OUT_PARAMS struct version. */
1306#define NV_ENC_ENCODE_OUT_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
1307
1308/**
1309 * Creation parameters for input buffer.
1310 */
1311typedef struct _NV_ENC_CREATE_INPUT_BUFFER
1312{
1313 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_INPUT_BUFFER_VER */
1314 uint32_t width; /**< [in]: Input frame width */
1315 uint32_t height; /**< [in]: Input frame height */
1316 NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */
1317 NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Input buffer format */
1318 uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
1319 NV_ENC_INPUT_PTR inputBuffer; /**< [out]: Pointer to input buffer */
1320 void* pSysMemBuffer; /**< [in]: Pointer to existing system memory buffer */
1321 uint32_t reserved1[57]; /**< [in]: Reserved and must be set to 0 */
1322 void* reserved2[63]; /**< [in]: Reserved and must be set to NULL */
1323} NV_ENC_CREATE_INPUT_BUFFER;
1324
1325/** NV_ENC_CREATE_INPUT_BUFFER struct version. */
1326#define NV_ENC_CREATE_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
1327
1328/**
1329 * Creation parameters for output bitstream buffer.
1330 */
1331typedef struct _NV_ENC_CREATE_BITSTREAM_BUFFER
1332{
1333 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_BITSTREAM_BUFFER_VER */
1334 uint32_t size; /**< [in]: Deprecated. Do not use */
1335 NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */
1336 uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
1337 NV_ENC_OUTPUT_PTR bitstreamBuffer; /**< [out]: Pointer to the output bitstream buffer */
1338 void* bitstreamBufferPtr; /**< [out]: Reserved and should not be used */
1339 uint32_t reserved1[58]; /**< [in]: Reserved and should be set to 0 */
1340 void* reserved2[64]; /**< [in]: Reserved and should be set to NULL */
1341} NV_ENC_CREATE_BITSTREAM_BUFFER;
1342
1343/** NV_ENC_CREATE_BITSTREAM_BUFFER struct version. */
1344#define NV_ENC_CREATE_BITSTREAM_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
1345
1346/**
1347 * Structs needed for ME only mode.
1348 */
1349typedef struct _NV_ENC_MVECTOR
1350{
1351 int16_t mvx; /**< the x component of MV in quarter-pel units */
1352 int16_t mvy; /**< the y component of MV in quarter-pel units */
1353} NV_ENC_MVECTOR;
1354
1355/**
1356 * Motion vector structure per macroblock for H264 motion estimation.
1357 */
1358typedef struct _NV_ENC_H264_MV_DATA
1359{
1360 NV_ENC_MVECTOR mv[4]; /**< up to 4 vectors for 8x8 partition */
1361 uint8_t mbType; /**< 0 (I), 1 (P), 2 (IPCM), 3 (B) */
1362 uint8_t partitionType; /**< Specifies the block partition type. 0:16x16, 1:8x8, 2:16x8, 3:8x16 */
1363 uint16_t reserved; /**< reserved padding for alignment */
1364 uint32_t mbCost;
1365} NV_ENC_H264_MV_DATA;
1366
1367/**
1368 * Motion vector structure per CU for HEVC motion estimation.
1369 */
1370typedef struct _NV_ENC_HEVC_MV_DATA
1371{
1372 NV_ENC_MVECTOR mv[4]; /**< up to 4 vectors within a CU */
1373 uint8_t cuType; /**< 0 (I), 1(P) */
1374 uint8_t cuSize; /**< 0: 8x8, 1: 16x16, 2: 32x32, 3: 64x64 */
1375 uint8_t partitionMode; /**< The CU partition mode
1376 0 (2Nx2N), 1 (2NxN), 2(Nx2N), 3 (NxN),
1377 4 (2NxnU), 5 (2NxnD), 6(nLx2N), 7 (nRx2N) */
1378 uint8_t lastCUInCTB; /**< Marker to separate CUs in the current CTB from CUs in the next CTB */
1379} NV_ENC_HEVC_MV_DATA;
1380
1381/**
1382 * Creation parameters for output motion vector buffer for ME only mode.
1383 */
1384typedef struct _NV_ENC_CREATE_MV_BUFFER
1385{
1386 uint32_t version; /**< [in]: Struct version. Must be set to NV_ENC_CREATE_MV_BUFFER_VER */
1387 NV_ENC_OUTPUT_PTR mvBuffer; /**< [out]: Pointer to the output motion vector buffer */
1388 uint32_t reserved1[255]; /**< [in]: Reserved and should be set to 0 */
1389 void* reserved2[63]; /**< [in]: Reserved and should be set to NULL */
1390} NV_ENC_CREATE_MV_BUFFER;
1391
1392/** NV_ENC_CREATE_MV_BUFFER struct version*/
1393#define NV_ENC_CREATE_MV_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
1394
1395/**
1396 * QP value for frames
1397 */
1398typedef struct _NV_ENC_QP
1399{
1400 uint32_t qpInterP; /**< [in]: Specifies QP value for P-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
1401 uint32_t qpInterB; /**< [in]: Specifies QP value for B-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
1402 uint32_t qpIntra; /**< [in]: Specifies QP value for Intra Frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
1403} NV_ENC_QP;
1404
1405/**
1406 * Rate Control Configuration Parameters
1407 */
1408 typedef struct _NV_ENC_RC_PARAMS
1409 {
1410 uint32_t version;
1411 NV_ENC_PARAMS_RC_MODE rateControlMode; /**< [in]: Specifies the rate control mode. Check support for various rate control modes using ::NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES caps. */
1412 NV_ENC_QP constQP; /**< [in]: Specifies the initial QP to be used for encoding, these values would be used for all frames if in Constant QP mode. */
1413 uint32_t averageBitRate; /**< [in]: Specifies the average bitrate(in bits/sec) used for encoding. */
1414 uint32_t maxBitRate; /**< [in]: Specifies the maximum bitrate for the encoded output. This is used for VBR and ignored for CBR mode. */
1415 uint32_t vbvBufferSize; /**< [in]: Specifies the VBV(HRD) buffer size. in bits. Set 0 to use the default VBV buffer size. */
1416 uint32_t vbvInitialDelay; /**< [in]: Specifies the VBV(HRD) initial delay in bits. Set 0 to use the default VBV initial delay .*/
1417 uint32_t enableMinQP :1; /**< [in]: Set this to 1 if minimum QP used for rate control. */
1418 uint32_t enableMaxQP :1; /**< [in]: Set this to 1 if maximum QP used for rate control. */
1419 uint32_t enableInitialRCQP :1; /**< [in]: Set this to 1 if user supplied initial QP is used for rate control. */
1420 uint32_t enableAQ :1; /**< [in]: Set this to 1 to enable adaptive quantization (Spatial). */
1421 uint32_t reservedBitField1 :1; /**< [in]: Reserved bitfields and must be set to 0. */
1422 uint32_t enableLookahead :1; /**< [in]: Set this to 1 to enable lookahead with depth <lookaheadDepth> (if lookahead is enabled, input frames must remain available to the encoder until encode completion) */
1423 uint32_t disableIadapt :1; /**< [in]: Set this to 1 to disable adaptive I-frame insertion at scene cuts (only has an effect when lookahead is enabled) */
1424 uint32_t disableBadapt :1; /**< [in]: Set this to 1 to disable adaptive B-frame decision (only has an effect when lookahead is enabled) */
1425 uint32_t enableTemporalAQ :1; /**< [in]: Set this to 1 to enable temporal AQ */
1426 uint32_t zeroReorderDelay :1; /**< [in]: Set this to 1 to indicate zero latency operation (no reordering delay, num_reorder_frames=0) */
1427 uint32_t enableNonRefP :1; /**< [in]: Set this to 1 to enable automatic insertion of non-reference P-frames (no effect if enablePTD=0) */
1428 uint32_t strictGOPTarget :1; /**< [in]: Set this to 1 to minimize GOP-to-GOP rate fluctuations */
1429 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).
1430 If not set, strength is auto selected by driver. */
1431 uint32_t reservedBitFields :16; /**< [in]: Reserved bitfields and must be set to 0 */
1432 NV_ENC_QP minQP; /**< [in]: Specifies the minimum QP used for rate control. Client must set NV_ENC_CONFIG::enableMinQP to 1. */
1433 NV_ENC_QP maxQP; /**< [in]: Specifies the maximum QP used for rate control. Client must set NV_ENC_CONFIG::enableMaxQP to 1. */
1434 NV_ENC_QP initialRCQP; /**< [in]: Specifies the initial QP used for rate control. Client must set NV_ENC_CONFIG::enableInitialRCQP to 1. */
1435 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].
1436 Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */
1437 uint8_t temporalLayerQP[8]; /**< [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as the array index.
1438 Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */
1439 uint8_t targetQuality; /**< [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */
1440 uint8_t targetQualityLSB; /**< [in]: Fractional part of target quality (as 8.8 fixed point format) */
1441 uint16_t lookaheadDepth; /**< [in]: Maximum depth of lookahead with range 0-(31 - number of B frames).
1442 lookaheadDepth is only used if enableLookahead=1.*/
1443 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,
1444 is set to 2 by default for low latency tuning info and 1 by default for ultra low latency tuning info */
1445 int8_t yDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_y_dc' in AV1.*/
1446 int8_t uDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_u_dc' in AV1.*/
1447 int8_t vDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_v_dc' in AV1 (for future use only - deltaQ_v_dc is currently always internally set to same value as deltaQ_u_dc). */
1448 NV_ENC_QP_MAP_MODE qpMapMode; /**< [in]: This flag is used to interpret values in array specified by NV_ENC_PIC_PARAMS::qpDeltaMap.
1449 Set this to NV_ENC_QP_MAP_EMPHASIS to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as Emphasis Level Map.
1450 Emphasis Level can be assigned any value specified in enum NV_ENC_EMPHASIS_MAP_LEVEL.
1451 Emphasis Level Map is used to specify regions to be encoded at varying levels of quality.
1452 The hardware encoder adjusts the quantization within the image as per the provided emphasis map,
1453 by adjusting the quantization parameter (QP) assigned to each macroblock. This adjustment is commonly called "Delta QP".
1454 The adjustment depends on the absolute QP decided by the rate control algorithm, and is applied after the rate control has decided each macroblock's QP.
1455 Since the Delta QP overrides rate control, enabling Emphasis Level Map may violate bitrate and VBV buffer size constraints.
1456 Emphasis Level Map is useful in situations where client has a priori knowledge of the image complexity (e.g. via use of NVFBC's Classification feature) and encoding those high-complexity areas at higher quality (lower QP) is important, even at the possible cost of violating bitrate/VBV buffer size constraints
1457 This feature is not supported when AQ( Spatial/Temporal) is enabled.
1458 This feature is only supported for H264 codec currently.
1459
1460 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
1461
1462 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.
1463
1464 Other values are reserved for future use.*/
1465 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 */
1466 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.
1467 The default split ratio is 15.*/
1468 int8_t cbQPIndexOffset; /**< [in]: Specifies the value of 'chroma_qp_index_offset' in H264 / 'pps_cb_qp_offset' in HEVC / 'deltaQ_u_ac' in AV1.*/
1469 int8_t crQPIndexOffset; /**< [in]: Specifies the value of 'second_chroma_qp_index_offset' in H264 / 'pps_cr_qp_offset' in HEVC / 'deltaQ_v_ac' in AV1 (for future use only - deltaQ_v_ac is currently always internally set to same value as deltaQ_u_ac). */
1470 uint16_t reserved2;
1471 uint32_t reserved[4];
1472 } NV_ENC_RC_PARAMS;
1473
1474/** macro for constructing the version field of ::_NV_ENC_RC_PARAMS */
1475#define NV_ENC_RC_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
1476
1477#define MAX_NUM_CLOCK_TS 3
1478
1479/**
1480* Clock Timestamp set parameters
1481* For H264, this structure is used to populate Picture Timing SEI when NV_ENC_CONFIG_H264::enableTimeCode is set to 1.
1482* For HEVC, this structure is used to populate Time Code SEI when NV_ENC_CONFIG_HEVC::enableTimeCodeSEI is set to 1.
1483* For more details, refer to Annex D of ITU-T Specification.
1484*/
1485
1486typedef struct _NV_ENC_CLOCK_TIMESTAMP_SET
1487{
1488 uint32_t countingType : 1; /**< [in] Specifies the 'counting_type' */
1489 uint32_t discontinuityFlag : 1; /**< [in] Specifies the 'discontinuity_flag' */
1490 uint32_t cntDroppedFrames : 1; /**< [in] Specifies the 'cnt_dropped_flag' */
1491 uint32_t nFrames : 8; /**< [in] Specifies the value of 'n_frames' */
1492 uint32_t secondsValue : 6; /**< [in] Specifies the 'seconds_value' */
1493 uint32_t minutesValue : 6; /**< [in] Specifies the 'minutes_value' */
1494 uint32_t hoursValue : 5; /**< [in] Specifies the 'hours_value' */
1495 uint32_t reserved2 : 4; /**< [in] Reserved and must be set to 0 */
1496 uint32_t timeOffset; /**< [in] Specifies the 'time_offset_value' */
1497} NV_ENC_CLOCK_TIMESTAMP_SET;
1498
1499typedef struct _NV_ENC_TIME_CODE
1500{
1501 NV_ENC_DISPLAY_PIC_STRUCT displayPicStruct; /**< [in] Display picStruct */
1502 NV_ENC_CLOCK_TIMESTAMP_SET clockTimestamp[MAX_NUM_CLOCK_TS]; /**< [in] Clock Timestamp set */
1503} NV_ENC_TIME_CODE;
1504
1505
1506/**
1507 * \struct _NV_ENC_CONFIG_H264_VUI_PARAMETERS
1508 * H264 Video Usability Info parameters
1509 */
1510typedef struct _NV_ENC_CONFIG_H264_VUI_PARAMETERS
1511{
1512 uint32_t overscanInfoPresentFlag; /**< [in]: If set to 1 , it specifies that the overscanInfo is present */
1513 uint32_t overscanInfo; /**< [in]: Specifies the overscan info(as defined in Annex E of the ITU-T Specification). */
1514 uint32_t videoSignalTypePresentFlag; /**< [in]: If set to 1, it specifies that the videoFormat, videoFullRangeFlag and colourDescriptionPresentFlag are present. */
1515 NV_ENC_VUI_VIDEO_FORMAT videoFormat; /**< [in]: Specifies the source video format(as defined in Annex E of the ITU-T Specification).*/
1516 uint32_t videoFullRangeFlag; /**< [in]: Specifies the output range of the luma and chroma samples(as defined in Annex E of the ITU-T Specification). */
1517 uint32_t colourDescriptionPresentFlag; /**< [in]: If set to 1, it specifies that the colourPrimaries, transferCharacteristics and colourMatrix are present. */
1518 NV_ENC_VUI_COLOR_PRIMARIES colourPrimaries; /**< [in]: Specifies color primaries for converting to RGB(as defined in Annex E of the ITU-T Specification) */
1519 NV_ENC_VUI_TRANSFER_CHARACTERISTIC transferCharacteristics; /**< [in]: Specifies the opto-electronic transfer characteristics to use (as defined in Annex E of the ITU-T Specification) */
1520 NV_ENC_VUI_MATRIX_COEFFS colourMatrix; /**< [in]: Specifies the matrix coefficients used in deriving the luma and chroma from the RGB primaries (as defined in Annex E of the ITU-T Specification). */
1521 uint32_t chromaSampleLocationFlag; /**< [in]: If set to 1 , it specifies that the chromaSampleLocationTop and chromaSampleLocationBot are present.*/
1522 uint32_t chromaSampleLocationTop; /**< [in]: Specifies the chroma sample location for top field(as defined in Annex E of the ITU-T Specification) */
1523 uint32_t chromaSampleLocationBot; /**< [in]: Specifies the chroma sample location for bottom field(as defined in Annex E of the ITU-T Specification) */
1524 uint32_t bitstreamRestrictionFlag; /**< [in]: If set to 1, it specifies the bitstream restriction parameters are present in the bitstream.*/
1525 uint32_t timingInfoPresentFlag; /**< [in]: If set to 1, it specifies that the timingInfo is present and the 'numUnitInTicks' and 'timeScale' fields are specified by the application. */
1526 /**< [in]: If not set, the timingInfo may still be present with timing related fields calculated internally basedon the frame rate specified by the application. */
1527 uint32_t numUnitInTicks; /**< [in]: Specifies the number of time units of the clock(as defined in Annex E of the ITU-T Specification). */
1528 uint32_t timeScale; /**< [in]: Specifies the frquency of the clock(as defined in Annex E of the ITU-T Specification). */
1529 uint32_t reserved[12]; /**< [in]: Reserved and must be set to 0 */
1530}NV_ENC_CONFIG_H264_VUI_PARAMETERS;
1531
1532typedef NV_ENC_CONFIG_H264_VUI_PARAMETERS NV_ENC_CONFIG_HEVC_VUI_PARAMETERS;
1533
1534/**
1535 * \struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
1536 * External motion vector hint counts per block type.
1537 * H264 and AV1 support multiple hint while HEVC supports one hint for each valid candidate.
1538 */
1539typedef struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
1540{
1541 uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Supported for H264, HEVC. It Specifies the number of candidates per 16x16 block. */
1542 uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 16x8 block. */
1543 uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 8x16 block. */
1544 uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Supported for H264, HEVC. Specifies the number of candidates per 8x8 block. */
1545 uint32_t numCandsPerSb : 8; /**< [in]: Supported for AV1 only. Specifies the number of candidates per SB. */
1546 uint32_t reserved : 8; /**< [in]: Reserved for padding. */
1547 uint32_t reserved1[3]; /**< [in]: Reserved for future use. */
1548} NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE;
1549
1550
1551/**
1552 * \struct _NVENC_EXTERNAL_ME_HINT
1553 * External Motion Vector hint structure for H264 and HEVC.
1554 */
1555typedef struct _NVENC_EXTERNAL_ME_HINT
1556{
1557 int32_t mvx : 12; /**< [in]: Specifies the x component of integer pixel MV (relative to current MB) S12.0. */
1558 int32_t mvy : 10; /**< [in]: Specifies the y component of integer pixel MV (relative to current MB) S10.0 .*/
1559 int32_t refidx : 5; /**< [in]: Specifies the reference index (31=invalid). Current we support only 1 reference frame per direction for external hints, so \p refidx must be 0. */
1560 int32_t dir : 1; /**< [in]: Specifies the direction of motion estimation . 0=L0 1=L1.*/
1561 int32_t partType : 2; /**< [in]: Specifies the block partition type.0=16x16 1=16x8 2=8x16 3=8x8 (blocks in partition must be consecutive).*/
1562 int32_t lastofPart : 1; /**< [in]: Set to 1 for the last MV of (sub) partition */
1563 int32_t lastOfMB : 1; /**< [in]: Set to 1 for the last MV of macroblock. */
1564} NVENC_EXTERNAL_ME_HINT;
1565
1566/**
1567 * \struct _NVENC_EXTERNAL_ME_SB_HINT
1568 * External Motion Vector SB hint structure for AV1
1569 */
1570typedef struct _NVENC_EXTERNAL_ME_SB_HINT
1571{
1572 int16_t refidx : 5; /**< [in]: Specifies the reference index (31=invalid) */
1573 int16_t direction : 1; /**< [in]: Specifies the direction of motion estimation . 0=L0 1=L1.*/
1574 int16_t bi : 1; /**< [in]: Specifies reference mode 0=single mv, 1=compound mv */
1575 int16_t partition_type : 3; /**< [in]: Specifies the partition type: 0: 2NX2N, 1:2NxN, 2:Nx2N. reserved 3bits for future modes */
1576 int16_t x8 : 3; /**< [in]: Specifies the current partition's top left x position in 8 pixel unit */
1577 int16_t last_of_cu : 1; /**< [in]: Set to 1 for the last MV current CU */
1578 int16_t last_of_sb : 1; /**< [in]: Set to 1 for the last MV of current SB */
1579 int16_t reserved0 : 1; /**< [in]: Reserved and must be set to 0 */
1580 int16_t mvx : 14; /**< [in]: Specifies the x component of integer pixel MV (relative to current MB) S12.2. */
1581 int16_t cu_size : 2; /**< [in]: Specifies the CU size: 0: 8x8, 1: 16x16, 2:32x32, 3:64x64 */
1582 int16_t mvy : 12; /**< [in]: Specifies the y component of integer pixel MV (relative to current MB) S10.2 .*/
1583 int16_t y8 : 3; /**< [in]: Specifies the current partition's top left y position in 8 pixel unit */
1584 int16_t reserved1 : 1; /**< [in]: Reserved and must be set to 0 */
1585} NVENC_EXTERNAL_ME_SB_HINT;
1586
1587/**
1588 * \struct _NV_ENC_CONFIG_H264
1589 * H264 encoder configuration parameters
1590 */
1591typedef struct _NV_ENC_CONFIG_H264
1592{
1593 uint32_t enableTemporalSVC :1; /**< [in]: Set to 1 to enable SVC temporal*/
1594 uint32_t enableStereoMVC :1; /**< [in]: Set to 1 to enable stereo MVC*/
1595 uint32_t hierarchicalPFrames :1; /**< [in]: Set to 1 to enable hierarchical P Frames */
1596 uint32_t hierarchicalBFrames :1; /**< [in]: Set to 1 to enable hierarchical B Frames */
1597 uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set to 1 to write SEI buffering period syntax in the bitstream */
1598 uint32_t outputPictureTimingSEI :1; /**< [in]: Set to 1 to write SEI picture timing syntax in the bitstream. */
1599 uint32_t outputAUD :1; /**< [in]: Set to 1 to write access unit delimiter syntax in bitstream */
1600 uint32_t disableSPSPPS :1; /**< [in]: Set to 1 to disable writing of Sequence and Picture parameter info in bitstream */
1601 uint32_t outputFramePackingSEI :1; /**< [in]: Set to 1 to enable writing of frame packing arrangement SEI messages to bitstream */
1602 uint32_t outputRecoveryPointSEI :1; /**< [in]: Set to 1 to enable writing of recovery point SEI message */
1603 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 */
1604 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.
1605 Constrained encoding works only with rectangular slices.
1606 Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */
1607 uint32_t repeatSPSPPS :1; /**< [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */
1608 uint32_t enableVFR :1; /**< [in]: Setting enableVFR=1 currently only sets the fixed_frame_rate_flag=0 in the VUI but otherwise
1609 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. */
1610 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.
1611 LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1.
1612 Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future.
1613 LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting
1614 ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode
1615 for using LTR.
1616 Note that LTRs are not supported if encoding session is configured with B-frames */
1617 uint32_t qpPrimeYZeroTransformBypassFlag :1; /**< [in]: To enable lossless encode set this to 1, set QP to 0 and RC_mode to NV_ENC_PARAMS_RC_CONSTQP and profile to HIGH_444_PREDICTIVE_PROFILE.
1618 Check support for lossless encoding using ::NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE caps. */
1619 uint32_t useConstrainedIntraPred :1; /**< [in]: Set 1 to enable constrained intra prediction. */
1620 uint32_t enableFillerDataInsertion :1; /**< [in]: Set to 1 to enable insertion of filler data in the bitstream.
1621 This flag will take effect only when one of the CBR rate
1622 control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ,
1623 NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both
1624 NV_ENC_INITIALIZE_PARAMS::frameRateNum and
1625 NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero
1626 values. Setting this field when
1627 NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set
1628 is currently not supported and will make ::NvEncInitializeEncoder()
1629 return an error. */
1630 uint32_t disableSVCPrefixNalu :1; /**< [in]: Set to 1 to disable writing of SVC Prefix NALU preceding each slice in bitstream.
1631 Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */
1632 uint32_t enableScalabilityInfoSEI :1; /**< [in]: Set to 1 to enable writing of Scalability Information SEI message preceding each IDR picture in bitstream
1633 Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */
1634 uint32_t singleSliceIntraRefresh :1; /**< [in]: Set to 1 to maintain single slice in frames during intra refresh.
1635 Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps.
1636 This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */
1637 uint32_t enableTimeCode :1; /**< [in]: Set to 1 to enable writing of clock timestamp sets in picture timing SEI. Note that this flag will be ignored for D3D12 interface. */
1638 uint32_t reservedBitFields :10; /**< [in]: Reserved bitfields and must be set to 0 */
1639 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. */
1640 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. */
1641 uint32_t separateColourPlaneFlag; /**< [in]: Set to 1 to enable 4:4:4 separate colour planes */
1642 uint32_t disableDeblockingFilterIDC; /**< [in]: Specifies the deblocking filter mode. Permissible value range: [0,2]. This flag corresponds
1643 to the flag disable_deblocking_filter_idc specified in section 7.4.3 of H.264 specification,
1644 which specifies whether the operation of the deblocking filter shall be disabled across some
1645 block edges of the slice and specifies for which edges the filtering is disabled. See section
1646 7.4.3 of H.264 specification for more details.*/
1647 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] */
1648 uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */
1649 uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */
1650 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. */
1651 NV_ENC_H264_FMO_MODE fmoMode; /**< [in]: Specified the FMO Mode. Check support for FMO using ::NV_ENC_CAPS_SUPPORT_FMO caps. */
1652 NV_ENC_H264_BDIRECT_MODE bdirectMode; /**< [in]: Specifies the BDirect mode. Check support for BDirect mode using ::NV_ENC_CAPS_SUPPORT_BDIRECT_MODE caps.*/
1653 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. */
1654 NV_ENC_STEREO_PACKING_MODE stereoMode; /**< [in]: Specifies the stereo frame packing mode which is to be signaled in frame packing arrangement SEI */
1655 uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
1656 Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
1657 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 */
1658 uint32_t maxNumRefFrames; /**< [in]: Specifies the DPB size used for encoding. Setting it to 0 will let driver use the default DPB size.
1659 The low latency application which wants to invalidate reference frame as an error resilience tool
1660 is recommended to use a large DPB size so that the encoder can keep old reference frames which can be used if recent
1661 frames are invalidated. */
1662 uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
1663 sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3 numSlices in Picture.
1664 When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
1665 When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
1666 uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
1667 sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice)
1668 sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
1669 sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice)
1670 sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
1671 NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters; /**< [in]: Specifies the H264 video usability info parameters */
1672 uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames. This parameter has different meaning in two LTR modes.
1673 In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR.
1674 In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */
1675 uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_H264::enableLTR for description of the two modes.
1676 Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may
1677 be deprecated in future releases.
1678 Set to 0 when using "LTR Per Picture" mode of LTR operation. */
1679 uint32_t chromaFormatIDC; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.
1680 Check support for YUV444 encoding using ::NV_ENC_CAPS_SUPPORT_YUV444_ENCODE caps.*/
1681 uint32_t maxTemporalLayers; /**< [in]: Specifies the max temporal layer used for temporal SVC / hierarchical coding.
1682 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
1683 be greater than or equal to (NV_ENC_CONFIG_H264::maxTemporalLayers - 2) * 2, for NV_ENC_CONFIG_H264::maxTemporalLayers >= 2.*/
1684 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.*/
1685 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.
1686 Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
1687 NV_ENC_NUM_REF_FRAMES numRefL1; /**< [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame.
1688 Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
1689
1690 uint32_t reserved1[267]; /**< [in]: Reserved and must be set to 0 */
1691 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
1692} NV_ENC_CONFIG_H264;
1693
1694/**
1695 * \struct _NV_ENC_CONFIG_HEVC
1696 * HEVC encoder configuration parameters to be set during initialization.
1697 */
1698typedef struct _NV_ENC_CONFIG_HEVC
1699{
1700 uint32_t level; /**< [in]: Specifies the level of the encoded bitstream.*/
1701 uint32_t tier; /**< [in]: Specifies the level tier of the encoded bitstream.*/
1702 NV_ENC_HEVC_CUSIZE minCUSize; /**< [in]: Specifies the minimum size of luma coding unit.*/
1703 NV_ENC_HEVC_CUSIZE maxCUSize; /**< [in]: Specifies the maximum size of luma coding unit. Currently NVENC SDK only supports maxCUSize equal to NV_ENC_HEVC_CUSIZE_32x32.*/
1704 uint32_t useConstrainedIntraPred :1; /**< [in]: Set 1 to enable constrained intra prediction. */
1705 uint32_t disableDeblockAcrossSliceBoundary :1; /**< [in]: Set 1 to disable in loop filtering across slice boundary.*/
1706 uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set 1 to write SEI buffering period syntax in the bitstream */
1707 uint32_t outputPictureTimingSEI :1; /**< [in]: Set 1 to write SEI picture timing syntax in the bitstream */
1708 uint32_t outputAUD :1; /**< [in]: Set 1 to write Access Unit Delimiter syntax. */
1709 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.
1710 LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1.
1711 Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future releases.
1712 LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting
1713 ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode
1714 for using LTR.
1715 Note that LTRs are not supported if encoding session is configured with B-frames */
1716 uint32_t disableSPSPPS :1; /**< [in]: Set 1 to disable VPS, SPS and PPS signaling in the bitstream. */
1717 uint32_t repeatSPSPPS :1; /**< [in]: Set 1 to output VPS,SPS and PPS for every IDR frame.*/
1718 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 */
1719 uint32_t chromaFormatIDC :2; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.*/
1720 uint32_t pixelBitDepthMinus8 :3; /**< [in]: Specifies pixel bit depth minus 8. Should be set to 0 for 8 bit input, 2 for 10 bit input.*/
1721 uint32_t enableFillerDataInsertion :1; /**< [in]: Set to 1 to enable insertion of filler data in the bitstream.
1722 This flag will take effect only when one of the CBR rate
1723 control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ,
1724 NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both
1725 NV_ENC_INITIALIZE_PARAMS::frameRateNum and
1726 NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero
1727 values. Setting this field when
1728 NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set
1729 is currently not supported and will make ::NvEncInitializeEncoder()
1730 return an error. */
1731 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.
1732 Constrained encoding works only with rectangular slices.
1733 Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */
1734 uint32_t enableAlphaLayerEncoding :1; /**< [in]: Set this to 1 to enable HEVC encode with alpha layer. */
1735 uint32_t singleSliceIntraRefresh :1; /**< [in]: Set this to 1 to maintain single slice frames during intra refresh.
1736 Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps.
1737 This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */
1738 uint32_t outputRecoveryPointSEI :1; /**< [in]: Set to 1 to enable writing of recovery point SEI message */
1739 uint32_t outputTimeCodeSEI :1; /**< [in]: Set 1 to write SEI time code syntax in the bitstream. Note that this flag will be ignored for D3D12 interface.*/
1740 uint32_t reserved :12; /**< [in]: Reserved bitfields.*/
1741 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. */
1742 uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
1743 Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
1744 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 */
1745 uint32_t maxNumRefFramesInDPB; /**< [in]: Specifies the maximum number of references frames in the DPB.*/
1746 uint32_t ltrNumFrames; /**< [in]: This parameter has different meaning in two LTR modes.
1747 In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR.
1748 In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB.
1749 These ltrNumFrames acts as a guidance to the encoder and are not necessarily honored. To achieve a right balance between the encoding
1750 quality and keeping LTR frames in the DPB queue, the encoder can internally limit the number of LTR frames.
1751 The number of LTR frames actually used depends upon the encoding preset being used; Faster encoding presets will use fewer LTR frames.*/
1752 uint32_t vpsId; /**< [in]: Specifies the VPS id of the video parameter set */
1753 uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */
1754 uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */
1755 uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
1756 sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture
1757 When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
1758 uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
1759 sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice)
1760 sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
1761 sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice)
1762 sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
1763 uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */
1764 NV_ENC_CONFIG_HEVC_VUI_PARAMETERS hevcVUIParameters; /**< [in]: Specifies the HEVC video usability info parameters */
1765 uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_HEVC::enableLTR for description of the two modes.
1766 Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may
1767 be deprecated in future releases.
1768 Set to 0 when using "LTR Per Picture" mode of LTR operation. */
1769 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.*/
1770 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.
1771 Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
1772 NV_ENC_NUM_REF_FRAMES numRefL1; /**< [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame.
1773 Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
1774 uint32_t reserved1[214]; /**< [in]: Reserved and must be set to 0.*/
1775 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
1776} NV_ENC_CONFIG_HEVC;
1777
1778#define NV_MAX_TILE_COLS_AV1 64
1779#define NV_MAX_TILE_ROWS_AV1 64
1780
1781/**
1782 * \struct _NV_ENC_FILM_GRAIN_PARAMS_AV1
1783 * AV1 Film Grain Parameters structure
1784 */
1785
1786typedef struct _NV_ENC_FILM_GRAIN_PARAMS_AV1
1787{
1788 uint32_t applyGrain :1; /**< [in]: Set to 1 to specify film grain should be added to frame */
1789 uint32_t chromaScalingFromLuma :1; /**< [in]: Set to 1 to specify the chroma scaling is inferred from luma scaling */
1790 uint32_t overlapFlag :1; /**< [in]: Set to 1 to indicate that overlap between film grain blocks should be applied*/
1791 uint32_t clipToRestrictedRange :1; /**< [in]: Set to 1 to clip values to restricted (studio) range after adding film grain */
1792 uint32_t grainScalingMinus8 :2; /**< [in]: Represents the shift - 8 applied to the values of the chroma component */
1793 uint32_t arCoeffLag :2; /**< [in]: Specifies the number of auto-regressive coefficients for luma and chroma */
1794 uint32_t numYPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the luma component */
1795 uint32_t numCbPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the cb component */
1796 uint32_t numCrPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the cr component */
1797 uint32_t arCoeffShiftMinus6 :2; /**< [in]: specifies the range of the auto-regressive coefficients */
1798 uint32_t grainScaleShift :2; /**< [in]: Specifies how much the Gaussian random numbers should be scaled down during the grain synthesi process */
1799 uint32_t reserved1 :8; /**< [in]: Reserved bits field - should be set to 0 */
1800 uint8_t pointYValue[14]; /**< [in]: pointYValue[i]: x coordinate for i-th point of luma piecewise linear scaling function. Values on a scale of 0...255 */
1801 uint8_t pointYScaling[14]; /**< [in]: pointYScaling[i]: i-th point output value of luma piecewise linear scaling function */
1802 uint8_t pointCbValue[10]; /**< [in]: pointCbValue[i]: x coordinate for i-th point of cb piecewise linear scaling function. Values on a scale of 0...255 */
1803 uint8_t pointCbScaling[10]; /**< [in]: pointCbScaling[i]: i-th point output value of cb piecewise linear scaling function */
1804 uint8_t pointCrValue[10]; /**< [in]: pointCrValue[i]: x coordinate for i-th point of cr piecewise linear scaling function. Values on a scale of 0...255 */
1805 uint8_t pointCrScaling[10]; /**< [in]: pointCrScaling[i]: i-th point output value of cr piecewise linear scaling function */
1806 uint8_t arCoeffsYPlus128[24]; /**< [in]: Specifies auto-regressive coefficients used for the Y plane */
1807 uint8_t arCoeffsCbPlus128[25]; /**< [in]: Specifies auto-regressive coefficients used for the U plane */
1808 uint8_t arCoeffsCrPlus128[25]; /**< [in]: Specifies auto-regressive coefficients used for the V plane */
1809 uint8_t reserved2[2]; /**< [in]: Reserved bytes - should be set to 0 */
1810 uint8_t cbMult; /**< [in]: Represents a multiplier for the cb component used in derivation of the input index to the cb component scaling function */
1811 uint8_t cbLumaMult; /**< [in]: represents a multiplier for the average luma component used in derivation of the input index to the cb component scaling function. */
1812 uint16_t cbOffset; /**< [in]: Represents an offset used in derivation of the input index to the cb component scaling function */
1813 uint8_t crMult; /**< [in]: Represents a multiplier for the cr component used in derivation of the input index to the cr component scaling function */
1814 uint8_t crLumaMult; /**< [in]: represents a multiplier for the average luma component used in derivation of the input index to the cr component scaling function. */
1815 uint16_t crOffset; /**< [in]: Represents an offset used in derivation of the input index to the cr component scaling function */
1816} NV_ENC_FILM_GRAIN_PARAMS_AV1;
1817
1818/**
1819* \struct _NV_ENC_CONFIG_AV1
1820* AV1 encoder configuration parameters to be set during initialization.
1821*/
1822typedef struct _NV_ENC_CONFIG_AV1
1823{
1824 uint32_t level; /**< [in]: Specifies the level of the encoded bitstream.*/
1825 uint32_t tier; /**< [in]: Specifies the level tier of the encoded bitstream.*/
1826 NV_ENC_AV1_PART_SIZE minPartSize; /**< [in]: Specifies the minimum size of luma coding block partition.*/
1827 NV_ENC_AV1_PART_SIZE maxPartSize; /**< [in]: Specifies the maximum size of luma coding block partition.*/
1828 uint32_t outputAnnexBFormat : 1; /**< [in]: Set 1 to use Annex B format for bitstream output.*/
1829 uint32_t enableTimingInfo : 1; /**< [in]: Set 1 to write Timing Info into sequence/frame headers */
1830 uint32_t enableDecoderModelInfo : 1; /**< [in]: Set 1 to write Decoder Model Info into sequence/frame headers */
1831 uint32_t enableFrameIdNumbers : 1; /**< [in]: Set 1 to write Frame id numbers in bitstream */
1832 uint32_t disableSeqHdr : 1; /**< [in]: Set 1 to disable Sequence Header signaling in the bitstream. */
1833 uint32_t repeatSeqHdr : 1; /**< [in]: Set 1 to output Sequence Header for every Key frame.*/
1834 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 */
1835 uint32_t chromaFormatIDC : 2; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input (yuv444 input currently not supported).*/
1836 uint32_t enableBitstreamPadding : 1; /**< [in]: Set 1 to enable bitstream padding. */
1837 uint32_t enableCustomTileConfig : 1; /**< [in]: Set 1 to enable custom tile configuration: numTileColumns and numTileRows must have non zero values and tileWidths and tileHeights must point to a valid address */
1838 uint32_t enableFilmGrainParams : 1; /**< [in]: Set 1 to enable custom film grain parameters: filmGrainParams must point to a valid address */
1839 uint32_t inputPixelBitDepthMinus8 : 3; /**< [in]: Specifies pixel bit depth minus 8 of video input. Should be set to 0 for 8 bit input, 2 for 10 bit input.*/
1840 uint32_t pixelBitDepthMinus8 : 3; /**< [in]: Specifies pixel bit depth minus 8 of encoded video. Should be set to 0 for 8 bit, 2 for 10 bit.
1841 HW will do the bitdepth conversion internally from inputPixelBitDepthMinus8 -> pixelBitDepthMinus8 if bit dpeths differ
1842 Support for 8 bit input to 10 bit encode conversion only */
1843 uint32_t reserved : 14; /**< [in]: Reserved bitfields.*/
1844 uint32_t idrPeriod; /**< [in]: Specifies the IDR/Key frame 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. */
1845 uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
1846 Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
1847 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 */
1848 uint32_t maxNumRefFramesInDPB; /**< [in]: Specifies the maximum number of references frames in the DPB.*/
1849 uint32_t numTileColumns; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileWidths[] specifies the way in which the picture is divided into tile columns.
1850 When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileColumns tile columns. If numTileColumns is not a power of 2,
1851 it will be rounded down to the next power of 2 value. If numTileColumns == 0, the picture will be coded with the smallest number of vertical tiles as allowed by standard.
1852 When enableCustomTileConfig == 1, numTileColumns must be > 0 and <= NV_MAX_TILE_COLS_AV1 and tileWidths must point to a valid array of numTileColumns entries.
1853 Entry i specifies the width in 64x64 CTU unit of tile colum i. The sum of all the entries should be equal to the picture width in 64x64 CTU units. */
1854 uint32_t numTileRows; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileHeights[] specifies the way in which the picture is divided into tiles rows
1855 When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileRows tile rows. If numTileRows is not a power of 2,
1856 it will be rounded down to the next power of 2 value. If numTileRows == 0, the picture will be coded with the smallest number of horizontal tiles as allowed by standard.
1857 When enableCustomTileConfig == 1, numTileRows must be > 0 and <= NV_MAX_TILE_ROWS_AV1 and tileHeights must point to a valid array of numTileRows entries.
1858 Entry i specifies the height in 64x64 CTU unit of tile row i. The sum of all the entries should be equal to the picture hieght in 64x64 CTU units. */
1859 uint32_t *tileWidths; /**< [in]: If enableCustomTileConfig == 1, tileWidths[i] specifies the width of tile column i in 64x64 CTU unit, with 0 <= i <= numTileColumns -1. */
1860 uint32_t *tileHeights; /**< [in]: If enableCustomTileConfig == 1, tileHeights[i] specifies the height of tile row i in 64x64 CTU unit, with 0 <= i <= numTileRows -1. */
1861 uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */
1862 NV_ENC_VUI_COLOR_PRIMARIES colorPrimaries; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
1863 NV_ENC_VUI_TRANSFER_CHARACTERISTIC transferCharacteristics; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
1864 NV_ENC_VUI_MATRIX_COEFFS matrixCoefficients; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
1865 uint32_t colorRange; /**< [in]: 0: studio swing representation - 1: full swing representation */
1866 uint32_t chromaSamplePosition; /**< [in]: 0: unknown
1867 1: Horizontally collocated with luma (0,0) sample, between two vertical samples
1868 2: Co-located with luma (0,0) sample */
1869 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.*/
1870 NV_ENC_FILM_GRAIN_PARAMS_AV1 *filmGrainParams; /**< [in]: If enableFilmGrainParams == 1, filmGrainParams must point to a valid NV_ENC_FILM_GRAIN_PARAMS_AV1 structure */
1871 NV_ENC_NUM_REF_FRAMES numFwdRefs; /**< [in]: Specifies max number of forward reference frame used for prediction of a frame. It must be in range 1-4 (Last, Last2, last3 and Golden). It's a suggestive value not necessarily be honored always. */
1872 NV_ENC_NUM_REF_FRAMES numBwdRefs; /**< [in]: Specifies max number of L1 list reference frame used for prediction of a frame. It must be in range 1-3 (Backward, Altref2, Altref). It's a suggestive value not necessarily be honored always. */
1873 uint32_t reserved1[235]; /**< [in]: Reserved and must be set to 0.*/
1874 void* reserved2[62]; /**< [in]: Reserved and must be set to NULL */
1875} NV_ENC_CONFIG_AV1;
1876
1877/**
1878 * \struct _NV_ENC_CONFIG_H264_MEONLY
1879 * H264 encoder configuration parameters for ME only Mode
1880 *
1881 */
1882typedef struct _NV_ENC_CONFIG_H264_MEONLY
1883{
1884 uint32_t disablePartition16x16 :1; /**< [in]: Disable Motion Estimation on 16x16 blocks*/
1885 uint32_t disablePartition8x16 :1; /**< [in]: Disable Motion Estimation on 8x16 blocks*/
1886 uint32_t disablePartition16x8 :1; /**< [in]: Disable Motion Estimation on 16x8 blocks*/
1887 uint32_t disablePartition8x8 :1; /**< [in]: Disable Motion Estimation on 8x8 blocks*/
1888 uint32_t disableIntraSearch :1; /**< [in]: Disable Intra search during Motion Estimation*/
1889 uint32_t bStereoEnable :1; /**< [in]: Enable Stereo Mode for Motion Estimation where each view is independently executed*/
1890 uint32_t reserved :26; /**< [in]: Reserved and must be set to 0 */
1891 uint32_t reserved1 [255]; /**< [in]: Reserved and must be set to 0 */
1892 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
1893} NV_ENC_CONFIG_H264_MEONLY;
1894
1895
1896/**
1897 * \struct _NV_ENC_CONFIG_HEVC_MEONLY
1898 * HEVC encoder configuration parameters for ME only Mode
1899 *
1900 */
1901typedef struct _NV_ENC_CONFIG_HEVC_MEONLY
1902{
1903 uint32_t reserved [256]; /**< [in]: Reserved and must be set to 0 */
1904 void* reserved1[64]; /**< [in]: Reserved and must be set to NULL */
1905} NV_ENC_CONFIG_HEVC_MEONLY;
1906
1907/**
1908 * \struct _NV_ENC_CODEC_CONFIG
1909 * Codec-specific encoder configuration parameters to be set during initialization.
1910 */
1911typedef union _NV_ENC_CODEC_CONFIG
1912{
1913 NV_ENC_CONFIG_H264 h264Config; /**< [in]: Specifies the H.264-specific encoder configuration. */
1914 NV_ENC_CONFIG_HEVC hevcConfig; /**< [in]: Specifies the HEVC-specific encoder configuration. */
1915 NV_ENC_CONFIG_AV1 av1Config; /**< [in]: Specifies the AV1-specific encoder configuration. */
1916 NV_ENC_CONFIG_H264_MEONLY h264MeOnlyConfig; /**< [in]: Specifies the H.264-specific ME only encoder configuration. */
1917 NV_ENC_CONFIG_HEVC_MEONLY hevcMeOnlyConfig; /**< [in]: Specifies the HEVC-specific ME only encoder configuration. */
1918 uint32_t reserved[320]; /**< [in]: Reserved and must be set to 0 */
1919} NV_ENC_CODEC_CONFIG;
1920
1921
1922/**
1923 * \struct _NV_ENC_CONFIG
1924 * Encoder configuration parameters to be set during initialization.
1925 */
1926typedef struct _NV_ENC_CONFIG
1927{
1928 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CONFIG_VER. */
1929 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. */
1930 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. */
1931 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. */
1932 uint32_t monoChromeEncoding; /**< [in]: Set this to 1 to enable monochrome encoding for this session. */
1933 NV_ENC_PARAMS_FRAME_FIELD_MODE frameFieldMode; /**< [in]: Specifies the frame/field mode.
1934 Check support for field encoding using ::NV_ENC_CAPS_SUPPORT_FIELD_ENCODING caps.
1935 Using a frameFieldMode other than NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME for RGB input is not supported. */
1936 NV_ENC_MV_PRECISION mvPrecision; /**< [in]: Specifies the desired motion vector prediction precision. */
1937 NV_ENC_RC_PARAMS rcParams; /**< [in]: Specifies the rate control parameters for the current encoding session. */
1938 NV_ENC_CODEC_CONFIG encodeCodecConfig; /**< [in]: Specifies the codec specific config parameters through this union. */
1939 uint32_t reserved [278]; /**< [in]: Reserved and must be set to 0 */
1940 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
1941} NV_ENC_CONFIG;
1942
1943/** macro for constructing the version field of ::_NV_ENC_CONFIG */
1944#define NV_ENC_CONFIG_VER (NVENCAPI_STRUCT_VERSION(8) | ( 1<<31 ))
1945
1946/**
1947 * Tuning information of NVENC encoding (TuningInfo is not applicable to H264 and HEVC MEOnly mode).
1948 */
1949typedef enum NV_ENC_TUNING_INFO
1950{
1951 NV_ENC_TUNING_INFO_UNDEFINED = 0, /**< Undefined tuningInfo. Invalid value for encoding. */
1952 NV_ENC_TUNING_INFO_HIGH_QUALITY = 1, /**< Tune presets for latency tolerant encoding.*/
1953 NV_ENC_TUNING_INFO_LOW_LATENCY = 2, /**< Tune presets for low latency streaming.*/
1954 NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY = 3, /**< Tune presets for ultra low latency streaming.*/
1955 NV_ENC_TUNING_INFO_LOSSLESS = 4, /**< Tune presets for lossless encoding.*/
1956 NV_ENC_TUNING_INFO_COUNT /**< Count number of tuningInfos. Invalid value. */
1957}NV_ENC_TUNING_INFO;
1958
1959/**
1960 * \struct _NV_ENC_INITIALIZE_PARAMS
1961 * Encode Session Initialization parameters.
1962 */
1963typedef struct _NV_ENC_INITIALIZE_PARAMS
1964{
1965 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */
1966 GUID encodeGUID; /**< [in]: Specifies the Encode GUID for which the encoder is being created. ::NvEncInitializeEncoder() API will fail if this is not set, or set to unsupported value. */
1967 GUID presetGUID; /**< [in]: Specifies the preset for encoding. If the preset GUID is set then , the preset configuration will be applied before any other parameter. */
1968 uint32_t encodeWidth; /**< [in]: Specifies the encode width. If not set ::NvEncInitializeEncoder() API will fail. */
1969 uint32_t encodeHeight; /**< [in]: Specifies the encode height. If not set ::NvEncInitializeEncoder() API will fail. */
1970 uint32_t darWidth; /**< [in]: Specifies the display aspect ratio width (H264/HEVC) or the render width (AV1). */
1971 uint32_t darHeight; /**< [in]: Specifies the display aspect ratio height (H264/HEVC) or the render height (AV1). */
1972 uint32_t frameRateNum; /**< [in]: Specifies the numerator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */
1973 uint32_t frameRateDen; /**< [in]: Specifies the denominator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */
1974 uint32_t enableEncodeAsync; /**< [in]: Set this to 1 to enable asynchronous mode and is expected to use events to get picture completion notification. */
1975 uint32_t enablePTD; /**< [in]: Set this to 1 to enable the Picture Type Decision is be taken by the NvEncodeAPI interface. */
1976 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 */
1977 uint32_t enableSubFrameWrite :1; /**< [in]: Set this to 1 to write out available bitstream to memory at subframe intervals.
1978 If enableSubFrameWrite = 1, then the hardware encoder returns data as soon as a slice (H264/HEVC) or tile (AV1) has completed encoding.
1979 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/tile data is available.
1980 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. */
1981 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.
1982 NV_ENC_PIC_PARAMS::meHintRefPicDist should preferably be set with enablePTD=1. */
1983 uint32_t enableMEOnlyMode :1; /**< [in]: Set to 1 to enable ME Only Mode .*/
1984 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
1985 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). */
1986 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. */
1987 uint32_t reservedBitFields :26; /**< [in]: Reserved bitfields and must be set to 0 */
1988 uint32_t privDataSize; /**< [in]: Reserved private data buffer size and must be set to 0 */
1989 void* privData; /**< [in]: Reserved private data buffer and must be set to NULL */
1990 NV_ENC_CONFIG* encodeConfig; /**< [in]: Specifies the advanced codec specific structure. If client has sent a valid codec config structure, it will override parameters set by the NV_ENC_INITIALIZE_PARAMS::presetGUID parameter. If set to NULL the NvEncodeAPI interface will use the NV_ENC_INITIALIZE_PARAMS::presetGUID to set the codec specific parameters.
1991 Client can also optionally query the NvEncodeAPI interface to get codec specific parameters for a presetGUID using ::NvEncGetEncodePresetConfig() API. It can then modify (if required) some of the codec config parameters and send down a custom config structure as part of ::_NV_ENC_INITIALIZE_PARAMS.
1992 Even in this case client is recommended to pass the same preset guid it has used in ::NvEncGetEncodePresetConfig() API to query the config structure; as NV_ENC_INITIALIZE_PARAMS::presetGUID. This will not override the custom config structure but will be used to determine other Encoder HW specific parameters not exposed in the API. */
1993 uint32_t maxEncodeWidth; /**< [in]: Maximum encode width to be used for current Encode session.
1994 Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encoder will not allow dynamic resolution change. */
1995 uint32_t maxEncodeHeight; /**< [in]: Maximum encode height to be allowed for current Encode session.
1996 Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encode will not allow dynamic resolution change. */
1997 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.
1998 The NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[0] is for L0 predictors and NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[1] is for L1 predictors.
1999 This client must also set NV_ENC_INITIALIZE_PARAMS::enableExternalMEHints to 1. */
2000 NV_ENC_TUNING_INFO tuningInfo; /**< [in]: Tuning Info of NVENC encoding(TuningInfo is not applicable to H264 and HEVC meonly mode). */
2001 NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Input buffer format. Used only when DX12 interface type is used */
2002 uint32_t reserved [287]; /**< [in]: Reserved and must be set to 0 */
2003 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
2004} NV_ENC_INITIALIZE_PARAMS;
2005
2006/** macro for constructing the version field of ::_NV_ENC_INITIALIZE_PARAMS */
2007#define NV_ENC_INITIALIZE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(5) | ( 1<<31 ))
2008
2009
2010/**
2011 * \struct _NV_ENC_RECONFIGURE_PARAMS
2012 * Encode Session Reconfigured parameters.
2013 */
2014typedef struct _NV_ENC_RECONFIGURE_PARAMS
2015{
2016 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_RECONFIGURE_PARAMS_VER. */
2017 NV_ENC_INITIALIZE_PARAMS reInitEncodeParams; /**< [in]: Encoder session re-initialization parameters.
2018 If reInitEncodeParams.encodeConfig is NULL and
2019 reInitEncodeParams.presetGUID is the same as the preset
2020 GUID specified on the call to NvEncInitializeEncoder(),
2021 EncodeAPI will continue to use the existing encode
2022 configuration.
2023 If reInitEncodeParams.encodeConfig is NULL and
2024 reInitEncodeParams.presetGUID is different from the preset
2025 GUID specified on the call to NvEncInitializeEncoder(),
2026 EncodeAPI will try to use the default configuration for
2027 the preset specified by reInitEncodeParams.presetGUID.
2028 In this case, reconfiguration may fail if the new
2029 configuration is incompatible with the existing
2030 configuration (e.g. the new configuration results in
2031 a change in the GOP structure). */
2032 uint32_t resetEncoder :1; /**< [in]: This resets the rate control states and other internal encoder states. This should be used only with an IDR frame.
2033 If NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1, encoder will force the frame type to IDR */
2034 uint32_t forceIDR :1; /**< [in]: Encode the current picture as an IDR picture. This flag is only valid when Picture type decision is taken by the Encoder
2035 [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */
2036 uint32_t reserved :30;
2037
2038}NV_ENC_RECONFIGURE_PARAMS;
2039
2040/** macro for constructing the version field of ::_NV_ENC_RECONFIGURE_PARAMS */
2041#define NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1<<31 ))
2042
2043/**
2044 * \struct _NV_ENC_PRESET_CONFIG
2045 * Encoder preset config
2046 */
2047typedef struct _NV_ENC_PRESET_CONFIG
2048{
2049 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PRESET_CONFIG_VER. */
2050 NV_ENC_CONFIG presetCfg; /**< [out]: preset config returned by the Nvidia Video Encoder interface. */
2051 uint32_t reserved1[255]; /**< [in]: Reserved and must be set to 0 */
2052 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
2053}NV_ENC_PRESET_CONFIG;
2054
2055/** macro for constructing the version field of ::_NV_ENC_PRESET_CONFIG */
2056#define NV_ENC_PRESET_CONFIG_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 ))
2057
2058
2059/**
2060 * \struct _NV_ENC_PIC_PARAMS_MVC
2061 * MVC-specific parameters to be sent on a per-frame basis.
2062 */
2063typedef struct _NV_ENC_PIC_PARAMS_MVC
2064{
2065 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_MVC_VER. */
2066 uint32_t viewID; /**< [in]: Specifies the view ID associated with the current input view. */
2067 uint32_t temporalID; /**< [in]: Specifies the temporal ID associated with the current input view. */
2068 uint32_t priorityID; /**< [in]: Specifies the priority ID associated with the current input view. Reserved and ignored by the NvEncodeAPI interface. */
2069 uint32_t reserved1[12]; /**< [in]: Reserved and must be set to 0. */
2070 void* reserved2[8]; /**< [in]: Reserved and must be set to NULL. */
2071}NV_ENC_PIC_PARAMS_MVC;
2072
2073/** macro for constructing the version field of ::_NV_ENC_PIC_PARAMS_MVC */
2074#define NV_ENC_PIC_PARAMS_MVC_VER NVENCAPI_STRUCT_VERSION(1)
2075
2076
2077/**
2078 * \union _NV_ENC_PIC_PARAMS_H264_EXT
2079 * H264 extension picture parameters
2080 */
2081typedef union _NV_ENC_PIC_PARAMS_H264_EXT
2082{
2083 NV_ENC_PIC_PARAMS_MVC mvcPicParams; /**< [in]: Specifies the MVC picture parameters. */
2084 uint32_t reserved1[32]; /**< [in]: Reserved and must be set to 0. */
2085}NV_ENC_PIC_PARAMS_H264_EXT;
2086
2087/**
2088 * \struct _NV_ENC_SEI_PAYLOAD
2089 * User SEI message
2090 */
2091typedef struct _NV_ENC_SEI_PAYLOAD
2092{
2093 uint32_t payloadSize; /**< [in] SEI payload size in bytes. SEI payload must be byte aligned, as described in Annex D */
2094 uint32_t payloadType; /**< [in] SEI payload types and syntax can be found in Annex D of the H.264 Specification. */
2095 uint8_t *payload; /**< [in] pointer to user data */
2096} NV_ENC_SEI_PAYLOAD;
2097
2098#define NV_ENC_H264_SEI_PAYLOAD NV_ENC_SEI_PAYLOAD
2099
2100/**
2101 * \struct _NV_ENC_PIC_PARAMS_H264
2102 * H264 specific enc pic params. sent on a per frame basis.
2103 */
2104typedef struct _NV_ENC_PIC_PARAMS_H264
2105{
2106 uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
2107 uint32_t reserved3; /**< [in]: Reserved and must be set to 0 */
2108 uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2109 uint32_t colourPlaneId; /**< [in]: Specifies the colour plane ID associated with the current input. */
2110 uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
2111 When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message
2112 forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
2113 uint32_t constrainedFrame :1; /**< [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame.
2114 NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */
2115 uint32_t sliceModeDataUpdate :1; /**< [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter
2116 When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */
2117 uint32_t ltrMarkFrame :1; /**< [in]: Set to 1 if client wants to mark this frame as LTR */
2118 uint32_t ltrUseFrames :1; /**< [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */
2119 uint32_t reservedBitFields :28; /**< [in]: Reserved bit fields and must be set to 0 */
2120 uint8_t* sliceTypeData; /**< [in]: Deprecated. */
2121 uint32_t sliceTypeArrayCnt; /**< [in]: Deprecated. */
2122 uint32_t seiPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in seiPayloadArray array. */
2123 NV_ENC_SEI_PAYLOAD* seiPayloadArray; /**< [in]: Array of SEI payloads which will be inserted for this frame. */
2124 uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
2125 sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3, numSlices in Picture
2126 When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
2127 When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
2128 uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
2129 sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice)
2130 sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
2131 sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice)
2132 sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
2133 uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term referenceframe index to use for marking this frame as LTR.*/
2134 uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */
2135 uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */
2136 uint32_t forceIntraSliceCount; /**< [in]: Specifies the number of slices to be forced to Intra in the current picture.
2137 This option along with forceIntraSliceIdx[] array needs to be used with sliceMode = 3 only */
2138 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.
2139 The number of entries in this array should be equal to forceIntraSliceCount */
2140 NV_ENC_PIC_PARAMS_H264_EXT h264ExtPicParams; /**< [in]: Specifies the H264 extension config parameters using this config. */
2141 NV_ENC_TIME_CODE timeCode; /**< [in]: Specifies the clock timestamp sets used in picture timing SEI. Applicable only when NV_ENC_CONFIG_H264::enableTimeCode is set to 1. */
2142 uint32_t reserved [203]; /**< [in]: Reserved and must be set to 0. */
2143 void* reserved2[61]; /**< [in]: Reserved and must be set to NULL. */
2144} NV_ENC_PIC_PARAMS_H264;
2145
2146/**
2147 * \struct _NV_ENC_PIC_PARAMS_HEVC
2148 * HEVC specific enc pic params. sent on a per frame basis.
2149 */
2150typedef struct _NV_ENC_PIC_PARAMS_HEVC
2151{
2152 uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
2153 uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2154 uint32_t temporalId; /**< [in]: Specifies the temporal id of the picture */
2155 uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
2156 When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message
2157 forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
2158 uint32_t constrainedFrame :1; /**< [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame.
2159 NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */
2160 uint32_t sliceModeDataUpdate :1; /**< [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter
2161 When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */
2162 uint32_t ltrMarkFrame :1; /**< [in]: Set to 1 if client wants to mark this frame as LTR */
2163 uint32_t ltrUseFrames :1; /**< [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */
2164 uint32_t reservedBitFields :28; /**< [in]: Reserved bit fields and must be set to 0 */
2165 uint8_t* sliceTypeData; /**< [in]: Array which specifies the slice type used to force intra slice for a particular slice. Currently supported only for NV_ENC_CONFIG_H264::sliceMode == 3.
2166 Client should allocate array of size sliceModeData where sliceModeData is specified in field of ::_NV_ENC_CONFIG_H264
2167 Array element with index n corresponds to nth slice. To force a particular slice to intra client should set corresponding array element to NV_ENC_SLICE_TYPE_I
2168 all other array elements should be set to NV_ENC_SLICE_TYPE_DEFAULT */
2169 uint32_t sliceTypeArrayCnt; /**< [in]: Client should set this to the number of elements allocated in sliceTypeData array. If sliceTypeData is NULL then this should be set to 0 */
2170 uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
2171 sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture
2172 When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
2173 When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
2174 uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
2175 sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice)
2176 sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
2177 sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice)
2178 sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
2179 uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term reference frame index to use for marking this frame as LTR.*/
2180 uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */
2181 uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */
2182 uint32_t seiPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in seiPayloadArray array. */
2183 uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
2184 NV_ENC_SEI_PAYLOAD* seiPayloadArray; /**< [in]: Array of SEI payloads which will be inserted for this frame. */
2185 NV_ENC_TIME_CODE timeCode; /**< [in]: Specifies the clock timestamp sets used in time code SEI. Applicable only when NV_ENC_CONFIG_HEVC::enableTimeCodeSEI is set to 1. */
2186 uint32_t reserved2 [237]; /**< [in]: Reserved and must be set to 0. */
2187 void* reserved3[61]; /**< [in]: Reserved and must be set to NULL. */
2188} NV_ENC_PIC_PARAMS_HEVC;
2189
2190#define NV_ENC_AV1_OBU_PAYLOAD NV_ENC_SEI_PAYLOAD
2191
2192/**
2193* \struct _NV_ENC_PIC_PARAMS_AV1
2194* AV1 specific enc pic params. sent on a per frame basis.
2195*/
2196typedef struct _NV_ENC_PIC_PARAMS_AV1
2197{
2198 uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
2199 uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2200 uint32_t temporalId; /**< [in]: Specifies the temporal id of the picture */
2201 uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
2202 forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
2203 uint32_t goldenFrameFlag : 1; /**< [in]: Encode frame as Golden Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2204 uint32_t arfFrameFlag : 1; /**< [in]: Encode frame as Alternate Reference Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2205 uint32_t arf2FrameFlag : 1; /**< [in]: Encode frame as Alternate Reference 2 Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2206 uint32_t bwdFrameFlag : 1; /**< [in]: Encode frame as Backward Reference Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2207 uint32_t overlayFrameFlag : 1; /**< [in]: Encode frame as overlay frame. A previously encoded frame with the same displayPOCSyntax value should be present in reference frame buffer.
2208 This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2209 uint32_t showExistingFrameFlag : 1; /**< [in]: When ovelayFrameFlag is set to 1, this flag controls the value of the show_existing_frame syntax element associated with the overlay frame.
2210 This flag is added to the interface as a placeholder. Its value is ignored for now and always assumed to be set to 1.
2211 This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
2212 uint32_t errorResilientModeFlag : 1; /**< [in]: encode frame independently from previously encoded frames */
2213
2214 uint32_t tileConfigUpdate : 1; /**< [in]: Set to 1 if client wants to overwrite the default tile configuration with the tile parameters specified below
2215 When forceIntraRefreshWithFrameCnt is set it will have priority over tileConfigUpdate setting */
2216 uint32_t enableCustomTileConfig : 1; /**< [in]: Set 1 to enable custom tile configuration: numTileColumns and numTileRows must have non zero values and tileWidths and tileHeights must point to a valid address */
2217 uint32_t filmGrainParamsUpdate : 1; /**< [in]: Set to 1 if client wants to update previous film grain parameters: filmGrainParams must point to a valid address and encoder must have been configured with film grain enabled */
2218 uint32_t reservedBitFields : 22; /**< [in]: Reserved bitfields and must be set to 0 */
2219 uint32_t numTileColumns; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileWidths[] specifies the way in which the picture is divided into tile columns.
2220 When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileColumns tile columns. If numTileColumns is not a power of 2,
2221 it will be rounded down to the next power of 2 value. If numTileColumns == 0, the picture will be coded with the smallest number of vertical tiles as allowed by standard.
2222 When enableCustomTileConfig == 1, numTileColumns must be > 0 and <= NV_MAX_TILE_COLS_AV1 and tileWidths must point to a valid array of numTileColumns entries.
2223 Entry i specifies the width in 64x64 CTU unit of tile colum i. The sum of all the entries should be equal to the picture width in 64x64 CTU units. */
2224 uint32_t numTileRows; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileHeights[] specifies the way in which the picture is divided into tiles rows
2225 When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileRows tile rows. If numTileRows is not a power of 2,
2226 it will be rounded down to the next power of 2 value. If numTileRows == 0, the picture will be coded with the smallest number of horizontal tiles as allowed by standard.
2227 When enableCustomTileConfig == 1, numTileRows must be > 0 and <= NV_MAX_TILE_ROWS_AV1 and tileHeights must point to a valid array of numTileRows entries.
2228 Entry i specifies the height in 64x64 CTU unit of tile row i. The sum of all the entries should be equal to the picture hieght in 64x64 CTU units. */
2229 uint32_t *tileWidths; /**< [in]: If enableCustomTileConfig == 1, tileWidths[i] specifies the width of tile column i in 64x64 CTU unit, with 0 <= i <= numTileColumns -1. */
2230 uint32_t *tileHeights; /**< [in]: If enableCustomTileConfig == 1, tileHeights[i] specifies the height of tile row i in 64x64 CTU unit, with 0 <= i <= numTileRows -1. */
2231 uint32_t obuPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in obuPayloadArray array. */
2232 uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
2233 NV_ENC_AV1_OBU_PAYLOAD* obuPayloadArray; /**< [in]: Array of OBU payloads which will be inserted for this frame. */
2234 NV_ENC_FILM_GRAIN_PARAMS_AV1 *filmGrainParams; /**< [in]: If filmGrainParamsUpdate == 1, filmGrainParams must point to a valid NV_ENC_FILM_GRAIN_PARAMS_AV1 structure */
2235 uint32_t reserved2[247]; /**< [in]: Reserved and must be set to 0. */
2236 void* reserved3[61]; /**< [in]: Reserved and must be set to NULL. */
2237} NV_ENC_PIC_PARAMS_AV1;
2238
2239/**
2240 * Codec specific per-picture encoding parameters.
2241 */
2242typedef union _NV_ENC_CODEC_PIC_PARAMS
2243{
2244 NV_ENC_PIC_PARAMS_H264 h264PicParams; /**< [in]: H264 encode picture params. */
2245 NV_ENC_PIC_PARAMS_HEVC hevcPicParams; /**< [in]: HEVC encode picture params. */
2246 NV_ENC_PIC_PARAMS_AV1 av1PicParams; /**< [in]: AV1 encode picture params. */
2247 uint32_t reserved[256]; /**< [in]: Reserved and must be set to 0. */
2248} NV_ENC_CODEC_PIC_PARAMS;
2249
2250
2251/**
2252 * \struct _NV_ENC_PIC_PARAMS
2253 * Encoding parameters that need to be sent on a per frame basis.
2254 */
2255typedef struct _NV_ENC_PIC_PARAMS
2256{
2257 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_VER. */
2258 uint32_t inputWidth; /**< [in]: Specifies the input frame width */
2259 uint32_t inputHeight; /**< [in]: Specifies the input frame height */
2260 uint32_t inputPitch; /**< [in]: Specifies the input buffer pitch. If pitch value is not known, set this to inputWidth. */
2261 uint32_t encodePicFlags; /**< [in]: Specifies bit-wise OR of encode picture flags. See ::NV_ENC_PIC_FLAGS enum. */
2262 uint32_t frameIdx; /**< [in]: Specifies the frame index associated with the input frame [optional]. */
2263 uint64_t inputTimeStamp; /**< [in]: Specifies opaque data which is associated with the encoded frame, but not actually encoded in the output bitstream.
2264 This opaque data can be used later to uniquely refer to the corresponding encoded frame. For example, it can be used
2265 for identifying the frame to be invalidated in the reference picture buffer, if lost at the client. */
2266 uint64_t inputDuration; /**< [in]: Specifies duration of the input picture */
2267 NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.*/
2268 NV_ENC_OUTPUT_PTR outputBitstream; /**< [in]: Specifies the output buffer pointer.
2269 If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to output buffer. Client should use a pointer obtained from ::NvEncCreateBitstreamBuffer() API.
2270 If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for NV_ENC_ENCODE_OUT_PARAMS struct and encoded bitstream data. Client
2271 should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this output buffer and assign it to NV_ENC_PIC_PARAMS::outputBitstream.
2272 First 256 bytes of this buffer should be interpreted as NV_ENC_ENCODE_OUT_PARAMS struct followed by encoded bitstream data. Recommended size for output buffer is sum of size of
2273 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
2274 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
2275 the default stream. */
2276 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. */
2277 NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */
2278 NV_ENC_PIC_STRUCT pictureStruct; /**< [in]: Specifies structure of the input picture. */
2279 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. */
2280 NV_ENC_CODEC_PIC_PARAMS codecPicParams; /**< [in]: Specifies the codec specific per-picture encoding parameters. */
2281 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.
2282 The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */
2283 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.
2284 The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8
2285 + 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) */
2286 uint32_t reserved1[6]; /**< [in]: Reserved and must be set to 0 */
2287 void* reserved2[2]; /**< [in]: Reserved and must be set to NULL */
2288 int8_t *qpDeltaMap; /**< [in]: Specifies the pointer to signed byte array containing value per MB for H264, per CTB for HEVC and per SB for AV1 in raster scan order for the current picture, which will be interpreted depending on NV_ENC_RC_PARAMS::qpMapMode.
2289 If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DELTA, qpDeltaMap specifies QP modifier per MB for H264, per CTB for HEVC and per SB for AV1. This QP modifier will be applied on top of the QP chosen by rate control.
2290 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
2291 compute the QP modifier, which in turn is applied on top of QP chosen by rate control.
2292 If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DISABLED, value in qpDeltaMap will be ignored.*/
2293 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, picWidthInCtbs * picHeightInCtbs for HEVC and
2294 picWidthInSbs * picHeightInSbs for AV1 */
2295 uint32_t reservedBitFields; /**< [in]: Reserved bitfields and must be set to 0 */
2296 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.
2297 If not set, will internally infer distance of 1. Ignored for NV_ENC_INITALIZE_PARAMS::enablePTD = 0 */
2298 NV_ENC_INPUT_PTR alphaBuffer; /**< [in]: Specifies the input alpha buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.
2299 Applicable only when encoding hevc with alpha layer is enabled. */
2300 NVENC_EXTERNAL_ME_SB_HINT *meExternalSbHints; /**< [in]: For AV1,Specifies the pointer to ME external SB hints for the current frame. The size of ME hint buffer should be equal to meSbHintsCount. */
2301 uint32_t meSbHintsCount; /**< [in]: For AV1, specifies the total number of external ME SB hint candidates for the frame
2302 NV_ENC_PIC_PARAMS::meSbHintsCount must never exceed the total number of SBs in frame * the max number of candidates per SB provided during encoder initialization.
2303 The max number of candidates per SB is maxMeHintCountsPerBlock[0].numCandsPerSb + maxMeHintCountsPerBlock[1].numCandsPerSb */
2304 uint32_t reserved3[285]; /**< [in]: Reserved and must be set to 0 */
2305 void* reserved4[58]; /**< [in]: Reserved and must be set to NULL */
2306} NV_ENC_PIC_PARAMS;
2307
2308/** Macro for constructing the version field of ::_NV_ENC_PIC_PARAMS */
2309#define NV_ENC_PIC_PARAMS_VER (NVENCAPI_STRUCT_VERSION(6) | ( 1<<31 ))
2310
2311
2312/**
2313 * \struct _NV_ENC_MEONLY_PARAMS
2314 * MEOnly parameters that need to be sent on a per motion estimation basis.
2315 * NV_ENC_MEONLY_PARAMS::meExternalHints is supported for H264 only.
2316 */
2317typedef struct _NV_ENC_MEONLY_PARAMS
2318{
2319 uint32_t version; /**< [in]: Struct version. Must be set to NV_ENC_MEONLY_PARAMS_VER.*/
2320 uint32_t inputWidth; /**< [in]: Specifies the input frame width */
2321 uint32_t inputHeight; /**< [in]: Specifies the input frame height */
2322 NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from NvEncCreateInputBuffer() or NvEncMapInputResource() APIs. */
2323 NV_ENC_INPUT_PTR referenceFrame; /**< [in]: Specifies the reference frame pointer */
2324 NV_ENC_OUTPUT_PTR mvBuffer; /**< [in]: Specifies the output buffer pointer.
2325 If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to motion vector data buffer allocated by NvEncCreateMVBuffer.
2326 Client must lock mvBuffer using ::NvEncLockBitstream() API to get the motion vector data.
2327 If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for storing the motion vector data. The size of this buffer must
2328 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
2329 output buffer and assign it to NV_ENC_MEONLY_PARAMS::mvBuffer. All CUDA operations on this buffer must use the default stream. */
2330 NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */
2331 void* completionEvent; /**< [in]: Specifies an event to be signaled on completion of motion estimation
2332 of this Frame [only if operating in Asynchronous mode].
2333 Each output buffer should be associated with a distinct event pointer. */
2334 uint32_t viewID; /**< [in]: Specifies left or right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set.
2335 viewID can be 0,1 if bStereoEnable is set, 0 otherwise. */
2336 NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
2337 meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block for the current frame. meHintCountsPerBlock[0] is for L0 predictors.
2338 The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */
2339 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.
2340 The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8
2341 + 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) */
2342 uint32_t reserved1[243]; /**< [in]: Reserved and must be set to 0 */
2343 void* reserved2[59]; /**< [in]: Reserved and must be set to NULL */
2344} NV_ENC_MEONLY_PARAMS;
2345
2346/** NV_ENC_MEONLY_PARAMS struct version*/
2347#define NV_ENC_MEONLY_PARAMS_VER NVENCAPI_STRUCT_VERSION(3)
2348
2349
2350/**
2351 * \struct _NV_ENC_LOCK_BITSTREAM
2352 * Bitstream buffer lock parameters.
2353 */
2354typedef struct _NV_ENC_LOCK_BITSTREAM
2355{
2356 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_LOCK_BITSTREAM_VER. */
2357 uint32_t doNotWait :1; /**< [in]: If this flag is set, the NvEncodeAPI interface will return buffer pointer even if operation is not completed. If not set, the call will block until operation completes. */
2358 uint32_t ltrFrame :1; /**< [out]: Flag indicating this frame is marked as LTR frame */
2359 uint32_t getRCStats :1; /**< [in]: If this flag is set then lockBitstream call will add additional intra-inter MB count and average MVX, MVY */
2360 uint32_t reservedBitFields :29; /**< [in]: Reserved bit fields and must be set to 0 */
2361 void* outputBitstream; /**< [in]: Pointer to the bitstream buffer being locked. */
2362 uint32_t* sliceOffsets; /**< [in, out]: Array which receives the slice (H264/HEVC) or tile (AV1) 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. */
2363 uint32_t frameIdx; /**< [out]: Frame no. for which the bitstream is being retrieved. */
2364 uint32_t hwEncodeStatus; /**< [out]: The NvEncodeAPI interface status for the locked picture. */
2365 uint32_t numSlices; /**< [out]: Number of slices (H264/HEVC) or tiles (AV1) in the encoded picture. Will be reported only if NV_ENC_INITIALIZE_PARAMS::reportSliceOffsets set to 1. */
2366 uint32_t bitstreamSizeInBytes; /**< [out]: Actual number of bytes generated and copied to the memory pointed by bitstreamBufferPtr.
2367 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.
2368 For AV1 when enablePTD is set, this field reports the total encoded size in bytes of all the encoded frames packed into the current output surface i.e. show frame plus all preceding no-show frames */
2369 uint64_t outputTimeStamp; /**< [out]: Presentation timestamp associated with the encoded output. */
2370 uint64_t outputDuration; /**< [out]: Presentation duration associates with the encoded output. */
2371 void* bitstreamBufferPtr; /**< [out]: Pointer to the generated output bitstream.
2372 For MEOnly mode _NV_ENC_LOCK_BITSTREAM::bitstreamBufferPtr should be typecast to
2373 NV_ENC_H264_MV_DATA/NV_ENC_HEVC_MV_DATA pointer respectively for H264/HEVC */
2374 NV_ENC_PIC_TYPE pictureType; /**< [out]: Picture type of the encoded picture. */
2375 NV_ENC_PIC_STRUCT pictureStruct; /**< [out]: Structure of the generated output picture. */
2376 uint32_t frameAvgQP; /**< [out]: Average QP of the frame. */
2377 uint32_t frameSatd; /**< [out]: Total SATD cost for whole frame. */
2378 uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */
2379 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. */
2380 uint32_t temporalId; /**< [out]: TemporalId value of the frame when using temporalSVC encoding */
2381 uint32_t reserved[12]; /**< [in]: Reserved and must be set to 0 */
2382 uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. For AV1, Number of Intra SBs in the encoded show frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
2383 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. For AV1, Number of Inter SBs in the encoded show frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
2384 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. */
2385 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. */
2386 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. */
2387
2388 uint32_t reserved1[218]; /**< [in]: Reserved and must be set to 0 */
2389 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
2390} NV_ENC_LOCK_BITSTREAM;
2391
2392/** Macro for constructing the version field of ::_NV_ENC_LOCK_BITSTREAM */
2393#define NV_ENC_LOCK_BITSTREAM_VER NVENCAPI_STRUCT_VERSION(2)
2394
2395
2396/**
2397 * \struct _NV_ENC_LOCK_INPUT_BUFFER
2398 * Uncompressed Input Buffer lock parameters.
2399 */
2400typedef struct _NV_ENC_LOCK_INPUT_BUFFER
2401{
2402 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_LOCK_INPUT_BUFFER_VER. */
2403 uint32_t doNotWait :1; /**< [in]: Set to 1 to make ::NvEncLockInputBuffer() a unblocking call. If the encoding is not completed, driver will return ::NV_ENC_ERR_ENCODER_BUSY error code. */
2404 uint32_t reservedBitFields :31; /**< [in]: Reserved bitfields and must be set to 0 */
2405 NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Pointer to the input buffer to be locked, client should pass the pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource API. */
2406 void* bufferDataPtr; /**< [out]: Pointed to the locked input buffer data. Client can only access input buffer using the \p bufferDataPtr. */
2407 uint32_t pitch; /**< [out]: Pitch of the locked input buffer. */
2408 uint32_t reserved1[251]; /**< [in]: Reserved and must be set to 0 */
2409 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
2410} NV_ENC_LOCK_INPUT_BUFFER;
2411
2412/** Macro for constructing the version field of ::_NV_ENC_LOCK_INPUT_BUFFER */
2413#define NV_ENC_LOCK_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
2414
2415
2416/**
2417 * \struct _NV_ENC_MAP_INPUT_RESOURCE
2418 * Map an input resource to a Nvidia Encoder Input Buffer
2419 */
2420typedef struct _NV_ENC_MAP_INPUT_RESOURCE
2421{
2422 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_MAP_INPUT_RESOURCE_VER. */
2423 uint32_t subResourceIndex; /**< [in]: Deprecated. Do not use. */
2424 void* inputResource; /**< [in]: Deprecated. Do not use. */
2425 NV_ENC_REGISTERED_PTR registeredResource; /**< [in]: The Registered resource handle obtained by calling NvEncRegisterInputResource. */
2426 NV_ENC_INPUT_PTR mappedResource; /**< [out]: Mapped pointer corresponding to the registeredResource. This pointer must be used in NV_ENC_PIC_PARAMS::inputBuffer parameter in ::NvEncEncodePicture() API. */
2427 NV_ENC_BUFFER_FORMAT mappedBufferFmt; /**< [out]: Buffer format of the outputResource. This buffer format must be used in NV_ENC_PIC_PARAMS::bufferFmt if client using the above mapped resource pointer. */
2428 uint32_t reserved1[251]; /**< [in]: Reserved and must be set to 0. */
2429 void* reserved2[63]; /**< [in]: Reserved and must be set to NULL */
2430} NV_ENC_MAP_INPUT_RESOURCE;
2431
2432/** Macro for constructing the version field of ::_NV_ENC_MAP_INPUT_RESOURCE */
2433#define NV_ENC_MAP_INPUT_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4)
2434
2435/**
2436 * \struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX
2437 * NV_ENC_REGISTER_RESOURCE::resourceToRegister must be a pointer to a variable of this type,
2438 * when NV_ENC_REGISTER_RESOURCE::resourceType is NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX
2439 */
2440typedef struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX
2441{
2442 uint32_t texture; /**< [in]: The name of the texture to be used. */
2443 uint32_t target; /**< [in]: Accepted values are GL_TEXTURE_RECTANGLE and GL_TEXTURE_2D. */
2444} NV_ENC_INPUT_RESOURCE_OPENGL_TEX;
2445
2446/** \struct NV_ENC_FENCE_POINT_D3D12
2447* Fence and fence value for synchronization.
2448*/
2449typedef struct _NV_ENC_FENCE_POINT_D3D12
2450{
2451 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_FENCE_POINT_D3D12_VER. */
2452 uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
2453 void* pFence; /**< [in]: Pointer to ID3D12Fence. This fence object is used for synchronization. */
2454 uint64_t waitValue; /**< [in]: Fence value to reach or exceed before the GPU operation. */
2455 uint64_t signalValue; /**< [in]: Fence value to set the fence to, after the GPU operation. */
2456 uint32_t bWait:1; /**< [in]: Wait on 'waitValue' if bWait is set to 1, before starting GPU operation. */
2457 uint32_t bSignal:1; /**< [in]: Signal on 'signalValue' if bSignal is set to 1, after GPU operation is complete. */
2458 uint32_t reservedBitField:30; /**< [in]: Reserved and must be set to 0. */
2459 uint32_t reserved1[7]; /**< [in]: Reserved and must be set to 0. */
2460} NV_ENC_FENCE_POINT_D3D12;
2461
2462#define NV_ENC_FENCE_POINT_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
2463
2464/**
2465 * \struct _NV_ENC_INPUT_RESOURCE_D3D12
2466 * NV_ENC_PIC_PARAMS::inputBuffer and NV_ENC_PIC_PARAMS::alphaBuffer must be a pointer to a struct of this type,
2467 * when D3D12 interface is used
2468 */
2469typedef struct _NV_ENC_INPUT_RESOURCE_D3D12
2470{
2471 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INPUT_RESOURCE_D3D12_VER. */
2472 uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
2473 NV_ENC_INPUT_PTR pInputBuffer; /**< [in]: Specifies the input surface pointer. Client must use a pointer obtained from NvEncMapInputResource() in NV_ENC_MAP_INPUT_RESOURCE::mappedResource
2474 when mapping the input surface. */
2475 NV_ENC_FENCE_POINT_D3D12 inputFencePoint; /**< [in]: Specifies the fence and corresponding fence values to do GPU wait and signal. */
2476 uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */
2477 void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */
2478} NV_ENC_INPUT_RESOURCE_D3D12;
2479
2480#define NV_ENC_INPUT_RESOURCE_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
2481
2482/**
2483 * \struct _NV_ENC_OUTPUT_RESOURCE_D3D12
2484 * NV_ENC_PIC_PARAMS::outputBitstream and NV_ENC_LOCK_BITSTREAM::outputBitstream must be a pointer to a struct of this type,
2485 * when D3D12 interface is used
2486 */
2487typedef struct _NV_ENC_OUTPUT_RESOURCE_D3D12
2488{
2489 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_OUTPUT_RESOURCE_D3D12_VER. */
2490 uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
2491 NV_ENC_INPUT_PTR pOutputBuffer; /**< [in]: Specifies the output buffer pointer. Client must use a pointer obtained from NvEncMapInputResource() in NV_ENC_MAP_INPUT_RESOURCE::mappedResource
2492 when mapping output bitstream buffer */
2493 NV_ENC_FENCE_POINT_D3D12 outputFencePoint; /**< [in]: Specifies the fence and corresponding fence values to do GPU wait and signal.*/
2494 uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */
2495 void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */
2496} NV_ENC_OUTPUT_RESOURCE_D3D12;
2497
2498#define NV_ENC_OUTPUT_RESOURCE_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
2499
2500/**
2501 * \struct _NV_ENC_REGISTER_RESOURCE
2502 * Register a resource for future use with the Nvidia Video Encoder Interface.
2503 */
2504typedef struct _NV_ENC_REGISTER_RESOURCE
2505{
2506 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_REGISTER_RESOURCE_VER. */
2507 NV_ENC_INPUT_RESOURCE_TYPE resourceType; /**< [in]: Specifies the type of resource to be registered.
2508 Supported values are
2509 ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX,
2510 ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR,
2511 ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX */
2512 uint32_t width; /**< [in]: Input frame width. */
2513 uint32_t height; /**< [in]: Input frame height. */
2514 uint32_t pitch; /**< [in]: Input buffer pitch.
2515 For ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX resources, set this to 0.
2516 For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR resources, set this to
2517 the pitch as obtained from cuMemAllocPitch(), or to the width in
2518 bytes (if this resource was created by using cuMemAlloc()). This
2519 value must be a multiple of 4.
2520 For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY resources, set this to the
2521 width of the allocation in bytes (i.e.
2522 CUDA_ARRAY3D_DESCRIPTOR::Width * CUDA_ARRAY3D_DESCRIPTOR::NumChannels).
2523 For ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX resources, set this to the
2524 texture width multiplied by the number of components in the texture
2525 format. */
2526 uint32_t subResourceIndex; /**< [in]: Subresource Index of the DirectX resource to be registered. Should be set to 0 for other interfaces. */
2527 void* resourceToRegister; /**< [in]: Handle to the resource that is being registered. */
2528 NV_ENC_REGISTERED_PTR registeredResource; /**< [out]: Registered resource handle. This should be used in future interactions with the Nvidia Video Encoder Interface. */
2529 NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Buffer format of resource to be registered. */
2530 NV_ENC_BUFFER_USAGE bufferUsage; /**< [in]: Usage of resource to be registered. */
2531 NV_ENC_FENCE_POINT_D3D12* pInputFencePoint; /**< [in]: Specifies the input fence and corresponding fence values to do GPU wait and signal.
2532 To be used only when NV_ENC_REGISTER_RESOURCE::resourceToRegister represents D3D12 surface and
2533 NV_ENC_BUFFER_USAGE::bufferUsage is NV_ENC_INPUT_IMAGE.
2534 The fence NV_ENC_FENCE_POINT_D3D12::pFence and NV_ENC_FENCE_POINT_D3D12::waitValue will be used to do GPU wait
2535 before starting GPU operation, if NV_ENC_FENCE_POINT_D3D12::bWait is set.
2536 The fence NV_ENC_FENCE_POINT_D3D12::pFence and NV_ENC_FENCE_POINT_D3D12::signalValue will be used to do GPU signal
2537 when GPU operation finishes, if NV_ENC_FENCE_POINT_D3D12::bSignal is set. */
2538 uint32_t reserved1[247]; /**< [in]: Reserved and must be set to 0. */
2539 void* reserved2[61]; /**< [in]: Reserved and must be set to NULL. */
2540} NV_ENC_REGISTER_RESOURCE;
2541
2542/** Macro for constructing the version field of ::_NV_ENC_REGISTER_RESOURCE */
2543#define NV_ENC_REGISTER_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4)
2544
2545/**
2546 * \struct _NV_ENC_STAT
2547 * Encode Stats structure.
2548 */
2549typedef struct _NV_ENC_STAT
2550{
2551 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_STAT_VER. */
2552 uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
2553 NV_ENC_OUTPUT_PTR outputBitStream; /**< [out]: Specifies the pointer to output bitstream. */
2554 uint32_t bitStreamSize; /**< [out]: Size of generated bitstream in bytes. */
2555 uint32_t picType; /**< [out]: Picture type of encoded picture. See ::NV_ENC_PIC_TYPE. */
2556 uint32_t lastValidByteOffset; /**< [out]: Offset of last valid bytes of completed bitstream */
2557 uint32_t sliceOffsets[16]; /**< [out]: Offsets of each slice */
2558 uint32_t picIdx; /**< [out]: Picture number */
2559 uint32_t frameAvgQP; /**< [out]: Average QP of the frame. */
2560 uint32_t ltrFrame :1; /**< [out]: Flag indicating this frame is marked as LTR frame */
2561 uint32_t reservedBitFields :31; /**< [in]: Reserved bit fields and must be set to 0 */
2562 uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */
2563 uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. */
2564 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. */
2565 int32_t averageMVX; /**< [out]: Average Motion Vector in X direction for the encoded frame. */
2566 int32_t averageMVY; /**< [out]: Average Motion Vector in y direction for the encoded frame. */
2567 uint32_t reserved1[226]; /**< [in]: Reserved and must be set to 0 */
2568 void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
2569} NV_ENC_STAT;
2570
2571/** Macro for constructing the version field of ::_NV_ENC_STAT */
2572#define NV_ENC_STAT_VER NVENCAPI_STRUCT_VERSION(1)
2573
2574
2575/**
2576 * \struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD
2577 * Sequence and picture paramaters payload.
2578 */
2579typedef struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD
2580{
2581 uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */
2582 uint32_t inBufferSize; /**< [in]: Specifies the size of the spsppsBuffer pr
2583… afgekapt