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 typedef struct { 24 FLOAT32 norm_pe_fac; /* factor to normalize input PE, depends on bitrate and bandwidth */ 25 FLOAT32 inc_stereo_attenuation; /* att. increment parameter */ 26 FLOAT32 dec_stereo_attenuation; /* att. decrement parameter */ 27 FLOAT32 average_freq_energy_l; /* energy left */ 28 FLOAT32 average_freq_energy_r; /* energy right */ 29 FLOAT32 average_freq_energy_m; /* energy mid */ 30 FLOAT32 average_freq_energy_s; /* energy side */ 31 FLOAT32 smoothed_pe_sum_sum; /* time-smoothed PE */ 32 FLOAT32 avg_s_to_m; /* time-smoothed energy ratio S/M [dB] */ 33 FLOAT32 last_l_to_r; /* previous frame energy ratio L/R [dB] */ 34 FLOAT32 last_nrg_lr; /* previous frame energy L+R */ 35 FLOAT32 impact_factor; /* bitrate dependent parameter */ 36 FLOAT32 stereo_attenuation; /* the actual attenuation of this frame */ 37 FLOAT32 stereo_attenuation_fac; /* the actual attenuation factor of this frame */ 38 /* tuning parameters that are not varied from frame to frame but initialized at init */ 39 WORD32 stereo_attenuation_flag; /* flag to indicate usage */ 40 FLOAT32 const_attenuation; /* if not zero, a constant att. will be applied [dB]*/ 41 FLOAT32 stereo_attenuation_max; /* the max. attenuation [dB]*/ 42 FLOAT32 lr_min; /* tuning parameter [dB] */ 43 FLOAT32 lr_max; /* tuning parameter [dB] */ 44 FLOAT32 sm_min; /* tuning parameter [dB] */ 45 FLOAT32 sm_max; /* tuning parameter [dB] */ 46 FLOAT32 pe_min; /* tuning parameter */ 47 FLOAT32 pe_crit; /* tuning parameter */ 48 FLOAT32 pe_impact_max; /* tuning parameter */ 49 } ixheaace_stereo_pre_pro_struct; 50 51 typedef ixheaace_stereo_pre_pro_struct *ixheaace_stereo_pre_pro_pstr; 52 53 IA_ERRORCODE iaace_init_stereo_pre_processing(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 54 WORD32 no_channels, WORD32 bit_rate, WORD32 sample_rate, 55 FLOAT32 used_scf_ratio); 56 57 VOID iaace_apply_stereo_preproc(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 58 WORD32 num_channels, ixheaace_element_info *pstr_elem_info, 59 FLOAT32 *ptr_time_data, WORD32 granule_len); 60 61 VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel **pstr_psy_out, 62 ixheaace_qc_out_element *pstr_qc_out, 63 ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro, 64 FLOAT32 weight_pe_fac); 65