FFmpeg
vaapi_encode_av1.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Intel Corporation
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <va/va.h>
22 #include <va/va_enc_av1.h>
23 
24 #include "libavutil/pixdesc.h"
25 #include "libavutil/opt.h"
26 
27 #include "cbs_av1.h"
28 #include "put_bits.h"
29 #include "codec_internal.h"
30 #include "av1_levels.h"
31 #include "vaapi_encode.h"
32 
33 #define AV1_MAX_QUANT 255
34 
35 typedef struct VAAPIEncodeAV1Picture {
37  int slot;
39 
40 typedef struct VAAPIEncodeAV1Context {
42  AV1RawOBU sh; /**< sequence header.*/
43  AV1RawOBU fh; /**< frame header.*/
46  VAConfigAttribValEncAV1 attr;
47  VAConfigAttribValEncAV1Ext1 attr_ext1;
48  VAConfigAttribValEncAV1Ext2 attr_ext2;
49 
50  char sh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded sequence header data. */
51  size_t sh_data_len; /**< bit length of sh_data. */
52  char fh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded frame header data. */
53  size_t fh_data_len; /**< bit length of fh_data. */
54 
55  uint8_t uniform_tile;
57  int sb_cols;
58  int sb_rows;
65 
70 
71  int q_idx_idr;
72  int q_idx_p;
73  int q_idx_b;
74 
75  /** bit positions in current frame header */
80 
81  /** user options */
82  int profile;
83  int level;
84  int tier;
88 
90  PutBitContext *pbc, int length,
91  const char *str, const int *subscripts,
92  int64_t value)
93 {
94  VAAPIEncodeAV1Context *priv = ctx;
95  int position;
96 
97  position = put_bits_count(pbc);
98  av_assert0(position >= length);
99 
100  if (!strcmp(str, "base_q_idx"))
101  priv->qindex_offset = position - length;
102  else if (!strcmp(str, "loop_filter_level[0]"))
103  priv->loopfilter_offset = position - length;
104  else if (!strcmp(str, "cdef_damping_minus_3"))
105  priv->cdef_start_offset = position - length;
106  else if (!strcmp(str, "cdef_uv_sec_strength[i]"))
107  priv->cdef_param_size = position - priv->cdef_start_offset;
108 }
109 
111 {
112  VAAPIEncodeContext *ctx = avctx->priv_data;
113  VAAPIEncodeAV1Context *priv = avctx->priv_data;
114 
115  // Surfaces must be aligned to superblock boundaries.
116  ctx->surface_width = FFALIGN(avctx->width, priv->use_128x128_superblock ? 128 : 64);
117  ctx->surface_height = FFALIGN(avctx->height, priv->use_128x128_superblock ? 128 : 64);
118 
119  return 0;
120 }
121 
123 {
124  VAAPIEncodeContext *ctx = avctx->priv_data;
125  VAAPIEncodeAV1Context *priv = avctx->priv_data;
126  int ret;
127 
128  ret = ff_cbs_init(&priv->cbc, AV_CODEC_ID_AV1, avctx);
129  if (ret < 0)
130  return ret;
131  priv->cbc->trace_enable = 1;
132  priv->cbc->trace_level = AV_LOG_DEBUG;
133  priv->cbc->trace_context = ctx;
135 
136  if (ctx->rc_mode->quality) {
137  priv->q_idx_p = av_clip(ctx->rc_quality, 0, AV1_MAX_QUANT);
138  if (fabs(avctx->i_quant_factor) > 0.0)
139  priv->q_idx_idr =
140  av_clip((fabs(avctx->i_quant_factor) * priv->q_idx_p +
141  avctx->i_quant_offset) + 0.5,
142  0, AV1_MAX_QUANT);
143  else
144  priv->q_idx_idr = priv->q_idx_p;
145 
146  if (fabs(avctx->b_quant_factor) > 0.0)
147  priv->q_idx_b =
148  av_clip((fabs(avctx->b_quant_factor) * priv->q_idx_p +
149  avctx->b_quant_offset) + 0.5,
150  0, AV1_MAX_QUANT);
151  else
152  priv->q_idx_b = priv->q_idx_p;
153  } else {
154  /** Arbitrary value */
155  priv->q_idx_idr = priv->q_idx_p = priv->q_idx_b = 128;
156  }
157 
158  return 0;
159 }
160 
163  uint8_t type,
164  void *obu_unit)
165 {
166  int ret;
167 
169  type, obu_unit, NULL);
170  if (ret < 0) {
171  av_log(avctx, AV_LOG_ERROR, "Failed to add OBU unit: "
172  "type = %d.\n", type);
173  return ret;
174  }
175 
176  return 0;
177 }
178 
180  char *data, size_t *data_len,
182 {
183  VAAPIEncodeAV1Context *priv = avctx->priv_data;
184  int ret;
185 
186  ret = ff_cbs_write_fragment_data(priv->cbc, bs);
187  if (ret < 0) {
188  av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n");
189  return ret;
190  }
191 
192  if ((size_t)8 * MAX_PARAM_BUFFER_SIZE < 8 * bs->data_size - bs->data_bit_padding) {
193  av_log(avctx, AV_LOG_ERROR, "Access unit too large: "
194  "%zu < %zu.\n", (size_t)8 * MAX_PARAM_BUFFER_SIZE,
195  8 * bs->data_size - bs->data_bit_padding);
196  return AVERROR(ENOSPC);
197  }
198 
199  memcpy(data, bs->data, bs->data_size);
200  *data_len = 8 * bs->data_size - bs->data_bit_padding;
201 
202  return 0;
203 }
204 
205 static int tile_log2(int blkSize, int target) {
206  int k;
207  for (k = 0; (blkSize << k) < target; k++);
208  return k;
209 }
210 
212 {
213  VAAPIEncodeAV1Context *priv = avctx->priv_data;
214  int mi_cols, mi_rows, sb_shift, sb_size;
215  int max_tile_area_sb, max_tile_area_sb_varied;
216  int tile_width_sb, tile_height_sb, widest_tile_sb;
217  int tile_cols, tile_rows;
218  int min_log2_tiles;
219  int i;
220 
221  if (priv->tile_cols > AV1_MAX_TILE_COLS ||
222  priv->tile_rows > AV1_MAX_TILE_ROWS) {
223  av_log(avctx, AV_LOG_ERROR, "Invalid tile number %dx%d, should less than %dx%d.\n",
225  return AVERROR(EINVAL);
226  }
227 
228  mi_cols = 2 * ((avctx->width + 7) >> 3);
229  mi_rows = 2 * ((avctx->height + 7) >> 3);
230  priv->sb_cols = priv->use_128x128_superblock ?
231  ((mi_cols + 31) >> 5) : ((mi_cols + 15) >> 4);
232  priv->sb_rows = priv->use_128x128_superblock ?
233  ((mi_rows + 31) >> 5) : ((mi_rows + 15) >> 4);
234  sb_shift = priv->use_128x128_superblock ? 5 : 4;
235  sb_size = sb_shift + 2;
236  priv->max_tile_width_sb = AV1_MAX_TILE_WIDTH >> sb_size;
237  max_tile_area_sb = AV1_MAX_TILE_AREA >> (2 * sb_size);
238 
242  min_log2_tiles = FFMAX(priv->min_log2_tile_cols,
243  tile_log2(max_tile_area_sb, priv->sb_rows * priv->sb_cols));
244 
245  tile_cols = av_clip(priv->tile_cols, (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, priv->sb_cols);
246 
247  if (!priv->tile_cols)
248  priv->tile_cols = tile_cols;
249  else if (priv->tile_cols != tile_cols){
250  av_log(avctx, AV_LOG_ERROR, "Invalid tile cols %d, should be in range of %d~%d\n",
251  priv->tile_cols,
252  (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb,
253  priv->sb_cols);
254  return AVERROR(EINVAL);
255  }
256 
257  priv->tile_cols_log2 = tile_log2(1, priv->tile_cols);
258  tile_width_sb = (priv->sb_cols + (1 << priv->tile_cols_log2) - 1) >>
259  priv->tile_cols_log2;
260 
261  if (priv->tile_rows > priv->sb_rows) {
262  av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d, should be less than %d.\n",
263  priv->tile_rows, priv->sb_rows);
264  return AVERROR(EINVAL);
265  }
266 
267  /** Try user setting tile rows number first. */
268  tile_rows = priv->tile_rows ? priv->tile_rows : 1;
269  for (; tile_rows <= priv->sb_rows && tile_rows <= AV1_MAX_TILE_ROWS; tile_rows++) {
270  /** try uniformed tile. */
271  priv->tile_rows_log2 = tile_log2(1, tile_rows);
272  if ((priv->sb_cols + tile_width_sb - 1) / tile_width_sb == priv->tile_cols) {
273  for (i = 0; i < priv->tile_cols - 1; i++)
274  priv->width_in_sbs_minus_1[i] = tile_width_sb - 1;
275  priv->width_in_sbs_minus_1[i] = priv->sb_cols - (priv->tile_cols - 1) * tile_width_sb - 1;
276 
277  tile_height_sb = (priv->sb_rows + (1 << priv->tile_rows_log2) - 1) >>
278  priv->tile_rows_log2;
279 
280  if ((priv->sb_rows + tile_height_sb - 1) / tile_height_sb == tile_rows &&
281  tile_height_sb <= max_tile_area_sb / tile_width_sb) {
282  for (i = 0; i < tile_rows - 1; i++)
283  priv->height_in_sbs_minus_1[i] = tile_height_sb - 1;
284  priv->height_in_sbs_minus_1[i] = priv->sb_rows - (tile_rows - 1) * tile_height_sb - 1;
285 
286  priv->uniform_tile = 1;
287  priv->min_log2_tile_rows = FFMAX(min_log2_tiles - priv->tile_cols_log2, 0);
288 
289  break;
290  }
291  }
292 
293  /** try non-uniformed tile. */
294  widest_tile_sb = 0;
295  for (i = 0; i < priv->tile_cols; i++) {
296  priv->width_in_sbs_minus_1[i] = (i + 1) * priv->sb_cols / priv->tile_cols - i * priv->sb_cols / priv->tile_cols - 1;
297  widest_tile_sb = FFMAX(widest_tile_sb, priv->width_in_sbs_minus_1[i] + 1);
298  }
299 
300  if (min_log2_tiles)
301  max_tile_area_sb_varied = (priv->sb_rows * priv->sb_cols) >> (min_log2_tiles + 1);
302  else
303  max_tile_area_sb_varied = priv->sb_rows * priv->sb_cols;
304  priv->max_tile_height_sb = FFMAX(1, max_tile_area_sb_varied / widest_tile_sb);
305 
306  if (tile_rows == av_clip(tile_rows, (priv->sb_rows + priv->max_tile_height_sb - 1) / priv->max_tile_height_sb, priv->sb_rows)) {
307  for (i = 0; i < tile_rows; i++)
308  priv->height_in_sbs_minus_1[i] = (i + 1) * priv->sb_rows / tile_rows - i * priv->sb_rows / tile_rows - 1;
309 
310  break;
311  }
312 
313  /** Return invalid parameter if explicit tile rows is set. */
314  if (priv->tile_rows) {
315  av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d.\n", priv->tile_rows);
316  return AVERROR(EINVAL);
317  }
318  }
319 
320  priv->tile_rows = tile_rows;
321  av_log(avctx, AV_LOG_DEBUG, "Setting tile cols/rows to %d/%d.\n",
322  priv->tile_cols, priv->tile_rows);
323 
324  /** check if tile cols/rows is supported by driver. */
325  if (priv->attr_ext2.bits.max_tile_num_minus1) {
326  if ((priv->tile_cols * priv->tile_rows - 1) > priv->attr_ext2.bits.max_tile_num_minus1) {
327  av_log(avctx, AV_LOG_ERROR, "Unsupported tile num %d * %d = %d by driver, "
328  "should be at most %d.\n", priv->tile_cols, priv->tile_rows,
329  priv->tile_cols * priv->tile_rows,
330  priv->attr_ext2.bits.max_tile_num_minus1 + 1);
331  return AVERROR(EINVAL);
332  }
333  }
334 
335  /** check if tile group numbers is valid. */
336  if (priv->tile_groups > priv->tile_cols * priv->tile_rows) {
337  av_log(avctx, AV_LOG_WARNING, "Invalid tile groups number %d, "
338  "correct to %d.\n", priv->tile_groups, priv->tile_cols * priv->tile_rows);
339  priv->tile_groups = priv->tile_cols * priv->tile_rows;
340  }
341 
342  return 0;
343 }
344 
346  char *data, size_t *data_len)
347 {
348  VAAPIEncodeAV1Context *priv = avctx->priv_data;
349 
350  memcpy(data, &priv->sh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char));
351  *data_len = priv->sh_data_len;
352 
353  return 0;
354 }
355 
357 {
358  VAAPIEncodeContext *ctx = avctx->priv_data;
359  VAAPIEncodeAV1Context *priv = avctx->priv_data;
360  AV1RawOBU *sh_obu = &priv->sh;
362  VAEncSequenceParameterBufferAV1 *vseq = ctx->codec_sequence_params;
363  CodedBitstreamFragment *obu = &priv->current_obu;
364  const AVPixFmtDescriptor *desc;
365  int ret;
366 
367  memset(sh_obu, 0, sizeof(*sh_obu));
369 
371  av_assert0(desc);
372 
373  sh->seq_profile = avctx->profile;
376  sh->frame_width_bits_minus_1 = av_log2(avctx->width);
378  sh->max_frame_width_minus_1 = avctx->width - 1;
379  sh->max_frame_height_minus_1 = avctx->height - 1;
380  sh->seq_tier[0] = priv->tier;
381  /** enable order hint and reserve maximum 8 bits for it by default. */
382  sh->enable_order_hint = 1;
383  sh->order_hint_bits_minus_1 = 7;
384 
386  .high_bitdepth = desc->comp[0].depth == 8 ? 0 : 1,
387  .color_primaries = avctx->color_primaries,
388  .transfer_characteristics = avctx->color_trc,
389  .matrix_coefficients = avctx->colorspace,
390  .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
391  avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
394  .subsampling_x = desc->log2_chroma_w,
395  .subsampling_y = desc->log2_chroma_h,
396  };
397 
398  switch (avctx->chroma_sample_location) {
399  case AVCHROMA_LOC_LEFT:
401  break;
404  break;
405  default:
407  break;
408  }
409 
410  if (avctx->level != AV_LEVEL_UNKNOWN) {
411  sh->seq_level_idx[0] = avctx->level;
412  } else {
413  const AV1LevelDescriptor *level;
414  float framerate;
415 
416  if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
417  framerate = avctx->framerate.num / avctx->framerate.den;
418  else
419  framerate = 0;
420 
421  level = ff_av1_guess_level(avctx->bit_rate, priv->tier,
422  ctx->surface_width, ctx->surface_height,
423  priv->tile_rows * priv->tile_cols,
424  priv->tile_cols, framerate);
425  if (level) {
426  av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name);
427  sh->seq_level_idx[0] = level->level_idx;
428  } else {
429  av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to "
430  "any normal level, using maximum parameters level by default.\n");
431  sh->seq_level_idx[0] = 31;
432  sh->seq_tier[0] = 1;
433  }
434  }
435  vseq->seq_profile = sh->seq_profile;
436  vseq->seq_level_idx = sh->seq_level_idx[0];
437  vseq->seq_tier = sh->seq_tier[0];
438  vseq->order_hint_bits_minus_1 = sh->order_hint_bits_minus_1;
439  vseq->intra_period = ctx->gop_size;
440  vseq->ip_period = ctx->b_per_p + 1;
441 
442  vseq->seq_fields.bits.enable_order_hint = sh->enable_order_hint;
443 
444  if (!(ctx->va_rc_mode & VA_RC_CQP)) {
445  vseq->bits_per_second = ctx->va_bit_rate;
446  vseq->seq_fields.bits.enable_cdef = sh->enable_cdef = 1;
447  }
448 
450  if (ret < 0)
451  goto end;
452 
453  ret = vaapi_encode_av1_write_obu(avctx, priv->sh_data, &priv->sh_data_len, obu);
454  if (ret < 0)
455  goto end;
456 
457 end:
459  return ret;
460 }
461 
463  VAAPIEncodePicture *pic)
464 {
465  VAAPIEncodeContext *ctx = avctx->priv_data;
466  VAAPIEncodeAV1Context *priv = avctx->priv_data;
467  VAAPIEncodeAV1Picture *hpic = pic->priv_data;
468  AV1RawOBU *fh_obu = &priv->fh;
469  AV1RawFrameHeader *fh = &fh_obu->obu.frame.header;
470  VAEncPictureParameterBufferAV1 *vpic = pic->codec_picture_params;
471  CodedBitstreamFragment *obu = &priv->current_obu;
473  VAAPIEncodeAV1Picture *href;
474  int slot, i;
475  int ret;
476  static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] =
477  { 1, 0, 0, 0, -1, 0, -1, -1 };
478 
479  memset(fh_obu, 0, sizeof(*fh_obu));
480  pic->nb_slices = priv->tile_groups;
483  fh_obu->header.obu_has_size_field = 1;
484 
485  switch (pic->type) {
486  case PICTURE_TYPE_IDR:
487  av_assert0(pic->nb_refs[0] == 0 || pic->nb_refs[1]);
489  fh->refresh_frame_flags = 0xFF;
490  fh->base_q_idx = priv->q_idx_idr;
491  hpic->slot = 0;
492  hpic->last_idr_frame = pic->display_order;
493  break;
494  case PICTURE_TYPE_P:
495  av_assert0(pic->nb_refs[0]);
497  fh->base_q_idx = priv->q_idx_p;
498  ref = pic->refs[0][pic->nb_refs[0] - 1];
499  href = ref->priv_data;
500  hpic->slot = !href->slot;
501  hpic->last_idr_frame = href->last_idr_frame;
502  fh->refresh_frame_flags = 1 << hpic->slot;
503 
504  /** set the nearest frame in L0 as all reference frame. */
505  for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
506  fh->ref_frame_idx[i] = href->slot;
507  }
508  fh->primary_ref_frame = href->slot;
509  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
510  vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST;
511 
512  /** set the 2nd nearest frame in L0 as Golden frame. */
513  if (pic->nb_refs[0] > 1) {
514  ref = pic->refs[0][pic->nb_refs[0] - 2];
515  href = ref->priv_data;
516  fh->ref_frame_idx[3] = href->slot;
517  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
518  vpic->ref_frame_ctrl_l0.fields.search_idx1 = AV1_REF_FRAME_GOLDEN;
519  }
520  break;
521  case PICTURE_TYPE_B:
522  av_assert0(pic->nb_refs[0] && pic->nb_refs[1]);
524  fh->base_q_idx = priv->q_idx_b;
525  fh->refresh_frame_flags = 0x0;
526  fh->reference_select = 1;
527 
528  /** B frame will not be referenced, disable its recon frame. */
529  vpic->picture_flags.bits.disable_frame_recon = 1;
530 
531  /** Use LAST_FRAME and BWDREF_FRAME for reference. */
532  vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST;
533  vpic->ref_frame_ctrl_l1.fields.search_idx0 = AV1_REF_FRAME_BWDREF;
534 
535  ref = pic->refs[0][pic->nb_refs[0] - 1];
536  href = ref->priv_data;
537  hpic->last_idr_frame = href->last_idr_frame;
538  fh->primary_ref_frame = href->slot;
539  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
540  for (i = 0; i < AV1_REF_FRAME_GOLDEN; i++) {
541  fh->ref_frame_idx[i] = href->slot;
542  }
543 
544  ref = pic->refs[1][pic->nb_refs[1] - 1];
545  href = ref->priv_data;
546  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
548  fh->ref_frame_idx[i] = href->slot;
549  }
550  break;
551  default:
552  av_assert0(0 && "invalid picture type");
553  }
554 
555  fh->show_frame = pic->display_order <= pic->encode_order;
557  fh->frame_width_minus_1 = avctx->width - 1;
558  fh->frame_height_minus_1 = avctx->height - 1;
561  fh->order_hint = pic->display_order - hpic->last_idr_frame;
562  fh->tile_cols = priv->tile_cols;
563  fh->tile_rows = priv->tile_rows;
564  fh->tile_cols_log2 = priv->tile_cols_log2;
565  fh->tile_rows_log2 = priv->tile_rows_log2;
567  fh->tile_size_bytes_minus1 = priv->attr_ext2.bits.tile_size_bytes_minus1;
568 
569  /** ignore ONLY_4x4 mode for codedlossless is not fully implemented. */
570  if (priv->attr_ext2.bits.tx_mode_support & 0x04)
572  else if (priv->attr_ext2.bits.tx_mode_support & 0x02)
574  else {
575  av_log(avctx, AV_LOG_ERROR, "No available tx mode found.\n");
576  return AVERROR(EINVAL);
577  }
578 
579  for (i = 0; i < fh->tile_cols; i++)
580  fh->width_in_sbs_minus_1[i] = vpic->width_in_sbs_minus_1[i] = priv->width_in_sbs_minus_1[i];
581 
582  for (i = 0; i < fh->tile_rows; i++)
583  fh->height_in_sbs_minus_1[i] = vpic->height_in_sbs_minus_1[i] = priv->height_in_sbs_minus_1[i];
584 
585  memcpy(fh->loop_filter_ref_deltas, default_loop_filter_ref_deltas,
586  AV1_TOTAL_REFS_PER_FRAME * sizeof(int8_t));
587 
588  if (fh->frame_type == AV1_FRAME_KEY && fh->show_frame) {
589  fh->error_resilient_mode = 1;
590  }
591 
594 
595  vpic->base_qindex = fh->base_q_idx;
596  vpic->frame_width_minus_1 = fh->frame_width_minus_1;
597  vpic->frame_height_minus_1 = fh->frame_height_minus_1;
598  vpic->primary_ref_frame = fh->primary_ref_frame;
599  vpic->reconstructed_frame = pic->recon_surface;
600  vpic->coded_buf = pic->output_buffer;
601  vpic->tile_cols = fh->tile_cols;
602  vpic->tile_rows = fh->tile_rows;
603  vpic->order_hint = fh->order_hint;
604 #if VA_CHECK_VERSION(1, 15, 0)
605  vpic->refresh_frame_flags = fh->refresh_frame_flags;
606 #endif
607 
608  vpic->picture_flags.bits.enable_frame_obu = 0;
609  vpic->picture_flags.bits.frame_type = fh->frame_type;
610  vpic->picture_flags.bits.reduced_tx_set = fh->reduced_tx_set;
611  vpic->picture_flags.bits.error_resilient_mode = fh->error_resilient_mode;
612 
613  /** let driver decide to use single or compound reference prediction mode. */
614  vpic->mode_control_flags.bits.reference_mode = fh->reference_select ? 2 : 0;
615  vpic->mode_control_flags.bits.tx_mode = fh->tx_mode;
616 
617  vpic->tile_group_obu_hdr_info.bits.obu_has_size_field = 1;
618 
619  /** set reference. */
620  for (i = 0; i < AV1_REFS_PER_FRAME; i++)
621  vpic->ref_frame_idx[i] = fh->ref_frame_idx[i];
622 
623  for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++)
624  vpic->reference_frames[i] = VA_INVALID_SURFACE;
625 
626  for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) {
627  for (int j = 0; j < pic->nb_refs[i]; j++) {
628  VAAPIEncodePicture *ref_pic = pic->refs[i][j];
629 
630  slot = ((VAAPIEncodeAV1Picture*)ref_pic->priv_data)->slot;
631  av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE);
632 
633  vpic->reference_frames[slot] = ref_pic->recon_surface;
634  }
635  }
636 
637  ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh);
638  if (ret < 0)
639  goto end;
640 
641  ret = vaapi_encode_av1_write_obu(avctx, priv->fh_data, &priv->fh_data_len, obu);
642  if (ret < 0)
643  goto end;
644 
645  if (!(ctx->va_rc_mode & VA_RC_CQP)) {
646  vpic->min_base_qindex = av_clip(avctx->qmin, 1, AV1_MAX_QUANT);
647  vpic->max_base_qindex = av_clip(avctx->qmax, 1, AV1_MAX_QUANT);
648 
649  vpic->bit_offset_qindex = priv->qindex_offset;
650  vpic->bit_offset_loopfilter_params = priv->loopfilter_offset;
651  vpic->bit_offset_cdef_params = priv->cdef_start_offset;
652  vpic->size_in_bits_cdef_params = priv->cdef_param_size;
653  vpic->size_in_bits_frame_hdr_obu = priv->fh_data_len;
654  vpic->byte_offset_frame_hdr_obu_size = (((pic->type == PICTURE_TYPE_IDR) ?
655  priv->sh_data_len / 8 : 0) +
656  (fh_obu->header.obu_extension_flag ?
657  2 : 1));
658  }
659 
660 end:
662  return ret;
663 }
664 
666  VAAPIEncodePicture *pic,
667  VAAPIEncodeSlice *slice)
668 {
669  VAAPIEncodeAV1Context *priv = avctx->priv_data;
670  VAEncTileGroupBufferAV1 *vslice = slice->codec_slice_params;
671  CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data;
672  int div;
673 
674  /** Set tile group info. */
675  div = priv->tile_cols * priv->tile_rows / priv->tile_groups;
676  vslice->tg_start = slice->index * div;
677  if (slice->index == (priv->tile_groups - 1)) {
678  vslice->tg_end = priv->tile_cols * priv->tile_rows - 1;
679  cbctx->seen_frame_header = 0;
680  } else {
681  vslice->tg_end = (slice->index + 1) * div - 1;
682  }
683 
684  return 0;
685 }
686 
688  VAAPIEncodePicture *pic,
689  char *data, size_t *data_len)
690 {
691  VAAPIEncodeAV1Context *priv = avctx->priv_data;
692  CodedBitstreamFragment *obu = &priv->current_obu;
693  CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data;
694  AV1RawOBU *fh_obu = &priv->fh;
695  AV1RawFrameHeader *rep_fh = &fh_obu->obu.frame_header;
696  VAAPIEncodeAV1Picture *href;
697  int ret = 0;
698 
699  pic->tail_size = 0;
700  /** Pack repeat frame header. */
701  if (pic->display_order > pic->encode_order) {
702  memset(fh_obu, 0, sizeof(*fh_obu));
703  href = pic->refs[0][pic->nb_refs[0] - 1]->priv_data;
705  fh_obu->header.obu_has_size_field = 1;
706 
707  rep_fh->show_existing_frame = 1;
708  rep_fh->frame_to_show_map_idx = href->slot == 0;
709  rep_fh->frame_type = AV1_FRAME_INTER;
710  rep_fh->frame_width_minus_1 = avctx->width - 1;
711  rep_fh->frame_height_minus_1 = avctx->height - 1;
712  rep_fh->render_width_minus_1 = rep_fh->frame_width_minus_1;
714 
715  cbctx->seen_frame_header = 0;
716 
717  ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh);
718  if (ret < 0)
719  goto end;
720 
721  ret = vaapi_encode_av1_write_obu(avctx, pic->tail_data, &pic->tail_size, obu);
722  if (ret < 0)
723  goto end;
724 
725  pic->tail_size /= 8;
726  }
727 
728  memcpy(data, &priv->fh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char));
729  *data_len = priv->fh_data_len;
730 
731 end:
733  return ret;
734 }
735 
737  { AV_PROFILE_AV1_MAIN, 8, 3, 1, 1, VAProfileAV1Profile0 },
738  { AV_PROFILE_AV1_MAIN, 10, 3, 1, 1, VAProfileAV1Profile0 },
740 };
741 
745  .default_quality = 25,
746 
747  .get_encoder_caps = &vaapi_encode_av1_get_encoder_caps,
748  .configure = &vaapi_encode_av1_configure,
749 
750  .sequence_header_type = VAEncPackedHeaderSequence,
751  .sequence_params_size = sizeof(VAEncSequenceParameterBufferAV1),
752  .init_sequence_params = &vaapi_encode_av1_init_sequence_params,
753  .write_sequence_header = &vaapi_encode_av1_write_sequence_header,
754 
755  .picture_priv_data_size = sizeof(VAAPIEncodeAV1Picture),
756  .picture_header_type = VAEncPackedHeaderPicture,
757  .picture_params_size = sizeof(VAEncPictureParameterBufferAV1),
758  .init_picture_params = &vaapi_encode_av1_init_picture_params,
759  .write_picture_header = &vaapi_encode_av1_write_picture_header,
760 
761  .slice_params_size = sizeof(VAEncTileGroupBufferAV1),
762  .init_slice_params = &vaapi_encode_av1_init_slice_params,
763 };
764 
766 {
767  VAAPIEncodeContext *ctx = avctx->priv_data;
768  VAAPIEncodeAV1Context *priv = avctx->priv_data;
769  VAConfigAttrib attr;
770  VAStatus vas;
771  int ret;
772 
773  ctx->codec = &vaapi_encode_type_av1;
774 
775  ctx->desired_packed_headers =
776  VA_ENC_PACKED_HEADER_SEQUENCE |
777  VA_ENC_PACKED_HEADER_PICTURE;
778 
779  if (avctx->profile == AV_PROFILE_UNKNOWN)
780  avctx->profile = priv->profile;
781  if (avctx->level == AV_LEVEL_UNKNOWN)
782  avctx->level = priv->level;
783 
784  if (avctx->level != AV_LEVEL_UNKNOWN && avctx->level & ~0x1f) {
785  av_log(avctx, AV_LOG_ERROR, "Invalid level %d\n", avctx->level);
786  return AVERROR(EINVAL);
787  }
788 
789  ret = ff_vaapi_encode_init(avctx);
790  if (ret < 0)
791  return ret;
792 
793  attr.type = VAConfigAttribEncAV1;
794  vas = vaGetConfigAttributes(ctx->hwctx->display,
795  ctx->va_profile,
796  ctx->va_entrypoint,
797  &attr, 1);
798  if (vas != VA_STATUS_SUCCESS) {
799  av_log(avctx, AV_LOG_ERROR, "Failed to query "
800  "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
801  return AVERROR_EXTERNAL;
802  } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
803  priv->attr.value = 0;
804  av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not "
805  "supported.\n", attr.type);
806  } else {
807  priv->attr.value = attr.value;
808  }
809 
810  attr.type = VAConfigAttribEncAV1Ext1;
811  vas = vaGetConfigAttributes(ctx->hwctx->display,
812  ctx->va_profile,
813  ctx->va_entrypoint,
814  &attr, 1);
815  if (vas != VA_STATUS_SUCCESS) {
816  av_log(avctx, AV_LOG_ERROR, "Failed to query "
817  "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
818  return AVERROR_EXTERNAL;
819  } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
820  priv->attr_ext1.value = 0;
821  av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not "
822  "supported.\n", attr.type);
823  } else {
824  priv->attr_ext1.value = attr.value;
825  }
826 
827  /** This attr provides essential indicators, return error if not support. */
828  attr.type = VAConfigAttribEncAV1Ext2;
829  vas = vaGetConfigAttributes(ctx->hwctx->display,
830  ctx->va_profile,
831  ctx->va_entrypoint,
832  &attr, 1);
833  if (vas != VA_STATUS_SUCCESS || attr.value == VA_ATTRIB_NOT_SUPPORTED) {
834  av_log(avctx, AV_LOG_ERROR, "Failed to query "
835  "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
836  return AVERROR_EXTERNAL;
837  } else {
838  priv->attr_ext2.value = attr.value;
839  }
840 
841  av_opt_set_int(priv->cbc->priv_data, "fixed_obu_size_length",
842  priv->attr_ext2.bits.obu_size_bytes_minus1 + 1, 0);
843 
845  if (ret < 0)
846  return ret;
847 
848  return 0;
849 }
850 
852 {
853  VAAPIEncodeAV1Context *priv = avctx->priv_data;
854 
856  ff_cbs_close(&priv->cbc);
857 
858  return ff_vaapi_encode_close(avctx);
859 }
860 
861 #define OFFSET(x) offsetof(VAAPIEncodeAV1Context, x)
862 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
863 
867  { "profile", "Set profile (seq_profile)",
869  { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, .unit = "profile" },
870 
871 #define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
872  { .i64 = value }, 0, 0, FLAGS, .unit = "profile"
873  { PROFILE("main", AV_PROFILE_AV1_MAIN) },
874  { PROFILE("high", AV_PROFILE_AV1_HIGH) },
875  { PROFILE("professional", AV_PROFILE_AV1_PROFESSIONAL) },
876 #undef PROFILE
877 
878  { "tier", "Set tier (seq_tier)",
879  OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "tier" },
880  { "main", NULL, 0, AV_OPT_TYPE_CONST,
881  { .i64 = 0 }, 0, 0, FLAGS, .unit = "tier" },
882  { "high", NULL, 0, AV_OPT_TYPE_CONST,
883  { .i64 = 1 }, 0, 0, FLAGS, .unit = "tier" },
884  { "level", "Set level (seq_level_idx)",
886  { .i64 = AV_LEVEL_UNKNOWN }, AV_LEVEL_UNKNOWN, 0x1f, FLAGS, .unit = "level" },
887 
888 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
889  { .i64 = value }, 0, 0, FLAGS, .unit = "level"
890  { LEVEL("2.0", 0) },
891  { LEVEL("2.1", 1) },
892  { LEVEL("3.0", 4) },
893  { LEVEL("3.1", 5) },
894  { LEVEL("4.0", 8) },
895  { LEVEL("4.1", 9) },
896  { LEVEL("5.0", 12) },
897  { LEVEL("5.1", 13) },
898  { LEVEL("5.2", 14) },
899  { LEVEL("5.3", 15) },
900  { LEVEL("6.0", 16) },
901  { LEVEL("6.1", 17) },
902  { LEVEL("6.2", 18) },
903  { LEVEL("6.3", 19) },
904 #undef LEVEL
905 
906  { "tiles", "Tile columns x rows (Use minimal tile column/row number automatically by default)",
907  OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS },
908  { "tile_groups", "Number of tile groups for encoding",
909  OFFSET(tile_groups), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, AV1_MAX_TILE_ROWS * AV1_MAX_TILE_COLS, FLAGS },
910 
911  { NULL },
912 };
913 
915  { "b", "0" },
916  { "bf", "2" },
917  { "g", "120" },
918  { "qmin", "1" },
919  { "qmax", "255" },
920  { NULL },
921 };
922 
924  .class_name = "av1_vaapi",
925  .item_name = av_default_item_name,
926  .option = vaapi_encode_av1_options,
927  .version = LIBAVUTIL_VERSION_INT,
928 };
929 
931  .p.name = "av1_vaapi",
932  CODEC_LONG_NAME("AV1 (VAAPI)"),
933  .p.type = AVMEDIA_TYPE_VIDEO,
934  .p.id = AV_CODEC_ID_AV1,
935  .priv_data_size = sizeof(VAAPIEncodeAV1Context),
938  .close = &vaapi_encode_av1_close,
939  .p.priv_class = &vaapi_encode_av1_class,
940  .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
942  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
944  .defaults = vaapi_encode_av1_defaults,
945  .p.pix_fmts = (const enum AVPixelFormat[]) {
948  },
949  .hw_configs = ff_vaapi_encode_hw_configs,
950  .p.wrapper_name = "vaapi",
951 };
AV1RawSequenceHeader::seq_force_integer_mv
uint8_t seq_force_integer_mv
Definition: cbs_av1.h:120
vaapi_encode_av1_init
static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:765
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
VAAPIEncodeSlice::codec_slice_params
void * codec_slice_params
Definition: vaapi_encode.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
level
uint8_t level
Definition: svq3.c:204
AV1RawFrameHeader::primary_ref_frame
uint8_t primary_ref_frame
Definition: cbs_av1.h:187
av_clip
#define av_clip
Definition: common.h:98
FLAGS
#define FLAGS
Definition: vaapi_encode_av1.c:862
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AV1RawSequenceHeader::seq_level_idx
uint8_t seq_level_idx[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:87
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AV1_CSP_VERTICAL
@ AV1_CSP_VERTICAL
Definition: av1.h:134
CodedBitstreamAV1Context::seen_frame_header
int seen_frame_header
Definition: cbs_av1.h:445
CodedBitstreamContext::priv_data
void * priv_data
Internal codec-specific data.
Definition: cbs.h:240
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:685
ff_av1_vaapi_encoder
const FFCodec ff_av1_vaapi_encoder
Definition: vaapi_encode_av1.c:930
VAAPIEncodeAV1Context::max_log2_tile_rows
int max_log2_tile_rows
Definition: vaapi_encode_av1.c:69
AV1RawSequenceHeader
Definition: cbs_av1.h:73
AV1RawFrameHeader::show_frame
uint8_t show_frame
Definition: cbs_av1.h:172
AV1RawOBU::obu
union AV1RawOBU::@40 obu
AV1_MAX_TILE_AREA
@ AV1_MAX_TILE_AREA
Definition: av1.h:80
tile_log2
static int tile_log2(int blkSize, int target)
Definition: vaapi_encode_av1.c:205
ff_cbs_fragment_free
av_cold void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
Definition: cbs.c:185
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2962
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
VAAPIEncodePicture::tail_size
size_t tail_size
Byte length of tail_data.
Definition: vaapi_encode.h:147
ff_cbs_insert_unit_content
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, void *content_ref)
Insert a new unit into a fragment with the given content.
Definition: cbs.c:782
int64_t
long long int64_t
Definition: coverity.c:34
VAAPIEncodeAV1Context::cdef_param_size
int cdef_param_size
Definition: vaapi_encode_av1.c:79
ff_av1_guess_level
const AV1LevelDescriptor * ff_av1_guess_level(int64_t bitrate, int tier, int width, int height, int tiles, int tile_cols, float fps)
Guess the level of a stream from some parameters.
Definition: av1_levels.c:48
FLAG_B_PICTURES
@ FLAG_B_PICTURES
Definition: vaapi_encode.h:408
VAAPIEncodeAV1Context::height_in_sbs_minus_1
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]
Definition: vaapi_encode_av1.c:64
VAAPIEncodeAV1Context::fh_data
char fh_data[MAX_PARAM_BUFFER_SIZE]
coded frame header data.
Definition: vaapi_encode_av1.c:52
pixdesc.h
VAAPIEncodeAV1Context::cdef_start_offset
int cdef_start_offset
Definition: vaapi_encode_av1.c:78
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:678
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:683
ff_cbs_fragment_reset
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
Definition: cbs.c:171
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:219
vaapi_encode_av1_set_tile
static int vaapi_encode_av1_set_tile(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:211
VAAPIEncodeSlice
Definition: vaapi_encode.h:64
AVOption
AVOption.
Definition: opt.h:346
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:583
AV1RawFrameHeader::uniform_tile_spacing_flag
uint8_t uniform_tile_spacing_flag
Definition: cbs_av1.h:215
data
const char data[16]
Definition: mxf.c:148
VAAPIEncodeAV1Context::current_obu
CodedBitstreamFragment current_obu
Definition: vaapi_encode_av1.c:45
AVCodecContext::b_quant_offset
float b_quant_offset
qscale offset between IP and B-frames
Definition: avcodec.h:811
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
FFCodec
Definition: codec_internal.h:127
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
VAAPIEncodeAV1Context::fh
AV1RawOBU fh
frame header.
Definition: vaapi_encode_av1.c:43
ff_vaapi_encode_close
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
Definition: vaapi_encode.c:2982
VAAPIEncodeSlice::index
int index
Definition: vaapi_encode.h:65
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
PICTURE_TYPE_IDR
@ PICTURE_TYPE_IDR
Definition: vaapi_encode.h:58
AV_PROFILE_AV1_PROFESSIONAL
#define AV_PROFILE_AV1_PROFESSIONAL
Definition: defs.h:169
AVCodecContext::qmax
int qmax
maximum quantizer
Definition: avcodec.h:1263
AV1_TX_MODE_SELECT
@ AV1_TX_MODE_SELECT
Definition: av1.h:183
VAAPIEncodeAV1Context::common
VAAPIEncodeContext common
Definition: vaapi_encode_av1.c:41
AV1RawOBU::header
AV1RawOBUHeader header
Definition: cbs_av1.h:401
VAAPIEncodeAV1Context::q_idx_b
int q_idx_b
Definition: vaapi_encode_av1.c:73
VAAPIEncodeAV1Context::min_log2_tile_cols
int min_log2_tile_cols
Definition: vaapi_encode_av1.c:66
VAAPIEncodeAV1Context::qindex_offset
int qindex_offset
bit positions in current frame header
Definition: vaapi_encode_av1.c:76
AV1_REF_FRAME_BWDREF
@ AV1_REF_FRAME_BWDREF
Definition: av1.h:67
AV1RawSequenceHeader::seq_profile
uint8_t seq_profile
Definition: cbs_av1.h:74
vaapi_encode_av1_init_slice_params
static int vaapi_encode_av1_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode_av1.c:665
ff_cbs_close
av_cold void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
Definition: cbs.c:141
VAAPIEncodePicture::refs
struct VAAPIEncodePicture * refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]
Definition: vaapi_encode.h:125
AV1RawFrame::header
AV1RawFrameHeader header
Definition: cbs_av1.h:306
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:560
AV1RawColorConfig
Definition: cbs_av1.h:41
VAAPIEncodePicture::nb_refs
int nb_refs[MAX_REFERENCE_LIST_NUM]
Definition: vaapi_encode.h:124
AVCodecContext::i_quant_factor
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
Definition: avcodec.h:820
AV1RawFrameHeader::loop_filter_ref_deltas
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:260
FFCodecDefault
Definition: codec_internal.h:97
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
vaapi_encode.h
AV1_OBU_FRAME_HEADER
@ AV1_OBU_FRAME_HEADER
Definition: av1.h:32
VAAPIEncodePicture
Definition: vaapi_encode.h:73
vaapi_encode_av1_profiles
static const VAAPIEncodeProfile vaapi_encode_av1_profiles[]
Definition: vaapi_encode_av1.c:736
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
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
FLAG_TIMESTAMP_NO_DELAY
@ FLAG_TIMESTAMP_NO_DELAY
Definition: vaapi_encode.h:416
AV1_REF_FRAME_GOLDEN
@ AV1_REF_FRAME_GOLDEN
Definition: av1.h:66
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV1_REF_FRAME_LAST
@ AV1_REF_FRAME_LAST
Definition: av1.h:63
CodedBitstreamContext::trace_level
int trace_level
Log level to use for default trace output.
Definition: cbs.h:263
AV1RawFrameHeader::tx_mode
uint8_t tx_mode
Definition: cbs_av1.h:275
AV1RawFrameHeader::base_q_idx
uint8_t base_q_idx
Definition: cbs_av1.h:230
cbs_av1.h
AV1RawOBUHeader::obu_extension_flag
uint8_t obu_extension_flag
Definition: cbs_av1.h:32
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:671
VAAPIEncodeAV1Picture::last_idr_frame
int64_t last_idr_frame
Definition: vaapi_encode_av1.c:36
VAAPIEncodeAV1Picture::slot
int slot
Definition: vaapi_encode_av1.c:37
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV1_MAX_QUANT
#define AV1_MAX_QUANT
Definition: vaapi_encode_av1.c:33
AV1_TX_MODE_LARGEST
@ AV1_TX_MODE_LARGEST
Definition: av1.h:182
vaapi_encode_av1_init_sequence_params
static int vaapi_encode_av1_init_sequence_params(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:356
VAAPIEncodePicture::codec_picture_params
void * codec_picture_params
Definition: vaapi_encode.h:111
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:122
VAAPIEncodeAV1Context::width_in_sbs_minus_1
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]
Definition: vaapi_encode_av1.c:63
AV1RawFrameHeader::render_width_minus_1
uint16_t render_width_minus_1
Definition: cbs_av1.h:193
CodedBitstreamFragment::data_size
size_t data_size
The number of bytes in the bitstream.
Definition: cbs.h:135
AV1_TOTAL_REFS_PER_FRAME
@ AV1_TOTAL_REFS_PER_FRAME
Definition: av1.h:86
vaapi_encode_av1_write_sequence_header
static int vaapi_encode_av1_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)
Definition: vaapi_encode_av1.c:345
MAX_REFERENCE_LIST_NUM
@ MAX_REFERENCE_LIST_NUM
Definition: vaapi_encode.h:52
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
tile_rows
int tile_rows
Definition: h265_levels.c:217
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
tile_cols
int tile_cols
Definition: av1_levels.c:73
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
AV1RawFrameHeader::frame_width_minus_1
uint16_t frame_width_minus_1
Definition: cbs_av1.h:188
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1396
tier
int tier
Definition: av1_levels.c:48
AV1RawSequenceHeader::seq_tier
uint8_t seq_tier[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:88
CodedBitstreamFragment::data_bit_padding
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
Definition: cbs.h:139
color_range
color_range
Definition: vf_selectivecolor.c:43
VAAPIEncodeAV1Context::tile_groups
int tile_groups
Definition: vaapi_encode_av1.c:86
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:558
VAAPIEncodeType
Definition: vaapi_encode.h:419
PutBitContext
Definition: put_bits.h:50
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
VAAPIEncodeContext
Definition: vaapi_encode.h:195
vaapi_encode_av1_trace_write_log
static void vaapi_encode_av1_trace_write_log(void *ctx, PutBitContext *pbc, int length, const char *str, const int *subscripts, int64_t value)
Definition: vaapi_encode_av1.c:89
framerate
float framerate
Definition: av1_levels.c:29
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AV1RawOBU
Definition: cbs_av1.h:400
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
AV1RawFrameHeader::tile_size_bytes_minus1
uint8_t tile_size_bytes_minus1
Definition: cbs_av1.h:223
NULL
#define NULL
Definition: coverity.c:32
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:210
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:695
VAAPIEncodeAV1Context
Definition: vaapi_encode_av1.c:40
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:280
CodedBitstreamContext::trace_context
void * trace_context
User context pointer to pass to trace callbacks.
Definition: cbs.h:267
AV1RawFrameHeader
Definition: cbs_av1.h:165
AV1_FRAME_KEY
@ AV1_FRAME_KEY
Definition: av1.h:53
AVCHROMA_LOC_LEFT
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:704
AV_LEVEL_UNKNOWN
#define AV_LEVEL_UNKNOWN
Definition: defs.h:196
VAAPIEncodeType::profiles
const VAAPIEncodeProfile * profiles
Definition: vaapi_encode.h:422
AV1RawFrameHeader::width_in_sbs_minus_1
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]
Definition: cbs_av1.h:220
AVCHROMA_LOC_TOPLEFT
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:706
vaapi_encode_av1_add_obu
static int vaapi_encode_av1_add_obu(AVCodecContext *avctx, CodedBitstreamFragment *au, uint8_t type, void *obu_unit)
Definition: vaapi_encode_av1.c:161
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:302
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:495
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:245
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV1RawColorConfig::chroma_sample_position
uint8_t chroma_sample_position
Definition: cbs_av1.h:54
VAAPIEncodeAV1Context::attr_ext2
VAConfigAttribValEncAV1Ext2 attr_ext2
Definition: vaapi_encode_av1.c:48
AV1_FRAME_INTER
@ AV1_FRAME_INTER
Definition: av1.h:54
VAAPIEncodeAV1Context::cbc
CodedBitstreamContext * cbc
Definition: vaapi_encode_av1.c:44
AVCodecContext::level
int level
Encoding level descriptor.
Definition: avcodec.h:1783
AV1_MAX_TILE_WIDTH
@ AV1_MAX_TILE_WIDTH
Definition: av1.h:79
AV1RawSequenceHeader::seq_force_screen_content_tools
uint8_t seq_force_screen_content_tools
Definition: cbs_av1.h:118
av_opt_set_int
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
Definition: opt.c:789
AV1RawSequenceHeader::max_frame_height_minus_1
uint16_t max_frame_height_minus_1
Definition: cbs_av1.h:99
vaapi_encode_av1_close
static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:851
VAAPIEncodeAV1Context::sh
AV1RawOBU sh
sequence header.
Definition: vaapi_encode_av1.c:42
AV1_CSP_UNKNOWN
@ AV1_CSP_UNKNOWN
Definition: av1.h:133
AV1RawFrameHeader::ref_frame_idx
int8_t ref_frame_idx[AV1_REFS_PER_FRAME]
Definition: cbs_av1.h:204
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
VAAPIEncodePicture::type
int type
Definition: vaapi_encode.h:92
VAAPIEncodeAV1Context::attr_ext1
VAConfigAttribValEncAV1Ext1 attr_ext1
Definition: vaapi_encode_av1.c:47
AV1RawFrameHeader::refresh_frame_flags
uint8_t refresh_frame_flags
Definition: cbs_av1.h:198
codec_internal.h
VAAPI_ENCODE_RC_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
Definition: vaapi_encode.h:532
AV1RawFrameHeader::reduced_tx_set
uint8_t reduced_tx_set
Definition: cbs_av1.h:280
AV1RawFrameHeader::tile_cols_log2
uint8_t tile_cols_log2
Definition: cbs_av1.h:216
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
VAAPIEncodeAV1Context::sb_rows
int sb_rows
Definition: vaapi_encode_av1.c:58
AV1_REFS_PER_FRAME
@ AV1_REFS_PER_FRAME
Definition: av1.h:85
AV1RawOBU::sequence_header
AV1RawSequenceHeader sequence_header
Definition: cbs_av1.h:406
CodedBitstreamFragment::data
uint8_t * data
Pointer to the bitstream form of this fragment.
Definition: cbs.h:128
AV1RawSequenceHeader::frame_height_bits_minus_1
uint8_t frame_height_bits_minus_1
Definition: cbs_av1.h:97
CodedBitstreamContext::trace_write_callback
CBSTraceWriteCallback trace_write_callback
Callback for write tracing.
Definition: cbs.h:281
AV1_OBU_SEQUENCE_HEADER
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
vaapi_encode_av1_options
static const AVOption vaapi_encode_av1_options[]
Definition: vaapi_encode_av1.c:864
AV1LevelDescriptor
Definition: av1_levels.h:26
VAAPIEncodeAV1Context::min_log2_tile_rows
int min_log2_tile_rows
Definition: vaapi_encode_av1.c:68
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:505
VAAPIEncodePicture::recon_surface
VASurfaceID recon_surface
Definition: vaapi_encode.h:101
VAAPIEncodeAV1Context::tile_cols
int tile_cols
Definition: vaapi_encode_av1.c:85
VAAPIEncodeAV1Context::use_128x128_superblock
uint8_t use_128x128_superblock
Definition: vaapi_encode_av1.c:56
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
VAAPIEncodePicture::output_buffer
VABufferID output_buffer
Definition: vaapi_encode.h:108
VAAPIEncodePicture::priv_data
void * priv_data
Definition: vaapi_encode.h:110
AV_PROFILE_AV1_HIGH
#define AV_PROFILE_AV1_HIGH
Definition: defs.h:168
VAAPIEncodeAV1Context::loopfilter_offset
int loopfilter_offset
Definition: vaapi_encode_av1.c:77
AV1RawFrameHeader::order_hint
uint8_t order_hint
Definition: cbs_av1.h:182
AV1_MAX_TILE_COLS
@ AV1_MAX_TILE_COLS
Definition: av1.h:82
VAAPIEncodePicture::display_order
int64_t display_order
Definition: vaapi_encode.h:76
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
AV1RawOBU::frame_header
AV1RawFrameHeader frame_header
Definition: cbs_av1.h:407
vaapi_encode_av1_class
static const AVClass vaapi_encode_av1_class
Definition: vaapi_encode_av1.c:923
AVCodecContext::b_quant_factor
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
Definition: avcodec.h:804
MAX_PARAM_BUFFER_SIZE
@ MAX_PARAM_BUFFER_SIZE
Definition: vaapi_encode.h:46
VAAPIEncodeAV1Picture
Definition: vaapi_encode_av1.c:35
AV1RawFrameHeader::frame_to_show_map_idx
uint8_t frame_to_show_map_idx
Definition: cbs_av1.h:167
PICTURE_TYPE_B
@ PICTURE_TYPE_B
Definition: vaapi_encode.h:61
VAAPIEncodeAV1Context::sh_data
char sh_data[MAX_PARAM_BUFFER_SIZE]
coded sequence header data.
Definition: vaapi_encode_av1.c:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
put_bits_count
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:80
VAAPIEncodeAV1Context::sb_cols
int sb_cols
Definition: vaapi_encode_av1.c:57
VAAPIEncodeContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_encode.h:275
VAAPIEncodeAV1Context::sh_data_len
size_t sh_data_len
bit length of sh_data.
Definition: vaapi_encode_av1.c:51
vaapi_encode_type_av1
static const VAAPIEncodeType vaapi_encode_type_av1
Definition: vaapi_encode_av1.c:742
AV1RawFrameHeader::tile_rows
uint16_t tile_rows
Definition: cbs_av1.h:228
value
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 default value
Definition: writing_filters.txt:86
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV1RawSequenceHeader::max_frame_width_minus_1
uint16_t max_frame_width_minus_1
Definition: cbs_av1.h:98
AV1RawSequenceHeader::color_config
AV1RawColorConfig color_config
Definition: cbs_av1.h:128
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:702
VAAPIEncodeAV1Context::level
int level
Definition: vaapi_encode_av1.c:83
vaapi_encode_av1_write_picture_header
static int vaapi_encode_av1_write_picture_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
Definition: vaapi_encode_av1.c:687
profile
int profile
Definition: mxfenc.c:2226
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:612
AV1RawSequenceHeader::enable_order_hint
uint8_t enable_order_hint
Definition: cbs_av1.h:113
AVCodecContext::height
int height
Definition: avcodec.h:618
AV1_SELECT_INTEGER_MV
@ AV1_SELECT_INTEGER_MV
Definition: av1.h:99
ff_cbs_write_fragment_data
int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Write the content of the fragment to its own internal buffer.
Definition: cbs.c:408
VAAPIEncodeAV1Context::profile
int profile
user options
Definition: vaapi_encode_av1.c:82
AV1RawFrameHeader::ref_order_hint
uint8_t ref_order_hint[AV1_NUM_REF_FRAMES]
Definition: cbs_av1.h:200
AV1RawFrameHeader::height_in_sbs_minus_1
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]
Definition: cbs_av1.h:221
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
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:35
ff_vaapi_encode_init
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
Definition: vaapi_encode.c:2773
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
vaapi_encode_av1_init_picture_params
static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode_av1.c:462
VAAPIEncodeAV1Context::max_tile_width_sb
int max_tile_width_sb
Definition: vaapi_encode_av1.c:61
VAAPIEncodeAV1Context::tier
int tier
Definition: vaapi_encode_av1.c:84
AV1RawColorConfig::high_bitdepth
uint8_t high_bitdepth
Definition: cbs_av1.h:42
vaapi_encode_av1_write_obu
static int vaapi_encode_av1_write_obu(AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *bs)
Definition: vaapi_encode_av1.c:179
VAAPIEncodeAV1Context::tile_rows_log2
int tile_rows_log2
Definition: vaapi_encode_av1.c:60
AV1_CSP_COLOCATED
@ AV1_CSP_COLOCATED
Definition: av1.h:135
AV1RawFrameHeader::reference_select
uint8_t reference_select
Definition: cbs_av1.h:276
vaapi_encode_av1_get_encoder_caps
static av_cold int vaapi_encode_av1_get_encoder_caps(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:110
VAAPIEncodeAV1Context::fh_data_len
size_t fh_data_len
bit length of fh_data.
Definition: vaapi_encode_av1.c:53
AV1RawSequenceHeader::frame_width_bits_minus_1
uint8_t frame_width_bits_minus_1
Definition: cbs_av1.h:96
vaapi_encode_av1_defaults
static const FFCodecDefault vaapi_encode_av1_defaults[]
Definition: vaapi_encode_av1.c:914
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AVCodecContext::qmin
int qmin
minimum quantizer
Definition: avcodec.h:1256
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
VAAPIEncodeAV1Context::tile_cols_log2
int tile_cols_log2
Definition: vaapi_encode_av1.c:59
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1639
VAAPIEncodeAV1Context::uniform_tile
uint8_t uniform_tile
Definition: vaapi_encode_av1.c:55
av1_levels.h
AV1RawFrameHeader::frame_height_minus_1
uint16_t frame_height_minus_1
Definition: cbs_av1.h:189
AVCodecContext::i_quant_offset
float i_quant_offset
qscale offset between P and I-frames
Definition: avcodec.h:827
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:112
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
AV1RawSequenceHeader::order_hint_bits_minus_1
uint8_t order_hint_bits_minus_1
Definition: cbs_av1.h:122
VAAPIEncodeAV1Context::max_tile_height_sb
int max_tile_height_sb
Definition: vaapi_encode_av1.c:62
CodedBitstreamContext::trace_enable
int trace_enable
Enable trace output during read/write operations.
Definition: cbs.h:257
AV1RawFrameHeader::show_existing_frame
uint8_t show_existing_frame
Definition: cbs_av1.h:166
desc
const char * desc
Definition: libsvtav1.c:75
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV1RawOBU::frame
AV1RawFrame frame
Definition: cbs_av1.h:408
VAAPIEncodeAV1Context::q_idx_idr
int q_idx_idr
Definition: vaapi_encode_av1.c:71
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
ff_cbs_init
av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
Definition: cbs.c:89
AV1RawFrameHeader::error_resilient_mode
uint8_t error_resilient_mode
Definition: cbs_av1.h:175
AV1RawFrameHeader::tile_rows_log2
uint8_t tile_rows_log2
Definition: cbs_av1.h:217
VAAPIEncodeAV1Context::attr
VAConfigAttribValEncAV1 attr
Definition: vaapi_encode_av1.c:46
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
VAAPIEncodePicture::encode_order
int64_t encode_order
Definition: vaapi_encode.h:77
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_av1.c:861
AV1RawSequenceHeader::enable_cdef
uint8_t enable_cdef
Definition: cbs_av1.h:125
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
AV1_MAX_TILE_ROWS
@ AV1_MAX_TILE_ROWS
Definition: av1.h:81
AV1_PRIMARY_REF_NONE
@ AV1_PRIMARY_REF_NONE
Definition: av1.h:87
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
VAAPIEncodeAV1Context::tile_rows
int tile_rows
Definition: vaapi_encode_av1.c:85
AV_PROFILE_AV1_MAIN
#define AV_PROFILE_AV1_MAIN
Definition: defs.h:167
VAAPIEncodeAV1Context::q_idx_p
int q_idx_p
Definition: vaapi_encode_av1.c:72
AV1RawFrameHeader::showable_frame
uint8_t showable_frame
Definition: cbs_av1.h:173
put_bits.h
PICTURE_TYPE_P
@ PICTURE_TYPE_P
Definition: vaapi_encode.h:60
AV1RawOBUHeader::obu_has_size_field
uint8_t obu_has_size_field
Definition: cbs_av1.h:33
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
vaapi_encode_av1_configure
static av_cold int vaapi_encode_av1_configure(AVCodecContext *avctx)
Definition: vaapi_encode_av1.c:122
LEVEL
#define LEVEL(name, value)
AV1RawFrameHeader::tile_cols
uint16_t tile_cols
Definition: cbs_av1.h:227
VAAPIEncodeProfile
Definition: vaapi_encode.h:150
PROFILE
#define PROFILE(name, value)
VAAPIEncodeAV1Context::max_log2_tile_cols
int max_log2_tile_cols
Definition: vaapi_encode_av1.c:67
AV1RawFrameHeader::render_height_minus_1
uint16_t render_height_minus_1
Definition: cbs_av1.h:194
VAAPIEncodePicture::nb_slices
int nb_slices
Definition: vaapi_encode.h:135
AV1RawFrameHeader::frame_type
uint8_t frame_type
Definition: cbs_av1.h:171
CodedBitstreamAV1Context
Definition: cbs_av1.h:438
AV1RawOBUHeader::obu_type
uint8_t obu_type
Definition: cbs_av1.h:31