FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvenc.h
Go to the documentation of this file.
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 
23 
24 #include "config.h"
25 
27 #include "libavutil/fifo.h"
28 #include "libavutil/opt.h"
29 
30 #include "avcodec.h"
31 
32 #define MAX_REGISTERED_FRAMES 64
33 
34 typedef struct NvencSurface
35 {
39  int reg_idx;
40  int width;
41  int height;
42  int pitch;
43 
46  int size;
47  int lockCount;
48 } NvencSurface;
49 
50 typedef struct NvencDynLoadFunctions
51 {
54 
58 
59 enum {
70  PRESET_LOSSLESS_DEFAULT, // lossless presets must be the last ones
72 };
73 
74 enum {
79 };
80 
81 enum {
85 };
86 
87 enum {
92 };
93 
94 enum {
97 };
98 
99 typedef struct NvencContext
100 {
102 
104 
109 
112 
116 
117  struct {
120  int mapped;
123 
124  /* the actual data pixel format, different from
125  * AVCodecContext.pix_fmt when using hwaccel frames on input */
127 
128  /* timestamps of the first two frames, for computing the first dts
129  * when B-frames are present */
130  int64_t initial_pts[2];
132 
133  void *nvencoder;
134 
135  int preset;
136  int profile;
137  int level;
138  int tier;
139  int rc;
140  int cbr;
141  int twopass;
142  int device;
143  int flags;
146  int aq;
149  int b_adapt;
152  int nonref_p;
155  int quality;
156  int aud;
161  int cqp;
162 } NvencContext;
163 
165 
167 
169  const AVFrame *frame, int *got_packet);
170 
171 extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
172 
173 #endif /* AVCODEC_NVENC_H */
int no_scenecut
Definition: nvenc.h:147
AVClass * avclass
Definition: nvenc.h:101
void * nvencoder
Definition: nvenc.h:133
enum AVPixelFormat ff_nvenc_pix_fmts[]
Definition: nvenc.c:39
int twopass
Definition: nvenc.h:141
NV_ENC_BUFFER_FORMAT format
Definition: nvenc.h:45
int ff_nvenc_encode_init(AVCodecContext *avctx)
Definition: nvenc.c:1332
int height
Definition: nvenc.h:41
struct NvencContext::@101 registered_frames[MAX_REGISTERED_FRAMES]
This structure describes decoded (raw) audio or video data.
Definition: frame.h:187
AVFifoBuffer * timestamp_list
Definition: nvenc.h:115
NvencFunctions * nvenc_dl
Definition: nvenc.h:53
int mapped
Definition: nvenc.h:120
AVFrame * in_ref
Definition: nvenc.h:37
NV_ENC_MAP_INPUT_RESOURCE in_map
Definition: nvenc.h:38
NvEncodeAPI provides a NVENC Video Encoding interface to NVIDIA GPU devices based on the Kepler archi...
int forced_idr
Definition: nvenc.h:148
NV_ENCODE_API_FUNCTION_LIST nvenc_funcs
Definition: nvenc.h:55
NvencDynLoadFunctions nvenc_dload_funcs
Definition: nvenc.h:103
int first_packet_output
Definition: nvenc.h:131
NV_ENCODE_API_FUNCTION_LIST.
Definition: nvEncodeAPI.h:3149
static AVPacket pkt
int init_qp_b
Definition: nvenc.h:159
int preset
Definition: nvenc.h:135
int pitch
Definition: nvenc.h:42
int nvenc_device_count
Definition: nvenc.h:56
NV_ENC_INPUT_PTR input_surface
Definition: nvenc.h:36
int aq
Definition: nvenc.h:146
void * NV_ENC_INPUT_PTR
NVENCODE API input buffer.
Definition: nvEncodeAPI.h:110
CUcontext cu_context
Definition: nvenc.h:107
AVOptions.
int init_qp_p
Definition: nvenc.h:158
int ff_nvenc_encode_close(AVCodecContext *avctx)
Definition: nvenc.c:1256
NV_ENC_INITIALIZE_PARAMS init_encode_params
Definition: nvenc.h:105
static AVFrame * frame
#define MAX_REGISTERED_FRAMES
Definition: nvenc.h:32
NV_ENC_BUFFER_FORMAT
Input buffer formats.
Definition: nvEncodeAPI.h:306
AVFifoBuffer * output_surface_ready_queue
Definition: nvenc.h:114
CUdeviceptr ptr
Definition: nvenc.h:118
CUcontext cu_context_internal
Definition: nvenc.h:108
int async_depth
Definition: nvenc.h:144
void * NV_ENC_REGISTERED_PTR
A Resource that has been registered with NVENCODE API.
Definition: nvEncodeAPI.h:112
int rc
Definition: nvenc.h:139
int nb_registered_frames
Definition: nvenc.h:122
int level
Definition: nvenc.h:137
int quality
Definition: nvenc.h:155
int bluray_compat
Definition: nvenc.h:157
int aq_strength
Definition: nvenc.h:154
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: nvenc.c:1741
int flags
Definition: nvenc.h:143
NV_ENC_REGISTERED_PTR regptr
Definition: nvenc.h:119
int lockCount
Definition: nvenc.h:47
int profile
Definition: nvenc.h:136
AVFifoBuffer * output_surface_queue
Definition: nvenc.h:113
CudaFunctions * cuda_dl
Definition: nvenc.h:52
enum AVPixelFormat data_pix_fmt
Definition: nvenc.h:126
NV_ENC_CONFIG encode_config
Definition: nvenc.h:106
Libavcodec external API header.
int strict_gop
Definition: nvenc.h:153
int temporal_aq
Definition: nvenc.h:150
int64_t initial_pts[2]
Definition: nvenc.h:130
main external API structure.
Definition: avcodec.h:1732
int init_qp_i
Definition: nvenc.h:160
a very simple circular buffer FIFO implementation
Describe the class of an AVClass context structure.
Definition: log.h:67
int width
Definition: nvenc.h:40
int nonref_p
Definition: nvenc.h:152
int cbr
Definition: nvenc.h:140
int reg_idx
Definition: nvenc.h:39
int b_adapt
Definition: nvenc.h:149
int rc_lookahead
Definition: nvenc.h:145
void * NV_ENC_OUTPUT_PTR
NVENCODE API output buffer.
Definition: nvEncodeAPI.h:111
int size
Definition: nvenc.h:46
NvencSurface * surfaces
Definition: nvenc.h:111
int device
Definition: nvenc.h:142
int nb_surfaces
Definition: nvenc.h:110
int aud
Definition: nvenc.h:156
int cqp
Definition: nvenc.h:161
int tier
Definition: nvenc.h:138
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
This structure stores compressed data.
Definition: avcodec.h:1634
NV_ENC_OUTPUT_PTR output_surface
Definition: nvenc.h:44
int zerolatency
Definition: nvenc.h:151