[an error occurred while processing this directive]
Ответ - вот вырезка из dsplib :
(«Телесистемы»: Конференция «Цифровые сигнальные процессоры (DSP) и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено SM 29 марта 2004 г. 11:50
В ответ на: Господа, Товарищи не дайте пропасть в бездне незнания. Хочется получить спектр из выборок... отправлено barmer 29 марта 2004 г. 10:25

/* USAGE */
/* This routine is C-callable and can be called as: */
/* */
/* void DSP_fft16x16r */
/* ( */
/* int N, */
/* short *x, */
/* short *w, */
/* unsigned char *brev, */
/* short *y, */
/* int n_min, */
/* int offset, */
/* int nmax */
/* ); */
/* */
/* N : Length of fft in complex samples, power of 2 <=16384 */
/* x : Pointer to complex data input */
/* w : Pointer to complex twiddle factor (see below) */
/* brev : Pointer to bit reverse table containing 64 entries */
/* y : Pointer to complex data output */
/* n_min : Smallest fft butterfly used in computation */
/* used for decomposing fft into subffts, see notes */
/* offset : Index in complex samples of sub-fft from start of main */
/* fft */
/* nmax : Size of main fft in complex samples */
/* */
/* DESCRIPTION */
/* The benchmark performs a mixed radix forward FFT using a special */
/* sequence of coefficients generated in the following way: */
/* */
/* void tw_gen(short *w, int N) */
/* { */
/* int j, k; */
/* double x_t, y_t, theta1, theta2, theta3; */
/* const double PI = 3.141592654, M = 32767.0; */
/* // M is 16383 for scale by 4 // */
/* */
/* for (j=1, k=0; j <= N>>2; j = j<<2) */
/* { */
/* for (i=0; i < N>>2; i+=j) */
/* { */
/* theta1 = 2*PI*i/N; */
/* x_t = M*cos(theta1); */
/* y_t = M*sin(theta1); */
/* w[k] = (short)x_t; */
/* w[k+1] = (short)y_t; */
/* */
/* theta2 = 4*PI*i/N; */
/* x_t = M*cos(theta2); */
/* y_t = M*sin(theta2); */
/* w[k+2] = (short)x_t; */
/* w[k+3] = (short)y_t; */
/* */
/* theta3 = 6*PI*i/N; */
/* x_t = M*cos(theta3); */
/* y_t = M*sin(theta3); */
/* w[k+4] = (short)x_t; */
/* w[k+5] = (short)y_t; */
/* k+=6; */
/* } */
/* } */
/* } */
/* */
/* This redundent set of twiddle factors is size 2*N short samples. */
/* As pointed out later dividing these twiddle factors by 2 will give */
/* an effective divide by 4 at each stage to guarentee no overflow. */
/* The function is accurate to about 68dB of signal to noise ratio to */
/* the DFT function below: */
/* */
/* void dft(int n, short x[], short y[]) */
/* { */
/* int k,i, index; */
/* const double PI = 3.14159654; */
/* short *p_x; */
/* double arg, fx_0, fx_1, fy_0, fy_1, co, si; */
/* */
/* for(k = 0; k<n; k++) */
/* { */
/* p_x = x; */
/* fy_0 = 0; */
/* fy_1 = 0; */
/* for(i=0; i<n; i++) */
/* { */
/* fx_0 = (double)p_x[0]; */
/* fx_1 = (double)p_x[1]; */
/* p_x += 2; */
/* index = (i*k) % n; */
/* arg = 2*PI*index/n; */
/* co = cos(arg); */
/* si = -sin(arg); */
/* fy_0 += ((fx_0 * co) - (fx_1 * si)); */
/* fy_1 += ((fx_1 * co) + (fx_0 * si)); */
/* } */
/* y[2*k] = (short)2*fy_0/sqrt(N); */
/* y[2*k+1] = (short)2*fy_1/sqrt(N); */
/* } */
/* } */
/* */



Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru