MCPcopy Create free account
hub / github.com/audeering/opensmile / myTick

Method myTick

src/core/vecToWinProcessor.cpp:473–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473eTickResult cVecToWinProcessor::myTick(long long t)
474{
475 /*
476 get a vector, for each field call a processFrame method to modify data
477 then overlap add data to buffer and flush buffer pieces (of size n-olaS) to output level
478
479 NOTE: the input period is always the same, this is the amount of data which will be written to the output in every tick.
480 only the frameSize and thus the percentage of overlap can change
481
482 */
483
484 SMILE_IDBG(4,"tick # %i, running vecToWinProcessor ....",t);
485
486 // check for space in output level
487 if (!(writer_->checkWrite(inputPeriodS))) return TICK_DEST_NO_SPACE;
488
489 // get next frame from dataMemory
490 cVector *vec;
491 vec = reader_->getNextFrame();
492 if (vec==NULL) { return TICK_SOURCE_NOT_AVAIL; } // currently no data available
493
494 if (mat == NULL) mat = new cMatrix(Nfi, inputPeriodS);
495
496
497 long i,j;
498 if (hasOverlap) {
499
500 for (i=0; i<Nfi; i++) {
501 long el = vec->fmeta->fieldToElementIdx(i);
502 long ptr1 = ola[i].bufferPtr;
503 long ptr = ola[i].bufferPtr;
504 FLOAT_DMEM * buf = ola[i].buffer;
505 FLOAT_DMEM * df = vec->data+el;
506 long bs = ola[i].buffersize;
507 double * norm = ola[i].norm;
508
509 if (normaliseAdd) {
510 // multiply input with norm function & add to buffer
511 for (j=0; j<ola[i].framelen; j++) {
512 //setOlaBufferNext(i, (FLOAT_DMEM)( vec->data[el+j] * ola[i].norm[j] ));
513 buf[ptr1++] += df[j] * (FLOAT_DMEM)norm[j];
514 if (ptr1 >= bs) ptr1 = 0;
515 }
516 } else {
517 if (gain != 1.0) {
518 // add to buffer, multiply with gain
519 for (j=0; j<ola[i].framelen; j++) {
520 //setOlaBufferNext(i, vec->data[el+j] * gain);
521 buf[ptr1++] += df[j] * gain;
522 if (ptr1 >= bs) ptr1 = 0;
523 }
524 } else {
525 // add to buffer
526 for (j=0; j<ola[i].framelen; j++) {
527 //setOlaBufferNext(i, vec->data[el+j]);
528 buf[ptr1++] += df[j];
529 if (ptr1 >= bs) ptr1 = 0;
530 }

Callers

nothing calls this directly

Calls 4

getNextFrameMethod · 0.80
fieldToElementIdxMethod · 0.80
setNextMatrixMethod · 0.80
checkWriteMethod · 0.45

Tested by

no test coverage detected