aboutsummaryrefslogtreecommitdiff
path: root/Src/replicant/nsmp3dec/meanvalue.h
blob: 5f1a3e587f74a2f7cc37b0b7f0789530c18c6d3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*************************************************************************** *
*                    MPEG Layer3-Audio Decoder
*                  © 1997-2006 by Fraunhofer IIS
 *                        All Rights Reserved
 *
 *   filename: meanvalue.h
 *   project : ---
 *   author  : Martin Sieler
 *   date    : 1998-02-14
 *   contents/description: HEADER - calc mean value
 *
 *
\***************************************************************************/

/*
 * $Date: 2010/11/17 20:46:03 $
 * $Id: meanvalue.h,v 1.1 2010/11/17 20:46:03 audiodsp Exp $
 */

#ifndef __MEANVALUE_H__
#define __MEANVALUE_H__

/* ------------------------ includes --------------------------------------*/

/*-------------------------- defines --------------------------------------*/

/*-------------------------------------------------------------------------*/

class CMeanValue
{
public:

  CMeanValue() { Reset(); }

  void  Reset();
  CMeanValue& operator+= (int nValue);

  operator int()   const { return m_Count ? m_Sum/m_Count : 0; }
  operator float() const { return m_Count ? float(m_Sum)/float(m_Count) : 0.0f; }

  int   GetSum()   const { return m_Sum;    }
  int   GetCount() const { return m_Count;  }
  int   GetMin()   const { return m_Min;    }
  int   GetMax()   const { return m_Max;    }
  bool  IsFixed()  const { return m_bFixed; }

protected:

private:

  int  m_Count;
  int  m_Sum;
  int  m_FirstValue;
  int  m_Min;
  int  m_Max;
  bool m_bFixed;
};

/*-------------------------------------------------------------------------*/
#endif