aboutsummaryrefslogtreecommitdiff
path: root/common/cosinetables.h
diff options
context:
space:
mode:
authorFilippos Karapetis2012-04-19 01:13:47 -0700
committerFilippos Karapetis2012-04-19 01:13:47 -0700
commita1618c215ba4b731c61df39a0eb31fc8028d34ed (patch)
tree324929ba691765db61d7012b5eb75c87f7eb1d3e /common/cosinetables.h
parent677806a4e97033a3e35559cf2a1da7ba45b0b72c (diff)
parent0f66d2c701958dc70ed57b570a7f59965a90bf66 (diff)
downloadscummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.tar.gz
scummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.tar.bz2
scummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.zip
Merge pull request #226 from digitall/sincos
Replace large static Sin and Cos tables with dynamically generated ones.
Diffstat (limited to 'common/cosinetables.h')
-rw-r--r--common/cosinetables.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/common/cosinetables.h b/common/cosinetables.h
index 5744d21569..f9fb6fd59a 100644
--- a/common/cosinetables.h
+++ b/common/cosinetables.h
@@ -25,12 +25,30 @@
namespace Common {
-/**
- * Get a cosine table with the specified bit precision
- *
- * @param bits Precision of the table, which must be in range [4, 16]
- */
-const float *getCosineTable(int bits);
+class CosineTable {
+public:
+ /**
+ * Construct a cosine table with the specified bit precision
+ *
+ * @param bitPrecision Precision of the table, which must be in range [4, 16]
+ */
+ CosineTable(int bitPrecision);
+ ~CosineTable();
+
+ /**
+ * 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