Mercurial > hg > svcore
comparison transform/FeatureExtractionPluginTransform.cpp @ 114:8cd01027502f
* Reorder plugin output querying so as to cope with plugins whose number of
values per output varies depending on the initialise parameters
* Make the colour 3D plot layer tolerably efficient with very dense models
* Allow export of colour 3D plot layers
author | Chris Cannam |
---|---|
date | Wed, 10 May 2006 16:34:03 +0000 |
parents | 47fd14e29813 |
children | 90ade4fa63be |
comparison
equal
deleted
inserted
replaced
113:534373d65f39 | 114:8cd01027502f |
---|---|
71 m_stepSize = m_plugin->getPreferredStepSize(); | 71 m_stepSize = m_plugin->getPreferredStepSize(); |
72 | 72 |
73 if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user | 73 if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user |
74 if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise | 74 if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise |
75 | 75 |
76 DenseTimeValueModel *input = getInput(); | |
77 if (!input) return; | |
78 | |
79 size_t channelCount = input->getChannelCount(); | |
80 if (m_plugin->getMaxChannelCount() < channelCount) { | |
81 channelCount = 1; | |
82 } | |
83 if (m_plugin->getMinChannelCount() > channelCount) { | |
84 std::cerr << "FeatureExtractionPluginTransform:: " | |
85 << "Can't provide enough channels to plugin (plugin min " | |
86 << m_plugin->getMinChannelCount() << ", max " | |
87 << m_plugin->getMaxChannelCount() << ", input model has " | |
88 << input->getChannelCount() << ")" << std::endl; | |
89 return; | |
90 } | |
91 | |
92 if (!m_plugin->initialise(channelCount, m_stepSize, m_blockSize)) { | |
93 std::cerr << "FeatureExtractionPluginTransform: Plugin " | |
94 << m_plugin->getName() << " failed to initialise!" << std::endl; | |
95 return; | |
96 } | |
97 | |
76 //!!! cope with plugins that request non-power-of-2 block sizes in | 98 //!!! cope with plugins that request non-power-of-2 block sizes in |
77 // the frequency domain! | 99 // the frequency domain! |
78 | 100 |
79 Vamp::Plugin::OutputList outputs = m_plugin->getOutputDescriptors(); | 101 Vamp::Plugin::OutputList outputs = m_plugin->getOutputDescriptors(); |
80 | 102 |
108 | 130 |
109 if (m_descriptor->hasFixedBinCount) { | 131 if (m_descriptor->hasFixedBinCount) { |
110 binCount = m_descriptor->binCount; | 132 binCount = m_descriptor->binCount; |
111 } | 133 } |
112 | 134 |
135 std::cerr << "FeatureExtractionPluginTransform: output bin count " | |
136 << binCount << std::endl; | |
137 | |
113 if (binCount > 0 && m_descriptor->hasKnownExtents) { | 138 if (binCount > 0 && m_descriptor->hasKnownExtents) { |
114 minValue = m_descriptor->minValue; | 139 minValue = m_descriptor->minValue; |
115 maxValue = m_descriptor->maxValue; | 140 maxValue = m_descriptor->maxValue; |
116 } | 141 } |
117 | 142 |
191 DenseTimeValueModel *input = getInput(); | 216 DenseTimeValueModel *input = getInput(); |
192 if (!input) return; | 217 if (!input) return; |
193 | 218 |
194 if (!m_output) return; | 219 if (!m_output) return; |
195 | 220 |
221 size_t sampleRate = m_input->getSampleRate(); | |
222 | |
196 size_t channelCount = input->getChannelCount(); | 223 size_t channelCount = input->getChannelCount(); |
197 if (m_plugin->getMaxChannelCount() < channelCount) { | 224 if (m_plugin->getMaxChannelCount() < channelCount) { |
198 channelCount = 1; | 225 channelCount = 1; |
199 } | |
200 if (m_plugin->getMinChannelCount() > channelCount) { | |
201 std::cerr << "FeatureExtractionPluginTransform::run: " | |
202 << "Can't provide enough channels to plugin (plugin min " | |
203 << m_plugin->getMinChannelCount() << ", max " | |
204 << m_plugin->getMaxChannelCount() << ", input model has " | |
205 << input->getChannelCount() << ")" << std::endl; | |
206 return; | |
207 } | |
208 | |
209 size_t sampleRate = m_input->getSampleRate(); | |
210 | |
211 if (!m_plugin->initialise(channelCount, m_stepSize, m_blockSize)) { | |
212 std::cerr << "FeatureExtractionPluginTransform::run: Plugin " | |
213 << m_plugin->getName() << " failed to initialise!" << std::endl; | |
214 return; | |
215 } | 226 } |
216 | 227 |
217 float **buffers = new float*[channelCount]; | 228 float **buffers = new float*[channelCount]; |
218 for (size_t ch = 0; ch < channelCount; ++ch) { | 229 for (size_t ch = 0; ch < channelCount; ++ch) { |
219 buffers[ch] = new float[m_blockSize]; | 230 buffers[ch] = new float[m_blockSize]; |