HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TComMotionInfo.h
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2  * License, included below. This software may be subject to other third party
3  * and contributor rights, including patent rights, and no such rights are
4  * granted under this license.
5  *
6  * Copyright (c) 2010-2017, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
39 #ifndef __TCOMMOTIONINFO__
40 #define __TCOMMOTIONINFO__
41 
42 #include <memory.h>
43 #include "CommonDef.h"
44 #include "TComMv.h"
45 
48 
49 // ====================================================================================================================
50 // Type definition
51 // ====================================================================================================================
52 
54 typedef struct _AMVPInfo
55 {
57  Int iN;
58 #if MCTS_ENC_CHECK
60 #endif
61 } AMVPInfo;
62 
63 // ====================================================================================================================
64 // Class definition
65 // ====================================================================================================================
66 
69 {
70 private:
73 
74 public:
76 
77  Void setMvField( TComMv const & cMv, Int iRefIdx )
78  {
79  m_acMv = cMv;
80  m_iRefIdx = iRefIdx;
81  }
82 
83  Void setRefIdx( Int refIdx ) { m_iRefIdx = refIdx; }
84 
85  TComMv const & getMv() const { return m_acMv; }
86  TComMv & getMv() { return m_acMv; }
87 
88  Int getRefIdx() const { return m_iRefIdx; }
89  Int getHor () const { return m_acMv.getHor(); }
90  Int getVer () const { return m_acMv.getVer(); }
91 };
92 
95 {
96 private:
102 
103  template <typename T>
104  Void setAll( T *p, T const & val, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx );
105 
106 public:
109 
110  // ------------------------------------------------------------------------------------------------------------------
111  // create / destroy
112  // ------------------------------------------------------------------------------------------------------------------
113 
114  Void create( UInt uiNumPartition );
115  Void destroy();
116 
117  // ------------------------------------------------------------------------------------------------------------------
118  // clear / copy
119  // ------------------------------------------------------------------------------------------------------------------
120 
121  Void clearMvField();
122 
123  Void copyFrom( TComCUMvField const * pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst );
124  Void copyTo ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst ) const;
125  Void copyTo ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst, UInt uiOffset, UInt uiNumPart ) const;
126 
127  // ------------------------------------------------------------------------------------------------------------------
128  // get
129  // ------------------------------------------------------------------------------------------------------------------
130 
131  TComMv const & getMv ( Int iIdx ) const { return m_pcMv [iIdx]; }
132  TComMv const & getMvd ( Int iIdx ) const { return m_pcMvd [iIdx]; }
133  Int getRefIdx( Int iIdx ) const { return m_piRefIdx[iIdx]; }
134 
136 
137  // ------------------------------------------------------------------------------------------------------------------
138  // set
139  // ------------------------------------------------------------------------------------------------------------------
140 
141  Void setAllMv ( TComMv const & rcMv, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
142  Void setAllMvd ( TComMv const & rcMvd, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
143  Void setAllRefIdx ( Int iRefIdx, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
144  Void setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
145 
147  {
148  m_uiNumPartition = iNumPart;
149  }
150 
151  Void linkToWithOffset( TComCUMvField const * src, Int offset )
152  {
153  m_pcMv = src->m_pcMv + offset;
154  m_pcMvd = src->m_pcMvd + offset;
155  m_piRefIdx = src->m_piRefIdx + offset;
156  }
157 
158 #if REDUCED_ENCODER_MEMORY
159  Void compress(SChar *pePredMode, const SChar* pePredModeSource, const Int scale, const TComCUMvField &source);
160 #else
161  Void compress(SChar* pePredMode, Int scale);
162 #endif
163 };
164 
166 
167 #endif // __TCOMMOTIONINFO__
static const Int NOT_VALID
Definition: CommonDef.h:127
Void setRefIdx(Int refIdx)
Int getRefIdx(Int iIdx) const
Void linkToWithOffset(TComCUMvField const *src, Int offset)
SChar * m_piRefIdx
Int getHor() const
Definition: TComMv.h:88
Defines version information, constants and small in-line functions.
void Void
Definition: TypeDef.h:203
Void setAllRefIdx(Int iRefIdx, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0)
#define NULL
Definition: CommonDef.h:107
TComMv const & getMv() const
class for motion vector with reference index
TComMv * m_pcMvd
unsigned int UInt
Definition: TypeDef.h:212
TComMv const & getMvd(Int iIdx) const
TComMv m_acMvCand[AMVP_MAX_NUM_CANDS]
array of motion vector predictor candidates
Void copyFrom(TComCUMvField const *pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst)
class for motion information in one CU
PartSize
supported partition shape
Definition: TypeDef.h:348
Void setMvField(TComMv const &cMv, Int iRefIdx)
Int iN
number of motion vector predictor candidates
signed char SChar
Definition: TypeDef.h:207
AMVPInfo m_cAMVPInfo
Void setAllMvField(TComMvField const &mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0)
Void setAll(T *p, T const &val, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx)
static const Int AMVP_MAX_NUM_CANDS
AMVP: advanced motion vector prediction - max number of final candidates.
Definition: CommonDef.h:129
Void setNumPartition(Int iNumPart)
parameters for AMVP
TComMv const & getMv(Int iIdx) const
motion vector class (header)
struct _AMVPInfo AMVPInfo
parameters for AMVP
Void copyTo(TComCUMvField *pcCUMvFieldDst, Int iPartAddrDst) const
Int getVer() const
Definition: TComMv.h:89
Int getHor() const
Void compress(SChar *pePredMode, const SChar *pePredModeSource, const Int scale, const TComCUMvField &source)
Int getVer() const
TComMv * m_pcMv
AMVPInfo * getAMVPInfo()
Void setAllMvd(TComMv const &rcMvd, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0)
TComMv & getMv()
int Int
Definition: TypeDef.h:211
basic motion vector class
Definition: TComMv.h:51
UInt numSpatialMVPCandidates
Void create(UInt uiNumPartition)
Void setAllMv(TComMv const &rcMv, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0)
Int getRefIdx() const