comparison transform/FeatureExtractionModelTransformer.cpp @ 1775:e3db163e3f50

Some debug tweaks
author Chris Cannam
date Wed, 04 Sep 2019 17:31:02 +0100
parents 9a8327e7b2dc
children d484490cdf69
comparison
equal deleted inserted replaced
1774:f19711ab7074 1775:e3db163e3f50
637 return; 637 return;
638 } 638 }
639 639
640 Transform primaryTransform = m_transforms[0]; 640 Transform primaryTransform = m_transforms[0];
641 641
642 ModelId inputId = getInputModel();
643
642 bool ready = false; 644 bool ready = false;
643 while (!ready && !m_abandoned) { 645 while (!ready && !m_abandoned) {
644 { // scope so as to release input shared_ptr before sleeping 646 { // scope so as to release input shared_ptr before sleeping
645 auto input = ModelById::getAs<DenseTimeValueModel>(getInputModel()); 647 auto input = ModelById::getAs<DenseTimeValueModel>(inputId);
646 if (!input) { 648 if (!input) {
647 abandon(); 649 abandon();
648 return; 650 return;
649 } 651 }
650 ready = input->isReady(); 652 ready = input->isReady();
651 } 653 }
652 if (!ready) { 654 if (!ready) {
653 SVDEBUG << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl; 655 SVDEBUG << "FeatureExtractionModelTransformer::run: Waiting for input model "
656 << inputId << " to be ready..." << endl;
654 usleep(500000); 657 usleep(500000);
655 } 658 }
656 } 659 }
657 if (m_abandoned) return; 660 if (m_abandoned) return;
658 661
659 ModelId inputId = getInputModel(); 662 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
663 SVDEBUG << "FeatureExtractionModelTransformer::run: Input model "
664 << inputId << " is ready, going ahead" << endl;
665 #endif
660 666
661 sv_samplerate_t sampleRate; 667 sv_samplerate_t sampleRate;
662 int channelCount; 668 int channelCount;
663 sv_frame_t startFrame; 669 sv_frame_t startFrame;
664 sv_frame_t endFrame; 670 sv_frame_t endFrame;
694 Vamp::Plugin::FrequencyDomain); 700 Vamp::Plugin::FrequencyDomain);
695 701
696 std::vector<FFTModel *> fftModels; 702 std::vector<FFTModel *> fftModels;
697 703
698 if (frequencyDomain) { 704 if (frequencyDomain) {
705 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
706 SVDEBUG << "FeatureExtractionModelTransformer::run: Input is frequency-domain" << endl;
707 #endif
699 for (int ch = 0; ch < channelCount; ++ch) { 708 for (int ch = 0; ch < channelCount; ++ch) {
700 FFTModel *model = new FFTModel 709 FFTModel *model = new FFTModel
701 (inputId, 710 (inputId,
702 channelCount == 1 ? m_input.getChannel() : ch, 711 channelCount == 1 ? m_input.getChannel() : ch,
703 primaryTransform.getWindowType(), 712 primaryTransform.getWindowType(),
709 delete model; 718 delete model;
710 for (int j = 0; in_range_for(m_outputNos, j); ++j) { 719 for (int j = 0; in_range_for(m_outputNos, j); ++j) {
711 setCompletion(j, 100); 720 setCompletion(j, 100);
712 } 721 }
713 //!!! need a better way to handle this -- previously we were using a QMessageBox but that isn't an appropriate thing to do here either 722 //!!! need a better way to handle this -- previously we were using a QMessageBox but that isn't an appropriate thing to do here either
723 SVDEBUG << "FeatureExtractionModelTransformer::run: Failed to create FFT model for input model " << inputId << ": " << err << endl;
714 throw AllocationFailed("Failed to create the FFT model for this feature extraction model transformer: error is: " + err); 724 throw AllocationFailed("Failed to create the FFT model for this feature extraction model transformer: error is: " + err);
715 } 725 }
716 fftModels.push_back(model); 726 fftModels.push_back(model);
717 } 727 }
728 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
729 SVDEBUG << "FeatureExtractionModelTransformer::run: Created FFT model(s) for frequency-domain input" << endl;
730 #endif
718 } 731 }
719 732
720 RealTime contextStartRT = primaryTransform.getStartTime(); 733 RealTime contextStartRT = primaryTransform.getStartTime();
721 RealTime contextDurationRT = primaryTransform.getDuration(); 734 RealTime contextDurationRT = primaryTransform.getDuration();
722 735