• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 /*
12  * codec.h
13  *
14  * This header file contains the calls to the internal encoder
15  * and decoder functions.
16  *
17  */
18 
19 #ifndef MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_
20 #define MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_
21 
22 #include "modules/audio_coding/codecs/isac/fix/source/structs.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 int WebRtcIsacfix_EstimateBandwidth(BwEstimatorstr* bwest_str,
29                                     Bitstr_dec* streamdata,
30                                     size_t packet_size,
31                                     uint16_t rtp_seq_number,
32                                     uint32_t send_ts,
33                                     uint32_t arr_ts);
34 
35 int WebRtcIsacfix_DecodeImpl(int16_t* signal_out16,
36                              IsacFixDecoderInstance* ISACdec_obj,
37                              size_t* current_framesamples);
38 
39 void WebRtcIsacfix_DecodePlcImpl(int16_t* decoded,
40                                  IsacFixDecoderInstance* ISACdec_obj,
41                                  size_t* current_framesample);
42 
43 int WebRtcIsacfix_EncodeImpl(int16_t* in,
44                              IsacFixEncoderInstance* ISACenc_obj,
45                              BwEstimatorstr* bw_estimatordata,
46                              int16_t CodingMode);
47 
48 int WebRtcIsacfix_EncodeStoredData(IsacFixEncoderInstance* ISACenc_obj,
49                                    int BWnumber,
50                                    float scale);
51 
52 /* initialization functions */
53 
54 void WebRtcIsacfix_InitMaskingEnc(MaskFiltstr_enc* maskdata);
55 void WebRtcIsacfix_InitMaskingDec(MaskFiltstr_dec* maskdata);
56 
57 void WebRtcIsacfix_InitPreFilterbank(PreFiltBankstr* prefiltdata);
58 
59 void WebRtcIsacfix_InitPostFilterbank(PostFiltBankstr* postfiltdata);
60 
61 void WebRtcIsacfix_InitPitchFilter(PitchFiltstr* pitchfiltdata);
62 
63 void WebRtcIsacfix_InitPitchAnalysis(PitchAnalysisStruct* State);
64 
65 void WebRtcIsacfix_InitPlc(PLCstr* State);
66 
67 /* transform functions */
68 
69 void WebRtcIsacfix_InitTransform(void);
70 
71 typedef void (*Time2Spec)(int16_t* inre1Q9,
72                           int16_t* inre2Q9,
73                           int16_t* outre,
74                           int16_t* outim);
75 typedef void (*Spec2Time)(int16_t* inreQ7,
76                           int16_t* inimQ7,
77                           int32_t* outre1Q16,
78                           int32_t* outre2Q16);
79 
80 extern Time2Spec WebRtcIsacfix_Time2Spec;
81 extern Spec2Time WebRtcIsacfix_Spec2Time;
82 
83 void WebRtcIsacfix_Time2SpecC(int16_t* inre1Q9,
84                               int16_t* inre2Q9,
85                               int16_t* outre,
86                               int16_t* outim);
87 void WebRtcIsacfix_Spec2TimeC(int16_t* inreQ7,
88                               int16_t* inimQ7,
89                               int32_t* outre1Q16,
90                               int32_t* outre2Q16);
91 
92 #if defined(WEBRTC_HAS_NEON)
93 void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9,
94                                  int16_t* inre2Q9,
95                                  int16_t* outre,
96                                  int16_t* outim);
97 void WebRtcIsacfix_Spec2TimeNeon(int16_t* inreQ7,
98                                  int16_t* inimQ7,
99                                  int32_t* outre1Q16,
100                                  int32_t* outre2Q16);
101 #endif
102 
103 #if defined(MIPS32_LE)
104 void WebRtcIsacfix_Time2SpecMIPS(int16_t* inre1Q9,
105                                  int16_t* inre2Q9,
106                                  int16_t* outre,
107                                  int16_t* outim);
108 void WebRtcIsacfix_Spec2TimeMIPS(int16_t* inreQ7,
109                                  int16_t* inimQ7,
110                                  int32_t* outre1Q16,
111                                  int32_t* outre2Q16);
112 #endif
113 
114 /* filterbank functions */
115 
116 void WebRtcIsacfix_SplitAndFilter1(int16_t* in,
117                                    int16_t* LP16,
118                                    int16_t* HP16,
119                                    PreFiltBankstr* prefiltdata);
120 
121 void WebRtcIsacfix_FilterAndCombine1(int16_t* tempin_ch1,
122                                      int16_t* tempin_ch2,
123                                      int16_t* out16,
124                                      PostFiltBankstr* postfiltdata);
125 
126 /* normalized lattice filters */
127 
128 void WebRtcIsacfix_NormLatticeFilterMa(size_t orderCoef,
129                                        int32_t* stateGQ15,
130                                        int16_t* lat_inQ0,
131                                        int16_t* filt_coefQ15,
132                                        int32_t* gain_lo_hiQ17,
133                                        int16_t lo_hi,
134                                        int16_t* lat_outQ9);
135 
136 void WebRtcIsacfix_NormLatticeFilterAr(size_t orderCoef,
137                                        int16_t* stateGQ0,
138                                        int32_t* lat_inQ25,
139                                        int16_t* filt_coefQ15,
140                                        int32_t* gain_lo_hiQ17,
141                                        int16_t lo_hi,
142                                        int16_t* lat_outQ0);
143 
144 /* TODO(kma): Remove the following functions into individual header files. */
145 
146 /* Internal functions in both C and ARM Neon versions */
147 
148 int WebRtcIsacfix_AutocorrC(int32_t* __restrict r,
149                             const int16_t* __restrict x,
150                             int16_t N,
151                             int16_t order,
152                             int16_t* __restrict scale);
153 
154 void WebRtcIsacfix_FilterMaLoopC(int16_t input0,
155                                  int16_t input1,
156                                  int32_t input2,
157                                  int32_t* ptr0,
158                                  int32_t* ptr1,
159                                  int32_t* ptr2);
160 
161 #if defined(WEBRTC_HAS_NEON)
162 int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
163                                const int16_t* __restrict x,
164                                int16_t N,
165                                int16_t order,
166                                int16_t* __restrict scale);
167 
168 void WebRtcIsacfix_FilterMaLoopNeon(int16_t input0,
169                                     int16_t input1,
170                                     int32_t input2,
171                                     int32_t* ptr0,
172                                     int32_t* ptr1,
173                                     int32_t* ptr2);
174 #endif
175 
176 #if defined(MIPS32_LE)
177 int WebRtcIsacfix_AutocorrMIPS(int32_t* __restrict r,
178                                const int16_t* __restrict x,
179                                int16_t N,
180                                int16_t order,
181                                int16_t* __restrict scale);
182 
183 void WebRtcIsacfix_FilterMaLoopMIPS(int16_t input0,
184                                     int16_t input1,
185                                     int32_t input2,
186                                     int32_t* ptr0,
187                                     int32_t* ptr1,
188                                     int32_t* ptr2);
189 #endif
190 
191 /* Function pointers associated with the above functions. */
192 
193 typedef int (*AutocorrFix)(int32_t* __restrict r,
194                            const int16_t* __restrict x,
195                            int16_t N,
196                            int16_t order,
197                            int16_t* __restrict scale);
198 extern AutocorrFix WebRtcIsacfix_AutocorrFix;
199 
200 typedef void (*FilterMaLoopFix)(int16_t input0,
201                                 int16_t input1,
202                                 int32_t input2,
203                                 int32_t* ptr0,
204                                 int32_t* ptr1,
205                                 int32_t* ptr2);
206 extern FilterMaLoopFix WebRtcIsacfix_FilterMaLoopFix;
207 
208 #ifdef __cplusplus
209 }  // extern "C"
210 #endif
211 
212 #endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_ */
213