source: 3DVCSoftware/branches/HTM-9.3-dev3-Samsung/source/Lib/TLibCommon/TComDataCU.h @ 792

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

Integration of JCT3V-G0101: InterSDC with multiple DC candidates

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