diff --git a/src/audio/module_adapter/CMakeLists.txt b/src/audio/module_adapter/CMakeLists.txt index 7400e27f7edd..25c9281dc64d 100644 --- a/src/audio/module_adapter/CMakeLists.txt +++ b/src/audio/module_adapter/CMakeLists.txt @@ -139,11 +139,15 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) endif() if(CONFIG_COMP_DOLBY_DAX_AUDIO_PROCESSING) + target_include_directories(sof PRIVATE ${PROJECT_SOURCE_DIR}/third_party/include) add_local_sources(sof module/dolby/dax.c) if (CONFIG_COMP_DOLBY_DAX_AUDIO_PROCESSING_MOCK) add_local_sources(sof module/dolby/dax_mock.c) else() - sof_add_static_library(dax_effect ${sof_top_dir}/third_party/lib/libdax.a) + target_link_libraries(sof PRIVATE m) + target_link_libraries(sof PRIVATE c) + sof_add_static_library(dax_effect + ${PROJECT_SOURCE_DIR}/third_party/lib/libdax.a) endif() endif() diff --git a/src/audio/module_adapter/module/dolby/dax.c b/src/audio/module_adapter/module/dolby/dax.c index 74825dc746cc..ecff1054171f 100644 --- a/src/audio/module_adapter/module/dolby/dax.c +++ b/src/audio/module_adapter/module/dolby/dax.c @@ -36,6 +36,40 @@ DECLARE_TR_CTX(dolby_dax_audio_processing_tr, SOF_UUID(dolby_dax_audio_processin #define DAX_ENUM_PROFILE_CONTROL_ID 0 #define DAX_ENUM_DEVICE_CONTROL_ID 1 +static int itostr(int num, char *str) +{ + int index = 0, digit_count = 0; + int temp; + + if (num < 0) { + str[0] = '-'; + index = 1; + num = -num; + } + + if (num == 0) { + str[index] = '0'; + str[index + 1] = '\0'; + return index + 1; + } + + temp = num; + while (temp > 0) { + temp /= 10; + digit_count++; + } + + temp = index + digit_count - 1; + while (num > 0) { + str[temp] = (num % 10) + '0'; + num /= 10; + temp--; + } + + str[index + digit_count] = '\0'; + return index + digit_count; +} + static const char *get_params_str(const void *val, uint32_t val_sz) { static char params_str[MAX_PARAMS_STR_BUFFER_SIZE + 16]; @@ -43,8 +77,12 @@ static const char *get_params_str(const void *val, uint32_t val_sz) const uint32_t param_sz = val_sz >> 2; uint32_t offset = 0; - for (uint32_t i = 0; i < param_sz && offset < MAX_PARAMS_STR_BUFFER_SIZE; i++) - offset += sprintf(params_str + offset, "%d,", param_val[i]); + for (uint32_t i = 0; i < param_sz && offset < MAX_PARAMS_STR_BUFFER_SIZE; i++) { + offset += itostr(param_val[i], params_str + offset); + params_str[offset] = ','; + offset++; + params_str[offset] = '\0'; + } return ¶ms_str[0]; } @@ -76,6 +114,8 @@ static int sof_to_dax_channels(uint32_t channels) { switch (channels) { case 2: + case 6 /* 5.1 */: + case 8 /* 7.1 */: return channels; default: return DAX_CHANNLES_UNSUPPORTED; @@ -124,9 +164,14 @@ static int dax_buffer_alloc(struct processing_module *mod, /* After reading from buffer */ static void dax_buffer_consume(struct dax_buffer *dax_buff, uint32_t bytes) { + uint8_t *buf = (uint8_t *)dax_buff->addr; + uint32_t copy_bytes; + bytes = MIN(bytes, dax_buff->avail); - memmove(dax_buff->addr, (uint8_t *)dax_buff->addr + bytes, dax_buff->avail - bytes); - dax_buff->avail = dax_buff->avail - bytes; + copy_bytes = dax_buff->avail - bytes; + for (int i = 0; i < copy_bytes; i++) + buf[i] = buf[bytes + i]; + dax_buff->avail = copy_bytes; dax_buff->free = dax_buff->size - dax_buff->avail; } diff --git a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dax-dai-copier-playback.conf b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dax-dai-copier-playback.conf index 1038746ad979..0f136364e3d5 100644 --- a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dax-dai-copier-playback.conf +++ b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dax-dai-copier-playback.conf @@ -31,7 +31,7 @@ Class.Pipeline."mixout-gain-dax-dai-copier-playback" { in_rate 48000 in_bit_depth 32 in_valid_bit_depth 32 - ibs "$[512 * ($in_bit_depth / 8) ]" + ibs "$[(256 * ($[($in_bit_depth / 8)])) * ($in_channels)]" } ] Object.Base.output_audio_format [ @@ -39,7 +39,7 @@ Class.Pipeline."mixout-gain-dax-dai-copier-playback" { out_rate 48000 out_bit_depth 32 out_valid_bit_depth 32 - obs "$[512 * ($out_bit_depth / 8) ]" + obs "$[(256 * ($[($out_bit_depth / 8)])) * ($out_channels)]" } ] } diff --git a/west.yml b/west.yml index 6d8e372b1055..0bd10446385e 100644 --- a/west.yml +++ b/west.yml @@ -43,7 +43,7 @@ manifest: - name: zephyr repo-path: zephyr - revision: 6cd7cfa104a5f4de68408c9bf6516cd1109b9782 + revision: 769ba82aa5ec482af0c4649ba075065e901fbe69 remote: zephyrproject # Import some projects listed in zephyr/west.yml@revision