Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibCommon/ContextModel.cpp


Ignore:
Timestamp:
20 Feb 2013, 22:07:43 (12 years ago)
Author:
tech
Message:

Reintegrated branch 5.1-dev0 rev. 295.

File:
1 edited

Legend:

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

    r56 r296  
    5656Void ContextModel::init( Int qp, Int initValue )
    5757{
    58 #if H0736_AVC_STYLE_QP_RANGE
    5958  qp = Clip3(0, 51, qp);
    60 #endif
    6159
    62 #if CABAC_LINEAR_INIT
    6360  Int  slope      = (initValue>>4)*5 - 45;
    6461  Int  offset     = ((initValue&15)<<3)-16;
     
    6663  UInt mpState    = (initState >= 64 );
    6764  m_ucState       = ( (mpState? (initState - 64):(63 - initState)) <<1) + mpState;
    68 #else
    69   Int m = m_slopes[initValue>>4];
    70   Int n = initValue & 15;
    71  
    72   Int val = max( 0, min( 3839, (n<<8) + m * (qp-26) + 128 ) );
    73   val -= 1920;
    74   Int valMps = val >= 0;
    75   val = ( val ^ (val>>11) ) + 128;
    76   Int segmentIdx = val >> 8;
    77   Int pStateIdx = m_accumulatedSegOffset[segmentIdx] + ( (val&255) * m_segOffset[segmentIdx] >> 8);
    78  
    79   m_ucState = (pStateIdx<<1) + valMps;
    80 #endif
    8165}
    8266
     
    143127#endif
    144128};
    145 #if !CABAC_LINEAR_INIT
    146 const Int ContextModel::m_slopes[16] = { -239, -143, -85, -51, -31, -19, -11, 0, 11, 19, 31, 51, 85, 143, 239, 399 };
    147 const Int ContextModel::m_segOffset[8]            = {   6,  7,  5,  7, 10, 14, 16,  1 };
    148 const Int ContextModel::m_accumulatedSegOffset[8] = {  -3,  3, 10, 15, 22, 32, 46, 62 };
    149 #endif
    150129//! \}
Note: See TracChangeset for help on using the changeset viewer.