OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ |
13 | 13 |
| 14 #include <stddef.h> |
| 15 |
14 #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h" | 16 #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h" |
15 #include "webrtc/typedefs.h" | 17 #include "webrtc/typedefs.h" |
16 | 18 |
17 typedef struct WebRtcISACStruct ISACStruct; | 19 typedef struct WebRtcISACStruct ISACStruct; |
18 | 20 |
19 #if defined(__cplusplus) | 21 #if defined(__cplusplus) |
20 extern "C" { | 22 extern "C" { |
21 #endif | 23 #endif |
22 | 24 |
23 /*****************************************************************************
* | 25 /*****************************************************************************
* |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 * - arr_ts : the arrival time of the packet (from NetEq) | 181 * - arr_ts : the arrival time of the packet (from NetEq) |
180 * in samples. | 182 * in samples. |
181 * | 183 * |
182 * Return value : 0 - Ok | 184 * Return value : 0 - Ok |
183 * -1 - Error | 185 * -1 - Error |
184 */ | 186 */ |
185 | 187 |
186 int16_t WebRtcIsac_UpdateBwEstimate( | 188 int16_t WebRtcIsac_UpdateBwEstimate( |
187 ISACStruct* ISAC_main_inst, | 189 ISACStruct* ISAC_main_inst, |
188 const uint8_t* encoded, | 190 const uint8_t* encoded, |
189 int32_t packet_size, | 191 size_t packet_size, |
190 uint16_t rtp_seq_number, | 192 uint16_t rtp_seq_number, |
191 uint32_t send_ts, | 193 uint32_t send_ts, |
192 uint32_t arr_ts); | 194 uint32_t arr_ts); |
193 | 195 |
194 | 196 |
195 /*****************************************************************************
* | 197 /*****************************************************************************
* |
196 * WebRtcIsac_Decode(...) | 198 * WebRtcIsac_Decode(...) |
197 * | 199 * |
198 * This function decodes an ISAC frame. At 16 kHz sampling rate, the length | 200 * This function decodes an ISAC frame. At 16 kHz sampling rate, the length |
199 * of the output audio could be either 480 or 960 samples, equivalent to | 201 * of the output audio could be either 480 or 960 samples, equivalent to |
200 * 30 or 60 ms respectively. At 32 kHz sampling rate, the length of the | 202 * 30 or 60 ms respectively. At 32 kHz sampling rate, the length of the |
201 * output audio is 960 samples, which is 30 ms. | 203 * output audio is 960 samples, which is 30 ms. |
202 * | 204 * |
203 * Input: | 205 * Input: |
204 * - ISAC_main_inst : ISAC instance. | 206 * - ISAC_main_inst : ISAC instance. |
205 * - encoded : encoded ISAC frame(s). | 207 * - encoded : encoded ISAC frame(s). |
206 * - len : bytes in encoded vector. | 208 * - len : bytes in encoded vector. |
207 * | 209 * |
208 * Output: | 210 * Output: |
209 * - decoded : The decoded vector. | 211 * - decoded : The decoded vector. |
210 * | 212 * |
211 * Return value : >0 - number of samples in decoded vector. | 213 * Return value : >0 - number of samples in decoded vector. |
212 * -1 - Error. | 214 * -1 - Error. |
213 */ | 215 */ |
214 | 216 |
215 int WebRtcIsac_Decode( | 217 int WebRtcIsac_Decode( |
216 ISACStruct* ISAC_main_inst, | 218 ISACStruct* ISAC_main_inst, |
217 const uint8_t* encoded, | 219 const uint8_t* encoded, |
218 int16_t len, | 220 size_t len, |
219 int16_t* decoded, | 221 int16_t* decoded, |
220 int16_t* speechType); | 222 int16_t* speechType); |
221 | 223 |
222 | 224 |
223 /*****************************************************************************
* | 225 /*****************************************************************************
* |
224 * WebRtcIsac_DecodePlc(...) | 226 * WebRtcIsac_DecodePlc(...) |
225 * | 227 * |
226 * This function conducts PLC for ISAC frame(s). Output speech length | 228 * This function conducts PLC for ISAC frame(s). Output speech length |
227 * will be a multiple of frames, i.e. multiples of 30 ms audio. Therefore, | 229 * will be a multiple of frames, i.e. multiples of 30 ms audio. Therefore, |
228 * the output is multiple of 480 samples if operating at 16 kHz and multiple | 230 * the output is multiple of 480 samples if operating at 16 kHz and multiple |
229 * of 960 if operating at 32 kHz. | 231 * of 960 if operating at 32 kHz. |
230 * | 232 * |
231 * Input: | 233 * Input: |
232 * - ISAC_main_inst : ISAC instance. | 234 * - ISAC_main_inst : ISAC instance. |
233 * - noOfLostFrames : Number of PLC frames to produce. | 235 * - noOfLostFrames : Number of PLC frames to produce. |
234 * | 236 * |
235 * Output: | 237 * Output: |
236 * - decoded : The decoded vector. | 238 * - decoded : The decoded vector. |
237 * | 239 * |
238 * Return value : >0 - number of samples in decoded PLC vector | 240 * Return value : Number of samples in decoded PLC vector |
239 * -1 - Error | |
240 */ | 241 */ |
241 | 242 |
242 int16_t WebRtcIsac_DecodePlc( | 243 size_t WebRtcIsac_DecodePlc( |
243 ISACStruct* ISAC_main_inst, | 244 ISACStruct* ISAC_main_inst, |
244 int16_t* decoded, | 245 int16_t* decoded, |
245 int16_t noOfLostFrames); | 246 size_t noOfLostFrames); |
246 | 247 |
247 | 248 |
248 /*****************************************************************************
* | 249 /*****************************************************************************
* |
249 * WebRtcIsac_Control(...) | 250 * WebRtcIsac_Control(...) |
250 * | 251 * |
251 * This function sets the limit on the short-term average bit-rate and the | 252 * This function sets the limit on the short-term average bit-rate and the |
252 * frame length. Should be used only in Instantaneous mode. At 16 kHz sampling | 253 * frame length. Should be used only in Instantaneous mode. At 16 kHz sampling |
253 * rate, an average bit-rate between 10000 to 32000 bps is valid and a | 254 * rate, an average bit-rate between 10000 to 32000 bps is valid and a |
254 * frame-size of 30 or 60 ms is acceptable. At 32 kHz, an average bit-rate | 255 * frame-size of 30 or 60 ms is acceptable. At 32 kHz, an average bit-rate |
255 * between 10000 to 56000 is acceptable, and the valid frame-size is 30 ms. | 256 * between 10000 to 56000 is acceptable, and the valid frame-size is 30 ms. |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 * | 698 * |
698 * Output: | 699 * Output: |
699 * - decoded : The decoded vector | 700 * - decoded : The decoded vector |
700 * | 701 * |
701 * Return value : >0 - number of samples in decoded vector | 702 * Return value : >0 - number of samples in decoded vector |
702 * -1 - Error | 703 * -1 - Error |
703 */ | 704 */ |
704 int WebRtcIsac_DecodeRcu( | 705 int WebRtcIsac_DecodeRcu( |
705 ISACStruct* ISAC_main_inst, | 706 ISACStruct* ISAC_main_inst, |
706 const uint8_t* encoded, | 707 const uint8_t* encoded, |
707 int16_t len, | 708 size_t len, |
708 int16_t* decoded, | 709 int16_t* decoded, |
709 int16_t* speechType); | 710 int16_t* speechType); |
710 | 711 |
711 /* Fills in an IsacBandwidthInfo struct. |inst| should be a decoder. */ | 712 /* Fills in an IsacBandwidthInfo struct. |inst| should be a decoder. */ |
712 void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst, IsacBandwidthInfo* bwinfo); | 713 void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst, IsacBandwidthInfo* bwinfo); |
713 | 714 |
714 /* Uses the values from an IsacBandwidthInfo struct. |inst| should be an | 715 /* Uses the values from an IsacBandwidthInfo struct. |inst| should be an |
715 encoder. */ | 716 encoder. */ |
716 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst, | 717 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst, |
717 const IsacBandwidthInfo* bwinfo); | 718 const IsacBandwidthInfo* bwinfo); |
718 | 719 |
719 /* If |inst| is a decoder but not an encoder: tell it what sample rate the | 720 /* If |inst| is a decoder but not an encoder: tell it what sample rate the |
720 encoder is using, for bandwidth estimation purposes. */ | 721 encoder is using, for bandwidth estimation purposes. */ |
721 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, int sample_rate_hz); | 722 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, int sample_rate_hz); |
722 | 723 |
723 #if defined(__cplusplus) | 724 #if defined(__cplusplus) |
724 } | 725 } |
725 #endif | 726 #endif |
726 | 727 |
727 | 728 |
728 | 729 |
729 #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ */ | 730 #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ */ |
OLD | NEW |