-
Notifications
You must be signed in to change notification settings - Fork 349
math: Add power scalar and base 2 log function #4941
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
math: Add power scalar and base 2 log function #4941
Conversation
3d2046b to
35edda9
Compare
f761d25 to
e48cf10
Compare
johnylin76
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.
My only question is why do we need a UUID for power? is it for logging with "power_tr"?
yep there does not seem to other way to create a trace than having uuid. Some other library parts also have uuid. yes it is for |
4c89d8a to
c46d965
Compare
|
Offline synced with Malladi. For DRC usage, it requires the support of fractional value of both base and exponent. Both of them are always positive. The actual use cases for "exponent" of DRC is =1/(attack_frames); attack_frames represents the number of frames it expects to spend for 10dB drop in attack mode. It is a configurable parameter range from 1 to (sample_rate), but "typically" the value is an integer by the scale of tens to hundreds (the case of thousands is not often to be seen but it exists). The power function implementation in this PR is not usable for DRC. However I think it would have the use case for some other processing algorithms. |
c46d965 to
9f1049b
Compare
9f1049b to
8d0beed
Compare
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.
My only question is why do we need a UUID for power? is it for logging with "power_tr"?
Thanks for catching this. Sorry for the late request.
Logging is dictionary-based to save memory, so it uses UUID for component names.
I think we don't want a new trace component for each single .c file (or in this case: a single log statement for now!), so I think math_power_tr is too specific. How about math_tr instead? Declare it in some non-optional file, maybe in math/numbers.c?
As another, maybe extreme example ipc_tr is used in more than 20 files and more than 200 statements.
|
As reported by checkpatch, there are still many There are a few more warnings in https://sof-ci.01.org/sofpr/PR4941/build11280/checkpatch/ |
8d0beed to
d54e510
Compare
fix point math power function having negative and positive values of base and exponent as function argument. power_int32() support only integer base and exponential value and it does not support fractional values for base and exponent. fix point math base 2 logarithm function using a short lookup tables Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
d54e510 to
4cd3e5a
Compare
I did the test and now I don't see additional errors |
|
There's an inconsistency between https://sof-ci.01.org/sofpr/PR4941/build11287/checkpatch/ and https://github.com/thesofproject/sof/runs/4377441309?check_suite_focus=true. One is configured to catch C99 // comments and the other is not. Which is wrong and which is right? |
https://github.com/thesofproject/sof/runs/4377441309?check_suite_focus=true , can be ignored since https://github.com/thesofproject/sof/runs/4377441309?check_suite_focus=true and I ran This is my understanding !! |
SPDX // is allowed (and I cant remember the reason), but this also aligns with Linux. |
Good catch (and we should capture this as a feature cleanup for v2.1), but this should not be a blocker given the direction of travel to Zephyr logging APIs |
|
CI shows known system level PM timeout (unrelated to this PR as it's not used in test) and only C99 SPDX comments (which are allowed) |
I meant // in general, not for SPDX specifically. I will submit the change that turns off this warning and we can discuss there.
Not just in SPDX, see https://github.com/thesofproject/sof/runs/4377441309?check_suite_focus=true or simply look at the source.
@ShriramShastry can you please submit a new PR that moves Zephyr logging (and any decent logging solution really) have a compoment equivalent: https://docs.zephyrproject.org/latest/reference/logging/index.html#logging-in-a-module-instance |
This is a logical revert of eb45907 Based on recently merged thesofproject#4941, C99 comments are now OK. I never found any rationale or even written down coding style for excluding them in the first place. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
|
fix point math power function having negative and positive values
of base and exponent as function argument
fix point math base 2 logarithm function using a short lookup
tables
Signed-off-by: ShriramShastry malladi.sastry@intel.com