diff vamp-sdk/PluginHostAdapter.cpp @ 108:1e7ab0399852

* marginal performance improvement through use of reserve() in PluginHostAdapter::convertFeatures
author cannam
date Fri, 08 Feb 2008 10:50:31 +0000
parents b907557b2fb9
children 44e6b94c2696
line wrap: on
line diff
--- a/vamp-sdk/PluginHostAdapter.cpp	Fri Feb 08 10:33:33 2008 +0000
+++ b/vamp-sdk/PluginHostAdapter.cpp	Fri Feb 08 10:50:31 2008 +0000
@@ -394,9 +394,11 @@
 
         if (list.featureCount > 0) {
 
+            Feature feature;
+            feature.values.reserve(list.features[0].valueCount);
+
             for (unsigned int j = 0; j < list.featureCount; ++j) {
-                
-                Feature feature;
+
                 feature.hasTimestamp = list.features[j].hasTimestamp;
                 feature.timestamp = RealTime(list.features[j].sec,
                                              list.features[j].nsec);
@@ -410,6 +412,14 @@
                 }
 
                 fs[i].push_back(feature);
+
+                if (list.features[j].valueCount > 0) {
+                    feature.values.clear();
+                }
+
+                if (list.features[j].label) {
+                    feature.label = "";
+                }
             }
         }
     }