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