KissFFT: not fully legal speed optimisation (doesn't take care of inf/nan)
This commit is contained in:
parent
469c95f859
commit
a09cf1dc95
|
@ -176,7 +176,8 @@ private:
|
|||
}
|
||||
void C_MUL(cpx_type& c, const cpx_type& a, const cpx_type& b)
|
||||
{
|
||||
c = a * b;
|
||||
//c = a * b;
|
||||
c = cpx_type(a.real() * b.real() - a.imag() * b.imag(), a.real() * b.imag() + a.imag() * b.real());
|
||||
}
|
||||
void C_SUB(cpx_type& c, const cpx_type& a, const cpx_type& b)
|
||||
{
|
||||
|
@ -205,7 +206,9 @@ private:
|
|||
void kf_bfly2(cpx_type* Fout, const size_t fstride, int m)
|
||||
{
|
||||
for(int k = 0; k < m; ++k) {
|
||||
cpx_type t = Fout[m + k] * _traits.twiddle(k * fstride);
|
||||
//cpx_type t = Fout[m + k] * _traits.twiddle(k * fstride);
|
||||
cpx_type t;
|
||||
C_MUL(t, Fout[m + k], _traits.twiddle(k * fstride));
|
||||
Fout[m + k] = Fout[k] - t;
|
||||
Fout[k] += t;
|
||||
}
|
||||
|
@ -216,9 +219,10 @@ private:
|
|||
cpx_type scratch[7];
|
||||
int negative_if_inverse = _inverse * -2 + 1;
|
||||
for(size_t k = 0; k < m; ++k) {
|
||||
scratch[0] = Fout[k + m] * _traits.twiddle(k * fstride);
|
||||
scratch[1] = Fout[k + 2 * m] * _traits.twiddle(k * fstride * 2);
|
||||
scratch[2] = Fout[k + 3 * m] * _traits.twiddle(k * fstride * 3);
|
||||
//scratch[0] = Fout[k + m] * _traits.twiddle(k * fstride);
|
||||
C_MUL(scratch[0], Fout[k + m], _traits.twiddle(k * fstride));
|
||||
C_MUL(scratch[1], Fout[k + 2 * m], _traits.twiddle(k * fstride * 2));
|
||||
C_MUL(scratch[2], Fout[k + 3 * m], _traits.twiddle(k * fstride * 3));
|
||||
scratch[5] = Fout[k] - scratch[1];
|
||||
|
||||
Fout[k] += scratch[1];
|
||||
|
|
Loading…
Reference in New Issue