Slide 37
Slide 37 text
खͰॻ͍ͨJavaScript͔Β
Emscripten͕ੜͨؔ͠Λݺͼग़͢
C++Ͱॻ͔ΕͨߴϑʔϦΤมΛJavaScript͔Β͏ྫ
#include !
#include !
#include !
#include !
#include !
#include "kissfft.hh"!
constexpr size_t fft_size = 2048u; !
extern "C" void fft( float *in, float *out ) {!
typedef kissfft< float >::cpx_type cpx;!
std::array< cpx, fft_size > in_complex;!
boost::copy(!
boost::iterator_range< float* >( in, in + fft_size ),!
boost::begin( in_complex )!
);!
std::array< cpx, fft_size > out_complex;!
kissfft< float > fft_( fft_size, false );!
fft_.transform( in_complex.data(), out_complex.data() );!
boost::transform( out_complex, out, []( const cpx &e ) {!
return e.real();!
} );!
}