• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.4
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by archivator - 2010-04-28
Last edited by Buschel - 2010-05-12

FS#11229 - FFT: math rework

Simplifies the math routines, removes all 64-bit math and unused 64-bit math sqrt function.

Closed by  Buschel
2010-05-12 02:42
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Submitted with r25790

Just a quick note. It seem that in some cases you’re first calculating a square root and then taking the logarithm. This can probably combined more efficiently (haven’t tested it though):
* just take the logarithm without doing the square root first
* divide the result by 2
This uses the mathematical property log(x^a) = a log (x), where a = 0.5 in this case

While that’s technically true, I can’t see how to use it here. Let me explain:

Before the if (tmp>0) bit, tmp is at most 29 bits (an assumption made throughout the code). The sqrt call makes sure that it’s at most 14 bits, so that the right shift does not overflow.

If I don’t do the sqrt, the right shift is virtually guaranteed to overflow, which is what this refactoring is trying to fix.
If I don’t do the right shift at all but just leave the log call (it *is* in theory a linear mapping), values < 0xFFFF will be treated as less than 1, resulting in negative and quite large values for tmp - obviously not the desired outcome. Therefore, the right shift is needed and therefore, the sqrt call is needed to guarantee that the shift does not overflow.

If I’m missing something, do let me know.

Sorry, that should say left shift, obviously.

Wasn’t this submitted with r25790?

It was. I don’t have the necessary privileges on FS to close the task (and frankly, I forgot about it :) )


Available keyboard shortcuts


Task Details

Task Editing