Last change
on this file since 4 was
2,
checked in by hhi, 13 years ago
|
inital import
|
-
Property svn:eol-style set to
native
|
File size:
1.6 KB
|
Line | |
---|
1 | |
---|
2 | |
---|
3 | |
---|
4 | /** \file ContextModel.h |
---|
5 | \brief context model class (header) |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef __CONTEXT_MODEL__ |
---|
9 | #define __CONTEXT_MODEL__ |
---|
10 | |
---|
11 | #if _MSC_VER > 1000 |
---|
12 | #pragma once |
---|
13 | #endif // _MSC_VER > 1000 |
---|
14 | |
---|
15 | #include "CommonDef.h" |
---|
16 | |
---|
17 | |
---|
18 | // ==================================================================================================================== |
---|
19 | // Class definition |
---|
20 | // ==================================================================================================================== |
---|
21 | |
---|
22 | /// context model class |
---|
23 | class ContextModel |
---|
24 | { |
---|
25 | public: |
---|
26 | ContextModel () { m_ucState = 0; } |
---|
27 | ~ContextModel () {} |
---|
28 | |
---|
29 | const UChar getState () { return ( m_ucState >> 1 ); } ///< get current state |
---|
30 | const UChar getMps () { return ( m_ucState & 1 ); } ///< get curret MPS |
---|
31 | |
---|
32 | Void init ( Int iQp, |
---|
33 | Short asCtxInit[] ); ///< initialize state with initial prob. |
---|
34 | |
---|
35 | Void updateLPS () |
---|
36 | { |
---|
37 | UChar ucMPS = ( m_ucState > 1 ? m_ucState & 1 : 1 - ( m_ucState & 1 ) ); |
---|
38 | m_ucState = ( m_aucNextStateLPS[ m_ucState >> 1 ] << 1 ) + ucMPS; |
---|
39 | } |
---|
40 | |
---|
41 | Void updateMPS () |
---|
42 | { |
---|
43 | m_ucState = ( m_aucNextStateMPS[ m_ucState >> 1 ] << 1 ) + ( m_ucState & 1 ); |
---|
44 | } |
---|
45 | |
---|
46 | private: |
---|
47 | UChar m_ucState; ///< internal state variable |
---|
48 | static const UChar m_aucNextStateMPS[ 64 ]; |
---|
49 | static const UChar m_aucNextStateLPS[ 64 ]; |
---|
50 | }; |
---|
51 | |
---|
52 | #endif |
---|
53 | |
---|
Note: See
TracBrowser for help on using the repository browser.