r7061: initial property settings
[ctsim.git] / libctsim / procsignal.cpp
index 1c4f25f03e7670beca493f8f853569786edd48a2..bdb9fa00626813ca37509601bd7eb7698d10c470 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************
 ** File IDENTIFICATION
 ** 
-**     Name:                   filter.cpp
-**     Purpose:                Routines for signal-procesing filters
-**     Progammer:             Kevin Rosenberg
-**     Date Started:           Aug 1984
+**     Name:            procsignal.cpp
+**     Purpose:         Routines for processing signals and projections
+**     Progammer:          Kevin Rosenberg
+**     Date Started:    Aug 1984
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: procsignal.cpp,v 1.30 2001/03/21 21:45:31 kevin Exp $
+**  $Id$
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -28,7 +28,7 @@
 #include "ct.h"
 
 #ifdef HAVE_WXWINDOWS
-#include "dlgezplot.h"
+#include "nographics.h"
 #endif
 
 // FilterMethod ID/Names
@@ -42,23 +42,23 @@ const int ProcessSignal::FILTER_METHOD_FFTW = 4;
 const int ProcessSignal::FILTER_METHOD_RFFTW =5 ;
 #endif
 const char* const ProcessSignal::s_aszFilterMethodName[] = {
-  {"convolution"},
-  {"fourier"},
-  {"fouier-table"},
-  {"fft"},
+  "convolution",
+  "fourier",
+  "fouier-table",
+  "fft",
 #if HAVE_FFTW
-  {"fftw"},
-  {"rfftw"},
+  "fftw",
+  "rfftw",
 #endif
 };
 const char* const ProcessSignal::s_aszFilterMethodTitle[] = {
-  {"Convolution"},
-  {"Fourier"},
-  {"Fouier Trigometric Table"},
-  {"FFT"},
+  "Convolution",
+  "Fourier",
+  "Fouier Trigometric Table",
+  "FFT",
 #if HAVE_FFTW
-  {"FFTW"},
-  {"Real/Half-Complex FFTW"},
+  "FFTW",
+  "Real/Half-Complex FFTW",
 #endif
 };
 const int ProcessSignal::s_iFilterMethodCount = sizeof(s_aszFilterMethodName) / sizeof(const char*);
@@ -68,12 +68,12 @@ const int ProcessSignal::FILTER_GENERATION_INVALID = -1;
 const int ProcessSignal::FILTER_GENERATION_DIRECT = 0;
 const int ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER = 1;
 const char* const ProcessSignal::s_aszFilterGenerationName[] = {
-  {"direct"},
-  {"inverse-fourier"},
+  "direct",
+  "inverse-fourier",
 };
 const char* const ProcessSignal::s_aszFilterGenerationTitle[] = {
-  {"Direct"},
-  {"Inverse Fourier"},
+  "Direct",
+  "Inverse Fourier",
 };
 const int ProcessSignal::s_iFilterGenerationCount = sizeof(s_aszFilterGenerationName) / sizeof(const char*);
 
@@ -871,9 +871,11 @@ ProcessSignal::addZeropadFactor (int n, int iZeropad)
   if (iZeropad > 0) {
     double dLogBase2 = log(n) / log(2);
     int iLogBase2 = static_cast<int>(floor (dLogBase2));
-    if (dLogBase2 != floor(dLogBase2))
-      iLogBase2++;   // raise up to next power of 2
-    n = 1 << (iLogBase2 + (iZeropad - 1));
+    int iPaddedN = 1 << (iLogBase2 + iZeropad);
+#ifdef DEBUG
+    sys_error (ERR_TRACE, "Zeropadding %d to %d", n, iPaddedN);
+#endif
+    return iPaddedN;
   }
 
   return n;