diff options
author | alexander <alexander.efremov@arm.com> | 2021-04-29 20:36:09 +0100 |
---|---|---|
committer | Alexander Efremov <alexander.efremov@arm.com> | 2021-05-04 19:57:44 +0000 |
commit | c350cdced0a8a2ca17376f58813e6d48d796ac7c (patch) | |
tree | f732cde664837a7cb9429b17e1366bb31a635b15 /source/use_case/asr/include | |
parent | 6448932cc1c612d78e62c778ebb228b3cbe96a58 (diff) | |
download | ml-embedded-evaluation-kit-c350cdced0a8a2ca17376f58813e6d48d796ac7c.tar.gz |
MLECO-1868: Code static analyzer warnings fixes
Signed-off-by: alexander <alexander.efremov@arm.com>
Change-Id: Ie423e9cad3fabec6ab077ded7236813fe4933dea
Diffstat (limited to 'source/use_case/asr/include')
-rw-r--r-- | source/use_case/asr/include/AsrClassifier.hpp | 6 | ||||
-rw-r--r-- | source/use_case/asr/include/Wav2LetterMfcc.hpp | 4 | ||||
-rw-r--r-- | source/use_case/asr/include/Wav2LetterModel.hpp | 4 | ||||
-rw-r--r-- | source/use_case/asr/include/Wav2LetterPostprocess.hpp | 18 | ||||
-rw-r--r-- | source/use_case/asr/include/Wav2LetterPreprocess.hpp | 38 |
5 files changed, 35 insertions, 35 deletions
diff --git a/source/use_case/asr/include/AsrClassifier.hpp b/source/use_case/asr/include/AsrClassifier.hpp index 1a63814..2c97a39 100644 --- a/source/use_case/asr/include/AsrClassifier.hpp +++ b/source/use_case/asr/include/AsrClassifier.hpp @@ -51,9 +51,9 @@ namespace app { * @return true if successful, false otherwise. **/ template<typename T> - bool _GetTopResults(TfLiteTensor* tensor, - std::vector<ClassificationResult>& vecResults, - const std::vector <std::string>& labels, double scale, double zeroPoint); + bool GetTopResults(TfLiteTensor* tensor, + std::vector<ClassificationResult>& vecResults, + const std::vector <std::string>& labels, double scale, double zeroPoint); }; } /* namespace app */ diff --git a/source/use_case/asr/include/Wav2LetterMfcc.hpp b/source/use_case/asr/include/Wav2LetterMfcc.hpp index 3cb43b9..b5a21d3 100644 --- a/source/use_case/asr/include/Wav2LetterMfcc.hpp +++ b/source/use_case/asr/include/Wav2LetterMfcc.hpp @@ -60,8 +60,8 @@ namespace audio { bool ApplyMelFilterBank( std::vector<float>& fftVec, std::vector<std::vector<float>>& melFilterBank, - std::vector<int32_t>& filterBankFilterFirst, - std::vector<int32_t>& filterBankFilterLast, + std::vector<uint32_t>& filterBankFilterFirst, + std::vector<uint32_t>& filterBankFilterLast, std::vector<float>& melEnergies) override; /** diff --git a/source/use_case/asr/include/Wav2LetterModel.hpp b/source/use_case/asr/include/Wav2LetterModel.hpp index b801e10..4c62578 100644 --- a/source/use_case/asr/include/Wav2LetterModel.hpp +++ b/source/use_case/asr/include/Wav2LetterModel.hpp @@ -49,10 +49,10 @@ namespace app { private: /* Maximum number of individual operations that can be enlisted. */ - static constexpr int _ms_maxOpCnt = 5; + static constexpr int ms_maxOpCnt = 5; /* A mutable op resolver instance. */ - tflite::MicroMutableOpResolver<_ms_maxOpCnt> _m_opResolver; + tflite::MicroMutableOpResolver<ms_maxOpCnt> _m_opResolver; }; } /* namespace app */ diff --git a/source/use_case/asr/include/Wav2LetterPostprocess.hpp b/source/use_case/asr/include/Wav2LetterPostprocess.hpp index 69567a3..e16d35b 100644 --- a/source/use_case/asr/include/Wav2LetterPostprocess.hpp +++ b/source/use_case/asr/include/Wav2LetterPostprocess.hpp @@ -72,33 +72,33 @@ namespace asr { * initialised. * @return true if valid, false otherwise. */ - bool _IsInputValid(TfLiteTensor* tensor, - uint32_t axisIdx) const; + bool IsInputValid(TfLiteTensor* tensor, + const uint32_t axisIdx) const; /** * @brief Gets the tensor data element size in bytes based * on the tensor type. * @return Size in bytes, 0 if not supported. */ - uint32_t _GetTensorElementSize(TfLiteTensor* tensor); + static uint32_t GetTensorElementSize(TfLiteTensor* tensor); /** * @brief Erases sections from the data assuming row-wise * arrangement along the context axis. * @return true if successful, false otherwise. */ - bool _EraseSectionsRowWise(uint8_t* ptrData, - uint32_t strideSzBytes, - bool lastIteration); + bool EraseSectionsRowWise(uint8_t* ptrData, + const uint32_t strideSzBytes, + const bool lastIteration); /** * @brief Erases sections from the data assuming col-wise * arrangement along the context axis. * @return true if successful, false otherwise. */ - bool _EraseSectionsColWise(uint8_t* ptrData, - uint32_t strideSzBytes, - bool lastIteration); + static bool EraseSectionsColWise(const uint8_t* ptrData, + const uint32_t strideSzBytes, + const bool lastIteration); }; } /* namespace asr */ diff --git a/source/use_case/asr/include/Wav2LetterPreprocess.hpp b/source/use_case/asr/include/Wav2LetterPreprocess.hpp index 8a4e0b7..10512b9 100644 --- a/source/use_case/asr/include/Wav2LetterPreprocess.hpp +++ b/source/use_case/asr/include/Wav2LetterPreprocess.hpp @@ -74,16 +74,16 @@ namespace asr { * @param[out] delta2 Result of the second diff computation. * @return true if successful, false otherwise. */ - static bool _ComputeDeltas(Array2d<float>& mfcc, - Array2d<float>& delta1, - Array2d<float>& delta2); + static bool ComputeDeltas(Array2d<float>& mfcc, + Array2d<float>& delta1, + Array2d<float>& delta2); /** * @brief Given a 2D vector of floats, computes the mean. * @param[in] vec Vctor of vector of floats. * @return Mean value. */ - static float _GetMean(Array2d<float>& vec); + static float GetMean(Array2d<float>& vec); /** * @brief Given a 2D vector of floats, computes the stddev. @@ -91,20 +91,20 @@ namespace asr { * @param[in] mean Mean value of the vector passed in. * @return stddev value. */ - static float _GetStdDev(Array2d<float>& vec, - float mean); + static float GetStdDev(Array2d<float>& vec, + const float mean); /** * @brief Given a 2D vector of floats, normalises it using * the mean and the stddev. * @param[in,out] vec Vector of vector of floats. */ - static void _NormaliseVec(Array2d<float>& vec); + static void NormaliseVec(Array2d<float>& vec); /** * @brief Normalises the MFCC and delta buffers. */ - void _Normalise(); + void Normalise(); /** * @brief Given the quantisation and data type limits, computes @@ -116,7 +116,7 @@ namespace asr { * @param[in] maxVal Numerical limit - maximum. * @return Floating point quantised value. */ - static float _GetQuantElem( + static float GetQuantElem( float elem, float quantScale, int quantOffset, @@ -137,7 +137,7 @@ namespace asr { * @param[in] quantOffset Quantisation offset. */ template <typename T> - bool _Quantise( + bool Quantise( T * outputBuf, const uint32_t outputBufSz, const float quantScale, @@ -161,15 +161,15 @@ namespace asr { /* Need to transpose while copying and concatenating the tensor. */ for (uint32_t j = 0; j < this->_m_numFeatVectors; ++j) { for (uint32_t i = 0; i < this->_m_numMfccFeats; ++i) { - *outputBufMfcc++ = static_cast<T>(Preprocess::_GetQuantElem( - this->_m_mfccBuf(i, j), quantScale, - quantOffset, minVal, maxVal)); - *outputBufD1++ = static_cast<T>(Preprocess::_GetQuantElem( - this->_m_delta1Buf(i, j), quantScale, - quantOffset, minVal, maxVal)); - *outputBufD2++ = static_cast<T>(Preprocess::_GetQuantElem( - this->_m_delta2Buf(i, j), quantScale, - quantOffset, minVal, maxVal)); + *outputBufMfcc++ = static_cast<T>(Preprocess::GetQuantElem( + this->_m_mfccBuf(i, j), quantScale, + quantOffset, minVal, maxVal)); + *outputBufD1++ = static_cast<T>(Preprocess::GetQuantElem( + this->_m_delta1Buf(i, j), quantScale, + quantOffset, minVal, maxVal)); + *outputBufD2++ = static_cast<T>(Preprocess::GetQuantElem( + this->_m_delta2Buf(i, j), quantScale, + quantOffset, minVal, maxVal)); } outputBufMfcc += ptrIncr; outputBufD1 += ptrIncr; |