Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/ContextModel.h


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/ContextModel.h

    r1179 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3737*/
    3838
    39 #ifndef __CONTEXT_MODEL__
    40 #define __CONTEXT_MODEL__
     39#ifndef __CONTEXTMODEL__
     40#define __CONTEXTMODEL__
    4141
    4242#if _MSC_VER > 1000
     
    4545
    4646#include "CommonDef.h"
     47#include "TComRom.h"
    4748
    4849//! \ingroup TLibCommon
     
    5960  ContextModel  ()                        { m_ucState = 0; m_binsCoded = 0; }
    6061  ~ContextModel ()                        {}
    61  
     62
    6263  UChar getState  ()                { return ( m_ucState >> 1 ); }                    ///< get current state
    6364  UChar getMps    ()                { return ( m_ucState  & 1 ); }                    ///< get curret MPS
    6465  Void  setStateAndMps( UChar ucState, UChar ucMPS) { m_ucState = (ucState << 1) + ucMPS; } ///< set state and MPS
    65  
     66
    6667  Void init ( Int qp, Int initValue );   ///< initialize state with initial probability
    67  
     68
    6869  Void updateLPS ()
    6970  {
    7071    m_ucState = m_aucNextStateLPS[ m_ucState ];
    7172  }
    72  
     73
    7374  Void updateMPS ()
    7475  {
    7576    m_ucState = m_aucNextStateMPS[ m_ucState ];
    7677  }
    77  
     78
    7879  Int getEntropyBits(Short val) { return m_entropyBits[m_ucState ^ val]; }
    79    
     80
    8081#if FAST_BIT_EST
    8182  Void update( Int binVal )
     
    8889  Void setBinsCoded(UInt val)   { m_binsCoded = val;  }
    8990  UInt getBinsCoded()           { return m_binsCoded;   }
    90  
     91
    9192private:
    9293  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];
    9699#if FAST_BIT_EST
    97   static UChar m_nextState[128][2];
     100  static UChar m_nextState[m_totalStates][2 /*MPS = [0|1]*/];
    98101#endif
    99102  UInt          m_binsCoded;
Note: See TracChangeset for help on using the changeset viewer.