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
37
39
40 #define MAX_REGISTERED_FRAMES 64
41 #define RC_MODE_DEPRECATED 0x800000
42 #define RCD(rc_mode) ((rc_mode) | RC_MODE_DEPRECATED)
43
44 #define NVENCAPI_CHECK_VERSION(major, minor) \
45 ((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION))
46
47 // SDK 8.1 compile time feature checks
48 #if NVENCAPI_CHECK_VERSION(8, 1)
49 #define NVENC_HAVE_BFRAME_REF_MODE
50 #define NVENC_HAVE_QP_MAP_MODE
51 #endif
52
53 // SDK 9.0 compile time feature checks
54 #if NVENCAPI_CHECK_VERSION(9, 0)
55 #define NVENC_HAVE_HEVC_BFRAME_REF_MODE
56 #endif
57
58 // SDK 9.1 compile time feature checks
59 #if NVENCAPI_CHECK_VERSION(9, 1)
60 #define NVENC_HAVE_MULTIPLE_REF_FRAMES
61 #define NVENC_HAVE_CUSTREAM_PTR
62 #define NVENC_HAVE_GETLASTERRORSTRING
63 #endif
64
65 // SDK 10.0 compile time feature checks
66 #if NVENCAPI_CHECK_VERSION(10, 0)
67 #define NVENC_HAVE_NEW_PRESETS
68 #define NVENC_HAVE_MULTIPASS
69 #define NVENC_HAVE_LDKFS
70 #define NVENC_HAVE_H264_LVL6
71 #define NVENC_HAVE_HEVC_CONSTRAINED_ENCODING
72 #endif
73
74 // SDK 11.1 compile time feature checks
75 #if NVENCAPI_CHECK_VERSION(11, 1)
76 #define NVENC_HAVE_QP_CHROMA_OFFSETS
77 #define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
78 #endif
79
81 {
88
92
94 {
97
101
102 enum {
115 #ifdef NVENC_HAVE_NEW_PRESETS
116 PRESET_P1,
117 PRESET_P2,
118 PRESET_P3,
119 PRESET_P4,
120 PRESET_P5,
121 PRESET_P6,
122 PRESET_P7,
123 #endif
124 };
125
126 enum {
131 };
132
133 enum {
137 };
138
139 enum {
144
146 };
147
148 enum {
151 };
152
154 {
156
158
165
167
170
175
178
179 struct {
187
188 /* the actual data pixel format, different from
189 * AVCodecContext.pix_fmt when using hwaccel frames on input */
191
193
195
240
242
244
246
248
251
252 #endif /* AVCODEC_NVENC_H */