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 #include "libavutil/fifo.h"
33 
34 #include "avcodec.h"
35 #include "hwconfig.h"
36 
37 struct VAAPIEncodeType;
38 struct VAAPIEncodePicture;
39 
40 enum {
47  // A.4.1: table A.6 allows at most 22 tile rows for any level.
49  // A.4.1: table A.6 allows at most 20 tile columns for any level.
53 };
54 
56 
57 enum {
62 };
63 
64 typedef struct VAAPIEncodeSlice {
65  int index;
66  int row_start;
67  int row_size;
72 
73 typedef struct VAAPIEncodePicture {
75 
76  int64_t display_order;
77  int64_t encode_order;
78  int64_t pts;
79  int64_t duration;
80  int force_idr;
81 
82  void *opaque;
84 
85 #if VA_CHECK_VERSION(1, 0, 0)
86  // ROI regions.
87  VAEncROI *roi;
88 #else
89  void *roi;
90 #endif
91 
92  int type;
93  int b_depth;
96 
98  VASurfaceID input_surface;
99 
101  VASurfaceID recon_surface;
102 
104  VABufferID *param_buffers;
105 
106  /* Refcounted via the refstruct-API */
107  VABufferID *output_buffer_ref;
108  VABufferID output_buffer;
109 
110  void *priv_data;
112 
113  // Whether this picture is a reference picture.
115 
116  // The contents of the DPB after this picture has been decoded.
117  // This will contain the picture itself if it is a reference picture,
118  // but not if it isn't.
121  // The reference pictures used in decoding this picture. If they are
122  // used by later pictures they will also appear in the DPB. ref[0][] for
123  // previous reference frames. ref[1][] for future reference frames.
126  // The previous reference picture in encode order. Must be in at least
127  // one of the reference list and DPB list.
129  // Reference count for other pictures referring to this one through
130  // the above pointers, directly from incomplete pictures and indirectly
131  // through completed pictures.
132  int ref_count[2];
133  int ref_removed[2];
134 
137 
138  /**
139  * indicate if current frame is an independent frame that the coded data
140  * can be pushed to downstream directly. Coded of non-independent frame
141  * data will be concatenated into next independent frame.
142  */
144  /** Tail data of current pic, used only for repeat header of AV1. */
146  /** Byte length of tail_data. */
147  size_t tail_size;
149 
150 typedef struct VAAPIEncodeProfile {
151  // lavc profile value (AV_PROFILE_*).
153  // Supported bit depth.
154  int depth;
155  // Number of components.
157  // Chroma subsampling in width dimension.
159  // Chroma subsampling in height dimension.
161  // VAAPI profile value.
162  VAProfile va_profile;
164 
165 enum {
174 };
175 
176 typedef struct VAAPIEncodeRCMode {
177  // Mode from above enum (RC_MODE_*).
178  int mode;
179  // Name.
180  const char *name;
181  // Supported in the compile-time VAAPI version.
183  // VA mode value (VA_RC_*).
184  uint32_t va_mode;
185  // Uses bitrate parameters.
186  int bitrate;
187  // Supports maxrate distinct from bitrate.
188  int maxrate;
189  // Uses quality value.
190  int quality;
191  // Supports HRD/VBV parameters.
192  int hrd;
194 
195 typedef struct VAAPIEncodeContext {
196  const AVClass *class;
197 
198  // Codec-specific hooks.
199  const struct VAAPIEncodeType *codec;
200 
201  // Global options.
202 
203  // Use low power encoding mode.
205 
206  // Number of I frames between IDR frames.
208 
209  // Desired B frame reference depth.
211 
212  // Max Frame Size
214 
215  // Explicitly set RC mode (otherwise attempt to pick from
216  // available modes).
218 
219  // Explicitly-set QP, for use with the "qp" options.
220  // (Forces CQP mode when set, overriding everything else.)
222 
223  // Desired packed headers.
225 
226  // The required size of surfaces. This is probably the input
227  // size (AVCodecContext.width|height) aligned up to whatever
228  // block size is required by the codec.
231 
232  // The block size for slice calculations.
235 
236  // Everything above this point must be set before calling
237  // ff_vaapi_encode_init().
238 
239  // Chosen encoding profile details.
241 
242  // Chosen rate control mode details.
244  // RC quality level - meaning depends on codec and RC mode.
245  // In CQP mode this sets the fixed quantiser value.
247 
248  // Encoding profile (VAProfile*).
249  VAProfile va_profile;
250  // Encoding entrypoint (VAEntryoint*).
251  VAEntrypoint va_entrypoint;
252  // Rate control mode.
253  unsigned int va_rc_mode;
254  // Bitrate for codec-specific encoder parameters.
255  unsigned int va_bit_rate;
256  // Packed headers which will actually be sent.
257  unsigned int va_packed_headers;
258 
259  // Configuration attributes to use when creating va_config.
262 
263  VAConfigID va_config;
264  VAContextID va_context;
265 
269 
270  // The hardware frame context containing the input frames.
273 
274  // The hardware frame context containing the reconstructed frames.
277 
278  // Pool of (reusable) bitstream output buffers.
280 
281  // Global parameters which will be applied at the start of the
282  // sequence (includes rate control parameters below).
287 
288  // Rate control parameters.
289  VAEncMiscParameterRateControl rc_params;
290  VAEncMiscParameterHRD hrd_params;
291  VAEncMiscParameterFrameRate fr_params;
292  VAEncMiscParameterBufferMaxFrameSize mfs_params;
293 #if VA_CHECK_VERSION(0, 36, 0)
294  VAEncMiscParameterBufferQualityLevel quality_params;
295 #endif
296 
297  // Per-sequence parameter structure (VAEncSequenceParameterBuffer*).
299 
300  // Per-sequence parameters found in the per-picture parameter
301  // structure (VAEncPictureParameterBuffer*).
303 
304  // Current encoding window, in display (input) order.
306  // The next picture to use as the previous reference picture in
307  // encoding order. Order from small to large in encoding order.
310 
311  // Next input order index (display order).
312  int64_t input_order;
313  // Number of frames that output is behind input.
314  int64_t output_delay;
315  // Next encode order index.
316  int64_t encode_order;
317  // Number of frames decode output will need to be delayed.
318  int64_t decode_delay;
319  // Next output order index (in encode order).
320  int64_t output_order;
321 
322  // Timestamp handling.
323  int64_t first_pts;
324  int64_t dts_pts_diff;
325  int64_t ts_ring[MAX_REORDER_DELAY * 3 +
327 
328  // Slice structure.
333 
334  // Tile encoding.
337  // Tile width of the i-th column.
339  // Tile height of i-th row.
341  // Location of the i-th tile column boundary.
343  // Location of the i-th tile row boundary.
345 
346  // Frame type decision.
347  int gop_size;
350  int p_per_i;
352  int b_per_p;
357  int p_to_gpb;
358 
359  // Whether the driver supports ROI at all.
361  // Maximum number of regions supported by the driver.
363  // Quantisation range for offset calculations. Set by codec-specific
364  // code, as it may change based on parameters.
366 
367  // The encoder does not support cropping information, so warn about
368  // it the first time we encounter any nonzero crop fields.
370  // If the driver does not support ROI then warn the first time we
371  // encounter a frame with ROI side data.
373 
375 
376  // Whether the driver support vaSyncBuffer
378  // Store buffered pic
380  // Max number of frame buffered in encoder.
382 
383  /** Head data for current output pkt, used only for AV1. */
384  //void *header_data;
385  //size_t header_data_size;
386 
387  /**
388  * Buffered coded data of a pic if it is an non-independent frame.
389  * This is a RefStruct reference.
390  */
391  VABufferID *coded_buffer_ref;
392 
393  /** Tail data of a pic, now only used for av1 repeat frame header. */
396 
397 enum {
398  // Codec supports controlling the subdivision of pictures into slices.
400  // Codec only supports constant quality (no rate control).
402  // Codec is intra-only.
403  FLAG_INTRA_ONLY = 1 << 2,
404  // Codec supports B-pictures.
405  FLAG_B_PICTURES = 1 << 3,
406  // Codec supports referencing B-pictures.
408  // Codec supports non-IDR key pictures (that is, key pictures do
409  // not necessarily empty the DPB).
411  // Codec output packet without timestamp delay, which means the
412  // output packet has same PTS and DTS.
414 };
415 
416 typedef struct VAAPIEncodeType {
417  // List of supported profiles and corresponding VAAPI profiles.
418  // (Must end with AV_PROFILE_UNKNOWN.)
420 
421  // Codec feature flags.
422  int flags;
423 
424  // Default quality for this codec - used as quantiser or RC quality
425  // factor depending on RC mode.
427 
428  // Determine encode parameters like block sizes for surface alignment
429  // and slices. This may need to query the profile and entrypoint,
430  // which will be available when this function is called. If not set,
431  // assume that all blocks are 16x16 and that surfaces should be
432  // aligned to match this.
434 
435  // Perform any extra codec-specific configuration after the
436  // codec context is initialised (set up the private data and
437  // add any necessary global parameters).
439 
440  // The size of any private data structure associated with each
441  // picture (can be zero if not required).
443 
444  // The size of the parameter structures:
445  // sizeof(VAEnc{type}ParameterBuffer{codec}).
449 
450  // Fill the parameter structures.
453  VAAPIEncodePicture *pic);
455  VAAPIEncodePicture *pic,
456  VAAPIEncodeSlice *slice);
457 
458  // The type used by the packed header: this should look like
459  // VAEncPackedHeader{something}.
463 
464  // Write the packed header data to the provided buffer.
465  // The sequence header is also used to fill the codec extradata
466  // when the encoder is starting.
468  char *data, size_t *data_len);
470  VAAPIEncodePicture *pic,
471  char *data, size_t *data_len);
473  VAAPIEncodePicture *pic,
474  VAAPIEncodeSlice *slice,
475  char *data, size_t *data_len);
476 
477  // Fill an extra parameter structure, which will then be
478  // passed to vaRenderPicture(). Will be called repeatedly
479  // with increasing index argument until AVERROR_EOF is
480  // returned.
482  VAAPIEncodePicture *pic,
483  int index, int *type,
484  char *data, size_t *data_len);
485 
486  // Write an extra packed header. Will be called repeatedly
487  // with increasing index argument until AVERROR_EOF is
488  // returned.
490  VAAPIEncodePicture *pic,
491  int index, int *type,
492  char *data, size_t *data_len);
494 
495 
497 
500 
501 
502 #define VAAPI_ENCODE_COMMON_OPTIONS \
503  { "low_power", \
504  "Use low-power encoding mode (only available on some platforms; " \
505  "may not support all encoding features)", \
506  OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
507  { .i64 = 0 }, 0, 1, FLAGS }, \
508  { "idr_interval", \
509  "Distance (in I-frames) between IDR frames", \
510  OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
511  { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
512  { "b_depth", \
513  "Maximum B-frame reference depth", \
514  OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
515  { .i64 = 1 }, 1, INT_MAX, FLAGS }, \
516  { "async_depth", "Maximum processing parallelism. " \
517  "Increase this to improve single channel performance. This option " \
518  "doesn't work if driver doesn't implement vaSyncBuffer function.", \
519  OFFSET(common.async_depth), AV_OPT_TYPE_INT, \
520  { .i64 = 2 }, 1, MAX_ASYNC_DEPTH, FLAGS }, \
521  { "max_frame_size", \
522  "Maximum frame size (in bytes)",\
523  OFFSET(common.max_frame_size), AV_OPT_TYPE_INT, \
524  { .i64 = 0 }, 0, INT_MAX, FLAGS }
525 
526 #define VAAPI_ENCODE_RC_MODE(name, desc) \
527  { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
528  0, 0, FLAGS, .unit = "rc_mode" }
529 #define VAAPI_ENCODE_RC_OPTIONS \
530  { "rc_mode",\
531  "Set rate control mode", \
532  OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
533  { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, .unit = "rc_mode" }, \
534  { "auto", "Choose mode automatically based on other parameters", \
535  0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, .unit = "rc_mode" }, \
536  VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
537  VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
538  VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
539  VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
540  VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
541  VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate")
542 
543 
544 #endif /* AVCODEC_VAAPI_ENCODE_H */
hwconfig.h
VAAPIEncodeType::default_quality
int default_quality
Definition: vaapi_encode.h:426
VAAPIEncodeSlice::codec_slice_params
void * codec_slice_params
Definition: vaapi_encode.h:70
VAAPIEncodeContext::slice_block_width
int slice_block_width
Definition: vaapi_encode.h:233
VAAPIEncodeContext::closed_gop
int closed_gop
Definition: vaapi_encode.h:348
RC_MODE_QVBR
@ RC_MODE_QVBR
Definition: vaapi_encode.h:171
VAAPIEncodeProfile::va_profile
VAProfile va_profile
Definition: vaapi_encode.h:162
VAAPIEncodeContext::va_packed_headers
unsigned int va_packed_headers
Definition: vaapi_encode.h:257
VAAPIEncodeContext::crop_warned
int crop_warned
Definition: vaapi_encode.h:369
VAAPIEncodeContext::desired_packed_headers
unsigned int desired_packed_headers
Definition: vaapi_encode.h:224
VAAPIEncodeContext::max_b_depth
int max_b_depth
Definition: vaapi_encode.h:351
VAAPIEncodePicture::tail_size
size_t tail_size
Byte length of tail_data.
Definition: vaapi_encode.h:147
VAAPIEncodeContext::tile_cols
int tile_cols
Definition: vaapi_encode.h:335
VAAPIEncodeContext::gop_counter
int gop_counter
Definition: vaapi_encode.h:355
VAAPIEncodeContext::slice_size
int slice_size
Definition: vaapi_encode.h:332
VAAPIEncodeContext::p_per_i
int p_per_i
Definition: vaapi_encode.h:350
VAAPIEncodeContext::nb_global_params
int nb_global_params
Definition: vaapi_encode.h:286
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
VAAPIEncodeContext::global_params_size
size_t global_params_size[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:285
VAAPIEncodeContext::nb_slices
int nb_slices
Definition: vaapi_encode.h:331
VAAPIEncodeType::write_sequence_header
int(* write_sequence_header)(AVCodecContext *avctx, char *data, size_t *data_len)
Definition: vaapi_encode.h:467
RC_MODE_VBR
@ RC_MODE_VBR
Definition: vaapi_encode.h:169
VAAPIEncodeSlice
Definition: vaapi_encode.h:64
data
const char data[16]
Definition: mxf.c:148
VAAPIEncodeContext::roi_quant_range
int roi_quant_range
Definition: vaapi_encode.h:365
VAAPIEncodePicture::force_idr
int force_idr
Definition: vaapi_encode.h:80
VAAPIEncodeContext::first_pts
int64_t first_pts
Definition: vaapi_encode.h:323
VAAPIEncodeSlice::block_start
int block_start
Definition: vaapi_encode.h:68
VAAPIEncodeType::flags
int flags
Definition: vaapi_encode.h:422
VAAPIEncodePicture::ref_count
int ref_count[2]
Definition: vaapi_encode.h:132
VAAPIEncodeContext::low_power
int low_power
Definition: vaapi_encode.h:204
VAAPIEncodeContext::roi_allowed
int roi_allowed
Definition: vaapi_encode.h:360
VAAPIEncodeSlice::index
int index
Definition: vaapi_encode.h:65
VAAPIEncodeContext::gop_size
int gop_size
Definition: vaapi_encode.h:347
VAAPIEncodeRCMode::va_mode
uint32_t va_mode
Definition: vaapi_encode.h:184
VAAPIEncodeContext::has_sync_buffer_func
int has_sync_buffer_func
Definition: vaapi_encode.h:377
RC_MODE_MAX
@ RC_MODE_MAX
Definition: vaapi_encode.h:173
ff_vaapi_encode_init
int ff_vaapi_encode_init(AVCodecContext *avctx)
Definition: vaapi_encode.c:2746
VAAPIEncodeContext::rc_params
VAEncMiscParameterRateControl rc_params
Definition: vaapi_encode.h:289
FLAG_NON_IDR_KEY_PICTURES
@ FLAG_NON_IDR_KEY_PICTURES
Definition: vaapi_encode.h:410
VAAPIEncodeContext::surface_width
int surface_width
Definition: vaapi_encode.h:229
VAAPIEncodePicture::refs
struct VAAPIEncodePicture * refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]
Definition: vaapi_encode.h:125
VAAPIEncodeContext::va_rc_mode
unsigned int va_rc_mode
Definition: vaapi_encode.h:253
VAAPIEncodeContext::roi_max_regions
int roi_max_regions
Definition: vaapi_encode.h:362
VAAPIEncodeType::configure
int(* configure)(AVCodecContext *avctx)
Definition: vaapi_encode.h:438
VAAPIEncodePicture::nb_refs
int nb_refs[MAX_REFERENCE_LIST_NUM]
Definition: vaapi_encode.h:124
fifo.h
VAAPIEncodeContext::row_height
int row_height[MAX_TILE_ROWS]
Definition: vaapi_encode.h:340
MAX_REORDER_DELAY
@ MAX_REORDER_DELAY
Definition: vaapi_encode.h:45
VAAPIEncodeType::picture_header_type
int picture_header_type
Definition: vaapi_encode.h:461
VAAPIEncodeType::init_picture_params
int(* init_picture_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode.h:452
VAAPIEncodeSlice::row_start
int row_start
Definition: vaapi_encode.h:66
VAAPIEncodePicture
Definition: vaapi_encode.h:73
VAAPIEncodeContext::tail_pkt
AVPacket * tail_pkt
Tail data of a pic, now only used for av1 repeat frame header.
Definition: vaapi_encode.h:394
VAAPIEncodePicture::non_independent_frame
int non_independent_frame
indicate if current frame is an independent frame that the coded data can be pushed to downstream dir...
Definition: vaapi_encode.h:143
VAAPIEncodeContext::output_order
int64_t output_order
Definition: vaapi_encode.h:320
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
MAX_CONFIG_ATTRIBUTES
@ MAX_CONFIG_ATTRIBUTES
Definition: vaapi_encode.h:41
VAAPIEncodeContext::mfs_params
VAEncMiscParameterBufferMaxFrameSize mfs_params
Definition: vaapi_encode.h:292
VAAPIEncodeContext::profile
const VAAPIEncodeProfile * profile
Definition: vaapi_encode.h:240
VAAPIEncodeContext::p_to_gpb
int p_to_gpb
Definition: vaapi_encode.h:357
VAAPIEncodeContext::nb_config_attributes
int nb_config_attributes
Definition: vaapi_encode.h:261
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:62
VAAPIEncodeContext::rc_mode
const VAAPIEncodeRCMode * rc_mode
Definition: vaapi_encode.h:243
pkt
AVPacket * pkt
Definition: movenc.c:59
VAAPIEncodeSlice::row_size
int row_size
Definition: vaapi_encode.h:67
VAAPIEncodePicture::codec_picture_params
void * codec_picture_params
Definition: vaapi_encode.h:111
VAAPIEncodeType::picture_params_size
size_t picture_params_size
Definition: vaapi_encode.h:447
VAAPIEncodeContext::dts_pts_diff
int64_t dts_pts_diff
Definition: vaapi_encode.h:324
FLAG_SLICE_CONTROL
@ FLAG_SLICE_CONTROL
Definition: vaapi_encode.h:399
MAX_TILE_ROWS
@ MAX_TILE_ROWS
Definition: vaapi_encode.h:48
VAAPIEncodePicture::encode_complete
int encode_complete
Definition: vaapi_encode.h:95
VAAPIEncodeContext::tile_rows
int tile_rows
Definition: vaapi_encode.h:336
MAX_PICTURE_REFERENCES
@ MAX_PICTURE_REFERENCES
Definition: vaapi_encode.h:44
VAAPIEncodeContext::global_params_type
int global_params_type[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:283
VAAPIEncodeContext::global_params
const void * global_params[MAX_GLOBAL_PARAMS]
Definition: vaapi_encode.h:284
VAAPIEncodeContext::output_buffer_pool
struct FFRefStructPool * output_buffer_pool
Definition: vaapi_encode.h:279
VAAPIEncodePicture::pts
int64_t pts
Definition: vaapi_encode.h:78
VAAPIEncodeContext::va_entrypoint
VAEntrypoint va_entrypoint
Definition: vaapi_encode.h:251
VAAPIEncodeContext::recon_frames_ref
AVBufferRef * recon_frames_ref
Definition: vaapi_encode.h:275
VAAPIEncodeContext::async_depth
int async_depth
Definition: vaapi_encode.h:381
VAAPIEncodeContext::device
AVHWDeviceContext * device
Definition: vaapi_encode.h:267
FFRefStructPool
FFRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
Definition: refstruct.c:183
VAAPIEncodePicture::opaque
void * opaque
Definition: vaapi_encode.h:82
VAAPIEncodeType
Definition: vaapi_encode.h:416
PICTURE_TYPE_B
@ PICTURE_TYPE_B
Definition: vaapi_encode.h:61
VAAPIEncodeContext
Definition: vaapi_encode.h:195
VAAPIEncodePicture::prev
struct VAAPIEncodePicture * prev
Definition: vaapi_encode.h:128
VAAPIEncodeContext::rc_quality
int rc_quality
Definition: vaapi_encode.h:246
VAAPIEncodeContext::slice_block_rows
int slice_block_rows
Definition: vaapi_encode.h:329
VAAPIEncodeType::sequence_header_type
int sequence_header_type
Definition: vaapi_encode.h:460
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
VAAPIEncodeProfile::av_profile
int av_profile
Definition: vaapi_encode.h:152
VAAPIEncodePicture::dpb
struct VAAPIEncodePicture * dpb[MAX_DPB_SIZE]
Definition: vaapi_encode.h:120
RC_MODE_AUTO
@ RC_MODE_AUTO
Definition: vaapi_encode.h:166
VAAPIEncodeType::profiles
const VAAPIEncodeProfile * profiles
Definition: vaapi_encode.h:419
ff_vaapi_encode_close
int ff_vaapi_encode_close(AVCodecContext *avctx)
Definition: vaapi_encode.c:2955
VAAPIEncodeType::write_picture_header
int(* write_picture_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
Definition: vaapi_encode.h:469
VAAPIEncodeType::init_sequence_params
int(* init_sequence_params)(AVCodecContext *avctx)
Definition: vaapi_encode.h:451
MAX_DPB_SIZE
@ MAX_DPB_SIZE
Definition: vaapi_encode.h:43
VAAPIEncodeRCMode::supported
int supported
Definition: vaapi_encode.h:182
VAAPIEncodeContext::codec_sequence_params
void * codec_sequence_params
Definition: vaapi_encode.h:298
VAAPIEncodeContext::va_bit_rate
unsigned int va_bit_rate
Definition: vaapi_encode.h:255
VAAPIEncodeContext::pic_start
VAAPIEncodePicture * pic_start
Definition: vaapi_encode.h:305
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:481
VAAPIEncodePicture::opaque_ref
AVBufferRef * opaque_ref
Definition: vaapi_encode.h:83
VAAPIEncodeType::slice_params_size
size_t slice_params_size
Definition: vaapi_encode.h:448
FLAG_INTRA_ONLY
@ FLAG_INTRA_ONLY
Definition: vaapi_encode.h:403
VAAPIEncodeContext::config_attributes
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]
Definition: vaapi_encode.h:260
VAAPIEncodePicture::duration
int64_t duration
Definition: vaapi_encode.h:79
index
int index
Definition: gxfenc.c:89
VAAPIEncodeContext::pic_end
VAAPIEncodePicture * pic_end
Definition: vaapi_encode.h:305
VAAPIEncodePicture::encode_issued
int encode_issued
Definition: vaapi_encode.h:94
VAAPIEncodeProfile::nb_components
int nb_components
Definition: vaapi_encode.h:156
VAAPIEncodePicture::slices
VAAPIEncodeSlice * slices
Definition: vaapi_encode.h:136
VAAPIEncodePicture::input_surface
VASurfaceID input_surface
Definition: vaapi_encode.h:98
VAAPIEncodePicture::type
int type
Definition: vaapi_encode.h:92
AVFifo
Definition: fifo.c:35
FLAG_CONSTANT_QUALITY_ONLY
@ FLAG_CONSTANT_QUALITY_ONLY
Definition: vaapi_encode.h:401
RC_MODE_CBR
@ RC_MODE_CBR
Definition: vaapi_encode.h:168
VAAPIEncodeRCMode::mode
int mode
Definition: vaapi_encode.h:178
VAAPIEncodeProfile::depth
int depth
Definition: vaapi_encode.h:154
VAAPIEncodeContext::slice_block_height
int slice_block_height
Definition: vaapi_encode.h:234
AVCodecHWConfigInternal
Definition: hwconfig.h:25
VAAPIEncodeContext::recon_frames
AVHWFramesContext * recon_frames
Definition: vaapi_encode.h:276
VAAPIEncodeContext::explicit_rc_mode
int explicit_rc_mode
Definition: vaapi_encode.h:217
VAAPIEncodePicture::recon_surface
VASurfaceID recon_surface
Definition: vaapi_encode.h:101
VAAPIEncodeType::slice_header_type
int slice_header_type
Definition: vaapi_encode.h:462
VAAPIEncodePicture::output_buffer
VABufferID output_buffer
Definition: vaapi_encode.h:108
VAAPIEncodeContext::gop_per_idr
int gop_per_idr
Definition: vaapi_encode.h:349
VAAPIEncodePicture::priv_data
void * priv_data
Definition: vaapi_encode.h:110
VAAPIEncodeContext::va_context
VAContextID va_context
Definition: vaapi_encode.h:264
VAAPIEncodeContext::hrd_params
VAEncMiscParameterHRD hrd_params
Definition: vaapi_encode.h:290
VAAPIEncodePicture::display_order
int64_t display_order
Definition: vaapi_encode.h:76
VAAPIEncodePicture::nb_dpb_pics
int nb_dpb_pics
Definition: vaapi_encode.h:119
VAAPIEncodePicture::b_depth
int b_depth
Definition: vaapi_encode.h:93
VAAPIEncodeContext::roi_warned
int roi_warned
Definition: vaapi_encode.h:372
VAAPIEncodePicture::ref_removed
int ref_removed[2]
Definition: vaapi_encode.h:133
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:489
MAX_ASYNC_DEPTH
@ MAX_ASYNC_DEPTH
Definition: vaapi_encode.h:51
VAAPIEncodeContext::col_width
int col_width[MAX_TILE_COLS]
Definition: vaapi_encode.h:338
MAX_TILE_COLS
@ MAX_TILE_COLS
Definition: vaapi_encode.h:50
VAAPIEncodeContext::codec
const struct VAAPIEncodeType * codec
Definition: vaapi_encode.h:199
VAAPIEncodeType::init_slice_params
int(* init_slice_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode.h:454
VAAPIEncodeContext::encode_fifo
AVFifo * encode_fifo
Definition: vaapi_encode.h:379
MAX_GLOBAL_PARAMS
@ MAX_GLOBAL_PARAMS
Definition: vaapi_encode.h:42
FLAG_B_PICTURE_REFERENCES
@ FLAG_B_PICTURE_REFERENCES
Definition: vaapi_encode.h:407
VAAPIEncodeContext::row_bd
int row_bd[MAX_TILE_ROWS+1]
Definition: vaapi_encode.h:344
VAAPIEncodeContext::device_ref
AVBufferRef * device_ref
Definition: vaapi_encode.h:266
VAAPIEncodeContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_encode.h:272
VAAPIEncodePicture::roi
void * roi
Definition: vaapi_encode.h:89
VAAPIEncodeContext::codec_picture_params
void * codec_picture_params
Definition: vaapi_encode.h:302
VAAPIEncodeContext::output_delay
int64_t output_delay
Definition: vaapi_encode.h:314
VAAPIEncodeContext::max_frame_size
int max_frame_size
Definition: vaapi_encode.h:213
MAX_PARAM_BUFFER_SIZE
@ MAX_PARAM_BUFFER_SIZE
Definition: vaapi_encode.h:46
VAAPIEncodeContext::desired_b_depth
int desired_b_depth
Definition: vaapi_encode.h:210
RC_MODE_CQP
@ RC_MODE_CQP
Definition: vaapi_encode.h:167
VAAPIEncodeContext::input_order
int64_t input_order
Definition: vaapi_encode.h:312
avcodec.h
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:125
VAAPIEncodePicture::tail_data
char tail_data[MAX_PARAM_BUFFER_SIZE]
Tail data of current pic, used only for repeat header of AV1.
Definition: vaapi_encode.h:145
hwcontext_vaapi.h
VAAPIEncodeContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_encode.h:268
PICTURE_TYPE_IDR
@ PICTURE_TYPE_IDR
Definition: vaapi_encode.h:58
VAAPIEncodeContext::frame
AVFrame * frame
Definition: vaapi_encode.h:374
VAAPIEncodeRCMode::bitrate
int bitrate
Definition: vaapi_encode.h:186
VAAPIEncodeContext::ts_ring
int64_t ts_ring[MAX_REORDER_DELAY *3+MAX_ASYNC_DEPTH]
Definition: vaapi_encode.h:326
VAAPIEncodePicture::param_buffers
VABufferID * param_buffers
Definition: vaapi_encode.h:104
VAAPIEncodeContext::va_config
VAConfigID va_config
Definition: vaapi_encode.h:263
FLAG_TIMESTAMP_NO_DELAY
@ FLAG_TIMESTAMP_NO_DELAY
Definition: vaapi_encode.h:413
VAAPIEncodeContext::va_profile
VAProfile va_profile
Definition: vaapi_encode.h:249
AVCodecContext
main external API structure.
Definition: avcodec.h:445
VAAPIEncodeContext::nb_next_prev
int nb_next_prev
Definition: vaapi_encode.h:309
VAAPIEncodePicture::is_reference
int is_reference
Definition: vaapi_encode.h:114
VAAPIEncodeContext::input_frames_ref
AVBufferRef * input_frames_ref
Definition: vaapi_encode.h:271
VAAPIEncodeRCMode::hrd
int hrd
Definition: vaapi_encode.h:192
VAAPIEncodePicture::recon_image
AVFrame * recon_image
Definition: vaapi_encode.h:100
VAAPIEncodeProfile::log2_chroma_h
int log2_chroma_h
Definition: vaapi_encode.h:160
VAAPIEncodeContext::fr_params
VAEncMiscParameterFrameRate fr_params
Definition: vaapi_encode.h:291
VAAPIEncodeType::write_slice_header
int(* write_slice_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
Definition: vaapi_encode.h:472
VAAPIEncodeRCMode::maxrate
int maxrate
Definition: vaapi_encode.h:188
VAAPIEncodeContext::coded_buffer_ref
VABufferID * coded_buffer_ref
Head data for current output pkt, used only for AV1.
Definition: vaapi_encode.h:391
VAAPIEncodeContext::decode_delay
int64_t decode_delay
Definition: vaapi_encode.h:318
VAAPIEncodePicture::output_buffer_ref
VABufferID * output_buffer_ref
Definition: vaapi_encode.h:107
VAAPIEncodePicture::next
struct VAAPIEncodePicture * next
Definition: vaapi_encode.h:74
VAAPIEncodeType::sequence_params_size
size_t sequence_params_size
Definition: vaapi_encode.h:446
VAAPIEncodeContext::explicit_qp
int explicit_qp
Definition: vaapi_encode.h:221
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
RC_MODE_AVBR
@ RC_MODE_AVBR
Definition: vaapi_encode.h:172
VAAPIEncodeContext::surface_height
int surface_height
Definition: vaapi_encode.h:230
VAAPIEncodePicture::input_image
AVFrame * input_image
Definition: vaapi_encode.h:97
VAAPIEncodeSlice::block_size
int block_size
Definition: vaapi_encode.h:69
VAAPIEncodeRCMode
Definition: vaapi_encode.h:176
VAAPIEncodeContext::idr_counter
int idr_counter
Definition: vaapi_encode.h:354
VAAPIEncodeContext::next_prev
VAAPIEncodePicture * next_prev[MAX_PICTURE_REFERENCES]
Definition: vaapi_encode.h:308
AVPacket
This structure stores compressed data.
Definition: packet.h:499
VAAPIEncodePicture::encode_order
int64_t encode_order
Definition: vaapi_encode.h:77
VAAPIEncodeContext::col_bd
int col_bd[MAX_TILE_COLS+1]
Definition: vaapi_encode.h:342
VAAPIEncodeContext::encode_order
int64_t encode_order
Definition: vaapi_encode.h:316
RC_MODE_ICQ
@ RC_MODE_ICQ
Definition: vaapi_encode.h:170
VAAPIEncodeProfile::log2_chroma_w
int log2_chroma_w
Definition: vaapi_encode.h:158
hwcontext.h
PICTURE_TYPE_P
@ PICTURE_TYPE_P
Definition: vaapi_encode.h:60
VAAPIEncodeContext::slice_block_cols
int slice_block_cols
Definition: vaapi_encode.h:330
VAAPIEncodeType::picture_priv_data_size
size_t picture_priv_data_size
Definition: vaapi_encode.h:442
VAAPIEncodeType::get_encoder_caps
int(* get_encoder_caps)(AVCodecContext *avctx)
Definition: vaapi_encode.h:433
VAAPIEncodePicture::nb_param_buffers
int nb_param_buffers
Definition: vaapi_encode.h:103
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68
PICTURE_TYPE_I
@ PICTURE_TYPE_I
Definition: vaapi_encode.h:59
VAAPIEncodeRCMode::quality
int quality
Definition: vaapi_encode.h:190
VAAPIEncodeContext::b_per_p
int b_per_p
Definition: vaapi_encode.h:352
int
int
Definition: ffmpeg_filter.c:424
FLAG_B_PICTURES
@ FLAG_B_PICTURES
Definition: vaapi_encode.h:405
VAAPIEncodeContext::end_of_stream
int end_of_stream
Definition: vaapi_encode.h:356
MAX_REFERENCE_LIST_NUM
@ MAX_REFERENCE_LIST_NUM
Definition: vaapi_encode.h:52
VAAPIEncodeProfile
Definition: vaapi_encode.h:150
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1397
VAAPIEncodeRCMode::name
const char * name
Definition: vaapi_encode.h:180
VAAPIEncodeContext::force_idr
int force_idr
Definition: vaapi_encode.h:353
VAAPIEncodePicture::nb_slices
int nb_slices
Definition: vaapi_encode.h:135
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:35
VAAPIEncodeContext::idr_interval
int idr_interval
Definition: vaapi_encode.h:207