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. If the new blob
has enable false, then the processing is changed to pass-through
mode.

The pass-through blob configuration is useful 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 <seppo.ingalsuo@linux.intel.com>
  • Loading branch information
singalsu committed Oct 31, 2024
1 parent 6b190eb commit c5ef0e3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ static int drc_process(struct processing_module *mod,
comp_err(dev, "drc_copy(), failed DRC setup");
return ret;
}

/* If new configuration blob is received in pass-through mode, and it
* has params.enabled true, then find the DRC processing function.
*/
if (cd->drc_func == drc_default_pass && cd->config->params.enabled)
cd->drc_func = drc_find_proc_func(cd->source_format);

/* If new configuration blob has params.enabled false, then it is safe
* to switch to pass-through mode.
*/
if (!cd->config->params.enabled)
cd->drc_func = drc_default_pass;
}

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

/* Params.enabled in the configuration blob is the master switch of DRC.
* The enable switch control does not have impact if this is not set to
* true. When false it is safe to use fast pass-through copy. A
* non-enabled blob can be used when same pipeline is used for both
* headphone and speaker where DRC should be off for headphone mode.
*/
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 c5ef0e3

Please sign in to comment.