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

IIRMultiRate.cc

Go to the documentation of this file.
00001 /*
00002 
00003     Base class for IIR based multirate filters
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/IIRMultiRate.hh"
00032 
00033 /*#include "Dec2IIR.h"
00034 #include "Dec2hpIIR.h"
00035 #include "Dec3IIR.h"
00036 #include "Dec3hpIIR.h"*/
00037 /*#include "Dec2IIR2.h"
00038 #include "Dec2hpIIR2.h"
00039 #include "Dec3IIR2.h"
00040 #include "Dec3hpIIR2.h"*/
00041 #include "Dec2IIR3.h"
00042 #include "Dec2hpIIR3.h"
00043 #include "Dec3IIR3.h"
00044 #include "Dec3hpIIR3.h"
00045 
00046 
00047 clIIRMultiRate::clIIRMultiRate ()
00048 {
00049     lFactor = 1;
00050 }
00051 
00052 
00053 clIIRMultiRate::~clIIRMultiRate ()
00054 {
00055     Uninitialize();
00056 }
00057 
00058 
00059 bool clIIRMultiRate::Initialize (long lFactorP, const float *fpNullPtr,
00060     bool bHighPass)
00061 {
00062     lFactor = lFactorP;
00063     switch (lFactor)
00064     {
00065         case 2:
00066             if (!bHighPass)
00067                 clIIRCascade::Initialize(fpDec2IIRCoeffs, lDec2IIRSize);
00068             else
00069                 clIIRCascade::Initialize(fpDec2hpIIRCoeffs, lDec2hpIIRSize);
00070             break;
00071         case 3:
00072             if (!bHighPass)
00073                 clIIRCascade::Initialize(fpDec3IIRCoeffs, lDec3IIRSize);
00074             else
00075                 clIIRCascade::Initialize(fpDec3hpIIRCoeffs, lDec3hpIIRSize);
00076             break;
00077         default:
00078             return false;
00079     };
00080     return true;
00081 }
00082 
00083 
00084 bool clIIRMultiRate::Initialize (long lFactorP, const double *dpNullPtr,
00085     bool bHighPass)
00086 {
00087     lFactor = lFactorP;
00088     switch (lFactor)
00089     {
00090         case 2:
00091             if (!bHighPass)
00092                 clIIRCascade::Initialize(dpDec2IIRCoeffs, lDec2IIRSize);
00093             else
00094                 clIIRCascade::Initialize(dpDec2hpIIRCoeffs, lDec2hpIIRSize);
00095             break;
00096         case 3:
00097             if (!bHighPass)
00098                 clIIRCascade::Initialize(dpDec3IIRCoeffs, lDec3IIRSize);
00099             else
00100                 clIIRCascade::Initialize(dpDec3hpIIRCoeffs, lDec3hpIIRSize);
00101             break;
00102         default:
00103             return false;
00104     };
00105     return true;
00106 }
00107 
00108 
00109 void clIIRMultiRate::Uninitialize ()
00110 {
00111     clIIRCascade::Uninitialize();
00112 }

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