source: 3DVCSoftware/branches/HTM-16.2-dev/source/Lib/TLibCommon/TComDataCU.h @ 1412

Last change on this file since 1412 was 1412, checked in by tech, 7 years ago
  • Update HM-16.18
  • Cleanups
  • Encoder Extension

-- Representation formats
-- Parameter set sharing
-- GOP configuration

  • Property svn:eol-style set to native
File size: 48.9 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-2017, 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 <algorithm>
43#include <vector>
44
45// Include files
46#include "CommonDef.h"
47#include "TComMotionInfo.h"
48#include "TComSlice.h"
49#include "TComRdCost.h"
50#include "TComPattern.h"
51#if NH_3D
52#include "TComYuv.h"
53#endif
54
55//! \ingroup TLibCommon
56//! \{
57
58class TComTU; // forward declaration
59
60static const UInt NUM_MOST_PROBABLE_MODES=3;
61
62#if NH_3D
63typedef struct _DBBPTmpData
64{
65  TComMv      acMvd[2][2];          // for two segments and two lists
66  TComMvField acMvField[2][2];      // for two segments and two lists
67  Int         aiMvpNum[2][2];       // for two segments and two lists
68  Int         aiMvpIdx[2][2];       // for two segments and two lists
69  UChar       auhInterDir[2];       // for two segments
70  Bool        abMergeFlag[2];       // for two segments
71  UChar       auhMergeIndex[2];     // for two segments
72  PartSize    eVirtualPartSize;
73  UInt        uiVirtualPartIndex;
74} DbbpTmpData;
75#endif
76
77
78// ====================================================================================================================
79// Class definition
80// ====================================================================================================================
81
82/// CU data structure class
83class TComDataCU
84{
85private:
86
87  // -------------------------------------------------------------------------------------------------------------------
88  // class pointers
89  // -------------------------------------------------------------------------------------------------------------------
90
91  TComPic*      m_pcPic;              ///< picture class pointer
92  TComSlice*    m_pcSlice;            ///< slice header pointer
93
94  // -------------------------------------------------------------------------------------------------------------------
95  // CU description
96  // -------------------------------------------------------------------------------------------------------------------
97
98  UInt          m_ctuRsAddr;          ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order).
99  UInt          m_absZIdxInCtu;       ///< absolute address in a CTU. It's Z scan order
100  UInt          m_uiCUPelX;           ///< CU position in a pixel (X)
101  UInt          m_uiCUPelY;           ///< CU position in a pixel (Y)
102  UInt          m_uiNumPartition;     ///< total number of minimum partitions in a CU
103  UChar*        m_puhWidth;           ///< array of widths
104  UChar*        m_puhHeight;          ///< array of heights
105  UChar*        m_puhDepth;           ///< array of depths
106  Int           m_unitSize;           ///< size of a "minimum partition"
107
108  // -------------------------------------------------------------------------------------------------------------------
109  // CU data
110  // -------------------------------------------------------------------------------------------------------------------
111
112  Bool*          m_skipFlag;           ///< array of skip flags
113#if NH_3D
114  Bool*          m_bDISFlag;         
115  UChar*         m_ucDISType;
116#endif
117  SChar*          m_pePartSize;         ///< array of partition sizes
118  SChar*        m_pePredMode;                           ///< array of prediction modes
119  SChar*        m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values
120  Bool*          m_CUTransquantBypass;   ///< array of cu_transquant_bypass flags
121  SChar*        m_phQP;                                 ///< array of QP values
122  UChar*         m_ChromaQpAdj;        ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1
123  UInt           m_codedChromaQpAdj;
124  UChar*         m_puhTrIdx;           ///< array of transform indices
125  UChar*         m_puhTransformSkip[MAX_NUM_COMPONENT];///< array of transform skipping flags
126  UChar*         m_puhCbf[MAX_NUM_COMPONENT];          ///< array of coded block flags (CBF)
127  TComCUMvField  m_acCUMvField[NUM_REF_PIC_LIST_01];    ///< array of motion vectors.
128  TCoeff*        m_pcTrCoeff[MAX_NUM_COMPONENT];       ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr)
129#if ADAPTIVE_QP_SELECTION
130  TCoeff*       m_pcArlCoeff[MAX_NUM_COMPONENT];        ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)
131  Bool           m_ArlCoeffIsAliasedAllocation;  ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
132#endif
133
134  Pel*           m_pcIPCMSample[MAX_NUM_COMPONENT];    ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr)
135
136  // -------------------------------------------------------------------------------------------------------------------
137  // neighbour access variables
138  // -------------------------------------------------------------------------------------------------------------------
139
140  TComDataCU*   m_pCtuAboveLeft;      ///< pointer of above-left CTU.
141  TComDataCU*   m_pCtuAboveRight;     ///< pointer of above-right CTU.
142  TComDataCU*   m_pCtuAbove;          ///< pointer of above CTU.
143  TComDataCU*   m_pCtuLeft;           ///< pointer of left CTU
144  TComMvField   m_cMvFieldA;          ///< motion vector of position A
145  TComMvField   m_cMvFieldB;          ///< motion vector of position B
146  TComMvField   m_cMvFieldC;          ///< motion vector of position C
147  TComMv        m_cMvPred;            ///< motion vector predictor
148
149  // -------------------------------------------------------------------------------------------------------------------
150  // coding tool information
151  // -------------------------------------------------------------------------------------------------------------------
152
153  Bool*         m_pbMergeFlag;        ///< array of merge flags
154  UChar*        m_puhMergeIndex;      ///< array of merge candidate indices
155#if AMP_MRG
156  Bool          m_bIsMergeAMP;
157#endif
158  UChar*        m_puhIntraDir[MAX_NUM_CHANNEL_TYPE];
159  UChar*        m_puhInterDir;        ///< array of inter directions
160  SChar*        m_apiMVPIdx[NUM_REF_PIC_LIST_01];       ///< array of motion vector predictor candidates
161  SChar*        m_apiMVPNum[NUM_REF_PIC_LIST_01];       ///< array of number of possible motion vectors predictors
162  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
163#if MCTS_ENC_CHECK
164  Bool          m_tMctsMvpIsValid;
165#endif
166#if NH_3D
167  DisInfo*      m_pDvInfo;
168  SChar*        m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
169  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP
170  UChar*        m_puhARPW;
171  Bool*         m_pbICFlag;           ///< array of IC flags
172  Pel*          m_dmmDeltaDC[NUM_DMM][2];
173  UInt*         m_dmm1WedgeTabIdx;
174  Bool*         m_pbSDCFlag;
175  Pel*          m_apSegmentDCOffset[2];
176  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
177  DbbpTmpData   m_sDBBPTmpData;
178
179  Bool          m_bAvailableFlagA1;    ///< A1 available flag
180  Bool          m_bAvailableFlagB1;    ///< B1 available flag
181  Bool          m_bAvailableFlagB0;    ///< B0 available flag
182  Bool          m_bAvailableFlagA0;    ///< A0 available flag
183  Bool          m_bAvailableFlagB2;    ///< B2 available flag
184#endif
185
186
187  // -------------------------------------------------------------------------------------------------------------------
188  // misc. variables
189  // -------------------------------------------------------------------------------------------------------------------
190
191  Bool          m_bDecSubCu;          ///< indicates decoder-mode
192  Double        m_dTotalCost;         ///< sum of partition RD costs
193#if NH_3D_VSO
194  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
195#else
196  Distortion    m_uiTotalDistortion;  ///< sum of partition distortion
197#endif
198  UInt          m_uiTotalBits;        ///< sum of partition bits
199  UInt          m_uiTotalBins;        ///< sum of partition bins
200  SChar         m_codedQP;
201#if NH_3D
202  DisInfo         m_cDefaultDisInfo;    ///< Default disparity information for initializing
203  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];   ///< Motion candidates for merge mode
204  Int             m_numSpatialCands;
205#endif
206
207  UChar*        m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU
208
209protected:
210
211  /// adds a single possible motion vector predictor candidate
212  Bool          xAddMVPCandUnscaled           ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const;
213  Bool          xAddMVPCandWithScaling        ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const;
214
215#if NH_3D
216  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
217  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); 
218#endif
219
220  Void          deriveRightBottomIdx          ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const;
221
222#if NH_3D
223  Bool          xGetColMVP                    ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true  ) const;
224#else
225  Bool          xGetColMVP                    ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const;
226#endif
227
228  /// compute scaling factor from POC difference
229#if !NH_3D
230  static Int    xGetDistScaleFactor           ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
231#endif
232  Void          xDeriveCenterIdx              ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const;
233
234#if NH_3D
235  Void          xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
236#endif
237
238public:
239
240#if NH_3D
241  static Int    xGetDistScaleFactor           ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
242#endif
243
244  TComDataCU();
245  virtual ~TComDataCU();
246
247  // -------------------------------------------------------------------------------------------------------------------
248  // create / destroy / initialize / copy
249  // -------------------------------------------------------------------------------------------------------------------
250  Void          create                ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
251#if ADAPTIVE_QP_SELECTION
252    , TCoeff *pParentARLBuffer = 0
253#endif
254    );
255  Void          destroy               ();
256
257  Void          initCtu               ( TComPic* pcPic, UInt ctuRsAddr );
258  Void          initEstData           ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass );
259  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
260  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
261
262  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx );
263#if NH_3D
264  Void          copyDVInfoFrom        (TComDataCU* pcCU, UInt uiAbsPartIdx);
265  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, Bool bNBDV = false );
266#else
267  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList );
268#endif
269  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
270
271  Void          copyToPic             ( UChar uiDepth );
272
273  // -------------------------------------------------------------------------------------------------------------------
274  // member functions for CU description
275  // -------------------------------------------------------------------------------------------------------------------
276
277  TComPic*        getPic              ()                        { return m_pcPic;           }
278  const TComPic*  getPic              () const                  { return m_pcPic;           }
279  TComSlice*       getSlice           ()                        { return m_pcSlice;         }
280  const TComSlice* getSlice           () const                  { return m_pcSlice;         }
281  UInt&         getCtuRsAddr          ()                        { return m_ctuRsAddr;       }
282  UInt          getCtuRsAddr          () const                  { return m_ctuRsAddr;       }
283  UInt          getZorderIdxInCtu     () const                  { return m_absZIdxInCtu;    }
284  UInt          getCUPelX             () const                  { return m_uiCUPelX;        }
285  UInt          getCUPelY             () const                  { return m_uiCUPelY;        }
286
287  UChar*        getDepth              ()                        { return m_puhDepth;        }
288  UChar         getDepth              ( UInt uiIdx ) const      { return m_puhDepth[uiIdx]; }
289  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
290
291  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
292
293#if MCTS_ENC_CHECK
294  Void          setTMctsMvpIsValid(Bool b)    { m_tMctsMvpIsValid = b; }
295  Bool          getTMctsMvpIsValid()          { return m_tMctsMvpIsValid; }
296  Bool          isLastColumnCTUInTile() const;
297#endif
298
299#if NH_3D
300  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) const;
301  Void          setSlice              ( TComSlice* pcSlice)     { m_pcSlice = pcSlice;       }
302  Void          setPic                ( TComDataCU* pcCU  )     { m_pcPic              = pcCU->getPic(); }
303#endif
304  // -------------------------------------------------------------------------------------------------------------------
305  // member functions for CU data
306  // -------------------------------------------------------------------------------------------------------------------
307
308  SChar*        getPartitionSize              ( )                                                          { return m_pePartSize;                       }
309  PartSize      getPartitionSize              ( UInt uiIdx ) const                                         { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
310  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
311  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
312  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
313
314#if NH_3D
315  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
316#endif
317 
318  Bool*         getSkipFlag           ()                        { return m_skipFlag;          }
319  Bool          getSkipFlag                   ( UInt idx ) const                                           { return m_skipFlag[idx];                    }
320  Void          setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
321  Void          setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
322
323#if NH_3D
324  Bool*         getDISFlag            ()                         { return m_bDISFlag;          }
325  Bool          getDISFlag            ( UInt idx)                { return m_bDISFlag[idx];     }
326  Void          setDISFlag            ( UInt idx, Bool bDIS)     { m_bDISFlag[idx] = bDIS;   }
327  Void          setDISFlagSubParts    ( Bool bDIS, UInt uiAbsPartIdx, UInt uiDepth );
328
329  UChar*        getDISType            ()                         { return m_ucDISType; }
330  UChar         getDISType            ( UInt idx)                { return m_ucDISType[idx];     }
331  Void          getDISType            ( UInt idx, UChar ucDISType)     { m_ucDISType[idx] = ucDISType;   }
332  Void          setDISTypeSubParts    ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth );
333
334  Bool*         getDBBPFlag           ()                        const { return m_pbDBBPFlag;               }
335  Bool          getDBBPFlag           ( UInt uiIdx )            const { return m_pbDBBPFlag[uiIdx];        }
336  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
337  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
338  DbbpTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
339
340
341#endif
342  SChar*        getPredictionMode             ( )                                                          { return m_pePredMode;                       }
343  PredMode      getPredictionMode             ( UInt uiIdx ) const                                         { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
344  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
345  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
346
347
348  SChar*        getCrossComponentPredictionAlpha( ComponentID compID )                                     { return m_crossComponentPredictionAlpha[compID];        }
349  SChar         getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID )                         { return m_crossComponentPredictionAlpha[compID][uiIdx]; }
350
351  Bool*         getCUTransquantBypass ()                        { return m_CUTransquantBypass;        }
352  Bool          getCUTransquantBypass         ( UInt uiIdx ) const                                         { return m_CUTransquantBypass[uiIdx];        }
353
354  UChar*        getWidth              ()                        { return m_puhWidth;          }
355  UChar         getWidth                      ( UInt uiIdx ) const                                         { return m_puhWidth[uiIdx];                  }
356  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
357
358  UChar*        getHeight             ()                        { return m_puhHeight;         }
359  UChar         getHeight                     ( UInt uiIdx ) const                                         { return m_puhHeight[uiIdx];                 }
360  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
361
362  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
363
364  SChar*        getQP                         ( )                                                          { return m_phQP;                             }
365  SChar         getQP                         ( UInt uiIdx ) const                                         { return m_phQP[uiIdx];                      }
366  Void          setQP                         ( UInt uiIdx, SChar value )                                  { m_phQP[uiIdx] =  value;                    }
367  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
368  Int           getLastValidPartIdx           ( Int iAbsPartIdx ) const;
369  SChar         getLastCodedQP                ( UInt uiAbsPartIdx ) const;
370  Void          setQPSubCUs           ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );
371  Void          setCodedQP                    ( SChar qp )                                                 { m_codedQP = qp;                            }
372  SChar         getCodedQP                    ( ) const                                                    { return m_codedQP;                          }
373
374  UChar*        getChromaQpAdj        ()                        { return m_ChromaQpAdj;       } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1
375  UChar         getChromaQpAdj        (Int idx)           const { return m_ChromaQpAdj[idx];  } ///< When value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1
376  Void          setChromaQpAdj        (Int idx, UChar val)      { m_ChromaQpAdj[idx] = val;   } ///< When val = 0,   cu_chroma_qp_offset_flag=0; when val>0,   indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1
377  Void          setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth );
378  Void          setCodedChromaQpAdj           ( SChar qp )                                                 { m_codedChromaQpAdj = qp;                   }
379  SChar         getCodedChromaQpAdj           ( ) const                                                    { return m_codedChromaQpAdj;                 }
380
381  Bool          isLosslessCoded               ( UInt absPartIdx ) const;
382
383  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
384  UChar         getTransformIdx               ( UInt uiIdx ) const                                         { return m_puhTrIdx[uiIdx];                  }
385  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
386
387  UChar*        getTransformSkip      ( ComponentID compID )    { return m_puhTransformSkip[compID];}
388  UChar         getTransformSkip              ( UInt uiIdx, ComponentID compID ) const                     { return m_puhTransformSkip[compID][uiIdx];  }
389  Void          setTransformSkipSubParts  ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth);
390  Void          setTransformSkipSubParts  ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth );
391
392  UChar*        getExplicitRdpcmMode      ( ComponentID component ) { return m_explicitRdpcmMode[component]; }
393  UChar         getExplicitRdpcmMode          ( ComponentID component, UInt partIdx ) const                { return m_explicitRdpcmMode[component][partIdx]; }
394  Void          setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
395
396  Bool          isRDPCMEnabled                ( UInt uiAbsPartIdx ) const                                  { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); }
397
398  Void          setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
399  Void          setTransformSkipPartRange                    ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
400
401  UInt          getQuadtreeTULog2MinSizeInCU  ( UInt uiIdx ) const;
402
403  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
404  const TComCUMvField* getCUMvField           ( RefPicList e ) const                                       { return &m_acCUMvField[e];                  }
405
406  TCoeff*       getCoeff              (ComponentID component)   { return m_pcTrCoeff[component]; }
407
408#if ADAPTIVE_QP_SELECTION
409  TCoeff*       getArlCoeff           ( ComponentID component ) { return m_pcArlCoeff[component]; }
410#endif
411  Pel*          getPCMSample          ( ComponentID component ) { return m_pcIPCMSample[component]; }
412
413  UChar         getCbf                        ( UInt uiIdx, ComponentID eType ) const                      { return m_puhCbf[eType][uiIdx];             }
414  UChar*        getCbf    ( ComponentID eType )                              { return m_puhCbf[eType];         }
415  UChar         getCbf                        ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const      { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
416  Void          setCbf    ( UInt uiIdx, ComponentID eType, UChar uh )        { m_puhCbf[eType][uiIdx] = uh;    }
417  Void          clearCbf  ( UInt uiIdx, ComponentID eType, UInt uiNumParts );
418  UChar         getQtRootCbf                  ( UInt uiIdx ) const;
419
420  Void          setCbfSubParts        ( const UInt uiCbf[MAX_NUM_COMPONENT],  UInt uiAbsPartIdx, UInt uiDepth           );
421  Void          setCbfSubParts        ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth                    );
422  Void          setCbfSubParts        ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
423
424  Void          setCbfPartRange       ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes      );
425  Void          bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes      );
426
427  // -------------------------------------------------------------------------------------------------------------------
428  // member functions for coding tool information
429  // -------------------------------------------------------------------------------------------------------------------
430
431  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
432  Bool          getMergeFlag                  ( UInt uiIdx ) const                                         { return m_pbMergeFlag[uiIdx];               }
433  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
434  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
435
436  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
437  UChar         getMergeIndex                 ( UInt uiIdx ) const                                         { return m_puhMergeIndex[uiIdx];             }
438  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
439  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
440  template <typename T>
441  Void          setSubPart            ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
442#if NH_3D
443  template<typename T>
444  Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
445#endif
446
447#if AMP_MRG
448  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
449  Bool          getMergeAMP                   ( ) const                                                    { return m_bIsMergeAMP;                      }
450#endif
451
452  UChar*        getIntraDir         ( const ChannelType channelType )                   const { return m_puhIntraDir[channelType];         }
453  UChar         getIntraDir         ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx];  }
454
455  Void          setIntraDirSubParts ( const ChannelType channelType,
456                                      const UInt uiDir,
457                                      const UInt uiAbsPartIdx,
458                                      const UInt uiDepth );
459
460  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
461  UChar         getInterDir                   ( UInt uiIdx ) const                                         { return m_puhInterDir[uiIdx];               }
462  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
463  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
464  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
465  Bool          getIPCMFlag                   ( UInt uiIdx ) const                                         { return m_pbIPCMFlag[uiIdx];                }
466  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
467  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
468  // -------------------------------------------------------------------------------------------------------------------
469  // member functions for accessing partition information
470  // -------------------------------------------------------------------------------------------------------------------
471
472#if  NH_3D_FAST_TEXTURE_ENCODING
473  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
474#endif
475
476#if NH_3D
477  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
478  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
479  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
480  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
481 
482  Void          getDisMvpCandNBDV     ( DisInfo* pDInfo, Bool bDepthRefine = false   );   
483  Void          getDispforDepth       ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
484
485  Pel           getMcpFromDM          ( TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
486  Void          estimateDVFromDM      ( Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );
487  Bool          getNeighDepth         ( UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);
488  Void          getSPPara             ( Int iPUWidth   , Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
489  Void          getSPAbsPartIdx       ( UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
490  Void          setInterDirSP         ( UInt uiDir    , UInt uiAbsPartIdx, Int iWidth, Int iHeight );
491  Bool          getInterViewMergeCands( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth , TComMvField* pcMFieldSP, UChar* puhInterDirSP, Bool bICFlag );   
492
493  UChar*        getARPW            ()              const          { return m_puhARPW;               }
494  UChar         getARPW            ( UInt uiIdx )  const          { return m_puhARPW[uiIdx];        }
495  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
496  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
497
498  Bool*         getICFlag          ()                        { return m_pbICFlag;               }
499  Bool          getICFlag          ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
500  Void          setICFlag          ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
501  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
502  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
503
504  Pel*          getDmmDeltaDC                 ( DmmID dmmType, UInt segId )                      { return m_dmmDeltaDC[dmmType][segId];        } 
505  Pel           getDmmDeltaDC                 ( DmmID dmmType, UInt segId, UInt uiIdx )          { return m_dmmDeltaDC[dmmType][segId][uiIdx]; } 
506  Void          setDmmDeltaDC                 ( DmmID dmmType, UInt segId, UInt uiIdx, Pel val ) { m_dmmDeltaDC[dmmType][segId][uiIdx] = val;  }
507
508  UInt*         getDmm1WedgeTabIdx            ()                                                { return m_dmm1WedgeTabIdx;          }       
509  UInt          getDmm1WedgeTabIdx            ( UInt uiIdx )                                    { return m_dmm1WedgeTabIdx[uiIdx];   }
510  Void          setDmm1WedgeTabIdx            ( UInt uiIdx, UInt tabIdx )                       { m_dmm1WedgeTabIdx[uiIdx] = tabIdx; }
511  Void          setDmm1WedgeTabIdxSubParts    ( UInt tabIdx, UInt uiAbsPartIdx, UInt uiDepth );
512
513  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
514  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
515  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );
516
517  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
518
519  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
520  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
521  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
522
523  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
524  Bool          xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, UInt uiMvpDvPos  , Bool bDepthRefine = false  );
525  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
526
527
528  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const;
529#else
530  Void          getPartIndexAndSize           ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
531#endif
532  UChar         getNumPartitions              ( const UInt uiAbsPartIdx = 0 ) const;
533  Bool          isFirstAbsZorderIdxInDepth    ( UInt uiAbsPartIdx, UInt uiDepth ) const;
534 
535  // -------------------------------------------------------------------------------------------------------------------
536  // member functions for motion vector
537  // -------------------------------------------------------------------------------------------------------------------
538
539  static Void   getMvField                    ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
540
541  Void          fillMvpCand                   ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const;
542  Bool          isDiffMER                     ( Int xN, Int yN, Int xP, Int yP ) const;
543  Void          getPartPosition               ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const;
544
545  Void          setMVPIdx                     ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
546  Int           getMVPIdx                     ( RefPicList eRefPicList, UInt uiIdx) const                  { return m_apiMVPIdx[eRefPicList][uiIdx];    }
547  SChar*        getMVPIdx                     ( RefPicList eRefPicList )                                   { return m_apiMVPIdx[eRefPicList];           }
548
549  Void          setMVPNum                     ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
550  Int           getMVPNum                     ( RefPicList eRefPicList, UInt uiIdx ) const                 { return m_apiMVPNum[eRefPicList][uiIdx];    }
551  SChar*        getMVPNum                     ( RefPicList eRefPicList )                                   { return m_apiMVPNum[eRefPicList];           }
552
553  Void          setMVPIdxSubParts             ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
554  Void          setMVPNumSubParts             ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
555
556  Void          clipMv                        ( TComMv&     rcMv     ) const;
557
558  Void          getMvPredLeft                 ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldA.getMv();            }
559  Void          getMvPredAbove                ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldB.getMv();            }
560  Void          getMvPredAboveRight           ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldC.getMv();            }
561
562#if NH_MV
563  Void          checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
564#endif
565
566
567#if NH_3D
568  Void          compressMV            ( Int scale );
569  Void          printMV               ( );
570#else           
571  Void          compressMV            ();
572#endif 
573  // -------------------------------------------------------------------------------------------------------------------
574  // utility functions for neighbouring information
575  // -------------------------------------------------------------------------------------------------------------------
576
577  TComDataCU*   getCtuLeft                  () { return m_pCtuLeft;       }
578  TComDataCU*   getCtuAbove                 () { return m_pCtuAbove;      }
579  TComDataCU*   getCtuAboveLeft             () { return m_pCtuAboveLeft;  }
580  TComDataCU*   getCtuAboveRight            () { return m_pCtuAboveRight; }
581  Bool          CUIsFromSameSlice           ( const TComDataCU *pCU /* Can be NULL */) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); }
582  Bool          CUIsFromSameTile            ( const TComDataCU *pCU /* Can be NULL */) const;
583  Bool          CUIsFromSameSliceAndTile    ( const TComDataCU *pCU /* Can be NULL */) const;
584  Bool          CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const;
585  Bool          isLastSubCUOfCtu              ( const UInt absPartIdx ) const;
586
587
588  const TComDataCU*   getPULeft               ( UInt& uiLPartUnitIdx,
589                                              UInt uiCurrPartUnitIdx,
590                                              Bool bEnforceSliceRestriction=true,
591                                                Bool  bEnforceTileRestriction=true ) const;
592
593  const TComDataCU*   getPUAbove              ( UInt& uiAPartUnitIdx,
594                                              UInt uiCurrPartUnitIdx,
595                                              Bool bEnforceSliceRestriction=true,
596                                              Bool planarAtCTUBoundary = false,
597                                                Bool  bEnforceTileRestriction=true ) const;
598
599  const TComDataCU*   getPUAboveLeft          ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const;
600
601  const TComDataCU*   getQpMinCuLeft          ( UInt&  uiLPartUnitIdx,  UInt uiCurrAbsIdxInCtu ) const;
602  const TComDataCU*   getQpMinCuAbove         ( UInt&  uiAPartUnitIdx,  UInt uiCurrAbsIdxInCtu ) const;
603
604  /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts)
605  const TComDataCU*   getPUAboveRight         ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const;
606  /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts)
607  const TComDataCU*   getPUBelowLeft          ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const;
608
609  SChar         getRefQP                      ( UInt uiCurrAbsIdxInCtu ) const;
610
611  Void          deriveLeftRightTopIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const;
612  Void          deriveLeftBottomIdx           ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const;
613
614  Bool          hasEqualMotion                ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const;
615
616#if NH_3D
617  Bool          hasEqualMotion              ( Int dirA, const TComMvField* mvFieldA,  Int dirB, const TComMvField* mvFieldB  );
618  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;   }
619  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;   }
620  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;   }
621  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;   }
622  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;   }
623 
624  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  } 
625 
626  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Bool* pbSPIVMPFlag , Int& numValidMergeCand    ); 
627  Void          xGetInterMergeCandidates      ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldSP, UChar* puhInterDirSP, Int& numValidMergeCand, Int mrgCandIdx = -1 );
628#endif
629
630#if MCTS_ENC_CHECK
631  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, UInt& numSpatialMergeCandidates , Int mrgCandIdx = -1)
632#else
633  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 )
634#endif
635#if !NH_3D
636  const
637#endif
638;
639#if NH_3D
640  Bool*         getSPIVMPFlag        ()                        const { return m_pbSPIVMPFlag;          }
641  Bool          getSPIVMPFlag        ( UInt uiIdx )            const { return m_pbSPIVMPFlag[uiIdx];   }
642  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
643  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
644
645  SChar*        getVSPFlag        ()                        const { return m_piVSPFlag;          }
646  SChar         getVSPFlag        ( UInt uiIdx )            const { return m_piVSPFlag[uiIdx];   }
647  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
648  Void          setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
649  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
650#endif
651  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const;
652  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const;
653  // -------------------------------------------------------------------------------------------------------------------
654  // member functions for modes
655  // -------------------------------------------------------------------------------------------------------------------
656
657  Bool          isIntra            ( UInt uiPartIdx )  const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA;                                              }
658  Bool          isInter            ( UInt uiPartIdx )  const { return m_pePredMode[ uiPartIdx ] == MODE_INTER;                                              }
659  Bool          isSkipped                     ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped
660  Bool          isBipredRestriction           ( UInt puIdx     ) const;
661
662  // -------------------------------------------------------------------------------------------------------------------
663  // member functions for symbol prediction (most probable / mode conversion)
664  // -------------------------------------------------------------------------------------------------------------------
665
666  UInt          getIntraSizeIdx               ( UInt uiAbsPartIdx ) const;
667
668  Void          getAllowedChromaDir           ( UInt uiAbsPartIdx, UInt* uiModeList ) const;
669  Void          getIntraDirPredictor          ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const;
670
671  // -------------------------------------------------------------------------------------------------------------------
672  // member functions for SBAC context
673  // -------------------------------------------------------------------------------------------------------------------
674
675  UInt          getCtxSplitFlag               ( UInt   uiAbsPartIdx, UInt uiDepth     ) const;
676  UInt          getCtxQtCbf                   ( TComTU &rTu, const ChannelType chType ) const;
677
678  UInt          getCtxSkipFlag                ( UInt   uiAbsPartIdx ) const;
679  UInt          getCtxInterDir                ( UInt   uiAbsPartIdx ) const;
680#if NH_3D
681  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
682#endif 
683
684  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                              }
685  // -------------------------------------------------------------------------------------------------------------------
686  // member functions for RD cost storage
687  // -------------------------------------------------------------------------------------------------------------------
688
689  Double&       getTotalCost()                  { return m_dTotalCost;        }
690#if NH_3D_VSO
691  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
692#else
693  Distortion&   getTotalDistortion()            { return m_uiTotalDistortion; }
694#endif
695  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
696  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
697
698  UInt          getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const ;
699};
700
701namespace RasterAddress
702{
703  /** Check whether 2 addresses point to the same column
704   * \param addrA          First address in raster scan order
705   * \param addrB          Second address in raters scan order
706   * \param numUnitsPerRow Number of units in a row
707   * \return Result of test
708   */
709  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
710  {
711    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
712    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
713  }
714
715  /** Check whether 2 addresses point to the same row
716   * \param addrA          First address in raster scan order
717   * \param addrB          Second address in raters scan order
718   * \param numUnitsPerRow Number of units in a row
719   * \return Result of test
720   */
721  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
722  {
723    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
724    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
725  }
726
727  /** Check whether 2 addresses point to the same row or column
728   * \param addrA          First address in raster scan order
729   * \param addrB          Second address in raters scan order
730   * \param numUnitsPerRow Number of units in a row
731   * \return Result of test
732   */
733  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
734  {
735    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
736  }
737
738  /** Check whether one address points to the first column
739   * \param addr           Address in raster scan order
740   * \param numUnitsPerRow Number of units in a row
741   * \return Result of test
742   */
743  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
744  {
745    // addr % numUnitsPerRow == 0
746    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
747  }
748
749  /** Check whether one address points to the first row
750   * \param addr           Address in raster scan order
751   * \param numUnitsPerRow Number of units in a row
752   * \return Result of test
753   */
754  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
755  {
756    // addr / numUnitsPerRow == 0
757    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
758  }
759
760  /** Check whether one address points to a column whose index is smaller than a given value
761   * \param addr           Address in raster scan order
762   * \param val            Given column index value
763   * \param numUnitsPerRow Number of units in a row
764   * \return Result of test
765   */
766  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
767  {
768    // addr % numUnitsPerRow < val
769    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
770  }
771
772  /** Check whether one address points to a row whose index is smaller than a given value
773   * \param addr           Address in raster scan order
774   * \param val            Given row index value
775   * \param numUnitsPerRow Number of units in a row
776   * \return Result of test
777   */
778  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
779  {
780    // addr / numUnitsPerRow < val
781    return addr < val * numUnitsPerRow;
782  }
783}
784
785//! \}
786
787#endif
Note: See TracBrowser for help on using the repository browser.