Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

FFTDecimator.cc

Go to the documentation of this file.
00001 /*
00002 
00003     FFT Decimation class
00004     Copyright (C) 2000-2003 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include <stdio.h>
00024 #ifdef USE_INTEL_MATH
00025     #include <mathimf.h>
00026 #else
00027     #include <math.h>
00028 #endif
00029 #include <float.h>
00030 
00031 #include "dsp/FFTDecimator.hh"
00032 
00033 
00034 clFFTDecimator::clFFTDecimator ()
00035 {
00036 }
00037 
00038 
00039 clFFTDecimator::~clFFTDecimator ()
00040 {
00041     if (bInitialized) Uninitialize();
00042 }
00043 
00044 
00045 void clFFTDecimator::Uninitialize ()
00046 {
00047     DecBuf.Free();
00048     clFFTMultiRate::Uninitialize();
00049 }
00050 
00051 
00052 void clFFTDecimator::Put (const float *fpSrcData, long lSrcCount)
00053 {
00054     Filter.Put(fpSrcData, lSrcCount);
00055 }
00056 
00057 
00058 void clFFTDecimator::Put (const double *dpSrcData, long lSrcCount)
00059 {
00060     Filter.Put(dpSrcData, lSrcCount);
00061 }
00062 
00063 
00064 bool clFFTDecimator::Get (float *fpDestData, long lDestCount)
00065 {
00066     long lWorkCount;
00067     float *fpDecBuf;
00068 
00069     lWorkCount = lDestCount * lFactor;
00070     fpDecBuf = (float *) DecBuf.Size(lWorkCount * sizeof(float));
00071     if (!Filter.Get(fpDecBuf, lWorkCount)) return false;
00072     DSP.Decimate(fpDestData, fpDecBuf, lFactor, lWorkCount);
00073     return true;
00074 }
00075 
00076 
00077 bool clFFTDecimator::Get (double *dpDestData, long lDestCount)
00078 {
00079     long lWorkCount;
00080     double *dpDecBuf;
00081 
00082     lWorkCount = lDestCount * lFactor;
00083     dpDecBuf = (double *) DecBuf.Size(lWorkCount * sizeof(float));
00084     if (!Filter.Get(dpDecBuf, lWorkCount)) return false;
00085     DSP.Decimate(dpDestData, dpDecBuf, lFactor, lWorkCount);
00086     return true;
00087 }

Generated on Tue Mar 2 19:46:44 2004 for libDSP by doxygen 1.3.6