P20 drc#11001
Open
piotrhoppeintel wants to merge 3 commits into
Open
Conversation
Add a process-level cmocka test for the DRC module. The new drc_process test follows the eq_iir_process harness (legacy process_audio_stream API): it builds a small libaudio, creates the DRC component through the full lifecycle (comp_new -> set_configuration -> prepare -> streaming) and pushes a chirp signal in S16/S24/S32.
Convert the DRC module from the legacy audio_stream processing API to the modern sof_source/sof_sink API.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Converts the DRC module processing path from the legacy audio_stream buffer API to the sof_source/sof_sink API, and adds a dedicated cmocka process-level test to validate the new data flow.
Changes:
- Update DRC processing entrypoint to use
sof_source/sof_sinkand circular-buffer views (cir_buf_source/cir_buf_sink). - Refactor DRC kernels (generic + HiFi4) to operate on circular-buffer pointers rather than
audio_streamhelpers. - Add a new cmocka
drc_processunit test and embed coefficient blobs for enabled / passthrough modes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/cmocka/src/audio/drc/drc_process.c | New cmocka test that instantiates the module adapter and directly exercises cd->drc_func() with circular-buffer views. |
| test/cmocka/src/audio/drc/cmocka_drc_coef.h | Adds generated DRC configuration blobs used by the new process test. |
| test/cmocka/src/audio/drc/CMakeLists.txt | Adds the drc_process test target and a small static audio_for_drc library to satisfy module dependencies. |
| src/audio/drc/drc_hifi4.c | Updates passthrough + delay/processing routines to use cir_buf_* sources/sinks and wrapping. |
| src/audio/drc/drc_generic.c | Same as above for the generic implementation; adds memcpy_s include usage. |
| src/audio/drc/drc.h | Updates public DRC function signature to cir_buf_source/cir_buf_sink and stores channel count in drc_comp_data. |
| src/audio/drc/drc.c | Switches module interface to .process and implements source/sink acquire/commit flow. |
Comment on lines
+64
to
+66
| ipc = calloc(1, ipc_size + SOF_UUID_SIZE); | ||
| memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE); | ||
| ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE; |
Comment on lines
+95
to
+97
| ret = ops->set_configuration(mod, 0, MODULE_CFG_FRAGMENT_SINGLE, | ||
| blob->size, (const uint8_t *)cdata, | ||
| blob->size, NULL, 0); |
| # make small version of libaudio so we don't have to care | ||
| # about unused missing references | ||
|
|
||
| add_compile_options(-DUNIT_TEST) |
Comment on lines
+485
to
+494
| while (bytes) { | ||
| n = MIN((const uint8_t *)source->buf_end - src, | ||
| (uint8_t *)sink->buf_end - dst); | ||
| n = MIN(n, bytes); | ||
| memcpy_s(dst, n, src, n); | ||
| src = cir_buf_wrap((void *)(src + n), (void *)source->buf_start, | ||
| (void *)source->buf_end); | ||
| dst = cir_buf_wrap(dst + n, sink->buf_start, sink->buf_end); | ||
| bytes -= n; | ||
| } |
Comment on lines
+539
to
+548
| while (bytes) { | ||
| n = MIN((const uint8_t *)source->buf_end - src, | ||
| (uint8_t *)sink->buf_end - dst); | ||
| n = MIN(n, bytes); | ||
| memcpy_s(dst, n, src, n); | ||
| src = cir_buf_wrap((void *)(src + n), (void *)source->buf_start, | ||
| (void *)source->buf_end); | ||
| dst = cir_buf_wrap(dst + n, sink->buf_start, sink->buf_end); | ||
| bytes -= n; | ||
| } |
Comment on lines
+325
to
+337
| /* acquire source and sink circular buffers for the whole period */ | ||
| ret = source_get_data(source, source_bytes, &source_buf.ptr, | ||
| &source_buf.buf_start, &bytes); | ||
| if (ret < 0) | ||
| return ret; | ||
| source_buf.buf_end = (const char *)source_buf.buf_start + bytes; | ||
|
|
||
| ret = sink_get_buffer(sink, sink_bytes, &sink_buf.ptr, &sink_buf.buf_start, &bytes); | ||
| if (ret < 0) { | ||
| source_release_data(source, 0); | ||
| return ret; | ||
| } | ||
| sink_buf.buf_end = (char *)sink_buf.buf_start + bytes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert the DRC module from the legacy audio_stream processing API
to the modern sof_source/sof_sink API.