-
Notifications
You must be signed in to change notification settings - Fork 330
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
Audio: Volume: Add IPC4 native Q1.31 mode and optimize #9900
Conversation
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.
@singalsu whats the overall MCPS delta for this PR ?
Here's savings for peakvolume and gain component builds. I did this while checking spectrograms with |
#define VOL_MAX INT32_MAX | ||
|
||
/** \brief Volume 0dB value. */ | ||
#define VOL_ZERO_DB INT32_MAX |
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.
Maybe it's correct and maybe it's just me, but it does look a bit confusing, or at least unclear. Maybe at least a bit larger comment could help. Is this the same value because by convention volume doesn't get positive or do these two macros have different usage?
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.
In IPC4 due to Q1.31 format the max volume and (near) 0 dB gain value are the same since the max linear gain is 0.9999... In IPC3 we used Q-formats those allowed amplification in volume component. I don't want to yet remove the IPC3 gain range since we still have IPC3 in the code. But we can do it later if we remove IPC3 from git main. But I don't think the Q1.31 is a good choice since it can't represent exactly gain 1 and it can't amplify. But that's what we have now.
src/audio/volume/volume_hifi5.c
Outdated
ae_int64 mult0; | ||
ae_int64 mult1; | ||
//ae_int64 mult0; | ||
//ae_int64 mult1; |
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.
left-over?
e67dbb8
to
74eb073
Compare
Failed one quickbuild test due to Python timeout. Retrying. |
Only the output align register needs to be cleared. The priming of input stream with e.g. AE_ZALIGN128() fully initializes it. Signed-off-by: Seppo Ingalsuo <[email protected]>
These registers are set later in the code in the load instructions. This change saves a bit of code size and a tiny amount of processor cycles. Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds Q1.31 gain to existing options Q8.16, Q8.23. The Q1.31 x Q1.31 or Q1.31 x Q1.15 to multiplications are directly supported by HiFi instructions without need for additional shifts. Also for HiFi5 the most parallel multiplications are available for suitable Q1.31 product. In HiFi5 version s24 and s32 peakvolume and gain the single multiply instruction AE_MULF32S_HH() or AE_MULF32S_LL() is changed to quad multiply AE_MULF2P32X4RS(). In HiFi4 and HiFi3 version s24 and s32 the single multiply is changed to dual multiply AE_MULFP32X2RS(). The MCPS saving in HiFi3/4/5 builds for gain and peakvolume with 16/24/32 bits stereo 48 kHz formats varies between 0.5% and 6.1%. At smallest the saving is 0.02 MCPS and at largest 0.2 MCPS. The savings are quite small because the volume gain computation has been already optimized and most of the load has happens in SOF modules framework instead of gain multiplications. Signed-off-by: Seppo Ingalsuo <[email protected]>
74eb073
to
cda34a9
Compare
No description provided.