1 /* 2 ** Copyright (c) 2019-2021 The Khronos Group Inc. 3 ** 4 ** SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 8 #define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include "vk_video/vulkan_video_codec_h265std.h" 15 16 // ************************************************* 17 // Video h265 Encode related parameters: 18 // ************************************************* 19 20 #define STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE 15 21 #define STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE 15 22 #define STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM 2 23 24 typedef struct StdVideoEncodeH265SliceHeaderFlags { 25 uint32_t first_slice_segment_in_pic_flag : 1; 26 uint32_t no_output_of_prior_pics_flag : 1; 27 uint32_t dependent_slice_segment_flag : 1; 28 uint32_t short_term_ref_pic_set_sps_flag : 1; 29 uint32_t slice_temporal_mvp_enable_flag : 1; 30 uint32_t slice_sao_luma_flag : 1; 31 uint32_t slice_sao_chroma_flag : 1; 32 uint32_t num_ref_idx_active_override_flag : 1; 33 uint32_t mvd_l1_zero_flag : 1; 34 uint32_t cabac_init_flag : 1; 35 uint32_t slice_deblocking_filter_disable_flag : 1; 36 uint32_t collocated_from_l0_flag : 1; 37 uint32_t slice_loop_filter_across_slices_enabled_flag : 1; 38 uint32_t bLastSliceInPic : 1; 39 uint32_t reservedBits : 18; 40 uint16_t luma_weight_l0_flag; // bit 0 - num_ref_idx_l0_active_minus1 41 uint16_t chroma_weight_l0_flag; // bit 0 - num_ref_idx_l0_active_minus1 42 uint16_t luma_weight_l1_flag; // bit 0 - num_ref_idx_l1_active_minus1 43 uint16_t chroma_weight_l1_flag; // bit 0 - num_ref_idx_l1_active_minus1 44 } StdVideoEncodeH265SliceHeaderFlags; 45 46 typedef struct StdVideoEncodeH265SliceHeader { 47 StdVideoH265SliceType slice_type; 48 uint8_t slice_pic_parameter_set_id; 49 uint8_t num_short_term_ref_pic_sets; 50 uint32_t slice_segment_address; 51 uint8_t short_term_ref_pic_set_idx; 52 uint8_t num_long_term_sps; 53 uint8_t num_long_term_pics; 54 uint8_t collocated_ref_idx; 55 uint8_t num_ref_idx_l0_active_minus1; // [0, 14] 56 uint8_t num_ref_idx_l1_active_minus1; // [0, 14] 57 uint8_t luma_log2_weight_denom; // [0, 7] 58 int8_t delta_chroma_log2_weight_denom; 59 int8_t delta_luma_weight_l0[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE]; 60 int8_t luma_offset_l0[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE]; 61 int8_t delta_chroma_weight_l0[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM]; 62 int8_t delta_chroma_offset_l0[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM]; 63 int8_t delta_luma_weight_l1[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE]; 64 int8_t luma_offset_l1[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE]; 65 int8_t delta_chroma_weight_l1[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM]; 66 int8_t delta_chroma_offset_l1[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM]; 67 uint8_t MaxNumMergeCand; 68 int8_t slice_qp_delta; 69 int8_t slice_cb_qp_offset; // [-12, 12] 70 int8_t slice_cr_qp_offset; // [-12, 12] 71 int8_t slice_beta_offset_div2; // [-6, 6] 72 int8_t slice_tc_offset_div2; // [-6, 6] 73 int8_t slice_act_y_qp_offset; 74 int8_t slice_act_cb_qp_offset; 75 int8_t slice_act_cr_qp_offset; 76 StdVideoEncodeH265SliceHeaderFlags flags; 77 } StdVideoEncodeH265SliceHeader; 78 79 typedef struct StdVideoEncodeH265ReferenceModificationFlags { 80 uint32_t ref_pic_list_modification_flag_l0 : 1; 81 uint32_t ref_pic_list_modification_flag_l1 : 1; 82 } StdVideoEncodeH265ReferenceModificationFlags; 83 84 typedef struct StdVideoEncodeH265ReferenceModifications { 85 StdVideoEncodeH265ReferenceModificationFlags flags; 86 uint8_t referenceList0ModificationsCount; // num_ref_idx_l0_active_minus1 87 uint8_t* pReferenceList0Modifications; // list_entry_l0 88 uint8_t referenceList1ModificationsCount; // num_ref_idx_l1_active_minus1 89 uint8_t* pReferenceList1Modifications; // list_entry_l1 90 } StdVideoEncodeH265ReferenceModifications; 91 92 typedef struct StdVideoEncodeH265PictureInfoFlags { 93 uint32_t is_reference_flag : 1; 94 uint32_t IrapPicFlag : 1; 95 uint32_t long_term_flag : 1; 96 } StdVideoEncodeH265PictureInfoFlags; 97 98 typedef struct StdVideoEncodeH265PictureInfo { 99 StdVideoH265PictureType PictureType; 100 uint8_t sps_video_parameter_set_id; 101 uint8_t pps_seq_parameter_set_id; 102 int32_t PicOrderCntVal; 103 uint8_t TemporalId; 104 StdVideoEncodeH265PictureInfoFlags flags; 105 } StdVideoEncodeH265PictureInfo; 106 107 typedef struct StdVideoEncodeH265ReferenceInfoFlags { 108 uint32_t is_long_term : 1; 109 uint32_t isUsedFlag : 1; 110 } StdVideoEncodeH265ReferenceInfoFlags; 111 112 typedef struct StdVideoEncodeH265ReferenceInfo { 113 int32_t PicOrderCntVal; 114 uint8_t TemporalId; 115 StdVideoEncodeH265ReferenceInfoFlags flags; 116 } StdVideoEncodeH265ReferenceInfo; 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif // VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 123