source: 3DVCSoftware/branches/HTM-14.1-update-dev4-Qualcomm/source/Lib/TLibCommon/TComDataCU.h @ 1320

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