comparison src/BulkTuningDifference.h @ 50:69ab9a6e7aee

Make BulkTuningDifference much faster when working with more than two files in fine-tuning mode, by storing the reference signal and calculating the fine-tuned features from that (shifted the opposite way) while leaving the other features alone at their coarse rotations. Slightly changes the results but not by a significant amount, I think.
author Chris Cannam
date Wed, 10 Jul 2019 18:52:36 +0100
parents f28b34e7ce8d
children
comparison
equal deleted inserted replaced
49:b8f65462d793 50:69ab9a6e7aee
63 typedef vector<float> Signal; 63 typedef vector<float> Signal;
64 typedef vector<double> TFeature; 64 typedef vector<double> TFeature;
65 65
66 int m_channelCount; 66 int m_channelCount;
67 int m_bpo; 67 int m_bpo;
68 std::unique_ptr<Chromagram> m_refChroma;
69 TFeature m_refTotals;
70 TFeature m_refFeature;
71 std::vector<Signal> m_others;
72 int m_blockSize; 68 int m_blockSize;
73 int m_frameCount; 69 int m_frameCount;
74 float m_maxDuration; 70 float m_maxDuration;
75 int m_maxSemis; 71 int m_maxSemis;
76 bool m_fineTuning; 72 bool m_fineTuning;
77 73
74 std::unique_ptr<Chromagram> m_refChroma;
75 TFeature m_refTotals;
76 std::map<int, TFeature> m_refFeatures; // map from cents-offset to feature
77 Signal m_reference; // we have to retain this when fine-tuning is enabled
78 std::vector<std::shared_ptr<Chromagram>> m_otherChroma;
79 std::vector<TFeature> m_otherTotals;
80
78 Chromagram::Parameters paramsForTuningFrequency(double hz) const; 81 Chromagram::Parameters paramsForTuningFrequency(double hz) const;
79 TFeature computeFeatureFromTotals(const TFeature &totals) const; 82 TFeature computeFeatureFromTotals(const TFeature &totals) const;
80 TFeature computeFeatureFromSignal(const Signal &signal, double hz) const; 83 TFeature computeFeatureFromSignal(const Signal &signal, double hz) const;
81 void rotateFeature(TFeature &feature, int rotation) const; 84 void rotateFeature(TFeature &feature, int rotation) const;
82 double featureDistance(const TFeature &other, int rotation = 0) const; 85 double featureDistance(const TFeature &ref, const TFeature &other,
83 int findBestRotation(const TFeature &other) const; 86 int rotation) const;
84 std::pair<int, double> findFineFrequency(int channel, int coarseCents); 87 int findBestRotation(const TFeature &ref, const TFeature &other) const;
88 std::pair<int, double> findFineFrequency(const TFeature &rotated,
89 int coarseCents);
85 void getRemainingFeaturesForChannel(int channel, FeatureSet &fs); 90 void getRemainingFeaturesForChannel(int channel, FeatureSet &fs);
86 91
87 mutable std::map<string, int> m_outputs; 92 mutable std::map<string, int> m_outputs;
88 }; 93 };
89 94