summaryrefslogtreecommitdiff
path: root/source/use_case/kws_asr/src/UseCaseHandler.cc
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2021-09-15 09:32:30 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2021-09-16 16:01:23 +0100
commit8f9588721cbb7356b03a714c97d6b3a9a6e89438 (patch)
tree1ca19d31958081c09f360d91e15fefb6e38b3992 /source/use_case/kws_asr/src/UseCaseHandler.cc
parente6588f620c648dd0492f6133152855d77c672568 (diff)
downloadml-embedded-evaluation-kit-8f9588721cbb7356b03a714c97d6b3a9a6e89438.tar.gz
MLECO-2082: Adding visual wake word use case21.08
MLECO-2083: Refactoring img_class and visual wake word *Added source files for visual wake word *Added tests *Added docs *Added new images for visual wake word demo *Refactored common functions in img_class, visual wake word and other usecases Change-Id: Ibd25854e19a5517f940a8d3086a5d4835fab89e9 Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'source/use_case/kws_asr/src/UseCaseHandler.cc')
-rw-r--r--source/use_case/kws_asr/src/UseCaseHandler.cc40
1 files changed, 2 insertions, 38 deletions
diff --git a/source/use_case/kws_asr/src/UseCaseHandler.cc b/source/use_case/kws_asr/src/UseCaseHandler.cc
index 9080348..1d88ba1 100644
--- a/source/use_case/kws_asr/src/UseCaseHandler.cc
+++ b/source/use_case/kws_asr/src/UseCaseHandler.cc
@@ -49,20 +49,6 @@ 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);
-
- /**
- * @brief Helper function to set the audio clip index
- * @param[in,out] ctx pointer to the application context object
- * @param[in] idx value to be set
- * @return true if index is set, false otherwise
- **/
- static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx);
-
- /**
* @brief Presents kws inference results using the data presentation
* object.
* @param[in] platform reference to the hal platform object
@@ -440,7 +426,7 @@ namespace app {
/* If the request has a valid size, set the audio index. */
if (clipIndex < NUMBER_OF_FILES) {
- if (!SetAppCtxClipIdx(ctx, clipIndex)) {
+ if (!SetAppCtxIfmIdx(ctx, clipIndex,"kws_asr")) {
return false;
}
}
@@ -461,35 +447,13 @@ namespace app {
}
}
- IncrementAppCtxClipIdx(ctx);
+ IncrementAppCtxIfmIdx(ctx,"kws_asr");
} while (runAll && ctx.Get<uint32_t>("clipIndex") != startClipIdx);
return true;
}
- static void IncrementAppCtxClipIdx(ApplicationContext& ctx)
- {
- auto curAudioIdx = ctx.Get<uint32_t>("clipIndex");
-
- if (curAudioIdx + 1 >= NUMBER_OF_FILES) {
- ctx.Set<uint32_t>("clipIndex", 0);
- return;
- }
- ++curAudioIdx;
- ctx.Set<uint32_t>("clipIndex", curAudioIdx);
- }
-
- static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx)
- {
- if (idx >= NUMBER_OF_FILES) {
- printf_err("Invalid idx %" PRIu32 " (expected less than %u)\n",
- idx, NUMBER_OF_FILES);
- return false;
- }
- ctx.Set<uint32_t>("clipIndex", idx);
- return true;
- }
static bool PresentInferenceResult(hal_platform& platform,
std::vector<arm::app::kws::KwsResult>& results)