-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google aec sink src dp #8722
Google aec sink src dp #8722
Conversation
422946e
to
878a4da
Compare
src/audio/google/CMakeLists.txt
Outdated
@@ -13,7 +13,7 @@ if((NOT CONFIG_LIBRARY) OR CONFIG_LIBRARY_STATIC) | |||
if(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING) | |||
target_include_directories(sof PRIVATE ${CMAKE_SOURCE_DIR}/third_party/include) | |||
add_local_sources(sof | |||
google_rtc_audio_processing.c | |||
google_rtc_audio_processing_ll.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking aloud as this was done for other modules with IPC3/4 split, is there any common code where we can have a google_rtc_audio_processing_common.c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there's really very little divergence needed. In the, heh, "other" patch, IPC3/4 deltas are limited to:
-
The set_config() method is handled differently for IPC4, and in a way that seems a little like needless boilerplate (this has never worked in main, so it's not clear to me why the changes happened). I haven't touched this yet but absolutely will clean it up.
-
A single workaround line remains to set the reference stream format (topology isn't getting to the pipeline correctly).
-
The single line "is this the reference or capture buffer?" predicate works differently (IPC3 checks pipeline IDs, IPC4 looks at the pin index instead, really those too are equivalent and I don't know why they diverged).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection in principle to merging this first, as long as there's a sincere commitment from Intel to consume and validate the other version too. If the only reason for merging this is to cut another "stable drop" branch that is cut off from SOF main, that seems like a bad trade. We need to agree on a single implementation and that takes work from both sides.
As far as code: it would be cleaner to avoid all the code motion (i.e. leave it all in one file, avoid the IPC3 removals), which really isn't needed to support the unified AEC and will only confuse the git history. (Edit: but that's not a -1, it's no harder to squash a big change than a small one, the only impact is to the pour soul trying to figure out what happened from the commit log)
@@ -53,9 +53,7 @@ DECLARE_TR_CTX(google_rtc_audio_processing_tr, SOF_UUID(google_rtc_audio_process | |||
LOG_LEVEL_INFO); | |||
|
|||
struct google_rtc_audio_processing_comp_data { | |||
#if CONFIG_IPC_MAJOR_4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this "remove IPC3 support" patch, or just squash it? IPC3 support is going to be added right back in as soon as this merges, so it seems a little silly to go through the motions of turning it off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split this file into google_rtc_audio_processing_ipc3.c and google_rtc_audio_processing_ipc4.c like smart_amp ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, I did not touch goole RTC part for ipc3/ipc4 split, because last quarter, a lot of patches are changing this module, if you need me to do this, we can do it later, this module indeed need a separation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the ipc3/ipc4 split later as we have now so many PR in flight touching this code.
src/audio/google/CMakeLists.txt
Outdated
@@ -13,7 +13,7 @@ if((NOT CONFIG_LIBRARY) OR CONFIG_LIBRARY_STATIC) | |||
if(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING) | |||
target_include_directories(sof PRIVATE ${CMAKE_SOURCE_DIR}/third_party/include) | |||
add_local_sources(sof | |||
google_rtc_audio_processing.c | |||
google_rtc_audio_processing_ll.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there's really very little divergence needed. In the, heh, "other" patch, IPC3/4 deltas are limited to:
-
The set_config() method is handled differently for IPC4, and in a way that seems a little like needless boilerplate (this has never worked in main, so it's not clear to me why the changes happened). I haven't touched this yet but absolutely will clean it up.
-
A single workaround line remains to set the reference stream format (topology isn't getting to the pipeline correctly).
-
The single line "is this the reference or capture buffer?" predicate works differently (IPC3 checks pipeline IDs, IPC4 looks at the pin index instead, really those too are equivalent and I don't know why they diverged).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the only reason for merging this is to cut another "stable drop" branch that is cut off from SOF main, that seems like a bad trade. We need to agree on a single implementation and that takes work from both sides.
And... it turns out from sideband communication that this is exactly what is happening.
I think this has to be a -1 from me. I've been following the rules in #8571, addressing review comments, splitting out changes, chasing down workarounds and external/framework issues instead of just working around them inline. It's neither fair nor good engineering practice for Intel to ram this through just to be able to cut a release without having to work with me.
Can you guys please actually try the code in #8571 first before merging this without review? It works as-is, though I need to push up a respin without the separately-submitted changes. I'll get this out this afternoon. If it doesn't work, then report problems and let's work together on fixing them.
@@ -53,9 +53,7 @@ DECLARE_TR_CTX(google_rtc_audio_processing_tr, SOF_UUID(google_rtc_audio_process | |||
LOG_LEVEL_INFO); | |||
|
|||
struct google_rtc_audio_processing_comp_data { | |||
#if CONFIG_IPC_MAJOR_4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split this file into google_rtc_audio_processing_ipc3.c and google_rtc_audio_processing_ipc4.c like smart_amp ?
src = audio_stream_wrap(mic_stream, src); | ||
dst = audio_stream_wrap(out_stream, dst); | ||
#if CONFIG_COMP_GOOGLE_RTC_USE_32_BIT_FLOAT_API | ||
GoogleRtcAudioProcessingAnalyzeRender_float32( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use different proc function for different format and select proc function based on module config
.e.g.
const struct drc_proc_fnmap drc_proc_fnmap[] = {
/* { SOURCE_FORMAT , PROCESSING FUNCTION } */
#if CONFIG_FORMAT_S16LE
{ SOF_IPC_FRAME_S16_LE, drc_s16_default },
#endif /* CONFIG_FORMAT_S16LE */
#if CONFIG_FORMAT_S24LE
{ SOF_IPC_FRAME_S24_4LE, drc_s24_default },
#endif /* CONFIG_FORMAT_S24LE */
#if CONFIG_FORMAT_S32LE
{ SOF_IPC_FRAME_S32_LE, drc_s32_default },
#endif /* CONFIG_FORMAT_S32LE */
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a separate option - just use google's API 16 or 32. It is independent of out CONFIG_FORMAT_xxxx flags.
In fact, AEC 16 and 32 bit API differ a bit more than just number of bits - they also accept diffrent set of parameters:
int GoogleRtcAudioProcessingAnalyzeRender_float32(
GoogleRtcAudioProcessingState *const state, const float *const *src);
int GoogleRtcAudioProcessingAnalyzeRender_int16(
GoogleRtcAudioProcessingState *const state, const int16_t *const src);
const float *const *src vs const float *const src - a pointer to a table of pointers to channels or just a pointer to first channel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, this is basically the architecture in #8571 (though it's selected with a branch and isn't table driven), there are a bunch of function pointers for doing the optimized sink/source de/interleave+convert+copy for each format variant, without any cut/paste of algorithm code. See https://github.com/andyross/sof/blob/mt8195-aec/src/audio/google/google_rtc_audio_processing.c#L112
why _LL ? because IPC4 != DP_scheduling this PR does:
|
@andyross the purpose of this change is to enable AEC module with DP Scheduler using IPC4. Since Intel has already transition to IPC4 then we have no plan to enable and validate this feature with IPC3. However, there are no objections to follow up with IPC3 support as a next step, but the validation and enabling will have to be done on your end.
I talked with @marcinszkudlinski and "Remove IPC3 support" is unfortunate naming and should be squashed, because the intention here is not to remove any IPC3 functionality, but rather limit the new feature to IPC4 (at least in this PR). |
This isn't an Intel project and SOF isn't an Intel deliverable though. I understand you don't want to support IPC3 anymore (I don't either, FWIW), but we still have devices shipping with it and they need to run with current code still. Which is why #8571 exists: it has all the features this PR does, plus IPC3 support, plus dynamic stream format handling, it's smaller, faster, and it does it all in a single source file without having to copy and paste all the future changes between this and a "legacy" version. If there are features you want to see there, just add review comments and let's work together on fixing them. I absolutely understand there are business worries about what software which entity is willing to support. And that may have to be dealt with out of band. I'll remove the -1 here since it's not really code-related and replace it with a proper review trying to point out the collisions and how it compares with the competing PR. |
To repeat, there's really just not that much divergence. The only major code block that changes is that the control handling has a rather different API in IPC4 (this was pre-existing, and absolutely can be cleaned up a ton). Beyond that, there's some sink/source validation code that obviously doesn't apply to IPC3 and a 1-line workaround for the broken reference channel count (which is a protocol bug really, will submit a proposed fix once we get things merged). Basically see here and scan for the use of IPC_MAJOR: https://github.com/andyross/sof/blob/mt8195-aec/src/audio/google/google_rtc_audio_processing.c |
878a4da
to
c803c46
Compare
...so here's a merge IPC3+IPC4 |
@andyross you are completely right and because of that you cannot expect Intel to enable and validate all possible configurations that are supported in SOF. This change introduce DP scheduling support for IPC4 because this is the configuration we can validate and guarantee the quality of it. |
Of course not. I just want you to review and approve a PR. If it doesn't work on your supported platform, provide comments and test results or whatever and we'll work together to fix it. I'll handle the other stuff. |
900b4f5
to
f060280
Compare
Sorry I was on vacation. Will have a look tomorrow. |
I think we are getting there. Any update ? |
Sorry I clicked the wrong button. |
This commit changes AEC to use sink/src interface and makes it to be a DP module it also enables optional usage of 32bit AEC API Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
f060280
to
37c5a26
Compare
I was on medical leave, please proceed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, thought I was already +1. Fine with me, though not looking forward to having to piecewise-rework the other PR.
Thanks @andyross - we can plan this better next time, a lot of moving parts this time which increased effort/complexity. |
SOFCI TEST |
Re run the CI build check. CI went down on Monday so manually restart. |
Andy has replied that his comments are now addressed and gives a +1 now..
@@ -92,3 +92,6 @@ CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y | |||
CONFIG_PROBE=y | |||
CONFIG_PROBE_DMA_MAX=2 | |||
CONFIG_LOG_TIMESTAMP_64BIT=y | |||
|
|||
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=y | |||
CONFIG_COMP_STUBS=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
From src/audio/Kconfig
"CONFIG_STUBS: This should only be used in testing environments like fuzzers or CI."
Good example of #9386
cc: @cujomalainey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now being reverted in:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#9410 results and discussion seem to show a test seems to depend on this!
CONFIG_COMP_STUBS=y was enabled in thesofproject#8722 / commit 8e34109 ("AEC: Enable Google AEC with Mock compliation"). CONFIG_COMP_STUBS indirectly enables CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK which was the desired effect. However it also automatically and silently "mocks" all other 3rd party modules which is not desirable. So, replace it with the more focused `CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK`. `src/audio/Kconfig` says "CONFIG_STUBS: This should only be used in testing environments like fuzzers or CI." It's not clear why official sof-bin releases should include `google_rtc_audio_processing_mock.c` but that's another topic for another day. build-mtl/zephyr.strip is identical before versus after this commit. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
CONFIG_COMP_STUBS=y was enabled in thesofproject#8722 / commit 8e34109 ("AEC: Enable Google AEC with Mock compliation"). CONFIG_COMP_STUBS indirectly enables CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK which was the desired effect. However it also automatically and silently "mocks" all other 3rd party modules which is not desirable. So, replace it with the more focused `CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK`. `src/audio/Kconfig` says "CONFIG_STUBS: This should only be used in testing environments like fuzzers or CI." Official sof-bin releases include `google_rtc_audio_processing_mock.c` because the CI that uses it can't use extra CONFIGS. That's another topic for another day, see thesofproject#9410. build-mtl/zephyr.strip is identical before versus after this commit. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
CONFIG_COMP_STUBS=y was enabled in #8722 / commit 8e34109 ("AEC: Enable Google AEC with Mock compliation"). CONFIG_COMP_STUBS indirectly enables CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK which was the desired effect. However it also automatically and silently "mocks" all other 3rd party modules which is not desirable. So, replace it with the more focused `CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK`. `src/audio/Kconfig` says "CONFIG_STUBS: This should only be used in testing environments like fuzzers or CI." Official sof-bin releases include `google_rtc_audio_processing_mock.c` because the CI that uses it can't use extra CONFIGS. That's another topic for another day, see #9410. build-mtl/zephyr.strip is identical before versus after this commit. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
this is a replacement of #8469
all review changes from it have been included
This PR modifies google AEC shimm to use sink/src interface and to be run as DP module in 10ms period
This is upstream of AEC changes from 007 branch and:
please ignore checkpatch warnings in google_rtc_audio_processing_ll.c, this file is - and should stay - 1:1 copy of legacy google_rtc_audio_processing.c.