changeset 127:fb4688d2cca5

* make thresholding work (from TW)
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 30 Jun 2009 10:15:01 +0000
parents be19fa17042c
children 9949881120a4
files plugins/DWT.cpp
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/DWT.cpp	Thu Jun 25 14:19:30 2009 +0000
+++ b/plugins/DWT.cpp	Tue Jun 30 10:15:01 2009 +0000
@@ -244,6 +244,7 @@
 //--------------------------------------------------------------------------------------------------	
 
     float tempDet;
+    float aTempDet;
     int outloc;
     int halfblocksize = int(.5 * b);
     int fbufloc;
@@ -280,10 +281,11 @@
                 tempDet += fbuf[fbufloc2] * m_hpd[m];							// detail
             }
 		
-            if (m_absolute == 1) tempDet = fabs(tempDet);
+            aTempDet = fabs(tempDet);
+            if (m_absolute == 1) tempDet = aTempDet;
 			
 			
-            //if (tempDet < m_threshold) tempDet = 0;							// simple hard thresholding, same for each scale
+            if (aTempDet < m_threshold) tempDet = 0;							// simple hard thresholding, same for each scale
             wCoefficients[scale].push_back(tempDet);
         }
 																				
@@ -348,6 +350,7 @@
 	
 	//-------------------------------------------------------------------------------------------	
 	float tempDet;
+        float aTempDet;
 	int outloc;
 	int halfblocksize = int(.5 * b);
 	int fbufloc;
@@ -384,9 +387,10 @@
                     tempAprx[n] += fbuf[fbufloc2] * m_lpd[m];						// approximation
                     tempDet += fbuf[fbufloc2] * m_hpd[m];							// detail
                 }
-			
-                if (m_absolute == 1) tempDet = fabs(tempDet);
-                //if (tempDet < m_threshold) tempDet = 0;							// simple hard thresholding, same for each scale
+
+                aTempDet = fabs(tempDet);
+                if (m_absolute == 1) tempDet = aTempDet;
+                if (aTempDet < m_threshold) tempDet = 0;							// simple hard thresholding, same for each scale
                 wCoefficients[scale].push_back(tempDet);
             }