comparison vamp-sdk/hostext/PluginSummarisingAdapter.cpp @ 177:2258794251be

* fix uninitialised count in summariser
author cannam
date Wed, 06 Aug 2008 14:45:47 +0000
parents adfb6348881c
children a5ede8515893
comparison
equal deleted inserted replaced
176:adfb6348881c 177:2258794251be
66 typedef std::map<int, ValueList> BinValueMap; 66 typedef std::map<int, ValueList> BinValueMap;
67 67
68 struct OutputAccumulator { 68 struct OutputAccumulator {
69 int count; 69 int count;
70 BinValueMap values; 70 BinValueMap values;
71 OutputAccumulator() : count(0), values() { }
71 }; 72 };
72 73
73 typedef std::map<int, OutputAccumulator> OutputAccumulatorMap; 74 typedef std::map<int, OutputAccumulator> OutputAccumulatorMap;
74 OutputAccumulatorMap m_accumulators; 75 OutputAccumulatorMap m_accumulators;
75 76
169 //!!! should be enough -- we do need to ensure that all data has 170 //!!! should be enough -- we do need to ensure that all data has
170 //!!! been processed though!) 171 //!!! been processed though!)
171 FeatureList fl; 172 FeatureList fl;
172 for (SummarySegmentMap::const_iterator i = m_summaries[output].begin(); 173 for (SummarySegmentMap::const_iterator i = m_summaries[output].begin();
173 i != m_summaries[output].end(); ++i) { 174 i != m_summaries[output].end(); ++i) {
175
174 Feature f; 176 Feature f;
175 f.hasTimestamp = true; 177 f.hasTimestamp = true;
176 f.timestamp = i->first; 178 f.timestamp = i->first;
177 f.hasDuration = false; 179 f.hasDuration = false;
180
178 for (OutputSummary::const_iterator j = i->second.begin(); 181 for (OutputSummary::const_iterator j = i->second.begin();
179 j != i->second.end(); ++j) { 182 j != i->second.end(); ++j) {
180 183
181 // these will be ordered by bin number, and no bin numbers 184 // these will be ordered by bin number, and no bin numbers
182 // will be missing except at the end (because of the way 185 // will be missing except at the end (because of the way
223 226
224 case Count: 227 case Count:
225 result = summary.count; 228 result = summary.count;
226 break; 229 break;
227 } 230 }
231
232 f.values.push_back(result);
228 } 233 }
229 234
230 fl.push_back(f); 235 fl.push_back(f);
231 } 236 }
232 return fl; 237 return fl;