diff options
author | Johannes Schickel | 2013-06-08 21:28:27 +0200 |
---|---|---|
committer | Johannes Schickel | 2013-06-08 21:47:52 +0200 |
commit | 4efc9b152c89aafe8a8b4f47c7f0d3d9db945df8 (patch) | |
tree | 40b56644fcdf3729ee0747af1f584a8cf454e59f /common | |
parent | 21f87070afa31f30593e85a9ddd5fcb84c292ec8 (diff) | |
download | scummvm-rg350-4efc9b152c89aafe8a8b4f47c7f0d3d9db945df8.tar.gz scummvm-rg350-4efc9b152c89aafe8a8b4f47c7f0d3d9db945df8.tar.bz2 scummvm-rg350-4efc9b152c89aafe8a8b4f47c7f0d3d9db945df8.zip |
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.
Diffstat (limited to 'common')
-rw-r--r-- | common/cosinetables.cpp | 2 | ||||
-rw-r--r-- | common/sinetables.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
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 diff --git a/common/sinetables.cpp b/common/sinetables.cpp index 2198dbfd1a..7338166d39 100644 --- a/common/sinetables.cpp +++ b/common/sinetables.cpp @@ -34,7 +34,7 @@ SineTable::SineTable(int bitPrecision) { int m = 1 << _bitPrecision; double freq = 2 * M_PI / m; - _table = new float[m]; + _table = new float[m / 2]; // Table contains sin(2*pi*i/m) for 0<=i<m/4, // followed by m/2<=i<3m/4 |