comparison transform/FeatureExtractionModelTransformer.h @ 1739:565575463752 by-id

Some work on models and transformers
author Chris Cannam
date Wed, 26 Jun 2019 14:59:09 +0100
parents ad5f892c0c4d
children fe3f7f8df3a3
comparison
equal deleted inserted replaced
1738:4abc0f08adf9 1739:565575463752
36 36
37 public: 37 public:
38 FeatureExtractionModelTransformer(Input input, 38 FeatureExtractionModelTransformer(Input input,
39 const Transform &transform); 39 const Transform &transform);
40 40
41 // Obtain outputs for a set of transforms that all use the same 41 /**
42 // plugin and input (but with different outputs). i.e. run the 42 * Obtain outputs for a set of transforms that all use the same
43 // plugin once only and collect more than one output from it. 43 * plugin and input (but with different outputs). i.e. run the
44 * plugin once only and collect more than one output from it.
45 */
44 FeatureExtractionModelTransformer(Input input, 46 FeatureExtractionModelTransformer(Input input,
45 const Transforms &relatedTransforms); 47 const Transforms &relatedTransforms);
46 48
47 virtual ~FeatureExtractionModelTransformer(); 49 virtual ~FeatureExtractionModelTransformer();
48 50
55 void deinitialise(); 57 void deinitialise();
56 58
57 void run() override; 59 void run() override;
58 60
59 Vamp::Plugin *m_plugin; 61 Vamp::Plugin *m_plugin;
60 std::vector<Vamp::Plugin::OutputDescriptor *> m_descriptors; // per transform 62
61 std::vector<int> m_fixedRateFeatureNos; // to assign times to FixedSampleRate features 63 // descriptors per transform
62 std::vector<int> m_outputNos; // list of plugin output indexes required for this group of transforms 64 std::vector<Vamp::Plugin::OutputDescriptor> m_descriptors;
65
66 // to assign times to FixedSampleRate features
67 std::vector<int> m_fixedRateFeatureNos;
68
69 // list of plugin output indexes required for this group of transforms
70 std::vector<int> m_outputNos;
63 71
64 void createOutputModels(int n); 72 void createOutputModels(int n);
65 73
66 std::map<int, bool> m_needAdditionalModels; // transformNo -> necessity 74 // map from transformNo -> necessity
67 typedef std::map<int, std::map<int, SparseTimeValueModel *> > AdditionalModelMap; 75 std::map<int, bool> m_needAdditionalModels;
76
77 // map from transformNo -> binNo -> SparseTimeValueModel id
78 typedef std::map<int, std::map<int, ModelId> > AdditionalModelMap;
79
68 AdditionalModelMap m_additionalModels; 80 AdditionalModelMap m_additionalModels;
69 SparseTimeValueModel *getAdditionalModel(int transformNo, int binNo); 81
82 ModelId getAdditionalModel(int transformNo, int binNo);
70 83
71 void addFeature(int n, 84 void addFeature(int n,
72 sv_frame_t blockFrame, 85 sv_frame_t blockFrame,
73 const Vamp::Plugin::Feature &feature); 86 const Vamp::Plugin::Feature &feature);
74 87
81 QMutex m_outputMutex; 94 QMutex m_outputMutex;
82 QWaitCondition m_outputsCondition; 95 QWaitCondition m_outputsCondition;
83 void awaitOutputModels() override; 96 void awaitOutputModels() override;
84 97
85 // just casts: 98 // just casts:
86 99 /*!!!
87 DenseTimeValueModel *getConformingInput(); 100 DenseTimeValueModel *getConformingInput();
88 101
89 template <typename ModelClass> bool isOutput(int n) { 102 template <typename ModelClass> bool isOutput(int n) {
90 return dynamic_cast<ModelClass *>(m_outputs[n]) != 0; 103 return dynamic_cast<ModelClass *>(m_outputs[n]) != 0;
91 } 104 }
100 } else { 113 } else {
101 std::cerr << "FeatureExtractionModelTransformer::getOutput: No such output number " << n << std::endl; 114 std::cerr << "FeatureExtractionModelTransformer::getOutput: No such output number " << n << std::endl;
102 return 0; 115 return 0;
103 } 116 }
104 } 117 }
118 */
105 }; 119 };
106 120
107 #endif 121 #endif
108 122