diff options
author | D G Turner | 2012-04-14 11:18:55 +0100 |
---|---|---|
committer | D G Turner | 2012-04-14 11:18:55 +0100 |
commit | f4ba8a6485b097a8ef1e2004d1af127243f379f1 (patch) | |
tree | 0cd4d3ebb0e7fbc9a4385e5244925570839aedda /common/sinetables.h | |
parent | 1809b9173cc158713246ae7bd70fe37a0dea1dd0 (diff) | |
download | scummvm-rg350-f4ba8a6485b097a8ef1e2004d1af127243f379f1.tar.gz scummvm-rg350-f4ba8a6485b097a8ef1e2004d1af127243f379f1.tar.bz2 scummvm-rg350-f4ba8a6485b097a8ef1e2004d1af127243f379f1.zip |
COMMON: Replaced static Sine and Cosine tables with dynamic generated.
This removes the large static tables from the binary (which saves 500K
to 1Mb of binary size) and replaced them with a class which generates
the required tables as needed in RAM. This has been tested with QDM2
and shows no obvious performance degredation and Memprof shows no
significant rise in RAM usage.
Diffstat (limited to 'common/sinetables.h')
-rw-r--r-- | common/sinetables.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/common/sinetables.h b/common/sinetables.h index 28918838f4..16e203f26d 100644 --- a/common/sinetables.h +++ b/common/sinetables.h @@ -25,12 +25,30 @@ namespace Common { -/** - * Get a sine table with the specified bit precision - * - * @param bits Precision of the table, which must be in range [4, 16] - */ -const float *getSineTable(int bits); +class SineTable { +public: + /** + * Construct a sine table with the specified bit precision + * + * @param bitPrecision Precision of the table, which must be in range [4, 16] + */ + SineTable(int bitPrecision); + ~SineTable(); + + /** + * Get pointer to table + */ + const float *getTable() { return _table; } + + /** + * Get pointer to table + */ + int getPrecision() { return _bitPrecision; } + +private: + float *_table; + int _bitPrecision; +}; } // End of namespace Common |