Skip to content

Commit

Permalink
ai-soc/ndp120: set extraction point in audio tank only for KD detection
Browse files Browse the repository at this point in the history
Incase we use recorder without Keyword detection, skip the start point
correction we do for Keyword detection case.

Signed-off-by: Abhishek Akkabathula <[email protected]>
  • Loading branch information
abhishek-samsung committed Dec 6, 2024
1 parent 0dd76b2 commit 2a37f80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions os/drivers/ai-soc/ndp120/src/ndp120_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@ int ndp120_init(struct ndp120_dev_s *dev, bool reinit)
}
#endif
dev->alive = true;
dev->keyword_correction = false;

errout_ndp120_init:
return s;
Expand Down Expand Up @@ -1344,6 +1345,7 @@ int ndp120_irq_handler_work(struct ndp120_dev_s *dev)
#ifdef CONFIG_NDP120_AEC_SUPPORT
g_ndp120_state = IS_RECORDING;
#endif
dev->keyword_correction = true;
msg.msgId = AUDIO_MSG_KD;
} else if (network_id == 1) {
switch (winner) {
Expand Down Expand Up @@ -1518,6 +1520,7 @@ int ndp120_kd_start_match_process(struct ndp120_dev_s *dev) {
int ndp120_start_sample_ready(struct ndp120_dev_s *dev)
{
int s;

#ifdef CONFIG_NDP120_AEC_SUPPORT
g_ndp120_state = IS_RECORDING;
#endif
Expand All @@ -1529,10 +1532,13 @@ int ndp120_start_sample_ready(struct ndp120_dev_s *dev)
uint32_t bytes_before_match = 0;

if (!dev->running) {
/* we need not do this if this is resume case, we only need to do it if its recorder start case after keyword detection */
s = syntiant_ndp_extract_data(dev->ndp, SYNTIANT_NDP_EXTRACT_TYPE_INPUT,
if (dev->keyword_correction) {
/* we need not do this if this is resume case, we only need to do it if its recorder start case after keyword detection */
s = syntiant_ndp_extract_data(dev->ndp, SYNTIANT_NDP_EXTRACT_TYPE_INPUT,
SYNTIANT_NDP_EXTRACT_FROM_MATCH, NULL,
&bytes_before_match);
dev->keyword_correction = false;
}
}

return s;
Expand Down
1 change: 1 addition & 0 deletions os/drivers/audio/ndp120_voice.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct ndp120_dev_s {
uint32_t extract_size;
bool extclk_inuse;
volatile bool alive;
bool keyword_correction;

/* moved to using pthread cond variable for parity with reference implementation in ilib examples */
pthread_mutex_t ndp_mutex_mbsync;
Expand Down

0 comments on commit 2a37f80

Please sign in to comment.