source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComMotionInfo.h @ 21

Last change on this file since 21 was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 7.0 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-2011, 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 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
35
36/** \file     TComMotionInfo.h
37    \brief    motion information handling classes (header)
38    \todo     TComMvField seems to be better to be inherited from TComMv
39*/
40
41#ifndef __TCOMMOTIONINFO__
42#define __TCOMMOTIONINFO__
43
44#include <memory.h>
45#include "CommonDef.h"
46#include "TComMv.h"
47
48// ====================================================================================================================
49// Type definition
50// ====================================================================================================================
51
52/// parameters for AMVP
53typedef struct _AMVPInfo
54{
55  TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS ];  ///< array of motion vector predictor candidates
56  Int    iN;                                ///< number of motion vector predictor candidates
57} AMVPInfo;
58
59// ====================================================================================================================
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:
71  TComMvField() :
72  m_iRefIdx (-1)
73  {
74  }
75 
76  Void setMvField ( TComMv cMv, Int iRefIdx )
77  {
78    m_acMv    = cMv;
79    m_iRefIdx = iRefIdx;
80  }
81 
82  TComMv& getMv     ()      { return  m_acMv;             }
83  Int     getRefIdx ()      { return  m_iRefIdx;          }
84 
85  Int     getHor    ()      { return  m_acMv.getHor();    }
86  Int     getVer    ()      { return  m_acMv.getVer();    }
87};
88
89/// class for motion information in one CU
90class TComCUMvField
91{
92private:
93  TComMv*   m_pcMv;
94  TComMv*   m_pcMvd;
95  Int*      m_piRefIdx;
96  UInt      m_uiNumPartition;
97  AMVPInfo  m_cAMVPInfo;
98public:
99  TComCUMvField()
100  {
101    m_pcMv     = NULL;
102    m_pcMvd    = NULL;
103    m_piRefIdx = NULL;
104  }
105  ~TComCUMvField()
106  {
107    m_pcMv     = NULL;
108    m_pcMvd    = NULL;
109    m_piRefIdx = NULL;
110  }
111 
112  // ------------------------------------------------------------------------------------------------------------------
113  // create / destroy
114  // ------------------------------------------------------------------------------------------------------------------
115 
116  Void    create        ( UInt uiNumPartition );
117  Void    destroy       ();
118 
119  // ------------------------------------------------------------------------------------------------------------------
120  // clear / copy
121  // ------------------------------------------------------------------------------------------------------------------
122 
123  Void    clearMv       ( Int iPartAddr, UInt uiDepth );
124  Void    clearMvd      ( Int iPartAddr, UInt uiDepth );
125  Void    clearMvField  ();
126 
127  Void    copyFrom          ( TComCUMvField* pcCUMvFieldSrc, Int iNumPartSrc, Int iPartAddrDst );
128  Void    copyTo            ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst );
129  Void    copyTo            ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst, UInt uiOffset, UInt uiNumPart );
130  Void    copyMvTo          ( TComCUMvField* pcCUMvFieldDst, Int iPartAddrDst );
131 
132  // ------------------------------------------------------------------------------------------------------------------
133  // get
134  // ------------------------------------------------------------------------------------------------------------------
135 
136  TComMv& getMv             ( Int iIdx )               { return  m_pcMv    [iIdx]; }
137  TComMv* getMv             ()                         { return  m_pcMv;           }
138  TComMv& getMvd            ( Int iIdx )               { return  m_pcMvd   [iIdx]; }
139  TComMv* getMvd            ()                         { return  m_pcMvd;          }
140  Int     getRefIdx         ( Int iIdx )               { return  m_piRefIdx[iIdx]; }
141  Int*    getRefIdx         ()                         { return  m_piRefIdx;       }
142 
143  AMVPInfo* getAMVPInfo () { return &m_cAMVPInfo; }
144  // ------------------------------------------------------------------------------------------------------------------
145  // set
146  // ------------------------------------------------------------------------------------------------------------------
147 
148  Void    setMv             ( TComMv  cMv,     Int iIdx ) { m_pcMv    [iIdx] = cMv;     }
149  Void    setMvd            ( TComMv  cMvd,    Int iIdx ) { m_pcMvd   [iIdx] = cMvd;    }
150  Void    setRefIdx         ( Int     iRefIdx, Int iIdx ) { m_piRefIdx[iIdx] = iRefIdx; }
151 
152  Void    setMvPtr          ( TComMv*  cMvPtr     ) { m_pcMv    = cMvPtr;         }
153  Void    setMvdPtr         ( TComMv*  cMvdPtr    ) { m_pcMvd  = cMvdPtr;         }
154  Void    setRefIdxPtr      ( Int*     iRefIdxPtr ) { m_piRefIdx = iRefIdxPtr;    }
155  Void    setNumPartition   ( Int      iNumPart   ) { m_uiNumPartition=iNumPart;  }
156 
157  Void    setAllMv          ( TComMv& rcMv,    PartSize eCUMode, Int iPartAddr, Int iPartIdx, UInt uiDepth );
158  Void    setAllMvd         ( TComMv& rcMvd,   PartSize eCUMode, Int iPartAddr, Int iPartIdx, UInt uiDepth );
159  Void    setAllRefIdx      ( Int     iRefIdx, PartSize eMbMode, Int iPartAddr, Int iPartIdx, UInt uiDepth );
160  Void    setAllMvField     ( TComMv& rcMv, Int iRefIdx, PartSize eMbMode, Int iPartAddr, Int iPartIdx, UInt uiDepth );
161 
162#if AMVP_BUFFERCOMPRESS
163  Void    compress          (PredMode* pePredMode,UChar* puhInterDir);
164#endif
165 
166};
167
168#endif // __TCOMMOTIONINFO__
169
Note: See TracBrowser for help on using the repository browser.