Mercurial > hg > silvet
comparison src/Silvet.cpp @ 306:af19bee9e53b livemode
Merge from default branch
author | Chris Cannam |
---|---|
date | Fri, 05 Dec 2014 16:47:06 +0000 |
parents | f5f3b50b2b9f 04a3c152e590 |
children | 5a181a427ac8 |
comparison
equal
deleted
inserted
replaced
304:f5f3b50b2b9f | 306:af19bee9e53b |
---|---|
611 if (wantShifts) { | 611 if (wantShifts) { |
612 localBestShifts = | 612 localBestShifts = |
613 vector<vector<int> >(width, vector<int>(pack.templateNoteCount, 0)); | 613 vector<vector<int> >(width, vector<int>(pack.templateNoteCount, 0)); |
614 } | 614 } |
615 | 615 |
616 vector<bool> present(width, false); | 616 double columnThreshold = 1e-5; |
617 | 617 |
618 #pragma omp parallel for | 618 #pragma omp parallel for |
619 for (int i = 0; i < width; ++i) { | 619 for (int i = 0; i < width; ++i) { |
620 | 620 |
621 double sum = 0.0; | 621 double sum = 0.0; |
622 for (int j = 0; j < pack.templateHeight; ++j) { | 622 for (int j = 0; j < pack.templateHeight; ++j) { |
623 sum += filtered.at(i).at(j); | 623 sum += filtered.at(i).at(j); |
624 } | 624 } |
625 if (sum < 1e-5) continue; | 625 if (sum < columnThreshold) continue; |
626 | |
627 present[i] = true; | |
628 | 626 |
629 EM em(&pack, m_mode == HighQualityMode); | 627 EM em(&pack, m_mode == HighQualityMode); |
630 | 628 |
631 em.setPitchSparsity(pack.pitchSparsity); | 629 em.setPitchSparsity(pack.pitchSparsity); |
632 em.setSourceSparsity(pack.sourceSparsity); | 630 em.setSourceSparsity(pack.sourceSparsity); |
656 } | 654 } |
657 } | 655 } |
658 } | 656 } |
659 | 657 |
660 for (int i = 0; i < width; ++i) { | 658 for (int i = 0; i < width; ++i) { |
661 | |
662 if (!present[i]) { | |
663 // silent column | |
664 for (int j = 0; j < pack.templateNoteCount; ++j) { | |
665 m_postFilter[j]->push(0.0); | |
666 } | |
667 m_pianoRoll.push_back(map<int, double>()); | |
668 if (wantShifts) { | |
669 m_pianoRollShifts.push_back(map<int, int>()); | |
670 } | |
671 continue; | |
672 } | |
673 | 659 |
674 vector<double> filtered = postProcess | 660 vector<double> filtered = postProcess |
675 (localPitches[i], localBestShifts[i], wantShifts); | 661 (localPitches[i], localBestShifts[i], wantShifts); |
676 | 662 |
677 Feature f; | 663 Feature f; |