source: 3DVCSoftware/branches/0.1-poznan-univ/source/Lib/TLibCommon/ContextModel.cpp

Last change on this file was 2, checked in by hhi, 13 years ago

inital import

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1
2
3/** \file     ContextModel.cpp
4    \brief    context model class
5*/
6
7#include "ContextModel.h"
8
9// ====================================================================================================================
10// Public member functions
11// ====================================================================================================================
12
13/**
14 - initialize context model with respect to QP and initial probability
15 .
16 \param  iQp         input QP value
17 \param  asCtxInit   initial probability table
18 */
19Void
20ContextModel::init( Int iQp, Short asCtxInit[] )
21{
22  Int iInitState  = ( ( asCtxInit[ 0 ] * iQp ) >> 4 ) + asCtxInit[ 1 ];
23  iInitState      = Min( Max( 1, iInitState ), 126 );
24  if( iInitState >= 64 )
25  {
26    m_ucState     = Min( 62, iInitState - 64 );
27    m_ucState    += m_ucState + 1;
28  }
29  else
30  {
31    m_ucState     = Min( 62, 63 - iInitState );
32    m_ucState    += m_ucState;
33  }
34}
35
36
37const UChar
38ContextModel::m_aucNextStateMPS[ 64 ] =
39{
40  1, 2, 3, 4, 5, 6, 7, 8,   
41  9, 10,11,12,13,14,15,16, 
42  17,18,19,20,21,22,23,24,
43  25,26,27,28,29,30,31,32, 
44  33,34,35,36,37,38,39,40, 
45  41,42,43,44,45,46,47,48,
46  49,50,51,52,53,54,55,56, 
47  57,58,59,60,61,62,62,63
48};
49
50const UChar
51ContextModel::m_aucNextStateLPS[ 64 ] =
52{
53  0, 0, 1, 2, 2, 4, 4, 5,   
54  6, 7, 8, 9, 9, 11,11,12, 
55  13,13,15,15,16,16,18,18,
56  19,19,21,21,22,22,23,24, 
57  24,25,26,26,27,27,28,29, 
58  29,30,30,30,31,32,32,33,
59  33,33,34,34,35,35,35,36, 
60  36,36,37,37,37,38,38,63
61};
62
Note: See TracBrowser for help on using the repository browser.