-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASRC: move to DRAM #9844
ASRC: move to DRAM #9844
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
#include <rtos/string.h> | ||
#include <sof/trace/trace.h> | ||
#include <sof/audio/format.h> | ||
#include <sof/lib/fast-get.h> | ||
#include <sof/lib/memory.h> | ||
#include <user/trace.h> | ||
#include "asrc_farrow.h" | ||
|
||
|
@@ -506,6 +508,31 @@ enum asrc_error_code asrc_set_output_format(struct comp_dev *dev, | |
return ASRC_EC_OK; | ||
} | ||
|
||
static const int32_t *__get_polyphase_filter(const int32_t *filter, size_t size) | ||
{ | ||
#if CONFIG_FAST_GET | ||
return fast_get(filter, size); | ||
#else | ||
return filter; | ||
#endif | ||
} | ||
|
||
#define get_polyphase_filter(f) __get_polyphase_filter(f, sizeof(f)) | ||
|
||
static void put_polyphase_filter(const int32_t *filter) | ||
{ | ||
#if CONFIG_FAST_GET | ||
fast_put(filter); | ||
#endif | ||
} | ||
|
||
void asrc_free_polyphase_filter(struct asrc_farrow *src_obj) | ||
{ | ||
if (src_obj && src_obj->polyphase_filters) { | ||
put_polyphase_filter(src_obj->polyphase_filters); | ||
src_obj->polyphase_filters = NULL; | ||
} | ||
} | ||
|
||
/* | ||
* FILTER FUNCTIONS | ||
|
@@ -533,7 +560,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
/* Reset coefficients for possible exit with error. */ | ||
src_obj->filter_length = 0; | ||
src_obj->num_filters = 0; | ||
src_obj->polyphase_filters = NULL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this was never needed for anything else but to potentially find bugs where the filter is accessed uninitialized. For that purpose it could still be valid there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsarha it is now inside the |
||
asrc_free_polyphase_filter(src_obj); | ||
|
||
if (fs_in == 0 || fs_out == 0) { | ||
/* Avoid possible divisions by zero. */ | ||
|
@@ -549,7 +576,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO48000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO48000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to48000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to48000); | ||
} else if (fs_in <= fs_out) { | ||
/* All upsampling use cases can share the same set of | ||
* filter coefficients. | ||
|
@@ -558,7 +585,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_44100TO48000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_44100TO48000].num_filters; | ||
src_obj->polyphase_filters = &coeff44100to48000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff44100to48000); | ||
} else if (fs_in == 48000) { | ||
switch (fs_out) { | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_08000) | ||
|
@@ -567,7 +594,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO08000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO08000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to08000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to08000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_11025) | ||
|
@@ -576,7 +603,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO11025].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO11025].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to11025[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to11025); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_12000) | ||
|
@@ -585,7 +612,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO12000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO12000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to12000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to12000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_16000) | ||
|
@@ -594,7 +621,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO16000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO16000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to16000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to16000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_22050) | ||
|
@@ -603,7 +630,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO22050].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO22050].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to22050[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to22050); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_24000) | ||
|
@@ -612,7 +639,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO24000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO24000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to24000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to24000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_32000) | ||
|
@@ -621,7 +648,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO32000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO32000].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to32000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to32000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_44100) | ||
|
@@ -630,7 +657,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_48000TO44100].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_48000TO44100].num_filters; | ||
src_obj->polyphase_filters = &coeff48000to44100[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff48000to44100); | ||
break; | ||
#endif | ||
default: | ||
|
@@ -646,7 +673,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_24000TO08000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_24000TO08000].num_filters; | ||
src_obj->polyphase_filters = &coeff24000to08000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff24000to08000); | ||
break; | ||
#endif | ||
#if (CONFIG_ASRC_SUPPORT_CONVERSION_24000_TO_16000) | ||
|
@@ -655,7 +682,7 @@ static enum asrc_error_code initialise_filter(struct comp_dev *dev, | |
c_filter_params[CR_24000TO16000].filter_length; | ||
src_obj->num_filters = | ||
c_filter_params[CR_24000TO16000].num_filters; | ||
src_obj->polyphase_filters = &coeff24000to16000[0]; | ||
src_obj->polyphase_filters = get_polyphase_filter(coeff24000to16000); | ||
break; | ||
#endif | ||
default: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why is this needed? Is sram much smaller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its smaller/faster.