xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_sbr_env_est.h (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
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 #define M_32 (32)
24*15dc779aSAndroid Build Coastguard Worker #define M_16 (16)
25*15dc779aSAndroid Build Coastguard Worker #define M_12 (12)
26*15dc779aSAndroid Build Coastguard Worker #define IXHEAACE_OP_DELAY_OFFSET (6)
27*15dc779aSAndroid Build Coastguard Worker 
28*15dc779aSAndroid Build Coastguard Worker typedef struct {
29*15dc779aSAndroid Build Coastguard Worker   WORD32 pre_transient_info[2];
30*15dc779aSAndroid Build Coastguard Worker   FLOAT32 *ptr_r_buffer[MAX_QMF_TIME_SLOTS];
31*15dc779aSAndroid Build Coastguard Worker   FLOAT32 *ptr_i_buffer[MAX_QMF_TIME_SLOTS];
32*15dc779aSAndroid Build Coastguard Worker   FLOAT32 *ptr_y_buffer[MAX_QMF_TIME_SLOTS * 2];
33*15dc779aSAndroid Build Coastguard Worker   WORD8 envelope_compensation[MAXIMUM_FREQ_COEFFS];
34*15dc779aSAndroid Build Coastguard Worker   WORD32 y_buffer_write_offset;
35*15dc779aSAndroid Build Coastguard Worker   WORD32 no_cols;
36*15dc779aSAndroid Build Coastguard Worker   WORD32 no_rows;
37*15dc779aSAndroid Build Coastguard Worker   WORD32 start_index;
38*15dc779aSAndroid Build Coastguard Worker   WORD32 time_slots;
39*15dc779aSAndroid Build Coastguard Worker   WORD32 time_step;
40*15dc779aSAndroid Build Coastguard Worker   WORD32 buffer_flag;
41*15dc779aSAndroid Build Coastguard Worker   WORD32 sbr_ratio_idx;
42*15dc779aSAndroid Build Coastguard Worker } ixheaace_str_sbr_extr_env;
43*15dc779aSAndroid Build Coastguard Worker typedef ixheaace_str_sbr_extr_env *ixheaace_pstr_sbr_extract_envelope;
44*15dc779aSAndroid Build Coastguard Worker 
45*15dc779aSAndroid Build Coastguard Worker WORD32
46*15dc779aSAndroid Build Coastguard Worker ixheaace_create_extract_sbr_envelope(WORD32 ch,
47*15dc779aSAndroid Build Coastguard Worker                                      ixheaace_pstr_sbr_extract_envelope pstr_sbr_ext_env,
48*15dc779aSAndroid Build Coastguard Worker                                      WORD32 start_index, WORD32 *ptr_common_buffer2,
49*15dc779aSAndroid Build Coastguard Worker                                      FLOAT32 *ptr_sbr_env_r_buf, FLOAT32 *ptr_sbr_env_i_buf,
50*15dc779aSAndroid Build Coastguard Worker                                      WORD32 is_ld_sbr, WORD32 frame_flag_480,
51*15dc779aSAndroid Build Coastguard Worker                                      ixheaace_sbr_codec_type sbr_codec);
52*15dc779aSAndroid Build Coastguard Worker 
53*15dc779aSAndroid Build Coastguard Worker struct ixheaace_str_sbr_config_data;
54*15dc779aSAndroid Build Coastguard Worker struct ixheaace_str_sbr_bitstream_data;
55*15dc779aSAndroid Build Coastguard Worker struct ixheaace_str_enc_channel;
56*15dc779aSAndroid Build Coastguard Worker struct ixheaace_str_common_data;
57*15dc779aSAndroid Build Coastguard Worker struct ixheaace_ps_enc;
58*15dc779aSAndroid Build Coastguard Worker 
59*15dc779aSAndroid Build Coastguard Worker VOID iusace_complex_fft_2048(FLOAT32 *ptr_x, FLOAT32 *ptr_scratch_fft);
60*15dc779aSAndroid Build Coastguard Worker VOID iusace_complex_fft_4096(FLOAT32 *ptr_x_r, FLOAT32 *ptr_x_i, FLOAT32 *ptr_scratch_fft);
61