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