1 | |
---|
2 | |
---|
3 | /** \file TComMotionInfo.h |
---|
4 | \brief motion information handling classes (header) |
---|
5 | \todo TComMvField seems to be better to be inherited from TComMv |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef __TCOMMOTIONINFO__ |
---|
9 | #define __TCOMMOTIONINFO__ |
---|
10 | |
---|
11 | #include <memory.h> |
---|
12 | #include "CommonDef.h" |
---|
13 | #include "TComMv.h" |
---|
14 | |
---|
15 | // ==================================================================================================================== |
---|
16 | // Type definition |
---|
17 | // ==================================================================================================================== |
---|
18 | |
---|
19 | /// parameters for AMVP |
---|
20 | typedef struct _AMVPInfo |
---|
21 | { |
---|
22 | TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS ]; ///< array of motion vector predictor candidates |
---|
23 | Int iN; ///< number of motion vector predictor candidates |
---|
24 | } AMVPInfo; |
---|
25 | |
---|
26 | // ==================================================================================================================== |
---|
27 | // Class definition |
---|
28 | // ==================================================================================================================== |
---|
29 | |
---|
30 | /// class for motion vector with reference index |
---|
31 | class TComMvField |
---|
32 | { |
---|
33 | private: |
---|
34 | TComMv m_acMv; |
---|
35 | Int m_iRefIdx; |
---|
36 | |
---|
37 | public: |
---|
38 | TComMvField() : |
---|
39 | m_iRefIdx (-1) |
---|
40 | { |
---|
41 | } |
---|
42 | |
---|
43 | Void setMvField ( TComMv cMv, Int iRefIdx ) |
---|
44 | { |
---|
45 | m_acMv = cMv; |
---|
46 | m_iRefIdx = iRefIdx; |
---|
47 | } |
---|
48 | |
---|
49 | TComMv& getMv () { return m_acMv; } |
---|
50 | Int getRefIdx () { return m_iRefIdx; } |
---|
51 | |
---|
52 | Int getHor () { return m_acMv.getHor(); } |
---|
53 | Int getVer () { return m_acMv.getVer(); } |
---|
54 | }; |
---|
55 | |
---|
56 | /// class for motion information in one CU |
---|
57 | class TComCUMvField |
---|
58 | { |
---|
59 | private: |
---|
60 | TComMv* m_pcMv; |
---|
61 | TComMv* m_pcMvd; |
---|
62 | Int* m_piRefIdx; |
---|
63 | UInt m_uiNumPartition; |
---|
64 | AMVPInfo m_cAMVPInfo; |
---|
65 | public: |
---|
66 | TComCUMvField() |
---|
67 | { |
---|
68 | m_pcMv = NULL; |
---|
69 | m_pcMvd = NULL; |
---|
70 | m_piRefIdx = NULL; |
---|
71 | } |
---|
72 | ~TComCUMvField() |
---|
73 | { |
---|
74 | m_pcMv = NULL; |
---|
75 | m_pcMvd = NULL; |
---|
76 | m_piRefIdx = NULL; |
---|
77 | } |
---|
78 | |
---|
79 | // ------------------------------------------------------------------------------------------------------------------ |
---|
80 | // create / destroy |
---|
81 | // ------------------------------------------------------------------------------------------------------------------ |
---|
82 | |
---|
83 | Void create ( UInt uiNumPartition ); |
---|
84 | Void destroy (); |
---|
85 | |
---|
86 | // ------------------------------------------------------------------------------------------------------------------ |
---|
87 | // clear / copy |
---|
88 | // ------------------------------------------------------------------------------------------------------------------ |
---|
89 | |
---|
90 | Void clearMv ( Int iPartAddr, UInt uiDepth ); |
---|
91 | Void clearMvd ( Int iPartAddr, UInt uiDepth ); |
---|
92 | Void clearMvField (); |
---|
93 | |
---|
94 | Void copyFrom ( TComCUMvField* pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst ); |
---|
95 | Void copyTo ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst ); |
---|
96 | Void copyTo ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst, UInt uiOffset, UInt uiNumPart ); |
---|
97 | Void copyMvTo ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst ); |
---|
98 | |
---|
99 | // ------------------------------------------------------------------------------------------------------------------ |
---|
100 | // get |
---|
101 | // ------------------------------------------------------------------------------------------------------------------ |
---|
102 | |
---|
103 | TComMv& getMv ( Int iIdx ) { return m_pcMv [iIdx]; } |
---|
104 | TComMv* getMv () { return m_pcMv; } |
---|
105 | TComMv& getMvd ( Int iIdx ) { return m_pcMvd [iIdx]; } |
---|
106 | TComMv* getMvd () { return m_pcMvd; } |
---|
107 | Int getRefIdx ( Int iIdx ) { return m_piRefIdx[iIdx]; } |
---|
108 | Int* getRefIdx () { return m_piRefIdx; } |
---|
109 | |
---|
110 | AMVPInfo* getAMVPInfo () { return &m_cAMVPInfo; } |
---|
111 | // ------------------------------------------------------------------------------------------------------------------ |
---|
112 | // set |
---|
113 | // ------------------------------------------------------------------------------------------------------------------ |
---|
114 | |
---|
115 | Void setMv ( TComMv cMv, Int iIdx ) { m_pcMv [iIdx] = cMv; } |
---|
116 | Void setMvd ( TComMv cMvd, Int iIdx ) { m_pcMvd [iIdx] = cMvd; } |
---|
117 | Void setRefIdx ( Int iRefIdx, Int iIdx ) { m_piRefIdx[iIdx] = iRefIdx; } |
---|
118 | |
---|
119 | Void setMvPtr ( TComMv* cMvPtr ) { m_pcMv = cMvPtr; } |
---|
120 | Void setMvdPtr ( TComMv* cMvdPtr ) { m_pcMvd = cMvdPtr; } |
---|
121 | Void setRefIdxPtr ( Int* iRefIdxPtr ) { m_piRefIdx = iRefIdxPtr; } |
---|
122 | Void setNumPartition ( Int iNumPart ) { m_uiNumPartition=iNumPart; } |
---|
123 | |
---|
124 | Void setAllMv ( TComMv& rcMv, PartSize eCUMode, Int iPartAddr, Int iPartIdx, UInt uiDepth ); |
---|
125 | Void setAllMvd ( TComMv& rcMvd, PartSize eCUMode, Int iPartAddr, Int iPartIdx, UInt uiDepth ); |
---|
126 | Void setAllRefIdx ( Int iRefIdx, PartSize eMbMode, Int iPartAddr, Int iPartIdx, UInt uiDepth ); |
---|
127 | Void setAllMvField ( TComMv& rcMv, Int iRefIdx, PartSize eMbMode, Int iPartAddr, Int iPartIdx, UInt uiDepth ); |
---|
128 | |
---|
129 | #if AMVP_BUFFERCOMPRESS |
---|
130 | Void compress (PredMode* pePredMode,UChar* puhInterDir); |
---|
131 | #endif |
---|
132 | |
---|
133 | }; |
---|
134 | |
---|
135 | #endif // __TCOMMOTIONINFO__ |
---|
136 | |
---|