From c350cdced0a8a2ca17376f58813e6d48d796ac7c Mon Sep 17 00:00:00 2001 From: alexander Date: Thu, 29 Apr 2021 20:36:09 +0100 Subject: MLECO-1868: Code static analyzer warnings fixes Signed-off-by: alexander Change-Id: Ie423e9cad3fabec6ab077ded7236813fe4933dea --- source/use_case/kws/include/DsCnnModel.hpp | 4 +- source/use_case/kws/src/UseCaseHandler.cc | 88 +++++++++++++++--------------- 2 files changed, 46 insertions(+), 46 deletions(-) (limited to 'source/use_case/kws') diff --git a/source/use_case/kws/include/DsCnnModel.hpp b/source/use_case/kws/include/DsCnnModel.hpp index a4e7110..e9ac18c 100644 --- a/source/use_case/kws/include/DsCnnModel.hpp +++ b/source/use_case/kws/include/DsCnnModel.hpp @@ -47,10 +47,10 @@ namespace app { private: /* Maximum number of individual operations that can be enlisted. */ - static constexpr int _ms_maxOpCnt = 8; + static constexpr int ms_maxOpCnt = 8; /* A mutable op resolver instance. */ - tflite::MicroMutableOpResolver<_ms_maxOpCnt> _m_opResolver; + tflite::MicroMutableOpResolver _m_opResolver; }; } /* namespace app */ diff --git a/source/use_case/kws/src/UseCaseHandler.cc b/source/use_case/kws/src/UseCaseHandler.cc index d2cba55..4011df6 100644 --- a/source/use_case/kws/src/UseCaseHandler.cc +++ b/source/use_case/kws/src/UseCaseHandler.cc @@ -37,7 +37,7 @@ namespace app { * @brief Helper function to increment current audio clip index. * @param[in,out] ctx Pointer to the application context object. **/ - static void _IncrementAppCtxClipIdx(ApplicationContext& ctx); + static void IncrementAppCtxClipIdx(ApplicationContext& ctx); /** * @brief Helper function to set the audio clip index. @@ -45,7 +45,7 @@ namespace app { * @param[in] idx Value to be set. * @return true if index is set, false otherwise. **/ - static bool _SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx); + static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx); /** * @brief Presents inference results using the data presentation @@ -56,8 +56,8 @@ namespace app { * otherwise, this can be passed in as 0. * @return true if successful, false otherwise. **/ - static bool _PresentInferenceResult(hal_platform& platform, - const std::vector& results); + static bool PresentInferenceResult(hal_platform& platform, + const std::vector& results); /** * @brief Returns a function to perform feature calculation and populates input tensor data with @@ -96,7 +96,7 @@ namespace app { /* If the request has a valid size, set the audio index. */ if (clipIndex < NUMBER_OF_FILES) { - if (!_SetAppCtxClipIdx(ctx, clipIndex)) { + if (!SetAppCtxClipIdx(ctx, clipIndex)) { return false; } } @@ -240,20 +240,20 @@ namespace app { ctx.Set>("results", results); - if (!_PresentInferenceResult(platform, results)) { + if (!PresentInferenceResult(platform, results)) { return false; } profiler.PrintProfilingResult(); - _IncrementAppCtxClipIdx(ctx); + IncrementAppCtxClipIdx(ctx); } while (runAll && ctx.Get("clipIndex") != startClipIdx); return true; } - static void _IncrementAppCtxClipIdx(ApplicationContext& ctx) + static void IncrementAppCtxClipIdx(ApplicationContext& ctx) { auto curAudioIdx = ctx.Get("clipIndex"); @@ -265,7 +265,7 @@ namespace app { ctx.Set("clipIndex", curAudioIdx); } - static bool _SetAppCtxClipIdx(ApplicationContext& ctx, const uint32_t idx) + static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx) { if (idx >= NUMBER_OF_FILES) { printf_err("Invalid idx %u (expected less than %u)\n", @@ -276,8 +276,8 @@ namespace app { return true; } - static bool _PresentInferenceResult(hal_platform& platform, - const std::vector& results) + static bool PresentInferenceResult(hal_platform& platform, + const std::vector& results) { constexpr uint32_t dataPsnTxtStartX1 = 20; constexpr uint32_t dataPsnTxtStartY1 = 30; @@ -345,8 +345,8 @@ namespace app { */ template std::function&, size_t, bool, size_t)> - _FeatureCalc(TfLiteTensor* inputTensor, size_t cacheSize, - std::function (std::vector& )> compute) + FeatureCalc(TfLiteTensor* inputTensor, size_t cacheSize, + std::function (std::vector& )> compute) { /* Feature cache to be captured by lambda function. */ static std::vector> featureCache = std::vector>(cacheSize); @@ -378,24 +378,24 @@ namespace app { } template std::function&, size_t , bool, size_t)> - _FeatureCalc(TfLiteTensor* inputTensor, + FeatureCalc(TfLiteTensor* inputTensor, size_t cacheSize, std::function (std::vector& )> compute); template std::function&, size_t , bool, size_t)> - _FeatureCalc(TfLiteTensor* inputTensor, - size_t cacheSize, - std::function (std::vector& )> compute); + FeatureCalc(TfLiteTensor* inputTensor, + size_t cacheSize, + std::function (std::vector& )> compute); template std::function&, size_t , bool, size_t)> - _FeatureCalc(TfLiteTensor* inputTensor, - size_t cacheSize, - std::function (std::vector& )> compute); + FeatureCalc(TfLiteTensor* inputTensor, + size_t cacheSize, + std::function (std::vector& )> compute); template std::function&, size_t, bool, size_t)> - _FeatureCalc(TfLiteTensor *inputTensor, - size_t cacheSize, - std::function(std::vector&)> compute); + FeatureCalc(TfLiteTensor* inputTensor, + size_t cacheSize, + std::function(std::vector&)> compute); static std::function&, int, bool, size_t)> @@ -413,19 +413,19 @@ namespace app { switch (inputTensor->type) { case kTfLiteInt8: { - mfccFeatureCalc = _FeatureCalc(inputTensor, - cacheSize, - [=, &mfcc](std::vector& audioDataWindow) { - return mfcc.MfccComputeQuant(audioDataWindow, - quantScale, - quantOffset); - } + mfccFeatureCalc = FeatureCalc(inputTensor, + cacheSize, + [=, &mfcc](std::vector& audioDataWindow) { + return mfcc.MfccComputeQuant(audioDataWindow, + quantScale, + quantOffset); + } ); break; } case kTfLiteUInt8: { - mfccFeatureCalc = _FeatureCalc(inputTensor, - cacheSize, + mfccFeatureCalc = FeatureCalc(inputTensor, + cacheSize, [=, &mfcc](std::vector& audioDataWindow) { return mfcc.MfccComputeQuant(audioDataWindow, quantScale, @@ -435,13 +435,13 @@ namespace app { break; } case kTfLiteInt16: { - mfccFeatureCalc = _FeatureCalc(inputTensor, - cacheSize, - [=, &mfcc](std::vector& audioDataWindow) { - return mfcc.MfccComputeQuant(audioDataWindow, - quantScale, - quantOffset); - } + mfccFeatureCalc = FeatureCalc(inputTensor, + cacheSize, + [=, &mfcc](std::vector& audioDataWindow) { + return mfcc.MfccComputeQuant(audioDataWindow, + quantScale, + quantOffset); + } ); break; } @@ -451,11 +451,11 @@ namespace app { } else { - mfccFeatureCalc = mfccFeatureCalc = _FeatureCalc(inputTensor, - cacheSize, - [&mfcc](std::vector& audioDataWindow) { - return mfcc.MfccCompute(audioDataWindow); - }); + mfccFeatureCalc = mfccFeatureCalc = FeatureCalc(inputTensor, + cacheSize, + [&mfcc](std::vector& audioDataWindow) { + return mfcc.MfccCompute(audioDataWindow); + }); } return mfccFeatureCalc; } -- cgit v1.2.1