1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef AVCODEC_NVENC_H
20 #define AVCODEC_NVENC_H
21
22 #include "config.h"
23
24 #if CONFIG_D3D11VA
25 #define COBJMACROS
27 #else
29 #endif
30
31 #include <ffnvcodec/nvEncodeAPI.h>
32
38
40
41 #define MAX_REGISTERED_FRAMES 64
42 #define RC_MODE_DEPRECATED 0x800000
43 #define RCD(rc_mode) ((rc_mode) | RC_MODE_DEPRECATED)
44
45 #define NVENCAPI_CHECK_VERSION(major, minor) \
46 ((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION))
47
48 // SDK 8.1 compile time feature checks
49 #if NVENCAPI_CHECK_VERSION(8, 1)
50 #define NVENC_HAVE_BFRAME_REF_MODE
51 #define NVENC_HAVE_QP_MAP_MODE
52 #endif
53
54 // SDK 9.0 compile time feature checks
55 #if NVENCAPI_CHECK_VERSION(9, 0)
56 #define NVENC_HAVE_HEVC_BFRAME_REF_MODE
57 #endif
58
59 // SDK 9.1 compile time feature checks
60 #if NVENCAPI_CHECK_VERSION(9, 1)
61 #define NVENC_HAVE_MULTIPLE_REF_FRAMES
62 #define NVENC_HAVE_CUSTREAM_PTR
63 #define NVENC_HAVE_GETLASTERRORSTRING
64 #endif
65
66 // SDK 10.0 compile time feature checks
67 #if NVENCAPI_CHECK_VERSION(10, 0)
68 #define NVENC_HAVE_NEW_PRESETS
69 #define NVENC_HAVE_MULTIPASS
70 #define NVENC_HAVE_LDKFS
71 #define NVENC_HAVE_H264_LVL6
72 #define NVENC_HAVE_HEVC_CONSTRAINED_ENCODING
73 #endif
74
75 // SDK 11.1 compile time feature checks
76 #if NVENCAPI_CHECK_VERSION(11, 1)
77 #define NVENC_HAVE_QP_CHROMA_OFFSETS
78 #define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
79 #endif
80
81 // SDK 12.1 compile time feature checks
82 #if NVENCAPI_CHECK_VERSION(12, 1)
83 #define NVENC_NO_DEPRECATED_RC
84 #endif
85
86 // SDK 12.2 compile time feature checks
87 #if NVENCAPI_CHECK_VERSION(12, 2)
88 #define NVENC_HAVE_NEW_BIT_DEPTH_API
89 #endif
90
92 {
99
103
105 {
107
111
113 {
116
120
121 enum {
134 #ifdef NVENC_HAVE_NEW_PRESETS
135 PRESET_P1,
136 PRESET_P2,
137 PRESET_P3,
138 PRESET_P4,
139 PRESET_P5,
140 PRESET_P6,
141 PRESET_P7,
142 #endif
143 };
144
145 enum {
150 };
151
152 enum {
156 };
157
158 enum {
163
165 };
166
167 enum {
170 };
171
172 enum {
176 };
177
179 {
181
183
190
192
195
199
204
207
208 struct {
216
217 /* the actual data pixel format, different from
218 * AVCodecContext.pix_fmt when using hwaccel frames on input */
220
222
224
275
277
279
281
283
286
287 #endif /* AVCODEC_NVENC_H */