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 DELTA_TIME 9 24 #define MAXIMUM_COMP 2 25 #define TONALITY_QUOTA 0.1f 26 #define DIFF_QUOTA 0.75f 27 #define THR_DIFF 25.0f 28 #define THR_DIFF_GUIDE 1.26f 29 #define THR_TONE 15.0f 30 #define I_THR_TONE (1.0f / 15.0f) 31 #define THR_TONE_GUIDE 1.26f 32 #define THR_SFM_SBR 0.3f 33 #define THR_SFM_ORIG 0.1f 34 #define DECAY_GUIDE_ORIG 0.3f 35 #define DECAY_GUIDE_DIFF 0.5f 36 37 typedef struct { 38 FLOAT32 *ptr_guide_vec_diff; 39 FLOAT32 *ptr_guide_vec_orig; 40 UWORD8 *ptr_guide_vector_detected; 41 } ixheaace_str_guide_vectors; 42 43 typedef struct { 44 WORD32 qmf_num_ch; 45 WORD32 num_scf; 46 WORD32 sample_freq; 47 WORD32 prev_trans_flag; 48 WORD32 prev_trans_frame; 49 WORD32 prev_trans_pos; 50 51 WORD32 no_vec_per_frame; 52 WORD32 trans_pos_offset; 53 54 WORD32 move; 55 WORD32 tot_no_est; 56 WORD32 no_est_per_frame; 57 WORD32 time_slots; 58 59 UWORD8 *ptr_guide_scfb; 60 UWORD8 sbr_guide_scfb[MAXIMUM_FREQ_COEFFS]; 61 62 WORD8 *ptr_prev_env_compensation; 63 WORD8 sbr_prev_env_compensation[MAXIMUM_FREQ_COEFFS]; 64 65 UWORD8 *ptr_detection_vectors[NO_OF_ESTIMATES]; 66 UWORD8 sbr_detection_vectors[NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS]; 67 68 FLOAT32 *ptr_sfm_orig[NO_OF_ESTIMATES]; 69 FLOAT32 *ptr_sfm_sbr[NO_OF_ESTIMATES]; 70 FLOAT32 *ptr_tonal_diff[NO_OF_ESTIMATES]; 71 ixheaace_str_guide_vectors guide_vectors[NO_OF_ESTIMATES]; 72 UWORD8 sbr_guide_vector_detected[NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS]; 73 } ixheaace_str_sbr_missing_har_detector; 74 75 typedef ixheaace_str_sbr_missing_har_detector *ixheaace_pstr_sbr_missing_harmonics_detector; 76 77 VOID ixheaace_sbr_missing_harmonics_detector_qmf( 78 ixheaace_pstr_sbr_missing_harmonics_detector pstr_sbr_mhd_et, FLOAT32 **ptr_quota_buf, 79 WORD8 *ptr_idx_vx, const ixheaace_str_frame_info_sbr *ptr_frame_info, 80 const WORD32 *ptr_tran_info, WORD32 *ptr_add_harmonics_flag, UWORD8 *ptr_add_harmonics_sfbs, 81 const UWORD8 *ptr_freq_band_tab, WORD32 num_sfb, WORD8 *ptr_env_compensation); 82 83 VOID ixheaace_create_sbr_missing_harmonics_detector( 84 WORD32 ch, ixheaace_pstr_sbr_missing_harmonics_detector pstr_sbr_mhdet, WORD32 sample_freq, 85 WORD32 num_sfb, WORD32 qmf_num_ch, WORD32 tot_no_est, WORD32 move, WORD32 no_est_per_frame, 86 WORD32 *ptr_common_buffer); 87