FFmpeg
vaapi_encode.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_VAAPI_ENCODE_H
20 #define AVCODEC_VAAPI_ENCODE_H
21 
22 #include <stdint.h>
23 
24 #include <va/va.h>
25 
26 #if VA_CHECK_VERSION(1, 0, 0)
27 #include <va/va_str.h>
28 #endif
29 
30 #include "libavutil/hwcontext.h"
32 
33 #include "avcodec.h"
34 
35 struct VAAPIEncodeType;
36 struct VAAPIEncodePicture;
37 
38 enum {
45 };
46 
47 enum {
52 };
53 
54 typedef struct VAAPIEncodeSlice {
55  int index;
56  int row_start;
57  int row_size;
60  void *priv_data;
63 
64 typedef struct VAAPIEncodePicture {
66 
67  int64_t display_order;
68  int64_t encode_order;
69  int64_t pts;
70  int force_idr;
71 
72  int type;
73  int b_depth;
76 
78  VASurfaceID input_surface;
79 
81  VASurfaceID recon_surface;
82 
84  VABufferID *param_buffers;
85 
87  VABufferID output_buffer;
88 
89  void *priv_data;
91 
92  // Whether this picture is a reference picture.
94 
95  // The contents of the DPB after this picture has been decoded.
96  // This will contain the picture itself if it is a reference picture,
97  // but not if it isn't.
100  // The reference pictures used in decoding this picture. If they are
101  // used by later pictures they will also appear in the DPB.
102  int nb_refs;
104  // The previous reference picture in encode order. Must be in at least
105  // one of the reference list and DPB list.
107  // Reference count for other pictures referring to this one through
108  // the above pointers, directly from incomplete pictures and indirectly
109  // through completed pictures.
110  int ref_count[2];
111  int ref_removed[2];
112 
116 
117 typedef struct VAAPIEncodeProfile {
118  // lavc profile value (FF_PROFILE_*).
120  // Supported bit depth.
121  int depth;
122  // Number of components.
124  // Chroma subsampling in width dimension.
126  // Chroma subsampling in height dimension.
128  // VAAPI profile value.
129  VAProfile va_profile;
131 
132 enum {
141 };
142 
143 typedef struct VAAPIEncodeRCMode {
144  // Mode from above enum (RC_MODE_*).
145  int mode;
146  // Name.
147  const char *name;
148  // Supported in the compile-time VAAPI version.
150  // VA mode value (VA_RC_*).
151  uint32_t va_mode;
152  // Uses bitrate parameters.
153  int bitrate;
154  // Supports maxrate distinct from bitrate.
155  int maxrate;
156  // Uses quality value.
157  int quality;
158  // Supports HRD/VBV parameters.
159  int hrd;
161 
162 typedef struct VAAPIEncodeContext {
163  const AVClass *class;
164 
165  // Codec-specific hooks.
166  const struct VAAPIEncodeType *codec;
167 
168  // Global options.
169 
170  // Use low power encoding mode.
172 
173  // Number of I frames between IDR frames.
175 
176  // Desired B frame reference depth.
178 
179  // Explicitly set RC mode (otherwise attempt to pick from
180  // available modes).
182 
183  // Explicitly-set QP, for use with the "qp" options.
184  // (Forces CQP mode when set, overriding everything else.)
186 
187  // Desired packed headers.
189 
190  // The required size of surfaces. This is probably the input
191  // size (AVCodecContext.width|height) aligned up to whatever
192  // block size is required by the codec.
195 
196  // The block size for slice calculations.
199 
200  // Everything above this point must be set before calling
201  // ff_vaapi_encode_init().
202 
203  // Chosen encoding profile details.
205 
206  // Chosen rate control mode details.
208  // RC quality level - meaning depends on codec and RC mode.
209  // In CQP mode this sets the fixed quantiser value.
211 
212  // Encoding profile (VAProfile*).
213  VAProfile va_profile;
214  // Encoding entrypoint (VAEntryoint*).
215  VAEntrypoint va_entrypoint;
216  // Rate control mode.
217  unsigned int va_rc_mode;
218  // Bitrate for codec-specific encoder parameters.
219  unsigned int va_bit_rate;
220  // Packed headers which will actually be sent.
221  unsigned int va_packed_headers;
222 
223  // Configuration attributes to use when creating va_config.
226 
227  VAConfigID va_config;
228  VAContextID va_context;
229 
233 
234  // The hardware frame context containing the input frames.
237 
238  // The hardware frame context containing the reconstructed frames.
241 
242  // Pool of (reusable) bitstream output buffers.
244 
245  // Global parameters which will be applied at the start of the
246  // sequence (includes rate control parameters below).
251 
252  // Rate control parameters.
253  VAEncMiscParameterRateControl rc_params;
254  VAEncMiscParameterHRD hrd_params;
255  VAEncMiscParameterFrameRate fr_params;
256 #if VA_CHECK_VERSION(0, 36, 0)
257  VAEncMiscParameterBufferQualityLevel quality_params;
258 #endif
259 
260  // Per-sequence parameter structure (VAEncSequenceParameterBuffer*).
262 
263  // Per-sequence parameters found in the per-picture parameter
264  // structure (VAEncPictureParameterBuffer*).
266 
267  // Current encoding window, in display (input) order.
269  // The next picture to use as the previous reference picture in
270  // encoding order.
272 
273  // Next input order index (display order).
274  int64_t input_order;
275  // Number of frames that output is behind input.
276  int64_t output_delay;
277  // Next encode order index.
278  int64_t encode_order;
279  // Number of frames decode output will need to be delayed.
280  int64_t decode_delay;
281  // Next output order index (in encode order).
282  int64_t output_order;
283 
284  // Timestamp handling.
285  int64_t first_pts;
286  int64_t dts_pts_diff;
288 
289  // Slice structure.
294 
295  // Frame type decision.
296  int gop_size;
299  int p_per_i;
301  int b_per_p;
306 
307  // The encoder does not support cropping information, so warn about
308  // it the first time we encounter any nonzero crop fields.
311 
312 enum {
313  // Codec supports controlling the subdivision of pictures into slices.
315  // Codec only supports constant quality (no rate control).
317  // Codec is intra-only.
318  FLAG_INTRA_ONLY = 1 << 2,
319  // Codec supports B-pictures.
320  FLAG_B_PICTURES = 1 << 3,
321  // Codec supports referencing B-pictures.
323  // Codec supports non-IDR key pictures (that is, key pictures do
324  // not necessarily empty the DPB).
326 };
327 
328 typedef struct VAAPIEncodeType {
329  // List of supported profiles and corresponding VAAPI profiles.
330  // (Must end with FF_PROFILE_UNKNOWN.)
332 
333  // Codec feature flags.
334  int flags;
335 
336  // Default quality for this codec - used as quantiser or RC quality
337  // factor depending on RC mode.
339 
340  // Perform any extra codec-specific configuration after the
341  // codec context is initialised (set up the private data and
342  // add any necessary global parameters).
344 
345  // The size of any private data structure associated with each
346  // picture (can be zero if not required).
348 
349  // The size of the parameter structures:
350  // sizeof(VAEnc{type}ParameterBuffer{codec}).
354 
355  // Fill the parameter structures.
358  VAAPIEncodePicture *pic);
360  VAAPIEncodePicture *pic,
361  VAAPIEncodeSlice *slice);
362 
363  // The type used by the packed header: this should look like
364  // VAEncPackedHeader{something}.
368 
369  // Write the packed header data to the provided buffer.
370  // The sequence header is also used to fill the codec extradata
371  // when the encoder is starting.
373  char *data, size_t *data_len);
375  VAAPIEncodePicture *pic,
376  char *data, size_t *data_len);
378  VAAPIEncodePicture *pic,
379  VAAPIEncodeSlice *slice,
380  char *data, size_t *data_len);
381 
382  // Fill an extra parameter structure, which will then be
383  // passed to vaRenderPicture(). Will be called repeatedly
384  // with increasing index argument until AVERROR_EOF is
385  // returned.
387  VAAPIEncodePicture *pic,
388  int index, int *type,
389  char *data, size_t *data_len);
390 
391  // Write an extra packed header. Will be called repeatedly
392  // with increasing index argument until AVERROR_EOF is
393  // returned.
395  VAAPIEncodePicture *pic,
396  int index, int *type,
397  char *data, size_t *data_len);
399 
400 
403 
406 
407 
408 #define VAAPI_ENCODE_COMMON_OPTIONS \
409  { "low_power", \
410  "Use low-power encoding mode (only available on some platforms; " \
411  "may not support all encoding features)", \
412  OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
413  { .i64 = 0 }, 0, 1, FLAGS }, \
414  { "idr_interval", \
415  "Distance (in I-frames) between IDR frames", \
416  OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
417  { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
418  { "b_depth", \
419  "Maximum B-frame reference depth", \
420  OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
421  { .i64 = 1 }, 1, INT_MAX, FLAGS }
422 
423 #define VAAPI_ENCODE_RC_MODE(name, desc) \
424  { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
425  0, 0, FLAGS, "rc_mode" }
426 #define VAAPI_ENCODE_RC_OPTIONS \
427  { "rc_mode",\
428  "Set rate control mode", \
429  OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
430  { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, "rc_mode" }, \
431  { "auto", "Choose mode automatically based on other parameters", \
432  0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, "rc_mode" }, \
433  VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
434  VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
435  VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
436  VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
437  VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
438  VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate")
439 
440 
441 #endif /* AVCODEC_VAAPI_ENCODE_H */
FLAG_CONSTANT_QUALITY_ONLY
@ FLAG_CONSTANT_QUALITY_ONLY
Definition: vaapi_encode.h:316
VAAPIEncodeType::default_quality
int default_quality
Definition: vaapi_encode.h:338
VAAPIEncodeSlice::codec_slice_params
void * codec_slice_params
Definition: vaapi_encode.h:61
VAAPIEncodeContext::slice_block_width
int slice_block_width
Definition: vaapi_encode.h:197
VAAPIEncodeContext::closed_gop
int closed_gop
Definition: vaapi_encode.h:297
VAAPIEncodeProfile::va_profile
VAProfile va_profile
Definition: vaapi_encode.h:129
RC_MODE_ICQ
@ RC_MODE_ICQ
Definition: vaapi_encode.h:137
VAAPIEncodeContext::va_packed_headers
unsigned int va_packed_headers
Definition: vaapi_encode.h:221
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:76
VAAPIEncodeContext::crop_warned
int crop_warned
Definition: vaapi_encode.h:309
VAAPIEncodeContext::desired_packed_headers
unsigned int desired_packed_headers
Definition: vaapi_encode.h:188
VAAPIEncodeContext::max_b_depth
int max_b_depth
Definition: vaapi_encode.h:300
RC_MODE_AVBR
@ RC_MODE_AVBR
Definition: vaapi_encode.h:139
VAAPIEncodeContext::gop_counter
int gop_counter
Definition: vaapi_encode.h:304
VAAPIEncodeContext::slice_size
int slice_size
Definition: vaapi_encode.h:293
VAAPIEncodeContext::p_per_i
int p_per_i
Definition: vaapi_encode.h:299
VAAPIEncodeContext::nb_global_params
int nb_global_params
Definition: vaapi_encode.h:250
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
VAAPIEncodeContext::global_params_size
size_t global_params_size[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:249
VAAPIEncodeContext::nb_slices
int nb_slices
Definition: vaapi_encode.h:292
VAAPIEncodeType::write_sequence_header
int(* write_sequence_header)(AVCodecContext *avctx, char *data, size_t *data_len)
Definition: vaapi_encode.h:372
VAAPIEncodeSlice
Definition: vaapi_encode.h:54
VAAPIEncodePicture::refs
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
Definition: vaapi_encode.h:103
data
const char data[16]
Definition: mxf.c:91
VAAPIEncodePicture::force_idr
int force_idr
Definition: vaapi_encode.h:70
VAAPIEncodeContext::first_pts
int64_t first_pts
Definition: vaapi_encode.h:285
VAAPIEncodeSlice::block_start
int block_start
Definition: vaapi_encode.h:58
VAAPIEncodeType::flags
int flags
Definition: vaapi_encode.h:334
VAAPIEncodePicture::ref_count
int ref_count[2]
Definition: vaapi_encode.h:110
VAAPIEncodeContext::low_power
int low_power
Definition: vaapi_encode.h:171
VAAPIEncodeSlice::index
int index
Definition: vaapi_encode.h:55
VAAPIEncodePicture::nb_refs
int nb_refs
Definition: vaapi_encode.h:102
VAAPIEncodeContext::gop_size
int gop_size
Definition: vaapi_encode.h:296
VAAPIEncodeRCMode::va_mode
uint32_t va_mode
Definition: vaapi_encode.h:151
ff_vaapi_encode_init
int ff_vaapi_encode_init(AVCodecContext *avctx)
Definition: vaapi_encode.c:2084
VAAPIEncodeContext::rc_params
VAEncMiscParameterRateControl rc_params
Definition: vaapi_encode.h:253
VAAPIEncodeContext::surface_width
int surface_width
Definition: vaapi_encode.h:193
VAAPIEncodeContext::va_rc_mode
unsigned int va_rc_mode
Definition: vaapi_encode.h:217
VAAPIEncodeType::configure
int(* configure)(AVCodecContext *avctx)
Definition: vaapi_encode.h:343
VAAPIEncodeType::picture_header_type
int picture_header_type
Definition: vaapi_encode.h:366
VAAPIEncodeType::init_picture_params
int(* init_picture_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode.h:357
VAAPIEncodeSlice::row_start
int row_start
Definition: vaapi_encode.h:56
VAAPIEncodePicture
Definition: vaapi_encode.h:64
PICTURE_TYPE_P
@ PICTURE_TYPE_P
Definition: vaapi_encode.h:50
VAAPIEncodeContext::output_order
int64_t output_order
Definition: vaapi_encode.h:282
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
VAAPIEncodeContext::profile
const VAAPIEncodeProfile * profile
Definition: vaapi_encode.h:204
VAAPIEncodeContext::nb_config_attributes
int nb_config_attributes
Definition: vaapi_encode.h:225
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:60
RC_MODE_QVBR
@ RC_MODE_QVBR
Definition: vaapi_encode.h:138
RC_MODE_CQP
@ RC_MODE_CQP
Definition: vaapi_encode.h:134
VAAPIEncodeContext::rc_mode
const VAAPIEncodeRCMode * rc_mode
Definition: vaapi_encode.h:207
VAAPIEncodeSlice::row_size
int row_size
Definition: vaapi_encode.h:57
PICTURE_TYPE_B
@ PICTURE_TYPE_B
Definition: vaapi_encode.h:51
VAAPIEncodePicture::codec_picture_params
void * codec_picture_params
Definition: vaapi_encode.h:90
VAAPIEncodeType::picture_params_size
size_t picture_params_size
Definition: vaapi_encode.h:352
VAAPIEncodeContext::dts_pts_diff
int64_t dts_pts_diff
Definition: vaapi_encode.h:286
FLAG_B_PICTURE_REFERENCES
@ FLAG_B_PICTURE_REFERENCES
Definition: vaapi_encode.h:322
VAAPIEncodePicture::encode_complete
int encode_complete
Definition: vaapi_encode.h:75
VAAPIEncodeContext::global_params_type
int global_params_type[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:247
VAAPIEncodeContext::global_params
const void * global_params[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:248
VAAPIEncodePicture::pts
int64_t pts
Definition: vaapi_encode.h:69
MAX_CONFIG_ATTRIBUTES
@ MAX_CONFIG_ATTRIBUTES
Definition: vaapi_encode.h:39
VAAPIEncodeContext::va_entrypoint
VAEntrypoint va_entrypoint
Definition: vaapi_encode.h:215
PICTURE_TYPE_IDR
@ PICTURE_TYPE_IDR
Definition: vaapi_encode.h:48
VAAPIEncodeContext::recon_frames_ref
AVBufferRef * recon_frames_ref
Definition: vaapi_encode.h:239
VAAPIEncodeContext::device
AVHWDeviceContext * device
Definition: vaapi_encode.h:231
VAAPIEncodeContext::output_buffer_pool
AVBufferPool * output_buffer_pool
Definition: vaapi_encode.h:243
VAAPIEncodeType
Definition: vaapi_encode.h:328
VAAPIEncodeContext
Definition: vaapi_encode.h:162
VAAPIEncodePicture::prev
struct VAAPIEncodePicture * prev
Definition: vaapi_encode.h:106
VAAPIEncodeContext::rc_quality
int rc_quality
Definition: vaapi_encode.h:210
VAAPIEncodeContext::slice_block_rows
int slice_block_rows
Definition: vaapi_encode.h:290
VAAPIEncodeType::sequence_header_type
int sequence_header_type
Definition: vaapi_encode.h:365
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
VAAPIEncodeProfile::av_profile
int av_profile
Definition: vaapi_encode.h:119
VAAPIEncodePicture::dpb
struct VAAPIEncodePicture * dpb[MAX_DPB_SIZE]
Definition: vaapi_encode.h:99
VAAPIEncodeType::profiles
const VAAPIEncodeProfile * profiles
Definition: vaapi_encode.h:331
ff_vaapi_encode_close
int ff_vaapi_encode_close(AVCodecContext *avctx)
Definition: vaapi_encode.c:2243
VAAPIEncodeType::write_picture_header
int(* write_picture_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
Definition: vaapi_encode.h:374
VAAPIEncodeType::init_sequence_params
int(* init_sequence_params)(AVCodecContext *avctx)
Definition: vaapi_encode.h:356
VAAPIEncodeRCMode::supported
int supported
Definition: vaapi_encode.h:149
VAAPIEncodeContext::codec_sequence_params
void * codec_sequence_params
Definition: vaapi_encode.h:261
VAAPIEncodeContext::va_bit_rate
unsigned int va_bit_rate
Definition: vaapi_encode.h:219
VAAPIEncodeContext::pic_start
VAAPIEncodePicture * pic_start
Definition: vaapi_encode.h:268
VAAPIEncodeType::write_extra_buffer
int(* write_extra_buffer)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
Definition: vaapi_encode.h:386
VAAPIEncodeType::slice_params_size
size_t slice_params_size
Definition: vaapi_encode.h:353
VAAPIEncodeContext::config_attributes
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]
Definition: vaapi_encode.h:224
index
int index
Definition: gxfenc.c:89
VAAPIEncodeContext::pic_end
VAAPIEncodePicture * pic_end
Definition: vaapi_encode.h:268
VAAPIEncodePicture::encode_issued
int encode_issued
Definition: vaapi_encode.h:74
ff_vaapi_encode_send_frame
int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Definition: vaapi_encode.c:954
VAAPIEncodeProfile::nb_components
int nb_components
Definition: vaapi_encode.h:123
VAAPIEncodePicture::slices
VAAPIEncodeSlice * slices
Definition: vaapi_encode.h:114
VAAPIEncodePicture::input_surface
VASurfaceID input_surface
Definition: vaapi_encode.h:78
VAAPIEncodePicture::type
int type
Definition: vaapi_encode.h:72
RC_MODE_AUTO
@ RC_MODE_AUTO
Definition: vaapi_encode.h:133
VAAPIEncodeRCMode::mode
int mode
Definition: vaapi_encode.h:145
VAAPIEncodeProfile::depth
int depth
Definition: vaapi_encode.h:121
VAAPIEncodeSlice::priv_data
void * priv_data
Definition: vaapi_encode.h:60
MAX_REORDER_DELAY
@ MAX_REORDER_DELAY
Definition: vaapi_encode.h:43
VAAPIEncodeContext::slice_block_height
int slice_block_height
Definition: vaapi_encode.h:198
VAAPIEncodeContext::recon_frames
AVHWFramesContext * recon_frames
Definition: vaapi_encode.h:240
VAAPIEncodeContext::explicit_rc_mode
int explicit_rc_mode
Definition: vaapi_encode.h:181
VAAPIEncodePicture::recon_surface
VASurfaceID recon_surface
Definition: vaapi_encode.h:81
VAAPIEncodeType::slice_header_type
int slice_header_type
Definition: vaapi_encode.h:367
VAAPIEncodePicture::output_buffer
VABufferID output_buffer
Definition: vaapi_encode.h:87
VAAPIEncodeContext::gop_per_idr
int gop_per_idr
Definition: vaapi_encode.h:298
VAAPIEncodePicture::priv_data
void * priv_data
Definition: vaapi_encode.h:89
FLAG_NON_IDR_KEY_PICTURES
@ FLAG_NON_IDR_KEY_PICTURES
Definition: vaapi_encode.h:325
VAAPIEncodeContext::va_context
VAContextID va_context
Definition: vaapi_encode.h:228
VAAPIEncodeContext::hrd_params
VAEncMiscParameterHRD hrd_params
Definition: vaapi_encode.h:254
VAAPIEncodePicture::display_order
int64_t display_order
Definition: vaapi_encode.h:67
MAX_DPB_SIZE
@ MAX_DPB_SIZE
Definition: vaapi_encode.h:41
VAAPIEncodePicture::nb_dpb_pics
int nb_dpb_pics
Definition: vaapi_encode.h:98
VAAPIEncodePicture::b_depth
int b_depth
Definition: vaapi_encode.h:73
FLAG_B_PICTURES
@ FLAG_B_PICTURES
Definition: vaapi_encode.h:320
VAAPIEncodePicture::ref_removed
int ref_removed[2]
Definition: vaapi_encode.h:111
VAAPIEncodeType::write_extra_header
int(* write_extra_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
Definition: vaapi_encode.h:394
VAAPIEncodeContext::codec
const struct VAAPIEncodeType * codec
Definition: vaapi_encode.h:166
VAAPIEncodeType::init_slice_params
int(* init_slice_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode.h:359
VAAPIEncodeContext::next_prev
VAAPIEncodePicture * next_prev
Definition: vaapi_encode.h:271
VAAPIEncodeContext::device_ref
AVBufferRef * device_ref
Definition: vaapi_encode.h:230
VAAPIEncodeContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_encode.h:236
MAX_PICTURE_REFERENCES
@ MAX_PICTURE_REFERENCES
Definition: vaapi_encode.h:42
VAAPIEncodeContext::codec_picture_params
void * codec_picture_params
Definition: vaapi_encode.h:265
VAAPIEncodeContext::output_delay
int64_t output_delay
Definition: vaapi_encode.h:276
RC_MODE_CBR
@ RC_MODE_CBR
Definition: vaapi_encode.h:135
VAAPIEncodeContext::desired_b_depth
int desired_b_depth
Definition: vaapi_encode.h:177
RC_MODE_MAX
@ RC_MODE_MAX
Definition: vaapi_encode.h:140
VAAPIEncodeContext::input_order
int64_t input_order
Definition: vaapi_encode.h:274
PICTURE_TYPE_I
@ PICTURE_TYPE_I
Definition: vaapi_encode.h:49
avcodec.h
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:123
hwcontext_vaapi.h
VAAPIEncodePicture::output_buffer_ref
AVBufferRef * output_buffer_ref
Definition: vaapi_encode.h:86
VAAPIEncodeContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_encode.h:232
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
VAAPIEncodeRCMode::bitrate
int bitrate
Definition: vaapi_encode.h:153
VAAPIEncodePicture::param_buffers
VABufferID * param_buffers
Definition: vaapi_encode.h:84
RC_MODE_VBR
@ RC_MODE_VBR
Definition: vaapi_encode.h:136
VAAPIEncodeContext::va_config
VAConfigID va_config
Definition: vaapi_encode.h:227
VAAPIEncodeContext::va_profile
VAProfile va_profile
Definition: vaapi_encode.h:213
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
pkt
static AVPacket pkt
Definition: demuxing_decoding.c:54
VAAPIEncodePicture::is_reference
int is_reference
Definition: vaapi_encode.h:93
VAAPIEncodeContext::input_frames_ref
AVBufferRef * input_frames_ref
Definition: vaapi_encode.h:235
VAAPIEncodeRCMode::hrd
int hrd
Definition: vaapi_encode.h:159
VAAPIEncodePicture::recon_image
AVFrame * recon_image
Definition: vaapi_encode.h:80
VAAPIEncodeProfile::log2_chroma_h
int log2_chroma_h
Definition: vaapi_encode.h:127
VAAPIEncodeContext::fr_params
VAEncMiscParameterFrameRate fr_params
Definition: vaapi_encode.h:255
VAAPIEncodeType::write_slice_header
int(* write_slice_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
Definition: vaapi_encode.h:377
VAAPIEncodeRCMode::maxrate
int maxrate
Definition: vaapi_encode.h:155
VAAPIEncodeContext::decode_delay
int64_t decode_delay
Definition: vaapi_encode.h:280
VAAPIEncodePicture::next
struct VAAPIEncodePicture * next
Definition: vaapi_encode.h:65
VAAPIEncodeType::sequence_params_size
size_t sequence_params_size
Definition: vaapi_encode.h:351
VAAPIEncodeContext::explicit_qp
int explicit_qp
Definition: vaapi_encode.h:185
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:81
VAAPIEncodeContext::surface_height
int surface_height
Definition: vaapi_encode.h:194
VAAPIEncodePicture::input_image
AVFrame * input_image
Definition: vaapi_encode.h:77
VAAPIEncodeSlice::block_size
int block_size
Definition: vaapi_encode.h:59
VAAPIEncodeRCMode
Definition: vaapi_encode.h:143
MAX_PARAM_BUFFER_SIZE
@ MAX_PARAM_BUFFER_SIZE
Definition: vaapi_encode.h:44
VAAPIEncodeContext::idr_counter
int idr_counter
Definition: vaapi_encode.h:303
AVPacket
This structure stores compressed data.
Definition: avcodec.h:1454
VAAPIEncodePicture::encode_order
int64_t encode_order
Definition: vaapi_encode.h:68
VAAPIEncodeContext::ts_ring
int64_t ts_ring[MAX_REORDER_DELAY *3]
Definition: vaapi_encode.h:287
VAAPIEncodeContext::encode_order
int64_t encode_order
Definition: vaapi_encode.h:278
VAAPIEncodeProfile::log2_chroma_w
int log2_chroma_w
Definition: vaapi_encode.h:125
hwcontext.h
MAX_GLOBAL_PARAMS
@ MAX_GLOBAL_PARAMS
Definition: vaapi_encode.h:40
VAAPIEncodeContext::slice_block_cols
int slice_block_cols
Definition: vaapi_encode.h:291
VAAPIEncodeType::picture_priv_data_size
size_t picture_priv_data_size
Definition: vaapi_encode.h:347
FLAG_INTRA_ONLY
@ FLAG_INTRA_ONLY
Definition: vaapi_encode.h:318
VAAPIEncodePicture::nb_param_buffers
int nb_param_buffers
Definition: vaapi_encode.h:83
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68
VAAPIEncodeRCMode::quality
int quality
Definition: vaapi_encode.h:157
VAAPIEncodeContext::b_per_p
int b_per_p
Definition: vaapi_encode.h:301
FLAG_SLICE_CONTROL
@ FLAG_SLICE_CONTROL
Definition: vaapi_encode.h:314
int
int
Definition: ffmpeg_filter.c:191
VAAPIEncodeContext::end_of_stream
int end_of_stream
Definition: vaapi_encode.h:305
VAAPIEncodeProfile
Definition: vaapi_encode.h:117
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1020
VAAPIEncodeRCMode::name
const char * name
Definition: vaapi_encode.h:147
VAAPIEncodeContext::force_idr
int force_idr
Definition: vaapi_encode.h:302
VAAPIEncodePicture::nb_slices
int nb_slices
Definition: vaapi_encode.h:113
VAAPIEncodeContext::idr_interval
int idr_interval
Definition: vaapi_encode.h:174