detector: update apply_config() procedure

This patch applies detector config according to sample
width.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2019-07-25 16:24:51 +02:00 committed by Janusz Jankowski
parent 0db051b83a
commit f19acba8e1
1 changed files with 7 additions and 2 deletions

View File

@ -202,16 +202,21 @@ static int test_keyword_apply_config(struct comp_dev *dev,
struct sof_detect_test_config *cfg)
{
struct comp_data *cd = comp_get_drvdata(dev);
uint16_t sample_width;
assert(!memcpy_s(&cd->config, sizeof(cd->config), cfg,
sizeof(struct sof_detect_test_config)));
sample_width = cd->config.sample_width;
if (!cd->config.activation_shift)
cd->config.activation_shift = ACTIVATION_DEFAULT_SHIFT;
if (!cd->config.activation_threshold)
cd->config.activation_threshold =
if (!cd->config.activation_threshold) {
cd->config.activation_threshold = (sample_width > 16U) ?
ACTIVATION_DEFAULT_THRESHOLD_S24 :
ACTIVATION_DEFAULT_THRESHOLD_S16;
}
return 0;
}