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 #ifndef IXHEAACD_BLOCK_H 21 #define IXHEAACD_BLOCK_H 22 23 #define IQ_TABLE_SIZE_HALF 128 24 25 VOID ixheaacd_inverse_quantize(WORD32 *x_invquant, WORD no_band, 26 WORD32 *ixheaacd_pow_table_Q13, 27 WORD8 *scratch_in); 28 29 VOID ixheaacd_scale_factor_process_dec(WORD32 *x_invquant, WORD16 *scale_fact, 30 WORD no_band, WORD8 *width, 31 WORD32 *scale_tables_ptr, 32 WORD32 total_channels, 33 WORD32 object_type, 34 WORD32 aac_sf_data_resil_flag); 35 36 VOID ixheaacd_scale_factor_process_armv7(WORD32 *x_invquant, WORD16 *scale_fact, 37 WORD no_band, WORD8 *width, 38 WORD32 *scale_tables_ptr, 39 WORD32 total_channels, 40 WORD32 object_type, 41 WORD32 aac_sf_data_resil_flag); 42 43 VOID ixheaacd_scale_factor_process_armv8(WORD32 *x_invquant, WORD16 *scale_fact, 44 WORD no_band, WORD8 *width, 45 WORD32 *scale_tables_ptr, 46 WORD32 total_channels, 47 WORD32 object_type, 48 WORD32 aac_sf_data_resil_flag); 49 50 VOID ixheaacd_right_shift_block(WORD32 *p_spectrum, WORD length, 51 WORD shift_val); 52 53 WORD ixheaacd_decode_huffman(ia_bit_buf_struct *it_bit_buff, WORD32 cb_no, 54 WORD32 *spec_coef, WORD16 *sfb_offset, WORD start, 55 WORD sfb, WORD group_len, 56 ia_aac_dec_tables_struct *ptr_aac_tables, 57 WORD32 maximum_bins_short); 58 59 WORD ixheaacd_huffman_dec_word2(ia_bit_buf_struct *it_bit_buff, WORD32 cb_no, 60 WORD32 width, 61 ia_aac_dec_tables_struct *ptr_aac_tables, 62 WORD32 *x_invquant, WORD8 *scratch_ptr); 63 64 VOID ixheaacd_read_scale_factor_data( 65 ia_bit_buf_struct *it_bit_buff, 66 ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, 67 ia_aac_dec_tables_struct *ptr_aac_tables, WORD32 object_type); 68 69 IA_ERRORCODE ixheaacd_read_spectral_data( 70 ia_bit_buf_struct *it_bit_buff, 71 ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, 72 ia_aac_dec_tables_struct *ptr_aac_tables, WORD32 total_channels, 73 WORD32 frame_size, WORD32 object_type, WORD32 aac_spect_data_resil_flag, 74 WORD32 aac_sf_data_resil_flag); 75 76 IA_ERRORCODE ixheaacd_read_section_data( 77 ia_bit_buf_struct *it_bit_buff, 78 ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, 79 WORD32 aac_spect_data_resil_flag, WORD32 aac_sect_data_resil_flag, 80 ia_aac_dec_tables_struct *ptr_aac_tables); 81 82 VOID ixheaacd_over_lap_add1_dec(WORD32 *coef, WORD32 *prev, WORD32 *out, 83 const WORD16 *window, WORD16 q_shift, 84 WORD16 size, WORD16 ch_fac); 85 86 VOID ixheaacd_over_lap_add1_armv7(WORD32 *coef, WORD32 *prev, WORD32 *out, 87 const WORD16 *window, WORD16 q_shift, 88 WORD16 size, WORD16 ch_fac); 89 90 VOID ixheaacd_over_lap_add1_armv8(WORD32 *coef, WORD32 *prev, WORD32 *out, 91 const WORD16 *window, WORD16 q_shift, 92 WORD16 size, WORD16 ch_fac); 93 94 VOID ixheaacd_over_lap_add2_dec(WORD32 *coef, WORD32 *prev, WORD32 *out, 95 const WORD16 *window, WORD16 q_shift, 96 WORD16 size, WORD16 ch_fac); 97 98 VOID ixheaacd_over_lap_add2_armv7(WORD32 *coef, WORD32 *prev, WORD32 *out, 99 const WORD16 *window, WORD16 q_shift, 100 WORD16 size, WORD16 ch_fac); 101 102 VOID ixheaacd_over_lap_add2_armv8(WORD32 *coef, WORD32 *prev, WORD32 *out, 103 const WORD16 *window, WORD16 q_shift, 104 WORD16 size, WORD16 ch_fac); 105 106 VOID ixheaacd_set_corr_info( 107 ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, WORD16 pns_band); 108 109 VOID ixheaacd_gen_rand_vec(WORD32 scale, WORD shift, WORD32 *spec, 110 WORD32 sfb_width, WORD32 *random_vec); 111 112 VOID ixheaacd_pns_process(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info[CHANNELS], 113 WORD32 channel, ia_aac_dec_tables_struct *ptr_aac_tables); 114 115 VOID ixheaacd_spec_to_overlapbuf_dec(WORD32 *ptr_overlap_buf, 116 WORD32 *ptr_spec_coeff, WORD32 q_shift, 117 WORD32 size); 118 119 VOID ixheaacd_spec_to_overlapbuf_armv7(WORD32 *ptr_overlap_buf, 120 WORD32 *ptr_spec_coeff, WORD32 q_shift, 121 WORD32 size); 122 123 VOID ixheaacd_overlap_buf_out_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf, 124 WORD32 size, const WORD16 ch_fac); 125 126 VOID ixheaacd_overlap_buf_out_armv7(WORD32 *out_samples, 127 WORD32 *ptr_overlap_buf, WORD32 size, 128 const WORD16 ch_fac); 129 130 WORD32 ixheaacd_inv_quant(WORD32 *x_quant, WORD32 *ixheaacd_pow_table_Q13); 131 132 VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info, 133 WORD32 *ptr_spec_coeff, 134 ia_ics_info_struct *ptr_ics_info, VOID *out_samples, 135 const WORD16 ch_fac, WORD32 *scratch, 136 ia_aac_dec_tables_struct *ptr_aac_tables, 137 WORD32 object_type, WORD32 ld_mps_present, 138 WORD slot_element); 139 140 VOID ixheaacd_neg_shift_spec_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift, 141 WORD16 ch_fac); 142 143 VOID ixheaacd_nolap_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift, 144 WORD16 ch_fac, WORD16 size_01); 145 146 VOID ixheaacd_neg_shift_spec_armv7(WORD32 *coef, WORD32 *out, WORD16 q_shift, 147 WORD16 ch_fac); 148 149 VOID ixheaacd_neg_shift_spec_armv8(WORD32 *coef, WORD32 *out, WORD16 q_shift, 150 WORD16 ch_fac); 151 152 VOID ixheaacd_nolap1_32(WORD32 *coef, WORD32 *out, WORD16 cu_scale, 153 WORD16 stride, WORD16 size_01); 154 155 VOID ixheaacd_overlap_out_copy_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf, 156 WORD32 *ptr_overlap_buf1, 157 const WORD16 ch_fac, WORD16 size_01); 158 159 VOID ixheaacd_overlap_out_copy_armv7(WORD32 *out_samples, 160 WORD32 *ptr_overlap_buf, 161 WORD32 *ptr_overlap_buf1, 162 const WORD16 ch_fac); 163 164 VOID ixheaacd_long_short_win_seq(WORD32 *current, WORD32 *prev, WORD32 *out, 165 const WORD16 *short_window, 166 const WORD16 *short_window_prev, 167 const WORD16 *long_window_prev, WORD16 q_shift, 168 WORD16 ch_fac, WORD16 size_01); 169 170 WORD32 ixheaacd_cnt_leading_ones(WORD32 a); 171 172 VOID ixheaacd_huffman_decode(WORD32 it_bit_buff, WORD16 *huff_index, 173 WORD16 *len, const UWORD16 *input_table, 174 const UWORD32 *idx_table); 175 176 VOID ixheaacd_eld_dec_windowing(WORD32 *ptr_spect_coeff, const WORD16 *ptr_win, 177 WORD32 framesize, WORD16 q_shift, 178 WORD32 *ptr_overlap_buf, const WORD16 stride, 179 VOID *out_samples, WORD slot_element); 180 181 VOID ixheaacd_eld_dec_windowing_32bit(WORD32 *ptr_spect_coeff, 182 const WORD16 *ptr_win, WORD32 framesize, 183 WORD16 q_shift, WORD32 *ptr_overlap_buf, 184 const WORD16 stride, WORD32 *out_samples); 185 186 VOID ixheaacd_process_single_scf(WORD32 scale_factor, WORD32 *x_invquant, 187 WORD32 width, WORD32 *ptr_scale_table, 188 WORD32 total_channels, WORD32 object_type, 189 WORD32 aac_sf_data_resil_flag); 190 191 VOID ixheaacd_lap1_512_480(WORD32 *coef, WORD32 *prev, VOID *out_tmp, 192 const WORD16 *window, WORD16 q_shift, WORD16 size, 193 WORD16 stride, WORD slot_element); 194 195 VOID ixheaacd_dec_copy_outsample(WORD32 *out_samples, WORD32 *p_overlap_buffer, 196 WORD32 size, WORD16 stride); 197 198 #endif /* #ifndef IXHEAACD_BLOCK_H */ 199