FFmpeg
d3d12va_encode_av1.c
Go to the documentation of this file.
1 /*
2  * Direct3D 12 HW acceleration video encoder
3  *
4  * Copyright (c) 2024 Intel Corporation
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "libavutil/opt.h"
24 #include "libavutil/common.h"
25 #include "libavutil/mem.h"
26 #include "libavutil/pixdesc.h"
28 
29 #include "config_components.h"
30 #include "avcodec.h"
31 #include "cbs.h"
32 #include "cbs_av1.h"
33 #include "av1_levels.h"
34 #include "codec_internal.h"
35 #include "d3d12va_encode.h"
36 #include "encode.h"
37 #include "hw_base_encode.h"
38 
39 #include <d3d12.h>
40 #include <d3d12video.h>
41 
42 #ifndef D3D12_VIDEO_ENCODER_AV1_INVALID_DPB_RESOURCE_INDEX
43 #define D3D12_VIDEO_ENCODER_AV1_INVALID_DPB_RESOURCE_INDEX ( 0xff )
44 #endif
45 
46 typedef struct D3D12VAHWBaseEncodeAV1 {
51 
53  int tier; // 0: Main tier, 1: High tier
54  int level; // AV1 level (2.0-7.3 map to 0-23)
55 
56  int enable_cdef; // Constrained Directional Enhancement Filter
57  int enable_restoration; // loop restoration
58  int enable_superres; // super-resolution
60 
63 
69 
73 
77 
78 typedef struct D3D12VAEncodeAV1Picture {
79  uint8_t temporal_id;
80  uint8_t spatial_id;
81  uint8_t show_frame;
82  uint8_t frame_type;
83  uint16_t last_idr_frame;
84  uint8_t slot;
86 
87 typedef struct D3D12VAEncodeAV1Context {
89  // User options.
90  int qp;
91  int profile;
92  int level;
93  int tier;
94 
95  uint8_t q_idx_idr;
96  uint8_t q_idx_p;
97 
98  // Writer structures.
101 
104  D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAGS post_encode_values_flag;
107 
108 typedef struct D3D12VAEncodeAV1Level {
109  uint8_t level;
110  D3D12_VIDEO_ENCODER_AV1_LEVELS d3d12_level;
112 
113 
115  { 0, D3D12_VIDEO_ENCODER_AV1_LEVELS_2_0 },
116  { 1, D3D12_VIDEO_ENCODER_AV1_LEVELS_2_1 },
117  { 2, D3D12_VIDEO_ENCODER_AV1_LEVELS_2_2 },
118  { 3, D3D12_VIDEO_ENCODER_AV1_LEVELS_2_3 },
119  { 4, D3D12_VIDEO_ENCODER_AV1_LEVELS_3_0 },
120  { 5, D3D12_VIDEO_ENCODER_AV1_LEVELS_3_1 },
121  { 6, D3D12_VIDEO_ENCODER_AV1_LEVELS_3_2 },
122  { 7, D3D12_VIDEO_ENCODER_AV1_LEVELS_3_3 },
123  { 8, D3D12_VIDEO_ENCODER_AV1_LEVELS_4_0 },
124  { 9, D3D12_VIDEO_ENCODER_AV1_LEVELS_4_1 },
125  { 10, D3D12_VIDEO_ENCODER_AV1_LEVELS_4_2 },
126  { 11, D3D12_VIDEO_ENCODER_AV1_LEVELS_4_3 },
127  { 12, D3D12_VIDEO_ENCODER_AV1_LEVELS_5_0 },
128  { 13, D3D12_VIDEO_ENCODER_AV1_LEVELS_5_1 },
129  { 14, D3D12_VIDEO_ENCODER_AV1_LEVELS_5_2 },
130  { 15, D3D12_VIDEO_ENCODER_AV1_LEVELS_5_3 },
131  { 16, D3D12_VIDEO_ENCODER_AV1_LEVELS_6_0 },
132  { 17, D3D12_VIDEO_ENCODER_AV1_LEVELS_6_1 },
133  { 18, D3D12_VIDEO_ENCODER_AV1_LEVELS_6_2 },
134  { 19, D3D12_VIDEO_ENCODER_AV1_LEVELS_6_3 },
135  { 20, D3D12_VIDEO_ENCODER_AV1_LEVELS_7_0 },
136  { 21, D3D12_VIDEO_ENCODER_AV1_LEVELS_7_1 },
137  { 22, D3D12_VIDEO_ENCODER_AV1_LEVELS_7_2 },
138  { 23, D3D12_VIDEO_ENCODER_AV1_LEVELS_7_3 },
139 };
140 
141 static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_main = D3D12_VIDEO_ENCODER_AV1_PROFILE_MAIN;
142 static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_high = D3D12_VIDEO_ENCODER_AV1_PROFILE_HIGH;
143 static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_professional = D3D12_VIDEO_ENCODER_AV1_PROFILE_PROFESSIONAL;
144 
145 #define D3D_PROFILE_DESC(name) \
146  { sizeof(D3D12_VIDEO_ENCODER_AV1_PROFILE), { .pAV1Profile = (D3D12_VIDEO_ENCODER_AV1_PROFILE *)&profile_ ## name } }
148  { AV_PROFILE_AV1_MAIN, 8, 3, 1, 1, D3D_PROFILE_DESC(main) },
149  { AV_PROFILE_AV1_MAIN, 10, 3, 1, 1, D3D_PROFILE_DESC(main) },
150  { AV_PROFILE_AV1_HIGH, 10, 3, 1, 1, D3D_PROFILE_DESC(high) },
151  { AV_PROFILE_AV1_PROFESSIONAL, 8, 3, 1, 1, D3D_PROFILE_DESC(professional) },
152  { AV_PROFILE_AV1_PROFESSIONAL, 10, 3, 1, 1, D3D_PROFILE_DESC(professional) },
153  { AV_PROFILE_AV1_PROFESSIONAL, 12, 3, 1, 1, D3D_PROFILE_DESC(professional) },
154  { AV_PROFILE_UNKNOWN },
155 };
156 
158  char *data, size_t *data_len,
160 {
161  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
162  int err = 0;
163 
164  err = ff_cbs_write_fragment_data(priv->cbc, obu);
165  if (err < 0) {
166  av_log(avctx, AV_LOG_ERROR, "Failed to write packed OBU data.\n");
167  return err;
168  }
169 
170  memcpy(data, obu->data, obu->data_size);
171  *data_len = (8 * obu->data_size) - obu->data_bit_padding;
172 
173  return 0;
174 }
175 
178  CodedBitstreamUnitType obu_type,
179  void* obu_unit)
180 {
181  int err = 0;
182 
183  err = ff_cbs_insert_unit_content(au, -1, obu_type, obu_unit, NULL);
184  if (err < 0) {
185  av_log(avctx, AV_LOG_ERROR, "Failed to add OBU unit: "
186  "type = %d.\n", obu_type);
187  return err;
188  }
189  return 0;
190 }
191 
193  char *data, size_t *data_len)
194 {
195  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
196  CodedBitstreamFragment *obu = &priv->current_obu;
197  int err = 0;
198 
201  if (err < 0)
202  goto fail;
203 
204  err = d3d12va_encode_av1_write_obu(avctx, data, data_len, obu);
205 
206 fail:
207  ff_cbs_fragment_reset(obu);
208  return err;
209 }
210 
213  AV1RawOBU *frameheader_obu)
214 {
215  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
216  AV1RawFrameHeader *fh = &frameheader_obu->obu.frame_header;
217  uint8_t *data = NULL;
218  HRESULT hr = S_OK;
219  int err = 0;
220  D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES *post_encode_values = NULL;
221 
222  // Update the frame header according to the picture post_encode_values
223  hr = ID3D12Resource_Map(pic->resolved_metadata, 0, NULL, (void **)&data);
224  if (FAILED(hr)) {
225  err = AVERROR_UNKNOWN;
226  return err;
227  }
228  post_encode_values = (D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES*) (data +
229  sizeof(D3D12_VIDEO_ENCODER_OUTPUT_METADATA) +
230  sizeof(D3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA) +
231  sizeof(D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_TILES));
232 
233  if (priv->post_encode_values_flag & D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAG_QUANTIZATION) {
234  fh->base_q_idx = post_encode_values->Quantization.BaseQIndex;
235  fh->delta_q_y_dc = post_encode_values->Quantization.YDCDeltaQ;
236  fh->delta_q_u_dc = post_encode_values->Quantization.UDCDeltaQ;
237  fh->delta_q_u_ac = post_encode_values->Quantization.UACDeltaQ;
238  fh->delta_q_v_dc = post_encode_values->Quantization.VDCDeltaQ;
239  fh->delta_q_v_ac = post_encode_values->Quantization.VACDeltaQ;
240  fh->using_qmatrix = post_encode_values->Quantization.UsingQMatrix;
241  fh->qm_y = post_encode_values->Quantization.QMY;
242  fh->qm_u = post_encode_values->Quantization.QMU;
243  fh->qm_v = post_encode_values->Quantization.QMV;
244  }
245 
246  if (priv->post_encode_values_flag & D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAG_LOOP_FILTER) {
247  fh->loop_filter_level[0] = post_encode_values->LoopFilter.LoopFilterLevel[0];
248  fh->loop_filter_level[1] = post_encode_values->LoopFilter.LoopFilterLevel[1];
249  fh->loop_filter_level[2] = post_encode_values->LoopFilter.LoopFilterLevelU;
250  fh->loop_filter_level[3] = post_encode_values->LoopFilter.LoopFilterLevelV;
251  fh->loop_filter_sharpness = post_encode_values->LoopFilter.LoopFilterSharpnessLevel;
252  fh->loop_filter_delta_enabled = post_encode_values->LoopFilter.LoopFilterDeltaEnabled;
253  if (fh->loop_filter_delta_enabled) {
254  for (int i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) {
255  fh->loop_filter_ref_deltas[i] = post_encode_values->LoopFilter.RefDeltas[i];
256  fh->update_ref_delta[i] = post_encode_values->LoopFilter.RefDeltas[i];
257  }
258  for (int i = 0; i < 2; i++) {
259  fh->loop_filter_mode_deltas[i] = post_encode_values->LoopFilter.ModeDeltas[i];
260  fh->update_mode_delta[i] = post_encode_values->LoopFilter.ModeDeltas[i];
261  }
262  }
263  }
264  if (priv->post_encode_values_flag & D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAG_CDEF_DATA) {
265  fh->cdef_damping_minus_3 = post_encode_values->CDEF.CdefDampingMinus3;
266  fh->cdef_bits = post_encode_values->CDEF.CdefBits;
267  for (int i = 0; i < 8; i++) {
268  fh->cdef_y_pri_strength[i] = post_encode_values->CDEF.CdefYPriStrength[i];
269  fh->cdef_y_sec_strength[i] = post_encode_values->CDEF.CdefYSecStrength[i];
270  fh->cdef_uv_pri_strength[i] = post_encode_values->CDEF.CdefUVPriStrength[i];
271  fh->cdef_uv_sec_strength[i] = post_encode_values->CDEF.CdefUVSecStrength[i];
272  }
273  }
274  if (priv->post_encode_values_flag & D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAG_QUANTIZATION_DELTA) {
275  fh->delta_q_present = post_encode_values->QuantizationDelta.DeltaQPresent;
276  fh->delta_q_res = post_encode_values->QuantizationDelta.DeltaQRes;
277  }
278 
279  if (priv->post_encode_values_flag & D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAG_REFERENCE_INDICES) {
280  for (int i = 0; i < AV1_REFS_PER_FRAME; i++) {
281  fh->ref_frame_idx[i] = post_encode_values->ReferenceIndices[i];
282  }
283  }
284 
285  ID3D12Resource_Unmap(pic->resolved_metadata, 0, NULL);
286  return 0;
287 }
288 
291  char *data, size_t *data_len)
292 {
293  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
294  CodedBitstreamFragment *obu = &priv->current_obu;
295  AV1RawOBU *frameheader_obu = av_mallocz(sizeof(AV1RawOBU));
296  int err = 0;
297 
298  av_fifo_read(priv->picture_header_list, frameheader_obu, 1);
299  err = d3d12va_encode_av1_update_current_frame_picture_header(avctx, pic,frameheader_obu);
300  if (err < 0) {
301  av_log(avctx, AV_LOG_ERROR, "Failed to update current frame picture header: %d.\n", err);
302  return err;
303  }
304 
305  // Add the frame header OBU
306  frameheader_obu->header.obu_has_size_field = 1;
307 
308  err = d3d12va_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, frameheader_obu);
309  if (err < 0)
310  goto fail;
311  err = d3d12va_encode_av1_write_obu(avctx, data, data_len, obu);
312 
313 fail:
314  ff_cbs_fragment_reset(obu);
315  av_freep(&frameheader_obu);
316  return err;
317 }
318 
320  uint8_t* tile_group,
321  uint32_t tile_group_size,
322  char *data, size_t *data_len)
323 {
324  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
325  CodedBitstreamFragment *obu = &priv->current_obu;
327  AV1RawTileGroup *tg = &tile_group_obu->obu.tile_group;
328  int err = 0;
329 
330  tg->tile_data.data = tile_group;
331  tg->tile_data.data_ref = NULL;
332  tg->tile_data.data_size = tile_group_size;
333  tile_group_obu->header.obu_has_size_field = 1;
334  tile_group_obu->header.obu_type = AV1_OBU_TILE_GROUP;
335 
337  if (err < 0)
338  goto fail;
339  err = d3d12va_encode_av1_write_obu(avctx, data, data_len, obu);
340 
341 fail:
342  ff_cbs_fragment_reset(obu);
343  return err;
344 }
345 
347  D3D12VAEncodePicture *pic, size_t *size)
348 {
349  D3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA *subregion_meta = NULL;
350  uint8_t *data = NULL;
351  HRESULT hr = S_OK;
352  int err = 0;
353 
354  hr = ID3D12Resource_Map(pic->resolved_metadata, 0, NULL, (void **)&data);
355  if (FAILED(hr)) {
356  err = AVERROR_UNKNOWN;
357  return err;
358  }
359 
360  subregion_meta = (D3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA*)(data + sizeof(D3D12_VIDEO_ENCODER_OUTPUT_METADATA));
361  if (subregion_meta->bSize == 0) {
362  av_log(avctx, AV_LOG_ERROR, "No subregion metadata found\n");
363  err = AVERROR(EINVAL);
364  return err;
365  }
366  *size = subregion_meta->bSize;
367 
368  ID3D12Resource_Unmap(pic->resolved_metadata, 0, NULL);
369 
370  return 0;
371 }
372 
375 {
376  int err = 0;
377  uint8_t *ptr = NULL;
378  uint8_t *mapped_data = NULL;
379  size_t total_size = 0;
380  HRESULT hr = S_OK;
381  size_t av1_pic_hd_size = 0;
382  int tile_group_extra_size = 0;
383  size_t bit_len = 0;
384 
385  char pic_hd_data[MAX_PARAM_BUFFER_SIZE] = { 0 };
386 
387  err = d3d12va_encode_av1_get_buffer_size(avctx, pic, &total_size);
388  if (err < 0)
389  goto end;
390 
391  // Update the picture header and calculate the picture header size
392  memset(pic_hd_data, 0, sizeof(pic_hd_data));
393  err = d3d12va_encode_av1_write_picture_header(avctx, pic, pic_hd_data, &av1_pic_hd_size);
394  if (err < 0) {
395  av_log(avctx, AV_LOG_ERROR, "Failed to write picture header: %d.\n", err);
396  return err;
397  }
398  av1_pic_hd_size /= 8;
399  av_log(avctx, AV_LOG_DEBUG, "AV1 picture header size: %zu bytes.\n", av1_pic_hd_size);
400 
401 
402  tile_group_extra_size = (av_log2(total_size) + 7) / 7 + 1; // 1 byte for obu header, rest for tile group LEB128 size
403  av_log(avctx, AV_LOG_DEBUG, "Tile group extra size: %d bytes.\n", tile_group_extra_size);
404 
405  total_size += (pic->header_size + tile_group_extra_size + av1_pic_hd_size);
406  av_log(avctx, AV_LOG_DEBUG, "Output buffer size %zu\n", total_size);
407 
408  hr = ID3D12Resource_Map(pic->output_buffer, 0, NULL, (void **)&mapped_data);
409  if (FAILED(hr)) {
410  err = AVERROR_UNKNOWN;
411  goto end;
412  }
413 
414  err = ff_get_encode_buffer(avctx, pkt, total_size, 0);
415  if (err < 0)
416  goto end;
417  ptr = pkt->data;
418 
419  memcpy(ptr, mapped_data, pic->header_size);
420 
421  ptr += pic->header_size;
422  mapped_data += pic->aligned_header_size;
423  total_size -= pic->header_size;
424 
425  memcpy(ptr, pic_hd_data, av1_pic_hd_size);
426  ptr += av1_pic_hd_size;
427  total_size -= av1_pic_hd_size;
428  av_log(avctx, AV_LOG_DEBUG, "AV1 total_size after write picture header: %zu.\n", total_size);
429 
430  total_size -= tile_group_extra_size;
431  err = d3d12va_encode_av1_write_tile_group(avctx, mapped_data, total_size, ptr, &bit_len);
432  if (err < 0) {
433  av_log(avctx, AV_LOG_ERROR, "Failed to write tile group: %d.\n", err);
434  goto end;
435  }
436  assert((total_size + tile_group_extra_size) * 8 == bit_len);
437 
438  ID3D12Resource_Unmap(pic->output_buffer, 0, NULL);
439 
440 end:
442  pic->output_buffer = NULL;
443  return err;
444 }
445 
447  AVCodecContext *avctx,
448  D3D12VAHWBaseEncodeAV1 *common,
450 {
451  AV1RawOBU *seqheader_obu = &common->raw_sequence_header;
452  AV1RawSequenceHeader *seq = &seqheader_obu->obu.sequence_header;
453  const AVPixFmtDescriptor *desc;
454 
455  seq->seq_profile = avctx->profile;
458  seq->seq_tier[0] = opts->tier;
459 
462  .high_bitdepth = desc->comp[0].depth == 8 ? 0 : 1,
463  .color_primaries = avctx->color_primaries,
464  .transfer_characteristics = avctx->color_trc,
465  .matrix_coefficients = avctx->colorspace,
466  .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
467  avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
470  .subsampling_x = desc->log2_chroma_w,
471  .subsampling_y = desc->log2_chroma_h,
472  };
473 
474  switch (avctx->chroma_sample_location) {
475  case AVCHROMA_LOC_LEFT:
477  break;
480  break;
481  default:
483  break;
484  }
485 
486  if (avctx->level != AV_LEVEL_UNKNOWN) {
487  seq->seq_level_idx[0] = avctx->level;
488  }
489  else {
490  const AV1LevelDescriptor *level;
491  float framerate;
492 
493  if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
494  framerate = avctx->framerate.num / avctx->framerate.den;
495  else
496  framerate = 0;
497 
498  //currently only supporting 1 tile
499  level = ff_av1_guess_level(avctx->bit_rate, opts->tier,
500  base_ctx->surface_width, base_ctx->surface_height,
501  /*priv->tile_rows*/1 * 1/*priv->tile_cols*/,
502  /*priv->tile_cols*/1, framerate);
503  if (level) {
504  av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name);
505  seq->seq_level_idx[0] = level->level_idx;
506  }
507  else {
508  av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to "
509  "any normal level, using maximum parameters level by default.\n");
510  seq->seq_level_idx[0] = 31;
511  seq->seq_tier[0] = 1;
512  }
513  }
514 
515  // Still picture mode
516  seq->still_picture = (base_ctx->gop_size == 1);
518 
519  // Feature flags
520  seq->enable_filter_intra = opts->enable_filter_intra;
521  seq->enable_intra_edge_filter = opts->enable_intra_edge_filter;
522  seq->enable_interintra_compound = opts->enable_interintra_compound;
523  seq->enable_masked_compound = opts->enable_masked_compound;
524  seq->enable_warped_motion = opts->enable_warped_motion;
525  seq->enable_dual_filter = opts->enable_dual_filter;
526  seq->enable_order_hint = !seq->still_picture;
527  if (seq->enable_order_hint) {
528  seq->order_hint_bits_minus_1 = 7;
529  }
530  seq->enable_jnt_comp = opts->enable_jnt_comp && seq->enable_order_hint;
531  seq->enable_ref_frame_mvs = opts->enable_ref_frame_mvs && seq->enable_order_hint;
532  seq->enable_superres = opts->enable_superres;
533  seq->enable_cdef = opts->enable_cdef;
534  seq->enable_restoration = opts->enable_restoration;
535 
536  return 0;
537 
538 }
539 
541 {
542  FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
544  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
545  AVD3D12VAFramesContext *hwctx = base_ctx->input_frames->hwctx;
546  AV1RawOBU *seqheader_obu = &priv->units.raw_sequence_header;
548 
549  D3D12_VIDEO_ENCODER_AV1_PROFILE profile = D3D12_VIDEO_ENCODER_AV1_PROFILE_MAIN;
550  D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS level = { 0 };
551  HRESULT hr;
552  int err;
553 
554  D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1 support = {
555  .NodeIndex = 0,
556  .Codec = D3D12_VIDEO_ENCODER_CODEC_AV1,
557  .InputFormat = hwctx->format,
558  .RateControl = ctx->rc,
559  .IntraRefresh = ctx->intra_refresh.Mode,
560  .SubregionFrameEncoding = D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME,
561  .ResolutionsListCount = 1,
562  .pResolutionList = &ctx->resolution,
563  .CodecGopSequence = ctx->gop,
564  .MaxReferenceFramesInDPB = AV1_NUM_REF_FRAMES,
565  .CodecConfiguration = ctx->codec_conf,
566  .SuggestedProfile.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_PROFILE),
567  .SuggestedProfile.pAV1Profile = &profile,
568  .SuggestedLevel.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS),
569  .SuggestedLevel.pAV1LevelSetting = &level,
570  .pResolutionDependentSupport = &ctx->res_limits,
571  .SubregionFrameEncodingData.pTilesPartition_AV1 = ctx->subregions_layout.pTilesPartition_AV1,
572  };
573 
574  hr = ID3D12VideoDevice3_CheckFeatureSupport(ctx->video_device3, D3D12_FEATURE_VIDEO_ENCODER_SUPPORT1,
575  &support, sizeof(support));
576 
577  if (FAILED(hr)) {
578  av_log(avctx, AV_LOG_ERROR, "Failed to check encoder support(%lx).\n", (long)hr);
579  return AVERROR(EINVAL);
580  }
581 
582  if (!(support.SupportFlags & D3D12_VIDEO_ENCODER_SUPPORT_FLAG_GENERAL_SUPPORT_OK)) {
583  av_log(avctx, AV_LOG_ERROR, "Driver does not support some request D3D12VA AV1 features. %#x\n",
584  support.ValidationFlags);
585  return AVERROR(EINVAL);
586  }
587 
588  if (support.SupportFlags & D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RECONSTRUCTED_FRAMES_REQUIRE_TEXTURE_ARRAYS) {
589  ctx->is_texture_array = 1;
590  av_log(avctx, AV_LOG_DEBUG, "D3D12 video encode on this device uses texture array mode.\n");
591  }
592 
593  memset(seqheader_obu, 0, sizeof(*seqheader_obu));
594  seq->seq_profile = profile;
595  seq->seq_level_idx[0] = level.Level;
596  seq->seq_tier[0] = level.Tier;
597 
598  seq->max_frame_width_minus_1 = ctx->resolution.Width - 1;
599  seq->max_frame_height_minus_1 = ctx->resolution.Height - 1;
600  seq->frame_width_bits_minus_1 = av_log2(ctx->resolution.Width);
601  seq->frame_height_bits_minus_1 = av_log2(ctx->resolution.Height);
602 
603  seqheader_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER;
604 
605  err = d3d12va_hw_base_encode_init_params_av1(base_ctx, avctx,
606  &priv->units, &priv->unit_opts);
607  if (err < 0)
608  return err;
609 
610  if (avctx->level == AV_LEVEL_UNKNOWN)
611  avctx->level = level.Level;
612 
613  return 0;
614 }
615 
617 {
618  HRESULT hr = S_OK;
619  FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
621  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
622 
623  D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION *config;
624  D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION_SUPPORT av1_caps;
625 
626  D3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT codec_caps = {
627  .NodeIndex = 0,
628  .Codec = D3D12_VIDEO_ENCODER_CODEC_AV1,
629  .Profile = ctx->profile->d3d12_profile,
630  .CodecSupportLimits.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION_SUPPORT),
631  };
632 
633  codec_caps.CodecSupportLimits.pAV1Support = &av1_caps;
634 
635  hr = ID3D12VideoDevice3_CheckFeatureSupport(ctx->video_device3, D3D12_FEATURE_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT,
636  &codec_caps, sizeof(codec_caps));
637  if (!(SUCCEEDED(hr) && codec_caps.IsSupported))
638  return AVERROR(EINVAL);
639 
640  ctx->codec_conf.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION);
641  ctx->codec_conf.pAV1Config = av_mallocz(ctx->codec_conf.DataSize);
642  if (!ctx->codec_conf.pAV1Config)
643  return AVERROR(ENOMEM);
644 
645  priv->post_encode_values_flag = av1_caps.PostEncodeValuesFlags;
646  config = ctx->codec_conf.pAV1Config;
647 
648  config->FeatureFlags = D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_NONE;
649  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_128x128_SUPERBLOCK) {
650  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_128x128_SUPERBLOCK;
652  }
653 
654  base_ctx->surface_width = FFALIGN(avctx->width, priv->unit_opts.enable_128x128_superblock ? 128 : 64);
655  base_ctx->surface_height = FFALIGN(avctx->height, priv->unit_opts.enable_128x128_superblock ? 128 : 64);
656 
657  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_LOOP_RESTORATION_FILTER) {
658  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_LOOP_RESTORATION_FILTER;
659  priv->unit_opts.enable_loop_filter = 1;
660  }
661 
662  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_PALETTE_ENCODING) {
663  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_PALETTE_ENCODING;
664  priv->unit_opts.enable_palette = 1;
665  }
666 
667  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_INTRA_BLOCK_COPY) {
668  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_INTRA_BLOCK_COPY;
670  }
671 
672  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_LOOP_FILTER_DELTAS) {
673  // Loop filter deltas
674  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_LOOP_FILTER_DELTAS;
676  }
677 
678  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_CDEF_FILTERING) {
679  // CDEF (Constrained Directional Enhancement Filter)
680  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_CDEF_FILTERING;
681  priv->unit_opts.enable_cdef = 1;
682  }
683 
684  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_DUAL_FILTER) {
685  // Dual filter
686  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_DUAL_FILTER;
687  priv->unit_opts.enable_dual_filter = 1;
688  }
689 
690  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_JNT_COMP) {
691  // Joint compound prediction
692  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_JNT_COMP;
693  priv->unit_opts.enable_jnt_comp = 1;
694  }
695 
696  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_FRAME_REFERENCE_MOTION_VECTORS) {
697  // Frame reference motion vectors
698  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_FRAME_REFERENCE_MOTION_VECTORS;
700  }
701 
702  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_SUPER_RESOLUTION) {
703  // Super-resolution
704  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_SUPER_RESOLUTION;
705  priv->unit_opts.enable_superres = 1;
706  }
707 
708  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_WARPED_MOTION) {
709  // Warped motion
710  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_WARPED_MOTION;
712  }
713 
714  if (av1_caps.SupportedFeatureFlags & D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_INTERINTRA_COMPOUND) {
715  // Inter-intra compound prediction
716  config->FeatureFlags |= D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAG_INTERINTRA_COMPOUND;
718  }
719 
720  return 0;
721 }
722 
724 {
725  FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
727  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
728  int err = 0;
729  int fixed_qp_key, fixed_qp_inter;
730 
731  err = ff_cbs_init(&priv->cbc, AV_CODEC_ID_AV1, avctx);
732  if (err < 0)
733  return err;
734 
735  if (ctx->rc.Mode == D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_CQP) {
736  D3D12_VIDEO_ENCODER_RATE_CONTROL_CQP *cqp_ctl;
737  fixed_qp_inter = av_clip_uintp2(ctx->rc_quality, 8);
738 
739  if (avctx->i_quant_factor > 0.0)
740  fixed_qp_key = av_clip_uintp2((avctx->i_quant_factor * fixed_qp_inter +
741  avctx->i_quant_offset) + 0.5, 8);
742  else
743  fixed_qp_key = fixed_qp_inter;
744 
745  av_log(avctx, AV_LOG_DEBUG, "Using fixed QP = "
746  "%d / %d for Key / Inter frames.\n",
747  fixed_qp_key, fixed_qp_inter);
748 
749  ctx->rc.ConfigParams.DataSize = sizeof(D3D12_VIDEO_ENCODER_RATE_CONTROL_CQP);
750  cqp_ctl = av_mallocz(ctx->rc.ConfigParams.DataSize);
751  if (!cqp_ctl)
752  return AVERROR(ENOMEM);
753 
754  cqp_ctl->ConstantQP_FullIntracodedFrame = fixed_qp_key;
755  cqp_ctl->ConstantQP_InterPredictedFrame_PrevRefOnly = fixed_qp_inter;
756  cqp_ctl->ConstantQP_InterPredictedFrame_BiDirectionalRef = fixed_qp_inter;
757 
758  ctx->rc.ConfigParams.pConfiguration_CQP = cqp_ctl;
759 
760  priv->q_idx_idr = fixed_qp_key;
761  priv->q_idx_p = fixed_qp_inter;
762 
763  }
764 
765  // GOP configuration for AV1
766  ctx->gop.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_SEQUENCE_STRUCTURE);
767  ctx->gop.pAV1SequenceStructure = av_mallocz(ctx->gop.DataSize);
768  if (!ctx->gop.pAV1SequenceStructure)
769  return AVERROR(ENOMEM);
770 
771  ctx->gop.pAV1SequenceStructure->IntraDistance = base_ctx->gop_size;
772  ctx->gop.pAV1SequenceStructure->InterFramePeriod = base_ctx->b_per_p + 1;
773 
774  return 0;
775 }
776 
778 {
780  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
781  int i = 0;
782 
783  ctx->level.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS);
784  ctx->level.pAV1LevelSetting = av_mallocz(ctx->level.DataSize);
785  if (!ctx->level.pAV1LevelSetting)
786  return AVERROR(ENOMEM);
787 
788  if (avctx->level != AV_LEVEL_UNKNOWN) {
789  for (i = 0; i < FF_ARRAY_ELEMS(av1_levels); i++) {
790  if (avctx->level == av1_levels[i].level) {
791  ctx->level.pAV1LevelSetting->Level = av1_levels[i].d3d12_level;
792  break;
793  }
794  }
795 
796  if (i == FF_ARRAY_ELEMS(av1_levels) ) {
797  av_log(avctx, AV_LOG_ERROR, "Invalid AV1 level %d.\n", avctx->level);
798  return AVERROR(EINVAL);
799  }
800  } else {
801  ctx->level.pAV1LevelSetting->Level = D3D12_VIDEO_ENCODER_AV1_LEVELS_5_2;
802  avctx->level = D3D12_VIDEO_ENCODER_AV1_LEVELS_5_2;
803  av_log(avctx, AV_LOG_DEBUG, "Using default AV1 level 5.2\n");
804  }
805 
806  if (priv->tier == 1 || avctx->bit_rate > 30000000) {
807  ctx->level.pAV1LevelSetting->Tier = D3D12_VIDEO_ENCODER_AV1_TIER_HIGH;
808  av_log(avctx, AV_LOG_DEBUG, "Using AV1 High tier\n");
809  } else {
810  ctx->level.pAV1LevelSetting->Tier = D3D12_VIDEO_ENCODER_AV1_TIER_MAIN;
811  av_log(avctx, AV_LOG_DEBUG, "Using AV1 Main tier\n");
812  }
813 
814  if (priv->tier >= 0) {
815  ctx->level.pAV1LevelSetting->Tier = priv->tier == 0 ?
816  D3D12_VIDEO_ENCODER_AV1_TIER_MAIN :
817  D3D12_VIDEO_ENCODER_AV1_TIER_HIGH;
818  }
819 
820  av_log(avctx, AV_LOG_DEBUG, "AV1 level set to %d, tier: %s\n",
821  ctx->level.pAV1LevelSetting->Level,
822  ctx->level.pAV1LevelSetting->Tier == D3D12_VIDEO_ENCODER_AV1_TIER_MAIN ? "Main" : "High");
823 
824  return 0;
825 }
826 
828 {
830 
831  ctx->subregions_layout.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_TILES);
832  D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_TILES *tiles_layout = av_mallocz(ctx->subregions_layout.DataSize);
833  ctx->subregions_layout.pTilesPartition_AV1 = tiles_layout;
834 
835  // Currently only support 1 tile
836  tiles_layout->RowCount = 1;
837  tiles_layout->ColCount = 1;
838 
839  return 0;
840 }
841 
843 {
844  if (!pic->pic_ctl.pAV1PicData)
845  return;
846 
847  av_freep(&pic->pic_ctl.pAV1PicData);
848 }
849 
852 {
853  FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
854  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
856  D3D12VAEncodePicture *d3d12va_pic = pic->priv;
857  D3D12VAEncodeAV1Picture *hpic = pic->codec_priv;
858  CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data;
859  AV1RawOBU *frameheader_obu = &priv->units.raw_frame_header;
860  AV1RawFrameHeader *fh = &frameheader_obu->obu.frame_header;
861 
864  int i;
865 
866  static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] =
867  { 1, 0, 0, 0, -1, 0, -1, -1 };
868 
869  memset(frameheader_obu, 0, sizeof(*frameheader_obu));
870 
871  frameheader_obu->header.obu_type = AV1_OBU_FRAME_HEADER;
872 
873  d3d12va_pic->pic_ctl.DataSize = sizeof(D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_CODEC_DATA);
874  d3d12va_pic->pic_ctl.pAV1PicData = av_mallocz(d3d12va_pic->pic_ctl.DataSize);
875  if (!d3d12va_pic->pic_ctl.pAV1PicData)
876  return AVERROR(ENOMEM);
877 
878  // Initialize frame type and reference frame management
879  switch(pic->type) {
882  fh->refresh_frame_flags = 0xFF;
883  fh->base_q_idx = priv->q_idx_idr;
884  hpic->slot = 0;
885  hpic->last_idr_frame = pic->display_order;
887  break;
888 
891  fh->base_q_idx = priv->q_idx_p;
893 
894  ref = pic->refs[0][pic->nb_refs[0] - 1];
895  href = ref->codec_priv;
896 
897  /**
898  * The encoder uses a simple alternating reference frame strategy:
899  * - For P-frames, it uses the last reconstructed frame as a reference.
900  * - To simplify the reference model of the encoder, the encoder alternates between
901  * two reference frame slots (typically slot 0 and slot 1) for storing reconstructed
902  * images and providing prediction references for the next frame.
903  */
904  if (base_ctx->ref_l0 > 1) {
905  hpic->slot = !href->slot;
906  } else {
907  hpic->slot = 0;
908  }
909  hpic->last_idr_frame = href->last_idr_frame;
910  fh->refresh_frame_flags = 1 << hpic->slot;
911 
912  // Set the nearest frame in L0 as all reference frame.
913  for (i = 0; i < AV1_REFS_PER_FRAME; i++)
914  fh->ref_frame_idx[i] = href->slot;
915 
916  fh->primary_ref_frame = href->slot;
917  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
918 
919  // Set the 2nd nearest frame in L0 as Golden frame.
920  if (pic->nb_refs[0] > 1) {
921  ref = pic->refs[0][pic->nb_refs[0] - 2];
922  href = ref->codec_priv;
923  // Reference frame index 3 is the GOLDEN_FRAME
924  fh->ref_frame_idx[3] = href->slot;
925  fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame;
926  } else if (base_ctx->ref_l0 == 1) {
927  fh->ref_order_hint[!href->slot] = cbctx->ref[!href->slot].order_hint;
928  }
929  break;
930 
932  av_log(avctx, AV_LOG_ERROR, "D3D12 AV1 video encode on this device requires B-frame support, "
933  "but it's not implemented.\n");
934  return AVERROR_PATCHWELCOME;
935  default:
936  av_log(avctx, AV_LOG_ERROR, "Unsupported picture type %d.\n", pic->type);
937  }
938 
939 
940  cbctx->seen_frame_header = 0;
941 
942  fh->show_frame = pic->display_order <= pic->encode_order;
944  fh->order_hint = pic->display_order - hpic->last_idr_frame;
945  fh->frame_width_minus_1 = ctx->resolution.Width - 1;
946  fh->frame_height_minus_1 = ctx->resolution.Height - 1;
949  fh->is_filter_switchable = 1;
952  fh->width_in_sbs_minus_1[0] = (ctx->resolution.Width + 63 >> 6) -1; // 64x64 superblock size
953  fh->height_in_sbs_minus_1[0] = (ctx->resolution.Height + 63 >> 6) -1; // 64x64 superblock size
954 
955  memcpy(fh->loop_filter_ref_deltas, default_loop_filter_ref_deltas,
956  AV1_TOTAL_REFS_PER_FRAME * sizeof(int8_t));
957 
958  if (fh->frame_type == AV1_FRAME_KEY && fh->show_frame)
959  fh->error_resilient_mode = 1;
960 
963 
964  d3d12va_pic->pic_ctl.pAV1PicData->FrameType = fh->frame_type;
965  d3d12va_pic->pic_ctl.pAV1PicData->TxMode = fh->tx_mode;
966  d3d12va_pic->pic_ctl.pAV1PicData->RefreshFrameFlags = fh->refresh_frame_flags;
967  d3d12va_pic->pic_ctl.pAV1PicData->TemporalLayerIndexPlus1 = hpic->temporal_id + 1;
968  d3d12va_pic->pic_ctl.pAV1PicData->SpatialLayerIndexPlus1 = hpic->spatial_id + 1;
969  d3d12va_pic->pic_ctl.pAV1PicData->PictureIndex = pic->display_order;
970  d3d12va_pic->pic_ctl.pAV1PicData->InterpolationFilter = D3D12_VIDEO_ENCODER_AV1_INTERPOLATION_FILTERS_SWITCHABLE;
971  d3d12va_pic->pic_ctl.pAV1PicData->PrimaryRefFrame = fh->primary_ref_frame;
972  if (fh->error_resilient_mode)
973  d3d12va_pic->pic_ctl.pAV1PicData->Flags |= D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_FLAG_ENABLE_ERROR_RESILIENT_MODE;
974 
975  if (pic->type == FF_HW_PICTURE_TYPE_IDR)
976  {
977  for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
978  d3d12va_pic->pic_ctl.pAV1PicData->ReferenceFramesReconPictureDescriptors[i].ReconstructedPictureResourceIndex =
980  }
981  } else if (pic->type == FF_HW_PICTURE_TYPE_P) {
982  for (i = 0; i < pic->nb_refs[0]; i++) {
983  FFHWBaseEncodePicture *ref_pic = pic->refs[0][i];
984  d3d12va_pic->pic_ctl.pAV1PicData->ReferenceFramesReconPictureDescriptors[i].ReconstructedPictureResourceIndex =
985  ((D3D12VAEncodeAV1Picture*)ref_pic->codec_priv)->slot;
986  }
987  }
988  // Set reference frame management
989  memset(d3d12va_pic->pic_ctl.pAV1PicData->ReferenceIndices, 0, sizeof(UINT) * AV1_REFS_PER_FRAME);
990  if (pic->type == FF_HW_PICTURE_TYPE_P) {
991  for (i = 0; i < AV1_REFS_PER_FRAME; i++)
992  d3d12va_pic->pic_ctl.pAV1PicData->ReferenceIndices[i] = fh->ref_frame_idx[i];
993  }
994 
995  return av_fifo_write(priv->picture_header_list, &priv->units.raw_frame_header, 1);
996 }
997 
998 
1001 
1002  .d3d12_codec = D3D12_VIDEO_ENCODER_CODEC_AV1,
1003 
1004  .flags = FF_HW_FLAG_B_PICTURES |
1007 
1008  .default_quality = 25,
1009 
1010  .get_encoder_caps = &d3d12va_encode_av1_get_encoder_caps,
1011 
1012  .configure = &d3d12va_encode_av1_configure,
1013 
1014  .set_level = &d3d12va_encode_av1_set_level,
1015 
1016  .set_tile = &d3d12va_encode_av1_set_tile,
1017 
1018  .picture_priv_data_size = sizeof(D3D12VAEncodeAV1Picture),
1019 
1020  .init_sequence_params = &d3d12va_encode_av1_init_sequence_params,
1021 
1022  .init_picture_params = &d3d12va_encode_av1_init_picture_params,
1023 
1024  .free_picture_params = &d3d12va_encode_av1_free_picture_params,
1025 
1027 
1028 #ifdef CONFIG_AV1_D3D12VA_ENCODER
1029  .get_coded_data = &d3d12va_encode_av1_get_coded_data,
1030 #endif
1031 };
1032 
1034 {
1036  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
1037 
1038  ctx->codec = &d3d12va_encode_type_av1;
1039 
1040  if (avctx->profile == AV_PROFILE_UNKNOWN)
1041  avctx->profile = priv->profile;
1042  if (avctx->level == AV_LEVEL_UNKNOWN)
1043  avctx->level = priv->level;
1044 
1045  if (avctx->level != AV_LEVEL_UNKNOWN && avctx->level & ~0xff) {
1046  av_log(avctx, AV_LOG_ERROR, "Invalid level %d: must fit "
1047  "in 8-bit unsigned integer.\n", avctx->level);
1048  return AVERROR(EINVAL);
1049  }
1050 
1051  if (priv->qp > 0)
1052  ctx->explicit_qp = priv->qp;
1053 
1055 
1056  return ff_d3d12va_encode_init(avctx);
1057 }
1058 
1060 {
1061  D3D12VAEncodeAV1Context *priv = avctx->priv_data;
1062 
1063  ff_cbs_fragment_free(&priv->current_obu);
1064  ff_cbs_close(&priv->cbc);
1065 
1066  av_freep(&priv->common.codec_conf.pAV1Config);
1067  av_freep(&priv->common.gop.pAV1SequenceStructure);
1068  av_freep(&priv->common.level.pAV1LevelSetting);
1069  av_freep(&priv->common.subregions_layout.pTilesPartition_AV1);
1070 
1072 
1073  return ff_d3d12va_encode_close(avctx);
1074 }
1075 
1076 #define OFFSET(x) offsetof(D3D12VAEncodeAV1Context, x)
1077 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
1082 
1083  { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
1084  OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, FLAGS },
1085 
1086  { "profile", "Set profile (general_profile_idc)",
1088  { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" },
1089 
1090 #define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1091  { .i64 = value }, 0, 0, FLAGS, "profile"
1092  { PROFILE("main", AV_PROFILE_AV1_MAIN) },
1093  { PROFILE("high", AV_PROFILE_AV1_HIGH) },
1094  { PROFILE("professional", AV_PROFILE_AV1_PROFESSIONAL) },
1095 #undef PROFILE
1096 
1097  { "tier", "Set tier (general_tier_flag)",
1098  OFFSET(unit_opts.tier), AV_OPT_TYPE_INT,
1099  { .i64 = 0 }, 0, 1, FLAGS, "tier" },
1100  { "main", NULL, 0, AV_OPT_TYPE_CONST,
1101  { .i64 = 0 }, 0, 0, FLAGS, "tier" },
1102  { "high", NULL, 0, AV_OPT_TYPE_CONST,
1103  { .i64 = 1 }, 0, 0, FLAGS, "tier" },
1104 
1105  { "level", "Set level (general_level_idc)",
1107  { .i64 = AV_LEVEL_UNKNOWN }, AV_LEVEL_UNKNOWN, 0xff, FLAGS, "level" },
1108 
1109 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1110  { .i64 = value }, 0, 0, FLAGS, "level"
1111  { LEVEL("2.0", 0) },
1112  { LEVEL("2.1", 1) },
1113  { LEVEL("2.2", 2) },
1114  { LEVEL("2.3", 3) },
1115  { LEVEL("3.0", 4) },
1116  { LEVEL("3.1", 5) },
1117  { LEVEL("3.2", 6) },
1118  { LEVEL("3.3", 7) },
1119  { LEVEL("4.0", 8) },
1120  { LEVEL("4.1", 9) },
1121  { LEVEL("4.2", 10) },
1122  { LEVEL("4.3", 11) },
1123  { LEVEL("5.0", 12) },
1124  { LEVEL("5.1", 13) },
1125  { LEVEL("5.2", 14) },
1126  { LEVEL("5.3", 15) },
1127  { LEVEL("6.0", 16) },
1128  { LEVEL("6.1", 17) },
1129  { LEVEL("6.2", 18) },
1130  { LEVEL("6.3", 19) },
1131  { LEVEL("7.0", 20) },
1132  { LEVEL("7.1", 21) },
1133  { LEVEL("7.2", 22) },
1134  { LEVEL("7.3", 23) },
1135 #undef LEVEL
1136  { NULL },
1137 };
1138 
1140  { "b", "0" },
1141  { "bf", "0" },
1142  { "g", "120" },
1143  { "i_qfactor", "1" },
1144  { "i_qoffset", "0" },
1145  { "b_qfactor", "1" },
1146  { "b_qoffset", "0" },
1147  { "qmin", "-1" },
1148  { "qmax", "-1" },
1149  { "refs", "0" },
1150  { NULL },
1151 };
1152 
1154  .class_name = "av1_d3d12va",
1155  .item_name = av_default_item_name,
1156  .option = d3d12va_encode_av1_options,
1157  .version = LIBAVUTIL_VERSION_INT,
1158 };
1159 
1161  .p.name = "av1_d3d12va",
1162  CODEC_LONG_NAME("D3D12VA av1 encoder"),
1163  .p.type = AVMEDIA_TYPE_VIDEO,
1164  .p.id = AV_CODEC_ID_AV1,
1165  .priv_data_size = sizeof(D3D12VAEncodeAV1Context),
1168  .close = &d3d12va_encode_av1_close,
1169  .p.priv_class = &d3d12va_encode_av1_class,
1170  .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
1172  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
1174  .defaults = d3d12va_encode_av1_defaults,
1176  .hw_configs = ff_d3d12va_encode_hw_configs,
1177  .p.wrapper_name = "d3d12va",
1178 };
D3D12VAHWBaseEncodeAV1Opts::enable_masked_compound
int enable_masked_compound
Definition: d3d12va_encode_av1.c:67
D3D12VAHWBaseEncodeAV1Opts::enable_intra_block_copy
int enable_intra_block_copy
Definition: d3d12va_encode_av1.c:75
cbs.h
d3d12va_encode_av1_profiles
static const D3D12VAEncodeProfile d3d12va_encode_av1_profiles[]
Definition: d3d12va_encode_av1.c:147
CODEC_PIXFMTS
#define CODEC_PIXFMTS(...)
Definition: codec_internal.h:392
AV1RawSequenceHeader::seq_force_integer_mv
uint8_t seq_force_integer_mv
Definition: cbs_av1.h:129
profile_high
static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_high
Definition: d3d12va_encode_av1.c:142
profile_professional
static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_professional
Definition: d3d12va_encode_av1.c:143
level
uint8_t level
Definition: svq3.c:208
AV1RawFrameHeader::primary_ref_frame
uint8_t primary_ref_frame
Definition: cbs_av1.h:196
d3d12va_hw_base_encode_init_params_av1
static int d3d12va_hw_base_encode_init_params_av1(FFHWBaseEncodeContext *base_ctx, AVCodecContext *avctx, D3D12VAHWBaseEncodeAV1 *common, D3D12VAHWBaseEncodeAV1Opts *opts)
Definition: d3d12va_encode_av1.c:446
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:96
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
D3D12VAHWBaseEncodeAV1::raw_frame_header
AV1RawOBU raw_frame_header
Definition: d3d12va_encode_av1.c:48
D3D12VAEncodeAV1Picture::last_idr_frame
uint16_t last_idr_frame
Definition: d3d12va_encode_av1.c:83
CodedBitstreamAV1Context::seen_frame_header
int seen_frame_header
Definition: cbs_av1.h:464
CodedBitstreamContext::priv_data
void * priv_data
Internal codec-specific data.
Definition: cbs.h:247
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:667
profile_main
static const D3D12_VIDEO_ENCODER_AV1_PROFILE profile_main
Definition: d3d12va_encode_av1.c:141
AV1RawSequenceHeader
Definition: cbs_av1.h:82
AV1RawFrameHeader::show_frame
uint8_t show_frame
Definition: cbs_av1.h:181
D3D12VAEncodeAV1Picture::slot
uint8_t slot
Definition: d3d12va_encode_av1.c:84
AV1_PRIMARY_REF_NONE
@ AV1_PRIMARY_REF_NONE
Definition: av1.h:87
FFHWBaseEncodePicture::priv
void * priv
Definition: hw_base_encode.h:63
FFHWBaseEncodePicture::codec_priv
void * codec_priv
Definition: hw_base_encode.h:65
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3456
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:130
av_clip_uintp2
#define av_clip_uintp2
Definition: common.h:124
AV1RawFrameHeader::cdef_uv_pri_strength
uint8_t cdef_uv_pri_strength[8]
Definition: cbs_av1.h:277
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
D3D12VAEncodeAV1Context::level
int level
Definition: d3d12va_encode_av1.c:92
pixdesc.h
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:660
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:777
AV1_TX_MODE_SELECT
@ AV1_TX_MODE_SELECT
Definition: av1.h:183
AVPacket::data
uint8_t * data
Definition: packet.h:588
AV1_INTERPOLATION_FILTER_SWITCHABLE
@ AV1_INTERPOLATION_FILTER_SWITCHABLE
Definition: av1.h:104
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:226
AVOption
AVOption.
Definition: opt.h:429
encode.h
d3d12va_encode.h
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:669
AV1RawFrameHeader::uniform_tile_spacing_flag
uint8_t uniform_tile_spacing_flag
Definition: cbs_av1.h:224
data
const char data[16]
Definition: mxf.c:149
high
int high
Definition: dovi_rpuenc.c:39
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:226
d3d12va_encode_av1_defaults
static const FFCodecDefault d3d12va_encode_av1_defaults[]
Definition: d3d12va_encode_av1.c:1139
d3d12va_encode_av1_update_current_frame_picture_header
static int d3d12va_encode_av1_update_current_frame_picture_header(AVCodecContext *avctx, D3D12VAEncodePicture *pic, AV1RawOBU *frameheader_obu)
Definition: d3d12va_encode_av1.c:211
AV_PROFILE_AV1_PROFESSIONAL
#define AV_PROFILE_AV1_PROFESSIONAL
Definition: defs.h:171
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
AV1RawTileData::data
uint8_t * data
Definition: cbs_av1.h:301
FF_HW_FLAG_B_PICTURES
@ FF_HW_FLAG_B_PICTURES
Definition: hw_base_encode.h:53
AV1RawOBU::header
AV1RawOBUHeader header
Definition: cbs_av1.h:414
AV1RawOBU::obu
union AV1RawOBU::@77 obu
tf_sess_config.config
config
Definition: tf_sess_config.py:33
AV1RawFrameHeader::loop_filter_level
uint8_t loop_filter_level[4]
Definition: cbs_av1.h:264
AV1ReferenceFrameState::order_hint
int order_hint
Definition: cbs_av1.h:447
AV1RawFrameHeader::cdef_y_sec_strength
uint8_t cdef_y_sec_strength[8]
Definition: cbs_av1.h:276
AV1RawSequenceHeader::seq_profile
uint8_t seq_profile
Definition: cbs_av1.h:83
AV1RawFrameHeader::cdef_damping_minus_3
uint8_t cdef_damping_minus_3
Definition: cbs_av1.h:273
AV1_CSP_COLOCATED
@ AV1_CSP_COLOCATED
Definition: av1.h:135
D3D12VAEncodeAV1Picture::temporal_id
uint8_t temporal_id
Definition: d3d12va_encode_av1.c:79
OFFSET
#define OFFSET(x)
Definition: d3d12va_encode_av1.c:1076
D3D12VAEncodePicture::resolved_metadata
ID3D12Resource * resolved_metadata
Definition: d3d12va_encode.h:53
D3D12VAHWBaseEncodeAV1Opts::enable_loop_filter
int enable_loop_filter
Definition: d3d12va_encode_av1.c:70
FFHWBaseEncodeContext
Definition: hw_base_encode.h:122
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:559
AV1RawColorConfig
Definition: cbs_av1.h:50
ff_d3d12va_encode_hw_configs
const AVCodecHWConfigInternal *const ff_d3d12va_encode_hw_configs[]
Definition: d3d12va_encode.c:37
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:802
AV1RawFrameHeader::loop_filter_ref_deltas
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:269
D3D12VAEncodePicture::output_buffer_ref
AVBufferRef * output_buffer_ref
Definition: d3d12va_encode.h:49
FFCodecDefault
Definition: codec_internal.h:96
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
D3D12VAHWBaseEncodeAV1Opts::enable_superres
int enable_superres
Definition: d3d12va_encode_av1.c:58
AV1RawFrameHeader::delta_q_u_dc
int8_t delta_q_u_dc
Definition: cbs_av1.h:242
D3D12VAEncodeContext::subregions_layout
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA subregions_layout
Definition: d3d12va_encode.h:268
FFHWBaseEncodePicture::type
int type
Definition: hw_base_encode.h:78
AV1RawSequenceHeader::enable_ref_frame_mvs
uint8_t enable_ref_frame_mvs
Definition: cbs_av1.h:124
fail
#define fail()
Definition: checkasm.h:214
AV1_OBU_FRAME_HEADER
@ AV1_OBU_FRAME_HEADER
Definition: av1.h:32
D3D12VAEncodeAV1Context
Definition: d3d12va_encode_av1.c:87
D3D12VAEncodeAV1Context::tier
int tier
Definition: d3d12va_encode_av1.c:93
av_fifo_write
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
Definition: fifo.c:188
AV1RawSequenceHeader::enable_filter_intra
uint8_t enable_filter_intra
Definition: cbs_av1.h:115
D3D12VAEncodePicture::output_buffer
ID3D12Resource * output_buffer
Definition: d3d12va_encode.h:50
CodedBitstreamAV1Context::ref
AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES]
Definition: cbs_av1.h:491
D3D12VA_ENCODE_RC_OPTIONS
#define D3D12VA_ENCODE_RC_OPTIONS
Definition: d3d12va_encode.h:386
D3D12VAHWBaseEncodeAV1Opts::enable_dual_filter
int enable_dual_filter
Definition: d3d12va_encode_av1.c:72
AVRational::num
int num
Numerator.
Definition: rational.h:59
D3D12VAEncodeAV1Context::common
D3D12VAEncodeContext common
Definition: d3d12va_encode_av1.c:88
AV1RawFrameHeader::tx_mode
uint8_t tx_mode
Definition: cbs_av1.h:284
d3d12va_encode_av1_init_sequence_params
static int d3d12va_encode_av1_init_sequence_params(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:540
AV1RawFrameHeader::base_q_idx
uint8_t base_q_idx
Definition: cbs_av1.h:239
cbs_av1.h
D3D12VAEncodeAV1Context::q_idx_idr
uint8_t q_idx_idr
Definition: d3d12va_encode_av1.c:95
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:653
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AV1RawSequenceHeader::enable_masked_compound
uint8_t enable_masked_compound
Definition: cbs_av1.h:118
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
main
int main
Definition: dovi_rpuenc.c:38
FFHWBaseEncodeContext::ref_l0
int ref_l0
Definition: hw_base_encode.h:197
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
av_fifo_read
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
Definition: fifo.c:240
AV1RawFrameHeader::cdef_uv_sec_strength
uint8_t cdef_uv_sec_strength[8]
Definition: cbs_av1.h:278
d3d12va_encode_av1_get_buffer_size
static int d3d12va_encode_av1_get_buffer_size(AVCodecContext *avctx, D3D12VAEncodePicture *pic, size_t *size)
Definition: d3d12va_encode_av1.c:346
D3D12VA_ENCODE_COMMON_OPTIONS
#define D3D12VA_ENCODE_COMMON_OPTIONS
Definition: d3d12va_encode.h:365
AV1RawFrameHeader::qm_y
uint8_t qm_y
Definition: cbs_av1.h:247
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:129
D3D12VAHWBaseEncodeAV1Opts::enable_cdef
int enable_cdef
Definition: d3d12va_encode_av1.c:56
AV1RawFrameHeader::render_width_minus_1
uint16_t render_width_minus_1
Definition: cbs_av1.h:202
AV1RawFrameHeader::update_mode_delta
uint8_t update_mode_delta[2]
Definition: cbs_av1.h:270
CodedBitstreamFragment::data_size
size_t data_size
The number of bytes in the bitstream.
Definition: cbs.h:142
D3D12VAEncodePicture::header_size
int header_size
Definition: d3d12va_encode.h:43
FLAGS
#define FLAGS
Definition: d3d12va_encode_av1.c:1077
d3d12va_encode_av1_options
static const AVOption d3d12va_encode_av1_options[]
Definition: d3d12va_encode_av1.c:1078
D3D12VAEncodeAV1Level
Definition: d3d12va_encode_av1.c:108
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:144
d3d12va_encode_av1_class
static const AVClass d3d12va_encode_av1_class
Definition: d3d12va_encode_av1.c:1153
D3D12VAHWBaseEncodeAV1Opts::enable_interintra_compound
int enable_interintra_compound
Definition: d3d12va_encode_av1.c:66
AV1_TOTAL_REFS_PER_FRAME
@ AV1_TOTAL_REFS_PER_FRAME
Definition: av1.h:86
d3d12va_encode_av1_configure
static int d3d12va_encode_av1_configure(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:723
CodedBitstreamUnitType
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition: cbs.h:54
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
AV1RawFrameHeader::frame_width_minus_1
uint16_t frame_width_minus_1
Definition: cbs_av1.h:197
ctx
AVFormatContext * ctx
Definition: movenc.c:49
hw_base_encode.h
D3D12VAEncodePicture::pic_ctl
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA pic_ctl
Definition: d3d12va_encode.h:57
AV1RawSequenceHeader::seq_tier
uint8_t seq_tier[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:97
CodedBitstreamFragment::data_bit_padding
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
Definition: cbs.h:146
AV1RawFrameHeader::loop_filter_mode_deltas
int8_t loop_filter_mode_deltas[2]
Definition: cbs_av1.h:271
color_range
color_range
Definition: vf_selectivecolor.c:43
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:639
FF_HW_PICTURE_TYPE_P
@ FF_HW_PICTURE_TYPE_P
Definition: hw_base_encode.h:41
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:332
FFHWBaseEncodeContext::b_per_p
int b_per_p
Definition: hw_base_encode.h:189
if
if(ret)
Definition: filter_design.txt:179
AV1_FRAME_INTER
@ AV1_FRAME_INTER
Definition: av1.h:54
D3D12VAHWBaseEncodeAV1Opts
Definition: d3d12va_encode_av1.c:52
D3D12VAHWBaseEncodeAV1
Definition: d3d12va_encode_av1.c:46
opts
AVDictionary * opts
Definition: movenc.c:51
framerate
float framerate
Definition: av1_levels.c:29
FF_HW_FLAG_B_PICTURE_REFERENCES
@ FF_HW_FLAG_B_PICTURE_REFERENCES
Definition: hw_base_encode.h:55
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AV1RawOBU
Definition: cbs_av1.h:413
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
AV1RawFrameHeader::qm_v
uint8_t qm_v
Definition: cbs_av1.h:249
AV1RawFrameHeader::is_filter_switchable
uint8_t is_filter_switchable
Definition: cbs_av1.h:217
D3D12VAEncodeAV1Context::qp
int qp
Definition: d3d12va_encode_av1.c:90
NULL
#define NULL
Definition: coverity.c:32
D3D12VAHWBaseEncodeAV1Opts::enable_jnt_comp
int enable_jnt_comp
Definition: d3d12va_encode_av1.c:61
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:213
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:677
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:284
AV1RawFrameHeader
Definition: cbs_av1.h:174
AVCHROMA_LOC_LEFT
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:798
AV_LEVEL_UNKNOWN
#define AV_LEVEL_UNKNOWN
Definition: defs.h:209
AV1RawFrameHeader::width_in_sbs_minus_1
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]
Definition: cbs_av1.h:229
AVCHROMA_LOC_TOPLEFT
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:800
d3d12va_encode_av1_free_picture_params
static void d3d12va_encode_av1_free_picture_params(D3D12VAEncodePicture *pic)
Definition: d3d12va_encode_av1.c:842
AV1_SELECT_INTEGER_MV
@ AV1_SELECT_INTEGER_MV
Definition: av1.h:99
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:367
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:489
D3D12VAHWBaseEncodeAV1::raw_tile_group
AV1RawOBU raw_tile_group
Definition: d3d12va_encode_av1.c:49
d3d12va_encode_av1_write_tile_group
static int d3d12va_encode_av1_write_tile_group(AVCodecContext *avctx, uint8_t *tile_group, uint32_t tile_group_size, char *data, size_t *data_len)
Definition: d3d12va_encode_av1.c:319
AV1RawTileData::data_size
size_t data_size
Definition: cbs_av1.h:303
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
AV1RawColorConfig::chroma_sample_position
uint8_t chroma_sample_position
Definition: cbs_av1.h:63
AV1_CSP_VERTICAL
@ AV1_CSP_VERTICAL
Definition: av1.h:134
FF_HW_FLAG_NON_IDR_KEY_PICTURES
@ FF_HW_FLAG_NON_IDR_KEY_PICTURES
Definition: hw_base_encode.h:58
AV1_OBU_TILE_GROUP
@ AV1_OBU_TILE_GROUP
Definition: av1.h:33
AV1RawSequenceHeader::enable_jnt_comp
uint8_t enable_jnt_comp
Definition: cbs_av1.h:123
AVD3D12VAFramesContext
This struct is allocated as AVHWFramesContext.hwctx.
Definition: hwcontext_d3d12va.h:172
AV_PIX_FMT_D3D12
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
Definition: pixfmt.h:440
D3D12VAEncodeAV1Picture::show_frame
uint8_t show_frame
Definition: d3d12va_encode_av1.c:81
D3D12VAEncodeAV1Context::profile
int profile
Definition: d3d12va_encode_av1.c:91
AVCodecContext::level
int level
Encoding level descriptor.
Definition: avcodec.h:1636
AV1RawSequenceHeader::seq_force_screen_content_tools
uint8_t seq_force_screen_content_tools
Definition: cbs_av1.h:127
d3d12va_encode_av1_set_level
static int d3d12va_encode_av1_set_level(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:777
D3D12VAEncodeAV1Context::unit_opts
D3D12VAHWBaseEncodeAV1Opts unit_opts
Definition: d3d12va_encode_av1.c:100
AV1RawFrameHeader::delta_q_res
uint8_t delta_q_res
Definition: cbs_av1.h:259
D3D12VAEncodeAV1Context::units
D3D12VAHWBaseEncodeAV1 units
Definition: d3d12va_encode_av1.c:99
AV1RawSequenceHeader::max_frame_height_minus_1
uint16_t max_frame_height_minus_1
Definition: cbs_av1.h:108
D3D12VAHWBaseEncodeAV1Opts::enable_ref_frame_mvs
int enable_ref_frame_mvs
Definition: d3d12va_encode_av1.c:59
AV1RawFrameHeader::interpolation_filter
uint8_t interpolation_filter
Definition: cbs_av1.h:218
D3D12VAHWBaseEncodeAV1Opts::tier
int tier
Definition: d3d12va_encode_av1.c:53
D3D12VAEncodeContext::codec_conf
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION codec_conf
Definition: d3d12va_encode.h:260
AV1RawFrameHeader::ref_frame_idx
int8_t ref_frame_idx[AV1_REFS_PER_FRAME]
Definition: cbs_av1.h:213
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:550
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
AVFifo
Definition: fifo.c:35
d3d12va_encode_av1_init_picture_params
static int d3d12va_encode_av1_init_picture_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
Definition: d3d12va_encode_av1.c:850
AV1RawFrameHeader::refresh_frame_flags
uint8_t refresh_frame_flags
Definition: cbs_av1.h:207
AV1RawFrameHeader::cdef_bits
uint8_t cdef_bits
Definition: cbs_av1.h:274
D3D12VAEncodeAV1Level::level
uint8_t level
Definition: d3d12va_encode_av1.c:109
codec_internal.h
D3D_PROFILE_DESC
#define D3D_PROFILE_DESC(name)
Definition: d3d12va_encode_av1.c:145
ff_d3d12va_encode_init
int ff_d3d12va_encode_init(AVCodecContext *avctx)
Definition: d3d12va_encode.c:1587
FFHWBaseEncodePicture::nb_refs
int nb_refs[MAX_REFERENCE_LIST_NUM]
Definition: hw_base_encode.h:97
D3D12VAEncodeProfile
Definition: d3d12va_encode.h:62
size
int size
Definition: twinvq_data.h:10344
AV1RawOBU::sequence_header
AV1RawSequenceHeader sequence_header
Definition: cbs_av1.h:419
CodedBitstreamFragment::data
uint8_t * data
Pointer to the bitstream form of this fragment.
Definition: cbs.h:135
AV1RawSequenceHeader::frame_height_bits_minus_1
uint8_t frame_height_bits_minus_1
Definition: cbs_av1.h:106
LEVEL
#define LEVEL(name, value)
d3d12va_encode_av1_write_picture_header
static int d3d12va_encode_av1_write_picture_header(AVCodecContext *avctx, D3D12VAEncodePicture *pic, char *data, size_t *data_len)
Definition: d3d12va_encode_av1.c:289
AV1_OBU_SEQUENCE_HEADER
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
AV1LevelDescriptor
Definition: av1_levels.h:26
FFHWBaseEncodePicture::encode_order
int64_t encode_order
Definition: hw_base_encode.h:70
AV1RawSequenceHeader::still_picture
uint8_t still_picture
Definition: cbs_av1.h:84
AV1_TX_MODE_LARGEST
@ AV1_TX_MODE_LARGEST
Definition: av1.h:182
D3D12VAHWBaseEncodeAV1Opts::enable_intra_edge_filter
int enable_intra_edge_filter
Definition: d3d12va_encode_av1.c:65
AV_PROFILE_AV1_HIGH
#define AV_PROFILE_AV1_HIGH
Definition: defs.h:170
AV1RawSequenceHeader::enable_interintra_compound
uint8_t enable_interintra_compound
Definition: cbs_av1.h:117
AV1RawFrameHeader::order_hint
uint8_t order_hint
Definition: cbs_av1.h:191
d3d12va_encode_av1_write_obu
static int d3d12va_encode_av1_write_obu(AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *obu)
Definition: d3d12va_encode_av1.c:157
AV1RawOBU::frame_header
AV1RawFrameHeader frame_header
Definition: cbs_av1.h:420
D3D12VAEncodePicture
Definition: d3d12va_encode.h:42
MAX_PARAM_BUFFER_SIZE
@ MAX_PARAM_BUFFER_SIZE
Definition: vaapi_encode.h:47
AV1RawFrameHeader::delta_q_v_dc
int8_t delta_q_v_dc
Definition: cbs_av1.h:244
D3D12VAHWBaseEncodeAV1Opts::enable_warped_motion
int enable_warped_motion
Definition: d3d12va_encode_av1.c:64
D3D12VAEncodeContext::level
D3D12_VIDEO_ENCODER_LEVEL_SETTING level
Definition: d3d12va_encode.h:266
d3d12va_encode_av1_write_sequence_header
static int d3d12va_encode_av1_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)
Definition: d3d12va_encode_av1.c:192
D3D12VAHWBaseEncodeAV1::raw_sequence_header
AV1RawOBU raw_sequence_header
Definition: d3d12va_encode_av1.c:47
D3D12VAEncodeAV1Level::d3d12_level
D3D12_VIDEO_ENCODER_AV1_LEVELS d3d12_level
Definition: d3d12va_encode_av1.c:110
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV1RawSequenceHeader::enable_dual_filter
uint8_t enable_dual_filter
Definition: cbs_av1.h:120
AV1RawSequenceHeader::enable_superres
uint8_t enable_superres
Definition: cbs_av1.h:133
common.h
d3d12va_encode_type_av1
static const D3D12VAEncodeType d3d12va_encode_type_av1
Definition: d3d12va_encode_av1.c:999
AV1RawSequenceHeader::enable_intra_edge_filter
uint8_t enable_intra_edge_filter
Definition: cbs_av1.h:116
D3D12_VIDEO_ENCODER_AV1_INVALID_DPB_RESOURCE_INDEX
#define D3D12_VIDEO_ENCODER_AV1_INVALID_DPB_RESOURCE_INDEX
Definition: d3d12va_encode_av1.c:43
AV1RawSequenceHeader::max_frame_width_minus_1
uint16_t max_frame_width_minus_1
Definition: cbs_av1.h:107
FFHWBaseEncodePicture::refs
struct FFHWBaseEncodePicture * refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]
Definition: hw_base_encode.h:98
AV1RawSequenceHeader::color_config
AV1RawColorConfig color_config
Definition: cbs_av1.h:137
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:684
profile
int profile
Definition: mxfenc.c:2297
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:703
D3D12VAHWBaseEncodeAV1Opts::enable_filter_intra
int enable_filter_intra
Definition: d3d12va_encode_av1.c:68
AV1RawSequenceHeader::enable_order_hint
uint8_t enable_order_hint
Definition: cbs_av1.h:122
AV1RawFrameHeader::loop_filter_delta_enabled
uint8_t loop_filter_delta_enabled
Definition: cbs_av1.h:266
AVCodecContext::height
int height
Definition: avcodec.h:600
av1_levels
static const D3D12VAEncodeAV1Level av1_levels[]
Definition: d3d12va_encode_av1.c:114
avcodec.h
d3d12va_encode_av1_close
static int d3d12va_encode_av1_close(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:1059
AV1RawTileGroup::tile_data
AV1RawTileData tile_data
Definition: cbs_av1.h:315
AVD3D12VAFramesContext::format
DXGI_FORMAT format
DXGI_FORMAT format.
Definition: hwcontext_d3d12va.h:177
AV1RawFrameHeader::ref_order_hint
uint8_t ref_order_hint[AV1_NUM_REF_FRAMES]
Definition: cbs_av1.h:209
AV1RawFrameHeader::height_in_sbs_minus_1
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]
Definition: cbs_av1.h:230
tile_group_obu
static int FUNC() tile_group_obu(CodedBitstreamContext *ctx, RWContext *rw, AV1RawTileGroup *current)
Definition: cbs_av1_syntax_template.c:1819
FFHWBaseEncodeContext::gop_size
int gop_size
Definition: hw_base_encode.h:184
FFHWBaseEncodePicture
Definition: hw_base_encode.h:61
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:81
AVHWFramesContext::hwctx
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
Definition: hwcontext.h:153
D3D12VAEncodeContext
Definition: d3d12va_encode.h:146
AV1RawColorConfig::high_bitdepth
uint8_t high_bitdepth
Definition: cbs_av1.h:51
av_fifo_alloc2
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
Definition: fifo.c:47
AV1RawFrameHeader::update_ref_delta
uint8_t update_ref_delta[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:268
AV1RawFrameHeader::using_qmatrix
uint8_t using_qmatrix
Definition: cbs_av1.h:246
AV1RawSequenceHeader::frame_width_bits_minus_1
uint8_t frame_width_bits_minus_1
Definition: cbs_av1.h:105
AV1RawSequenceHeader::enable_warped_motion
uint8_t enable_warped_motion
Definition: cbs_av1.h:119
FF_HW_PICTURE_TYPE_IDR
@ FF_HW_PICTURE_TYPE_IDR
Definition: hw_base_encode.h:39
FFHWBaseEncodeContext::surface_height
int surface_height
Definition: hw_base_encode.h:141
D3D12VAEncodeAV1Picture::spatial_id
uint8_t spatial_id
Definition: d3d12va_encode_av1.c:80
AVCodecContext
main external API structure.
Definition: avcodec.h:439
write_sequence_header
static int write_sequence_header(AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, uint8_t *data, size_t *data_len)
Definition: vulkan_encode_av1.c:1095
ff_get_encode_buffer
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
Definition: encode.c:105
d3d12va_encode_av1_set_tile
static int d3d12va_encode_av1_set_tile(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:827
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1626
D3D12VAHWBaseEncodeAV1Opts::enable_restoration
int enable_restoration
Definition: d3d12va_encode_av1.c:57
av1_levels.h
ff_av1_d3d12va_encoder
const FFCodec ff_av1_d3d12va_encoder
Definition: d3d12va_encode_av1.c:1160
AV1_FRAME_KEY
@ AV1_FRAME_KEY
Definition: av1.h:53
AV1RawFrameHeader::frame_height_minus_1
uint16_t frame_height_minus_1
Definition: cbs_av1.h:198
AVCodecContext::i_quant_offset
float i_quant_offset
qscale offset between P and I-frames
Definition: avcodec.h:809
D3D12VAEncodePicture::aligned_header_size
int aligned_header_size
Definition: d3d12va_encode.h:44
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
D3D12VAHWBaseEncodeAV1Opts::level
int level
Definition: d3d12va_encode_av1.c:54
FFHWBaseEncodeContext::input_frames
AVHWFramesContext * input_frames
Definition: hw_base_encode.h:153
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
D3D12VAEncodeAV1Picture
Definition: d3d12va_encode_av1.c:78
D3D12VAHWBaseEncodeAV1Opts::enable_palette
int enable_palette
Definition: d3d12va_encode_av1.c:74
AV1_NUM_REF_FRAMES
@ AV1_NUM_REF_FRAMES
Definition: av1.h:84
FFHWBaseEncodeContext::surface_width
int surface_width
Definition: hw_base_encode.h:140
AV1RawSequenceHeader::order_hint_bits_minus_1
uint8_t order_hint_bits_minus_1
Definition: cbs_av1.h:131
AV1RawTileGroup
Definition: cbs_av1.h:306
AV1RawFrameHeader::loop_filter_sharpness
uint8_t loop_filter_sharpness
Definition: cbs_av1.h:265
AV1_CSP_UNKNOWN
@ AV1_CSP_UNKNOWN
Definition: av1.h:133
D3D12VAEncodeContext::gop
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE gop
Definition: d3d12va_encode.h:264
AV1RawFrameHeader::delta_q_v_ac
int8_t delta_q_v_ac
Definition: cbs_av1.h:245
desc
const char * desc
Definition: libsvtav1.c:78
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
D3D12VAHWBaseEncodeAV1Opts::enable_128x128_superblock
int enable_128x128_superblock
Definition: d3d12va_encode_av1.c:62
FF_HW_PICTURE_TYPE_B
@ FF_HW_PICTURE_TYPE_B
Definition: hw_base_encode.h:42
mem.h
D3D12VAHWBaseEncodeAV1Opts::enable_loop_filter_delta
int enable_loop_filter_delta
Definition: d3d12va_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
AV1RawSequenceHeader::enable_restoration
uint8_t enable_restoration
Definition: cbs_av1.h:135
ff_d3d12va_encode_close
int ff_d3d12va_encode_close(AVCodecContext *avctx)
Definition: d3d12va_encode.c:1726
AV1RawFrameHeader::error_resilient_mode
uint8_t error_resilient_mode
Definition: cbs_av1.h:184
AV1RawFrameHeader::delta_q_u_ac
int8_t delta_q_u_ac
Definition: cbs_av1.h:243
d3d12va_encode_av1_init
static int d3d12va_encode_av1_init(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:1033
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
ff_d3d12va_encode_receive_packet
int ff_d3d12va_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: d3d12va_encode.c:1582
AVPacket
This structure stores compressed data.
Definition: packet.h:565
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:466
d3d12va_encode_av1_add_obu
static int d3d12va_encode_av1_add_obu(AVCodecContext *avctx, CodedBitstreamFragment *au, CodedBitstreamUnitType obu_type, void *obu_unit)
Definition: d3d12va_encode_av1.c:176
AV1RawTileData::data_ref
AVBufferRef * data_ref
Definition: cbs_av1.h:302
D3D12VAEncodeAV1Context::current_obu
CodedBitstreamFragment current_obu
Definition: d3d12va_encode_av1.c:103
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
AV1RawFrameHeader::delta_q_present
uint8_t delta_q_present
Definition: cbs_av1.h:258
D3D12VAEncodeAV1Context::post_encode_values_flag
D3D12_VIDEO_ENCODER_AV1_POST_ENCODE_VALUES_FLAGS post_encode_values_flag
Definition: d3d12va_encode_av1.c:104
AV1RawSequenceHeader::enable_cdef
uint8_t enable_cdef
Definition: cbs_av1.h:134
d3d12va_encode_av1_get_coded_data
static int d3d12va_encode_av1_get_coded_data(AVCodecContext *avctx, D3D12VAEncodePicture *pic, AVPacket *pkt)
Definition: d3d12va_encode_av1.c:373
AV1RawSequenceHeader::reduced_still_picture_header
uint8_t reduced_still_picture_header
Definition: cbs_av1.h:85
D3D12VAEncodeType::profiles
const D3D12VAEncodeProfile * profiles
List of supported profiles.
Definition: d3d12va_encode.h:286
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:600
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
av_fifo_freep2
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
Definition: fifo.c:286
HW_BASE_ENCODE_COMMON_OPTIONS
#define HW_BASE_ENCODE_COMMON_OPTIONS
Definition: hw_base_encode.h:243
D3D12VAEncodeType
Definition: d3d12va_encode.h:282
D3D12VAEncodeAV1Context::q_idx_p
uint8_t q_idx_p
Definition: d3d12va_encode_av1.c:96
D3D12VAEncodeAV1Picture::frame_type
uint8_t frame_type
Definition: d3d12va_encode_av1.c:82
AV1RawFrameHeader::qm_u
uint8_t qm_u
Definition: cbs_av1.h:248
hwcontext_d3d12va_internal.h
FFHWBaseEncodePicture::display_order
int64_t display_order
Definition: hw_base_encode.h:69
AV1RawFrameHeader::cdef_y_pri_strength
uint8_t cdef_y_pri_strength[8]
Definition: cbs_av1.h:275
AV_PROFILE_AV1_MAIN
#define AV_PROFILE_AV1_MAIN
Definition: defs.h:169
AV1RawFrameHeader::delta_q_y_dc
int8_t delta_q_y_dc
Definition: cbs_av1.h:240
AV1RawFrameHeader::showable_frame
uint8_t showable_frame
Definition: cbs_av1.h:182
AV1RawOBUHeader::obu_has_size_field
uint8_t obu_has_size_field
Definition: cbs_av1.h:42
d3d12va_encode_av1_get_encoder_caps
static int d3d12va_encode_av1_get_encoder_caps(AVCodecContext *avctx)
Definition: d3d12va_encode_av1.c:616
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV1_REFS_PER_FRAME
@ AV1_REFS_PER_FRAME
Definition: av1.h:85
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
AV_FIFO_FLAG_AUTO_GROW
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
Definition: fifo.h:63
PROFILE
#define PROFILE(name, value)
AV1RawFrameHeader::render_height_minus_1
uint16_t render_height_minus_1
Definition: cbs_av1.h:203
D3D12VAEncodeAV1Context::cbc
CodedBitstreamContext * cbc
Definition: d3d12va_encode_av1.c:102
AV1RawFrameHeader::frame_type
uint8_t frame_type
Definition: cbs_av1.h:180
CodedBitstreamAV1Context
Definition: cbs_av1.h:457
D3D12VAEncodeAV1Context::picture_header_list
AVFifo * picture_header_list
Definition: d3d12va_encode_av1.c:105
AV1RawOBUHeader::obu_type
uint8_t obu_type
Definition: cbs_av1.h:40