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

Method processVector

src/lldcore/spectral.cpp:586–1555  ·  view source on GitHub ↗

a derived class should override this method, in order to implement the actual processing

Source from the content-addressed store, hash-verified

584
585// a derived class should override this method, in order to implement the actual processing
586int cSpectral::processVector(const FLOAT_DMEM *src, FLOAT_DMEM *dst, long Nsrc, long Ndst, int idxi) // idxi=input field index
587{
588 long n = 0;
589 long i = 0;
590 long j = 0;
591
592 double N = (double) ((Nsrc-1)*2); // assumes FFT magnitude input array!!
593 double F0 = 1.0/fsSec;
594
595 if (frq == NULL) { // input block's frequency axis
596 // TODO: use frqSet flag to avoid doing the code below on every tick if info==NULL
597 const FrameMetaInfo * fmeta = reader_->getFrameMetaInfo();
598 if ((fmeta != NULL)&&(idxi < fmeta->N)) {
599 // TODO: check input block's type (in fmeta)
600 // fmeta->field[idxi].dataType & SPECTRAL == 1 ?
601 nScale = fmeta->field[idxi].infoSize / sizeof(double);
602 frq = (double *)(fmeta->field[idxi].info);
603 if (nScale > 0) {
604 // old frequency axis computation mode:
605 //nScale=0;
606 if (nScale != Nsrc) {
607 SMILE_IWRN(2,"number of frequency axis points (from info struct) [%i] is not equal to Nsrc [%i] ! Field index: %i (check the processArrayFields option).",nScale,Nsrc,idxi);
608 nScale = MIN(nScale,Nsrc);
609 }
610 }
611 }
612 }
613
614 if (frqScale == -1) {
615 cVectorMeta *mdata = writer_->getLevelMetaDataPtr();
616 if (mdata != NULL && mdata->ID == 1001 /* SCALED_SPEC */) {
617 frqScale = (int)mdata->fData[6];
618 frqScaleParam = (double)mdata->fData[7];
619 } else {
620 frqScale = SPECTSCALE_LINEAR;
621 frqScaleParam = 0.0;
622 }
623 }
624
625 if (specRangeLowerBin == -1) {
626 if (specRangeLower == specRangeUpper && specRangeUpper == 0) {
627 specRangeLowerBin = 1;
628 specRangeUpperBin = Nsrc - 1;
629 } else {
630 for (i = 0; i < Nsrc; i++) {
631 if ((double)specRangeLower >= frq[i]) {
632 specRangeLowerBin = i;
633 }
634 if ((double)specRangeUpper > frq[i]) {
635 specRangeUpperBin = i;
636 }
637 }
638 if (specRangeUpperBin == -1 || specRangeUpperBin >= Nsrc) {
639 specRangeUpperBin = Nsrc - 1;
640 }
641 if (specRangeLowerBin < 0) {
642 specRangeLowerBin = 0;
643 }

Callers

nothing calls this directly

Calls 6

smileStat_entropyFunction · 0.85
getFrameMetaInfoMethod · 0.45
getLevelMetaDataPtrMethod · 0.45

Tested by

no test coverage detected