xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_mps_tree.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 typedef struct {
23   WORD32 num_param_bands;
24   UWORD8 use_coarse_quant_tto_cld_flag;
25   UWORD8 use_coarse_quant_tto_icc_flag;
26   WORD32 quant_mode;
27   UWORD8 num_channels_in_max;
28   UWORD8 num_hybrid_bands_max;
29 
30 } ixheaace_mps_space_tree_setup;
31 
32 typedef struct {
33   UWORD8 num_ott_boxes;
34   UWORD8 num_in_channels;
35   UWORD8 num_out_channels;
36 
37 } ixheaace_mps_space_tree_description;
38 
39 struct ixheaace_mps_space_tree {
40   ixheaace_mps_space_tree_description descr;
41   ixheaace_mps_pstr_tto_box pstr_tto_box[IXHEAACE_MPS_MAX_NUM_BOXES];
42   WORD32 num_param_bands;
43   UWORD8 use_coarse_quant_tto_icc_flag;
44   UWORD8 use_coarse_quant_tto_cld_flag;
45   WORD32 quant_mode;
46   WORD32 frame_count;
47   WORD32 frame_keep_flag;
48 
49   UWORD8 cld_prev[IXHEAACE_MPS_MAX_NUM_BOXES][MAX_NUM_PARAM_BANDS];
50   UWORD8 icc_prev[IXHEAACE_MPS_MAX_NUM_BOXES][MAX_NUM_PARAM_BANDS];
51 
52   UWORD8 num_channels_in_max;
53   UWORD8 num_hybrid_bands_max;
54 };
55 
56 typedef struct {
57   UWORD8 box_id;
58   UWORD8 in_ch1;
59   UWORD8 in_ch2;
60   UWORD8 in_ch3;
61   UWORD8 in_ch4;
62   UWORD8 w_ch1;
63   UWORD8 w_ch2;
64 
65 } ixheaace_mps_tto_descriptor;
66 
67 typedef struct {
68   UWORD8 num_channels_in;
69   UWORD8 n_channels_out;
70   UWORD8 n_tto_boxes;
71   ixheaace_mps_tto_descriptor tto_descriptor[1];
72 } ixheaace_mps_tree_setup;
73 
74 typedef struct ixheaace_mps_space_tree ixheaace_mps_space_tree, *ixheaace_mps_pstr_space_tree;
75 
76 IA_ERRORCODE
77 ixheaace_mps_212_space_tree_init(ixheaace_mps_pstr_space_tree pstr_space_tree,
78                                  const ixheaace_mps_space_tree_setup *const pstr_space_tree_setup,
79                                  UWORD8 *ptr_parameter_band_2_hybrid_band_offset,
80                                  const WORD32 frame_keep_flag, WORD32 aot);
81 
82 IA_ERRORCODE ixheaace_mps_212_space_tree_apply(
83     ixheaace_mps_pstr_space_tree pstr_space_tree, const WORD32 param_set,
84     const WORD32 num_channels_in, const WORD32 num_time_slots, const WORD32 start_time_slot,
85     const WORD32 num_hybrid_bands, FLOAT32 *p_frame_window_ana_mps,
86     ixheaace_cmplx_str ppp_cmplx_hybrid_1[IXHEAACE_MPS_MAX_INPUT_CHANNELS][MAX_ANA_TIME_SLOT]
87                                          [MAX_QMF_BANDS],
88     ixheaace_cmplx_str ppp_cmplx_hybrid_2[IXHEAACE_MPS_MAX_INPUT_CHANNELS][MAX_ANA_TIME_SLOT]
89                                          [MAX_QMF_BANDS],
90     ixheaace_mps_spatial_frame *const pstr_spatial_frame, const WORD32 avoid_keep);
91