Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/audio/module_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
53 changes: 49 additions & 4 deletions src/audio/module_adapter/module/dolby/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,53 @@ 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];
const int32_t *param_val = (const int32_t *)val;
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 &params_str[0];
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ 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 [
{
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)]"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading