-
Notifications
You must be signed in to change notification settings - Fork 6
/
CFFTBuffer.cpp
65 lines (55 loc) · 1.44 KB
/
CFFTBuffer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "CFFTBuffer.h"
#include "CInput.h"
#include <memory.h>
CFFTBuffer* CFFTBuffer::m_pInstance = 0L;
CFFTBuffer* CFFTBuffer::GetInstance(void)
{
if(m_pInstance != 0L) return m_pInstance;
m_pInstance = new CFFTBuffer;
return m_pInstance;
}
void CFFTBuffer::DeleteInstance(void)
{
if(m_pInstance == 0L) return;
delete m_pInstance;
m_pInstance = 0L;
}
CFFTBuffer::CFFTBuffer(void)
{
CInput* pInput = CInput::GetInstance();
m_iNumGpus = pInput->m_iNumGpus;
if(m_iNumGpus <= 0) return;
//-------------------------
m_gForward2Ds = new Util::GFFT2D[m_iNumGpus * 2];
m_gInverse2Ds = m_gForward2Ds + m_iNumGpus;
//-----------------------------------------
m_gForward1Ds = new Util::GFFT1D[m_iNumGpus * 2];
m_gInverse1Ds = m_gForward1Ds + m_iNumGpus;
}
CFFTBuffer::~CFFTBuffer(void)
{
if(m_iNumGpus <= 0) return;
delete[] m_gForward2Ds;
delete[] m_gForward1Ds;
m_iNumGpus = 0;
}
Util::GFFT2D* CFFTBuffer::GetForward2D(int iNthGpu)
{
if(iNthGpu < 0 || iNthGpu >= m_iNumGpus) return 0L;
return &m_gForward2Ds[iNthGpu];
}
Util::GFFT2D* CFFTBuffer::GetInverse2D(int iNthGpu)
{
if(iNthGpu < 0 || iNthGpu >= m_iNumGpus) return 0L;
return &m_gInverse2Ds[iNthGpu];
}
Util::GFFT1D* CFFTBuffer::GetForward1D(int iNthGpu)
{
if(iNthGpu < 0 || iNthGpu >= m_iNumGpus) return 0L;
return &m_gForward1Ds[iNthGpu];
}
Util::GFFT1D* CFFTBuffer::GetInverse1D(int iNthGpu)
{
if(iNthGpu < 0 || iNthGpu >= m_iNumGpus) return 0L;
return &m_gInverse1Ds[iNthGpu];
}