MCPcopy Create free account
hub / github.com/ARM-software/armnn / Invoke

Method Invoke

samples/KeywordSpotting/src/DsCNNPreprocessor.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "DsCNNPreprocessor.hpp"
12
13std::vector<int8_t> kws::DsCNNPreprocessor::Invoke(const float* audioData, size_t dataSize,
14 int quantOffset, float quantScale)
15{
16 auto window = SlidingWindow<const float>(
17 audioData, dataSize,
18 this->m_windowLen, this->m_windowStride);
19
20 uint32_t mfccBufIdx = 0;
21 std::vector<int8_t> outputBuffer;
22 // While we can slide over the window
23 while (window.HasNext())
24 {
25 const float* mfccWindow = window.Next();
26 auto mfccAudioData = std::vector<float>(mfccWindow, mfccWindow + this->m_windowLen);
27
28 auto mfcc = this->m_mfcc->MfccComputeQuant<int8_t>(mfccAudioData, quantScale, quantOffset);
29
30 std::copy(mfcc.begin(), mfcc.end(), std::back_inserter(outputBuffer));
31
32 ++mfccBufIdx;
33 }
34
35 return outputBuffer;
36}
37
38kws::DsCNNPreprocessor::DsCNNPreprocessor(const uint32_t windowLen, const uint32_t windowStride,
39 std::unique_ptr<DsCnnMFCC> mfccInst) :

Callers 2

RunMethod · 0.45
PreProcessingMethod · 0.45

Calls 5

copyFunction · 0.85
HasNextMethod · 0.45
NextMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected