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

RemoveNoise.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Background noise estimation and removal, header
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 <map>
00024 
00025 #include <Alloc.hh>
00026 #include <Exception.hh>
00027 #include <dsp/DSPOp.hh>
00028 
00029 
00030 #ifndef REMOVENOISE_HH
00031     #define REMOVENOISE_HH
00032 
00033     typedef std::map<double, long> ValueMap_t;
00034     typedef std::map<float, long> ValueMapf_t;
00035 
00036 
00040     class clSortedArray : protected clDSPOp
00041     {
00042             enum eDataType
00043             {
00044                 TYPE_DOUBLE,
00045                 TYPE_FLOAT
00046             };
00047             class clXSortedArray : public clException
00048             {
00049                 public:
00050                     clXSortedArray (const char *cpErrorMsg, 
00051                         int iErrorCode = 0) throw() :
00052                         clException(cpErrorMsg, iErrorCode)
00053                     { }
00054             };
00055             eDataType DataType;
00056             long lFrontSerial;
00057             long lTailSerial;
00058             ValueMap_t mapValues;
00059             ValueMapf_t mapValuesf;
00060         public:
00061             clSortedArray ();
00062             ~clSortedArray ();
00069             void Initialize (const float *, long);
00075             void InsertTail (float);
00079             void RemoveHead ();
00087             void GetValues (float *, long);
00094             long GetSize ();
00098             void Clear ();
00099     };
00100 
00101 
00105     class clRemoveNoise : protected clDSPOp
00106     {
00107             long lPrevSize;
00108             clAlloc PrevBuf;
00109             clSortedArray SortedArray;
00110             void GetPosSize (long *, long *, long, long, long);
00111             void GetPosSize1 (long *, long *, long, long, long, long);
00112             void GetPosSize2 (long *, long *, long, long, long, long);
00113             long GetAlphaMedian (const float *, float, long);
00114             long GetAlphaMedian (const double *, double, long);
00115         public:
00116             clRemoveNoise ();
00117             ~clRemoveNoise ();
00141             void TPSW (float *, float, long, long, long);
00143             void TPSW (double *, double, long, long, long);
00152             void TPSW (float *, const float *, float, long, long, long);
00154             void TPSW (double *, const double *, double, long, long, long);
00171             void OTA (float *, float, long, long);
00173             void OTA (double *, double, long, long);
00181             void OTA (float *, const float *, float, long, long);
00183             void OTA (double *, const double *, double, long, long);
00193             void Diff (float *, float, long);
00195             void Diff (double *, double, long);
00203             void Diff (float *, const float *, float, long);
00205             void Diff (double *, const double *, double, long);
00209             void InvDiff (float *, float, long);
00211             void InvDiff (double *, double, long);
00213             void InvDiff (float *, const float *, float, long);
00215             void InvDiff (double *, const double *, double, long);
00216     };
00217     
00218 #endif

Generated on Sun Oct 26 19:11:21 2003 for HASAS by doxygen 1.3.3