📄 runfft.cpp
字号:
/*
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright(c) 1999-2006 Intel Corporation. All Rights Reserved.
//
*/
// RunFFT.cpp : implementation of the CRunFFT class.
// CRunFFT class processes vectors by ippSP functions listed in
// CallIppFunction member function.
// See CRun & CippsRun classes for more information.
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ippsDemo.h"
#include "Histo.h"
#include "RunFFT.h"
#include "ParmFFTDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRunFFT::CRunFFT()
{
m_pSpec = NULL;
m_buffer = NULL;
m_order = 0;
m_flag = 0;
m_flagFwd = IPP_FFT_DIV_FWD_BY_N;
m_flagInv = IPP_FFT_NODIV_BY_ANY;
m_hint = ippAlgHintFast;
}
CRunFFT::~CRunFFT()
{
}
BOOL CRunFFT::Open(CFunc func)
{
if (!CippsRun::Open(func)) return FALSE;
BOOL bCplx = func.Found("CToC");
if (bCplx && !(func.DstType() & PP_CPLX))
m_UsedVectors = VEC_SRC | VEC_SRC2 | VEC_DST | VEC_DST2;
if (m_Func.Found("Fwd"))
m_flag = m_flagFwd;
else
m_flag = m_flagInv;
m_buffer = NULL;
int type = (int)func.DstType() & ~PP_CPLX;
m_InitName = "";
m_FreeName = "";
m_GetBufSizeName = "";
CString sType = func.TypeName();
if (sType == "32s16s") sType = "16s32s";
sType = (bCplx ? "_C_" : "_R_") + sType;
m_InitName = "ippsFFTInitAlloc" + sType;
m_FreeName = "ippsFFTFree" + sType;
m_GetBufSizeName = "ippsFFTGetBufSize" + sType;
return TRUE;
}
void CRunFFT::Close()
{
if (m_Func.Found("Fwd"))
m_flagFwd = m_flag;
else
m_flagInv = m_flag;
}
CParamDlg* CRunFFT::CreateDlg()
{
return new CParmFFTDlg;
}
void CRunFFT::UpdateData(CParamDlg* parmDlg, BOOL save)
{
CippsRun::UpdateData(parmDlg,save);
CParmFFTDlg *pDlg = (CParmFFTDlg*)parmDlg;
if (save) {
m_order = pDlg->m_Order;
m_flag = pDlg->m_Flag ;
m_hint = (IppHintAlgorithm)pDlg->m_Hint ;
} else {
pDlg->m_Order = m_order;
pDlg->m_Flag = m_flag;
pDlg->m_Hint = (int)m_hint ;
}
}
int CRunFFT::GetDstLength()
{
int length = 1;
for (int i = 0; i < m_order; i++) length <<= 1;
return length;
}
BOOL CRunFFT::BeforeCall()
{
IppStatus status = CallInit();
IppErrorMessage(m_InitName, status);
if (status < 0) return FALSE;
int size;
status = CallGetBufSize(size);
IppErrorMessage(m_GetBufSizeName, status);
if (status < 0) return FALSE;
if (size) m_buffer = (Ipp8u*)ippMalloc(size);
return TRUE;
}
BOOL CRunFFT::AfterCall(BOOL bOk)
{
IppStatus status = CallFree(); m_pSpec = NULL;
IppErrorMessage(m_FreeName, status);
ippFree(m_buffer); m_buffer = NULL;
return TRUE;
}
IppStatus CRunFFT::CallInit()
{
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_16sc,
( (IppsFFTSpec_C_16sc**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_16s,
( (IppsFFTSpec_C_16s**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_R_16s,
( (IppsFFTSpec_R_16s**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_32fc,
( (IppsFFTSpec_C_32fc**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_32f,
( (IppsFFTSpec_C_32f**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_R_32f,
( (IppsFFTSpec_R_32f**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_64fc,
( (IppsFFTSpec_C_64fc**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_64f,
( (IppsFFTSpec_C_64f**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_R_64f,
( (IppsFFTSpec_R_64f**)&m_pSpec,
m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_C_32sc, ((IppsFFTSpec_C_32sc**)&m_pSpec, m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_R_32s, ((IppsFFTSpec_R_32s**)&m_pSpec, m_order, m_flag, m_hint))
MATE_CALL(m_InitName, ippsFFTInitAlloc_R_16s32s, ((IppsFFTSpec_R_16s32s**)&m_pSpec, m_order, m_flag, m_hint))
return stsNoFunction;
}
IppStatus CRunFFT::CallFree()
{
MATE_CALL(m_FreeName, ippsFFTFree_C_16sc, ( (IppsFFTSpec_C_16sc*)m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_16s, ( (IppsFFTSpec_C_16s*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_R_16s, ( (IppsFFTSpec_R_16s*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_32fc, ( (IppsFFTSpec_C_32fc*)m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_32f, ( (IppsFFTSpec_C_32f*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_R_32f, ( (IppsFFTSpec_R_32f*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_64fc, ( (IppsFFTSpec_C_64fc*)m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_64f, ( (IppsFFTSpec_C_64f*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_R_64f, ( (IppsFFTSpec_R_64f*) m_pSpec ))
MATE_CALL(m_FreeName, ippsFFTFree_C_32sc, ((IppsFFTSpec_C_32sc*)m_pSpec))
MATE_CALL(m_FreeName, ippsFFTFree_R_32s, ((IppsFFTSpec_R_32s*)m_pSpec))
MATE_CALL(m_FreeName, ippsFFTFree_R_16s32s,((IppsFFTSpec_R_16s32s*)m_pSpec))
return stsNoFunction;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -