Mercurial > hg > svcore
diff data/model/RangeSummarisableTimeValueModel.h @ 836:f3c98e89cf75
I don't think this optimisation is worth the loss of data fidelity any more
author | Chris Cannam |
---|---|
date | Wed, 09 Oct 2013 14:44:05 +0100 |
parents | 8c5b0eec6fe9 |
children | 59e7fe1b1003 |
line wrap: on
line diff
--- a/data/model/RangeSummarisableTimeValueModel.h Mon Sep 16 15:47:27 2013 +0100 +++ b/data/model/RangeSummarisableTimeValueModel.h Wed Oct 09 14:44:05 2013 +0100 @@ -37,41 +37,6 @@ public: RangeSummarisableTimeValueModel() { } -#define RANGE_USE_SHORT 1 -#ifdef RANGE_USE_SHORT - class Range - { - public: - Range() : - m_min(0), m_max(0), m_absmean(0) { } - Range(const Range &r) : - m_min(r.m_min), m_max(r.m_max), m_absmean(r.m_absmean) { } - Range(float min, float max, float absmean) - { setMin(min); setMax(max); setAbsmean(absmean); } - - float min() const { return i2f(m_min); } - float max() const { return i2f(m_max); } - float absmean() const { return i2f(m_absmean); } - - void setMin(float min) { m_min = f2i(min); } - void setMax(float max) { m_max = f2i(max); } - void setAbsmean(float absmean) { m_absmean = f2i(absmean); } - - private: - static inline int16_t f2i(float f) { - if (f > 1.f) f = 1.f; - if (f < -1.f) f = -1.f; - return int16_t(f * 32767.f); - } - static inline float i2f(int16_t i) { - return float(i) / 32767.f; - } - - int16_t m_min; - int16_t m_max; - int16_t m_absmean; - }; -#else class Range { public: @@ -95,7 +60,6 @@ float m_max; float m_absmean; }; -#endif typedef std::vector<Range> RangeBlock;