2 * HEVC HW decode acceleration through VA API
4 * Copyright (C) 2015 Timo Rothenpieler <timo@rothenpieler.org>
6 * This file is part of FFmpeg.
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.
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.
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
23 #include "vaapi_internal.h"
25 #include "mpegutils.h"
29 * This file implements the glue code between FFmpeg's and VA API's
30 * structures for HEVC decoding.
33 typedef struct vaapi_hevc_frame_data {
34 VAPictureParameterBufferHEVC *pic_param;
35 VASliceParameterBufferHEVC *last_slice_param;
36 } vaapi_hevc_frame_data;
39 * Initialize an empty VA API picture.
41 * VA API requires a fixed-size reference picture array.
43 static void init_vaapi_pic(VAPictureHEVC *va_pic)
45 va_pic->picture_id = VA_INVALID_ID;
46 va_pic->flags = VA_PICTURE_HEVC_INVALID;
47 va_pic->pic_order_cnt = 0;
50 static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_type)
52 va_pic->picture_id = ff_vaapi_get_surface_id(pic->frame);
53 va_pic->pic_order_cnt = pic->poc;
54 va_pic->flags = rps_type;
56 if (pic->flags & HEVC_FRAME_FLAG_LONG_REF)
57 va_pic->flags |= VA_PICTURE_HEVC_LONG_TERM_REFERENCE;
59 if (pic->frame->interlaced_frame) {
60 va_pic->flags |= VA_PICTURE_HEVC_FIELD_PIC;
62 if (!pic->frame->top_field_first) {
63 va_pic->flags |= VA_PICTURE_HEVC_BOTTOM_FIELD;
68 static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
70 VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame);
73 for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; ++i) {
74 if (pic_surf == ff_vaapi_get_surface_id(h->rps[ST_CURR_BEF].ref[i]->frame))
75 return VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE;
78 for (i = 0; i < h->rps[ST_CURR_AFT].nb_refs; ++i) {
79 if (pic_surf == ff_vaapi_get_surface_id(h->rps[ST_CURR_AFT].ref[i]->frame))
80 return VA_PICTURE_HEVC_RPS_ST_CURR_AFTER;
83 for (i = 0; i < h->rps[LT_CURR].nb_refs; ++i) {
84 if (pic_surf == ff_vaapi_get_surface_id(h->rps[LT_CURR].ref[i]->frame))
85 return VA_PICTURE_HEVC_RPS_LT_CURR;
91 static void fill_vaapi_ReferenceFrames(const HEVCContext *h, VAPictureParameterBufferHEVC *pp)
93 const HEVCFrame *current_picture = h->ref;
96 for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) {
97 const HEVCFrame *frame = NULL;
99 while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) {
100 if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
105 init_vaapi_pic(&pp->ReferenceFrames[i]);
108 rps_type = find_frame_rps_type(h, frame);
109 fill_vaapi_pic(&pp->ReferenceFrames[i], frame, rps_type);
114 static uint8_t get_ref_pic_index(const HEVCContext *h, const HEVCFrame *frame)
116 vaapi_hevc_frame_data *frame_data = h->ref->hwaccel_picture_private;
117 VAPictureParameterBufferHEVC *pp = frame_data->pic_param;
123 for (i = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); ++i) {
124 VASurfaceID pid = pp->ReferenceFrames[i].picture_id;
125 int poc = pp->ReferenceFrames[i].pic_order_cnt;
126 if (pid != VA_INVALID_ID && pid == ff_vaapi_get_surface_id(frame->frame) && poc == frame->poc)
133 static void fill_picture_parameters(const HEVCContext *h, VAPictureParameterBufferHEVC *pp)
137 pp->pic_fields.value = 0;
138 pp->slice_parsing_fields.value = 0;
140 fill_vaapi_pic(&pp->CurrPic, h->ref, 0);
141 fill_vaapi_ReferenceFrames(h, pp);
143 pp->pic_width_in_luma_samples = h->ps.sps->width;
144 pp->pic_height_in_luma_samples = h->ps.sps->height;
146 pp->log2_min_luma_coding_block_size_minus3 = h->ps.sps->log2_min_cb_size - 3;
148 pp->pic_fields.bits.chroma_format_idc = h->ps.sps->chroma_format_idc;
150 pp->sps_max_dec_pic_buffering_minus1 = h->ps.sps->temporal_layer[h->ps.sps->max_sub_layers - 1].max_dec_pic_buffering - 1;
151 pp->log2_diff_max_min_luma_coding_block_size = h->ps.sps->log2_diff_max_min_coding_block_size;
152 pp->log2_min_transform_block_size_minus2 = h->ps.sps->log2_min_tb_size - 2;
153 pp->log2_diff_max_min_transform_block_size = h->ps.sps->log2_max_trafo_size - h->ps.sps->log2_min_tb_size;
154 pp->max_transform_hierarchy_depth_inter = h->ps.sps->max_transform_hierarchy_depth_inter;
155 pp->max_transform_hierarchy_depth_intra = h->ps.sps->max_transform_hierarchy_depth_intra;
156 pp->num_short_term_ref_pic_sets = h->ps.sps->nb_st_rps;
157 pp->num_long_term_ref_pic_sps = h->ps.sps->num_long_term_ref_pics_sps;
159 pp->num_ref_idx_l0_default_active_minus1 = h->ps.pps->num_ref_idx_l0_default_active - 1;
160 pp->num_ref_idx_l1_default_active_minus1 = h->ps.pps->num_ref_idx_l1_default_active - 1;
161 pp->init_qp_minus26 = h->ps.pps->pic_init_qp_minus26;
163 pp->pps_cb_qp_offset = h->ps.pps->cb_qp_offset;
164 pp->pps_cr_qp_offset = h->ps.pps->cr_qp_offset;
166 pp->pic_fields.bits.tiles_enabled_flag = h->ps.pps->tiles_enabled_flag;
167 pp->pic_fields.bits.separate_colour_plane_flag = h->ps.sps->separate_colour_plane_flag;
168 pp->pic_fields.bits.pcm_enabled_flag = h->ps.sps->pcm_enabled_flag;
169 pp->pic_fields.bits.scaling_list_enabled_flag = h->ps.sps->scaling_list_enable_flag;
170 pp->pic_fields.bits.transform_skip_enabled_flag = h->ps.pps->transform_skip_enabled_flag;
171 pp->pic_fields.bits.amp_enabled_flag = h->ps.sps->amp_enabled_flag;
172 pp->pic_fields.bits.strong_intra_smoothing_enabled_flag = h->ps.sps->sps_strong_intra_smoothing_enable_flag;
173 pp->pic_fields.bits.sign_data_hiding_enabled_flag = h->ps.pps->sign_data_hiding_flag;
174 pp->pic_fields.bits.constrained_intra_pred_flag = h->ps.pps->constrained_intra_pred_flag;
175 pp->pic_fields.bits.cu_qp_delta_enabled_flag = h->ps.pps->cu_qp_delta_enabled_flag;
176 pp->pic_fields.bits.weighted_pred_flag = h->ps.pps->weighted_pred_flag;
177 pp->pic_fields.bits.weighted_bipred_flag = h->ps.pps->weighted_bipred_flag;
178 pp->pic_fields.bits.transquant_bypass_enabled_flag = h->ps.pps->transquant_bypass_enable_flag;
179 pp->pic_fields.bits.entropy_coding_sync_enabled_flag = h->ps.pps->entropy_coding_sync_enabled_flag;
180 pp->pic_fields.bits.pps_loop_filter_across_slices_enabled_flag = h->ps.pps->seq_loop_filter_across_slices_enabled_flag;
181 pp->pic_fields.bits.loop_filter_across_tiles_enabled_flag = h->ps.pps->loop_filter_across_tiles_enabled_flag;
183 pp->pic_fields.bits.pcm_loop_filter_disabled_flag = h->ps.sps->pcm.loop_filter_disable_flag;
184 pp->pcm_sample_bit_depth_luma_minus1 = h->ps.sps->pcm.bit_depth - 1;
185 pp->pcm_sample_bit_depth_chroma_minus1 = h->ps.sps->pcm.bit_depth_chroma - 1;
186 pp->log2_min_pcm_luma_coding_block_size_minus3 = h->ps.sps->pcm.log2_min_pcm_cb_size - 3;
187 pp->log2_diff_max_min_pcm_luma_coding_block_size = h->ps.sps->pcm.log2_max_pcm_cb_size - h->ps.sps->pcm.log2_min_pcm_cb_size;
189 memset(pp->column_width_minus1, 0, sizeof(pp->column_width_minus1));
190 memset(pp->row_height_minus1, 0, sizeof(pp->row_height_minus1));
192 if (h->ps.pps->tiles_enabled_flag) {
193 pp->num_tile_columns_minus1 = h->ps.pps->num_tile_columns - 1;
194 pp->num_tile_rows_minus1 = h->ps.pps->num_tile_rows - 1;
196 for (i = 0; i < h->ps.pps->num_tile_columns; i++)
197 pp->column_width_minus1[i] = h->ps.pps->column_width[i] - 1;
199 for (i = 0; i < h->ps.pps->num_tile_rows; i++)
200 pp->row_height_minus1[i] = h->ps.pps->row_height[i] - 1;
203 pp->diff_cu_qp_delta_depth = h->ps.pps->diff_cu_qp_delta_depth;
204 pp->pps_beta_offset_div2 = h->ps.pps->beta_offset / 2;
205 pp->pps_tc_offset_div2 = h->ps.pps->tc_offset / 2;
206 pp->log2_parallel_merge_level_minus2 = h->ps.pps->log2_parallel_merge_level - 2;
208 /* Different chroma/luma bit depths are currently not supported by ffmpeg. */
209 pp->bit_depth_luma_minus8 = h->ps.sps->bit_depth - 8;
210 pp->bit_depth_chroma_minus8 = h->ps.sps->bit_depth - 8;
212 pp->slice_parsing_fields.bits.lists_modification_present_flag = h->ps.pps->lists_modification_present_flag;
213 pp->slice_parsing_fields.bits.long_term_ref_pics_present_flag = h->ps.sps->long_term_ref_pics_present_flag;
214 pp->slice_parsing_fields.bits.sps_temporal_mvp_enabled_flag = h->ps.sps->sps_temporal_mvp_enabled_flag;
215 pp->slice_parsing_fields.bits.cabac_init_present_flag = h->ps.pps->cabac_init_present_flag;
216 pp->slice_parsing_fields.bits.output_flag_present_flag = h->ps.pps->output_flag_present_flag;
217 pp->slice_parsing_fields.bits.dependent_slice_segments_enabled_flag = h->ps.pps->dependent_slice_segments_enabled_flag;
218 pp->slice_parsing_fields.bits.pps_slice_chroma_qp_offsets_present_flag = h->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag;
219 pp->slice_parsing_fields.bits.sample_adaptive_offset_enabled_flag = h->ps.sps->sao_enabled;
220 pp->slice_parsing_fields.bits.deblocking_filter_override_enabled_flag = h->ps.pps->deblocking_filter_override_enabled_flag;
221 pp->slice_parsing_fields.bits.pps_disable_deblocking_filter_flag = h->ps.pps->disable_dbf;
222 pp->slice_parsing_fields.bits.slice_segment_header_extension_present_flag = h->ps.pps->slice_header_extension_present_flag;
224 pp->log2_max_pic_order_cnt_lsb_minus4 = h->ps.sps->log2_max_poc_lsb - 4;
225 pp->num_extra_slice_header_bits = h->ps.pps->num_extra_slice_header_bits;
227 if (h->nal_unit_type >= NAL_BLA_W_LP && h->nal_unit_type <= NAL_CRA_NUT) {
228 pp->slice_parsing_fields.bits.RapPicFlag = 1;
230 pp->slice_parsing_fields.bits.RapPicFlag = 0;
234 pp->slice_parsing_fields.bits.IdrPicFlag = 1;
236 pp->slice_parsing_fields.bits.IdrPicFlag = 0;
240 pp->slice_parsing_fields.bits.IntraPicFlag = 1;
242 pp->slice_parsing_fields.bits.IntraPicFlag = 0;
245 if (h->sh.short_term_ref_pic_set_sps_flag == 0 && h->sh.short_term_rps) {
246 pp->st_rps_bits = h->sh.short_term_ref_pic_set_size;
252 pp->pic_fields.bits.NoPicReorderingFlag = 0;
253 pp->pic_fields.bits.NoBiPredFlag = 0;
257 /** Initialize and start decoding a frame with VA API. */
258 static int vaapi_hevc_start_frame(AVCodecContext *avctx,
259 av_unused const uint8_t *buffer,
260 av_unused uint32_t size)
262 HEVCContext * const h = avctx->priv_data;
263 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
264 vaapi_hevc_frame_data *frame_data = h->ref->hwaccel_picture_private;
265 VAPictureParameterBufferHEVC *pic_param;
266 VAIQMatrixBufferHEVC *iq_matrix;
267 ScalingList const * scaling_list;
270 ff_dlog(avctx, "vaapi_hevc_start_frame()\n");
272 vactx->slice_param_size = sizeof(VASliceParameterBufferHEVC);
274 /* Fill in VAPictureParameterBufferHEVC. */
275 pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferHEVC));
278 fill_picture_parameters(h, pic_param);
279 frame_data->pic_param = pic_param;
281 /* Fill in VAIQMatrixBufferHEVC. */
282 if (h->ps.pps->scaling_list_data_present_flag) {
283 scaling_list = &h->ps.pps->scaling_list;
284 } else if (h->ps.sps->scaling_list_enable_flag) {
285 scaling_list = &h->ps.sps->scaling_list;
290 iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferHEVC));
294 for (i = 0; i < 6; ++i) {
295 for (j = 0; j < 16; ++j) {
296 pos = 4 * ff_hevc_diag_scan4x4_y[j] + ff_hevc_diag_scan4x4_x[j];
297 iq_matrix->ScalingList4x4[i][j] = scaling_list->sl[0][i][pos];
299 for (j = 0; j < 64; ++j) {
300 pos = 8 * ff_hevc_diag_scan8x8_y[j] + ff_hevc_diag_scan8x8_x[j];
301 iq_matrix->ScalingList8x8[i][j] = scaling_list->sl[1][i][pos];
302 iq_matrix->ScalingList16x16[i][j] = scaling_list->sl[2][i][pos];
304 iq_matrix->ScalingList32x32[i][j] = scaling_list->sl[3][i * 3][pos];
307 iq_matrix->ScalingListDC16x16[i] = scaling_list->sl_dc[0][i];
309 iq_matrix->ScalingListDC32x32[i] = scaling_list->sl_dc[1][i * 3];
316 /** End a hardware decoding based frame. */
317 static int vaapi_hevc_end_frame(AVCodecContext *avctx)
319 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
320 HEVCContext * const h = avctx->priv_data;
321 vaapi_hevc_frame_data *frame_data = h->ref->hwaccel_picture_private;
324 ff_dlog(avctx, "vaapi_hevc_end_frame()\n");
326 frame_data->last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1;
328 ret = ff_vaapi_commit_slices(vactx);
332 ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(h->ref->frame));
337 ff_vaapi_common_end_frame(avctx);
341 static int fill_pred_weight_table(HEVCContext * const h,
342 VASliceParameterBufferHEVC *slice_param,
343 SliceHeader * const sh)
347 memset(slice_param->delta_luma_weight_l0, 0, sizeof(slice_param->delta_luma_weight_l0));
348 memset(slice_param->delta_luma_weight_l1, 0, sizeof(slice_param->delta_luma_weight_l1));
349 memset(slice_param->luma_offset_l0, 0, sizeof(slice_param->luma_offset_l0));
350 memset(slice_param->luma_offset_l1, 0, sizeof(slice_param->luma_offset_l1));
351 memset(slice_param->delta_chroma_weight_l0, 0, sizeof(slice_param->delta_chroma_weight_l0));
352 memset(slice_param->delta_chroma_weight_l1, 0, sizeof(slice_param->delta_chroma_weight_l1));
353 memset(slice_param->ChromaOffsetL0, 0, sizeof(slice_param->ChromaOffsetL0));
354 memset(slice_param->ChromaOffsetL1, 0, sizeof(slice_param->ChromaOffsetL1));
356 slice_param->delta_chroma_log2_weight_denom = 0;
357 slice_param->luma_log2_weight_denom = 0;
359 if ( sh->slice_type == I_SLICE
360 || (sh->slice_type == P_SLICE && !h->ps.pps->weighted_pred_flag)
361 || (sh->slice_type == B_SLICE && !h->ps.pps->weighted_bipred_flag)) {
365 slice_param->luma_log2_weight_denom = sh->luma_log2_weight_denom;
367 if (h->ps.sps->chroma_format_idc) {
368 slice_param->delta_chroma_log2_weight_denom = sh->chroma_log2_weight_denom - sh->luma_log2_weight_denom;
371 for (i = 0; i < 15 && i < sh->nb_refs[L0]; ++i) {
372 slice_param->delta_luma_weight_l0[i] = sh->luma_weight_l0[i] - (1 << sh->luma_log2_weight_denom);
373 slice_param->luma_offset_l0[i] = sh->luma_offset_l0[i];
374 slice_param->delta_chroma_weight_l0[i][0] = sh->chroma_weight_l0[i][0] - (1 << sh->chroma_log2_weight_denom);
375 slice_param->delta_chroma_weight_l0[i][1] = sh->chroma_weight_l0[i][1] - (1 << sh->chroma_log2_weight_denom);
376 slice_param->ChromaOffsetL0[i][0] = sh->chroma_offset_l0[i][0];
377 slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
380 if (sh->slice_type == B_SLICE) {
381 for (i = 0; i < 15 && i < sh->nb_refs[L1]; ++i) {
382 slice_param->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - (1 << sh->luma_log2_weight_denom);
383 slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i];
384 slice_param->delta_chroma_weight_l1[i][0] = sh->chroma_weight_l1[i][0] - (1 << sh->chroma_log2_weight_denom);
385 slice_param->delta_chroma_weight_l1[i][1] = sh->chroma_weight_l1[i][1] - (1 << sh->chroma_log2_weight_denom);
386 slice_param->ChromaOffsetL1[i][0] = sh->chroma_offset_l1[i][0];
387 slice_param->ChromaOffsetL1[i][1] = sh->chroma_offset_l1[i][1];
394 /** Decode the given hevc slice with VA API. */
395 static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
396 const uint8_t *buffer,
399 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
400 HEVCContext * const h = avctx->priv_data;
401 vaapi_hevc_frame_data *frame_data = h->ref->hwaccel_picture_private;
402 SliceHeader * const sh = &h->sh;
403 VASliceParameterBufferHEVC *slice_param;
405 uint8_t nb_list = sh->slice_type == B_SLICE ? 2 : 1;
407 if (sh->slice_type == I_SLICE)
410 ff_dlog(avctx, "vaapi_hevc_decode_slice(): buffer %p, size %d\n", buffer, size);
412 /* Fill in VASliceParameterBufferH264. */
413 slice_param = (VASliceParameterBufferHEVC *)ff_vaapi_alloc_slice(vactx, buffer, size);
417 frame_data->last_slice_param = slice_param;
419 /* The base structure changed, so this has to be re-set in order to be valid on every byte order. */
420 slice_param->slice_data_flag = VA_SLICE_DATA_FLAG_ALL;
422 /* Add 1 to the bits count here to account for the byte_alignment bit, which allways is at least one bit and not accounted for otherwise. */
423 slice_param->slice_data_byte_offset = (get_bits_count(&h->HEVClc->gb) + 1 + 7) / 8;
425 slice_param->slice_segment_address = sh->slice_segment_addr;
427 slice_param->LongSliceFlags.value = 0;
428 slice_param->LongSliceFlags.fields.dependent_slice_segment_flag = sh->dependent_slice_segment_flag;
429 slice_param->LongSliceFlags.fields.slice_type = sh->slice_type;
430 slice_param->LongSliceFlags.fields.color_plane_id = sh->colour_plane_id;
431 slice_param->LongSliceFlags.fields.mvd_l1_zero_flag = sh->mvd_l1_zero_flag;
432 slice_param->LongSliceFlags.fields.cabac_init_flag = sh->cabac_init_flag;
433 slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag = sh->slice_temporal_mvp_enabled_flag;
434 slice_param->LongSliceFlags.fields.slice_deblocking_filter_disabled_flag = sh->disable_deblocking_filter_flag;
435 slice_param->LongSliceFlags.fields.collocated_from_l0_flag = sh->collocated_list == L0 ? 1 : 0;
436 slice_param->LongSliceFlags.fields.slice_loop_filter_across_slices_enabled_flag = sh->slice_loop_filter_across_slices_enabled_flag;
438 slice_param->LongSliceFlags.fields.slice_sao_luma_flag = sh->slice_sample_adaptive_offset_flag[0];
439 if (h->ps.sps->chroma_format_idc) {
440 slice_param->LongSliceFlags.fields.slice_sao_chroma_flag = sh->slice_sample_adaptive_offset_flag[1];
443 if (sh->slice_temporal_mvp_enabled_flag) {
444 slice_param->collocated_ref_idx = sh->collocated_ref_idx;
446 slice_param->collocated_ref_idx = 0xFF;
449 slice_param->slice_qp_delta = sh->slice_qp_delta;
450 slice_param->slice_cb_qp_offset = sh->slice_cb_qp_offset;
451 slice_param->slice_cr_qp_offset = sh->slice_cr_qp_offset;
452 slice_param->slice_beta_offset_div2 = sh->beta_offset / 2;
453 slice_param->slice_tc_offset_div2 = sh->tc_offset / 2;
455 if (sh->slice_type == I_SLICE) {
456 slice_param->five_minus_max_num_merge_cand = 0;
458 slice_param->five_minus_max_num_merge_cand = 5 - sh->max_num_merge_cand;
461 slice_param->num_ref_idx_l0_active_minus1 = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0;
462 slice_param->num_ref_idx_l1_active_minus1 = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0;
464 memset(slice_param->RefPicList, 0xFF, sizeof(slice_param->RefPicList));
466 /* h->ref->refPicList is updated befor calling each slice */
467 for (list_idx = 0; list_idx < nb_list; ++list_idx) {
468 RefPicList *rpl = &h->ref->refPicList[list_idx];
470 for (i = 0; i < rpl->nb_refs; ++i) {
471 slice_param->RefPicList[list_idx][i] = get_ref_pic_index(h, rpl->ref[i]);
475 return fill_pred_weight_table(h, slice_param, sh);
478 AVHWAccel ff_hevc_vaapi_hwaccel = {
479 .name = "hevc_vaapi",
480 .type = AVMEDIA_TYPE_VIDEO,
481 .id = AV_CODEC_ID_HEVC,
482 .pix_fmt = AV_PIX_FMT_VAAPI,
483 .start_frame = vaapi_hevc_start_frame,
484 .end_frame = vaapi_hevc_end_frame,
485 .decode_slice = vaapi_hevc_decode_slice,
486 .init = ff_vaapi_context_init,
487 .uninit = ff_vaapi_context_fini,
488 .priv_data_size = sizeof(FFVAContext),
489 .frame_priv_data_size = sizeof(vaapi_hevc_frame_data),