2021-10-09 15:16:34 -05:00
|
|
|
/***********************************************************************
|
|
|
|
|
|
|
|
qfouriervariablecalculator.cpp - Source file for
|
2024-05-05 00:20:10 -05:00
|
|
|
QFourierVariableCalculator
|
2021-10-09 15:16:34 -05:00
|
|
|
|
|
|
|
Class for calculating FFts of a variable size.
|
|
|
|
|
|
|
|
************************************************************************
|
|
|
|
|
|
|
|
This file is part of QRealFourier.
|
|
|
|
|
|
|
|
QRealFourier is free software: you can redistribute it and/or modify it
|
|
|
|
under the terms of the Lesser GNU General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Foobar is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the Lesser GNU General Public License
|
|
|
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
************************************************************************
|
|
|
|
|
|
|
|
Copyright © 2012 - 2013 Christoph Stallmann, University of Pretoria
|
|
|
|
|
|
|
|
Developer: Christoph Stallmann
|
|
|
|
University of Pretoria
|
|
|
|
Department of Computer Science
|
|
|
|
|
|
|
|
http://www.visore.org
|
|
|
|
http://sourceforge.net/projects/qrealfourier
|
|
|
|
http://github.com/visore/QRealFourier
|
|
|
|
|
|
|
|
qrealfourier@visore.org
|
|
|
|
qrealfourier@gmail.com
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include "qfouriervariablecalculator.h"
|
|
|
|
|
|
|
|
QFourierVariableCalculator::QFourierVariableCalculator()
|
2024-05-05 00:20:10 -05:00
|
|
|
: QFourierCalculator()
|
2021-10-09 15:16:34 -05:00
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
mFourierTransform = 0;
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QFourierVariableCalculator::~QFourierVariableCalculator()
|
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
if (mFourierTransform != 0)
|
|
|
|
{
|
|
|
|
delete mFourierTransform;
|
|
|
|
}
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void QFourierVariableCalculator::setSize(int size)
|
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
QFourierCalculator::setSize(size);
|
|
|
|
if (mFourierTransform == 0)
|
|
|
|
{
|
|
|
|
mFourierTransform = new ffft::FFTReal<float>(mSize);
|
|
|
|
}
|
|
|
|
else if (mFourierTransform->get_length() != mSize)
|
|
|
|
{
|
|
|
|
delete mFourierTransform;
|
|
|
|
mFourierTransform = new ffft::FFTReal<float>(mSize);
|
|
|
|
}
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void QFourierVariableCalculator::forward()
|
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
mFourierTransform->do_fft(mOutput, mInput);
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void QFourierVariableCalculator::inverse()
|
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
mFourierTransform->do_ifft(mInput, mOutput);
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void QFourierVariableCalculator::rescale()
|
|
|
|
{
|
2024-05-05 00:20:10 -05:00
|
|
|
mFourierTransform->rescale(mInput);
|
2021-10-09 15:16:34 -05:00
|
|
|
}
|