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 23 #define IXHEAACE_SBR_TRAN_ABS_THR (128000.0f) 24 #define IXHEAACE_SBR_TRAN_STD_FAC (1.0f) 25 #define IXHEAACE_SBR_ENERGY_THRESHOLD (65536 * 31) 26 27 #define IXHEAACE_TRANSIENT_THRESHOLD (5.0f) 28 #define IXHEAACE_SMALL_ENERGY (1e-2f) 29 30 typedef struct { 31 FLOAT32 sbr_transients[3 * QMF_TIME_SLOTS_USAC_4_1]; 32 FLOAT32 *ptr_transients; 33 FLOAT32 sbr_thresholds[IXHEAACE_QMF_CHANNELS]; 34 FLOAT32 *ptr_thresholds; 35 FLOAT32 tran_thr; 36 FLOAT32 split_thr; 37 WORD32 tran_fc; 38 WORD32 buffer_length; 39 WORD32 no_cols; 40 WORD32 no_rows; 41 WORD32 mode; 42 FLOAT32 prev_low_band_energy; 43 FLOAT32 delta_energy[34]; 44 FLOAT32 energy[34]; 45 FLOAT32 coeff[64]; 46 WORD32 energy_slots[34]; 47 WORD32 delta_slots[34]; 48 WORD32 buffer_size; 49 WORD32 look_ahead; 50 WORD32 time_slots; 51 WORD32 start_band; 52 WORD32 stop_band; 53 } ixheaace_str_sbr_trans_detector; 54 55 typedef ixheaace_str_sbr_trans_detector *ixheaace_pstr_sbr_trans_detector; 56 57 VOID ixheaace_detect_transient(FLOAT32 **ptr_energies, 58 ixheaace_pstr_sbr_trans_detector pstr_sbr_trans_det, 59 WORD32 *ptr_tran_vector, WORD32 time_step, 60 ixheaace_sbr_codec_type sbr_codec); 61 62 VOID ixheaace_detect_transient_eld(FLOAT32 **ptr_energies, 63 ixheaace_pstr_sbr_trans_detector pstr_sbr_trans_det, 64 WORD32 *ptr_tran_vector); 65 66 VOID ixheaace_create_sbr_transient_detector( 67 ixheaace_pstr_sbr_trans_detector pstr_sbr_trans_detector, WORD32 sample_freq, 68 WORD32 total_bitrate, WORD32 codec_bitrate, WORD32 tran_thr, WORD32 mode, WORD32 tran_fc, 69 WORD32 frame_flag_480, WORD32 is_ld_sbr, WORD32 sbr_ratio_idx, 70 ixheaace_sbr_codec_type sbr_codec, WORD32 start_band); 71 72 IA_ERRORCODE 73 ixheaace_frame_splitter(FLOAT32 **ptr_energies, 74 ixheaace_pstr_sbr_trans_detector pstr_sbr_trans_detector, 75 UWORD8 *ptr_freq_band_tab, WORD32 num_scf, WORD32 time_step, 76 WORD32 no_cols, WORD32 *ptr_tran_vector, 77 FLOAT32 *ptr_frame_splitter_scratch, WORD32 is_ld_sbr); 78