xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_mps_param_extract.h (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
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 struct ixheaace_mps_tto_box {
23   FLOAT32 cld[MAX_NUM_PARAM_BANDS];
24   FLOAT32 icc[MAX_NUM_PARAM_BANDS];
25 
26   const FLOAT32 *p_icc_quant_table;
27   const FLOAT32 *p_cld_quant_table_enc;
28 
29   UWORD8 *ptr_parameter_band_2_hybrid_band_offset;
30   UWORD8 num_hybrid_bands_max;
31   UWORD8 num_parameter_bands;
32   WORD32 frame_keep_flag;
33 
34   UWORD8 icc_correlation_coherence_border;
35   WORD32 box_quant_mode;
36 
37   UWORD8 n_icc_quant_steps;
38   UWORD8 n_icc_quant_offset;
39 
40   UWORD8 n_cld_quant_steps;
41   UWORD8 n_cld_quant_offset;
42 
43   UWORD8 use_coarse_quant_cld_flag;
44   UWORD8 use_coarse_quant_icc_flag;
45 };
46 
47 struct ixheaace_mps_box_subband_setup {
48   UWORD8 *p_subband_2_parameter_index_ld;
49   UWORD8 icc_correlation_coherence_border;
50 };
51 
52 typedef struct ixheaace_mps_tto_box_config {
53   UWORD8 use_coarse_quant_cld_flag;
54   UWORD8 use_coarse_quant_icc_flag;
55   UWORD8 b_use_coherence_icc_only;
56 
57   WORD32 subband_config;
58   WORD32 box_quant_mode;
59 
60   UWORD8 num_hybrid_bands_max;
61   WORD32 frame_keep_flag;
62 
63 } ixheaace_mps_tto_box_config;
64 
65 typedef struct ixheaace_mps_tto_box ixheaace_mps_tto_box, *ixheaace_mps_pstr_tto_box;
66 typedef struct ixheaace_mps_box_subband_setup ixheaace_mps_box_subband_setup,
67     *ixheaace_mps_pstr_box_subband_setup;
68 
69 IA_ERRORCODE
70 ixheaace_mps_212_init_tto_box(ixheaace_mps_pstr_tto_box pstr_tto_box,
71                               const ixheaace_mps_tto_box_config *const pstr_tto_box_config,
72                               UWORD8 *ptr_parameter_band_2_hybrid_band_offset, WORD32 aot);
73 
74 IA_ERRORCODE ixheaace_mps_212_apply_tto_box(
75     ixheaace_mps_pstr_tto_box pstr_tto_box, const WORD32 num_time_slots,
76     const WORD32 start_time_slot, const WORD32 num_hybrid_bands,
77     ixheaace_cmplx_str pp_cmplx_hybrid_data_1[MAX_ANA_TIME_SLOT][MAX_QMF_BANDS],
78     ixheaace_cmplx_str pp_cmplx_hybrid_data_2[MAX_ANA_TIME_SLOT][MAX_QMF_BANDS],
79     WORD8 *const p_icc_idx, UWORD8 *const pb_icc_quant_coarse, WORD8 *const p_cld_idx,
80     UWORD8 *const pb_cld_quant_coarse, const WORD32 b_use_bb_cues);
81 
82 VOID ixheaace_mps_212_calc_parameter_band_to_hybrid_band_offset(
83     const WORD32 num_hybrid_bands, UWORD8 *ptr_parameter_band_2_hybrid_band_offset, WORD32 aot);
84