| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 14 matching lines...) Expand all Loading... |
| 25 //snrLocPost is the post SNR for each frequency (in Q11) | 25 //snrLocPost is the post SNR for each frequency (in Q11) |
| 26 void WebRtcNsx_SpeechNoiseProb(NoiseSuppressionFixedC* inst, | 26 void WebRtcNsx_SpeechNoiseProb(NoiseSuppressionFixedC* inst, |
| 27 uint16_t* nonSpeechProbFinal, | 27 uint16_t* nonSpeechProbFinal, |
| 28 uint32_t* priorLocSnr, | 28 uint32_t* priorLocSnr, |
| 29 uint32_t* postLocSnr) { | 29 uint32_t* postLocSnr) { |
| 30 uint32_t tmpU32no1, tmpU32no2, tmpU32no3; | 30 uint32_t tmpU32no1, tmpU32no2, tmpU32no3; |
| 31 int32_t indPriorFX, tmp32no1; | 31 int32_t indPriorFX, tmp32no1; |
| 32 int32_t logLrtTimeAvgKsumFX; | 32 int32_t logLrtTimeAvgKsumFX; |
| 33 int16_t indPriorFX16; | 33 int16_t indPriorFX16; |
| 34 int16_t tmp16, tmp16no1, tmp16no2, tmpIndFX, tableIndex, frac; | 34 int16_t tmp16, tmp16no1, tmp16no2, tmpIndFX, tableIndex, frac; |
| 35 int i, normTmp, nShifts; | 35 size_t i; |
| 36 int normTmp, nShifts; |
| 36 | 37 |
| 37 int32_t r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; | 38 int32_t r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; |
| 38 int32_t const_max = 0x7fffffff; | 39 int32_t const_max = 0x7fffffff; |
| 39 int32_t const_neg43 = -43; | 40 int32_t const_neg43 = -43; |
| 40 int32_t const_5412 = 5412; | 41 int32_t const_5412 = 5412; |
| 41 int32_t const_11rsh12 = (11 << 12); | 42 int32_t const_11rsh12 = (11 << 12); |
| 42 int32_t const_178 = 178; | 43 int32_t const_178 = 178; |
| 43 | 44 |
| 44 | 45 |
| 45 // compute feature based on average LR factor | 46 // compute feature based on average LR factor |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 325 } |
| 325 } | 326 } |
| 326 } | 327 } |
| 327 } | 328 } |
| 328 | 329 |
| 329 // Update analysis buffer for lower band, and window data before FFT. | 330 // Update analysis buffer for lower band, and window data before FFT. |
| 330 void WebRtcNsx_AnalysisUpdate_mips(NoiseSuppressionFixedC* inst, | 331 void WebRtcNsx_AnalysisUpdate_mips(NoiseSuppressionFixedC* inst, |
| 331 int16_t* out, | 332 int16_t* out, |
| 332 int16_t* new_speech) { | 333 int16_t* new_speech) { |
| 333 int iters, after; | 334 int iters, after; |
| 334 int anaLen = inst->anaLen; | 335 int anaLen = (int)inst->anaLen; |
| 335 int *window = (int*)inst->window; | 336 int *window = (int*)inst->window; |
| 336 int *anaBuf = (int*)inst->analysisBuffer; | 337 int *anaBuf = (int*)inst->analysisBuffer; |
| 337 int *outBuf = (int*)out; | 338 int *outBuf = (int*)out; |
| 338 int r0, r1, r2, r3, r4, r5, r6, r7; | 339 int r0, r1, r2, r3, r4, r5, r6, r7; |
| 339 #if defined(MIPS_DSP_R1_LE) | 340 #if defined(MIPS_DSP_R1_LE) |
| 340 int r8; | 341 int r8; |
| 341 #endif | 342 #endif |
| 342 | 343 |
| 343 // For lower band update analysis buffer. | 344 // For lower band update analysis buffer. |
| 344 memcpy(inst->analysisBuffer, inst->analysisBuffer + inst->blockLen10ms, | 345 memcpy(inst->analysisBuffer, inst->analysisBuffer + inst->blockLen10ms, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 : "memory", "hi", "lo" | 498 : "memory", "hi", "lo" |
| 498 ); | 499 ); |
| 499 #endif | 500 #endif |
| 500 } | 501 } |
| 501 | 502 |
| 502 // For the noise supression process, synthesis, read out fully processed | 503 // For the noise supression process, synthesis, read out fully processed |
| 503 // segment, and update synthesis buffer. | 504 // segment, and update synthesis buffer. |
| 504 void WebRtcNsx_SynthesisUpdate_mips(NoiseSuppressionFixedC* inst, | 505 void WebRtcNsx_SynthesisUpdate_mips(NoiseSuppressionFixedC* inst, |
| 505 int16_t* out_frame, | 506 int16_t* out_frame, |
| 506 int16_t gain_factor) { | 507 int16_t gain_factor) { |
| 507 int iters = inst->blockLen10ms >> 2; | 508 int iters = (int)inst->blockLen10ms >> 2; |
| 508 int after = inst->blockLen10ms & 3; | 509 int after = inst->blockLen10ms & 3; |
| 509 int r0, r1, r2, r3, r4, r5, r6, r7; | 510 int r0, r1, r2, r3, r4, r5, r6, r7; |
| 510 int16_t *window = (int16_t*)inst->window; | 511 int16_t *window = (int16_t*)inst->window; |
| 511 int16_t *real = inst->real; | 512 int16_t *real = inst->real; |
| 512 int16_t *synthBuf = inst->synthesisBuffer; | 513 int16_t *synthBuf = inst->synthesisBuffer; |
| 513 int16_t *out = out_frame; | 514 int16_t *out = out_frame; |
| 514 int sat_pos = 0x7fff; | 515 int sat_pos = 0x7fff; |
| 515 int sat_neg = 0xffff8000; | 516 int sat_neg = 0xffff8000; |
| 516 int block10 = (int)inst->blockLen10ms; | 517 int block10 = (int)inst->blockLen10ms; |
| 517 int anaLen = (int)inst->anaLen; | 518 int anaLen = (int)inst->anaLen; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 : "memory", "hi", "lo" | 855 : "memory", "hi", "lo" |
| 855 ); | 856 ); |
| 856 } | 857 } |
| 857 | 858 |
| 858 #if defined(MIPS_DSP_R1_LE) | 859 #if defined(MIPS_DSP_R1_LE) |
| 859 // Denormalize the real-valued signal |in|, the output from inverse FFT. | 860 // Denormalize the real-valued signal |in|, the output from inverse FFT. |
| 860 void WebRtcNsx_Denormalize_mips(NoiseSuppressionFixedC* inst, | 861 void WebRtcNsx_Denormalize_mips(NoiseSuppressionFixedC* inst, |
| 861 int16_t* in, | 862 int16_t* in, |
| 862 int factor) { | 863 int factor) { |
| 863 int32_t r0, r1, r2, r3, t0; | 864 int32_t r0, r1, r2, r3, t0; |
| 864 int len = inst->anaLen; | 865 int len = (int)inst->anaLen; |
| 865 int16_t *out = &inst->real[0]; | 866 int16_t *out = &inst->real[0]; |
| 866 int shift = factor - inst->normData; | 867 int shift = factor - inst->normData; |
| 867 | 868 |
| 868 __asm __volatile ( | 869 __asm __volatile ( |
| 869 ".set push \n\t" | 870 ".set push \n\t" |
| 870 ".set noreorder \n\t" | 871 ".set noreorder \n\t" |
| 871 "beqz %[len], 8f \n\t" | 872 "beqz %[len], 8f \n\t" |
| 872 " nop \n\t" | 873 " nop \n\t" |
| 873 "bltz %[shift], 4f \n\t" | 874 "bltz %[shift], 4f \n\t" |
| 874 " sra %[t0], %[len], 2 \n\t" | 875 " sra %[t0], %[len], 2 \n\t" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 : "memory" | 945 : "memory" |
| 945 ); | 946 ); |
| 946 } | 947 } |
| 947 #endif | 948 #endif |
| 948 | 949 |
| 949 // Normalize the real-valued signal |in|, the input to forward FFT. | 950 // Normalize the real-valued signal |in|, the input to forward FFT. |
| 950 void WebRtcNsx_NormalizeRealBuffer_mips(NoiseSuppressionFixedC* inst, | 951 void WebRtcNsx_NormalizeRealBuffer_mips(NoiseSuppressionFixedC* inst, |
| 951 const int16_t* in, | 952 const int16_t* in, |
| 952 int16_t* out) { | 953 int16_t* out) { |
| 953 int32_t r0, r1, r2, r3, t0; | 954 int32_t r0, r1, r2, r3, t0; |
| 954 int len = inst->anaLen; | 955 int len = (int)inst->anaLen; |
| 955 int shift = inst->normData; | 956 int shift = inst->normData; |
| 956 | 957 |
| 957 __asm __volatile ( | 958 __asm __volatile ( |
| 958 ".set push \n\t" | 959 ".set push \n\t" |
| 959 ".set noreorder \n\t" | 960 ".set noreorder \n\t" |
| 960 "beqz %[len], 4f \n\t" | 961 "beqz %[len], 4f \n\t" |
| 961 " sra %[t0], %[len], 2 \n\t" | 962 " sra %[t0], %[len], 2 \n\t" |
| 962 "beqz %[t0], 2f \n\t" | 963 "beqz %[t0], 2f \n\t" |
| 963 " andi %[len], %[len], 3 \n\t" | 964 " andi %[len], %[len], 3 \n\t" |
| 964 "1: \n\t" | 965 "1: \n\t" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 992 "4: \n\t" | 993 "4: \n\t" |
| 993 ".set pop \n\t" | 994 ".set pop \n\t" |
| 994 : [t0] "=&r" (t0), [r0] "=&r" (r0), [r1] "=&r" (r1), | 995 : [t0] "=&r" (t0), [r0] "=&r" (r0), [r1] "=&r" (r1), |
| 995 [r2] "=&r" (r2), [r3] "=&r" (r3) | 996 [r2] "=&r" (r2), [r3] "=&r" (r3) |
| 996 : [len] "r" (len), [shift] "r" (shift), [in] "r" (in), | 997 : [len] "r" (len), [shift] "r" (shift), [in] "r" (in), |
| 997 [out] "r" (out) | 998 [out] "r" (out) |
| 998 : "memory" | 999 : "memory" |
| 999 ); | 1000 ); |
| 1000 } | 1001 } |
| 1001 | 1002 |
| OLD | NEW |