From 8f9588721cbb7356b03a714c97d6b3a9a6e89438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89anna=20=C3=93=20Cath=C3=A1in?= Date: Wed, 15 Sep 2021 09:32:30 +0100 Subject: MLECO-2082: Adding visual wake word use case MLECO-2083: Refactoring img_class and visual wake word MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *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 --- source/use_case/ad/src/UseCaseHandler.cc | 40 ++------------------------------ 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'source/use_case/ad') diff --git a/source/use_case/ad/src/UseCaseHandler.cc b/source/use_case/ad/src/UseCaseHandler.cc index 0c78179..b20b63e 100644 --- a/source/use_case/ad/src/UseCaseHandler.cc +++ b/source/use_case/ad/src/UseCaseHandler.cc @@ -28,20 +28,6 @@ namespace arm { 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 inference results using the data presentation * object. @@ -88,7 +74,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,"clipIndex")) { return false; } } @@ -225,35 +211,13 @@ namespace app { profiler.PrintProfilingResult(); - IncrementAppCtxClipIdx(ctx); + IncrementAppCtxIfmIdx(ctx,"clipIndex"); } while (runAll && ctx.Get("clipIndex") != startClipIdx); return true; } - static void IncrementAppCtxClipIdx(ApplicationContext& ctx) - { - auto curAudioIdx = ctx.Get("clipIndex"); - - if (curAudioIdx + 1 >= NUMBER_OF_FILES) { - ctx.Set("clipIndex", 0); - return; - } - ++curAudioIdx; - ctx.Set("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("clipIndex", idx); - return true; - } static bool PresentInferenceResult(hal_platform& platform, float result, float threshold) { -- cgit v1.2.1