source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComMotionInfo.h @ 476

Last change on this file since 476 was 476, checked in by mediatek-htm, 11 years ago

Integration of 3D-HEVC merge related coding tools:
Inter-view motion merge candidate
HHI_INTER_VIEW_MOTION_PRED
SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069
OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069
MTK_INTERVIEW_MERGE_A0049 , second part
QC_AMVP_MRG_UNIFY_IVCAN_C0051
TEXTURE MERGING CANDIDATE , JCT3V-C0137

Notes: Two configurations are added:
PredDepthMapGen : 1
MultiviewMvPred : 7

From: yiwen.chen@… (MediaTek)

  • Property svn:eol-style set to native
File size: 7.1 KB
Line 
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-2013, 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
34/** \file     TComMotionInfo.h
35    \brief    motion information handling classes (header)
36    \todo     TComMvField seems to be better to be inherited from TComMv
37*/
38
39#ifndef __TCOMMOTIONINFO__
40#define __TCOMMOTIONINFO__
41
42#include <memory.h>
43#include "CommonDef.h"
44#include "TComMv.h"
45
46//! \ingroup TLibCommon
47//! \{
48
49// ====================================================================================================================
50// Type definition
51// ====================================================================================================================
52
53/// parameters for AMVP
54typedef struct _AMVPInfo
55{
56  TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS_MEM ];  ///< array of motion vector predictor candidates
57  Int    iN;                                ///< number of motion vector predictor candidates
58} AMVPInfo;
59
60#if H_3D_NBDV
61typedef struct _DisCand
62{
63  Bool bDV;
64  TComMv m_acNBDV;              // DV from NBDV
65#if H_3D_NBDV_REF
66  TComMv m_acDoNBDV;            // DV from DoNBDV
67#endif 
68  Int    m_aVIdxCan;            // View order index (the same with the NBDV and the DoNBDV)
69} DisInfo;
70
71typedef struct _IDVCand // IDV
72{
73  TComMv m_acMvCand[2][ IDV_CANDS ];           
74  Int    m_aVIdxCan[2][ IDV_CANDS ];           
75  Bool   m_bAvailab[2][ IDV_CANDS ];
76  Bool   m_bFound;                               
77} IDVInfo;
78#endif
79// ====================================================================================================================
80// Class definition
81// ====================================================================================================================
82
83/// class for motion vector with reference index
84class TComMvField
85{
86private:
87  TComMv    m_acMv;
88  Int       m_iRefIdx;
89 
90public:
91  TComMvField() : m_iRefIdx( NOT_VALID ) {}
92 
93  Void setMvField( TComMv const & cMv, Int iRefIdx )
94  {
95    m_acMv    = cMv;
96    m_iRefIdx = iRefIdx;
97  }
98 
99  Void setRefIdx( Int refIdx ) { m_iRefIdx = refIdx; }
100 
101  TComMv const & getMv() const { return  m_acMv; }
102  TComMv       & getMv()       { return  m_acMv; }
103 
104  Int getRefIdx() const { return  m_iRefIdx;       }
105  Int getHor   () const { return  m_acMv.getHor(); }
106  Int getVer   () const { return  m_acMv.getVer(); }
107
108#if H_3D_IV_MERGE
109  Bool operator== ( const TComMvField& rcMv ) const
110  {
111    return (m_acMv.getHor()==rcMv.getHor() && m_acMv.getVer()==rcMv.getVer() && m_iRefIdx == rcMv.getRefIdx());
112  }
113#endif
114};
115
116/// class for motion information in one CU
117class TComCUMvField
118{
119private:
120  TComMv*   m_pcMv;
121  TComMv*   m_pcMvd;
122  Char*     m_piRefIdx;
123  UInt      m_uiNumPartition;
124  AMVPInfo  m_cAMVPInfo;
125   
126  template <typename T>
127  Void setAll( T *p, T const & val, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx );
128
129public:
130  TComCUMvField() : m_pcMv(NULL), m_pcMvd(NULL), m_piRefIdx(NULL), m_uiNumPartition(0) {}
131  ~TComCUMvField() {}
132
133  // ------------------------------------------------------------------------------------------------------------------
134  // create / destroy
135  // ------------------------------------------------------------------------------------------------------------------
136 
137  Void    create( UInt uiNumPartition );
138  Void    destroy();
139 
140  // ------------------------------------------------------------------------------------------------------------------
141  // clear / copy
142  // ------------------------------------------------------------------------------------------------------------------
143
144  Void    clearMvField();
145 
146  Void    copyFrom( TComCUMvField const * pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst );
147  Void    copyTo  ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst ) const;
148  Void    copyTo  ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst, UInt uiOffset, UInt uiNumPart ) const;
149 
150  // ------------------------------------------------------------------------------------------------------------------
151  // get
152  // ------------------------------------------------------------------------------------------------------------------
153 
154  TComMv const & getMv    ( Int iIdx ) const { return  m_pcMv    [iIdx]; }
155  TComMv const & getMvd   ( Int iIdx ) const { return  m_pcMvd   [iIdx]; }
156  Int            getRefIdx( Int iIdx ) const { return  m_piRefIdx[iIdx]; }
157 
158  AMVPInfo* getAMVPInfo () { return &m_cAMVPInfo; }
159 
160  // ------------------------------------------------------------------------------------------------------------------
161  // set
162  // ------------------------------------------------------------------------------------------------------------------
163 
164  Void    setAllMv     ( TComMv const & rcMv,         PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
165  Void    setAllMvd    ( TComMv const & rcMvd,        PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
166  Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
167  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
168
169  Void setNumPartition( Int iNumPart )
170  {
171    m_uiNumPartition = iNumPart;
172  }
173 
174  Void linkToWithOffset( TComCUMvField const * src, Int offset )
175  {
176    m_pcMv     = src->m_pcMv     + offset;
177    m_pcMvd    = src->m_pcMvd    + offset;
178    m_piRefIdx = src->m_piRefIdx + offset;
179  }
180 
181  Void compress(Char* pePredMode, Int scale); 
182};
183
184//! \}
185
186#endif // __TCOMMOTIONINFO__
Note: See TracBrowser for help on using the repository browser.