1/******************************************************************************
2 *                                                                            *
3 * Copyright (C) 2018 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#ifndef IXHEAACD_BIT_EXTRACT_H
21#define IXHEAACD_BIT_EXTRACT_H
22
23typedef struct {
24  WORD32 core_mode[2];
25  WORD32 common_tw;
26  WORD32 common_window;
27  WORD32 tns_data_present[2];
28  WORD32 tns_active;
29  WORD32 common_tns;
30  WORD32 tns_on_lr;
31  WORD32 tns_present_both;
32  WORD32 common_max_sfb;
33  UWORD8 max_sfb[2];
34  WORD32 max_sfb_ste;
35  WORD32 pred_dir;
36  WORD32 complex_coef;
37  WORD32 use_prev_frame;
38  UWORD8 ms_mask_present[2];
39
40} ia_usac_tmp_core_coder_struct;
41
42WORD32 ixheaacd_ics_info(ia_usac_data_struct *usac_data, WORD32 widx,
43                         UWORD8 *max_sfb, ia_bit_buf_struct *it_bit_buff,
44                         WORD32 window_sequence_last);
45
46VOID ixheaacd_calc_grp_offset(ia_sfb_info_struct *pstr_sfb_info, UWORD8 *group);
47
48VOID ixheaacd_read_tns_u(ia_sfb_info_struct *pstr_sfb_info,
49                         ia_tns_frame_info_struct *pstr_tns_frame_info,
50                         ia_bit_buf_struct *it_bit_buff);
51
52WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
53                                WORD32 elem_idx, WORD32 *chan_offset,
54                                ia_bit_buf_struct *it_bit_buff,
55                                WORD32 nr_core_coder_channels);
56
57VOID usac_past_tw(ia_usac_data_struct *usac_data, WORD32 mod0, WORD32 i,
58                  ia_usac_lpd_decoder_handle st);
59
60VOID usac_td2buffer(FLOAT32 p_in_data[], ia_usac_data_struct *usac_data,
61                    WORD32 k, WORD32 mod0);
62
63WORD32 ixheaacd_lpd_channel_stream(ia_usac_data_struct *usac_data,
64                                   ia_td_frame_data_struct *pstr_td_frame_data,
65                                   ia_bit_buf_struct *it_bit_buff,
66                                   FLOAT32 *synth);
67
68VOID ixheaacd_acelp_decoding(WORD32 k, ia_usac_data_struct *usac_data,
69                             ia_td_frame_data_struct *pstr_td_frame_data,
70                             ia_bit_buf_struct *it_bit_buff, WORD32 chan);
71
72VOID ixheaacd_tcx_coding(ia_usac_data_struct *usac_data, WORD32 *quant,
73                         WORD32 k, WORD32 first_tcx_flag,
74                         ia_td_frame_data_struct *pstr_td_frame_data,
75                         ia_bit_buf_struct *it_bit_buff);
76
77WORD32 ixheaacd_win_seq_select(WORD32 window_sequence_curr,
78                               WORD32 window_sequence_last);
79
80WORD32 ixheaacd_fd_channel_stream(
81    ia_usac_data_struct *usac_data,
82    ia_usac_tmp_core_coder_struct *pstr_core_coder, UWORD8 *max_sfb,
83    WORD32 window_sequence_last, WORD32 chn, WORD32 noise_filling_config,
84    WORD32 ch, ia_bit_buf_struct *it_bit_buff);
85
86VOID ixheaacd_read_fac_data(WORD32 lfac, WORD32 *fac_data,
87                            ia_bit_buf_struct *it_bit_buff);
88
89#endif /* IXHEAACD_BIT_EXTRACT_H */
90