From f4109364390689758ad89272c4cee4269b178aaf Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Thu, 1 Feb 2018 14:57:37 -0500 Subject: [PATCH] vl: add parameters for HEVC encode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add HEVC encode interface Signed-off-by: Boyuan Zhang Acked-by: Christian König --- src/gallium/include/pipe/p_video_state.h | 99 ++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 5a88e6cf8c4..2533ba4fabc 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -120,6 +120,15 @@ enum pipe_h264_enc_picture_type PIPE_H264_ENC_PICTURE_TYPE_SKIP = 0x04 }; +enum pipe_h265_enc_picture_type +{ + PIPE_H265_ENC_PICTURE_TYPE_P = 0x00, + PIPE_H265_ENC_PICTURE_TYPE_B = 0x01, + PIPE_H265_ENC_PICTURE_TYPE_I = 0x02, + PIPE_H265_ENC_PICTURE_TYPE_IDR = 0x03, + PIPE_H265_ENC_PICTURE_TYPE_SKIP = 0x04 +}; + enum pipe_h264_enc_rate_control_method { PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00, @@ -129,6 +138,15 @@ enum pipe_h264_enc_rate_control_method PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04 }; +enum pipe_h265_enc_rate_control_method +{ + PIPE_H265_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00, + PIPE_H265_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01, + PIPE_H265_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02, + PIPE_H265_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03, + PIPE_H265_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04 +}; + struct pipe_picture_desc { enum pipe_video_profile profile; @@ -412,6 +430,87 @@ struct pipe_h264_enc_picture_desc }; +struct pipe_h265_enc_seq_param +{ + uint8_t general_profile_idc; + uint8_t general_level_idc; + uint8_t general_tier_flag; + uint32_t intra_period; + uint16_t pic_width_in_luma_samples; + uint16_t pic_height_in_luma_samples; + uint32_t chroma_format_idc; + uint32_t bit_depth_luma_minus8; + uint32_t bit_depth_chroma_minus8; + bool strong_intra_smoothing_enabled_flag; + bool amp_enabled_flag; + bool sample_adaptive_offset_enabled_flag; + bool pcm_enabled_flag; + bool sps_temporal_mvp_enabled_flag; + uint8_t log2_min_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_luma_coding_block_size; + uint8_t log2_min_transform_block_size_minus2; + uint8_t log2_diff_max_min_transform_block_size; + uint8_t max_transform_hierarchy_depth_inter; + uint8_t max_transform_hierarchy_depth_intra; +}; + +struct pipe_h265_enc_pic_param +{ + uint8_t log2_parallel_merge_level_minus2; + uint8_t nal_unit_type; + bool constrained_intra_pred_flag; +}; + +struct pipe_h265_enc_slice_param +{ + uint8_t max_num_merge_cand; + int8_t slice_cb_qp_offset; + int8_t slice_cr_qp_offset; + int8_t slice_beta_offset_div2; + int8_t slice_tc_offset_div2; + bool cabac_init_flag; + uint32_t slice_deblocking_filter_disabled_flag; + bool slice_loop_filter_across_slices_enabled_flag; +}; + +struct pipe_h265_enc_rate_control +{ + enum pipe_h265_enc_rate_control_method rate_ctrl_method; + unsigned target_bitrate; + unsigned peak_bitrate; + unsigned frame_rate_num; + unsigned frame_rate_den; + unsigned quant_i_frames; + unsigned vbv_buffer_size; + unsigned vbv_buf_lv; + unsigned target_bits_picture; + unsigned peak_bits_picture_integer; + unsigned peak_bits_picture_fraction; + unsigned fill_data_enable; + unsigned enforce_hrd; +}; + +struct pipe_h265_enc_picture_desc +{ + struct pipe_picture_desc base; + + struct pipe_h265_enc_seq_param seq; + struct pipe_h265_enc_pic_param pic; + struct pipe_h265_enc_slice_param slice; + struct pipe_h265_enc_rate_control rc; + + enum pipe_h265_enc_picture_type picture_type; + unsigned decoded_curr_pic; + unsigned reference_frames[16]; + unsigned frame_num; + unsigned pic_order_cnt; + unsigned pic_order_cnt_type; + unsigned ref_idx_l0; + unsigned ref_idx_l1; + bool not_referenced; + struct util_hash_table *frame_idx; +}; + struct pipe_h265_sps { uint8_t chroma_format_idc; -- 2.30.2