comparison src/Silvet.cpp @ 305:04a3c152e590

Now that we are returning the pitch activation matrix, we don't want to skip silent columns in the postprocess loop
author Chris Cannam
date Fri, 05 Dec 2014 16:46:57 +0000
parents aa7be9d8112e
children af19bee9e53b 07ee4ebea57c
comparison
equal deleted inserted replaced
296:a3229b972463 305:04a3c152e590
529 if (wantShifts) { 529 if (wantShifts) {
530 localBestShifts = 530 localBestShifts =
531 vector<vector<int> >(width, vector<int>(pack.templateNoteCount, 0)); 531 vector<vector<int> >(width, vector<int>(pack.templateNoteCount, 0));
532 } 532 }
533 533
534 vector<bool> present(width, false); 534 double columnThreshold = 1e-5;
535 535
536 #pragma omp parallel for 536 #pragma omp parallel for
537 for (int i = 0; i < width; ++i) { 537 for (int i = 0; i < width; ++i) {
538 538
539 double sum = 0.0; 539 double sum = 0.0;
540 for (int j = 0; j < pack.templateHeight; ++j) { 540 for (int j = 0; j < pack.templateHeight; ++j) {
541 sum += filtered.at(i).at(j); 541 sum += filtered.at(i).at(j);
542 } 542 }
543 if (sum < 1e-5) continue; 543 if (sum < columnThreshold) continue;
544
545 present[i] = true;
546 544
547 EM em(&pack, m_hqMode); 545 EM em(&pack, m_hqMode);
548 546
549 em.setPitchSparsity(pack.pitchSparsity); 547 em.setPitchSparsity(pack.pitchSparsity);
550 em.setSourceSparsity(pack.sourceSparsity); 548 em.setSourceSparsity(pack.sourceSparsity);
574 } 572 }
575 } 573 }
576 } 574 }
577 575
578 for (int i = 0; i < width; ++i) { 576 for (int i = 0; i < width; ++i) {
579
580 if (!present[i]) {
581 // silent column
582 for (int j = 0; j < pack.templateNoteCount; ++j) {
583 m_postFilter[j]->push(0.0);
584 }
585 m_pianoRoll.push_back(map<int, double>());
586 if (wantShifts) {
587 m_pianoRollShifts.push_back(map<int, int>());
588 }
589 continue;
590 }
591 577
592 vector<double> filtered = postProcess 578 vector<double> filtered = postProcess
593 (localPitches[i], localBestShifts[i], wantShifts); 579 (localPitches[i], localBestShifts[i], wantShifts);
594 580
595 Feature f; 581 Feature f;