FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vaapi_hevc.c
Go to the documentation of this file.
1 /*
2  * HEVC HW decode acceleration through VA API
3  *
4  * Copyright (C) 2015 Timo Rothenpieler <timo@rothenpieler.org>
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 <va/va.h>
24 #include <va/va_dec_hevc.h>
25 
26 #include "avcodec.h"
27 #include "hevcdec.h"
28 #include "hwaccel.h"
29 #include "vaapi_decode.h"
30 
31 typedef struct VAAPIDecodePictureHEVC {
32  VAPictureParameterBufferHEVC pic_param;
33  VASliceParameterBufferHEVC last_slice_param;
35  size_t last_size;
36 
39 
40 static void init_vaapi_pic(VAPictureHEVC *va_pic)
41 {
42  va_pic->picture_id = VA_INVALID_ID;
43  va_pic->flags = VA_PICTURE_HEVC_INVALID;
44  va_pic->pic_order_cnt = 0;
45 }
46 
47 static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_type)
48 {
49  va_pic->picture_id = ff_vaapi_get_surface_id(pic->frame);
50  va_pic->pic_order_cnt = pic->poc;
51  va_pic->flags = rps_type;
52 
54  va_pic->flags |= VA_PICTURE_HEVC_LONG_TERM_REFERENCE;
55 
56  if (pic->frame->interlaced_frame) {
57  va_pic->flags |= VA_PICTURE_HEVC_FIELD_PIC;
58 
59  if (!pic->frame->top_field_first)
60  va_pic->flags |= VA_PICTURE_HEVC_BOTTOM_FIELD;
61  }
62 }
63 
64 static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
65 {
66  VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame);
67  int i;
68 
69  for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) {
70  if (pic_surf == ff_vaapi_get_surface_id(h->rps[ST_CURR_BEF].ref[i]->frame))
71  return VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE;
72  }
73 
74  for (i = 0; i < h->rps[ST_CURR_AFT].nb_refs; i++) {
75  if (pic_surf == ff_vaapi_get_surface_id(h->rps[ST_CURR_AFT].ref[i]->frame))
76  return VA_PICTURE_HEVC_RPS_ST_CURR_AFTER;
77  }
78 
79  for (i = 0; i < h->rps[LT_CURR].nb_refs; i++) {
80  if (pic_surf == ff_vaapi_get_surface_id(h->rps[LT_CURR].ref[i]->frame))
81  return VA_PICTURE_HEVC_RPS_LT_CURR;
82  }
83 
84  return 0;
85 }
86 
87 static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameterBufferHEVC *pp)
88 {
89  const HEVCFrame *current_picture = h->ref;
90  int i, j, rps_type;
91 
92  for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) {
93  const HEVCFrame *frame = NULL;
94 
95  while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) {
96  if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
97  frame = &h->DPB[j];
98  j++;
99  }
100 
101  init_vaapi_pic(&pp->ReferenceFrames[i]);
102 
103  if (frame) {
104  rps_type = find_frame_rps_type(h, frame);
105  fill_vaapi_pic(&pp->ReferenceFrames[i], frame, rps_type);
106  }
107  }
108 }
109 
111  av_unused const uint8_t *buffer,
112  av_unused uint32_t size)
113 {
114  const HEVCContext *h = avctx->priv_data;
116  const HEVCSPS *sps = h->ps.sps;
117  const HEVCPPS *pps = h->ps.pps;
118 
119  const ScalingList *scaling_list = NULL;
120  int err, i;
121 
123 
124  pic->pic_param = (VAPictureParameterBufferHEVC) {
125  .pic_fields.value = 0,
126  .slice_parsing_fields.value = 0,
127  .pic_width_in_luma_samples = sps->width,
128  .pic_height_in_luma_samples = sps->height,
129  .log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3,
130  .sps_max_dec_pic_buffering_minus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering - 1,
131  .log2_diff_max_min_luma_coding_block_size = sps->log2_diff_max_min_coding_block_size,
132  .log2_min_transform_block_size_minus2 = sps->log2_min_tb_size - 2,
133  .log2_diff_max_min_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size,
134  .max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter,
135  .max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra,
136  .num_short_term_ref_pic_sets = sps->nb_st_rps,
137  .num_long_term_ref_pic_sps = sps->num_long_term_ref_pics_sps,
138  .num_ref_idx_l0_default_active_minus1 = pps->num_ref_idx_l0_default_active - 1,
139  .num_ref_idx_l1_default_active_minus1 = pps->num_ref_idx_l1_default_active - 1,
140  .init_qp_minus26 = pps->pic_init_qp_minus26,
141  .pps_cb_qp_offset = pps->cb_qp_offset,
142  .pps_cr_qp_offset = pps->cr_qp_offset,
143  .pcm_sample_bit_depth_luma_minus1 = sps->pcm.bit_depth - 1,
144  .pcm_sample_bit_depth_chroma_minus1 = sps->pcm.bit_depth_chroma - 1,
145  .log2_min_pcm_luma_coding_block_size_minus3 = sps->pcm.log2_min_pcm_cb_size - 3,
146  .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size,
147  .diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth,
148  .pps_beta_offset_div2 = pps->beta_offset / 2,
149  .pps_tc_offset_div2 = pps->tc_offset / 2,
150  .log2_parallel_merge_level_minus2 = pps->log2_parallel_merge_level - 2,
151  .bit_depth_luma_minus8 = sps->bit_depth - 8,
152  .bit_depth_chroma_minus8 = sps->bit_depth - 8,
153  .log2_max_pic_order_cnt_lsb_minus4 = sps->log2_max_poc_lsb - 4,
154  .num_extra_slice_header_bits = pps->num_extra_slice_header_bits,
155  .pic_fields.bits = {
156  .chroma_format_idc = sps->chroma_format_idc,
157  .tiles_enabled_flag = pps->tiles_enabled_flag,
158  .separate_colour_plane_flag = sps->separate_colour_plane_flag,
159  .pcm_enabled_flag = sps->pcm_enabled_flag,
160  .scaling_list_enabled_flag = sps->scaling_list_enable_flag,
161  .transform_skip_enabled_flag = pps->transform_skip_enabled_flag,
162  .amp_enabled_flag = sps->amp_enabled_flag,
163  .strong_intra_smoothing_enabled_flag = sps->sps_strong_intra_smoothing_enable_flag,
164  .sign_data_hiding_enabled_flag = pps->sign_data_hiding_flag,
165  .constrained_intra_pred_flag = pps->constrained_intra_pred_flag,
166  .cu_qp_delta_enabled_flag = pps->cu_qp_delta_enabled_flag,
167  .weighted_pred_flag = pps->weighted_pred_flag,
168  .weighted_bipred_flag = pps->weighted_bipred_flag,
169  .transquant_bypass_enabled_flag = pps->transquant_bypass_enable_flag,
170  .entropy_coding_sync_enabled_flag = pps->entropy_coding_sync_enabled_flag,
171  .pps_loop_filter_across_slices_enabled_flag = pps->seq_loop_filter_across_slices_enabled_flag,
172  .loop_filter_across_tiles_enabled_flag = pps->loop_filter_across_tiles_enabled_flag,
173  .pcm_loop_filter_disabled_flag = sps->pcm.loop_filter_disable_flag,
174  },
175  .slice_parsing_fields.bits = {
176  .lists_modification_present_flag = pps->lists_modification_present_flag,
177  .long_term_ref_pics_present_flag = sps->long_term_ref_pics_present_flag,
178  .sps_temporal_mvp_enabled_flag = sps->sps_temporal_mvp_enabled_flag,
179  .cabac_init_present_flag = pps->cabac_init_present_flag,
180  .output_flag_present_flag = pps->output_flag_present_flag,
181  .dependent_slice_segments_enabled_flag = pps->dependent_slice_segments_enabled_flag,
182  .pps_slice_chroma_qp_offsets_present_flag = pps->pic_slice_level_chroma_qp_offsets_present_flag,
183  .sample_adaptive_offset_enabled_flag = sps->sao_enabled,
184  .deblocking_filter_override_enabled_flag = pps->deblocking_filter_override_enabled_flag,
185  .pps_disable_deblocking_filter_flag = pps->disable_dbf,
186  .slice_segment_header_extension_present_flag = pps->slice_header_extension_present_flag,
187  .RapPicFlag = IS_IRAP(h),
188  .IdrPicFlag = IS_IDR(h),
189  .IntraPicFlag = IS_IRAP(h),
190  },
191  };
192 
193  fill_vaapi_pic(&pic->pic_param.CurrPic, h->ref, 0);
195 
196  if (pps->tiles_enabled_flag) {
197  pic->pic_param.num_tile_columns_minus1 = pps->num_tile_columns - 1;
198  pic->pic_param.num_tile_rows_minus1 = pps->num_tile_rows - 1;
199 
200  for (i = 0; i < pps->num_tile_columns; i++)
201  pic->pic_param.column_width_minus1[i] = pps->column_width[i] - 1;
202 
203  for (i = 0; i < pps->num_tile_rows; i++)
204  pic->pic_param.row_height_minus1[i] = pps->row_height[i] - 1;
205  }
206 
208  pic->pic_param.st_rps_bits = h->sh.short_term_ref_pic_set_size;
209  } else {
210  pic->pic_param.st_rps_bits = 0;
211  }
212 
213  err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
214  VAPictureParameterBufferType,
215  &pic->pic_param, sizeof(pic->pic_param));
216  if (err < 0)
217  goto fail;
218 
220  scaling_list = &pps->scaling_list;
221  else if (sps->scaling_list_enable_flag)
222  scaling_list = &sps->scaling_list;
223 
224  if (scaling_list) {
225  VAIQMatrixBufferHEVC iq_matrix;
226  int j;
227 
228  for (i = 0; i < 6; i++) {
229  for (j = 0; j < 16; j++)
230  iq_matrix.ScalingList4x4[i][j] = scaling_list->sl[0][i][j];
231  for (j = 0; j < 64; j++) {
232  iq_matrix.ScalingList8x8[i][j] = scaling_list->sl[1][i][j];
233  iq_matrix.ScalingList16x16[i][j] = scaling_list->sl[2][i][j];
234  if (i < 2)
235  iq_matrix.ScalingList32x32[i][j] = scaling_list->sl[3][i * 3][j];
236  }
237  iq_matrix.ScalingListDC16x16[i] = scaling_list->sl_dc[0][i];
238  if (i < 2)
239  iq_matrix.ScalingListDC32x32[i] = scaling_list->sl_dc[1][i * 3];
240  }
241 
242  err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
243  VAIQMatrixBufferType,
244  &iq_matrix, sizeof(iq_matrix));
245  if (err < 0)
246  goto fail;
247  }
248 
249  return 0;
250 
251 fail:
252  ff_vaapi_decode_cancel(avctx, &pic->pic);
253  return err;
254 }
255 
257 {
258  const HEVCContext *h = avctx->priv_data;
260  int ret;
261 
262  if (pic->last_size) {
263  pic->last_slice_param.LongSliceFlags.fields.LastSliceOfPic = 1;
264  ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
265  &pic->last_slice_param, sizeof(pic->last_slice_param),
266  pic->last_buffer, pic->last_size);
267  if (ret < 0)
268  goto fail;
269  }
270 
271 
272  ret = ff_vaapi_decode_issue(avctx, &pic->pic);
273  if (ret < 0)
274  goto fail;
275 
276  return 0;
277 fail:
278  ff_vaapi_decode_cancel(avctx, &pic->pic);
279  return ret;
280 }
281 
283  const SliceHeader *sh,
284  VASliceParameterBufferHEVC *slice_param)
285 {
286  int i;
287 
288  memset(slice_param->delta_luma_weight_l0, 0, sizeof(slice_param->delta_luma_weight_l0));
289  memset(slice_param->delta_luma_weight_l1, 0, sizeof(slice_param->delta_luma_weight_l1));
290  memset(slice_param->luma_offset_l0, 0, sizeof(slice_param->luma_offset_l0));
291  memset(slice_param->luma_offset_l1, 0, sizeof(slice_param->luma_offset_l1));
292  memset(slice_param->delta_chroma_weight_l0, 0, sizeof(slice_param->delta_chroma_weight_l0));
293  memset(slice_param->delta_chroma_weight_l1, 0, sizeof(slice_param->delta_chroma_weight_l1));
294  memset(slice_param->ChromaOffsetL0, 0, sizeof(slice_param->ChromaOffsetL0));
295  memset(slice_param->ChromaOffsetL1, 0, sizeof(slice_param->ChromaOffsetL1));
296 
297  slice_param->delta_chroma_log2_weight_denom = 0;
298  slice_param->luma_log2_weight_denom = 0;
299 
300  if (sh->slice_type == HEVC_SLICE_I ||
301  (sh->slice_type == HEVC_SLICE_P && !h->ps.pps->weighted_pred_flag) ||
303  return;
304 
305  slice_param->luma_log2_weight_denom = sh->luma_log2_weight_denom;
306 
307  if (h->ps.sps->chroma_format_idc) {
308  slice_param->delta_chroma_log2_weight_denom = sh->chroma_log2_weight_denom - sh->luma_log2_weight_denom;
309  }
310 
311  for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
312  slice_param->delta_luma_weight_l0[i] = sh->luma_weight_l0[i] - (1 << sh->luma_log2_weight_denom);
313  slice_param->luma_offset_l0[i] = sh->luma_offset_l0[i];
314  slice_param->delta_chroma_weight_l0[i][0] = sh->chroma_weight_l0[i][0] - (1 << sh->chroma_log2_weight_denom);
315  slice_param->delta_chroma_weight_l0[i][1] = sh->chroma_weight_l0[i][1] - (1 << sh->chroma_log2_weight_denom);
316  slice_param->ChromaOffsetL0[i][0] = sh->chroma_offset_l0[i][0];
317  slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
318  }
319 
320  if (sh->slice_type == HEVC_SLICE_B) {
321  for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) {
322  slice_param->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - (1 << sh->luma_log2_weight_denom);
323  slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i];
324  slice_param->delta_chroma_weight_l1[i][0] = sh->chroma_weight_l1[i][0] - (1 << sh->chroma_log2_weight_denom);
325  slice_param->delta_chroma_weight_l1[i][1] = sh->chroma_weight_l1[i][1] - (1 << sh->chroma_log2_weight_denom);
326  slice_param->ChromaOffsetL1[i][0] = sh->chroma_offset_l1[i][0];
327  slice_param->ChromaOffsetL1[i][1] = sh->chroma_offset_l1[i][1];
328  }
329  }
330 }
331 
333 {
335  VAPictureParameterBufferHEVC *pp = &pic->pic_param;
336  uint8_t i;
337 
338  if (!frame)
339  return 0xff;
340 
341  for (i = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) {
342  VASurfaceID pid = pp->ReferenceFrames[i].picture_id;
343  int poc = pp->ReferenceFrames[i].pic_order_cnt;
344  if (pid != VA_INVALID_ID && pid == ff_vaapi_get_surface_id(frame->frame) && poc == frame->poc)
345  return i;
346  }
347 
348  return 0xff;
349 }
350 
352  const uint8_t *buffer,
353  uint32_t size)
354 {
355  const HEVCContext *h = avctx->priv_data;
356  const SliceHeader *sh = &h->sh;
358 
359  int nb_list = (sh->slice_type == HEVC_SLICE_B) ?
360  2 : (sh->slice_type == HEVC_SLICE_I ? 0 : 1);
361 
362  int err, i, list_idx;
363 
364  if (!sh->first_slice_in_pic_flag) {
365  err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
366  &pic->last_slice_param, sizeof(pic->last_slice_param),
367  pic->last_buffer, pic->last_size);
368  pic->last_buffer = NULL;
369  pic->last_size = 0;
370  if (err) {
371  ff_vaapi_decode_cancel(avctx, &pic->pic);
372  return err;
373  }
374  }
375 
376  pic->last_slice_param = (VASliceParameterBufferHEVC) {
377  .slice_data_size = size,
378  .slice_data_offset = 0,
379  .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
380  /* Add 1 to the bits count here to account for the byte_alignment bit, which
381  * always is at least one bit and not accounted for otherwise. */
382  .slice_data_byte_offset = (get_bits_count(&h->HEVClc->gb) + 1 + 7) / 8,
383  .slice_segment_address = sh->slice_segment_addr,
384  .slice_qp_delta = sh->slice_qp_delta,
385  .slice_cb_qp_offset = sh->slice_cb_qp_offset,
386  .slice_cr_qp_offset = sh->slice_cr_qp_offset,
387  .slice_beta_offset_div2 = sh->beta_offset / 2,
388  .slice_tc_offset_div2 = sh->tc_offset / 2,
389  .collocated_ref_idx = sh->slice_temporal_mvp_enabled_flag ? sh->collocated_ref_idx : 0xFF,
390  .five_minus_max_num_merge_cand = sh->slice_type == HEVC_SLICE_I ? 0 : 5 - sh->max_num_merge_cand,
391  .num_ref_idx_l0_active_minus1 = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0,
392  .num_ref_idx_l1_active_minus1 = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0,
393 
394  .LongSliceFlags.fields = {
395  .dependent_slice_segment_flag = sh->dependent_slice_segment_flag,
396  .slice_type = sh->slice_type,
397  .color_plane_id = sh->colour_plane_id,
398  .mvd_l1_zero_flag = sh->mvd_l1_zero_flag,
399  .cabac_init_flag = sh->cabac_init_flag,
400  .slice_temporal_mvp_enabled_flag = sh->slice_temporal_mvp_enabled_flag,
401  .slice_deblocking_filter_disabled_flag = sh->disable_deblocking_filter_flag,
402  .collocated_from_l0_flag = sh->collocated_list == L0 ? 1 : 0,
403  .slice_loop_filter_across_slices_enabled_flag = sh->slice_loop_filter_across_slices_enabled_flag,
404  .slice_sao_luma_flag = sh->slice_sample_adaptive_offset_flag[0],
405  .slice_sao_chroma_flag = sh->slice_sample_adaptive_offset_flag[1],
406  },
407  };
408 
409  memset(pic->last_slice_param.RefPicList, 0xFF, sizeof(pic->last_slice_param.RefPicList));
410 
411  for (list_idx = 0; list_idx < nb_list; list_idx++) {
412  RefPicList *rpl = &h->ref->refPicList[list_idx];
413 
414  for (i = 0; i < rpl->nb_refs; i++)
415  pic->last_slice_param.RefPicList[list_idx][i] = get_ref_pic_index(h, rpl->ref[i]);
416  }
417 
418  fill_pred_weight_table(h, sh, &pic->last_slice_param);
419 
420  pic->last_buffer = buffer;
421  pic->last_size = size;
422 
423  return 0;
424 }
425 
427  .name = "hevc_vaapi",
428  .type = AVMEDIA_TYPE_VIDEO,
429  .id = AV_CODEC_ID_HEVC,
430  .pix_fmt = AV_PIX_FMT_VAAPI,
431  .start_frame = vaapi_hevc_start_frame,
432  .end_frame = vaapi_hevc_end_frame,
433  .decode_slice = vaapi_hevc_decode_slice,
434  .frame_priv_data_size = sizeof(VAAPIDecodePictureHEVC),
437  .frame_params = ff_vaapi_common_frame_params,
438  .priv_data_size = sizeof(VAAPIDecodeContext),
439  .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
440 };
const HEVCPPS * pps
Definition: hevc_ps.h:403
AVFrame * frame
Definition: hevcdec.h:312
#define NULL
Definition: coverity.c:32
unsigned int log2_min_cb_size
Definition: hevc_ps.h:277
int short_term_ref_pic_set_sps_flag
Definition: hevc_ps.h:66
HEVCFrame * ref
Definition: hevcdec.h:423
static int vaapi_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vaapi_hevc.c:110
VAAPIDecodePicture pic
Definition: vaapi_hevc.c:37
int max_dec_pic_buffering
Definition: hevc_ps.h:244
static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_type)
Definition: vaapi_hevc.c:47
unsigned int * row_height
RowHeight.
Definition: hevc_ps.h:379
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
void * hwaccel_picture_private
Definition: hevcdec.h:326
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
Definition: vaapi_decode.c:29
int pic_init_qp_minus26
Definition: hevc_ps.h:327
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
Definition: vaapi_decode.h:35
uint8_t weighted_bipred_flag
Definition: hevc_ps.h:339
uint8_t seq_loop_filter_across_slices_enabled_flag
Definition: hevc_ps.h:352
uint8_t cabac_init_present_flag
Definition: hevc_ps.h:323
int16_t chroma_offset_l1[16][2]
Definition: hevc_ps.h:120
static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameterBufferHEVC *pp)
Definition: vaapi_hevc.c:87
static void init_vaapi_pic(VAPictureHEVC *va_pic)
Definition: vaapi_hevc.c:40
HEVCParamSets ps
Definition: hevcdec.h:408
int num_ref_idx_l0_default_active
num_ref_idx_l0_default_active_minus1 + 1
Definition: hevc_ps.h:325
uint8_t dependent_slice_segment_flag
Definition: hevc_ps.h:61
int width
Definition: hevc_ps.h:296
static int FUNC() scaling_list(CodedBitstreamContext *ctx, RWContext *rw, H264RawScalingList *current, int size_of_scaling_list)
const AVHWAccel ff_hevc_vaapi_hwaccel
Definition: vaapi_hevc.c:426
uint8_t entropy_coding_sync_enabled_flag
Definition: hevc_ps.h:345
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: vaapi_decode.c:586
int log2_parallel_merge_level
log2_parallel_merge_level_minus2 + 2
Definition: hevc_ps.h:364
int nb_refs
Definition: hevcdec.h:235
int chroma_format_idc
Definition: hevc_ps.h:227
uint8_t disable_dbf
Definition: hevc_ps.h:356
unsigned int log2_max_trafo_size
Definition: hevc_ps.h:280
unsigned int slice_segment_addr
address (in raster order) of the first block in the current slice
Definition: hevc_ps.h:52
enum HEVCSliceType slice_type
Definition: hevc_ps.h:56
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
Definition: vaapi_decode.c:699
uint8_t
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
Definition: vaapi_decode.c:150
struct HEVCFrame * ref[HEVC_MAX_REFS]
Definition: hevcdec.h:232
int num_ref_idx_l1_default_active
num_ref_idx_l1_default_active_minus1 + 1
Definition: hevc_ps.h:326
unsigned int log2_min_pcm_cb_size
Definition: hevc_ps.h:270
static AVFrame * frame
uint8_t scaling_list_data_present_flag
Definition: hevc_ps.h:360
uint8_t first_slice_in_pic_flag
Definition: hevc_ps.h:60
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:200
static void fill_pred_weight_table(const HEVCContext *h, const SliceHeader *sh, VASliceParameterBufferHEVC *slice_param)
Definition: vaapi_hevc.c:282
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:365
uint8_t loop_filter_disable_flag
Definition: hevc_ps.h:272
ptrdiff_t size
Definition: opengl_enc.c:101
uint8_t transquant_bypass_enable_flag
Definition: hevc_ps.h:341
static int vaapi_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: vaapi_hevc.c:351
int bit_depth_chroma
Definition: hevc_ps.h:235
uint8_t colour_plane_id
RPS coded in the slice header itself is stored here.
Definition: hevc_ps.h:63
unsigned int log2_max_poc_lsb
Definition: hevc_ps.h:239
#define HEVC_FRAME_FLAG_LONG_REF
Definition: hevcdec.h:308
static int vaapi_hevc_end_frame(AVCodecContext *avctx)
Definition: vaapi_hevc.c:256
uint8_t amp_enabled_flag
Definition: hevc_ps.h:259
int16_t luma_offset_l0[16]
Definition: hevc_ps.h:116
int tc_offset
tc_offset_div2 * 2
Definition: hevc_ps.h:97
const ShortTermRPS * short_term_rps
Definition: hevc_ps.h:69
#define IS_IDR(s)
Definition: hevcdec.h:77
#define HEVC_FRAME_FLAG_SHORT_REF
Definition: hevcdec.h:307
#define fail()
Definition: checkasm.h:116
struct HEVCSPS::@72 pcm
uint8_t slice_temporal_mvp_enabled_flag
Definition: hevc_ps.h:76
uint8_t tiles_enabled_flag
Definition: hevc_ps.h:344
int16_t luma_weight_l0[16]
Definition: hevc_ps.h:111
int slice_qp_delta
Definition: hevc_ps.h:90
const HEVCSPS * sps
Definition: hevc_ps.h:402
uint8_t lists_modification_present_flag
Definition: hevc_ps.h:363
#define IS_IRAP(s)
Definition: hevcdec.h:80
#define L1
Definition: hevcdec.h:60
int beta_offset
beta_offset_div2 * 2
Definition: hevc_ps.h:96
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:3582
int max_transform_hierarchy_depth_inter
Definition: hevc_ps.h:284
int slice_cr_qp_offset
Definition: hevc_ps.h:92
int ff_vaapi_decode_init(AVCodecContext *avctx)
Definition: vaapi_decode.c:610
int num_tile_columns
num_tile_columns_minus1 + 1
Definition: hevc_ps.h:347
uint8_t cu_qp_delta_enabled_flag
Definition: hevc_ps.h:332
int16_t chroma_weight_l0[16][2]
Definition: hevc_ps.h:112
uint8_t sl_dc[2][6]
Definition: hevc_ps.h:222
uint8_t sign_data_hiding_flag
Definition: hevc_ps.h:321
int height
Definition: hevc_ps.h:297
uint8_t output_flag_present_flag
Definition: hevc_ps.h:340
int16_t luma_offset_l1[16]
Definition: hevc_ps.h:119
int16_t chroma_offset_l0[16][2]
Definition: hevc_ps.h:117
#define FF_ARRAY_ELEMS(a)
uint8_t constrained_intra_pred_flag
Definition: hevc_ps.h:329
uint8_t sl[4][6][64]
Definition: hevc_ps.h:221
uint8_t pic_slice_level_chroma_qp_offsets_present_flag
Definition: hevc_ps.h:337
VASurfaceID output_surface
Definition: vaapi_decode.h:45
HEVCFrame DPB[32]
Definition: hevcdec.h:424
int slice_cb_qp_offset
Definition: hevc_ps.h:91
uint8_t transform_skip_enabled_flag
Definition: hevc_ps.h:330
int short_term_ref_pic_set_size
Definition: hevc_ps.h:67
Libavcodec external API header.
#define L0
Definition: hevcdec.h:59
const uint8_t * last_buffer
Definition: vaapi_hevc.c:34
int max_sub_layers
Definition: hevc_ps.h:242
ScalingList scaling_list
Definition: hevc_ps.h:361
VASliceParameterBufferHEVC last_slice_param
Definition: vaapi_hevc.c:33
main external API structure.
Definition: avcodec.h:1518
uint8_t sao_enabled
Definition: hevc_ps.h:260
int num_extra_slice_header_bits
Definition: hevc_ps.h:365
VAPictureParameterBufferHEVC pic_param
Definition: vaapi_hevc.c:32
uint8_t loop_filter_across_tiles_enabled_flag
Definition: hevc_ps.h:350
static uint8_t get_ref_pic_index(const HEVCContext *h, const HEVCFrame *frame)
Definition: vaapi_hevc.c:332
uint8_t num_long_term_ref_pics_sps
Definition: hevc_ps.h:265
uint8_t sps_temporal_mvp_enabled_flag
Definition: hevc_ps.h:274
unsigned int nb_st_rps
Definition: hevc_ps.h:256
uint8_t cabac_init_flag
Definition: hevc_ps.h:83
int num_tile_rows
num_tile_rows_minus1 + 1
Definition: hevc_ps.h:348
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
int poc
Definition: hevcdec.h:318
unsigned int max_num_merge_cand
5 - 5_minus_max_num_merge_cand
Definition: hevc_ps.h:99
GetBitContext gb
Definition: hevcdec.h:347
static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
Definition: vaapi_hevc.c:64
unsigned int log2_min_tb_size
Definition: hevc_ps.h:279
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
uint8_t scaling_list_enable_flag
Definition: hevc_ps.h:253
int16_t luma_weight_l1[16]
Definition: hevc_ps.h:114
int16_t chroma_log2_weight_denom
Definition: hevc_ps.h:109
int tc_offset
tc_offset_div2 * 2
Definition: hevc_ps.h:358
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
Definition: hevcdec.h:337
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
Definition: vaapi_decode.c:222
HEVCLocalContext * HEVClc
Definition: hevcdec.h:390
int cr_qp_offset
Definition: hevc_ps.h:336
ScalingList scaling_list
Definition: hevc_ps.h:254
unsigned int log2_diff_max_min_coding_block_size
Definition: hevc_ps.h:278
unsigned int log2_max_pcm_cb_size
Definition: hevc_ps.h:271
int max_transform_hierarchy_depth_intra
Definition: hevc_ps.h:285
struct HEVCSPS::@71 temporal_layer[HEVC_MAX_SUB_LAYERS]
uint8_t weighted_pred_flag
Definition: hevc_ps.h:338
unsigned int nb_refs[2]
Definition: hevc_ps.h:78
uint8_t disable_deblocking_filter_flag
slice_header_disable_deblocking_filter_flag
Definition: hevc_ps.h:84
unsigned int * column_width
ColumnWidth.
Definition: hevc_ps.h:378
uint8_t slice_header_extension_present_flag
Definition: hevc_ps.h:366
uint8_t collocated_list
Definition: hevc_ps.h:86
uint8_t slice_loop_filter_across_slices_enabled_flag
Definition: hevc_ps.h:85
#define HWACCEL_CAP_ASYNC_SAFE
Definition: hwaccel.h:26
void * priv_data
Definition: avcodec.h:1545
RefPicList rps[5]
Definition: hevcdec.h:416
uint8_t sps_strong_intra_smoothing_enable_flag
Definition: hevc_ps.h:275
unsigned int collocated_ref_idx
Definition: hevc_ps.h:88
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:370
uint8_t luma_log2_weight_denom
Definition: hevc_ps.h:108
int16_t chroma_weight_l1[16][2]
Definition: hevc_ps.h:113
uint8_t long_term_ref_pics_present_flag
Definition: hevc_ps.h:262
int diff_cu_qp_delta_depth
Definition: hevc_ps.h:333
int cb_qp_offset
Definition: hevc_ps.h:335
uint8_t deblocking_filter_override_enabled_flag
Definition: hevc_ps.h:355
int bit_depth
Definition: hevc_ps.h:234
int beta_offset
beta_offset_div2 * 2
Definition: hevc_ps.h:357
SliceHeader sh
Definition: hevcdec.h:418
int pcm_enabled_flag
Definition: hevc_ps.h:240
uint8_t mvd_l1_zero_flag
Definition: hevc_ps.h:81
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, size_t params_size, const void *slice_data, size_t slice_size)
Definition: vaapi_decode.c:58
for(j=16;j >0;--j)
uint8_t separate_colour_plane_flag
Definition: hevc_ps.h:228
GLuint buffer
Definition: opengl_enc.c:102
#define av_unused
Definition: attributes.h:125
uint8_t slice_sample_adaptive_offset_flag[3]
Definition: hevc_ps.h:80
uint8_t dependent_slice_segments_enabled_flag
Definition: hevc_ps.h:343