1#ifndef APE_SCALEDFIRSTORDERFILTER_H 2#define APE_SCALEDFIRSTORDERFILTER_H 3 4template <int MULTIPLY, int SHIFT> class CScaledFirstOrderFilter 5{ 6public: 7 8 __inline void Flush() 9 { 10 m_nLastValue = 0; 11 } 12 13 __inline int Compress(const int nInput) 14 { 15 int nRetVal = nInput - ((m_nLastValue * MULTIPLY) >> SHIFT); 16 m_nLastValue = nInput; 17 return nRetVal; 18 } 19 20 __inline int Decompress(const int nInput) 21 { 22 m_nLastValue = nInput + ((m_nLastValue * MULTIPLY) >> SHIFT); 23 return m_nLastValue; 24 } 25 26protected: 27 28 int m_nLastValue; 29}; 30 31#endif // #ifndef APE_SCALEDFIRSTORDERFILTER_H 32