Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
| /* fix_fft.c - Fixed-point in-place Fast Fourier Transform */ | |
| /* | |
| All data are fixed-point short integers, in which -32768 | |
| to +32768 represent -1.0 to +1.0 respectively. Integer | |
| arithmetic is used for speed, instead of the more natural | |
| floating-point. | |
| For the forward FFT (time -> freq), fixed scaling is | |
| performed to prevent arithmetic overflow, and to map a 0dB | |
| sine/cosine wave (i.e. amplitude = 32767) to two -6dB freq |
| Edit mc’s ini file (either ~/.mc/ini or ~/.config/mc/ini) and look for the line [Colors]. Then, change the line base_color to this: | |
| [Colors] | |
| base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black |
| /* | |
| * Arduino Serial Bypass - use an Arduino as a dumb USB 2 Serial Converter | |
| * | |
| * This code makes the Arduino not interfere with pins 0 and 1 | |
| * which are connected to RX and TX on the FTDI chip. This allows | |
| * the data coming from the FTDI USB 2 Serial chip to flow directly | |
| * to another device. Since RX and TX are labeled from the Arduino's | |
| * point of view, don't cross the wires, but plug the device's | |
| * RX wire into the RX pin 0 and the TX wire into the TX pin 0. | |
| * |
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
| #include <GL/glut.h> | |
| void resize(int width, int height) { | |
| // avoid div-by-zero | |
| if (height == 0) { | |
| height = 1; | |
| } | |
| // calculate the aspect ratio |
| # include <stdlib.h> | |
| # include <stdio.h> | |
| # include <math.h> | |
| int do_benchmark ( void ); | |
| double cpu_time ( void ); | |
| void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); | |
| double ddot ( int n, double dx[], int incx, double dy[], int incy ); | |
| int dgefa ( double a[], int lda, int n, int ipvt[] ); | |
| void dgesl ( double a[], int lda, int n, int ipvt[], double b[], int job ); |
| #ifdef __cplusplus | |
| extern "C" { | |
| #endif | |
| #include <windows.h> | |
| #include <tchar.h> | |
| #include <setupapi.h> | |
| #include <initguid.h> |
| #include <algorithm> | |
| #include <iostream> | |
| #include <string> | |
| #ifdef _WIN32 | |
| #include <limits.h> | |
| #include <intrin.h> | |
| typedef unsigned __int32 uint32_t; | |
| #else | |
| #include <stdint.h> |
| #include "FFT.h" | |
| void fft(int *x_in, | |
| std::complex<double> *x_out, | |
| int N) { | |
| // Make copy of array and apply window | |
| for (int i = 0; i < N; i++) { | |
| x_out[i] = std::complex<double>(x_in[i], 0); | |
| x_out[i] *= 1; // Window |