OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 WebRtcIsacfix_HighpassFilterFixDec32 = | 234 WebRtcIsacfix_HighpassFilterFixDec32 = |
235 WebRtcIsacfix_HighpassFilterFixDec32MIPS; | 235 WebRtcIsacfix_HighpassFilterFixDec32MIPS; |
236 #endif | 236 #endif |
237 #if defined(MIPS_DSP_R2_LE) | 237 #if defined(MIPS_DSP_R2_LE) |
238 WebRtcIsacfix_CalculateResidualEnergy = | 238 WebRtcIsacfix_CalculateResidualEnergy = |
239 WebRtcIsacfix_CalculateResidualEnergyMIPS; | 239 WebRtcIsacfix_CalculateResidualEnergyMIPS; |
240 #endif | 240 #endif |
241 } | 241 } |
242 #endif | 242 #endif |
243 | 243 |
| 244 static void InitFunctionPointers(void) { |
| 245 WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrC; |
| 246 WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopC; |
| 247 WebRtcIsacfix_CalculateResidualEnergy = |
| 248 WebRtcIsacfix_CalculateResidualEnergyC; |
| 249 WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16C; |
| 250 WebRtcIsacfix_HighpassFilterFixDec32 = WebRtcIsacfix_HighpassFilterFixDec32C; |
| 251 WebRtcIsacfix_Time2Spec = WebRtcIsacfix_Time2SpecC; |
| 252 WebRtcIsacfix_Spec2Time = WebRtcIsacfix_Spec2TimeC; |
| 253 WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C; |
| 254 WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C; |
| 255 |
| 256 #ifdef WEBRTC_DETECT_NEON |
| 257 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { |
| 258 WebRtcIsacfix_InitNeon(); |
| 259 } |
| 260 #elif defined(WEBRTC_HAS_NEON) |
| 261 WebRtcIsacfix_InitNeon(); |
| 262 #endif |
| 263 |
| 264 #if defined(MIPS32_LE) |
| 265 WebRtcIsacfix_InitMIPS(); |
| 266 #endif |
| 267 } |
| 268 |
244 /**************************************************************************** | 269 /**************************************************************************** |
245 * WebRtcIsacfix_EncoderInit(...) | 270 * WebRtcIsacfix_EncoderInit(...) |
246 * | 271 * |
247 * This function initializes a ISAC instance prior to the encoder calls. | 272 * This function initializes a ISAC instance prior to the encoder calls. |
248 * | 273 * |
249 * Input: | 274 * Input: |
250 * - ISAC_main_inst : ISAC instance. | 275 * - ISAC_main_inst : ISAC instance. |
251 * - CodingMode : 0 -> Bit rate and frame length are automatically | 276 * - CodingMode : 0 -> Bit rate and frame length are automatically |
252 * adjusted to available bandwidth on | 277 * adjusted to available bandwidth on |
253 * transmission channel. | 278 * transmission channel. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 335 |
311 /* Init the bistream data area to zero */ | 336 /* Init the bistream data area to zero */ |
312 for (k=0; k<STREAM_MAXW16_60MS; k++){ | 337 for (k=0; k<STREAM_MAXW16_60MS; k++){ |
313 ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0; | 338 ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0; |
314 } | 339 } |
315 | 340 |
316 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED | 341 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED |
317 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj); | 342 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj); |
318 #endif | 343 #endif |
319 | 344 |
320 // Initiaze function pointers. | 345 InitFunctionPointers(); |
321 WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrC; | |
322 WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopC; | |
323 WebRtcIsacfix_CalculateResidualEnergy = | |
324 WebRtcIsacfix_CalculateResidualEnergyC; | |
325 WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16C; | |
326 WebRtcIsacfix_HighpassFilterFixDec32 = WebRtcIsacfix_HighpassFilterFixDec32C; | |
327 WebRtcIsacfix_Time2Spec = WebRtcIsacfix_Time2SpecC; | |
328 WebRtcIsacfix_Spec2Time = WebRtcIsacfix_Spec2TimeC; | |
329 WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C; | |
330 WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C; | |
331 | |
332 #ifdef WEBRTC_DETECT_NEON | |
333 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { | |
334 WebRtcIsacfix_InitNeon(); | |
335 } | |
336 #elif defined(WEBRTC_HAS_NEON) | |
337 WebRtcIsacfix_InitNeon(); | |
338 #endif | |
339 | |
340 #if defined(MIPS32_LE) | |
341 WebRtcIsacfix_InitMIPS(); | |
342 #endif | |
343 | 346 |
344 return statusInit; | 347 return statusInit; |
345 } | 348 } |
346 | 349 |
347 /* Read the given number of bytes of big-endian 16-bit integers from |src| and | 350 /* Read the given number of bytes of big-endian 16-bit integers from |src| and |
348 write them to |dest| in host endian. If |nbytes| is odd, the number of | 351 write them to |dest| in host endian. If |nbytes| is odd, the number of |
349 output elements is rounded up, and the least significant byte of the last | 352 output elements is rounded up, and the least significant byte of the last |
350 element is set to 0. */ | 353 element is set to 0. */ |
351 static void read_be16(const uint8_t* src, size_t nbytes, uint16_t* dest) { | 354 static void read_be16(const uint8_t* src, size_t nbytes, uint16_t* dest) { |
352 size_t i; | 355 size_t i; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 * | 571 * |
569 * Return value | 572 * Return value |
570 * : 0 - Ok | 573 * : 0 - Ok |
571 * -1 - Error | 574 * -1 - Error |
572 */ | 575 */ |
573 | 576 |
574 int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst) | 577 int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst) |
575 { | 578 { |
576 ISACFIX_SubStruct *ISAC_inst; | 579 ISACFIX_SubStruct *ISAC_inst; |
577 | 580 |
| 581 InitFunctionPointers(); |
| 582 |
578 /* typecast pointer to real structure */ | 583 /* typecast pointer to real structure */ |
579 ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; | 584 ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; |
580 | 585 |
581 /* flag decoder init */ | 586 /* flag decoder init */ |
582 ISAC_inst->initflag |= 1; | 587 ISAC_inst->initflag |= 1; |
583 | 588 |
584 WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj); | 589 WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj); |
585 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj); | 590 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj); |
586 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj); | 591 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj); |
587 | 592 |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 assert(inst->initflag & 1); // Decoder initialized. | 1550 assert(inst->initflag & 1); // Decoder initialized. |
1546 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); | 1551 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
1547 } | 1552 } |
1548 | 1553 |
1549 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, | 1554 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, |
1550 const IsacBandwidthInfo* bwinfo) { | 1555 const IsacBandwidthInfo* bwinfo) { |
1551 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; | 1556 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
1552 assert(inst->initflag & 2); // Encoder initialized. | 1557 assert(inst->initflag & 2); // Encoder initialized. |
1553 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); | 1558 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
1554 } | 1559 } |
OLD | NEW |