24 #include <va/va_dec_hevc.h>
42 va_pic->picture_id = VA_INVALID_ID;
43 va_pic->flags = VA_PICTURE_HEVC_INVALID;
44 va_pic->pic_order_cnt = 0;
50 va_pic->pic_order_cnt = pic->
poc;
51 va_pic->flags = rps_type;
54 va_pic->flags |= VA_PICTURE_HEVC_LONG_TERM_REFERENCE;
57 va_pic->flags |= VA_PICTURE_HEVC_FIELD_PIC;
60 va_pic->flags |= VA_PICTURE_HEVC_BOTTOM_FIELD;
71 return VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE;
76 return VA_PICTURE_HEVC_RPS_ST_CURR_AFTER;
81 return VA_PICTURE_HEVC_RPS_LT_CURR;
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,
136 .num_short_term_ref_pic_sets = sps->
nb_st_rps,
143 .pcm_sample_bit_depth_luma_minus1 = sps->
pcm.
bit_depth - 1,
149 .pps_tc_offset_div2 = pps->
tc_offset / 2,
151 .bit_depth_luma_minus8 = sps->
bit_depth - 8,
152 .bit_depth_chroma_minus8 = sps->
bit_depth - 8,
175 .slice_parsing_fields.bits = {
183 .sample_adaptive_offset_enabled_flag = sps->
sao_enabled,
185 .pps_disable_deblocking_filter_flag = pps->
disable_dbf,
214 VAPictureParameterBufferType,
225 VAIQMatrixBufferHEVC iq_matrix;
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];
235 iq_matrix.ScalingList32x32[i][j] = scaling_list->
sl[3][i * 3][j];
237 iq_matrix.ScalingListDC16x16[i] = scaling_list->
sl_dc[0][i];
239 iq_matrix.ScalingListDC32x32[i] = scaling_list->
sl_dc[1][i * 3];
243 VAIQMatrixBufferType,
244 &iq_matrix,
sizeof(iq_matrix));
284 VASliceParameterBufferHEVC *slice_param)
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));
297 slice_param->delta_chroma_log2_weight_denom = 0;
298 slice_param->luma_log2_weight_denom = 0;
311 for (i = 0; i < 15 && i < sh->
nb_refs[
L0]; i++) {
321 for (i = 0; i < 15 && i < sh->
nb_refs[
L1]; i++) {
335 VAPictureParameterBufferHEVC *pp = &pic->
pic_param;
342 VASurfaceID pid = pp->ReferenceFrames[i].picture_id;
343 int poc = pp->ReferenceFrames[i].pic_order_cnt;
362 int err, i, list_idx;
377 .slice_data_size =
size,
378 .slice_data_offset = 0,
379 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
388 .slice_tc_offset_div2 = sh->
tc_offset / 2,
394 .LongSliceFlags.fields = {
409 memset(pic->last_slice_param.RefPicList, 0xFF,
sizeof(pic->last_slice_param.RefPicList));
411 for (list_idx = 0; list_idx < nb_list; list_idx++) {
414 for (i = 0; i < rpl->
nb_refs; i++)
420 pic->last_buffer =
buffer;
421 pic->last_size =
size;
427 .
name =
"hevc_vaapi",
unsigned int log2_min_cb_size
static int vaapi_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
int max_dec_pic_buffering
static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_type)
unsigned int * row_height
RowHeight.
static av_cold int init(AVCodecContext *avctx)
void * hwaccel_picture_private
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
uint8_t weighted_bipred_flag
uint8_t seq_loop_filter_across_slices_enabled_flag
uint8_t cabac_init_present_flag
static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameterBufferHEVC *pp)
static void init_vaapi_pic(VAPictureHEVC *va_pic)
int num_ref_idx_l0_default_active
num_ref_idx_l0_default_active_minus1 + 1
static int FUNC() scaling_list(CodedBitstreamContext *ctx, RWContext *rw, H264RawScalingList *current, int size_of_scaling_list)
const AVHWAccel ff_hevc_vaapi_hwaccel
uint8_t entropy_coding_sync_enabled_flag
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int log2_parallel_merge_level
log2_parallel_merge_level_minus2 + 2
unsigned int log2_max_trafo_size
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
struct HEVCFrame * ref[HEVC_MAX_REFS]
int num_ref_idx_l1_default_active
num_ref_idx_l1_default_active_minus1 + 1
unsigned int log2_min_pcm_cb_size
uint8_t scaling_list_data_present_flag
static int get_bits_count(const GetBitContext *s)
static void fill_pred_weight_table(const HEVCContext *h, const SliceHeader *sh, VASliceParameterBufferHEVC *slice_param)
int interlaced_frame
The content of the picture is interlaced.
uint8_t loop_filter_disable_flag
uint8_t transquant_bypass_enable_flag
static int vaapi_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
unsigned int log2_max_poc_lsb
#define HEVC_FRAME_FLAG_LONG_REF
static int vaapi_hevc_end_frame(AVCodecContext *avctx)
#define HEVC_FRAME_FLAG_SHORT_REF
uint8_t tiles_enabled_flag
uint8_t lists_modification_present_flag
const char * name
Name of the hardware accelerated codec.
int max_transform_hierarchy_depth_inter
int ff_vaapi_decode_init(AVCodecContext *avctx)
int num_tile_columns
num_tile_columns_minus1 + 1
uint8_t cu_qp_delta_enabled_flag
uint8_t sign_data_hiding_flag
uint8_t output_flag_present_flag
#define FF_ARRAY_ELEMS(a)
uint8_t constrained_intra_pred_flag
uint8_t pic_slice_level_chroma_qp_offsets_present_flag
VASurfaceID output_surface
uint8_t transform_skip_enabled_flag
Libavcodec external API header.
const uint8_t * last_buffer
VASliceParameterBufferHEVC last_slice_param
main external API structure.
int num_extra_slice_header_bits
VAPictureParameterBufferHEVC pic_param
uint8_t loop_filter_across_tiles_enabled_flag
static uint8_t get_ref_pic_index(const HEVCContext *h, const HEVCFrame *frame)
uint8_t num_long_term_ref_pics_sps
uint8_t sps_temporal_mvp_enabled_flag
int num_tile_rows
num_tile_rows_minus1 + 1
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
unsigned int log2_min_tb_size
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
uint8_t scaling_list_enable_flag
int tc_offset
tc_offset_div2 * 2
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
HEVCLocalContext * HEVClc
unsigned int log2_diff_max_min_coding_block_size
unsigned int log2_max_pcm_cb_size
int max_transform_hierarchy_depth_intra
struct HEVCSPS::@71 temporal_layer[HEVC_MAX_SUB_LAYERS]
uint8_t weighted_pred_flag
unsigned int * column_width
ColumnWidth.
uint8_t slice_header_extension_present_flag
#define HWACCEL_CAP_ASYNC_SAFE
uint8_t sps_strong_intra_smoothing_enable_flag
int top_field_first
If the content is interlaced, is top field displayed first.
uint8_t long_term_ref_pics_present_flag
int diff_cu_qp_delta_depth
uint8_t deblocking_filter_override_enabled_flag
int beta_offset
beta_offset_div2 * 2
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)
uint8_t separate_colour_plane_flag
uint8_t dependent_slice_segments_enabled_flag