blob: c0e601c8c7bb9d0cf4d6060886b9ee4f2b031877 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
//
// Use, modification and distribution is allowed without limitation,
// warranty, or liability of any kind.
//
/*
modifications compared to original code:
using float format
*/
#ifndef INLINES_H
#define INLINES_H
#include "fft.h"
#include <math.h>
#include <string.h>
// *fast* convenience functions
static inline void calc_freq(short* dest, float *src)
{
static fft_state *state = NULL;
float tmp_out[257];
int i;
if (!state)
state = fft_init();
fft_perform(src, tmp_out, state);
for (i = 0; i < 256; i++)
dest[i] = ((int) sqrt(tmp_out[i + 1])) >> 8;
}
#endif // INLINES_H
|