Home | History | Annotate | Download | only in generic
      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 #include <stdio.h>
     21 #include <string.h>
     22 #include "ixheaacd_sbr_common.h"
     23 #include <ixheaacd_type_def.h>
     24 
     25 #include "ixheaacd_constants.h"
     26 #include <ixheaacd_basic_ops32.h>
     27 #include <ixheaacd_basic_ops16.h>
     28 #include <ixheaacd_basic_ops40.h>
     29 #include "ixheaacd_basic_ops.h"
     30 
     31 #include <ixheaacd_basic_op.h>
     32 #include "ixheaacd_intrinsics.h"
     33 #include "ixheaacd_common_rom.h"
     34 #include "ixheaacd_sbrdecsettings.h"
     35 #include "ixheaacd_bitbuffer.h"
     36 #include "ixheaacd_defines.h"
     37 
     38 #include "ixheaacd_pns.h"
     39 
     40 #include <ixheaacd_aac_rom.h>
     41 #include "ixheaacd_aac_imdct.h"
     42 #include "ixheaacd_pulsedata.h"
     43 
     44 #include "ixheaacd_drc_data_struct.h"
     45 
     46 #include "ixheaacd_lt_predict.h"
     47 
     48 #include "ixheaacd_channelinfo.h"
     49 #include "ixheaacd_drc_dec.h"
     50 
     51 #include "ixheaacd_sbrdecoder.h"
     52 #include "ixheaacd_tns.h"
     53 #include "ixheaacd_sbr_scale.h"
     54 #include "ixheaacd_lpp_tran.h"
     55 #include "ixheaacd_env_extr_part.h"
     56 #include <ixheaacd_sbr_rom.h>
     57 #include "ixheaacd_block.h"
     58 #include "ixheaacd_hybrid.h"
     59 #include "ixheaacd_ps_dec.h"
     60 #include "ixheaacd_env_extr.h"
     61 #include "ixheaacd_basic_funcs.h"
     62 #include "ixheaacd_env_calc.h"
     63 #include "ixheaacd_interface.h"
     64 #include "ixheaacd_dsp_fft32x32s.h"
     65 #if !__ARM_NEON__
     66 
     67 WORD32 (*ixheaacd_fix_div)(WORD32, WORD32) = &ixheaacd_fix_div_dec;
     68 
     69 VOID(*ixheaacd_covariance_matrix_calc)
     70 (WORD32 *, ixheaacd_lpp_trans_cov_matrix *,
     71  WORD32) = &ixheaacd_covariance_matrix_calc_dec;
     72 
     73 VOID(*ixheaacd_covariance_matrix_calc_2)
     74 (ixheaacd_lpp_trans_cov_matrix *, WORD32 *, WORD32,
     75  WORD16) = &ixheaacd_covariance_matrix_calc_2_dec;
     76 
     77 VOID(*ixheaacd_over_lap_add1)
     78 (WORD32 *, WORD32 *, WORD16 *, const WORD16 *, WORD16, WORD16,
     79  WORD16) = &ixheaacd_over_lap_add1_dec;
     80 
     81 VOID(*ixheaacd_over_lap_add2)
     82 (WORD32 *, WORD32 *, WORD32 *, const WORD16 *, WORD16, WORD16,
     83  WORD16) = &ixheaacd_over_lap_add2_dec;
     84 
     85 VOID(*ixheaacd_decorr_filter2)
     86 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_buf_left_real, WORD32 *p_buf_left_imag,
     87  WORD32 *p_buf_right_real, WORD32 *p_buf_right_imag,
     88  ia_ps_tables_struct *ps_tables_ptr,
     89  WORD16 *transient_ratio) = &ixheaacd_decorr_filter2_dec;
     90 
     91 VOID(*ixheaacd_decorr_filter1)
     92 (ia_ps_dec_struct *ptr_ps_dec, ia_ps_tables_struct *ps_tables_ptr,
     93  WORD16 *transient_ratio) = &ixheaacd_decorr_filter1_dec;
     94 
     95 WORD32(*ixheaacd_divide16_pos)
     96 (WORD32 op1, WORD32 op2) = &ixheaacd_divide16_pos_dec;
     97 
     98 VOID(*ixheaacd_decorrelation)
     99 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_buf_left_real, WORD32 *p_buf_left_imag,
    100  WORD32 *p_buf_right_real, WORD32 *p_buf_right_imag,
    101  ia_ps_tables_struct *ps_tables_ptr) = &ixheaacd_decorrelation_dec;
    102 
    103 VOID(*ixheaacd_apply_rot)
    104 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_qmf_left_re, WORD32 *p_qmf_left_im,
    105  WORD32 *p_qmf_right_re, WORD32 *p_qmf_right_im,
    106  ia_sbr_tables_struct *sbr_tables_ptr,
    107  const WORD16 *ptr_res) = &ixheaacd_apply_rot_dec;
    108 
    109 VOID(*ixheaacd_conv_ergtoamplitudelp)
    110 (WORD32 bands, WORD16 noise_e, WORD16 *nrg_sine, WORD16 *nrg_gain,
    111  WORD16 *noise_level_mant,
    112  WORD16 *sqrt_table) = &ixheaacd_conv_ergtoamplitudelp_dec;
    113 
    114 VOID(*ixheaacd_conv_ergtoamplitude)
    115 (WORD32 bands, WORD16 noise_e, WORD16 *nrg_sine, WORD16 *nrg_gain,
    116  WORD16 *noise_level_mant,
    117  WORD16 *sqrt_table) = &ixheaacd_conv_ergtoamplitude_dec;
    118 
    119 VOID(*ixheaacd_adjust_scale)
    120 (WORD32 **re, WORD32 **im, WORD32 sub_band_start, WORD32 sub_band_end,
    121  WORD32 start_pos, WORD32 next_pos, WORD32 shift,
    122  FLAG low_pow_flag) = &ixheaacd_adjust_scale_dec;
    123 
    124 WORD16(*ixheaacd_ixheaacd_expsubbandsamples)
    125 (WORD32 **re, WORD32 **im, WORD32 sub_band_start, WORD32 sub_band_end,
    126  WORD32 start_pos, WORD32 next_pos,
    127  FLAG low_pow_flag) = &ixheaacd_expsubbandsamples_dec;
    128 
    129 VOID(*ixheaacd_enery_calc_per_subband)
    130 (WORD32 start_pos, WORD32 next_pos, WORD32 sub_band_start, WORD32 sub_band_end,
    131  WORD32 frame_exp, WORD16 *nrg_est_mant, FLAG low_pow_flag,
    132  ia_sbr_tables_struct *ptr_sbr_tables,
    133  WORD32 *ptr_qmf_matrix) = &ixheaacd_enery_calc_per_subband_dec;
    134 
    135 VOID(*ixheaacd_harm_idx_zerotwolp)
    136 (WORD32 *ptr_real_buf, WORD16 *ptr_gain_buf, WORD32 scale_change,
    137  WORD16 *ptr_sine_level_buf, const WORD32 *ptr_rand_ph,
    138  WORD16 *noise_level_mant, WORD32 num_sub_bands, FLAG noise_absc_flag,
    139  WORD32 harm_index) = &ixheaacd_harm_idx_zerotwolp_dec;
    140 
    141 VOID(*ixheaacd_tns_ar_filter_fixed)
    142 (WORD32 *spectrum, WORD32 size, WORD32 inc, WORD32 *lpc, WORD32 order,
    143  WORD32 shift_value, WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_dec;
    144 
    145 VOID(*ixheaacd_tns_ar_filter)
    146 (WORD32 *spectrum, WORD32 size, WORD32 inc, WORD16 *lpc, WORD32 order,
    147  WORD32 shift_value, WORD scale_spec,
    148  WORD32 *ptr_filter_state) = &ixheaacd_tns_ar_filter_dec;
    149 
    150 VOID(*ixheaacd_tns_parcor_lpc_convert)
    151 (WORD16 *parcor, WORD16 *lpc, WORD16 *scale,
    152  WORD order) = &ixheaacd_tns_parcor_lpc_convert_dec;
    153 
    154 WORD32(*ixheaacd_calc_max_spectral_line)
    155 (WORD32 *ptr_tmp, WORD32 size) = &ixheaacd_calc_max_spectral_line_dec;
    156 
    157 VOID(*ixheaacd_post_twiddle)
    158 (WORD32 out_ptr[], WORD32 spec_data[],
    159  ia_aac_dec_imdct_tables_struct *ptr_imdct_tables,
    160  WORD npoints) = &ixheaacd_post_twiddle_dec;
    161 
    162 VOID(*ixheaacd_post_twid_overlap_add)
    163 (WORD16 pcm_out[], WORD32 spec_data[],
    164  ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD npoints,
    165  WORD32 *ptr_overlap_buf, WORD16 q_shift, const WORD16 *window,
    166  WORD16 ch_fac) = &ixheaacd_post_twid_overlap_add_dec;
    167 
    168 VOID(*ixheaacd_neg_shift_spec)
    169 (WORD32 *coef, WORD16 *out, WORD16 q_shift,
    170  WORD16 ch_fac) = &ixheaacd_neg_shift_spec_dec;
    171 
    172 VOID(*ixheaacd_spec_to_overlapbuf)
    173 (WORD32 *ptr_overlap_buf, WORD32 *ptr_spec_coeff, WORD32 q_shift,
    174  WORD32 size) = &ixheaacd_spec_to_overlapbuf_dec;
    175 
    176 VOID(*ixheaacd_overlap_buf_out)
    177 (WORD16 *out_samples, WORD32 *ptr_overlap_buf, WORD32 size,
    178  const WORD16 ch_fac) = &ixheaacd_overlap_buf_out_dec;
    179 
    180 VOID(*ixheaacd_overlap_out_copy)
    181 (WORD16 *out_samples, WORD32 *ptr_overlap_buf, WORD32 *ptr_overlap_buf1,
    182  const WORD16 ch_fac) = &ixheaacd_overlap_out_copy_dec;
    183 
    184 VOID(*ixheaacd_pretwiddle_compute)
    185 (WORD32 *spec_data1, WORD32 *spec_data2, WORD32 *out_ptr,
    186  ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD npoints4,
    187  WORD32 neg_expo) = &ixheaacd_pretwiddle_compute_dec;
    188 
    189 VOID(*ixheaacd_imdct_using_fft)
    190 (ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD32 npoints,
    191  WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_imdct_using_fft_dec;
    192 
    193 VOID(*ixheaacd_complex_fft_p2)
    194 (WORD32 *xr, WORD32 *xi, WORD32 nlength, WORD32 fft_mode,
    195  WORD32 *preshift) = &ixheaacd_complex_fft_p2_dec;
    196 
    197 VOID(*ixheaacd_mps_complex_fft_64)
    198 (WORD32 *ptr_x, WORD32 *fin_re, WORD32 *fin_im,
    199  WORD32 nlength) = &ixheaacd_mps_complex_fft_64_dec;
    200 
    201 VOID(*ixheaacd_mps_synt_pre_twiddle)
    202 (WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
    203  WORD32 resolution) = &ixheaacd_mps_synt_pre_twiddle_dec;
    204 
    205 VOID(*ixheaacd_mps_synt_post_twiddle)
    206 (WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
    207  WORD32 resolution) = &ixheaacd_mps_synt_post_twiddle_dec;
    208 
    209 VOID(*ixheaacd_calc_pre_twid)
    210 (WORD32 *ptr_x, WORD32 *r_ptr, WORD32 *i_ptr, WORD32 nlength,
    211  const WORD32 *cos_ptr, const WORD32 *sin_ptr) = &ixheaacd_calc_pre_twid_dec;
    212 
    213 VOID(*ixheaacd_calc_post_twid)
    214 (WORD32 *ptr_x, WORD32 *r_ptr, WORD32 *i_ptr, WORD32 nlength,
    215  const WORD32 *cos_ptr, const WORD32 *sin_ptr) = &ixheaacd_calc_post_twid_dec;
    216 
    217 VOID(*ixheaacd_mps_synt_post_fft_twiddle)
    218 (WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, WORD32 *table_re,
    219  WORD32 *table_im, WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_dec;
    220 
    221 VOID(*ixheaacd_mps_synt_out_calc)
    222 (WORD32 resolution, WORD32 *out, WORD32 *state,
    223  const WORD32 *filter_coeff) = &ixheaacd_mps_synt_out_calc_dec;
    224 
    225 VOID(*ixheaacd_fft_15_ld)
    226 (WORD32 *inp, WORD32 *op, WORD32 *fft3out,
    227  UWORD8 *re_arr_tab_sml_240_ptr) = &ixheaacd_fft_15_ld_dec;
    228 
    229 VOID(*ixheaacd_aac_ld_dec_rearrange)
    230 (WORD32 *ip, WORD32 *op, WORD32 mdct_len_2,
    231  UWORD8 *re_arr_tab) = &ixheaacd_rearrange_dec;
    232 
    233 VOID(*ixheaacd_fft32x32_ld)
    234 (ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
    235  WORD32 *ptr_x, WORD32 *ptr_y) = ixheaacd_fft32x32_ld_dec;
    236 
    237 VOID(*ixheaacd_fft32x32_ld2)
    238 (ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
    239  WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_fft32x32_ld_dec;
    240 
    241 WORD16 (*ixheaacd_neg_expo_inc)(WORD16 neg_expo) = &ixheaacd_neg_expo_inc_dec;
    242 
    243 VOID(*ixheaacd_inv_dit_fft_8pt)
    244 (WORD32 *x, WORD32 *real, WORD32 *imag) = &ixheaacd_inv_dit_fft_8pt_dec;
    245 
    246 VOID(*ixheaacd_scale_factor_process)
    247 (WORD32 *x_invquant, WORD16 *scale_fact, WORD no_band, WORD8 *width,
    248  WORD32 *scale_tables_ptr, WORD32 total_channels, WORD32 object_type,
    249  WORD32 aac_sf_data_resil_flag) = &ixheaacd_scale_factor_process_dec;
    250 
    251 #endif
    252 
    253