source: 3DVCSoftware/branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.h @ 1243

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