source: 3DVCSoftware/branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComMotionInfo.h @ 1306

Last change on this file since 1306 was 1072, checked in by tech, 10 years ago

Removed 3D-HEVC related integrations.

  • Property svn:eol-style set to native
File size: 6.4 KB
RevLine 
[5]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
[56]4 * granted under this license. 
[5]5 *
[872]6* Copyright (c) 2010-2014, ITU/ISO/IEC
[5]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.
[56]17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
[5]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 */
[2]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"
[56]45//! \ingroup TLibCommon
46//! \{
47
[2]48// ====================================================================================================================
49// Type definition
50// ====================================================================================================================
51
52/// parameters for AMVP
53typedef struct _AMVPInfo
54{
[56]55  TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS_MEM ];  ///< array of motion vector predictor candidates
[2]56  Int    iN;                                ///< number of motion vector predictor candidates
57} AMVPInfo;
58
[608]59// ====================================================================================================================
[2]60// Class definition
61// ====================================================================================================================
62
63/// class for motion vector with reference index
64class TComMvField
65{
66private:
67  TComMv    m_acMv;
68  Int       m_iRefIdx;
69 
70public:
[56]71  TComMvField() : m_iRefIdx( NOT_VALID ) {}
[2]72 
[56]73  Void setMvField( TComMv const & cMv, Int iRefIdx )
[2]74  {
75    m_acMv    = cMv;
76    m_iRefIdx = iRefIdx;
77  }
78 
[56]79  Void setRefIdx( Int refIdx ) { m_iRefIdx = refIdx; }
[2]80 
[56]81  TComMv const & getMv() const { return  m_acMv; }
82  TComMv       & getMv()       { return  m_acMv; }
83 
84  Int getRefIdx() const { return  m_iRefIdx;       }
85  Int getHor   () const { return  m_acMv.getHor(); }
86  Int getVer   () const { return  m_acMv.getVer(); }
[2]87};
88
89/// class for motion information in one CU
90class TComCUMvField
91{
92private:
93  TComMv*   m_pcMv;
94  TComMv*   m_pcMvd;
[56]95  Char*     m_piRefIdx;
[2]96  UInt      m_uiNumPartition;
97  AMVPInfo  m_cAMVPInfo;
[56]98   
99  template <typename T>
100  Void setAll( T *p, T const & val, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx );
101
[2]102public:
[56]103  TComCUMvField() : m_pcMv(NULL), m_pcMvd(NULL), m_piRefIdx(NULL), m_uiNumPartition(0) {}
104  ~TComCUMvField() {}
105
[2]106  // ------------------------------------------------------------------------------------------------------------------
107  // create / destroy
108  // ------------------------------------------------------------------------------------------------------------------
109 
[56]110  Void    create( UInt uiNumPartition );
111  Void    destroy();
[2]112 
113  // ------------------------------------------------------------------------------------------------------------------
114  // clear / copy
115  // ------------------------------------------------------------------------------------------------------------------
[56]116
117  Void    clearMvField();
[2]118 
[56]119  Void    copyFrom( TComCUMvField const * pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst );
120  Void    copyTo  ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst ) const;
121  Void    copyTo  ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst, UInt uiOffset, UInt uiNumPart ) const;
[2]122 
123  // ------------------------------------------------------------------------------------------------------------------
124  // get
125  // ------------------------------------------------------------------------------------------------------------------
126 
[56]127  TComMv const & getMv    ( Int iIdx ) const { return  m_pcMv    [iIdx]; }
128  TComMv const & getMvd   ( Int iIdx ) const { return  m_pcMvd   [iIdx]; }
129  Int            getRefIdx( Int iIdx ) const { return  m_piRefIdx[iIdx]; }
[2]130 
131  AMVPInfo* getAMVPInfo () { return &m_cAMVPInfo; }
[56]132 
[2]133  // ------------------------------------------------------------------------------------------------------------------
134  // set
135  // ------------------------------------------------------------------------------------------------------------------
136 
[56]137  Void    setAllMv     ( TComMv const & rcMv,         PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
138  Void    setAllMvd    ( TComMv const & rcMvd,        PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
139  Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
140  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
141
142  Void setNumPartition( Int iNumPart )
143  {
144    m_uiNumPartition = iNumPart;
145  }
[2]146 
[56]147  Void linkToWithOffset( TComCUMvField const * src, Int offset )
148  {
149    m_pcMv     = src->m_pcMv     + offset;
150    m_pcMvd    = src->m_pcMvd    + offset;
151    m_piRefIdx = src->m_piRefIdx + offset;
152  }
[2]153 
[56]154  Void compress(Char* pePredMode, Int scale); 
[2]155};
156
[56]157//! \}
158
[950]159
160
[2]161#endif // __TCOMMOTIONINFO__
Note: See TracBrowser for help on using the repository browser.