From 4efc9b152c89aafe8a8b4f47c7f0d3d9db945df8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 8 Jun 2013 21:28:27 +0200 Subject: COMMON: Save memory by allocating only required entries in Cosine-/SineTable. The tables only contain (2^bitPrecision)/2 entries. The code allocated twice as many entries previously. --- common/cosinetables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/cosinetables.cpp') diff --git a/common/cosinetables.cpp b/common/cosinetables.cpp index fe8f454e14..e6bf790611 100644 --- a/common/cosinetables.cpp +++ b/common/cosinetables.cpp @@ -34,7 +34,7 @@ CosineTable::CosineTable(int bitPrecision) { int m = 1 << _bitPrecision; double freq = 2 * M_PI / m; - _table = new float[m]; + _table = new float[m / 2]; // Table contains cos(2*pi*x/n) for 0<=x<=n/4, // followed by its reverse -- cgit v1.2.3 From bc358b77a8b018901f58e43a8b530113c7716688 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 8 Jun 2013 21:46:29 +0200 Subject: COMMON: Improve comment in CosineTable::CosineTable. This commit changes the comment to use the same variable names as we do in the code. Furthermore, it also makes the comment a bit easier to grasp. --- common/cosinetables.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/cosinetables.cpp') diff --git a/common/cosinetables.cpp b/common/cosinetables.cpp index e6bf790611..3b245750fa 100644 --- a/common/cosinetables.cpp +++ b/common/cosinetables.cpp @@ -36,8 +36,8 @@ CosineTable::CosineTable(int bitPrecision) { double freq = 2 * M_PI / m; _table = new float[m / 2]; - // Table contains cos(2*pi*x/n) for 0<=x<=n/4, - // followed by its reverse + // Table contains cos(2*pi*i/m) for 0<=i