source: 3DVCSoftware/branches/HTM-9.3-dev1-MediaTek/source/Lib/TLibCommon/TComDataCU.h @ 795

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

Integration of DDD (JCT3V-G0063)

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