Math: Library: Added cordic sine function#3990
Conversation
66c1a70 to
eab4e3f
Compare
|
I'd expect the commit message to contain a description on what this improves. |
eab4e3f to
8fbac25
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
Indentation and content LGTM. Cant comment on the maths though.
|
Github Actions hang fixed by #3992 . @ShriramShastry you must: This will restart Github Actions. Sorry for the inconvenience. Of course you could also address review comments and push, this would also trigger the same thing. |
|
@ShriramShastry are you able to rebase on top of latest main branch to fix the CI report. We are good to merge, we just need to make sure your shastry_cordicsin_dev branch has the CI fix from the main branch. |
8fbac25 to
fcbf08d
Compare
Rebasing is always possible but very rarely useful because Github Actions (and Travis, and Quickbuild, and our Jenkins, and others,...) always test the constantly moving Rebasing when no conflict also creates pointless NOT rebasing also provides more test coverage: 1. without the moving target locally, 2. with the moving target in CI. |
|
@zrombel can you comment on UT here, as this should be unrelated ? |
|
In https://sof-ci.01.org/sof-pr-viewer/#/build/PR3990/build6249622 all platforms fail with something like this so it does seem related |
Thanks @aiChaoSONG for helping me with triggering the tests. |
|
@cujomalainey please merge if you are happy. |
keyonjie
left a comment
There was a problem hiding this comment.
Thanks for the optimization @ShriramShastry , do you intend to add support of input formats Q2.30, Q3.29 (besides today's Q4.28) for sin_fixed()? If so, better to add another param to denote this and avoid the checking logic. The variables declaration and comments need follow the guide and remained code also.
do you intend to add support of input formats Q2.30, Q3.29 (besides today's Q4.28) for sin_fixed() The cordic sine algorithm only converges when the angle is in the range [-pi/2, pi/2). If an angle is outside of this range, then a multiple of pi/2 is added or subtracted from the angle until it is within the range [-pi/2,pi/2). The cordicsin function do addition or subtraction by a multiple of pi/2 in the data type of the input. So, when the fraction length is 30 or 29 , then the quantization error introduced by the addition or subtraction of pi/2 is done on input fraction bits of precision. I checked the implementation with cmocka which is pretty good #3990 (comment) In case it is desired, subsequent adaptation is needed outside the cordicsine algorithm ( For example DRC fix) |
singalsu
left a comment
There was a problem hiding this comment.
Look pretty good, can you check the things mentioned by me and Keyon!
5af6bd6 to
ffd95fc
Compare
paulstelian97
left a comment
There was a problem hiding this comment.
Still cannot fully review algorithm (my own theory is lacking).
Marking this as comment rather than approve due to issues with the commit message itself (for example, you need to fix the range in the commit message -- should be [-2*pi to 2*pi] -- and don't insert spaces where you shouldn't -- should be sizeof(int32) without extra spaces between the parentheses).
Other than that, as far as I could tell this looks good. I assume tests confirm that this works correctly.
Thanks you. |
ffd95fc to
030c506
Compare
|
@ShriramShastry Also please mark as resolved the issues those you have addressed. |
cordicsine input value range is [-2*pi to 2*pi] Compared to git hub, proposed solution has following advantage - Proposed implementation takes approx. ¼ [One fourth ] execution time - Lookup table size is reduced from 513 to 31 with sizeof(int32) with a saving of 481 int32 bytes Mean and maximum value for the difference between floating to fixed point output is 3.2136e-09 and 0.0000000596 Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
030c506 to
475381c
Compare
singalsu
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
|
CML showing unrelated kernel resume issue. |
Implement cordic sine algorithm with angle in the range [-pi/2, pi/2] having total harmonic distortion (THD) of (-170) dBc for SNR
Signed-off-by: ShriramShastry malladi.sastry@intel.com
** figure -1 cordic sine performance**
** figure -2 Computed time per sample derived using x86 performance count**
** figure -3 Difference between floating point and fixed point out**
