-
Notifications
You must be signed in to change notification settings - Fork 321
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
[DNM] Audio: Volume: Skip stream start fade as defined in Kconfig #8227
Conversation
The new options COMP_VOLUME_PLAYBACK_START_FADE and COMP_VOLUME_CAPTURE_START_FADE can be used to enable stream start fade-in to conceal pop sounds. By default fade is disabled for playback and enabled for capture. Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch makes the stream start volume fade-in operation configurable via Kconfig. It can save up to 3.5 MCPS peak load per channel per volume instance. The fade operation causes a load peak especially when multiple streams are started simultaneously. If there is no fade and when target gain is exactly 1 for all channels, the component will start in the lightest pass-through mode. Signed-off-by: Seppo Ingalsuo <[email protected]>
volume_prepare_start_with_fade(mod); | ||
else | ||
volume_prepare_start_without_fade(mod); | ||
#endif /* CONFIG_COMP_VOLUME_PLAYBACK_START_FADE*/ |
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.
those changes will make volume more complicated, we may need investigate and discuss first before take action.
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.
I tested all kconfig permutations so they work, but yes, there's more complexity.
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.
As this is not performance critical, I'd put the checks in an inline function and have just one call to volume_prepare_start_with_fade() and one to volume_prepare_start_without_fade().
static inline bool start_with_fade(direction)
{
#if CONFIG_COMP_VOLUME_PLAYBACK_START_FADE
if (direction == SOF_IPC_STREAM_PLAYBACK)
return true;
#endif
#if CONFIG_COMP_VOLUME_CAPTURE_START_FADE
if (direction == SOF_IPC_STREAM_CAPTURE)
return true;
#endif
return false;
}
I think we can spare one conditional check in prepare().
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.
don't add new code if it is not must, our initial problem is high ramp mcps, now, with change to linear and optimize windows fade, we already get good results, as liam just mentioned in mail, we should keep module easy to read/understand, especially for volume such simply module.
If volume is complicated, how can we do for other real complicated modules.
@lgirdwood @btian1 @wszypelt Seems we can't disable the playback start ramp in Kconfig without failing the 01_10_TestGainPeakVolApi test case. What should we do? In my tests with UPX I could not hear any start pops so this change could be done. If the test build could set CONFIG_COMP_VOLUME_PLAYBACK_START_FADE the test should pass. |
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.
One typoe and one code refactor proposal.
This option is needed to help reduce audible pops on | ||
some codecs but depending on requested ramp type it | ||
can increase peak MCPS by up to 3.5 per channel. Pops | ||
playback direction are rare, so this should be usually |
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.
typoe: "Pops in playback direction"
volume_prepare_start_with_fade(mod); | ||
else | ||
volume_prepare_start_without_fade(mod); | ||
#endif /* CONFIG_COMP_VOLUME_PLAYBACK_START_FADE*/ |
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.
As this is not performance critical, I'd put the checks in an inline function and have just one call to volume_prepare_start_with_fade() and one to volume_prepare_start_without_fade().
static inline bool start_with_fade(direction)
{
#if CONFIG_COMP_VOLUME_PLAYBACK_START_FADE
if (direction == SOF_IPC_STREAM_PLAYBACK)
return true;
#endif
#if CONFIG_COMP_VOLUME_CAPTURE_START_FADE
if (direction == SOF_IPC_STREAM_CAPTURE)
return true;
#endif
return false;
}
I think we can spare one conditional check in prepare().
I recall there is a test about fade in (start ramp) curve in internal CI test, is that one? |
Yep, it is failed. I marked this as do not merge since I'm not sure at all this is good way though it's efficient for MCPS. It would be better to have control of initial fade-in via topology. |
@andrula-song, @singalsu Just a reminder that Gain and PeakVol have fade in length definition inside of InitInstance and LargeConfigSet messages. Part of verification is comparison of recorded curve length with the module configuration. |
@mszleszy There's curve_type in both init IPC and volume command IPC. Is it a possible scenario that curve duration is 0 in init and changed in successive volume command during streaming to e.g 0.1s? Also apperently the curve type can change on the fly between no_fade and fade. We don't support such in Linux not at least yet but we could add such support to firmware if it's used by Windows OS driver. |
@singalsu It's possible to start with 0 curve length, it can be changed before stream starts, and ipc contains (channel id, target volume, curve type and curve duration). Same IPC can be sent while pipeline is running but i think only volume will be actually changed on the fly. We have same ipc structure for setting gain parameters before and during pipeline run so it looks like we can change curve type on the fly but i don't think that's an actual requirement or production scenario. @mwasko please correct me if I'm wrong |
I'll close this PR since it's causing a regression. With the curve_duration change on the fly, at least Windows OS driver can avoid the high peak MCPS when several gains are starting. We can make sure the FW handles it correctly. Not sure we can utilize it in Linux though. |
Closing |
No description provided.