Minor bug fix and cosmetic changes in AEC MIPS optimizations.

Minor bug fix in WebRtcAec_FilterAdaptation_mips, which did not manifest with
gcc 4.7.2, but it did with version 4.9.0. While there, also made some cosmetic
changes to comply with Chromium coding style.

R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/22399004

Patch from Ljubomir Papuga <lpapuga@mips.com>.

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6931 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2014-08-19 15:42:50 +00:00
parent 5a60aed80f
commit 71d9572e9c

View File

@ -43,7 +43,7 @@ void WebRtcAec_ComfortNoise_mips(AecCore* aec,
int16_t* randWptr = randW16; int16_t* randWptr = randW16;
float randTemp, randTemp2, randTemp3, randTemp4; float randTemp, randTemp2, randTemp3, randTemp4;
short tmp1s, tmp2s, tmp3s, tmp4s; int32_t tmp1s, tmp2s, tmp3s, tmp4s;
for (i = 0; i < PART_LEN; i+=4) { for (i = 0; i < PART_LEN; i+=4) {
__asm __volatile ( __asm __volatile (
@ -76,14 +76,14 @@ void WebRtcAec_ComfortNoise_mips(AecCore* aec,
: "memory" : "memory"
); );
u[i+1][0] = (float)cos(randTemp); u[i+1][0] = cosf(randTemp);
u[i+1][1] = (float)sin(randTemp); u[i+1][1] = sinf(randTemp);
u[i+2][0] = (float)cos(randTemp2); u[i+2][0] = cosf(randTemp2);
u[i+2][1] = (float)sin(randTemp2); u[i+2][1] = sinf(randTemp2);
u[i+3][0] = (float)cos(randTemp3); u[i+3][0] = cosf(randTemp3);
u[i+3][1] = (float)sin(randTemp3); u[i+3][1] = sinf(randTemp3);
u[i+4][0] = (float)cos(randTemp4); u[i+4][0] = cosf(randTemp4);
u[i+4][1] = (float)sin(randTemp4); u[i+4][1] = sinf(randTemp4);
} }
// Reject LF noise // Reject LF noise
@ -156,7 +156,6 @@ void WebRtcAec_ComfortNoise_mips(AecCore* aec,
float* efw_ptr_1 = &efw[1][0]; float* efw_ptr_1 = &efw[1][0];
float tmp9f, tmp10f; float tmp9f, tmp10f;
const float tmp1c = 1.0; const float tmp1c = 1.0;
const float tmp2c = 0.0;
__asm __volatile ( __asm __volatile (
".set push \n\t" ".set push \n\t"
@ -260,7 +259,7 @@ void WebRtcAec_ComfortNoise_mips(AecCore* aec,
[tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f), [tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f),
[tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f), [tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f),
[tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f) [tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f)
: [tmp1c] "f" (tmp1c), [tmp2c] "f" (tmp2c), [u_ptr_end] "r" (u_ptr_end) : [tmp1c] "f" (tmp1c), [u_ptr_end] "r" (u_ptr_end)
: "memory" : "memory"
); );
@ -428,7 +427,7 @@ void WebRtcAec_FilterFar_mips(AecCore *aec, float yf[2][PART_LEN1]) {
[f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe),
[aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm), [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm),
[yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len) [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len)
: [len1] "r" (len1) :
: "memory" : "memory"
); );
} }
@ -451,7 +450,7 @@ void WebRtcAec_FilterAdaptation_mips(AecCore *aec,
float* aIm = aec->xfBuf[1] + xPos; float* aIm = aec->xfBuf[1] + xPos;
float* bRe = ef[0]; float* bRe = ef[0];
float* bIm = ef[1]; float* bIm = ef[1];
float *fft_tmp = fft; float* fft_tmp;
float f0, f1, f2, f3, f4, f5, f6 ,f7, f8, f9, f10, f11, f12; float f0, f1, f2, f3, f4, f5, f6 ,f7, f8, f9, f10, f11, f12;
int len = PART_LEN >> 1; int len = PART_LEN >> 1;
@ -459,6 +458,7 @@ void WebRtcAec_FilterAdaptation_mips(AecCore *aec,
__asm __volatile ( __asm __volatile (
".set push \n\t" ".set push \n\t"
".set noreorder \n\t" ".set noreorder \n\t"
"addiu %[fft_tmp], %[fft], 0 \n\t"
"1: \n\t" "1: \n\t"
"lwc1 %[f0], 0(%[aRe]) \n\t" "lwc1 %[f0], 0(%[aRe]) \n\t"
"lwc1 %[f1], 0(%[bRe]) \n\t" "lwc1 %[f1], 0(%[bRe]) \n\t"
@ -519,9 +519,9 @@ void WebRtcAec_FilterAdaptation_mips(AecCore *aec,
[f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8),
[f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11),
[f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm), [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm),
[bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "+r" (fft_tmp), [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp),
[len] "+r" (len), [fft] "=&r" (fft) [len] "+r" (len)
: : [fft] "r" (fft)
: "memory" : "memory"
); );
@ -626,8 +626,8 @@ void WebRtcAec_FilterAdaptation_mips(AecCore *aec,
: [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
[f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5),
[f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len), [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len),
[fft_tmp] "=&r" (fft_tmp) [fft_tmp] "=&r" (fft_tmp), [aRe] "+r" (aRe), [aIm] "+r" (aIm)
: [aRe] "r" (aRe), [aIm] "r" (aIm), [fft] "r" (fft) : [fft] "r" (fft)
: "memory" : "memory"
); );
} }
@ -639,7 +639,9 @@ void WebRtcAec_OverdriveAndSuppress_mips(AecCore *aec,
float efw[2][PART_LEN1]) { float efw[2][PART_LEN1]) {
int i; int i;
const float one = 1.0; const float one = 1.0;
float *p_hNl, *p_efw0, *p_efw1; float* p_hNl;
float* p_efw0;
float* p_efw1;
float* p_WebRtcAec_wC; float* p_WebRtcAec_wC;
float temp1, temp2, temp3, temp4; float temp1, temp2, temp3, temp4;
@ -763,8 +765,7 @@ void WebRtcAec_ScaleErrorSignal_mips(AecCore *aec, float ef[2][PART_LEN1]) {
); );
} }
void WebRtcAec_InitAec_mips(void) void WebRtcAec_InitAec_mips(void) {
{
WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips;
WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips;
WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips;