-
Notifications
You must be signed in to change notification settings - Fork 349
Audio: DRC: DRC math function optimiazation #8431
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
Conversation
| ae_f32 exp; /* Q7.25 */ | ||
| ae_f32 acc; /* Q6.26 */ | ||
| ae_f32 tmp; /* Q6.26 */ | ||
| ae_f64 tmp64; |
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.
So, there's overhead in inline functions, maybe it's from 26 as literal instead of variable? You could comment that the instructions normalize the value after the function was removed.
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 in xtensa test bench, it really costs more cycles when using the function wrapper than instructions.
src/audio/drc/drc_math_hifi3.c
Outdated
| x = drc_mult_lshift(x, ONE_OVER_SQRT2_Q30, lshift); | ||
| tmp64 = AE_MULF32R_LL(x, ONE_OVER_SQRT2_Q30); | ||
| /* drc_get_lshift(30, 30, 30) = 1 */ | ||
| tmp64 = AE_SLAI64S(tmp64, 1); |
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.
You could use #define macro for the magic shift values to know the are for a Qx to Qy conversion.
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 use macro then I can not use AE_SLAI64S, and if use AE_SLAA64S, the log10_fixed reduce cycles from 12.8% down to 12.2%, so better get back the lshift calculation for better code readability.
src/audio/drc/drc_math_hifi3.c
Outdated
| int32_t lshift; | ||
| int32_t e; | ||
| /* drc_get_lshift(25, 30, 25) = 1 */ | ||
| int32_t lshift = 1; |
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.
Use a #define macro for Qx Qy multiply as Qz shift value?
Use the xtense intrinsic instrunctions directly can save at least 10% cycles for those functions, and save about 0.9mcps for DRC component. Signed-off-by: Andrula Song <andrula.song@intel.com>
lgirdwood
left a comment
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.
Good improvement.
|
@andrula-song whats the reason for close if saving MCPS ? |
|

Use the xtense intrinsic instrunctions directly can save at least 10% cycles for those functions, and save about 0.92mcps for DRC component.