blob: f85751683b86def02a49412065b08835cb5db137 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "pv.h"
/* unconvert essentially undoes what convert does, i.e., it
turns N2+1 PAIRS of amplitude and frequency values in
C into N2 PAIR of complex spectrum data (in rfft format)
in output array S; sampling rate R and interpolation factor
I are used to recompute phase values from frequencies */
void leanunconvert( float *C, float *S, int N2 )
{
int real, imag,
amp, phase;
float a, b;
register int i;
for ( i = 0; i <= N2; i++ ) {
imag = phase = ( real = amp = i<<1 ) + 1;
S[real] = *(C+amp) * cos( *(C+phase) );
if ( i != N2 )
S[imag] = -*(C+amp) * sin( *(C+phase) );
}
}
|