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.h 25 * 26 * @brief 27 * This file contains structures and interface prototypes for header encoding 28 * 29 * @author 30 * ittiam 31 * 32 ****************************************************************************** 33 */ 34 35 #ifndef _IHEVCE_ENCODE_HEADER_H_ 36 #define _IHEVCE_ENCODE_HEADER_H_ 37 38 /*****************************************************************************/ 39 /* Function Macros */ 40 /*****************************************************************************/ 41 42 /** 43 ****************************************************************************** 44 * @brief Macro to put a code with specified number of bits into the 45 * bitstream 46 ****************************************************************************** 47 */ 48 #define PUT_BITS(ps_bitstrm, code_val, code_len, ret_val) \ 49 ret_val |= ihevce_put_bits((ps_bitstrm), (code_val), (code_len)) 50 51 /** 52 ****************************************************************************** 53 * @brief Macro to put a code with specified number of bits into the 54 * bitstream using 0th order exponential Golomb encoding for 55 * signed numbers 56 ****************************************************************************** 57 */ 58 #define PUT_BITS_UEV(ps_bitstrm, code_val, ret_val) \ 59 ret_val |= ihevce_put_uev((ps_bitstrm), (code_val)) 60 61 /** 62 ****************************************************************************** 63 * @brief Macro to put a code with specified number of bits into the 64 * bitstream using 0th order exponential Golomb encoding for 65 * signed numbers 66 ****************************************************************************** 67 */ 68 #define PUT_BITS_SEV(ps_bitstrm, code_val, ret_val) \ 69 ret_val |= ihevce_put_sev((ps_bitstrm), (code_val)) 70 71 /*****************************************************************************/ 72 /* Extern Function Declarations */ 73 /*****************************************************************************/ 74 75 WORD32 ihevce_generate_nal_unit_header( 76 bitstrm_t *ps_bitstrm, WORD32 nal_unit_type, WORD32 nuh_temporal_id); 77 78 WORD32 ihevce_generate_aud(bitstrm_t *ps_bitstrm, WORD32 pic_type); 79 80 WORD32 ihevce_generate_eos(bitstrm_t *ps_bitstrm); 81 82 WORD32 ihevce_generate_vps(bitstrm_t *ps_bitstrm, vps_t *ps_vps); 83 84 WORD32 ihevce_generate_sps(bitstrm_t *ps_bitstrm, sps_t *ps_sps); 85 86 WORD32 ihevce_generate_pps(bitstrm_t *ps_bitstrm, pps_t *ps_pps); 87 88 WORD32 ihevce_generate_slice_header( 89 bitstrm_t *ps_bitstrm, 90 WORD8 i1_nal_unit_type, 91 slice_header_t *ps_slice_hdr, 92 pps_t *ps_pps, 93 sps_t *ps_sps, 94 bitstrm_t *ps_dup_bit_strm_ent_offset, 95 UWORD32 *pu4_first_slice_start_offset, 96 ihevce_tile_params_t *ps_tile_params, 97 WORD32 i4_next_slice_seg_x, 98 WORD32 i4_next_slice_seg_y); 99 100 WORD32 ihevce_populate_vps( 101 enc_ctxt_t *ps_enc_ctxt, 102 vps_t *ps_vps, 103 ihevce_src_params_t *ps_src_params, 104 ihevce_out_strm_params_t *ps_out_strm_params, 105 ihevce_coding_params_t *ps_coding_params, 106 ihevce_config_prms_t *ps_config_prms, 107 ihevce_static_cfg_params_t *ps_stat_cfg_prms, 108 WORD32 i4_resolution_id); 109 110 WORD32 ihevce_populate_sps( 111 enc_ctxt_t *ps_enc_ctxt, 112 sps_t *ps_sps, 113 vps_t *ps_vps, 114 ihevce_src_params_t *ps_src_params, 115 ihevce_out_strm_params_t *ps_out_strm_params, 116 ihevce_coding_params_t *ps_coding_params, 117 ihevce_config_prms_t *ps_config_prms, 118 frm_ctb_ctxt_t *ps_frm_ctb_prms, 119 ihevce_static_cfg_params_t *ps_stat_cfg_prms, 120 WORD32 i4_resolution_id); 121 122 WORD32 ihevce_populate_pps( 123 pps_t *ps_pps, 124 sps_t *ps_sps, 125 ihevce_src_params_t *ps_src_params, 126 ihevce_out_strm_params_t *ps_out_strm_params, 127 ihevce_coding_params_t *ps_coding_params, 128 ihevce_config_prms_t *ps_config_prms, 129 ihevce_static_cfg_params_t *ps_stat_cfg_prms, 130 WORD32 i4_bitrate_instance_id, 131 WORD32 i4_resolution_id, 132 ihevce_tile_params_t *ps_tile_params_base, 133 WORD32 *pi4_column_width_array, 134 WORD32 *pi4_row_height_array); 135 136 WORD32 ihevce_populate_slice_header( 137 slice_header_t *ps_slice_hdr, 138 pps_t *ps_pps, 139 sps_t *ps_sps, 140 WORD32 nal_unit_type, 141 WORD32 slice_type, 142 WORD32 ctb_x, 143 WORD32 ctb_y, 144 WORD32 poc, 145 WORD32 cur_slice_qp, 146 WORD32 max_merge_candidates, 147 WORD32 i4_rc_pass_num, 148 WORD32 i4_quality_preset, 149 WORD32 stasino_enabled); 150 151 WORD32 ihevce_insert_entry_offset_slice_header( 152 bitstrm_t *ps_bitstrm, 153 slice_header_t *ps_slice_hdr, 154 pps_t *ps_pps, 155 UWORD32 u4_first_slice_start_offset); 156 157 #endif // _IHEVCE_ENCODE_HEADER_H_ 158