Mercurial > hg > svcore
comparison transform/FeatureExtractionModelTransformer.cpp @ 556:53e5dc8439e7
* get whole columns at a time from fft model when running transform
author | Chris Cannam |
---|---|
date | Mon, 09 Feb 2009 11:53:29 +0000 |
parents | 3ccf48fb81d6 |
children | a40023bebd15 |
comparison
equal
deleted
inserted
replaced
555:8accc7969c1c | 556:53e5dc8439e7 |
---|---|
447 | 447 |
448 long prevCompletion = 0; | 448 long prevCompletion = 0; |
449 | 449 |
450 setCompletion(0); | 450 setCompletion(0); |
451 | 451 |
452 float *reals = 0; | |
453 float *imaginaries = 0; | |
454 if (frequencyDomain) { | |
455 reals = new float[blockSize/2 + 1]; | |
456 imaginaries = new float[blockSize/2 + 1]; | |
457 } | |
458 | |
452 while (!m_abandoned) { | 459 while (!m_abandoned) { |
453 | 460 |
454 if (frequencyDomain) { | 461 if (frequencyDomain) { |
455 if (blockFrame - int(blockSize)/2 > | 462 if (blockFrame - int(blockSize)/2 > |
456 contextStart + contextDuration) break; | 463 contextStart + contextDuration) break; |
470 // channelCount is either m_input.getModel()->channelCount or 1 | 477 // channelCount is either m_input.getModel()->channelCount or 1 |
471 | 478 |
472 if (frequencyDomain) { | 479 if (frequencyDomain) { |
473 for (size_t ch = 0; ch < channelCount; ++ch) { | 480 for (size_t ch = 0; ch < channelCount; ++ch) { |
474 int column = (blockFrame - startFrame) / stepSize; | 481 int column = (blockFrame - startFrame) / stepSize; |
482 fftModels[ch]->getValuesAt(column, reals, imaginaries); | |
475 for (size_t i = 0; i <= blockSize/2; ++i) { | 483 for (size_t i = 0; i <= blockSize/2; ++i) { |
476 fftModels[ch]->getValuesAt | 484 buffers[ch][i*2] = reals[i]; |
477 (column, i, buffers[ch][i*2], buffers[ch][i*2+1]); | 485 buffers[ch][i*2+1] = imaginaries[i]; |
478 } | 486 } |
479 } | 487 } |
480 } else { | 488 } else { |
481 getFrames(channelCount, blockFrame, blockSize, buffers); | 489 getFrames(channelCount, blockFrame, blockSize, buffers); |
482 } | 490 } |
516 | 524 |
517 if (frequencyDomain) { | 525 if (frequencyDomain) { |
518 for (size_t ch = 0; ch < channelCount; ++ch) { | 526 for (size_t ch = 0; ch < channelCount; ++ch) { |
519 delete fftModels[ch]; | 527 delete fftModels[ch]; |
520 } | 528 } |
529 delete[] reals; | |
530 delete[] imaginaries; | |
521 } | 531 } |
522 } | 532 } |
523 | 533 |
524 void | 534 void |
525 FeatureExtractionModelTransformer::getFrames(int channelCount, | 535 FeatureExtractionModelTransformer::getFrames(int channelCount, |