xref: /aosp_15_r20/external/libxaac/decoder/ixheaacd_block.h (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
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(
113     ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info[], WORD32 channel,
114     ia_aac_dec_tables_struct *ptr_aac_tables);
115 
116 VOID ixheaacd_spec_to_overlapbuf_dec(WORD32 *ptr_overlap_buf,
117                                      WORD32 *ptr_spec_coeff, WORD32 q_shift,
118                                      WORD32 size);
119 
120 VOID ixheaacd_spec_to_overlapbuf_armv7(WORD32 *ptr_overlap_buf,
121                                        WORD32 *ptr_spec_coeff, WORD32 q_shift,
122                                        WORD32 size);
123 
124 VOID ixheaacd_overlap_buf_out_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf,
125                                   WORD32 size, const WORD16 ch_fac);
126 
127 VOID ixheaacd_overlap_buf_out_armv7(WORD32 *out_samples,
128                                     WORD32 *ptr_overlap_buf, WORD32 size,
129                                     const WORD16 ch_fac);
130 
131 WORD32 ixheaacd_inv_quant(WORD32 *x_quant, WORD32 *ixheaacd_pow_table_Q13);
132 
133 VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info,
134                             WORD32 *ptr_spec_coeff,
135                             ia_ics_info_struct *ptr_ics_info, VOID *out_samples,
136                             const WORD16 ch_fac, WORD32 *scratch,
137                             ia_aac_dec_tables_struct *ptr_aac_tables,
138                             WORD32 object_type, WORD32 ld_mps_present,
139                             WORD slot_element);
140 
141 VOID ixheaacd_neg_shift_spec_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift,
142                                  WORD16 ch_fac);
143 
144 VOID ixheaacd_nolap_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift,
145                         WORD16 ch_fac, WORD16 size_01);
146 
147 VOID ixheaacd_neg_shift_spec_armv7(WORD32 *coef, WORD32 *out, WORD16 q_shift,
148                                    WORD16 ch_fac);
149 
150 VOID ixheaacd_neg_shift_spec_armv8(WORD32 *coef, WORD32 *out, WORD16 q_shift,
151                                    WORD16 ch_fac);
152 
153 VOID ixheaacd_nolap1_32(WORD32 *coef, WORD32 *out, WORD16 cu_scale,
154                         WORD16 stride, WORD16 size_01);
155 
156 VOID ixheaacd_overlap_out_copy_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf,
157                                    WORD32 *ptr_overlap_buf1,
158                                    const WORD16 ch_fac, WORD16 size_01);
159 
160 VOID ixheaacd_overlap_out_copy_armv7(WORD32 *out_samples,
161                                      WORD32 *ptr_overlap_buf,
162                                      WORD32 *ptr_overlap_buf1,
163                                      const WORD16 ch_fac);
164 
165 VOID ixheaacd_long_short_win_seq(WORD32 *current, WORD32 *prev, WORD32 *out,
166                                  const WORD16 *short_window,
167                                  const WORD16 *short_window_prev,
168                                  const WORD16 *long_window_prev, WORD16 q_shift,
169                                  WORD16 ch_fac, WORD16 size_01);
170 
171 WORD32 ixheaacd_cnt_leading_ones(WORD32 a);
172 
173 VOID ixheaacd_huffman_decode(WORD32 it_bit_buff, WORD16 *huff_index,
174                              WORD16 *len, const UWORD16 *input_table,
175                              const UWORD32 *idx_table);
176 
177 VOID ixheaacd_eld_dec_windowing(WORD32 *ptr_spect_coeff, const WORD16 *ptr_win,
178                                 WORD32 framesize, WORD16 q_shift,
179                                 WORD32 *ptr_overlap_buf, const WORD16 stride,
180                                 VOID *out_samples, WORD slot_element);
181 
182 VOID ixheaacd_eld_dec_windowing_32bit(WORD32 *ptr_spect_coeff,
183                                       const WORD16 *ptr_win, WORD32 framesize,
184                                       WORD16 q_shift, WORD32 *ptr_overlap_buf,
185                                       const WORD16 stride, WORD32 *out_samples);
186 
187 VOID ixheaacd_process_single_scf(WORD32 scale_factor, WORD32 *x_invquant,
188                                  WORD32 width, WORD32 *ptr_scale_table,
189                                  WORD32 total_channels, WORD32 object_type,
190                                  WORD32 aac_sf_data_resil_flag);
191 
192 VOID ixheaacd_lap1_512_480(WORD32 *coef, WORD32 *prev, VOID *out_tmp,
193                            const WORD16 *window, WORD16 q_shift, WORD16 size,
194                            WORD16 stride, WORD slot_element);
195 
196 VOID ixheaacd_dec_copy_outsample(WORD32 *out_samples, WORD32 *p_overlap_buffer,
197                                  WORD32 size, WORD16 stride);
198 
199 #endif /* #ifndef IXHEAACD_BLOCK_H */
200