Thread: [Sv1-commits] SF.net SVN: sv1:[1370] sonic-annotator/trunk/runner/ FeatureExtractionManager.cpp
Brought to you by:
cannam
From: <ca...@us...> - 2008-12-11 15:18:46
|
Revision: 1370 http://sv1.svn.sourceforge.net/sv1/?rev=1370&view=rev Author: cannam Date: 2008-12-11 15:18:43 +0000 (Thu, 11 Dec 2008) Log Message: ----------- * possible progress fix Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-11 15:18:10 UTC (rev 1369) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-11 15:18:43 UTC (rev 1370) @@ -544,7 +544,7 @@ } int pp = progress; - progress = ((i - startFrame) * 100) / (endFrame - startFrame); + progress = int(((i - startFrame) * 100.0) / (endFrame - startFrame) + 0.1); if (progress > pp) extractionProgress.setProgress(progress); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-12-12 14:29:46
|
Revision: 1379 http://sv1.svn.sourceforge.net/sv1/?rev=1379&view=rev Author: cannam Date: 2008-12-12 14:29:42 +0000 (Fri, 12 Dec 2008) Log Message: ----------- * Set block & step sizes if not properly specified Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 14:29:34 UTC (rev 1378) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 14:29:42 UTC (rev 1379) @@ -19,6 +19,7 @@ #include <vamp-hostsdk/PluginBufferingAdapter.h> #include <vamp-hostsdk/PluginInputDomainAdapter.h> #include <vamp-hostsdk/PluginSummarisingAdapter.h> +#include <vamp-hostsdk/PluginWrapper.h> #include <vamp-hostsdk/PluginLoader.h> #include <iostream> @@ -32,6 +33,7 @@ using Vamp::HostExt::PluginBufferingAdapter; using Vamp::HostExt::PluginInputDomainAdapter; using Vamp::HostExt::PluginSummarisingAdapter; +using Vamp::HostExt::PluginWrapper; #include "data/fileio/FileSource.h" #include "data/fileio/AudioFileReader.h" @@ -255,6 +257,29 @@ cerr << "NOTE: Loaded and initialised plugin " << plugin << " for transform \"" << transform.getIdentifier().toStdString() << "\"" << endl; + + } else { + + if (transform.getStepSize() == 0 || transform.getBlockSize() == 0) { + + PluginWrapper *pw = dynamic_cast<PluginWrapper *>(plugin); + if (pw) { + PluginBufferingAdapter *pba = + pw->getWrapper<PluginBufferingAdapter>(); + if (pba) { + size_t actualStepSize = 0; + size_t actualBlockSize = 0; + pba->getActualStepAndBlockSizes(actualStepSize, + actualBlockSize); + if (transform.getStepSize() == 0) { + transform.setStepSize(actualStepSize); + } + if (transform.getBlockSize() == 0) { + transform.setBlockSize(actualBlockSize); + } + } + } + } } if (transform.getOutput() == "") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-12-12 15:33:59
|
Revision: 1384 http://sv1.svn.sourceforge.net/sv1/?rev=1384&view=rev Author: cannam Date: 2008-12-12 15:33:55 +0000 (Fri, 12 Dec 2008) Log Message: ----------- * Delete reader after use! Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 15:33:28 UTC (rev 1383) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 15:33:55 UTC (rev 1384) @@ -254,8 +254,7 @@ m_pluginOutputIndices[outputs[i].identifier] = i; } - cerr << "NOTE: Loaded and initialised plugin " << plugin - << " for transform \"" + cerr << "NOTE: Loaded and initialised plugin for transform \"" << transform.getIdentifier().toStdString() << "\"" << endl; } else { @@ -572,6 +571,8 @@ progress = int(((i - startFrame) * 100.0) / (endFrame - startFrame) + 0.1); if (progress > pp) extractionProgress.setProgress(progress); } + + delete reader; for (PluginMap::iterator pi = m_plugins.begin(); pi != m_plugins.end(); ++pi) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-12-12 16:12:09
|
Revision: 1386 http://sv1.svn.sourceforge.net/sv1/?rev=1386&view=rev Author: cannam Date: 2008-12-12 16:12:05 +0000 (Fri, 12 Dec 2008) Log Message: ----------- * progress tweaks Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 16:03:37 UTC (rev 1385) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2008-12-12 16:12:05 UTC (rev 1386) @@ -367,9 +367,9 @@ { if (m_plugins.empty()) return; - ProgressPrinter printer("Retrieving audio data..."); + ProgressPrinter retrievalProgress("Retrieving audio data..."); - FileSource source(audioSource, &printer); + FileSource source(audioSource, &retrievalProgress); if (!source.isAvailable()) { cerr << "ERROR: File or URL \"" << audioSource.toStdString() << "\" could not be located" << endl; @@ -399,7 +399,7 @@ } AudioFileReader *reader = - AudioFileReaderFactory::createReader(source, m_sampleRate, &printer); + AudioFileReaderFactory::createReader(source, m_sampleRate, &retrievalProgress); if (!reader) { cerr << "ERROR: File or URL \"" << audioSource.toStdString() @@ -408,7 +408,9 @@ } size_t channels = reader->getChannelCount(); - + + retrievalProgress.done(); + cerr << "Opened " << channels << "-channel file or URL \"" << audioSource.toStdString() << "\"" << endl; // reject file if it has too few channels, plugin will handle if it has too many This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2009-01-20 18:10:16
|
Revision: 1393 http://sv1.svn.sourceforge.net/sv1/?rev=1393&view=rev Author: cannam Date: 2009-01-20 18:10:13 +0000 (Tue, 20 Jan 2009) Log Message: ----------- * Try to avoid leaving output files open after completion Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-01-16 15:12:23 UTC (rev 1392) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-01-20 18:10:13 UTC (rev 1393) @@ -574,6 +574,8 @@ if (progress > pp) extractionProgress.setProgress(progress); } + std::cerr << "FeatureExtractionManager: deleting audio file reader" << std::endl; + delete reader; for (PluginMap::iterator pi = m_plugins.begin(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2009-09-10 15:26:14
|
Revision: 1621 http://sv1.svn.sourceforge.net/sv1/?rev=1621&view=rev Author: cannam Date: 2009-09-10 15:25:58 +0000 (Thu, 10 Sep 2009) Log Message: ----------- * print a bit more info for diagnostic purposes Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-09-10 14:31:49 UTC (rev 1620) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-09-10 15:25:58 UTC (rev 1621) @@ -203,9 +203,12 @@ size_t pluginStepSize = plugin->getPreferredStepSize(); size_t pluginBlockSize = plugin->getPreferredBlockSize(); + PluginInputDomainAdapter *pida = 0; + // adapt the plugin for buffering, channels, etc. if (plugin->getInputDomain() == Plugin::FrequencyDomain) { - plugin = new PluginInputDomainAdapter(plugin); + pida = new PluginInputDomainAdapter(plugin); + plugin = pida; } PluginBufferingAdapter *pba = new PluginBufferingAdapter(plugin); @@ -257,8 +260,18 @@ } cerr << "NOTE: Loaded and initialised plugin for transform \"" - << transform.getIdentifier().toStdString() << "\"" << endl; + << transform.getIdentifier().toStdString() + << "\" with plugin step size " << actualStepSize + << " and block size " << actualBlockSize + << " (adapter step and block size " << m_blockSize << ")" + << endl; + if (pida) { + cerr << "NOTE: PluginInputDomainAdapter timestamp adjustment is " + + << pida->getTimestampAdjustment() << endl; + } + } else { if (transform.getStepSize() == 0 || transform.getBlockSize() == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2009-09-16 11:28:28
|
Revision: 1626 http://sv1.svn.sourceforge.net/sv1/?rev=1626&view=rev Author: cannam Date: 2009-09-16 11:28:21 +0000 (Wed, 16 Sep 2009) Log Message: ----------- * Use ShiftData method for PluginInputDomainAdapter, ensuring data is pre-padded so that the first block received by the plugin is that centred on 0 rather than starting on 0 Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-09-11 15:42:32 UTC (rev 1625) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2009-09-16 11:28:21 UTC (rev 1626) @@ -208,6 +208,7 @@ // adapt the plugin for buffering, channels, etc. if (plugin->getInputDomain() == Plugin::FrequencyDomain) { pida = new PluginInputDomainAdapter(plugin); + pida->setProcessTimestampMethod(PluginInputDomainAdapter::ShiftData); plugin = pida; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-05-24 15:06:37
|
Revision: 1702 http://sv1.svn.sourceforge.net/sv1/?rev=1702&view=rev Author: cannam Date: 2010-05-24 15:06:30 +0000 (Mon, 24 May 2010) Log Message: ----------- * Fix mixdown for multi-channel source -> 1-channel plugin Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-05-21 10:21:33 UTC (rev 1701) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-05-24 15:06:30 UTC (rev 1702) @@ -429,7 +429,7 @@ cerr << "Opened " << channels << "-channel file or URL \"" << audioSource.toStdString() << "\"" << endl; - // reject file if it has too few channels, plugin will handle if it has too many + // reject file if it has too few channels if ((int)channels < m_channels) { delete reader; throw FileOperationFailed @@ -574,24 +574,40 @@ // leave it to the plugin adapter because the same plugin // adapter may have to serve for input files with various // numbers of channels (so the adapter is simply configured - // with a fixed channel count, generally 1). + // with a fixed channel count). int rc = reader->getChannelCount(); - for (int j = 0; j < m_blockSize; ++j) { + // m_channels is the number of channels we need for the plugin + + int index; + int fc = (int)frames.size(); + if (m_channels == 1) { // only case in which we can sensibly mix down + for (int j = 0; j < m_blockSize; ++j) { + data[0][j] = 0.f; + } + for (int c = 0; c < rc; ++c) { + for (int j = 0; j < m_blockSize; ++j) { + index = j * rc + c; + if (index < fc) data[0][j] += frames[index]; + } + } + for (int j = 0; j < m_blockSize; ++j) { + data[0][j] /= rc; + } + } else { for (int c = 0; c < m_channels; ++c) { - int index; - if (c < rc) { - index = j * rc + c; + for (int j = 0; j < m_blockSize; ++j) { data[c][j] = 0.f; - } else { - index = j * rc + (c % rc); } - if (index < (int)frames.size()) { - data[c][j] += frames[index]; + if (c < rc) { + for (int j = 0; j < m_blockSize; ++j) { + index = j * rc + c; + if (index < fc) data[c][j] += frames[index]; + } } } - } + } Vamp::RealTime timestamp = Vamp::RealTime::frame2RealTime (i, m_sampleRate); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |