FFmpeg
Loading...
Searching...
No Matches
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 "config_components.h"
24
25#include "libavutil/avassert.h"
26
27#include "dxva2_internal.h"
28#include "hevc/data.h"
29#include "hevc/hevcdec.h"
30#include "hwaccel_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];
39 const uint8_t *bitstream;
41};
42
43static 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
50static 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 HEVCContext *h = avctx->priv_data;
64 const HEVCLayerContext *l = &h->layers[h->cur_layer];
65 const HEVCFrame *current_picture = h->cur_frame;
66 const HEVCPPS *pps = h->pps;
67 const HEVCSPS *sps = pps->sps;
68 int i, j;
69
70 memset(pp, 0, sizeof(*pp));
71
72 pp->PicWidthInMinCbsY = sps->min_cb_width;
73 pp->PicHeightInMinCbsY = sps->min_cb_height;
74
75 pp->wFormatAndSequenceInfoFlags = (sps->chroma_format_idc << 0) |
76 (sps->separate_colour_plane << 2) |
77 ((sps->bit_depth - 8) << 3) |
78 ((sps->bit_depth - 8) << 6) |
79 ((sps->log2_max_poc_lsb - 4) << 9) |
80 (0 << 13) |
81 (0 << 14) |
82 (0 << 15);
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
98 if (h->sh.short_term_ref_pic_set_sps_flag == 0 && h->sh.short_term_rps) {
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_enabled << 0) |
104 (sps->amp_enabled << 1) |
105 (sps->sao_enabled << 2) |
106 (sps->pcm_enabled << 3) |
107 ((sps->pcm_enabled ? (sps->pcm.bit_depth - 1) : 0) << 4) |
108 ((sps->pcm_enabled ? (sps->pcm.bit_depth_chroma - 1) : 0) << 8) |
109 ((sps->pcm_enabled ? (sps->pcm.log2_min_pcm_cb_size - 3) : 0) << 12) |
110 ((sps->pcm_enabled ? (sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size) : 0) << 14) |
111 (sps->pcm_loop_filter_disabled << 16) |
112 (sps->long_term_ref_pics_present << 17) |
113 (sps->temporal_mvp_enabled << 18) |
114 (sps->strong_intra_smoothing_enabled << 19) |
115 (pps->dependent_slice_segments_enabled_flag << 20) |
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) |
125 (pps->pic_slice_level_chroma_qp_offsets_present_flag << 3) |
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) |
130 (pps->entropy_coding_sync_enabled_flag << 8) |
131 (pps->uniform_spacing_flag << 9) |
132 ((pps->tiles_enabled_flag ? pps->loop_filter_across_tiles_enabled_flag : 0) << 10) |
133 (pps->seq_loop_filter_across_slices_enabled_flag << 11) |
134 (pps->deblocking_filter_override_enabled_flag << 12) |
135 (pps->disable_dbf << 13) |
136 (pps->lists_modification_present_flag << 14) |
137 (pps->slice_header_extension_present_flag << 15) |
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(l->DPB)) {
168 if (&l->DPB[j] != current_picture && (l->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
169 frame = &l->DPB[j];
170 j++;
171 }
172
173 if (frame) {
174 fill_picture_entry(&pp->RefPicList[i], ff_dxva2_get_surface_index(avctx, ctx, frame->f, 0), !!(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 fill_picture_entry(&pp->CurrPic, ff_dxva2_get_surface_index(avctx, ctx, current_picture->f, 1), 0);
183
184 #define DO_REF_LIST(ref_idx, ref_list) { \
185 const RefPicList *rpl = &h->rps[ref_idx]; \
186 for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ref_list); i++) { \
187 const HEVCFrame *frame = NULL; \
188 while (!frame && j < rpl->nb_refs) \
189 frame = rpl->ref[j++]; \
190 if (frame && frame->flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)) \
191 pp->ref_list[i] = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, frame->f, 0)); \
192 else \
193 pp->ref_list[i] = 0xff; \
194 } \
195 }
196
197 // Fill short term and long term lists
198 DO_REF_LIST(ST_CURR_BEF, RefPicSetStCurrBefore);
199 DO_REF_LIST(ST_CURR_AFT, RefPicSetStCurrAfter);
200 DO_REF_LIST(LT_CURR, RefPicSetLtCurr);
201
202 pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
203}
204
205void ff_dxva2_hevc_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_HEVC *qm)
206{
207 const HEVCContext *h = avctx->priv_data;
208 unsigned i, j, pos;
209 const ScalingList *sl = h->pps->scaling_list_data_present_flag ?
210 &h->pps->scaling_list : &h->pps->sps->scaling_list;
211
212 memset(qm, 0, sizeof(*qm));
213 for (i = 0; i < 6; i++) {
214 for (j = 0; j < 16; j++) {
216 qm->ucScalingLists0[i][j] = sl->sl[0][i][pos];
217 }
218
219 for (j = 0; j < 64; j++) {
221 qm->ucScalingLists1[i][j] = sl->sl[1][i][pos];
222 qm->ucScalingLists2[i][j] = sl->sl[2][i][pos];
223
224 if (i < 2)
225 qm->ucScalingLists3[i][j] = sl->sl[3][i * 3][pos];
226 }
227
228 qm->ucScalingListDCCoefSizeID2[i] = sl->sl_dc[0][i];
229 if (i < 2)
230 qm->ucScalingListDCCoefSizeID3[i] = sl->sl_dc[1][i * 3];
231 }
232}
233
234static void fill_slice_short(DXVA_Slice_HEVC_Short *slice,
235 unsigned position, unsigned size)
236{
237 memset(slice, 0, sizeof(*slice));
238 slice->BSNALunitDataLocation = position;
239 slice->SliceBytesInBuffer = size;
240 slice->wBadSliceChopping = 0;
241}
242
246{
247 const HEVCContext *h = avctx->priv_data;
249 const HEVCFrame *current_picture = h->cur_frame;
250 struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
251 DXVA_Slice_HEVC_Short *slice = NULL;
252 void *dxva_data_ptr = NULL;
253 uint8_t *dxva_data, *current, *end;
254 unsigned dxva_size;
255 void *slice_data;
256 unsigned slice_size;
257 unsigned padding;
258 unsigned i;
259 unsigned type;
260
261 /* Create an annex B bitstream buffer with only slice NAL and finalize slice */
262#if CONFIG_D3D11VA
263 if (ff_dxva2_is_d3d11(avctx)) {
264 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
265 if (FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
267 type,
268 &dxva_size, &dxva_data_ptr)))
269 return -1;
270 }
271#endif
272#if CONFIG_DXVA2
273 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
274 type = DXVA2_BitStreamDateBufferType;
275 if (FAILED(IDirectXVideoDecoder_GetBuffer(DXVA2_CONTEXT(ctx)->decoder,
276 type,
277 &dxva_data_ptr, &dxva_size)))
278 return -1;
279 }
280#endif
281
282 if (!dxva_data_ptr)
283 return -1;
284
285 dxva_data = dxva_data_ptr;
286 current = dxva_data;
287 end = dxva_data + dxva_size;
288
289 for (i = 0; i < ctx_pic->slice_count; i++) {
290 static const uint8_t start_code[] = { 0, 0, 1 };
291 static const unsigned start_code_size = sizeof(start_code);
292 unsigned position, size;
293
294 slice = &ctx_pic->slice_short[i];
295
296 position = slice->BSNALunitDataLocation;
297 size = slice->SliceBytesInBuffer;
298 if (start_code_size + size > end - current) {
299 av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
300 break;
301 }
302
303 slice->BSNALunitDataLocation = current - dxva_data;
304 slice->SliceBytesInBuffer = start_code_size + size;
305
306 memcpy(current, start_code, start_code_size);
307 current += start_code_size;
308
309 memcpy(current, &ctx_pic->bitstream[position], size);
310 current += size;
311 }
312 padding = FFMIN(128 - ((current - dxva_data) & 127), end - current);
313 if (slice && padding > 0) {
314 memset(current, 0, padding);
315 current += padding;
316
317 slice->SliceBytesInBuffer += padding;
318 }
319#if CONFIG_D3D11VA
320 if (ff_dxva2_is_d3d11(avctx))
321 if (FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, type)))
322 return -1;
323#endif
324#if CONFIG_DXVA2
325 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
326 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(DXVA2_CONTEXT(ctx)->decoder, type)))
327 return -1;
328#endif
330 return -1;
331
332#if CONFIG_D3D11VA
333 if (ff_dxva2_is_d3d11(avctx)) {
334 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
335 memset(dsc11, 0, sizeof(*dsc11));
336 dsc11->BufferType = type;
337 dsc11->DataSize = current - dxva_data;
338 dsc11->NumMBsInBuffer = 0;
339
340 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
341 }
342#endif
343#if CONFIG_DXVA2
344 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
345 DXVA2_DecodeBufferDesc *dsc2 = bs;
346 memset(dsc2, 0, sizeof(*dsc2));
347 dsc2->CompressedBufferType = type;
348 dsc2->DataSize = current - dxva_data;
349 dsc2->NumMBsInBuffer = 0;
350
351 type = DXVA2_SliceControlBufferType;
352 }
353#endif
354
355 slice_data = ctx_pic->slice_short;
356 slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_short);
357
358 av_assert0(((current - dxva_data) & 127) == 0);
359 return ff_dxva2_commit_buffer(avctx, ctx, sc,
360 type,
361 slice_data, slice_size, 0);
362}
363
364
366 av_unused const AVBufferRef *buffer_ref,
367 av_unused const uint8_t *buffer,
368 av_unused uint32_t size)
369{
370 const HEVCContext *h = avctx->priv_data;
372 struct hevc_dxva2_picture_context *ctx_pic = h->cur_frame->hwaccel_picture_private;
373
374 if (!DXVA_CONTEXT_VALID(avctx, ctx))
375 return -1;
376 av_assert0(ctx_pic);
377
378 /* Fill up DXVA_PicParams_HEVC */
380
381 /* Fill up DXVA_Qmatrix_HEVC */
382 ff_dxva2_hevc_fill_scaling_lists(avctx, ctx, &ctx_pic->qm);
383
384 ctx_pic->slice_count = 0;
385 ctx_pic->bitstream_size = 0;
386 ctx_pic->bitstream = NULL;
387 return 0;
388}
389
391 const uint8_t *buffer,
392 uint32_t size)
393{
394 const HEVCContext *h = avctx->priv_data;
395 const HEVCFrame *current_picture = h->cur_frame;
396 struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
397 unsigned position;
398
399 if (ctx_pic->slice_count >= MAX_SLICES)
400 return -1;
401
402 if (!ctx_pic->bitstream)
403 ctx_pic->bitstream = buffer;
404 ctx_pic->bitstream_size += size;
405
406 position = buffer - ctx_pic->bitstream;
407 fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count], position, size);
408 ctx_pic->slice_count++;
409
410 return 0;
411}
412
414{
415 HEVCContext *h = avctx->priv_data;
416 struct hevc_dxva2_picture_context *ctx_pic = h->cur_frame->hwaccel_picture_private;
417 int scale = ctx_pic->pp.dwCodingParamToolFlags & 1;
418 int ret;
419
420 if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
421 return -1;
422
423 ret = ff_dxva2_common_end_frame(avctx, h->cur_frame->f,
424 &ctx_pic->pp, sizeof(ctx_pic->pp),
425 scale ? &ctx_pic->qm : NULL, scale ? sizeof(ctx_pic->qm) : 0,
427 return ret;
428}
429
430#if CONFIG_HEVC_DXVA2_HWACCEL
432 .p.name = "hevc_dxva2",
433 .p.type = AVMEDIA_TYPE_VIDEO,
434 .p.id = AV_CODEC_ID_HEVC,
435 .p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
436 .init = ff_dxva2_decode_init,
437 .uninit = ff_dxva2_decode_uninit,
438 .start_frame = dxva2_hevc_start_frame,
439 .decode_slice = dxva2_hevc_decode_slice,
440 .end_frame = dxva2_hevc_end_frame,
441 .frame_params = ff_dxva2_common_frame_params,
442 .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
443 .priv_data_size = sizeof(FFDXVASharedContext),
444};
445#endif
446
447#if CONFIG_HEVC_D3D11VA_HWACCEL
449 .p.name = "hevc_d3d11va",
450 .p.type = AVMEDIA_TYPE_VIDEO,
451 .p.id = AV_CODEC_ID_HEVC,
452 .p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
453 .init = ff_dxva2_decode_init,
454 .uninit = ff_dxva2_decode_uninit,
455 .start_frame = dxva2_hevc_start_frame,
456 .decode_slice = dxva2_hevc_decode_slice,
457 .end_frame = dxva2_hevc_end_frame,
458 .frame_params = ff_dxva2_common_frame_params,
459 .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
460 .priv_data_size = sizeof(FFDXVASharedContext),
461};
462#endif
463
464#if CONFIG_HEVC_D3D11VA2_HWACCEL
466 .p.name = "hevc_d3d11va2",
467 .p.type = AVMEDIA_TYPE_VIDEO,
468 .p.id = AV_CODEC_ID_HEVC,
469 .p.pix_fmt = AV_PIX_FMT_D3D11,
470 .init = ff_dxva2_decode_init,
471 .uninit = ff_dxva2_decode_uninit,
472 .start_frame = dxva2_hevc_start_frame,
473 .decode_slice = dxva2_hevc_decode_slice,
474 .end_frame = dxva2_hevc_end_frame,
475 .frame_params = ff_dxva2_common_frame_params,
476 .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
477 .priv_data_size = sizeof(FFDXVASharedContext),
478};
479#endif
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define flag(name)
Definition cbs_h264.c:60
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#define NULL
Definition coverity.c:32
#define MAX_SLICES
static AVFrame * frame
uint64_t pps
Definition dovi_rpuenc.c:36
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
Definition dxva2.c:1068
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, AVDXVAContext *ctx, const AVFrame *frame, int curr)
Definition dxva2.c:783
int ff_dxva2_decode_init(AVCodecContext *avctx)
Definition dxva2.c:668
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:814
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
Definition dxva2.c:743
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:903
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition dxva2.c:602
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
Definition dxva2_av1.c:351
static int dxva2_hevc_end_frame(AVCodecContext *avctx)
Definition dxva2_hevc.c:413
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
Definition dxva2_hevc.c:243
static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition dxva2_hevc.c:365
static int get_refpic_index(const DXVA_PicParams_HEVC *pp, int surface_index)
Definition dxva2_hevc.c:50
static void fill_picture_entry(DXVA_PicEntry_HEVC *pic, unsigned index, unsigned flag)
Definition dxva2_hevc.c:43
#define DO_REF_LIST(ref_idx, ref_list)
static int dxva2_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition dxva2_hevc.c:390
static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, unsigned size)
Definition dxva2_hevc.c:234
void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_HEVC *pp)
Definition dxva2_hevc.c:60
#define MAX_SLICES
Definition dxva2_hevc.c:32
void ff_dxva2_hevc_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_HEVC *qm)
Definition dxva2_hevc.c:205
#define DXVA_CONTEXT(avctx)
#define DXVA2_CONTEXT(ctx)
#define D3D11VA_CONTEXT(ctx)
#define DXVA_CONTEXT_REPORT_ID(avctx, ctx)
#define DXVA_CONTEXT_VALID(avctx, ctx)
void DECODER_BUFFER_DESC
static struct @111144215057303131116103221376075045141373005341 current
@ AV_CODEC_ID_HEVC
Definition codec_id.h:223
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
int index
Definition gxfenc.c:90
const uint8_t ff_hevc_diag_scan8x8_x[64]
Definition data.c:39
const uint8_t ff_hevc_diag_scan4x4_x[16]
Definition data.c:25
const uint8_t ff_hevc_diag_scan8x8_y[64]
Definition data.c:58
const uint8_t ff_hevc_diag_scan4x4_y[16]
Definition data.c:32
#define HEVC_FRAME_FLAG_SHORT_REF
Definition hevcdec.h:355
#define IS_IDR(s)
Definition hevcdec.h:74
#define HEVC_FRAME_FLAG_LONG_REF
Definition hevcdec.h:356
#define IS_IRAP(s)
Definition hevcdec.h:77
@ ST_CURR_AFT
Definition hevcdec.h:85
@ ST_CURR_BEF
Definition hevcdec.h:84
@ LT_CURR
Definition hevcdec.h:87
const struct FFHWAccel ff_hevc_dxva2_hwaccel
const struct FFHWAccel ff_hevc_d3d11va2_hwaccel
const struct FFHWAccel ff_hevc_d3d11va_hwaccel
cl_device_type type
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition intra.c:278
static const chunk_decoder decoder[8]
Definition dfa.c:331
#define av_unused
Definition attributes.h:164
#define FFMIN(a, b)
Definition macros.h:49
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
Definition pixfmt.h:134
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
Definition pixfmt.h:336
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
Definition pixfmt.h:254
#define FF_ARRAY_ELEMS(a)
unsigned int pos
Definition spdifenc.c:431
A reference to a data buffer.
Definition buffer.h:82
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:643
void * priv_data
Definition avcodec.h:470
void * hwaccel_picture_private
RefStruct reference.
Definition hevcdec.h:379
AVFrame * f
Definition hevcdec.h:363
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
Definition hevcdec.h:388
HEVCFrame DPB[32]
Definition hevcdec.h:453
Definition ps.h:371
Definition ps.h:252
uint8_t sl_dc[2][6]
Definition ps.h:249
uint8_t sl[4][6][64]
Definition ps.h:248
DXVA_Qmatrix_HEVC qm
Definition dxva2_hevc.c:36
DXVA_PicParams_HEVC pp
Definition dxva2_hevc.c:35
const uint8_t * bitstream
Definition dxva2_hevc.c:39
DXVA_Slice_HEVC_Short slice_short[MAX_SLICES]
Definition dxva2_hevc.c:38
#define av_log(a,...)
static char buffer[20]
Definition seek.c:32
int size
static const uint8_t start_code[]