1 /****************************************************************************** 2 * * 3 * Copyright (C) 2023 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 #pragma once 22 #define COUPLING_1 (1) 23 24 typedef struct { 25 WORD32 offset; 26 WORD32 update; 27 WORD32 num_scf[2]; 28 WORD32 sfb_nrg_prev[MAXIMUM_FREQ_COEFFS]; 29 WORD32 delta_t_across_frames; 30 FLOAT32 df_edge_1st_env; 31 FLOAT32 df_edge_incr; 32 WORD32 df_edge_incr_fac; 33 34 WORD32 code_book_scf_lav_time; 35 WORD32 code_book_scf_lav_freq; 36 37 WORD32 code_book_scf_lav_lvl_time; 38 WORD32 code_book_scf_lav_lvl_freq; 39 WORD32 code_book_scf_lav_bal_time; 40 WORD32 code_book_scf_lav_bal_freq; 41 42 WORD32 start_bits; 43 WORD32 start_bits_balance; 44 45 const UWORD8 *ptr_huff_tab_time_l; 46 const UWORD8 *ptr_huff_tab_freq_l; 47 48 const UWORD8 *ptr_huff_tab_lvl_time_l; 49 const UWORD8 *ptr_huff_tab_bal_time_l; 50 const UWORD8 *ptr_huff_tab_lvl_freq_l; 51 const UWORD8 *ptr_huff_tab_bal_freq_l; 52 } ixheaace_str_sbr_code_envelope; 53 54 typedef ixheaace_str_sbr_code_envelope *ixheaace_pstr_sbr_code_envelope; 55 struct ixheaace_str_sbr_env_data; 56 57 IA_ERRORCODE ixheaace_code_envelope(WORD32 *ptr_sfb_energy, const ixheaace_freq_res *freq_res, 58 ixheaace_str_sbr_code_envelope *pstr_code_env, 59 WORD32 *ptr_dir_vec, WORD32 coupling, WORD32 num_envelopes, 60 WORD32 channel, WORD32 header_active, WORD32 usac_indep_flag, 61 WORD32 is_ld_sbr); 62 63 VOID ixheaace_create_sbr_code_envelope(ixheaace_pstr_sbr_code_envelope pstr_code_env, 64 WORD32 *num_sfb, WORD32 delta_t_across_frames, 65 FLOAT32 df_edge_first_env, FLOAT32 df_edge_incr); 66 67 IA_ERRORCODE 68 ixheaace_init_sbr_huffman_tabs(struct ixheaace_str_sbr_env_data *pstr_sbr_env, 69 ixheaace_pstr_sbr_code_envelope pstr_code_env, 70 ixheaace_pstr_sbr_code_envelope pstr_noise, 71 ixheaace_amp_res amp_res, 72 ixheaace_str_sbr_huff_tabs *pstr_sbr_huff_tabs); 73 74 VOID ixheaace_map_low_res_energy_value(WORD32 curr_val, WORD32 *ptr_prev_data, WORD32 offset, 75 WORD32 index, ixheaace_freq_res res); 76 77 IA_ERRORCODE 78 ixheaace_compute_bits(WORD32 delta, WORD32 code_book_scf_lav_lvl, 79 WORD32 code_book_scf_lav_balance, const UWORD8 *ptr_huff_tbl_lvl, 80 const UWORD8 *ptr_huff_tbl_bal, WORD32 coupling, WORD32 ch, 81 WORD32 *ptr_delta_bits); 82