Skip to content
Merged
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
43 changes: 39 additions & 4 deletions src/audio/copier/copier_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,45 @@ pcm_converter_func get_converter_func(const struct ipc4_audio_format *in_fmt,
audio_stream_fmt_conversion(out_fmt->depth, out_fmt->valid_bit_depth, &out, &out_valid,
out_fmt->s_type);

if (in_fmt->s_type == IPC4_TYPE_MSB_INTEGER && in_valid == SOF_IPC_FRAME_S24_4LE)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
if (out_fmt->s_type == IPC4_TYPE_MSB_INTEGER && out_valid == SOF_IPC_FRAME_S24_4LE)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
/* use MSB sample type to select conversion function if the data is enter or exit dsp.
* In playback case, host input and dai output and in capture case, host output and
* dai input.
*/
if (in_fmt->s_type == IPC4_TYPE_MSB_INTEGER && in_valid == SOF_IPC_FRAME_S24_4LE) {
switch (type) {
case ipc4_gtw_host:
if (dir == ipc4_playback)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
case ipc4_gtw_alh:
case ipc4_gtw_link:
case ipc4_gtw_ssp:
case ipc4_gtw_dmic:
if (dir == ipc4_capture)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
default:
break;
}
}

if (out_fmt->s_type == IPC4_TYPE_MSB_INTEGER && out_valid == SOF_IPC_FRAME_S24_4LE) {
switch (type) {
case ipc4_gtw_host:
if (dir == ipc4_capture)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
case ipc4_gtw_alh:
case ipc4_gtw_link:
case ipc4_gtw_ssp:
case ipc4_gtw_dmic:
if (dir == ipc4_playback)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
default:
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we combine two switch case to one and move two if() inside case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets take that as an optimization for followup in another PR.


/* check container & sample size */
if (use_no_container_convert_function(in, in_valid, out, out_valid))
Expand Down