Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibCommon/ContextModel.cpp
- Timestamp:
- 20 Feb 2013, 22:07:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/ContextModel.cpp
r56 r296 56 56 Void ContextModel::init( Int qp, Int initValue ) 57 57 { 58 #if H0736_AVC_STYLE_QP_RANGE59 58 qp = Clip3(0, 51, qp); 60 #endif61 59 62 #if CABAC_LINEAR_INIT63 60 Int slope = (initValue>>4)*5 - 45; 64 61 Int offset = ((initValue&15)<<3)-16; … … 66 63 UInt mpState = (initState >= 64 ); 67 64 m_ucState = ( (mpState? (initState - 64):(63 - initState)) <<1) + mpState; 68 #else69 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 #endif81 65 } 82 66 … … 143 127 #endif 144 128 }; 145 #if !CABAC_LINEAR_INIT146 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 #endif150 129 //! \}
Note: See TracChangeset for help on using the changeset viewer.