1 /****************************************************************************** 2 * 3 * Copyright (C) 2018 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 /** 22 ****************************************************************************** 23 * 24 * @file ihevce_encode_header_sei_vui.h 25 * 26 * @brief 27 * This file contains structures and interface prototypes for header vui/sei 28 * encoding 29 * 30 * @author 31 * ittiam 32 * 33 ****************************************************************************** 34 */ 35 36 #ifndef _IHEVCE_ENCODE_HEADER_SEI_VUI_H_ 37 #define _IHEVCE_ENCODE_HEADER_SEI_VUI_H_ 38 39 /*****************************************************************************/ 40 /* Function Macros */ 41 /*****************************************************************************/ 42 43 /** 44 ****************************************************************************** 45 * @brief Macro to calculate the CRC for a bit index 46 ****************************************************************************** 47 */ 48 #define CALC_CRC_BIT_LEVEL(u4_crc_val, u1_cur_val, bit_idx) \ 49 { \ 50 UWORD32 u4_bit_val, u4_crc_msb; \ 51 u4_crc_msb = (u4_crc_val >> 15) & 1; \ 52 u4_bit_val = (u1_cur_val >> (7 - bit_idx)) & 1; \ 53 u4_crc_val = (((u4_crc_val << 1) + u4_bit_val) & 0xffff) ^ (u4_crc_msb * 0x1021); \ 54 } 55 56 /*****************************************************************************/ 57 /* Enums */ 58 /*****************************************************************************/ 59 typedef enum 60 { 61 /* SEI PREFIX */ 62 IHEVCE_SEI_BUF_PERIOD_T = 0, 63 IHEVCE_SEI_PIC_TIMING_T, 64 IHEVCE_SEI_PAN_SCAN_RECT_T, 65 IHEVCE_SEI_FILLER_PAYLOAD_T, 66 IHEVCE_SEI_USER_DATA_REGISTERED_ITU_T_T35_T, 67 IHEVCE_SEI_USER_DATA_UNREGISTERED_T, 68 IHEVCE_SEI_RECOVERY_POINT_T = 6, 69 IHEVCE_SEI_SCENE_INFO_T = 9, 70 IHEVCE_SEI_FULL_FRAME_SNAPSHOT_T = 15, 71 IHEVCE_SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START_T = 16, 72 IHEVCE_SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END_T = 17, 73 IHEVCE_SEI_FILM_GRAIN_CHARACTERISTICS_T = 19, 74 IHEVCE_SEI_POST_FILTER_HINT_T = 22, 75 IHEVCE_SEI_TONE_MAPPING_INFO_T = 23, 76 IHEVCE_SEI_FRAME_PACKING_ARRANGEMENT_T = 45, 77 IHEVCE_SEI_DISPLAY_ORIENTATION_T = 47, 78 IHEVCE_SEI_SOP_DESCRIPTION_T = 128, 79 IHEVCE_SEI_ACTIVE_PARAMETER_SETS_T = 129, 80 IHEVCE_SEI_DECODING_UNIT_INFO_T = 130, 81 IHEVCE_SEI_TL0_INDEX_T = 131, 82 IHEVCE_SEI_DECODED_PICTURE_HASH_T = 132, /* SEI SUFFIX */ 83 IHEVCE_SEI_SCALABLE_NESTING_T = 133, 84 IHEVCE_SEI_REGION_REFRESH_INFO_T = 134, 85 IHEVCE_SEI_MASTERING_DISP_COL_VOL_T = 137, 86 IHEVCE_SEI_CONTENT_LIGHT_LEVEL_DATA_T = 144, 87 88 /* SIE SUFFIX/PREFIX REST OF THE SEI */ 89 IHEVCE_SEI_RESERVED_SEI_MESSAGE_T 90 } IHEVCE_SEI_TYPE; 91 92 /*****************************************************************************/ 93 /* Extern Function Declarations */ 94 /*****************************************************************************/ 95 96 WORD32 ihevce_generate_sub_layer_hrd_params( 97 bitstrm_t *ps_bitstrm, 98 sub_lyr_hrd_params_t *ps_sub_lyr_hrd_params, 99 hrd_params_t *ps_hrd_params, 100 WORD32 cpb_cnt_minus1); 101 102 WORD32 103 ihevce_generate_hrd_params(bitstrm_t *ps_bitstrm, hrd_params_t *ps_hrd_params, sps_t *ps_sps); 104 105 WORD32 ihevce_generate_vui(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t s_vui); 106 107 WORD32 ihevce_put_buf_period_sei_params( 108 buf_period_sei_params_t *ps_bp_sei, vui_t *ps_vui_params, bitstrm_t *ps_bitstrm); 109 110 WORD32 ihevce_put_active_parameter_set_sei_params( 111 active_parameter_set_sei_param_t *ps_act_sei, bitstrm_t *ps_bitstrm); 112 113 WORD32 ihevce_put_recovery_point_sei_params( 114 recovery_point_sei_params_t *ps_rp_sei, bitstrm_t *ps_bitstrm); 115 116 WORD32 ihevce_put_pic_timing_sei_params( 117 pic_timing_sei_params_t *ps_pt_sei, vui_t *ps_vui_params, bitstrm_t *ps_bitstrm); 118 119 WORD32 ihevce_put_sei_msg( 120 IHEVCE_SEI_TYPE e_payload_type, 121 sei_params_t *ps_sei_params, 122 vui_t *ps_vui_params, 123 bitstrm_t *ps_bitstrm, 124 UWORD32 i4_registered_user_data_length, 125 UWORD8 *pu1_user_data_registered); 126 127 WORD32 ihevce_generate_sei( 128 bitstrm_t *ps_bitstrm, 129 sei_params_t *ps_sei_params, 130 vui_t *ps_vui_params, 131 WORD32 insert_per_cra, 132 WORD32 nal_unit_header, 133 UWORD32 u4_num_sei_payloads, 134 sei_payload_t *ps_sei_payload); 135 136 WORD32 ihevce_populate_recovery_point_sei( 137 sei_params_t *ps_sei, ihevce_vui_sei_params_t *ps_vui_sei_prms); 138 139 WORD32 ihevce_populate_mastering_disp_col_vol_sei( 140 sei_params_t *ps_sei, ihevce_out_strm_params_t *ps_out_strm_prms); 141 142 WORD32 ihevce_populate_picture_timing_sei( 143 sei_params_t *ps_sei, 144 vui_t *ps_vui, 145 ihevce_src_params_t *ps_src_params, 146 WORD32 u4_bottom_field_flag); 147 148 WORD32 ihevce_populate_buffering_period_sei( 149 sei_params_t *ps_sei, vui_t *ps_vui, sps_t *ps_sps, ihevce_vui_sei_params_t *ps_vui_sei_prms); 150 151 WORD32 ihevce_populate_active_parameter_set_sei(sei_params_t *ps_sei, vps_t *ps_vps, sps_t *ps_sps); 152 153 WORD32 ihevce_populate_hash_sei( 154 sei_params_t *ps_sei, 155 WORD32 bit_depth, 156 void *pv_y_buf, 157 WORD32 y_wd, 158 WORD32 y_ht, 159 WORD32 y_strd, 160 void *pv_u_buf, 161 WORD32 uv_wd, 162 WORD32 uv_ht, 163 WORD32 uv_strd, 164 WORD32 i4_frame_pos_x, 165 WORD32 i4_frame_pos_y); 166 167 WORD32 ihevce_populate_vui( 168 vui_t *ps_vui, 169 sps_t *ps_sps, 170 ihevce_src_params_t *ps_src_params, 171 ihevce_vui_sei_params_t *ps_vui_sei_prms, 172 WORD32 i4_resolution_id, 173 ihevce_tgt_params_t *ps_tgt_params, 174 ihevce_static_cfg_params_t *ps_stat_prms, 175 WORD32 i4_bitrate_instance_id); 176 177 #endif // _IHEVCE_ENCODE_HEADER_SEI_VUI_H_ 178