Conversation
c++ wrappers for windowing and complex options for the benchmark Signed-off-by: hayati ayguen <h_ayguen@web.de>
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| } |
There was a problem hiding this comment.
this } probably doesn't belong here?
| { | ||
| case pf_winRect: | ||
| break; | ||
| default: assert(0); |
There was a problem hiding this comment.
is it permitted that the default case is not at the end? i have never seen it before. even if it is, i suggest moving it to the end as it's surprising otherwise.
| // pre-calculate small trig table - hope this allow SIMD parallelization | ||
| freal2 *trig_tab = wp.trig_tab; | ||
| const freal phi_inc = TWO_PI / wp.N_div; | ||
| const freal c_inc_cos = rcos(phi_inc); | ||
| const freal c_inc_sin = rsin(phi_inc); | ||
| freal cos_phi = trig_tab[0][0] = c1; | ||
| freal sin_phi = trig_tab[0][1] = c0; |
There was a problem hiding this comment.
The original PFFFT Author Julien Pommier also wrote some fast SIMD functions for sin / cos / exp / log, based on Cephes. You could consider using them, but probably this is not time sensitive code.
|
|
||
| const struct pf_windowing_param_tag * pf_window_alloc(pf_windowing_T win, int N, int w0, freal alpha) | ||
| { | ||
| struct pf_windowing_param_tag * param = new pf_windowing_param_t(); |
There was a problem hiding this comment.
Doesn't gcc warn about using new in C instead of malloc? Well, it should.
|
|
||
| void pf_window_free(const struct pf_windowing_param_tag * param) | ||
| { | ||
| delete param; |
There was a problem hiding this comment.
same here, this should be free.
| pafWin[n] *= a0; | ||
| } | ||
| break; | ||
| default: assert(0); |
| } | ||
| } | ||
| break; | ||
| default: assert(0); |
| const freal mag = rsqrt(cos_phi0 * cos_phi0 + sin_phi0 * sin_phi0); | ||
| cos_phi0 /= mag; | ||
| sin_phi0 /= mag; |
There was a problem hiding this comment.
| const freal mag = rsqrt(cos_phi0 * cos_phi0 + sin_phi0 * sin_phi0); | |
| cos_phi0 /= mag; | |
| sin_phi0 /= mag; | |
| const freal inv_mag = 1.0f/rsqrt(cos_phi0 * cos_phi0 + sin_phi0 * sin_phi0); | |
| cos_phi0 *= inv_mag; | |
| sin_phi0 *= inv_mag; |
There was a problem hiding this comment.
... if only C had a built-in for inverse square roots.
for calculation of a spectrum, to be displayed,
usually a windowing is applied in time domain before calling fft() ..