comparison transform/FeatureExtractionModelTransformer.cpp @ 877:b109b88bfa85 tonioni

Callback handler for additional models at end of processing
author Chris Cannam
date Wed, 29 Jan 2014 15:58:15 +0000
parents 47aa3aeb687b
children 4cbf8c6a462d 8db820ad2b8f
comparison
equal deleted inserted replaced
876:47aa3aeb687b 877:b109b88bfa85
416 // model first as the "standard" output and then create models 416 // model first as the "standard" output and then create models
417 // for bins 1+ in the additional model map (mapping the output 417 // for bins 1+ in the additional model map (mapping the output
418 // descriptor to a list of models indexed by bin-1). But we 418 // descriptor to a list of models indexed by bin-1). But we
419 // don't create the additional models yet, as this case has to 419 // don't create the additional models yet, as this case has to
420 // work even if the number of bins is unknown at this point -- 420 // work even if the number of bins is unknown at this point --
421 // we just create an additional model (copying its parameters 421 // we create an additional model (copying its parameters from
422 // from the default one) each time a new bin is encountered. 422 // the default one) each time a new bin is encountered.
423 423
424 if (!haveBinCount || binCount > 1) { 424 if (!haveBinCount || binCount > 1) {
425 m_needAdditionalModels[n] = true; 425 m_needAdditionalModels[n] = true;
426 } 426 }
427 427
497 } 497 }
498 } 498 }
499 return mm; 499 return mm;
500 } 500 }
501 501
502 bool
503 FeatureExtractionModelTransformer::willHaveAdditionalOutputModels()
504 {
505 for (std::map<int, bool>::const_iterator i =
506 m_needAdditionalModels.begin();
507 i != m_needAdditionalModels.end(); ++i) {
508 if (i->second) return true;
509 }
510 return false;
511 }
512
502 SparseTimeValueModel * 513 SparseTimeValueModel *
503 FeatureExtractionModelTransformer::getAdditionalModel(int n, int binNo) 514 FeatureExtractionModelTransformer::getAdditionalModel(int n, int binNo)
504 { 515 {
505 std::cerr << "getAdditionalModel(" << n << ", " << binNo << ")" << std::endl; 516 std::cerr << "getAdditionalModel(" << n << ", " << binNo << ")" << std::endl;
506 517
556 if (m_outputs.empty()) return; 567 if (m_outputs.empty()) return;
557 568
558 Transform primaryTransform = m_transforms[0]; 569 Transform primaryTransform = m_transforms[0];
559 570
560 while (!input->isReady() && !m_abandoned) { 571 while (!input->isReady() && !m_abandoned) {
561 SVDEBUG << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl; 572 cerr << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl;
562 usleep(500000); 573 usleep(500000);
563 } 574 }
564 if (m_abandoned) return; 575 if (m_abandoned) return;
565 576
566 size_t sampleRate = input->getSampleRate(); 577 size_t sampleRate = input->getSampleRate();