blob: 488ee2e76a82a19466d6705c624f0d57b14b72e4 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:231/*
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 WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_
20#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_
21
22#include "structs.h"
23
kma@webrtc.org27fe9992012-11-14 18:44:2424#ifdef __cplusplus
25extern "C" {
26#endif
andrew@webrtc.orgb015cbe2012-10-22 18:19:2327
kma@webrtc.org178f0132013-01-24 01:37:3328int WebRtcIsacfix_EstimateBandwidth(BwEstimatorstr* bwest_str,
29 Bitstr_dec* streamdata,
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0630 int32_t packet_size,
31 uint16_t rtp_seq_number,
32 uint32_t send_ts,
33 uint32_t arr_ts);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2334
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0635int16_t WebRtcIsacfix_DecodeImpl(int16_t* signal_out16,
pbos@webrtc.org3791d7e2014-12-17 15:23:2936 IsacFixDecoderInstance* ISACdec_obj,
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0637 int16_t* current_framesamples);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2338
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0639int16_t WebRtcIsacfix_DecodePlcImpl(int16_t* decoded,
pbos@webrtc.org3791d7e2014-12-17 15:23:2940 IsacFixDecoderInstance* ISACdec_obj,
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0641 int16_t* current_framesample );
andrew@webrtc.orgb015cbe2012-10-22 18:19:2342
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0643int WebRtcIsacfix_EncodeImpl(int16_t* in,
pbos@webrtc.org3791d7e2014-12-17 15:23:2944 IsacFixEncoderInstance* ISACenc_obj,
kma@webrtc.org178f0132013-01-24 01:37:3345 BwEstimatorstr* bw_estimatordata,
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0646 int16_t CodingMode);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2347
pbos@webrtc.org3791d7e2014-12-17 15:23:2948int WebRtcIsacfix_EncodeStoredData(IsacFixEncoderInstance* ISACenc_obj,
kma@webrtc.org178f0132013-01-24 01:37:3349 int BWnumber,
50 float scale);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2351
52/* initialization functions */
53
kma@webrtc.org178f0132013-01-24 01:37:3354void WebRtcIsacfix_InitMaskingEnc(MaskFiltstr_enc* maskdata);
55void WebRtcIsacfix_InitMaskingDec(MaskFiltstr_dec* maskdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2356
kma@webrtc.org178f0132013-01-24 01:37:3357void WebRtcIsacfix_InitPreFilterbank(PreFiltBankstr* prefiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2358
kma@webrtc.org178f0132013-01-24 01:37:3359void WebRtcIsacfix_InitPostFilterbank(PostFiltBankstr* postfiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2360
kma@webrtc.org178f0132013-01-24 01:37:3361void WebRtcIsacfix_InitPitchFilter(PitchFiltstr* pitchfiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2362
kma@webrtc.org178f0132013-01-24 01:37:3363void WebRtcIsacfix_InitPitchAnalysis(PitchAnalysisStruct* State);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2364
kma@webrtc.org178f0132013-01-24 01:37:3365void WebRtcIsacfix_InitPlc(PLCstr* State);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2366
67
68/* transform functions */
69
70void WebRtcIsacfix_InitTransform();
71
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0672typedef void (*Time2Spec)(int16_t* inre1Q9,
73 int16_t* inre2Q9,
74 int16_t* outre,
75 int16_t* outim);
76typedef void (*Spec2Time)(int16_t* inreQ7,
77 int16_t* inimQ7,
78 int32_t* outre1Q16,
79 int32_t* outre2Q16);
kma@webrtc.org178f0132013-01-24 01:37:3380
81extern Time2Spec WebRtcIsacfix_Time2Spec;
kma@webrtc.org3c374682012-12-12 23:00:5282extern Spec2Time WebRtcIsacfix_Spec2Time;
andrew@webrtc.orgb015cbe2012-10-22 18:19:2383
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0684void WebRtcIsacfix_Time2SpecC(int16_t* inre1Q9,
85 int16_t* inre2Q9,
86 int16_t* outre,
87 int16_t* outim);
88void WebRtcIsacfix_Spec2TimeC(int16_t* inreQ7,
89 int16_t* inimQ7,
90 int32_t* outre1Q16,
91 int32_t* outre2Q16);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2392
kma@webrtc.org3c374682012-12-12 23:00:5293#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON)
pbos@webrtc.orgfbda0fc2013-04-09 00:28:0694void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9,
95 int16_t* inre2Q9,
96 int16_t* outre,
97 int16_t* outim);
98void WebRtcIsacfix_Spec2TimeNeon(int16_t* inreQ7,
99 int16_t* inimQ7,
100 int32_t* outre1Q16,
101 int32_t* outre2Q16);
kma@webrtc.org3c374682012-12-12 23:00:52102#endif
andrew@webrtc.orgb015cbe2012-10-22 18:19:23103
andrew@webrtc.orge4834e02014-07-21 16:43:13104#if defined(MIPS32_LE)
105void WebRtcIsacfix_Time2SpecMIPS(int16_t* inre1Q9,
106 int16_t* inre2Q9,
107 int16_t* outre,
108 int16_t* outim);
109void WebRtcIsacfix_Spec2TimeMIPS(int16_t* inreQ7,
110 int16_t* inimQ7,
111 int32_t* outre1Q16,
112 int32_t* outre2Q16);
113#endif
andrew@webrtc.orgb015cbe2012-10-22 18:19:23114
andrew@webrtc.orgb015cbe2012-10-22 18:19:23115/* filterbank functions */
116
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06117void WebRtcIsacfix_SplitAndFilter1(int16_t* in,
118 int16_t* LP16,
119 int16_t* HP16,
kma@webrtc.org178f0132013-01-24 01:37:33120 PreFiltBankstr* prefiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23121
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06122void WebRtcIsacfix_FilterAndCombine1(int16_t* tempin_ch1,
123 int16_t* tempin_ch2,
124 int16_t* out16,
kma@webrtc.org178f0132013-01-24 01:37:33125 PostFiltBankstr* postfiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23126
127#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
128
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06129void WebRtcIsacfix_SplitAndFilter2(int16_t* in,
130 int16_t* LP16,
131 int16_t* HP16,
kma@webrtc.org178f0132013-01-24 01:37:33132 PreFiltBankstr* prefiltdata);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23133
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06134void WebRtcIsacfix_FilterAndCombine2(int16_t* tempin_ch1,
135 int16_t* tempin_ch2,
136 int16_t* out16,
kma@webrtc.org178f0132013-01-24 01:37:33137 PostFiltBankstr* postfiltdata,
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06138 int16_t len);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23139
140#endif
141
142/* normalized lattice filters */
143
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06144void WebRtcIsacfix_NormLatticeFilterMa(int16_t orderCoef,
145 int32_t* stateGQ15,
146 int16_t* lat_inQ0,
147 int16_t* filt_coefQ15,
148 int32_t* gain_lo_hiQ17,
149 int16_t lo_hi,
150 int16_t* lat_outQ9);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23151
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06152void WebRtcIsacfix_NormLatticeFilterAr(int16_t orderCoef,
153 int16_t* stateGQ0,
154 int32_t* lat_inQ25,
155 int16_t* filt_coefQ15,
156 int32_t* gain_lo_hiQ17,
157 int16_t lo_hi,
158 int16_t* lat_outQ0);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23159
160/* TODO(kma): Remove the following functions into individual header files. */
161
162/* Internal functions in both C and ARM Neon versions */
163
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06164int WebRtcIsacfix_AutocorrC(int32_t* __restrict r,
165 const int16_t* __restrict x,
166 int16_t N,
167 int16_t order,
168 int16_t* __restrict scale);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23169
170void WebRtcIsacfix_FilterMaLoopC(int16_t input0,
171 int16_t input1,
172 int32_t input2,
173 int32_t* ptr0,
174 int32_t* ptr1,
175 int32_t* ptr2);
176
177#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON)
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06178int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
179 const int16_t* __restrict x,
180 int16_t N,
181 int16_t order,
182 int16_t* __restrict scale);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23183
184void WebRtcIsacfix_FilterMaLoopNeon(int16_t input0,
185 int16_t input1,
186 int32_t input2,
187 int32_t* ptr0,
188 int32_t* ptr1,
189 int32_t* ptr2);
190#endif
191
andrew@webrtc.orgbc9c1952014-06-10 18:13:15192#if defined(MIPS32_LE)
193int WebRtcIsacfix_AutocorrMIPS(int32_t* __restrict r,
194 const int16_t* __restrict x,
195 int16_t N,
196 int16_t order,
197 int16_t* __restrict scale);
198
199void WebRtcIsacfix_FilterMaLoopMIPS(int16_t input0,
200 int16_t input1,
201 int32_t input2,
202 int32_t* ptr0,
203 int32_t* ptr1,
204 int32_t* ptr2);
205#endif
206
andrew@webrtc.orgb015cbe2012-10-22 18:19:23207/* Function pointers associated with the above functions. */
208
pbos@webrtc.orgfbda0fc2013-04-09 00:28:06209typedef int (*AutocorrFix)(int32_t* __restrict r,
210 const int16_t* __restrict x,
211 int16_t N,
212 int16_t order,
213 int16_t* __restrict scale);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23214extern AutocorrFix WebRtcIsacfix_AutocorrFix;
215
216typedef void (*FilterMaLoopFix)(int16_t input0,
217 int16_t input1,
218 int32_t input2,
219 int32_t* ptr0,
220 int32_t* ptr1,
221 int32_t* ptr2);
222extern FilterMaLoopFix WebRtcIsacfix_FilterMaLoopFix;
223
kma@webrtc.org27fe9992012-11-14 18:44:24224#ifdef __cplusplus
225} // extern "C"
226#endif
227
andrew@webrtc.orgb015cbe2012-10-22 18:19:23228#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_CODEC_H_ */