source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComDataCU.h @ 976

Last change on this file since 976 was 976, checked in by tech, 10 years ago
  • Merged 11.1-dev0@975. (Clean ups)
  • Added coding results.
  • Changed version number.
  • Property svn:eol-style set to native
File size: 46.2 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-2014, 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     TComDataCU.h
35    \brief    CU data structure (header)
36    \todo     not all entities are documented
37*/
38
39#ifndef _TCOMDATACU_
40#define _TCOMDATACU_
41
42#include <assert.h>
43
44// Include files
45#include "CommonDef.h"
46#include "TComMotionInfo.h"
47#include "TComSlice.h"
48#include "TComRdCost.h"
49#include "TComPattern.h"
50
51#if H_3D_ARP
52#include "TComYuv.h"
53#endif
54
55#include <algorithm>
56#include <vector>
57
58//! \ingroup TLibCommon
59//! \{
60
61
62#if H_3D_DBBP
63typedef struct _DBBPTmpData
64{
65  TComMv      acMvd[2][2];          // for two segments and two lists
66  TComMvField acMvField[2][2];      // for two segments and two lists
67  Int         aiMvpNum[2][2];       // for two segments and two lists
68  Int         aiMvpIdx[2][2];       // for two segments and two lists
69  UChar       auhInterDir[2];       // for two segments
70  Bool        abMergeFlag[2];       // for two segments
71  UChar       auhMergeIndex[2];     // for two segments
72  PartSize    eVirtualPartSize;
73  UInt        uiVirtualPartIndex;
74} DBBPTmpData;
75#endif
76
77// ====================================================================================================================
78// Class definition
79// ====================================================================================================================
80
81/// CU data structure class
82class TComDataCU
83{
84private:
85 
86  // -------------------------------------------------------------------------------------------------------------------
87  // class pointers
88  // -------------------------------------------------------------------------------------------------------------------
89 
90  TComPic*      m_pcPic;              ///< picture class pointer
91  TComSlice*    m_pcSlice;            ///< slice header pointer
92  TComPattern*  m_pcPattern;          ///< neighbour access class pointer
93 
94  // -------------------------------------------------------------------------------------------------------------------
95  // CU description
96  // -------------------------------------------------------------------------------------------------------------------
97 
98  UInt          m_uiCUAddr;           ///< CU address in a slice
99  UInt          m_uiAbsIdxInLCU;      ///< absolute address in a CU. It's Z scan order
100  UInt          m_uiCUPelX;           ///< CU position in a pixel (X)
101  UInt          m_uiCUPelY;           ///< CU position in a pixel (Y)
102  UInt          m_uiNumPartition;     ///< total number of minimum partitions in a CU
103  UChar*        m_puhWidth;           ///< array of widths
104  UChar*        m_puhHeight;          ///< array of heights
105  UChar*        m_puhDepth;           ///< array of depths
106  Int           m_unitSize;           ///< size of a "minimum partition"
107 
108  // -------------------------------------------------------------------------------------------------------------------
109  // CU data
110  // -------------------------------------------------------------------------------------------------------------------
111  Bool*         m_skipFlag;           ///< array of skip flags
112  Char*         m_pePartSize;         ///< array of partition sizes
113  Char*         m_pePredMode;         ///< array of prediction modes
114  Bool*         m_CUTransquantBypass;   ///< array of cu_transquant_bypass flags
115  Char*         m_phQP;               ///< array of QP values
116  UChar*        m_puhTrIdx;           ///< array of transform indices
117  UChar*        m_puhTransformSkip[3];///< array of transform skipping flags
118  UChar*        m_puhCbf[3];          ///< array of coded block flags (CBF)
119  TComCUMvField m_acCUMvField[2];     ///< array of motion vectors
120  TCoeff*       m_pcTrCoeffY;         ///< transformed coefficient buffer (Y)
121  TCoeff*       m_pcTrCoeffCb;        ///< transformed coefficient buffer (Cb)
122  TCoeff*       m_pcTrCoeffCr;        ///< transformed coefficient buffer (Cr)
123#if ADAPTIVE_QP_SELECTION
124  Int*          m_pcArlCoeffY;        ///< ARL coefficient buffer (Y)
125  Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
126  Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
127  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
128
129  static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
130  static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
131  static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
132#endif
133 
134  Pel*          m_pcIPCMSampleY;      ///< PCM sample buffer (Y)
135  Pel*          m_pcIPCMSampleCb;     ///< PCM sample buffer (Cb)
136  Pel*          m_pcIPCMSampleCr;     ///< PCM sample buffer (Cr)
137
138  // -------------------------------------------------------------------------------------------------------------------
139  // neighbour access variables
140  // -------------------------------------------------------------------------------------------------------------------
141 
142  TComDataCU*   m_pcCUAboveLeft;      ///< pointer of above-left CU
143  TComDataCU*   m_pcCUAboveRight;     ///< pointer of above-right CU
144  TComDataCU*   m_pcCUAbove;          ///< pointer of above CU
145  TComDataCU*   m_pcCULeft;           ///< pointer of left CU
146  TComDataCU*   m_apcCUColocated[2];  ///< pointer of temporally colocated CU's for both directions
147  TComMvField   m_cMvFieldA;          ///< motion vector of position A
148  TComMvField   m_cMvFieldB;          ///< motion vector of position B
149  TComMvField   m_cMvFieldC;          ///< motion vector of position C
150  TComMv        m_cMvPred;            ///< motion vector predictor
151 
152  // -------------------------------------------------------------------------------------------------------------------
153  // coding tool information
154  // -------------------------------------------------------------------------------------------------------------------
155 
156  Bool*         m_pbMergeFlag;        ///< array of merge flags
157  UChar*        m_puhMergeIndex;      ///< array of merge candidate indices
158#if AMP_MRG
159  Bool          m_bIsMergeAMP;
160#endif
161  UChar*        m_puhLumaIntraDir;    ///< array of intra directions (luma)
162  UChar*        m_puhChromaIntraDir;  ///< array of intra directions (chroma)
163  UChar*        m_puhInterDir;        ///< array of inter directions
164  Char*         m_apiMVPIdx[2];       ///< array of motion vector predictor candidates
165  Char*         m_apiMVPNum[2];       ///< array of number of possible motion vectors predictors
166  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
167#if H_3D_NBDV
168  DisInfo*      m_pDvInfo;
169#endif
170#if H_3D_VSP
171  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
172                                      ///< 0: non-VSP; 1: VSP
173#endif
174#if H_3D_SPIVMP
175  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
176                                      ///< 0: non-SPIVMP; 1: SPIVMP
177#endif
178#if H_3D_ARP
179  UChar*        m_puhARPW;
180#endif
181#if H_3D_IC
182  Bool*         m_pbICFlag;           ///< array of IC flags
183#endif
184#if H_3D_DIM
185  Pel*          m_dimDeltaDC[DIM_NUM_TYPE][2];
186#if H_3D_DIM_DMM
187  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 
188#endif
189#if H_3D_DIM_SDC
190  Bool*         m_pbSDCFlag;
191  Pel*          m_apSegmentDCOffset[2];
192  Pel          m_apDmmPredictor[2];
193#endif
194#endif
195#if H_3D_DBBP
196  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
197  DBBPTmpData   m_sDBBPTmpData;
198#endif
199#if H_3D
200  Bool          m_bAvailableFlagA1;    ///< A1 available flag
201  Bool          m_bAvailableFlagB1;    ///< B1 available flag
202  Bool          m_bAvailableFlagB0;    ///< B0 available flag
203  Bool          m_bAvailableFlagA0;    ///< A0 available flag
204  Bool          m_bAvailableFlagB2;    ///< B2 available flag
205#endif
206  // -------------------------------------------------------------------------------------------------------------------
207  // misc. variables
208  // -------------------------------------------------------------------------------------------------------------------
209 
210  Bool          m_bDecSubCu;          ///< indicates decoder-mode
211  Double        m_dTotalCost;         ///< sum of partition RD costs
212#if H_3D_VSO
213  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
214#else
215  UInt          m_uiTotalDistortion;  ///< sum of partition distortion
216#endif
217  UInt          m_uiTotalBits;        ///< sum of partition bits
218  UInt          m_uiTotalBins;       ///< sum of partition bins
219  UInt*         m_sliceStartCU;    ///< Start CU address of current slice
220  UInt*         m_sliceSegmentStartCU; ///< Start CU address of current slice
221  Char          m_codedQP;
222#if H_3D
223  DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
224#endif
225
226#if H_3D_DDD
227  UChar*        m_pucDisparityDerivedDepth;
228  Bool*         m_pbUseDDD;
229  Int           m_iUseDDDCandIdx;
230  UChar         m_ucDDTmpDepth;
231#endif
232
233#if H_3D_IV_MERGE
234  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
235  Int           m_baseListidc;
236#endif
237
238protected:
239 
240  /// add possible motion vector predictor candidates
241  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
242  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
243#if H_3D_VSP
244  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
245#endif
246#if H_3D_IV_MERGE
247  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); 
248  Bool          xGetPosFirstAvailDmvCand( Int iCount, Int& iFirDispCand );
249#endif
250
251  Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
252  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
253#if H_3D_TMVP
254  ,
255  Bool bMRG = true
256#endif
257  );
258 
259  /// compute required bits to encode MVD (used in AMVP)
260  UInt          xGetMvdBits           ( TComMv cMvd );
261  UInt          xGetComponentBits     ( Int iVal );
262 
263  /// compute scaling factor from POC difference
264#if !H_3D_ARP
265  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
266#endif
267
268  Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
269
270#if H_3D_VSP
271  Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
272#endif
273
274public:
275  TComDataCU();
276  virtual ~TComDataCU();
277 
278  // -------------------------------------------------------------------------------------------------------------------
279  // create / destroy / initialize / copy
280  // -------------------------------------------------------------------------------------------------------------------
281#if H_3D_ARP
282  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
283#endif
284  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
285#if ADAPTIVE_QP_SELECTION
286    , Bool bGlobalRMARLBuffer = false
287#endif 
288    );
289  Void          destroy               ();
290 
291  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
292  Void          initEstData           ( UInt uiDepth, Int qp, Bool bTransquantBypass );
293  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
294  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
295#if H_3D_NBDV
296  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
297#endif
298  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
299  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
300#if H_3D_NBDV
301  , Bool bNBDV = false
302#endif
303  );
304  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
305 
306  Void          copyToPic             ( UChar uiDepth );
307  Void          copyToPic             ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth );
308 
309  // -------------------------------------------------------------------------------------------------------------------
310  // member functions for CU description
311  // -------------------------------------------------------------------------------------------------------------------
312 
313  TComPic*      getPic                ()                        { return m_pcPic;           }
314  TComSlice*    getSlice              ()                        { return m_pcSlice;         }
315  UInt&         getAddr               ()                        { return m_uiCUAddr;        }
316  UInt&         getZorderIdxInCU      ()                        { return m_uiAbsIdxInLCU; }
317  UInt          getSCUAddr            ();
318  UInt          getCUPelX             ()                        { return m_uiCUPelX;        }
319  UInt          getCUPelY             ()                        { return m_uiCUPelY;        }
320  TComPattern*  getPattern            ()                        { return m_pcPattern;       }
321 
322  UChar*        getDepth              ()                        { return m_puhDepth;        }
323  UChar         getDepth              ( UInt uiIdx )            { return m_puhDepth[uiIdx]; }
324  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
325 
326  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
327#if H_3D
328  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
329#endif
330 
331  // -------------------------------------------------------------------------------------------------------------------
332  // member functions for CU data
333  // -------------------------------------------------------------------------------------------------------------------
334 
335  Char*         getPartitionSize      ()                        { return m_pePartSize;        }
336  PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
337  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
338  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
339  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
340 
341#if H_3D_DBBP
342  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
343#endif
344 
345  Bool*        getSkipFlag            ()                        { return m_skipFlag;          }
346  Bool         getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
347  Void         setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
348  Void         setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
349
350  Char*         getPredictionMode     ()                        { return m_pePredMode;        }
351  PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
352  Bool*         getCUTransquantBypass ()                        { return m_CUTransquantBypass;        }
353  Bool          getCUTransquantBypass( UInt uiIdx )             { return m_CUTransquantBypass[uiIdx]; }
354  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
355  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
356 
357#if H_3D_DBBP
358  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
359  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
360  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
361  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
362  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
363#endif
364 
365  UChar*        getWidth              ()                        { return m_puhWidth;          }
366  UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
367  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
368 
369  UChar*        getHeight             ()                        { return m_puhHeight;         }
370  UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
371  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
372 
373  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
374 
375  Char*         getQP                 ()                        { return m_phQP;              }
376  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
377  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
378  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
379  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
380  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
381  Void          setQPSubCUs           ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );
382  Void          setCodedQP            ( Char qp )               { m_codedQP = qp;             }
383  Char          getCodedQP            ()                        { return m_codedQP;           }
384
385  Bool          isLosslessCoded(UInt absPartIdx);
386 
387  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
388  UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
389  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
390
391  UChar*        getTransformSkip      ( TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];}
392  UChar         getTransformSkip      ( UInt uiIdx,TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];}
393  Void          setTransformSkipSubParts  ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); 
394  Void          setTransformSkipSubParts  ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth );
395
396  UInt          getQuadtreeTULog2MinSizeInCU( UInt absPartIdx );
397 
398  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
399 
400  TCoeff*&      getCoeffY             ()                        { return m_pcTrCoeffY;        }
401  TCoeff*&      getCoeffCb            ()                        { return m_pcTrCoeffCb;       }
402  TCoeff*&      getCoeffCr            ()                        { return m_pcTrCoeffCr;       }
403#if ADAPTIVE_QP_SELECTION
404  Int*&         getArlCoeffY          ()                        { return m_pcArlCoeffY;       }
405  Int*&         getArlCoeffCb         ()                        { return m_pcArlCoeffCb;      }
406  Int*&         getArlCoeffCr         ()                        { return m_pcArlCoeffCr;      }
407#endif
408 
409  Pel*&         getPCMSampleY         ()                        { return m_pcIPCMSampleY;     }
410  Pel*&         getPCMSampleCb        ()                        { return m_pcIPCMSampleCb;    }
411  Pel*&         getPCMSampleCr        ()                        { return m_pcIPCMSampleCr;    }
412
413  UChar         getCbf    ( UInt uiIdx, TextType eType )                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];  }
414  UChar*        getCbf    ( TextType eType )                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];         }
415  UChar         getCbf    ( UInt uiIdx, TextType eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
416  Void          setCbf    ( UInt uiIdx, TextType eType, UChar uh )        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;    }
417  Void          clearCbf  ( UInt uiIdx, TextType eType, UInt uiNumParts );
418  UChar         getQtRootCbf          ( UInt uiIdx )                      { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); }
419 
420  Void          setCbfSubParts        ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth          );
421  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth                    );
422  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
423 
424  // -------------------------------------------------------------------------------------------------------------------
425  // member functions for coding tool information
426  // -------------------------------------------------------------------------------------------------------------------
427 
428  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
429  Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
430  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
431  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
432
433  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
434  UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
435  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
436  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
437  template <typename T>
438  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
439#if H_3D_VSP
440  template<typename T>
441  Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
442#endif
443#if AMP_MRG
444  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
445  Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
446#endif
447
448  UChar*        getLumaIntraDir       ()                        { return m_puhLumaIntraDir;           }
449  UChar         getLumaIntraDir       ( UInt uiIdx )            { return m_puhLumaIntraDir[uiIdx];    }
450  Void          setLumaIntraDir       ( UInt uiIdx, UChar  uh ) { m_puhLumaIntraDir[uiIdx] = uh;      }
451  Void          setLumaIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
452 
453  UChar*        getChromaIntraDir     ()                        { return m_puhChromaIntraDir;         }
454  UChar         getChromaIntraDir     ( UInt uiIdx )            { return m_puhChromaIntraDir[uiIdx];  }
455  Void          setChromaIntraDir     ( UInt uiIdx, UChar  uh ) { m_puhChromaIntraDir[uiIdx] = uh;    }
456  Void          setChromIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
457 
458  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
459  UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
460  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
461  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
462  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
463  Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
464  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
465  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
466#if H_3D_NBDV
467  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
468  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
469  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
470  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
471#endif
472#if H_3D_NBDV
473  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
474  Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
475                                   UInt uiMvpDvPos
476#if H_3D_NBDV_REF
477  , Bool bDepthRefine = false
478#endif
479  );
480  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
481  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
482#if H_3D_NBDV_REF
483   , Bool bDepthRefine = false
484#endif
485   ); 
486   
487#if H_3D
488  Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
489  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
490#endif
491
492#if H_3D_NBDV_REF
493  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
494  Void          estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );
495#endif //H_3D_NBDV_REF
496#endif
497#if  H_3D_FAST_TEXTURE_ENCODING
498  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
499#endif
500#if H_3D_SPIVMP
501  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
502  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
503  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
504#endif
505#if H_3D_IV_MERGE
506  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth           
507
508#if H_3D_SPIVMP
509    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
510#endif   
511    , Bool bICFlag
512    );   
513#endif
514#if H_3D_ARP
515  UChar*        getARPW            ()                        { return m_puhARPW;               }
516  UChar         getARPW            ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
517  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
518  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
519  Double        getARPWFactor      ( UInt uiIdx );
520#endif
521#if H_3D_IC
522  Bool*         getICFlag          ()                        { return m_pbICFlag;               }
523  Bool          getICFlag          ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
524  Void          setICFlag          ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
525  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
526  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
527  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
528#else
529  // -------------------------------------------------------------------------------------------------------------------
530  // member functions for accessing partition information
531  // -------------------------------------------------------------------------------------------------------------------
532 
533  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
534#endif
535UChar         getNumPartitions       ();
536  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
537
538#if H_3D_DIM
539  Pel*  getDimDeltaDC                 ( UInt dimType, UInt segId )                      { return m_dimDeltaDC[dimType][segId];        } 
540  Pel   getDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx )          { return m_dimDeltaDC[dimType][segId][uiIdx]; } 
541  Void  setDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val;  }
542#if H_3D_DIM_DMM
543  UInt* getDmmWedgeTabIdx             ( UInt dmmType )                          { return m_dmmWedgeTabIdx[dmmType];          }       
544  UInt  getDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx )              { return m_dmmWedgeTabIdx[dmmType][uiIdx];   }
545  Void  setDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; }
546  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
547
548#endif
549#if H_3D_DIM_SDC
550  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
551  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
552  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );
553 
554  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
555 
556  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
557  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
558  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
559  Void          setDmmPredictor ( Pel pOffset, UInt uiSeg) { m_apDmmPredictor[uiSeg] = pOffset; }
560  Pel           getDmmPredictor ( UInt uiSeg) { return m_apDmmPredictor[uiSeg]; }
561  UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
562#endif
563#endif
564 
565  // -------------------------------------------------------------------------------------------------------------------
566  // member functions for motion vector
567  // -------------------------------------------------------------------------------------------------------------------
568 
569  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
570 
571  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
572  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
573  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
574  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
575  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
576  Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
577
578  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
579  Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
580  Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
581 
582  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
583  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
584 
585  Void          clipMv                ( TComMv&     rcMv     );
586  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
587  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
588  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
589#if H_3D
590  Void          compressMV            ( Int scale );
591#else           
592  Void          compressMV            ();
593#endif 
594  // -------------------------------------------------------------------------------------------------------------------
595  // utility functions for neighbouring information
596  // -------------------------------------------------------------------------------------------------------------------
597 
598  TComDataCU*   getCULeft                   () { return m_pcCULeft;       }
599  TComDataCU*   getCUAbove                  () { return m_pcCUAbove;      }
600  TComDataCU*   getCUAboveLeft              () { return m_pcCUAboveLeft;  }
601  TComDataCU*   getCUAboveRight             () { return m_pcCUAboveRight; }
602  TComDataCU*   getCUColocated              ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; }
603
604
605  TComDataCU*   getPULeft                   ( UInt&  uiLPartUnitIdx, 
606                                              UInt uiCurrPartUnitIdx, 
607                                              Bool bEnforceSliceRestriction=true, 
608                                              Bool bEnforceTileRestriction=true );
609  TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx,
610                                              UInt uiCurrPartUnitIdx, 
611                                              Bool bEnforceSliceRestriction=true, 
612                                              Bool planarAtLCUBoundary = false,
613                                              Bool bEnforceTileRestriction=true );
614  TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
615  TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
616  TComDataCU*   getPUBelowLeft              ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
617
618  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU );
619  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU );
620  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
621
622  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
623  TComDataCU*   getPUBelowLeftAdi           ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
624 
625  Void          deriveLeftRightTopIdx       ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
626  Void          deriveLeftBottomIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLB );
627 
628  Void          deriveLeftRightTopIdxAdi    ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth );
629  Void          deriveLeftBottomIdxAdi      ( UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth );
630 
631  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
632
633#if H_3D
634  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
635  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
636  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
637  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
638  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
639  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
640  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
641#if H_3D_VSP
642    , Int* vspFlag
643#endif
644#if H_3D_SPIVMP
645    , Bool* pbSPIVMPFlag
646#endif
647    , Int& numValidMergeCand
648    );
649  Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
650  Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
651#else
652  Void          getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
653#endif
654#if H_3D_VSP
655                                            , InheritedVSPDisInfo*  inheritedVSPDisInfo
656#endif
657#if H_3D_SPIVMP
658                                            , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
659#endif
660                                            , Int& numValidMergeCand, Int mrgCandIdx = -1
661                                            );
662
663#if H_3D_VSP
664  inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
665
666#if H_3D_SPIVMP
667  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
668  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
669  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
670  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
671#endif
672
673  Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
674  Char          getVSPFlag        ( UInt uiIdx )            { return m_piVSPFlag[uiIdx];   }
675  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
676  Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
677  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
678#endif
679  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
680  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
681 
682 
683  // -------------------------------------------------------------------------------------------------------------------
684  // member functions for modes
685  // -------------------------------------------------------------------------------------------------------------------
686 
687  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
688  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
689  Bool          isBipredRestriction( UInt puIdx );
690
691#if H_3D_IC
692  Bool          isIC      ( UInt uiPartIdx );
693#endif
694
695  // -------------------------------------------------------------------------------------------------------------------
696  // member functions for symbol prediction (most probable / mode conversion)
697  // -------------------------------------------------------------------------------------------------------------------
698 
699  UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
700 
701  Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
702  Int           getIntraDirLumaPredictor        ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL );
703 
704  // -------------------------------------------------------------------------------------------------------------------
705  // member functions for SBAC context
706  // -------------------------------------------------------------------------------------------------------------------
707 
708  UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
709  UInt          getCtxQtCbf                     ( TextType eType, UInt uiTrDepth );
710
711  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
712  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
713 
714#if H_3D_ARP
715  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
716#endif 
717  UInt          getSliceStartCU         ( UInt pos )                  { return m_sliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
718  UInt          getSliceSegmentStartCU  ( UInt pos )                  { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
719  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
720  // -------------------------------------------------------------------------------------------------------------------
721  // member functions for RD cost storage
722  // -------------------------------------------------------------------------------------------------------------------
723 
724  Double&       getTotalCost()                  { return m_dTotalCost;        }
725#if H_3D_VSO
726  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
727#else
728  UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
729#endif
730  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
731  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
732
733  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
734
735#if H_3D_DDD
736  UChar*       getDDDepth        ()                        { return m_pucDisparityDerivedDepth;        }
737  UChar        getDDDepth        ( UInt uiIdx )            { return m_pucDisparityDerivedDepth[uiIdx]; }
738  Void         setDDDepth        ( UInt uiIdx, UChar n )   { m_pucDisparityDerivedDepth[uiIdx] = n;    }
739  Void         setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
740
741  Bool*        getUseDDD        ()                        { return m_pbUseDDD;        }
742  Bool         getUseDDD        ( UInt uiIdx )            { return m_pbUseDDD[uiIdx]; }
743  Void         setUseDDD        ( UInt uiIdx, Bool n )     { m_pbUseDDD[uiIdx] = n;    }
744  Void         setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth );
745
746  Void         setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
747
748  UChar        getDDTmpDepth(){ return m_ucDDTmpDepth; }
749  Int          getUseDDDCandIdx(){ return m_iUseDDDCandIdx;}
750
751#endif
752};
753
754namespace RasterAddress
755{
756  /** Check whether 2 addresses point to the same column
757   * \param addrA          First address in raster scan order
758   * \param addrB          Second address in raters scan order
759   * \param numUnitsPerRow Number of units in a row
760   * \return Result of test
761   */
762  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
763  {
764    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
765    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
766  }
767 
768  /** Check whether 2 addresses point to the same row
769   * \param addrA          First address in raster scan order
770   * \param addrB          Second address in raters scan order
771   * \param numUnitsPerRow Number of units in a row
772   * \return Result of test
773   */
774  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
775  {
776    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
777    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
778  }
779 
780  /** Check whether 2 addresses point to the same row or column
781   * \param addrA          First address in raster scan order
782   * \param addrB          Second address in raters scan order
783   * \param numUnitsPerRow Number of units in a row
784   * \return Result of test
785   */
786  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
787  {
788    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
789  }
790 
791  /** Check whether one address points to the first column
792   * \param addr           Address in raster scan order
793   * \param numUnitsPerRow Number of units in a row
794   * \return Result of test
795   */
796  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
797  {
798    // addr % numUnitsPerRow == 0
799    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
800  }
801 
802  /** Check whether one address points to the first row
803   * \param addr           Address in raster scan order
804   * \param numUnitsPerRow Number of units in a row
805   * \return Result of test
806   */
807  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
808  {
809    // addr / numUnitsPerRow == 0
810    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
811  }
812 
813  /** Check whether one address points to a column whose index is smaller than a given value
814   * \param addr           Address in raster scan order
815   * \param val            Given column index value
816   * \param numUnitsPerRow Number of units in a row
817   * \return Result of test
818   */
819  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
820  {
821    // addr % numUnitsPerRow < val
822    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
823  }
824 
825  /** Check whether one address points to a row whose index is smaller than a given value
826   * \param addr           Address in raster scan order
827   * \param val            Given row index value
828   * \param numUnitsPerRow Number of units in a row
829   * \return Result of test
830   */
831  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
832  {
833    // addr / numUnitsPerRow < val
834    return addr < val * numUnitsPerRow;
835  }
836};
837
838//! \}
839
840#endif
Note: See TracBrowser for help on using the repository browser.