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 30, 2024
1 parent 5fe899d commit bbda6e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ 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);

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 +357,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 bbda6e8

Please sign in to comment.