1*15dc779aSAndroid Build Coastguard Worker /****************************************************************************** 2*15dc779aSAndroid Build Coastguard Worker * * 3*15dc779aSAndroid Build Coastguard Worker * Copyright (C) 2023 The Android Open Source Project 4*15dc779aSAndroid Build Coastguard Worker * 5*15dc779aSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 6*15dc779aSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 7*15dc779aSAndroid Build Coastguard Worker * You may obtain a copy of the License at: 8*15dc779aSAndroid Build Coastguard Worker * 9*15dc779aSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 10*15dc779aSAndroid Build Coastguard Worker * 11*15dc779aSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 12*15dc779aSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 13*15dc779aSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*15dc779aSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 15*15dc779aSAndroid Build Coastguard Worker * limitations under the License. 16*15dc779aSAndroid Build Coastguard Worker * 17*15dc779aSAndroid Build Coastguard Worker ***************************************************************************** 18*15dc779aSAndroid Build Coastguard Worker * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19*15dc779aSAndroid Build Coastguard Worker */ 20*15dc779aSAndroid Build Coastguard Worker 21*15dc779aSAndroid Build Coastguard Worker #pragma once 22*15dc779aSAndroid Build Coastguard Worker 23*15dc779aSAndroid Build Coastguard Worker typedef struct { 24*15dc779aSAndroid Build Coastguard Worker FLOAT32 norm_pe_fac; /* factor to normalize input PE, depends on bitrate and bandwidth */ 25*15dc779aSAndroid Build Coastguard Worker FLOAT32 inc_stereo_attenuation; /* att. increment parameter */ 26*15dc779aSAndroid Build Coastguard Worker FLOAT32 dec_stereo_attenuation; /* att. decrement parameter */ 27*15dc779aSAndroid Build Coastguard Worker FLOAT32 average_freq_energy_l; /* energy left */ 28*15dc779aSAndroid Build Coastguard Worker FLOAT32 average_freq_energy_r; /* energy right */ 29*15dc779aSAndroid Build Coastguard Worker FLOAT32 average_freq_energy_m; /* energy mid */ 30*15dc779aSAndroid Build Coastguard Worker FLOAT32 average_freq_energy_s; /* energy side */ 31*15dc779aSAndroid Build Coastguard Worker FLOAT32 smoothed_pe_sum_sum; /* time-smoothed PE */ 32*15dc779aSAndroid Build Coastguard Worker FLOAT32 avg_s_to_m; /* time-smoothed energy ratio S/M [dB] */ 33*15dc779aSAndroid Build Coastguard Worker FLOAT32 last_l_to_r; /* previous frame energy ratio L/R [dB] */ 34*15dc779aSAndroid Build Coastguard Worker FLOAT32 last_nrg_lr; /* previous frame energy L+R */ 35*15dc779aSAndroid Build Coastguard Worker FLOAT32 impact_factor; /* bitrate dependent parameter */ 36*15dc779aSAndroid Build Coastguard Worker FLOAT32 stereo_attenuation; /* the actual attenuation of this frame */ 37*15dc779aSAndroid Build Coastguard Worker FLOAT32 stereo_attenuation_fac; /* the actual attenuation factor of this frame */ 38*15dc779aSAndroid Build Coastguard Worker /* tuning parameters that are not varied from frame to frame but initialized at init */ 39*15dc779aSAndroid Build Coastguard Worker WORD32 stereo_attenuation_flag; /* flag to indicate usage */ 40*15dc779aSAndroid Build Coastguard Worker FLOAT32 const_attenuation; /* if not zero, a constant att. will be applied [dB]*/ 41*15dc779aSAndroid Build Coastguard Worker FLOAT32 stereo_attenuation_max; /* the max. attenuation [dB]*/ 42*15dc779aSAndroid Build Coastguard Worker FLOAT32 lr_min; /* tuning parameter [dB] */ 43*15dc779aSAndroid Build Coastguard Worker FLOAT32 lr_max; /* tuning parameter [dB] */ 44*15dc779aSAndroid Build Coastguard Worker FLOAT32 sm_min; /* tuning parameter [dB] */ 45*15dc779aSAndroid Build Coastguard Worker FLOAT32 sm_max; /* tuning parameter [dB] */ 46*15dc779aSAndroid Build Coastguard Worker FLOAT32 pe_min; /* tuning parameter */ 47*15dc779aSAndroid Build Coastguard Worker FLOAT32 pe_crit; /* tuning parameter */ 48*15dc779aSAndroid Build Coastguard Worker FLOAT32 pe_impact_max; /* tuning parameter */ 49*15dc779aSAndroid Build Coastguard Worker } ixheaace_stereo_pre_pro_struct; 50*15dc779aSAndroid Build Coastguard Worker 51*15dc779aSAndroid Build Coastguard Worker typedef ixheaace_stereo_pre_pro_struct *ixheaace_stereo_pre_pro_pstr; 52*15dc779aSAndroid Build Coastguard Worker 53*15dc779aSAndroid Build Coastguard Worker IA_ERRORCODE iaace_init_stereo_pre_processing(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 54*15dc779aSAndroid Build Coastguard Worker WORD32 no_channels, WORD32 bit_rate, WORD32 sample_rate, 55*15dc779aSAndroid Build Coastguard Worker FLOAT32 used_scf_ratio); 56*15dc779aSAndroid Build Coastguard Worker 57*15dc779aSAndroid Build Coastguard Worker VOID iaace_apply_stereo_preproc(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 58*15dc779aSAndroid Build Coastguard Worker WORD32 num_channels, ixheaace_element_info *pstr_elem_info, 59*15dc779aSAndroid Build Coastguard Worker FLOAT32 *ptr_time_data, WORD32 granule_len); 60*15dc779aSAndroid Build Coastguard Worker 61*15dc779aSAndroid Build Coastguard Worker VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel **pstr_psy_out, 62*15dc779aSAndroid Build Coastguard Worker ixheaace_qc_out_element *pstr_qc_out, 63*15dc779aSAndroid Build Coastguard Worker ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 64*15dc779aSAndroid Build Coastguard Worker FLOAT32 weight_pe_fac); 65