diff transform/FeatureExtractionModelTransformer.cpp @ 1558:73b3dd65e0b3

Some debug + tidying
author Chris Cannam
date Thu, 18 Oct 2018 13:14:56 +0100
parents 48e9f538e6e9
children 70e172e6cc59
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp	Thu Oct 18 13:12:58 2018 +0100
+++ b/transform/FeatureExtractionModelTransformer.cpp	Thu Oct 18 13:14:56 2018 +0100
@@ -40,6 +40,8 @@
 
 #include <QSettings>
 
+//#define DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN 1
+
 FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in,
                                                                      const Transform &transform) :
     ModelTransformer(in, transform),
@@ -656,9 +658,11 @@
     Transform primaryTransform = m_transforms[0];
 
     while (!input->isReady() && !m_abandoned) {
-        cerr << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl;
+        SVDEBUG << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl;
         usleep(500000);
     }
+    SVDEBUG << "FeatureExtractionModelTransformer::run: Waited, ready = "
+            << input->isReady() << ", m_abandoned = " << m_abandoned << endl;
     if (m_abandoned) return;
 
     sv_samplerate_t sampleRate = input->getSampleRate();
@@ -678,6 +682,7 @@
 
     bool frequencyDomain = (m_plugin->getInputDomain() ==
                             Vamp::Plugin::FrequencyDomain);
+
     std::vector<FFTModel *> fftModels;
 
     if (frequencyDomain) {
@@ -754,10 +759,12 @@
                     contextStart + contextDuration) break;
             }
 
-//        SVDEBUG << "FeatureExtractionModelTransformer::run: blockFrame "
-//                  << blockFrame << ", endFrame " << endFrame << ", blockSize "
-//                  << blockSize << endl;
-
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+            SVDEBUG << "FeatureExtractionModelTransformer::run: blockFrame "
+                    << blockFrame << ", endFrame " << endFrame << ", blockSize "
+                    << blockSize << endl;
+#endif
+        
             int completion = int
                 ((((blockFrame - contextStart) / stepSize) * 99) /
                  (contextDuration / stepSize + 1));
@@ -777,7 +784,8 @@
                             buffers[ch][i*2] = 0.f;
                             buffers[ch][i*2+1] = 0.f;
                         }
-                    }                    
+                    }
+                        
                     error = fftModels[ch]->getError();
                     if (error != "") {
                         SVCERR << "FeatureExtractionModelTransformer::run: Abandoning, error is " << error << endl;
@@ -793,8 +801,10 @@
             if (m_abandoned) break;
 
             Vamp::Plugin::FeatureSet features = m_plugin->process
-                (buffers, RealTime::frame2RealTime(blockFrame, sampleRate).toVampRealTime());
-
+                (buffers,
+                 RealTime::frame2RealTime(blockFrame, sampleRate)
+                 .toVampRealTime());
+            
             if (m_abandoned) break;
 
             for (int j = 0; j < (int)m_outputNos.size(); ++j) {
@@ -1122,8 +1132,10 @@
 void
 FeatureExtractionModelTransformer::setCompletion(int n, int completion)
 {
-//    SVDEBUG << "FeatureExtractionModelTransformer::setCompletion("
-//              << completion << ")" << endl;
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+    SVDEBUG << "FeatureExtractionModelTransformer::setCompletion("
+              << completion << ")" << endl;
+#endif
 
     if (isOutput<SparseOneDimensionalModel>(n)) {