replaced radix2 input with float

This commit is contained in:
Ahmet Inan 2015-01-14 11:28:51 +01:00
parent 4d8ccd970c
commit 98a9ee7f1f
2 changed files with 6 additions and 6 deletions

View file

@ -20,7 +20,7 @@ limitations under the License.
#include "complex.rsh"
#include "radix2_generated.rsh"
static void radix2(complex_t *out, complex_t *in, int N, int S, int L)
static void radix2(complex_t *out, float *in, int N, int S, int L)
{
if (1 == N) {
out[0] = in[0];
@ -32,9 +32,9 @@ static void radix2(complex_t *out, complex_t *in, int N, int S, int L)
} else if (4 == N) {
complex_t w = radix2_z[1 << L];
out[0] = in[0] + in[S] + in[2 * S] + in[3 * S];
out[1] = in[0] + cmul(w, in[S]) - in[2 * S] - cmul(w, in[3 * S]);
out[1] = in[0] + w * in[S] - in[2 * S] - w * in[3 * S];
out[2] = in[0] - in[S] + in[2 * S] - in[3 * S];
out[3] = in[0] - cmul(w, in[S]) - in[2 * S] + cmul(w, in[3 * S]);
out[3] = in[0] - w * in[S] - in[2 * S] + w * in[3 * S];
return;
}
radix2(out, in, N / 2, 2 * S, L + 1);

View file

@ -74,7 +74,7 @@ static void spectrum_analyzer(int amplitude)
const int M = 7;
static int n, m;
static int buffer[stft_N];
static complex_t input[radix2_N];
static float input[radix2_N];
static complex_t output[radix2_N];
if (disable_analyzer)
@ -103,8 +103,8 @@ static void spectrum_analyzer(int amplitude)
if (!(++n&(radix2_N-1))) {
n &= stft_N - 1;
for (int i = 0; i < stft_N; ++i)
input[i&(radix2_N-1)] += complex(stft_w[i] * buffer[(i+n)&(stft_N-1)], 0.0f);
// yep, were wasting 3x performance
input[i&(radix2_N-1)] += stft_w[i] * buffer[(i+n)&(stft_N-1)];
// yep, were wasting 2x performance
radix2(output, input, radix2_N, 1, 0);
for (int i = 0; i < radix2_N; ++i)
input[i] = 0.0f;