svcore
1.9
|
#include <FeatureExtractionModelTransformer.h>
Public Types | |
typedef std::vector< Model * > | Models |
enum | Type { RTThread, NonRTThread } |
Public Slots | |
void | start () |
Public Member Functions | |
FeatureExtractionModelTransformer (Input input, const Transform &transform) | |
FeatureExtractionModelTransformer (Input input, const Transforms &relatedTransforms) | |
virtual | ~FeatureExtractionModelTransformer () |
Models | getAdditionalOutputModels () |
Return any additional models that were created during processing. | |
bool | willHaveAdditionalOutputModels () |
Return true if the current transform is one that may produce additional models (to be retrieved through getAdditionalOutputModels above). | |
void | abandon () |
Hint to the processing thread that it should give up, for example because the process is going to exit or we want to get rid of the input model. | |
Model * | getInputModel () |
Return the input model for the transform. | |
int | getInputChannel () |
Return the input channel spec for the transform. | |
Models | getOutputModels () |
Return the set of output models created by the transform or transforms. | |
Models | detachOutputModels () |
Return the set of output models, also detaching them from the transformer so that they will not be deleted when the transformer is. | |
virtual Models | detachAdditionalOutputModels () |
Return the set of additional models, also detaching them from the transformer. | |
QString | getMessage () const |
Return a warning or error message. | |
Protected Types | |
typedef std::map< int, std::map< int, SparseTimeValueModel * > > | AdditionalModelMap |
Protected Member Functions | |
bool | initialise () |
virtual void | run () |
void | createOutputModels (int n) |
SparseTimeValueModel * | getAdditionalModel (int transformNo, int binNo) |
void | addFeature (int n, int blockFrame, const Vamp::Plugin::Feature &feature) |
void | setCompletion (int, int) |
void | getFrames (int channelCount, long startFrame, long size, float **buffer) |
DenseTimeValueModel * | getConformingInput () |
template<typename ModelClass > | |
bool | isOutput (int n) |
template<typename ModelClass > | |
ModelClass * | getConformingOutput (int n) |
Protected Attributes | |
Vamp::Plugin * | m_plugin |
std::vector < Vamp::Plugin::OutputDescriptor * > | m_descriptors |
std::vector< int > | m_fixedRateFeatureNos |
std::vector< int > | m_outputNos |
std::map< int, bool > | m_needAdditionalModels |
AdditionalModelMap | m_additionalModels |
Transforms | m_transforms |
Input | m_input |
Models | m_outputs |
bool | m_detached |
bool | m_detachedAdd |
bool | m_abandoned |
QString | m_message |
Definition at line 31 of file FeatureExtractionModelTransformer.h.
typedef std::map<int, std::map<int, SparseTimeValueModel *> > FeatureExtractionModelTransformer::AdditionalModelMap [protected] |
Definition at line 64 of file FeatureExtractionModelTransformer.h.
typedef std::vector<Model *> ModelTransformer::Models [inherited] |
Definition at line 43 of file ModelTransformer.h.
enum Thread::Type [inherited] |
FeatureExtractionModelTransformer::FeatureExtractionModelTransformer | ( | Input | input, |
const Transform & | transform | ||
) |
Definition at line 42 of file FeatureExtractionModelTransformer.cpp.
References initialise().
FeatureExtractionModelTransformer::FeatureExtractionModelTransformer | ( | Input | input, |
const Transforms & | relatedTransforms | ||
) |
Definition at line 52 of file FeatureExtractionModelTransformer.cpp.
References initialise().
Definition at line 476 of file FeatureExtractionModelTransformer.cpp.
References m_descriptors, and m_plugin.
FeatureExtractionModelTransformer::Models FeatureExtractionModelTransformer::getAdditionalOutputModels | ( | ) | [virtual] |
Return any additional models that were created during processing.
This might happen if, for example, a transform was configured to split a multi-bin output into separate single-bin models as it processed. These should not be queried until after the transform has completed.
Reimplemented from ModelTransformer.
Definition at line 486 of file FeatureExtractionModelTransformer.cpp.
References m_additionalModels.
bool FeatureExtractionModelTransformer::willHaveAdditionalOutputModels | ( | ) | [virtual] |
Return true if the current transform is one that may produce additional models (to be retrieved through getAdditionalOutputModels above).
Reimplemented from ModelTransformer.
Definition at line 502 of file FeatureExtractionModelTransformer.cpp.
References m_needAdditionalModels.
bool FeatureExtractionModelTransformer::initialise | ( | ) | [protected] |
!!! hang on, this isn't right -- we're modifying a copy
Definition at line 71 of file FeatureExtractionModelTransformer.cpp.
References areTransformsSimilar(), createOutputModels(), Transform::getBlockSize(), DenseTimeValueModel::getChannelCount(), getConformingInput(), TransformFactory::getInstance(), Transform::getPluginIdentifier(), Transform::getPluginVersion(), Model::getSampleRate(), Transform::getStepSize(), FeatureExtractionPluginFactory::instanceFor(), FeatureExtractionPluginFactory::instantiatePlugin(), m_descriptors, m_fixedRateFeatureNos, ModelTransformer::m_message, m_outputNos, m_plugin, ModelTransformer::m_transforms, TransformFactory::makeContextConsistentWithPlugin(), Transform::setBlockSize(), TransformFactory::setPluginParameters(), Transform::setStepSize(), and SVDEBUG.
Referenced by FeatureExtractionModelTransformer().
void FeatureExtractionModelTransformer::run | ( | ) | [protected, virtual] |
!! need a better way to handle this -- previously we were using a QMessageBox but that isn't an appropriate thing to do here either
Implements Thread.
Definition at line 561 of file FeatureExtractionModelTransformer.cpp.
References addFeature(), Transform::getBlockSize(), ModelTransformer::Input::getChannel(), DenseTimeValueModel::getChannelCount(), getConformingInput(), Transform::getDuration(), Model::getEndFrame(), getFrames(), ModelTransformer::Input::getModel(), Model::getSampleRate(), Model::getStartFrame(), Transform::getStartTime(), Transform::getStepSize(), Transform::getWindowType(), FFTModel::isOK(), Model::isReady(), ModelTransformer::m_abandoned, ModelTransformer::m_input, ModelTransformer::m_message, m_outputNos, ModelTransformer::m_outputs, m_plugin, ModelTransformer::m_transforms, StorageAdviser::PrecisionCritical, RealTime::realTime2Frame(), FFTModel::resume(), and setCompletion().
void FeatureExtractionModelTransformer::createOutputModels | ( | int | n | ) | [protected] |
!! SV doesn't actually support display of models that have !! different underlying rates together -- so we always set !! the model rate to be the input model's rate, and adjust !! the resolution appropriately. We can't properly display !! data with a higher resolution than the base model at all
Definition at line 223 of file FeatureExtractionModelTransformer.cpp.
References EditableDenseThreeDimensionalModel::BasicMultirateCompression, getConformingInput(), PluginRDFDescription::getOutputEventTypeURI(), PluginRDFDescription::getOutputSignalTypeURI(), Model::getSampleRate(), m_descriptors, m_needAdditionalModels, m_outputNos, ModelTransformer::m_outputs, m_plugin, ModelTransformer::m_transforms, EditableDenseThreeDimensionalModel::setBinNames(), Model::setRDFTypeURI(), SparseValueModel< PointType >::setScaleUnits(), and Model::setSourceModel().
Referenced by initialise().
SparseTimeValueModel * FeatureExtractionModelTransformer::getAdditionalModel | ( | int | transformNo, |
int | binNo | ||
) | [protected] |
Definition at line 513 of file FeatureExtractionModelTransformer.cpp.
References Model::getRDFTypeURI(), SparseModel< PointType >::getResolution(), SparseModel< PointType >::getSampleRate(), SparseValueModel< PointType >::getScaleUnits(), SparseValueModel< PointType >::getValueMaximum(), SparseValueModel< PointType >::getValueMinimum(), m_additionalModels, m_needAdditionalModels, Model::setRDFTypeURI(), and SparseValueModel< PointType >::setScaleUnits().
Referenced by addFeature().
void FeatureExtractionModelTransformer::addFeature | ( | int | n, |
int | blockFrame, | ||
const Vamp::Plugin::Feature & | feature | ||
) | [protected] |
Definition at line 812 of file FeatureExtractionModelTransformer.cpp.
References SparseValueModel< PointType >::addPoint(), SparseModel< PointType >::addPoint(), RegionModel::addPoint(), getAdditionalModel(), ModelTransformer::Input::getModel(), EditableDenseThreeDimensionalModel::getResolution(), Model::getSampleRate(), m_descriptors, m_fixedRateFeatureNos, ModelTransformer::m_input, m_needAdditionalModels, EditableDenseThreeDimensionalModel::setColumn(), SVDEBUG, and RealTime::toDouble().
Referenced by run().
void FeatureExtractionModelTransformer::setCompletion | ( | int | n, |
int | completion | ||
) | [protected] |
!!m_context.updates);
Definition at line 1011 of file FeatureExtractionModelTransformer.cpp.
References ModelTransformer::abandon(), Model::isAbandoning(), SparseModel< PointType >::setCompletion(), and EditableDenseThreeDimensionalModel::setCompletion().
Referenced by run().
void FeatureExtractionModelTransformer::getFrames | ( | int | channelCount, |
long | startFrame, | ||
long | size, | ||
float ** | buffer | ||
) | [protected] |
Definition at line 752 of file FeatureExtractionModelTransformer.cpp.
References ModelTransformer::Input::getChannel(), DenseTimeValueModel::getChannelCount(), getConformingInput(), DenseTimeValueModel::getData(), and ModelTransformer::m_input.
Referenced by run().
DenseTimeValueModel * FeatureExtractionModelTransformer::getConformingInput | ( | ) | [protected] |
Definition at line 548 of file FeatureExtractionModelTransformer.cpp.
References ModelTransformer::getInputModel(), and SVDEBUG.
Referenced by createOutputModels(), getFrames(), initialise(), and run().
bool FeatureExtractionModelTransformer::isOutput | ( | int | n | ) | [inline, protected] |
Definition at line 81 of file FeatureExtractionModelTransformer.h.
References ModelTransformer::m_outputs.
ModelClass* FeatureExtractionModelTransformer::getConformingOutput | ( | int | n | ) | [inline, protected] |
Definition at line 85 of file FeatureExtractionModelTransformer.h.
References ModelTransformer::m_outputs.
void ModelTransformer::abandon | ( | ) | [inline, inherited] |
Hint to the processing thread that it should give up, for example because the process is going to exit or we want to get rid of the input model.
Caller should still wait() and/or delete the transform before assuming its input and output models are no longer required.
Definition at line 68 of file ModelTransformer.h.
References ModelTransformer::m_abandoned.
Referenced by ModelTransformerFactory::modelAboutToBeDeleted(), and setCompletion().
Model* ModelTransformer::getInputModel | ( | ) | [inline, inherited] |
Return the input model for the transform.
Definition at line 73 of file ModelTransformer.h.
References ModelTransformer::Input::getModel(), and ModelTransformer::m_input.
Referenced by RealTimeEffectModelTransformer::getConformingInput(), getConformingInput(), and ModelTransformerFactory::modelAboutToBeDeleted().
int ModelTransformer::getInputChannel | ( | ) | [inline, inherited] |
Return the input channel spec for the transform.
Definition at line 78 of file ModelTransformer.h.
References ModelTransformer::Input::getChannel(), and ModelTransformer::m_input.
Models ModelTransformer::getOutputModels | ( | ) | [inline, inherited] |
Return the set of output models created by the transform or transforms.
Returns an empty list if any transform could not be initialised; an error message may be available via getMessage() in this situation.
Definition at line 86 of file ModelTransformer.h.
References ModelTransformer::m_outputs.
Referenced by ModelTransformer::detachOutputModels(), ModelTransformerFactory::modelAboutToBeDeleted(), and ModelTransformer::~ModelTransformer().
Models ModelTransformer::detachOutputModels | ( | ) | [inline, inherited] |
Return the set of output models, also detaching them from the transformer so that they will not be deleted when the transformer is.
The caller takes ownership of the models.
Definition at line 93 of file ModelTransformer.h.
References ModelTransformer::getOutputModels(), and ModelTransformer::m_detached.
Referenced by ModelTransformerFactory::transformMultiple().
virtual Models ModelTransformer::detachAdditionalOutputModels | ( | ) | [inline, virtual, inherited] |
Return the set of additional models, also detaching them from the transformer.
The caller takes ownership of the models.
Definition at line 118 of file ModelTransformer.h.
References ModelTransformer::getAdditionalOutputModels(), and ModelTransformer::m_detachedAdd.
Referenced by ModelTransformerFactory::transformerFinished().
QString ModelTransformer::getMessage | ( | ) | const [inline, inherited] |
Return a warning or error message.
If getOutputModel returned a null pointer, this should contain a fatal error message for the transformer; otherwise it may contain a warning to show to the user about e.g. suboptimal block size or whatever.
Definition at line 129 of file ModelTransformer.h.
References ModelTransformer::m_message.
Referenced by ModelTransformerFactory::transformMultiple().
void Thread::start | ( | ) | [slot, inherited] |
Definition at line 34 of file Thread.cpp.
References Thread::m_type, and Thread::RTThread.
Referenced by DecodingWavFileReader::DecodingWavFileReader(), WaveFileModel::fillCache(), MP3FileReader::MP3FileReader(), OggVorbisFileReader::OggVorbisFileReader(), DSSIPluginInstance::requestNonRTThread(), FFTDataServer::resume(), FFTDataServer::FillThread::run(), and ModelTransformerFactory::transformMultiple().
Vamp::Plugin* FeatureExtractionModelTransformer::m_plugin [protected] |
Definition at line 56 of file FeatureExtractionModelTransformer.h.
Referenced by createOutputModels(), initialise(), run(), and ~FeatureExtractionModelTransformer().
std::vector<Vamp::Plugin::OutputDescriptor *> FeatureExtractionModelTransformer::m_descriptors [protected] |
Definition at line 57 of file FeatureExtractionModelTransformer.h.
Referenced by addFeature(), createOutputModels(), initialise(), and ~FeatureExtractionModelTransformer().
std::vector<int> FeatureExtractionModelTransformer::m_fixedRateFeatureNos [protected] |
Definition at line 58 of file FeatureExtractionModelTransformer.h.
Referenced by addFeature(), and initialise().
std::vector<int> FeatureExtractionModelTransformer::m_outputNos [protected] |
Definition at line 59 of file FeatureExtractionModelTransformer.h.
Referenced by createOutputModels(), initialise(), and run().
std::map<int, bool> FeatureExtractionModelTransformer::m_needAdditionalModels [protected] |
Definition at line 63 of file FeatureExtractionModelTransformer.h.
Referenced by addFeature(), createOutputModels(), getAdditionalModel(), and willHaveAdditionalOutputModels().
Definition at line 65 of file FeatureExtractionModelTransformer.h.
Referenced by getAdditionalModel(), and getAdditionalOutputModels().
Transforms ModelTransformer::m_transforms [protected, inherited] |
Definition at line 135 of file ModelTransformer.h.
Referenced by createOutputModels(), initialise(), ModelTransformer::ModelTransformer(), RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(), RealTimeEffectModelTransformer::run(), and run().
Input ModelTransformer::m_input [protected, inherited] |
Definition at line 136 of file ModelTransformer.h.
Referenced by addFeature(), getFrames(), ModelTransformer::getInputChannel(), ModelTransformer::getInputModel(), RealTimeEffectModelTransformer::run(), and run().
Models ModelTransformer::m_outputs [protected, inherited] |
Definition at line 137 of file ModelTransformer.h.
Referenced by createOutputModels(), getConformingOutput(), ModelTransformer::getOutputModels(), isOutput(), RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(), RealTimeEffectModelTransformer::run(), and run().
bool ModelTransformer::m_detached [protected, inherited] |
Definition at line 138 of file ModelTransformer.h.
Referenced by ModelTransformer::detachOutputModels(), and ModelTransformer::~ModelTransformer().
bool ModelTransformer::m_detachedAdd [protected, inherited] |
Definition at line 139 of file ModelTransformer.h.
Referenced by ModelTransformer::detachAdditionalOutputModels(), and ModelTransformer::~ModelTransformer().
bool ModelTransformer::m_abandoned [protected, inherited] |
Definition at line 140 of file ModelTransformer.h.
Referenced by ModelTransformer::abandon(), RealTimeEffectModelTransformer::run(), run(), and ModelTransformer::~ModelTransformer().
QString ModelTransformer::m_message [protected, inherited] |
Definition at line 141 of file ModelTransformer.h.
Referenced by ModelTransformer::getMessage(), initialise(), and run().