# HG changeset patch # User Chris Cannam # Date 1381326245 -3600 # Node ID f3c98e89cf759cd1234d05ef5f4d010036cffbe7 # Parent 1d439494604c3237775c3a18e4edb7e0c1fdc2d6 I don't think this optimisation is worth the loss of data fidelity any more diff -r 1d439494604c -r f3c98e89cf75 data/model/RangeSummarisableTimeValueModel.h --- 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 RangeBlock;