Skip to content

Commit

Permalink
Audio: DRC: Use audio_stream_copy() with pass-through configuration
Browse files Browse the repository at this point in the history
The configuration blob is checked in drc_prepare(). If
the blob does not have params.enable set, then it is safe
to switch to a more efficient buffer copy function that
bypasses the internal DRC lookup delay with channels
de-interleave and interleave operations. The enable in the
blob is a master switch for DRC. With such configuration in
the blob the switch control from user space can't switch the
processing on. Therefore it is safe to change the processing
function. This change minimizes the MCPS overhead of unused
DRC and reduces audio latency.

If a new blob is received during streaming, the params.enable
is checked again and the processing function is set again
if the pass-through copy mode was in use.

A pass-through blob can be applied e.g. when the same pipeline
is used for both headphone and speaker, where DRC is usually
disabled for headphone mode.

This change saves in hda-generic topologies with the default
blob about 1.2 MCPS in TGL platform.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu committed Oct 30, 2024
1 parent 5fe899d commit 57cdc86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ static int drc_process(struct processing_module *mod,
comp_err(dev, "drc_copy(), failed DRC setup");
return ret;
}

if (cd->drc_func == drc_default_pass && cd->config->params.enabled)
cd->drc_func = drc_find_proc_func(cd->source_format);
}

/* Control pass-though in processing function with switch control */
Expand Down Expand Up @@ -351,6 +354,9 @@ static int drc_prepare(struct processing_module *mod,
comp_err(dev, "drc_prepare(), No proc func");
return -EINVAL;
}

if (!cd->config->params.enabled)
cd->drc_func = drc_default_pass;
} else {
/* Generic function for all formats */
cd->drc_func = drc_default_pass;
Expand Down

0 comments on commit 57cdc86

Please sign in to comment.