资源简介
FFTW ARM cortex-A 平台测试程序
代码片段和文件信息
/*
* test.c
*
* Created on: 2015-3-6
* Author: Sean Zhou
*/
#include
#include
#include
#include
#if 1
#include “fftw3.h“
typedef unsigned long long int u64;
enum {
real_2_complex
complex_2_real
complex_2_complex
};
enum {
FORWARD
BACKWARD
};
typedef struct FFTPlan
{
fftwf_plan planForward;
fftwf_plan planBackward;
fftwf_complex *pIn; // malloc address
fftwf_complex *pOut; // malloc address
int width;
int height;
}FFTPlan;
FFTPlan* fftPlanInit(int width int height)
{
FFTPlan *pPlan = (FFTPlan*)malloc(sizeof(FFTPlan));
pPlan->height = height;
pPlan->width = width;
pPlan->pIn = (fftwf_complex*)fftwf_malloc(width*height*sizeof(fftwf_complex));
pPlan->pOut = (fftwf_complex*)fftwf_malloc(width*height*sizeof(fftwf_complex));
pPlan->planForward = fftwf_plan_dft_2d(height width pPlan->pIn pPlan->pOut FFTW_FORWARD FFTW_ESTIMATE /*FFTW_MEASURE*/);
pPlan->planBackward = fftwf_plan_dft_2d(height width pPlan->pIn pPlan->pOut FFTW_BACKWARD FFTW_ESTIMATE /*FFTW_MEASURE*/);
return pPlan;
}
void fftPlanDestroy(FFTPlan* pPlan)
{
if(pPlan == NULL)
return;
if(pPlan->pIn != NULL)
fftwf_free(pPlan->pIn);
if(pPlan->pOut != NULL)
fftwf_free(pPlan->pOut);
fftwf_destroy_plan(pPlan->planForward);
fftwf_destroy_plan(pPlan->planBackward);
free(pPlan);
}
static void displayOutput(float* pData int width int height)
{
int i j;
printf(“\n displayOutput: \n\n“);
for(i = 0; i < height; i++)
{
for(j = 0; j< width; j++)
{
printf(“%+5f“ *pData++);
printf(“%+5fi “ *pData++);
}
printf(“\n“);
}
}
void fft2(FFTPlan* pPlan float* pIn float* pOut int modeint direct)
{
int i;
int size = pPlan->width * pPlan->height;
float *pTemp;
fftwf_complex *pIn_used = pPlan->pIn;
fftwf_complex *pOut_used = pPlan->pOut;
// input
switch(mode)
{
case real_2_complex:
pTemp = (float*)pIn_used;
for(i = 0; i < size; i++)
{
*pTemp++ = *pIn++;
*pTemp++ = 0;
}
break;
case complex_2_real:
case complex_2_complex:
pTemp = (float*)pIn_used;
memcpy(pTemp pIn size*sizeof(float)*2);
break;
}
// displayInput((float*)pIn_used pPlan->width pPlan->height);
if(direct == FORWARD)
fftwf_execute(pPlan->planForward);
else if(direct == BACKWARD)
fftwf_execute(pPlan->planBackward);
else
{
printf(“Error: invalid parameter \n“);
return;
}
// displayOutput((float*)pOut_used pPlan->width pPlan->height);
// output
switch(mode)
{
case real_2_complex:
case complex_2_complex:
pTemp = (float*)pOut_used;
memcpy(pOut pTemp size*sizeof(float)*2);
break;
case complex_2_real:
pTemp = (float*)pOut_used;
for(i = 0; i < size; i++)
{
*pOut++ = *pTemp;
pTemp += 2;
}
break;
}
}
u64 getCurrentTime()
{
u64 currentTime;
struct timeval tv;
ge
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 25413 2015-03-17 18:44 test_fft\fftw3\include\fftw3q.f03
....... 17900 2015-03-17 18:44 test_fft\fftw3\include\fftw3.h
....... 26820 2015-03-17 18:44 test_fft\fftw3\include\fftw3l.f03
....... 2447 2015-03-17 18:44 test_fft\fftw3\include\fftw3.f
....... 54273 2015-03-17 18:44 test_fft\fftw3\include\fftw3.f03
....... 652 2015-03-17 18:44 test_fft\fftw3\share\info\dir
....... 6170 2015-03-17 18:44 test_fft\fftw3\share\info\fftw3.info
....... 77145 2015-03-17 18:44 test_fft\fftw3\share\info\fftw3.info-2
....... 298053 2015-03-17 18:44 test_fft\fftw3\share\info\fftw3.info-1
....... 3597 2015-03-17 18:44 test_fft\fftw3\share\man\man1\fftw-wisdom-to-conf.1
....... 6901 2015-03-17 18:44 test_fft\fftw3\share\man\man1\fftwf-wisdom.1
文件 1673724 2015-03-17 18:44 test_fft\fftw3\bin\fftwf-wisdom
文件 2279 2015-03-17 18:44 test_fft\fftw3\bin\fftw-wisdom-to-conf
....... 263 2015-03-17 18:44 test_fft\fftw3\lib\pkgconfig\fftw3f.pc
文件 917 2015-03-17 18:44 test_fft\fftw3\lib\libfftw3f.la
....... 2412920 2015-03-17 18:44 test_fft\fftw3\lib\libfftw3f.a
..A..H. 12270 2015-03-06 15:22 test_fft\.cproject
文件 4993 2015-03-18 10:10 test_fft\test.c
..A..H. 838 2015-03-06 15:22 test_fft\.project
文件 1268 2015-03-17 14:42 test_fft\CamLinux.mk
文件 551 2015-03-17 15:59 test_fft\Debug\sources.mk
文件 239 2015-03-17 15:58 test_fft\Debug\ob
文件 1381 2015-03-17 15:59 test_fft\Debug\makefile
文件 669 2015-03-17 15:59 test_fft\Debug\subdir.mk
目录 0 2015-03-17 14:04 test_fft\fftw3\share\man\man1
目录 0 2015-03-17 14:04 test_fft\fftw3\share\info
目录 0 2015-03-17 14:04 test_fft\fftw3\share\man
目录 0 2015-03-17 14:04 test_fft\fftw3\lib\pkgconfig
目录 0 2015-03-17 14:04 test_fft\fftw3\include
目录 0 2015-03-17 14:04 test_fft\fftw3\share
............此处省略8个文件信息
- 上一篇:Cunit单元测试工具的实践入门
- 下一篇:遗传算法约束条件的处理
相关资源
- ARM9芯片手册中文版
- 几种辐射传输模型大气校正及气溶胶
- 基于ARM STM32F429的红外遥控贪吃蛇游戏
- ARM® Cortex™-A Series Programmer’s Guide
- 通过Web远程浏览arm板上的摄像头
- ARM_Cortex_A53
- zbar静态库支持armv7sarm64
- VxWorks for ARM 实验教程
- Cortex-A7官方技术手册
- ARM9嵌入式系统设计基础教程(与教材
- 基于GPS和GSM的车辆定位防盗
- 博创2410开发板—LINUX实验指导书
- IAR EWARM V5嵌入式系统应用编程与开发
- ARM嵌入式WINCE实践教程.pdf
- STM32F103C8T6 串行驱动 12864屏幕
-
Jli
nkARM(已解决V6.70C).rar - 基于ARM的网络视频监控系统106766
- 嵌入式实时操作系统的多线程计算-
- IAR for MSP430 6.1 crack license
- stm32最简单的串口通信和打印程序模板
- ARM cortext A8 spec
- ARM7入门指导包括31个学习 Proteus仿真及
- ARM7最小系统原理图及资料
- usb摄像头在ARM上的测试程序
- QT下自定义控件的拖动,标尺,控件的
- 智能车MT9V034摄像头调试上位机
- arm~~s3c2410中文手册完整版第一部分
- ilg.gnuarmeclipse.repository-2.5.1-20141219151
- sx1301全频道源码及配置文件
- AlarmManagerDemo(含 广播 service activit
评论
共有 条评论