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
8 changes: 1 addition & 7 deletions src/audio/eq_fir/eq_fir.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static int eq_fir_verify_params(struct comp_dev *dev,

comp_dbg(dev, "eq_fir_verify_params()");

ret = comp_verify_params(dev, BUFF_PARAMS_FRAME_FMT, params);
ret = comp_verify_params(dev, 0, params);
if (ret < 0) {
comp_err(dev, "eq_fir_verify_params() error: comp_verify_params() failed.");
return ret;
Expand Down Expand Up @@ -770,12 +770,6 @@ static int eq_fir_prepare(struct comp_dev *dev)
sink_period_bytes = audio_stream_period_bytes(&sinkb->stream,
dev->frames);

/* Rewrite params format for this component to match the host side. */
if (dev->direction == SOF_IPC_STREAM_PLAYBACK)
sourceb->stream.frame_fmt = cd->source_format;
else
sinkb->stream.frame_fmt = cd->sink_format;

if (sinkb->stream.size < config->periods_sink * sink_period_bytes) {
comp_err(dev, "eq_fir_prepare() error: sink buffer size is insufficient");
ret = -ENOMEM;
Expand Down
43 changes: 31 additions & 12 deletions src/audio/eq_iir/eq_iir.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,18 @@ const struct eq_iir_func_map fm_passthrough[] = {
#endif /* CONFIG_FORMAT_S32LE */
};

static eq_iir_func eq_iir_find_func(struct comp_data *cd,
static eq_iir_func eq_iir_find_func(enum sof_ipc_frame source_format,
enum sof_ipc_frame sink_format,
const struct eq_iir_func_map *map,
int n)
{
int i;

/* Find suitable processing function from map. */
for (i = 0; i < n; i++) {
if ((uint8_t)cd->source_format != map[i].source)
if ((uint8_t)source_format != map[i].source)
continue;
if ((uint8_t)cd->sink_format != map[i].sink)
if ((uint8_t)sink_format != map[i].sink)
continue;

return map[i].func;
Expand Down Expand Up @@ -581,11 +582,31 @@ static void eq_iir_free(struct comp_dev *dev)
static int eq_iir_verify_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
{
struct comp_buffer *sourceb;
struct comp_buffer *sinkb;
uint32_t buffer_flag;
int ret;

comp_dbg(dev, "eq_iir_verify_params()");

ret = comp_verify_params(dev, BUFF_PARAMS_FRAME_FMT, params);
/* EQ component will only ever have 1 source and 1 sink buffer */
sourceb = list_first_item(&dev->bsource_list, struct comp_buffer,
sink_list);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer,
source_list);

/* we check whether we can support frame_fmt conversion (whether we have
* such conversion function) due to source and sink buffer frame_fmt's.
* If not, we will overwrite sink (playback) and source (capture) with
* pcm frame_fmt and will not make any conversion (sink and source
* frame_fmt will be equal).
*/
buffer_flag = eq_iir_find_func(sourceb->stream.frame_fmt,
sinkb->stream.frame_fmt, fm_configured,
ARRAY_SIZE(fm_configured)) ?
BUFF_PARAMS_FRAME_FMT : 0;

ret = comp_verify_params(dev, buffer_flag, params);
if (ret < 0) {
comp_err(dev, "eq_iir_verify_params() error: comp_verify_params() failed.");
return ret;
Expand Down Expand Up @@ -829,12 +850,6 @@ static int eq_iir_prepare(struct comp_dev *dev)
sink_period_bytes = audio_stream_period_bytes(&sinkb->stream,
dev->frames);

/* Rewrite params format for this component to match the host side. */
if (dev->direction == SOF_IPC_STREAM_PLAYBACK)
sourceb->stream.frame_fmt = cd->source_format;
else
sinkb->stream.frame_fmt = cd->sink_format;

if (sinkb->stream.size < config->periods_sink * sink_period_bytes) {
comp_err(dev, "eq_iir_prepare(), sink buffer size %d is insufficient",
sinkb->stream.size);
Expand All @@ -851,7 +866,9 @@ static int eq_iir_prepare(struct comp_dev *dev)
comp_err(dev, "eq_iir_prepare(), setup failed.");
goto err;
}
cd->eq_iir_func = eq_iir_find_func(cd, fm_configured,
cd->eq_iir_func = eq_iir_find_func(cd->source_format,
cd->sink_format,
fm_configured,
ARRAY_SIZE(fm_configured));
if (!cd->eq_iir_func) {
comp_err(dev, "eq_iir_prepare(), No proc func");
Expand All @@ -860,7 +877,9 @@ static int eq_iir_prepare(struct comp_dev *dev)
}
comp_info(dev, "eq_iir_prepare(), IIR is configured.");
} else {
cd->eq_iir_func = eq_iir_find_func(cd, fm_passthrough,
cd->eq_iir_func = eq_iir_find_func(cd->source_format,
cd->sink_format,
fm_passthrough,
ARRAY_SIZE(fm_passthrough));
if (!cd->eq_iir_func) {
comp_err(dev, "eq_iir_prepare(), No pass func");
Expand Down