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