aec_rdft_128: one entry point for each sign.
Review URL: http://webrtc-codereview.appspot.com/61007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@153 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
fae3b31707
commit
d0159d8eb0
@ -290,7 +290,7 @@ static void FilterAdaptation(aec_t *aec, float *fft, float ef[2][PART_LEN1]) {
|
|||||||
-aec->xfBuf[1][xPos + PART_LEN],
|
-aec->xfBuf[1][xPos + PART_LEN],
|
||||||
ef[0][PART_LEN], ef[1][PART_LEN]);
|
ef[0][PART_LEN], ef[1][PART_LEN]);
|
||||||
|
|
||||||
aec_rdft_128(-1, fft);
|
aec_rdft_inverse_128(fft);
|
||||||
memset(fft + PART_LEN, 0, sizeof(float) * PART_LEN);
|
memset(fft + PART_LEN, 0, sizeof(float) * PART_LEN);
|
||||||
|
|
||||||
// fft scaling
|
// fft scaling
|
||||||
@ -300,7 +300,7 @@ static void FilterAdaptation(aec_t *aec, float *fft, float ef[2][PART_LEN1]) {
|
|||||||
fft[j] *= scale;
|
fft[j] *= scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
aec->wfBuf[0][pos] += fft[0];
|
aec->wfBuf[0][pos] += fft[0];
|
||||||
aec->wfBuf[0][pos + PART_LEN] += fft[1];
|
aec->wfBuf[0][pos + PART_LEN] += fft[1];
|
||||||
@ -609,7 +609,7 @@ static void ProcessBlock(aec_t *aec, const short *farend,
|
|||||||
memcpy(aec->dBufH + PART_LEN, dH, sizeof(float) * PART_LEN);
|
memcpy(aec->dBufH + PART_LEN, dH, sizeof(float) * PART_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
// Far fft
|
// Far fft
|
||||||
xf[1][0] = 0;
|
xf[1][0] = 0;
|
||||||
@ -624,7 +624,7 @@ static void ProcessBlock(aec_t *aec, const short *farend,
|
|||||||
|
|
||||||
// Near fft
|
// Near fft
|
||||||
memcpy(fft, aec->dBuf, sizeof(float) * PART_LEN2);
|
memcpy(fft, aec->dBuf, sizeof(float) * PART_LEN2);
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
df[0][1] = 0;
|
df[0][1] = 0;
|
||||||
df[PART_LEN][1] = 0;
|
df[PART_LEN][1] = 0;
|
||||||
df[0][0] = fft[0];
|
df[0][0] = fft[0];
|
||||||
@ -700,7 +700,7 @@ static void ProcessBlock(aec_t *aec, const short *farend,
|
|||||||
fft[2 * i] = yf[0][i];
|
fft[2 * i] = yf[0][i];
|
||||||
fft[2 * i + 1] = yf[1][i];
|
fft[2 * i + 1] = yf[1][i];
|
||||||
}
|
}
|
||||||
aec_rdft_128(-1, fft);
|
aec_rdft_inverse_128(fft);
|
||||||
|
|
||||||
scale = 2.0f / PART_LEN2;
|
scale = 2.0f / PART_LEN2;
|
||||||
for (i = 0; i < PART_LEN; i++) {
|
for (i = 0; i < PART_LEN; i++) {
|
||||||
@ -715,7 +715,7 @@ static void ProcessBlock(aec_t *aec, const short *farend,
|
|||||||
memcpy(aec->eBuf + PART_LEN, e, sizeof(float) * PART_LEN);
|
memcpy(aec->eBuf + PART_LEN, e, sizeof(float) * PART_LEN);
|
||||||
memset(fft, 0, sizeof(float) * PART_LEN);
|
memset(fft, 0, sizeof(float) * PART_LEN);
|
||||||
memcpy(fft + PART_LEN, e, sizeof(float) * PART_LEN);
|
memcpy(fft + PART_LEN, e, sizeof(float) * PART_LEN);
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
ef[1][0] = 0;
|
ef[1][0] = 0;
|
||||||
ef[1][PART_LEN] = 0;
|
ef[1][PART_LEN] = 0;
|
||||||
@ -838,7 +838,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
fft[i] = aec->xBuf[i] * sqrtHanning[i];
|
fft[i] = aec->xBuf[i] * sqrtHanning[i];
|
||||||
fft[PART_LEN + i] = aec->xBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
fft[PART_LEN + i] = aec->xBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
||||||
}
|
}
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
xfw[0][1] = 0;
|
xfw[0][1] = 0;
|
||||||
xfw[PART_LEN][1] = 0;
|
xfw[PART_LEN][1] = 0;
|
||||||
@ -860,7 +860,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
fft[i] = aec->dBuf[i] * sqrtHanning[i];
|
fft[i] = aec->dBuf[i] * sqrtHanning[i];
|
||||||
fft[PART_LEN + i] = aec->dBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
fft[PART_LEN + i] = aec->dBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
||||||
}
|
}
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
dfw[1][0] = 0;
|
dfw[1][0] = 0;
|
||||||
dfw[1][PART_LEN] = 0;
|
dfw[1][PART_LEN] = 0;
|
||||||
@ -876,7 +876,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
fft[i] = aec->eBuf[i] * sqrtHanning[i];
|
fft[i] = aec->eBuf[i] * sqrtHanning[i];
|
||||||
fft[PART_LEN + i] = aec->eBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
fft[PART_LEN + i] = aec->eBuf[PART_LEN + i] * sqrtHanning[PART_LEN - i];
|
||||||
}
|
}
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
efw[1][0] = 0;
|
efw[1][0] = 0;
|
||||||
efw[1][PART_LEN] = 0;
|
efw[1][PART_LEN] = 0;
|
||||||
efw[0][0] = fft[0];
|
efw[0][0] = fft[0];
|
||||||
@ -1053,7 +1053,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
// Sign change required by Ooura fft.
|
// Sign change required by Ooura fft.
|
||||||
fft[2*i + 1] = -efw[1][i];
|
fft[2*i + 1] = -efw[1][i];
|
||||||
}
|
}
|
||||||
aec_rdft_128(-1, fft);
|
aec_rdft_inverse_128(fft);
|
||||||
|
|
||||||
// Overlap and add to obtain output.
|
// Overlap and add to obtain output.
|
||||||
scale = 2.0f / PART_LEN2;
|
scale = 2.0f / PART_LEN2;
|
||||||
@ -1085,7 +1085,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
fft[2*i] = comfortNoiseHband[i][0];
|
fft[2*i] = comfortNoiseHband[i][0];
|
||||||
fft[2*i + 1] = comfortNoiseHband[i][1];
|
fft[2*i + 1] = comfortNoiseHband[i][1];
|
||||||
}
|
}
|
||||||
aec_rdft_128(-1, fft);
|
aec_rdft_inverse_128(fft);
|
||||||
scale = 2.0f / PART_LEN2;
|
scale = 2.0f / PART_LEN2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ static void FilterAdaptationSSE2(aec_t *aec, float *fft, float ef[2][PART_LEN1])
|
|||||||
-aec->xfBuf[1][xPos + PART_LEN],
|
-aec->xfBuf[1][xPos + PART_LEN],
|
||||||
ef[0][PART_LEN], ef[1][PART_LEN]);
|
ef[0][PART_LEN], ef[1][PART_LEN]);
|
||||||
|
|
||||||
aec_rdft_128(-1, fft);
|
aec_rdft_inverse_128(fft);
|
||||||
memset(fft + PART_LEN, 0, sizeof(float)*PART_LEN);
|
memset(fft + PART_LEN, 0, sizeof(float)*PART_LEN);
|
||||||
|
|
||||||
// fft scaling
|
// fft scaling
|
||||||
@ -187,7 +187,7 @@ static void FilterAdaptationSSE2(aec_t *aec, float *fft, float ef[2][PART_LEN1])
|
|||||||
_mm_storeu_ps(&fft[j], fft_scale);
|
_mm_storeu_ps(&fft[j], fft_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aec_rdft_128(1, fft);
|
aec_rdft_forward_128(fft);
|
||||||
|
|
||||||
{
|
{
|
||||||
float wt1 = aec->wfBuf[1][pos];
|
float wt1 = aec->wfBuf[1][pos];
|
||||||
|
@ -477,27 +477,32 @@ static void rftbsub_128_C(float *a) {
|
|||||||
a[65] = -a[65];
|
a[65] = -a[65];
|
||||||
}
|
}
|
||||||
|
|
||||||
void aec_rdft_128(int isgn, float *a) {
|
void aec_rdft_forward_128(float *a) {
|
||||||
const int n = 128;
|
const int n = 128;
|
||||||
int nw;
|
int nw;
|
||||||
float xi;
|
float xi;
|
||||||
|
|
||||||
nw = ip[0];
|
nw = ip[0];
|
||||||
if (isgn >= 0) {
|
|
||||||
bitrv2_32or128(n, ip + 2, a);
|
bitrv2_32or128(n, ip + 2, a);
|
||||||
cftfsub_128(a);
|
cftfsub_128(a);
|
||||||
rftfsub_128(a);
|
rftfsub_128(a);
|
||||||
xi = a[0] - a[1];
|
xi = a[0] - a[1];
|
||||||
a[0] += a[1];
|
a[0] += a[1];
|
||||||
a[1] = xi;
|
a[1] = xi;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
void aec_rdft_inverse_128(float *a) {
|
||||||
|
const int n = 128;
|
||||||
|
int nw;
|
||||||
|
float xi;
|
||||||
|
|
||||||
|
nw = ip[0];
|
||||||
a[1] = 0.5f * (a[0] - a[1]);
|
a[1] = 0.5f * (a[0] - a[1]);
|
||||||
a[0] -= a[1];
|
a[0] -= a[1];
|
||||||
rftbsub_128(a);
|
rftbsub_128(a);
|
||||||
bitrv2_32or128(n, ip + 2, a);
|
bitrv2_32or128(n, ip + 2, a);
|
||||||
cftbsub_128(a);
|
cftbsub_128(a);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// code path selection
|
// code path selection
|
||||||
rft_sub_128_t rftfsub_128;
|
rft_sub_128_t rftfsub_128;
|
||||||
|
@ -19,4 +19,5 @@ extern rft_sub_128_t rftbsub_128;
|
|||||||
// entry points
|
// entry points
|
||||||
void aec_rdft_init(void);
|
void aec_rdft_init(void);
|
||||||
void aec_rdft_init_sse2(void);
|
void aec_rdft_init_sse2(void);
|
||||||
void aec_rdft_128(int isgn, float *a);
|
void aec_rdft_forward_128(float *a);
|
||||||
|
void aec_rdft_inverse_128(float *a);
|
||||||
|
Loading…
Reference in New Issue
Block a user