FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dxva2_hevc.c
Go to the documentation of this file.
1 /*
2  * DXVA2 HEVC HW acceleration.
3  *
4  * copyright (c) 2014 - 2015 Hendrik Leppkes
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/avassert.h"
24 
25 #include "hevc.h"
26 
27 // The headers above may include w32threads.h, which uses the original
28 // _WIN32_WINNT define, while dxva2_internal.h redefines it to target a
29 // potentially newer version.
30 #include "dxva2_internal.h"
31 
32 #define MAX_SLICES 256
33 
35  DXVA_PicParams_HEVC pp;
36  DXVA_Qmatrix_HEVC qm;
37  unsigned slice_count;
38  DXVA_Slice_HEVC_Short slice_short[MAX_SLICES];
40  unsigned bitstream_size;
41 };
42 
43 static void fill_picture_entry(DXVA_PicEntry_HEVC *pic,
44  unsigned index, unsigned flag)
45 {
46  av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
47  pic->bPicEntry = index | (flag << 7);
48 }
49 
50 static int get_refpic_index(const DXVA_PicParams_HEVC *pp, int surface_index)
51 {
52  int i;
53  for (i = 0; i < FF_ARRAY_ELEMS(pp->RefPicList); i++) {
54  if ((pp->RefPicList[i].bPicEntry & 0x7f) == surface_index)
55  return i;
56  }
57  return 0xff;
58 }
59 
61  DXVA_PicParams_HEVC *pp)
62 {
63  const HEVCFrame *current_picture = h->ref;
64  const HEVCSPS *sps = h->ps.sps;
65  const HEVCPPS *pps = h->ps.pps;
66  int i, j;
67 
68  memset(pp, 0, sizeof(*pp));
69 
70  pp->PicWidthInMinCbsY = sps->min_cb_width;
71  pp->PicHeightInMinCbsY = sps->min_cb_height;
72 
73  pp->wFormatAndSequenceInfoFlags = (sps->chroma_format_idc << 0) |
74  (sps->separate_colour_plane_flag << 2) |
75  ((sps->bit_depth - 8) << 3) |
76  ((sps->bit_depth - 8) << 6) |
77  ((sps->log2_max_poc_lsb - 4) << 9) |
78  (0 << 13) |
79  (0 << 14) |
80  (0 << 15);
81 
82  fill_picture_entry(&pp->CurrPic, ff_dxva2_get_surface_index(avctx, ctx, current_picture->frame), 0);
83 
84  pp->sps_max_dec_pic_buffering_minus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering - 1;
85  pp->log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3;
86  pp->log2_diff_max_min_luma_coding_block_size = sps->log2_diff_max_min_coding_block_size;
87  pp->log2_min_transform_block_size_minus2 = sps->log2_min_tb_size - 2;
88  pp->log2_diff_max_min_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size;
89  pp->max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter;
90  pp->max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra;
91  pp->num_short_term_ref_pic_sets = sps->nb_st_rps;
92  pp->num_long_term_ref_pics_sps = sps->num_long_term_ref_pics_sps;
93 
94  pp->num_ref_idx_l0_default_active_minus1 = pps->num_ref_idx_l0_default_active - 1;
95  pp->num_ref_idx_l1_default_active_minus1 = pps->num_ref_idx_l1_default_active - 1;
96  pp->init_qp_minus26 = pps->pic_init_qp_minus26;
97 
99  pp->ucNumDeltaPocsOfRefRpsIdx = h->sh.short_term_rps->rps_idx_num_delta_pocs;
100  pp->wNumBitsForShortTermRPSInSlice = h->sh.short_term_ref_pic_set_size;
101  }
102 
103  pp->dwCodingParamToolFlags = (sps->scaling_list_enable_flag << 0) |
104  (sps->amp_enabled_flag << 1) |
105  (sps->sao_enabled << 2) |
106  (sps->pcm_enabled_flag << 3) |
107  ((sps->pcm_enabled_flag ? (sps->pcm.bit_depth - 1) : 0) << 4) |
108  ((sps->pcm_enabled_flag ? (sps->pcm.bit_depth_chroma - 1) : 0) << 8) |
109  ((sps->pcm_enabled_flag ? (sps->pcm.log2_min_pcm_cb_size - 3) : 0) << 12) |
110  ((sps->pcm_enabled_flag ? (sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size) : 0) << 14) |
111  (sps->pcm.loop_filter_disable_flag << 16) |
112  (sps->long_term_ref_pics_present_flag << 17) |
113  (sps->sps_temporal_mvp_enabled_flag << 18) |
116  (pps->output_flag_present_flag << 21) |
117  (pps->num_extra_slice_header_bits << 22) |
118  (pps->sign_data_hiding_flag << 25) |
119  (pps->cabac_init_present_flag << 26) |
120  (0 << 27);
121 
122  pp->dwCodingSettingPicturePropertyFlags = (pps->constrained_intra_pred_flag << 0) |
123  (pps->transform_skip_enabled_flag << 1) |
124  (pps->cu_qp_delta_enabled_flag << 2) |
126  (pps->weighted_pred_flag << 4) |
127  (pps->weighted_bipred_flag << 5) |
128  (pps->transquant_bypass_enable_flag << 6) |
129  (pps->tiles_enabled_flag << 7) |
131  (pps->uniform_spacing_flag << 9) |
135  (pps->disable_dbf << 13) |
136  (pps->lists_modification_present_flag << 14) |
138  (IS_IRAP(h) << 16) |
139  (IS_IDR(h) << 17) |
140  /* IntraPicFlag */
141  (IS_IRAP(h) << 18) |
142  (0 << 19);
143  pp->pps_cb_qp_offset = pps->cb_qp_offset;
144  pp->pps_cr_qp_offset = pps->cr_qp_offset;
145  if (pps->tiles_enabled_flag) {
146  pp->num_tile_columns_minus1 = pps->num_tile_columns - 1;
147  pp->num_tile_rows_minus1 = pps->num_tile_rows - 1;
148 
149  if (!pps->uniform_spacing_flag) {
150  for (i = 0; i < pps->num_tile_columns; i++)
151  pp->column_width_minus1[i] = pps->column_width[i] - 1;
152 
153  for (i = 0; i < pps->num_tile_rows; i++)
154  pp->row_height_minus1[i] = pps->row_height[i] - 1;
155  }
156  }
157 
158  pp->diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth;
159  pp->pps_beta_offset_div2 = pps->beta_offset / 2;
160  pp->pps_tc_offset_div2 = pps->tc_offset / 2;
161  pp->log2_parallel_merge_level_minus2 = pps->log2_parallel_merge_level - 2;
162  pp->CurrPicOrderCntVal = h->poc;
163 
164  // fill RefPicList from the DPB
165  for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefPicList); i++) {
166  const HEVCFrame *frame = NULL;
167  while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) {
168  if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
169  frame = &h->DPB[j];
170  j++;
171  }
172 
173  if (frame) {
174  fill_picture_entry(&pp->RefPicList[i], ff_dxva2_get_surface_index(avctx, ctx, frame->frame), !!(frame->flags & HEVC_FRAME_FLAG_LONG_REF));
175  pp->PicOrderCntValList[i] = frame->poc;
176  } else {
177  pp->RefPicList[i].bPicEntry = 0xff;
178  pp->PicOrderCntValList[i] = 0;
179  }
180  }
181 
182  #define DO_REF_LIST(ref_idx, ref_list) { \
183  const RefPicList *rpl = &h->rps[ref_idx]; \
184  for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ref_list); i++) { \
185  const HEVCFrame *frame = NULL; \
186  while (!frame && j < rpl->nb_refs) \
187  frame = rpl->ref[j++]; \
188  if (frame) \
189  pp->ref_list[i] = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, frame->frame)); \
190  else \
191  pp->ref_list[i] = 0xff; \
192  } \
193  }
194 
195  // Fill short term and long term lists
196  DO_REF_LIST(ST_CURR_BEF, RefPicSetStCurrBefore);
197  DO_REF_LIST(ST_CURR_AFT, RefPicSetStCurrAfter);
198  DO_REF_LIST(LT_CURR, RefPicSetLtCurr);
199 
200  pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
201 }
202 
203 static void fill_scaling_lists(AVDXVAContext *ctx, const HEVCContext *h, DXVA_Qmatrix_HEVC *qm)
204 {
205  unsigned i, j, pos;
207  &h->ps.pps->scaling_list : &h->ps.sps->scaling_list;
208 
209  memset(qm, 0, sizeof(*qm));
210  for (i = 0; i < 6; i++) {
211  for (j = 0; j < 16; j++) {
213  qm->ucScalingLists0[i][j] = sl->sl[0][i][pos];
214  }
215 
216  for (j = 0; j < 64; j++) {
218  qm->ucScalingLists1[i][j] = sl->sl[1][i][pos];
219  qm->ucScalingLists2[i][j] = sl->sl[2][i][pos];
220 
221  if (i < 2)
222  qm->ucScalingLists3[i][j] = sl->sl[3][i * 3][pos];
223  }
224 
225  qm->ucScalingListDCCoefSizeID2[i] = sl->sl_dc[0][i];
226  if (i < 2)
227  qm->ucScalingListDCCoefSizeID3[i] = sl->sl_dc[1][i * 3];
228  }
229 }
230 
231 static void fill_slice_short(DXVA_Slice_HEVC_Short *slice,
232  unsigned position, unsigned size)
233 {
234  memset(slice, 0, sizeof(*slice));
235  slice->BSNALunitDataLocation = position;
236  slice->SliceBytesInBuffer = size;
237  slice->wBadSliceChopping = 0;
238 }
239 
243 {
244  const HEVCContext *h = avctx->priv_data;
246  const HEVCFrame *current_picture = h->ref;
247  struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
248  DXVA_Slice_HEVC_Short *slice = NULL;
249  void *dxva_data_ptr;
250  uint8_t *dxva_data, *current, *end;
251  unsigned dxva_size;
252  void *slice_data;
253  unsigned slice_size;
254  unsigned padding;
255  unsigned i;
256  unsigned type;
257 
258  /* Create an annex B bitstream buffer with only slice NAL and finalize slice */
259 #if CONFIG_D3D11VA
260  if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
261  type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
262  if (FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
263  D3D11VA_CONTEXT(ctx)->decoder,
264  type,
265  &dxva_size, &dxva_data_ptr)))
266  return -1;
267  }
268 #endif
269 #if CONFIG_DXVA2
270  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
271  type = DXVA2_BitStreamDateBufferType;
272  if (FAILED(IDirectXVideoDecoder_GetBuffer(DXVA2_CONTEXT(ctx)->decoder,
273  type,
274  &dxva_data_ptr, &dxva_size)))
275  return -1;
276  }
277 #endif
278 
279  dxva_data = dxva_data_ptr;
280  current = dxva_data;
281  end = dxva_data + dxva_size;
282 
283  for (i = 0; i < ctx_pic->slice_count; i++) {
284  static const uint8_t start_code[] = { 0, 0, 1 };
285  static const unsigned start_code_size = sizeof(start_code);
286  unsigned position, size;
287 
288  slice = &ctx_pic->slice_short[i];
289 
290  position = slice->BSNALunitDataLocation;
291  size = slice->SliceBytesInBuffer;
292  if (start_code_size + size > end - current) {
293  av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
294  break;
295  }
296 
297  slice->BSNALunitDataLocation = current - dxva_data;
298  slice->SliceBytesInBuffer = start_code_size + size;
299 
300  memcpy(current, start_code, start_code_size);
301  current += start_code_size;
302 
303  memcpy(current, &ctx_pic->bitstream[position], size);
304  current += size;
305  }
306  padding = FFMIN(128 - ((current - dxva_data) & 127), end - current);
307  if (slice && padding > 0) {
308  memset(current, 0, padding);
309  current += padding;
310 
311  slice->SliceBytesInBuffer += padding;
312  }
313 #if CONFIG_D3D11VA
314  if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
315  if (FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, type)))
316  return -1;
317 #endif
318 #if CONFIG_DXVA2
319  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
320  if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(DXVA2_CONTEXT(ctx)->decoder, type)))
321  return -1;
322 #endif
323  if (i < ctx_pic->slice_count)
324  return -1;
325 
326 #if CONFIG_D3D11VA
327  if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
328  D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
329  memset(dsc11, 0, sizeof(*dsc11));
330  dsc11->BufferType = type;
331  dsc11->DataSize = current - dxva_data;
332  dsc11->NumMBsInBuffer = 0;
333 
334  type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
335  }
336 #endif
337 #if CONFIG_DXVA2
338  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
339  DXVA2_DecodeBufferDesc *dsc2 = bs;
340  memset(dsc2, 0, sizeof(*dsc2));
341  dsc2->CompressedBufferType = type;
342  dsc2->DataSize = current - dxva_data;
343  dsc2->NumMBsInBuffer = 0;
344 
345  type = DXVA2_SliceControlBufferType;
346  }
347 #endif
348 
349  slice_data = ctx_pic->slice_short;
350  slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_short);
351 
352  av_assert0(((current - dxva_data) & 127) == 0);
353  return ff_dxva2_commit_buffer(avctx, ctx, sc,
354  type,
355  slice_data, slice_size, 0);
356 }
357 
358 
360  av_unused const uint8_t *buffer,
361  av_unused uint32_t size)
362 {
363  const HEVCContext *h = avctx->priv_data;
366 
367  if (DXVA_CONTEXT_DECODER(avctx, ctx) == NULL ||
368  DXVA_CONTEXT_CFG(avctx, ctx) == NULL ||
369  DXVA_CONTEXT_COUNT(avctx, ctx) <= 0)
370  return -1;
371  av_assert0(ctx_pic);
372 
373  /* Fill up DXVA_PicParams_HEVC */
374  fill_picture_parameters(avctx, ctx, h, &ctx_pic->pp);
375 
376  /* Fill up DXVA_Qmatrix_HEVC */
377  fill_scaling_lists(ctx, h, &ctx_pic->qm);
378 
379  ctx_pic->slice_count = 0;
380  ctx_pic->bitstream_size = 0;
381  ctx_pic->bitstream = NULL;
382  return 0;
383 }
384 
386  const uint8_t *buffer,
387  uint32_t size)
388 {
389  const HEVCContext *h = avctx->priv_data;
390  const HEVCFrame *current_picture = h->ref;
391  struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
392  unsigned position;
393 
394  if (ctx_pic->slice_count >= MAX_SLICES)
395  return -1;
396 
397  if (!ctx_pic->bitstream)
398  ctx_pic->bitstream = buffer;
399  ctx_pic->bitstream_size += size;
400 
401  position = buffer - ctx_pic->bitstream;
402  fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count], position, size);
403  ctx_pic->slice_count++;
404 
405  return 0;
406 }
407 
409 {
410  HEVCContext *h = avctx->priv_data;
412  int scale = ctx_pic->pp.dwCodingParamToolFlags & 1;
413  int ret;
414 
415  if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
416  return -1;
417 
418  ret = ff_dxva2_common_end_frame(avctx, h->ref->frame,
419  &ctx_pic->pp, sizeof(ctx_pic->pp),
420  scale ? &ctx_pic->qm : NULL, scale ? sizeof(ctx_pic->qm) : 0,
422  return ret;
423 }
424 
425 #if CONFIG_HEVC_DXVA2_HWACCEL
426 AVHWAccel ff_hevc_dxva2_hwaccel = {
427  .name = "hevc_dxva2",
428  .type = AVMEDIA_TYPE_VIDEO,
429  .id = AV_CODEC_ID_HEVC,
430  .pix_fmt = AV_PIX_FMT_DXVA2_VLD,
431  .start_frame = dxva2_hevc_start_frame,
432  .decode_slice = dxva2_hevc_decode_slice,
433  .end_frame = dxva2_hevc_end_frame,
434  .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
435 };
436 #endif
437 
438 #if CONFIG_HEVC_D3D11VA_HWACCEL
439 AVHWAccel ff_hevc_d3d11va_hwaccel = {
440  .name = "hevc_d3d11va",
441  .type = AVMEDIA_TYPE_VIDEO,
442  .id = AV_CODEC_ID_HEVC,
443  .pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
444  .start_frame = dxva2_hevc_start_frame,
445  .decode_slice = dxva2_hevc_decode_slice,
446  .end_frame = dxva2_hevc_end_frame,
447  .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
448 };
449 #endif
const HEVCPPS * pps
Definition: hevc.h:570
AVFrame * frame
Definition: hevc.h:720
#define NULL
Definition: coverity.c:32
unsigned int log2_min_cb_size
Definition: hevc.h:451
int short_term_ref_pic_set_sps_flag
Definition: hevc.h:591
HEVCFrame * ref
Definition: hevc.h:831
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
Definition: dxva2_hevc.c:240
int max_dec_pic_buffering
Definition: hevc.h:419
const uint8_t * bitstream
Definition: dxva2_hevc.c:39
unsigned int * row_height
RowHeight.
Definition: hevc.h:549
void * hwaccel_picture_private
Definition: hevc.h:736
int pic_init_qp_minus26
Definition: hevc.h:497
const uint8_t ff_hevc_diag_scan4x4_x[16]
Definition: hevc_data.c:25
int flag
Definition: cpu.c:34
uint8_t weighted_bipred_flag
Definition: hevc.h:509
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1877
uint8_t seq_loop_filter_across_slices_enabled_flag
Definition: hevc.h:522
uint8_t cabac_init_present_flag
Definition: hevc.h:493
static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, unsigned size)
Definition: dxva2_hevc.c:231
HEVCParamSets ps
Definition: hevc.h:818
int min_cb_height
Definition: hevc.h:475
int num_ref_idx_l0_default_active
num_ref_idx_l0_default_active_minus1 + 1
Definition: hevc.h:495
uint8_t entropy_coding_sync_enabled_flag
Definition: hevc.h:515
int log2_parallel_merge_level
log2_parallel_merge_level_minus2 + 2
Definition: hevc.h:534
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
static int get_refpic_index(const DXVA_PicParams_HEVC *pp, int surface_index)
Definition: dxva2_hevc.c:50
int chroma_format_idc
Definition: hevc.h:401
uint8_t disable_dbf
Definition: hevc.h:526
unsigned int log2_max_trafo_size
Definition: hevc.h:454
DXVA_Qmatrix_HEVC qm
Definition: dxva2_hevc.c:36
uint8_t
void * hwaccel_context
Hardware accelerator context.
Definition: avcodec.h:2980
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice))
Definition: dxva2.c:125
int num_ref_idx_l1_default_active
num_ref_idx_l1_default_active_minus1 + 1
Definition: hevc.h:496
unsigned int log2_min_pcm_cb_size
Definition: hevc.h:444
int min_cb_width
Definition: hevc.h:474
static AVFrame * frame
DXVA_Slice_HEVC_Short slice_short[MAX_SLICES]
Definition: dxva2_hevc.c:38
uint8_t scaling_list_data_present_flag
Definition: hevc.h:530
uint8_t bit_depth_chroma
Definition: hevc.h:443
uint8_t loop_filter_disable_flag
Definition: hevc.h:446
ptrdiff_t size
Definition: opengl_enc.c:101
uint8_t transquant_bypass_enable_flag
Definition: hevc.h:511
#define av_log(a,...)
#define HEVC_FRAME_FLAG_LONG_REF
Definition: hevc.h:716
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
Definition: hevc.h:126
unsigned int log2_max_poc_lsb
Definition: hevc.h:414
uint8_t amp_enabled_flag
Definition: hevc.h:433
simple assert() macros that are a bit more flexible than ISO C assert().
const ShortTermRPS * short_term_rps
Definition: hevc.h:594
#define MAX_SLICES
Definition: dxva2_hevc.c:32
static void fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, const HEVCContext *h, DXVA_PicParams_HEVC *pp)
Definition: dxva2_hevc.c:60
uint8_t tiles_enabled_flag
Definition: hevc.h:514
const HEVCSPS * sps
Definition: hevc.h:569
uint8_t lists_modification_present_flag
Definition: hevc.h:533
#define HEVC_FRAME_FLAG_SHORT_REF
Definition: hevc.h:715
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:3668
int max_transform_hierarchy_depth_inter
Definition: hevc.h:458
#define IS_IDR(s)
Definition: hevc.h:86
#define FFMIN(a, b)
Definition: common.h:96
int num_tile_columns
num_tile_columns_minus1 + 1
Definition: hevc.h:517
static const chunk_decoder decoder[8]
Definition: dfa.c:327
AVFormatContext * ctx
Definition: movenc.c:48
uint8_t cu_qp_delta_enabled_flag
Definition: hevc.h:502
static void fill_scaling_lists(AVDXVAContext *ctx, const HEVCContext *h, DXVA_Qmatrix_HEVC *qm)
Definition: dxva2_hevc.c:203
uint8_t sl_dc[2][6]
Definition: hevc.h:396
uint8_t sign_data_hiding_flag
Definition: hevc.h:491
uint8_t output_flag_present_flag
Definition: hevc.h:510
#define FF_ARRAY_ELEMS(a)
uint8_t constrained_intra_pred_flag
Definition: hevc.h:499
uint8_t sl[4][6][64]
Definition: hevc.h:395
uint8_t pic_slice_level_chroma_qp_offsets_present_flag
Definition: hevc.h:507
HEVCFrame DPB[32]
Definition: hevc.h:832
Definition: hevc.h:399
Definition: hevc.h:488
uint8_t transform_skip_enabled_flag
Definition: hevc.h:500
int short_term_ref_pic_set_size
Definition: hevc.h:592
#define IS_IRAP(s)
Definition: hevc.h:89
uint8_t uniform_spacing_flag
Definition: hevc.h:519
int max_sub_layers
Definition: hevc.h:417
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame)
Definition: dxva2.c:37
ScalingList scaling_list
Definition: hevc.h:531
main external API structure.
Definition: avcodec.h:1649
uint8_t sao_enabled
Definition: hevc.h:434
int num_extra_slice_header_bits
Definition: hevc.h:535
static void fill_picture_entry(DXVA_PicEntry_HEVC *pic, unsigned index, unsigned flag)
Definition: dxva2_hevc.c:43
uint8_t loop_filter_across_tiles_enabled_flag
Definition: hevc.h:520
uint8_t num_long_term_ref_pics_sps
Definition: hevc.h:439
int ff_dxva2_commit_buffer(AVCodecContext *avctx, AVDXVAContext *ctx, DECODER_BUFFER_DESC *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
Definition: dxva2.c:52
GLint GLenum type
Definition: opengl_enc.c:105
uint8_t sps_temporal_mvp_enabled_flag
Definition: hevc.h:448
unsigned int nb_st_rps
Definition: hevc.h:430
int num_tile_rows
num_tile_rows_minus1 + 1
Definition: hevc.h:518
int index
Definition: gxfenc.c:89
const uint8_t ff_hevc_diag_scan8x8_y[64]
Definition: hevc_data.c:58
int poc
Definition: hevc.h:726
unsigned int log2_min_tb_size
Definition: hevc.h:453
int poc
Definition: hevc.h:833
void DECODER_BUFFER_DESC
uint8_t scaling_list_enable_flag
Definition: hevc.h:427
struct HEVCSPS::@52 temporal_layer[MAX_SUB_LAYERS]
int tc_offset
tc_offset_div2 * 2
Definition: hevc.h:528
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
Definition: pixfmt.h:148
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
Definition: hevc.h:747
static const uint8_t start_code[]
Definition: h264.c:806
int cr_qp_offset
Definition: hevc.h:506
ScalingList scaling_list
Definition: hevc.h:428
unsigned int log2_diff_max_min_coding_block_size
Definition: hevc.h:452
#define FAILED(hr)
Definition: windows2linux.h:48
unsigned int log2_max_pcm_cb_size
Definition: hevc.h:445
int max_transform_hierarchy_depth_intra
Definition: hevc.h:459
#define DO_REF_LIST(ref_idx, ref_list)
uint8_t weighted_pred_flag
Definition: hevc.h:508
unsigned int * column_width
ColumnWidth.
Definition: hevc.h:548
static int dxva2_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: dxva2_hevc.c:385
uint8_t slice_header_extension_present_flag
Definition: hevc.h:536
void * priv_data
Definition: avcodec.h:1691
uint8_t sps_strong_intra_smoothing_enable_flag
Definition: hevc.h:449
int rps_idx_num_delta_pocs
Definition: hevc.h:280
uint8_t long_term_ref_pics_present_flag
Definition: hevc.h:436
int diff_cu_qp_delta_depth
Definition: hevc.h:503
const uint8_t ff_hevc_diag_scan8x8_x[64]
Definition: hevc_data.c:39
HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer...
Definition: pixfmt.h:242
static int dxva2_hevc_end_frame(AVCodecContext *avctx)
Definition: dxva2_hevc.c:408
int cb_qp_offset
Definition: hevc.h:505
struct HEVCSPS::@53 pcm
uint8_t deblocking_filter_override_enabled_flag
Definition: hevc.h:525
int bit_depth
Definition: hevc.h:410
int beta_offset
beta_offset_div2 * 2
Definition: hevc.h:527
DXVA_PicParams_HEVC pp
Definition: dxva2_hevc.c:35
SliceHeader sh
Definition: hevc.h:826
int pcm_enabled_flag
Definition: hevc.h:415
static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: dxva2_hevc.c:359
for(j=16;j >0;--j)
uint8_t separate_colour_plane_flag
output (i.e. cropped) values
Definition: hevc.h:402
const uint8_t ff_hevc_diag_scan4x4_y[16]
Definition: hevc_data.c:32
GLuint buffer
Definition: opengl_enc.c:102
#define av_unused
Definition: attributes.h:126
uint8_t dependent_slice_segments_enabled_flag
Definition: hevc.h:513