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

FIRInterpolator.cc

Go to the documentation of this file.
00001 /*
00002 
00003     FIR Interpolation class
00004     Copyright (C) 2002-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/FIRInterpolator.hh"
00032 
00033 
00034 clFIRInterpolator::clFIRInterpolator ()
00035 {
00036 }
00037 
00038 
00039 clFIRInterpolator::~clFIRInterpolator ()
00040 {
00041     Uninitialize();
00042 }
00043 
00044 
00045 void clFIRInterpolator::Uninitialize ()
00046 {
00047     IntBuf.Free();
00048     clFIRMultiRate::Uninitialize();
00049 }
00050 
00051 
00052 void clFIRInterpolator::Put (const float *fpSrcData, long lSrcCount)
00053 {
00054     long lWorkCount;
00055     float *fpIntBuf;
00056 
00057     lWorkCount = lSrcCount * lFactor;
00058     fpIntBuf = (float *) IntBuf.Size(lWorkCount * sizeof(float));
00059     DSP.Interpolate(fpIntBuf, fpSrcData, lFactor, lSrcCount);
00060     FIR.FIRFilter(fpIntBuf, lWorkCount);
00061     DSP.Mul(fpIntBuf, fGain, lWorkCount);
00062     OutBuf.Put(fpIntBuf, lWorkCount);
00063 }
00064 
00065 
00066 void clFIRInterpolator::Put (const double *dpSrcData, long lSrcCount)
00067 {
00068     long lWorkCount;
00069     double *dpIntBuf;
00070 
00071     lWorkCount = lSrcCount * lFactor;
00072     dpIntBuf = (double *) IntBuf.Size(lWorkCount * sizeof(double));
00073     DSP.Interpolate(dpIntBuf, dpSrcData, lFactor, lSrcCount);
00074     FIR.FIRFilter(dpIntBuf, lWorkCount);
00075     DSP.Mul(dpIntBuf, dGain, lWorkCount);
00076     OutBuf.Put(dpIntBuf, lWorkCount);
00077 }
00078 
00079 
00080 bool clFIRInterpolator::Get (float *fpDestData, long lDestCount)
00081 {
00082     return OutBuf.Get(fpDestData, lDestCount);
00083 }
00084 
00085 
00086 bool clFIRInterpolator::Get (double *dpDestData, long lDestCount)
00087 {
00088     return OutBuf.Get(dpDestData, lDestCount);
00089 }

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