Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/ContextModel.h
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/ContextModel.h
r1179 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 37 37 */ 38 38 39 #ifndef __CONTEXT _MODEL__40 #define __CONTEXT _MODEL__39 #ifndef __CONTEXTMODEL__ 40 #define __CONTEXTMODEL__ 41 41 42 42 #if _MSC_VER > 1000 … … 45 45 46 46 #include "CommonDef.h" 47 #include "TComRom.h" 47 48 48 49 //! \ingroup TLibCommon … … 59 60 ContextModel () { m_ucState = 0; m_binsCoded = 0; } 60 61 ~ContextModel () {} 61 62 62 63 UChar getState () { return ( m_ucState >> 1 ); } ///< get current state 63 64 UChar getMps () { return ( m_ucState & 1 ); } ///< get curret MPS 64 65 Void setStateAndMps( UChar ucState, UChar ucMPS) { m_ucState = (ucState << 1) + ucMPS; } ///< set state and MPS 65 66 66 67 Void init ( Int qp, Int initValue ); ///< initialize state with initial probability 67 68 68 69 Void updateLPS () 69 70 { 70 71 m_ucState = m_aucNextStateLPS[ m_ucState ]; 71 72 } 72 73 73 74 Void updateMPS () 74 75 { 75 76 m_ucState = m_aucNextStateMPS[ m_ucState ]; 76 77 } 77 78 78 79 Int getEntropyBits(Short val) { return m_entropyBits[m_ucState ^ val]; } 79 80 80 81 #if FAST_BIT_EST 81 82 Void update( Int binVal ) … … 88 89 Void setBinsCoded(UInt val) { m_binsCoded = val; } 89 90 UInt getBinsCoded() { return m_binsCoded; } 90 91 91 92 private: 92 93 UChar m_ucState; ///< internal state variable 93 static const UChar m_aucNextStateMPS[ 128 ]; 94 static const UChar m_aucNextStateLPS[ 128 ]; 95 static const Int m_entropyBits[ 128 ]; 94 95 static const UInt m_totalStates = (1 << CONTEXT_STATE_BITS) * 2; //*2 for MPS = [0|1] 96 static const UChar m_aucNextStateMPS[m_totalStates]; 97 static const UChar m_aucNextStateLPS[m_totalStates]; 98 static const Int m_entropyBits [m_totalStates]; 96 99 #if FAST_BIT_EST 97 static UChar m_nextState[ 128][2];100 static UChar m_nextState[m_totalStates][2 /*MPS = [0|1]*/]; 98 101 #endif 99 102 UInt m_binsCoded;
Note: See TracChangeset for help on using the changeset viewer.