Mercurial > hg > svcore
comparison transform/FeatureExtractionModelTransformer.cpp @ 1777:d484490cdf69
Split EditableDenseThreeDimensionalModel into explicitly compressed and uncompressed variants. Simplifies the uncompressed version, and we may want to consider whether we need the compressed one at all.
author | Chris Cannam |
---|---|
date | Tue, 10 Sep 2019 16:34:47 +0100 |
parents | e3db163e3f50 |
children | 4eac4bf35b45 |
comparison
equal
deleted
inserted
replaced
1776:5750b9e60818 | 1777:d484490cdf69 |
---|---|
23 #include "data/model/Model.h" | 23 #include "data/model/Model.h" |
24 #include "base/Window.h" | 24 #include "base/Window.h" |
25 #include "base/Exceptions.h" | 25 #include "base/Exceptions.h" |
26 #include "data/model/SparseOneDimensionalModel.h" | 26 #include "data/model/SparseOneDimensionalModel.h" |
27 #include "data/model/SparseTimeValueModel.h" | 27 #include "data/model/SparseTimeValueModel.h" |
28 #include "data/model/EditableDenseThreeDimensionalModel.h" | 28 #include "data/model/BasicCompressedDenseThreeDimensionalModel.h" |
29 #include "data/model/DenseTimeValueModel.h" | 29 #include "data/model/DenseTimeValueModel.h" |
30 #include "data/model/NoteModel.h" | 30 #include "data/model/NoteModel.h" |
31 #include "data/model/RegionModel.h" | 31 #include "data/model/RegionModel.h" |
32 #include "data/model/FFTModel.h" | 32 #include "data/model/FFTModel.h" |
33 #include "data/model/WaveFileModel.h" | 33 #include "data/model/WaveFileModel.h" |
502 | 502 |
503 // Anything that is not a 1D, note, or interval model and that | 503 // Anything that is not a 1D, note, or interval model and that |
504 // has a fixed sample rate and more than one value per result | 504 // has a fixed sample rate and more than one value per result |
505 // must be a dense 3D model. | 505 // must be a dense 3D model. |
506 | 506 |
507 EditableDenseThreeDimensionalModel *model = | 507 auto model = |
508 new EditableDenseThreeDimensionalModel | 508 new BasicCompressedDenseThreeDimensionalModel |
509 (modelRate, modelResolution, binCount, | 509 (modelRate, modelResolution, binCount, false); |
510 EditableDenseThreeDimensionalModel::BasicMultirateCompression, | |
511 false); | |
512 | 510 |
513 if (!m_descriptors[n].binNames.empty()) { | 511 if (!m_descriptors[n].binNames.empty()) { |
514 std::vector<QString> names; | 512 std::vector<QString> names; |
515 for (int i = 0; i < (int)m_descriptors[n].binNames.size(); ++i) { | 513 for (int i = 0; i < (int)m_descriptors[n].binNames.size(); ++i) { |
516 names.push_back(m_descriptors[n].binNames[i].c_str()); | 514 names.push_back(m_descriptors[n].binNames[i].c_str()); |
1146 duration, | 1144 duration, |
1147 feature.label.c_str())); | 1145 feature.label.c_str())); |
1148 } | 1146 } |
1149 } | 1147 } |
1150 | 1148 |
1151 } else if (isOutputType<EditableDenseThreeDimensionalModel>(n)) { | 1149 } else if (isOutputType<BasicCompressedDenseThreeDimensionalModel>(n)) { |
1152 | 1150 |
1153 auto model = ModelById::getAs | 1151 auto model = ModelById::getAs |
1154 <EditableDenseThreeDimensionalModel>(outputId); | 1152 <BasicCompressedDenseThreeDimensionalModel>(outputId); |
1155 if (!model) return; | 1153 if (!model) return; |
1156 | 1154 |
1157 DenseThreeDimensionalModel::Column values = feature.values; | 1155 DenseThreeDimensionalModel::Column values = feature.values; |
1158 | 1156 |
1159 if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) { | 1157 if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) { |
1179 (void) | 1177 (void) |
1180 (setOutputCompletion<SparseOneDimensionalModel>(n, completion) || | 1178 (setOutputCompletion<SparseOneDimensionalModel>(n, completion) || |
1181 setOutputCompletion<SparseTimeValueModel>(n, completion) || | 1179 setOutputCompletion<SparseTimeValueModel>(n, completion) || |
1182 setOutputCompletion<NoteModel>(n, completion) || | 1180 setOutputCompletion<NoteModel>(n, completion) || |
1183 setOutputCompletion<RegionModel>(n, completion) || | 1181 setOutputCompletion<RegionModel>(n, completion) || |
1184 setOutputCompletion<EditableDenseThreeDimensionalModel>(n, completion)); | 1182 setOutputCompletion<BasicCompressedDenseThreeDimensionalModel>(n, completion)); |
1185 } | 1183 } |
1186 | 1184 |