summaryrefslogtreecommitdiff
path: root/apps/plugins/fft/math.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-02-10 19:44:11 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-02-10 19:44:11 +0000
commit43264a946f0222e49ac2c10da7d00b36efc3f40e (patch)
treed0ef77e8280819bfc23f9ef101e1374011ad6e1b /apps/plugins/fft/math.c
parentfa4ab10bbbd5b3588bc0e7057b338d1068939fda (diff)
downloadrockbox-43264a946f0222e49ac2c10da7d00b36efc3f40e.tar.gz
rockbox-43264a946f0222e49ac2c10da7d00b36efc3f40e.zip
New plugin: FFT, A frequency analyzer plugin
There is some more work needed: - Keymaps are definitely not perfect, touchscreen targets are disabled due to no keymap - There is no manual yet Author: Delyan Kratunov Flyspray: FS#10065 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24587 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/fft/math.c')
-rw-r--r--apps/plugins/fft/math.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/plugins/fft/math.c b/apps/plugins/fft/math.c
new file mode 100644
index 0000000000..c00804fcc8
--- /dev/null
+++ b/apps/plugins/fft/math.c
@@ -0,0 +1,13 @@
1#include "math.h"
2
3int64_t fsqrt64(int64_t a, unsigned int fracbits)
4{
5 int64_t b = a/2 + (1 << fracbits); /* initial approximation */
6 unsigned int n;
7 const unsigned int iterations = 3; /* very rough approximation */
8
9 for (n = 0; n < iterations; ++n)
10 b = (b + (((int64_t)(a) << fracbits)/b))/2;
11
12 return b;
13}