If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
SQRT optimization
15 posts
• Page 1 of 2 • 1, 2
SQRT optimization
Hey there,
I got to a point in which I need to use a function:
Y = sqrt(x)
in which X is limited between [1:0].
Can this be optimized, by avoiding sqrt and instead using taylor/maclaurin approximations?
I guess those would reach 3rd order (to reach satsifactory precision) and some multiplications and additions. Is that really better than using the original sqrt function ?
I got to a point in which I need to use a function:
Y = sqrt(x)
in which X is limited between [1:0].
Can this be optimized, by avoiding sqrt and instead using taylor/maclaurin approximations?
I guess those would reach 3rd order (to reach satsifactory precision) and some multiplications and additions. Is that really better than using the original sqrt function ?
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: SQRT optimization
There is not much to optimize: the sqrt function is as fast as a division, which is about four multiplies.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: SQRT optimization
I am attaching a .fsm, aiming at showing the state of the art. Kind of zoo. This goes beyond the SQRT optimization. It also covers the lin2db and db2lin functions. Please let me know if there is something missing. By the way, inside the .fsm, there is a question about the way one is raising audio to the 2nd power. Have a nice day.
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: SQRT optimization
steph_tsf wrote:...question about the way one is raising audio to the 2nd power
The max is irrelevant to the power function. It is just obtaining whichever stereo channel has the greater absolute magnitude (assuming that left/right are packed into the first two SSE channels).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: SQRT optimization
To use the x^a power function for a square root is indeed "sub-optimal". Better use sqrt (code) or sqrtps (ASM).
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: SQRT optimization
http://www.dsprobotics.com/support/viewtopic.php?f=2&t=37876&start=20
I've read the trogluddite post, confirming that "sqrtps" is full precision. Good news.
Contrary to "rsqrtps" (the reciprocal of it), that's limited to approximately 11-bits of precision ("half-precision").
Time to edit the RMS detector canvas, thus. One thus need to rely on the "sqrtps" instruction, just before the output.
I've read the trogluddite post, confirming that "sqrtps" is full precision. Good news.
Contrary to "rsqrtps" (the reciprocal of it), that's limited to approximately 11-bits of precision ("half-precision").
Time to edit the RMS detector canvas, thus. One thus need to rely on the "sqrtps" instruction, just before the output.
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: SQRT optimization
I am attaching a .fsm and a .jpg, for asking what's the specification of the sqrt(x) function that's supported by Flowstone 3.0.4. The .fsm shows that the the sqrt(x) DSP Code Component function doesn't deliver the square root of the input. Have a nice day.
Last edited by steph_tsf on Sat Feb 22, 2020 1:28 am, edited 2 times in total.
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: SQRT optimization
Given that we've had three users hit the limit in the last two days, I'm starting to think the "limit" is global, not per-user.steph_tsf wrote:**** Sorry, the board attachment quota has been reached. *****
Is such quota, a weekly limitation? When will I be able to attach the .fsm and .jpg?
I keep a pair of oven mitts next to my computer so I don't get a concussion from slapping my forehead while I'm reading the responses to my questions.
- deraudrl
- Posts: 239
- Joined: Thu Nov 28, 2019 9:12 pm
- Location: SoCal
Re: SQRT optimization
steph_tsf wrote:Is such quota, a weekly limitation? When will I be able to attach the .fsm and .jpg?
deraudrl wrote:Given that we've had three users hit the limit in the last two days, I'm starting to think the "limit" is global, not per-user.
In all my years moderating, I've still never worked out what the hell the algorithm is for it - there seem to be post-count, per-user, and global elements. I would have thought that having been here so long, I would have had it happen to me many times before, but it never has, even when we've had flurries like this one (I now have the horrible feeling that I've probably just jinxed myself! )
I also can't help wondering whether all the damned spammers aren't helping. Spogg and I can only ban them, which stops them from logging back in, but it doesn't delete their NSFW animated-GIF avatars etc. (q.v. the way that they still show in the "birthdays" list). The amount of junk on the server doesn't bear thinking about, given that we sometimes ban dozens in a single day.
In the mean-time, the only advice we can offer is to send an email to support@dsprobotics.com reporting that you can no longer upload, and hope for the best - Malc doesn't seem to check the account all that often, but he usually does fix it once he knows.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: SQRT optimization
trogluddite wrote:the only advice we can offer is to send an email to support@dsprobotics.com reporting that you can no longer upload, and hope for the best
Without doing anything, without sending an email, I am again allowed to attach files. The attachments are now on my post, above. The sqrt(x) doesn't deliver what one is expecting. There must me something obvious like an offset, or some rescaling. Can you please tell?
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
15 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 39 guests