source: 3DVCSoftware/branches/HTM-10.2-dev3-Hisilicon/source/Lib/TLibCommon/TComDataCU.h @ 928

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

Integration of H0108 "Clean-up on DMM and SDC DC value derivation"

  • Property svn:eol-style set to native
File size: 46.9 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6* Copyright (c) 2010-2014, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TComDataCU.h
35    \brief    CU data structure (header)
36    \todo     not all entities are documented
37*/
38
39#ifndef _TCOMDATACU_
40#define _TCOMDATACU_
41
42#include <assert.h>
43
44// Include files
45#include "CommonDef.h"
46#include "TComMotionInfo.h"
47#include "TComSlice.h"
48#include "TComRdCost.h"
49#include "TComPattern.h"
50
51#if H_3D_ARP
52#include "TComYuv.h"
53#endif
54
55#include <algorithm>
56#include <vector>
57
58//! \ingroup TLibCommon
59//! \{
60
61
62#if H_3D_DBBP
63typedef struct _DBBPTmpData
64{
65  TComMv      acMvd[2][2];          // for two segments and two lists
66  TComMvField acMvField[2][2];      // for two segments and two lists
67  Int         aiMvpNum[2][2];       // for two segments and two lists
68  Int         aiMvpIdx[2][2];       // for two segments and two lists
69  UChar       auhInterDir[2];       // for two segments
70  Bool        abMergeFlag[2];       // for two segments
71  UChar       auhMergeIndex[2];     // for two segments
72  Char        ahVSPFlag[2];         // for two segments
73  DisInfo     acDvInfo[2];          // for two segments
74 
75  PartSize    eVirtualPartSize;
76  UInt        uiVirtualPartIndex;
77} DBBPTmpData;
78#endif
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  TComPattern*  m_pcPattern;          ///< neighbour access class pointer
96 
97  // -------------------------------------------------------------------------------------------------------------------
98  // CU description
99  // -------------------------------------------------------------------------------------------------------------------
100 
101  UInt          m_uiCUAddr;           ///< CU address in a slice
102  UInt          m_uiAbsIdxInLCU;      ///< absolute address in a CU. It's Z scan order
103  UInt          m_uiCUPelX;           ///< CU position in a pixel (X)
104  UInt          m_uiCUPelY;           ///< CU position in a pixel (Y)
105  UInt          m_uiNumPartition;     ///< total number of minimum partitions in a CU
106  UChar*        m_puhWidth;           ///< array of widths
107  UChar*        m_puhHeight;          ///< array of heights
108  UChar*        m_puhDepth;           ///< array of depths
109  Int           m_unitSize;           ///< size of a "minimum partition"
110 
111  // -------------------------------------------------------------------------------------------------------------------
112  // CU data
113  // -------------------------------------------------------------------------------------------------------------------
114  Bool*         m_skipFlag;           ///< array of skip flags
115  Char*         m_pePartSize;         ///< array of partition sizes
116  Char*         m_pePredMode;         ///< array of prediction modes
117  Bool*         m_CUTransquantBypass;   ///< array of cu_transquant_bypass flags
118  Char*         m_phQP;               ///< array of QP values
119  UChar*        m_puhTrIdx;           ///< array of transform indices
120  UChar*        m_puhTransformSkip[3];///< array of transform skipping flags
121  UChar*        m_puhCbf[3];          ///< array of coded block flags (CBF)
122  TComCUMvField m_acCUMvField[2];     ///< array of motion vectors
123  TCoeff*       m_pcTrCoeffY;         ///< transformed coefficient buffer (Y)
124  TCoeff*       m_pcTrCoeffCb;        ///< transformed coefficient buffer (Cb)
125  TCoeff*       m_pcTrCoeffCr;        ///< transformed coefficient buffer (Cr)
126#if ADAPTIVE_QP_SELECTION
127  Int*          m_pcArlCoeffY;        ///< ARL coefficient buffer (Y)
128  Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
129  Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
130  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
131
132  static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
133  static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
134  static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
135#endif
136 
137  Pel*          m_pcIPCMSampleY;      ///< PCM sample buffer (Y)
138  Pel*          m_pcIPCMSampleCb;     ///< PCM sample buffer (Cb)
139  Pel*          m_pcIPCMSampleCr;     ///< PCM sample buffer (Cr)
140
141  // -------------------------------------------------------------------------------------------------------------------
142  // neighbour access variables
143  // -------------------------------------------------------------------------------------------------------------------
144 
145  TComDataCU*   m_pcCUAboveLeft;      ///< pointer of above-left CU
146  TComDataCU*   m_pcCUAboveRight;     ///< pointer of above-right CU
147  TComDataCU*   m_pcCUAbove;          ///< pointer of above CU
148  TComDataCU*   m_pcCULeft;           ///< pointer of left CU
149  TComDataCU*   m_apcCUColocated[2];  ///< 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_puhLumaIntraDir;    ///< array of intra directions (luma)
165  UChar*        m_puhChromaIntraDir;  ///< array of intra directions (chroma)
166  UChar*        m_puhInterDir;        ///< array of inter directions
167  Char*         m_apiMVPIdx[2];       ///< array of motion vector predictor candidates
168  Char*         m_apiMVPNum[2];       ///< array of number of possible motion vectors predictors
169  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
170#if H_3D_NBDV
171  DisInfo*      m_pDvInfo;
172#endif
173#if H_3D_VSP
174  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
175                                      ///< 0: non-VSP; 1: VSP
176#endif
177#if H_3D_SPIVMP
178  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
179                                      ///< 0: non-SPIVMP; 1: SPIVMP
180#endif
181#if H_3D_ARP
182  UChar*        m_puhARPW;
183#endif
184#if H_3D_IC
185  Bool*         m_pbICFlag;           ///< array of IC flags
186#endif
187#if H_3D_DIM
188  Pel*          m_dimDeltaDC[DIM_NUM_TYPE][2];
189#if H_3D_DIM_DMM
190  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 
191#endif
192#if H_3D_DIM_SDC
193  Bool*         m_pbSDCFlag;
194  Pel*          m_apSegmentDCOffset[2];
195#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
196  Pel          m_apDmmPredictor[2];
197#endif
198#endif
199#endif
200#if H_3D_DBBP
201  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
202  DBBPTmpData   m_sDBBPTmpData;
203#endif
204#if H_3D
205  Bool          m_bAvailableFlagA1;    ///< A1 available flag
206  Bool          m_bAvailableFlagB1;    ///< B1 available flag
207  Bool          m_bAvailableFlagB0;    ///< B0 available flag
208  Bool          m_bAvailableFlagA0;    ///< A0 available flag
209  Bool          m_bAvailableFlagB2;    ///< B2 available flag
210#endif
211  // -------------------------------------------------------------------------------------------------------------------
212  // misc. variables
213  // -------------------------------------------------------------------------------------------------------------------
214 
215  Bool          m_bDecSubCu;          ///< indicates decoder-mode
216  Double        m_dTotalCost;         ///< sum of partition RD costs
217#if H_3D_VSO
218  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
219#else
220  UInt          m_uiTotalDistortion;  ///< sum of partition distortion
221#endif
222  UInt          m_uiTotalBits;        ///< sum of partition bits
223  UInt          m_uiTotalBins;       ///< sum of partition bins
224  UInt*         m_sliceStartCU;    ///< Start CU address of current slice
225  UInt*         m_sliceSegmentStartCU; ///< Start CU address of current slice
226  Char          m_codedQP;
227#if H_3D
228  DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
229#endif
230
231#if H_3D_DDD
232  UChar*        m_pucDisparityDerivedDepth;
233  Bool*         m_pbUseDDD;
234  Int           m_iUseDDDCandIdx;
235  UChar         m_ucDDTmpDepth;
236#endif
237
238protected:
239 
240  /// add possible motion vector predictor candidates
241  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
242  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
243#if H_3D_VSP
244  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
245                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
246#endif
247#if H_3D_IV_MERGE
248  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
249                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   ); 
250  Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
251#endif
252
253  Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
254  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
255#if H_3D_TMVP
256  ,
257  Bool bMRG = true
258#endif
259  );
260 
261  /// compute required bits to encode MVD (used in AMVP)
262  UInt          xGetMvdBits           ( TComMv cMvd );
263  UInt          xGetComponentBits     ( Int iVal );
264 
265  /// compute scaling factor from POC difference
266#if !H_3D_ARP
267  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
268#endif
269
270  Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
271
272#if H_3D_VSP
273  Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
274#endif
275
276public:
277  TComDataCU();
278  virtual ~TComDataCU();
279 
280  // -------------------------------------------------------------------------------------------------------------------
281  // create / destroy / initialize / copy
282  // -------------------------------------------------------------------------------------------------------------------
283#if H_3D_ARP
284  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
285#endif
286  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
287#if ADAPTIVE_QP_SELECTION
288    , Bool bGlobalRMARLBuffer = false
289#endif 
290    );
291  Void          destroy               ();
292 
293  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
294  Void          initEstData           ( UInt uiDepth, Int qp, Bool bTransquantBypass );
295  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
296  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
297#if H_3D_NBDV
298  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
299#endif
300  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
301  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
302#if H_3D_NBDV
303  , Bool bNBDV = false
304#endif
305  );
306  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
307 
308  Void          copyToPic             ( UChar uiDepth );
309  Void          copyToPic             ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth );
310 
311  // -------------------------------------------------------------------------------------------------------------------
312  // member functions for CU description
313  // -------------------------------------------------------------------------------------------------------------------
314 
315  TComPic*      getPic                ()                        { return m_pcPic;           }
316  TComSlice*    getSlice              ()                        { return m_pcSlice;         }
317  UInt&         getAddr               ()                        { return m_uiCUAddr;        }
318  UInt&         getZorderIdxInCU      ()                        { return m_uiAbsIdxInLCU; }
319  UInt          getSCUAddr            ();
320  UInt          getCUPelX             ()                        { return m_uiCUPelX;        }
321  UInt          getCUPelY             ()                        { return m_uiCUPelY;        }
322  TComPattern*  getPattern            ()                        { return m_pcPattern;       }
323 
324  UChar*        getDepth              ()                        { return m_puhDepth;        }
325  UChar         getDepth              ( UInt uiIdx )            { return m_puhDepth[uiIdx]; }
326  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
327 
328  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
329#if H_3D
330  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
331#endif
332 
333  // -------------------------------------------------------------------------------------------------------------------
334  // member functions for CU data
335  // -------------------------------------------------------------------------------------------------------------------
336 
337  Char*         getPartitionSize      ()                        { return m_pePartSize;        }
338  PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
339  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
340  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
341  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
342 
343#if H_3D_DBBP
344  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
345#endif
346 
347  Bool*        getSkipFlag            ()                        { return m_skipFlag;          }
348  Bool         getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
349  Void         setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
350  Void         setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
351
352  Char*         getPredictionMode     ()                        { return m_pePredMode;        }
353  PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
354  Bool*         getCUTransquantBypass ()                        { return m_CUTransquantBypass;        }
355  Bool          getCUTransquantBypass( UInt uiIdx )             { return m_CUTransquantBypass[uiIdx]; }
356  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
357  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
358 
359#if H_3D_DBBP
360  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
361  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
362  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
363  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
364  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
365#endif
366 
367  UChar*        getWidth              ()                        { return m_puhWidth;          }
368  UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
369  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
370 
371  UChar*        getHeight             ()                        { return m_puhHeight;         }
372  UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
373  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
374 
375  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
376 
377  Char*         getQP                 ()                        { return m_phQP;              }
378  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
379  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
380  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
381  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
382  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
383  Void          setQPSubCUs           ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );
384  Void          setCodedQP            ( Char qp )               { m_codedQP = qp;             }
385  Char          getCodedQP            ()                        { return m_codedQP;           }
386
387  Bool          isLosslessCoded(UInt absPartIdx);
388 
389  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
390  UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
391  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
392
393  UChar*        getTransformSkip      ( TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];}
394  UChar         getTransformSkip      ( UInt uiIdx,TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];}
395  Void          setTransformSkipSubParts  ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); 
396  Void          setTransformSkipSubParts  ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth );
397
398  UInt          getQuadtreeTULog2MinSizeInCU( UInt absPartIdx );
399 
400  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
401 
402  TCoeff*&      getCoeffY             ()                        { return m_pcTrCoeffY;        }
403  TCoeff*&      getCoeffCb            ()                        { return m_pcTrCoeffCb;       }
404  TCoeff*&      getCoeffCr            ()                        { return m_pcTrCoeffCr;       }
405#if ADAPTIVE_QP_SELECTION
406  Int*&         getArlCoeffY          ()                        { return m_pcArlCoeffY;       }
407  Int*&         getArlCoeffCb         ()                        { return m_pcArlCoeffCb;      }
408  Int*&         getArlCoeffCr         ()                        { return m_pcArlCoeffCr;      }
409#endif
410 
411  Pel*&         getPCMSampleY         ()                        { return m_pcIPCMSampleY;     }
412  Pel*&         getPCMSampleCb        ()                        { return m_pcIPCMSampleCb;    }
413  Pel*&         getPCMSampleCr        ()                        { return m_pcIPCMSampleCr;    }
414
415  UChar         getCbf    ( UInt uiIdx, TextType eType )                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];  }
416  UChar*        getCbf    ( TextType eType )                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];         }
417  UChar         getCbf    ( UInt uiIdx, TextType eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
418  Void          setCbf    ( UInt uiIdx, TextType eType, UChar uh )        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;    }
419  Void          clearCbf  ( UInt uiIdx, TextType eType, UInt uiNumParts );
420  UChar         getQtRootCbf          ( UInt uiIdx )                      { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); }
421 
422  Void          setCbfSubParts        ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth          );
423  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth                    );
424  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
425 
426  // -------------------------------------------------------------------------------------------------------------------
427  // member functions for coding tool information
428  // -------------------------------------------------------------------------------------------------------------------
429 
430  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
431  Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
432  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
433  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
434
435  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
436  UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
437  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
438  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
439  template <typename T>
440  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
441#if H_3D_VSP
442  template<typename T>
443  Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
444#endif
445#if AMP_MRG
446  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
447  Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
448#endif
449
450  UChar*        getLumaIntraDir       ()                        { return m_puhLumaIntraDir;           }
451  UChar         getLumaIntraDir       ( UInt uiIdx )            { return m_puhLumaIntraDir[uiIdx];    }
452  Void          setLumaIntraDir       ( UInt uiIdx, UChar  uh ) { m_puhLumaIntraDir[uiIdx] = uh;      }
453  Void          setLumaIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
454 
455  UChar*        getChromaIntraDir     ()                        { return m_puhChromaIntraDir;         }
456  UChar         getChromaIntraDir     ( UInt uiIdx )            { return m_puhChromaIntraDir[uiIdx];  }
457  Void          setChromaIntraDir     ( UInt uiIdx, UChar  uh ) { m_puhChromaIntraDir[uiIdx] = uh;    }
458  Void          setChromIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
459 
460  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
461  UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
462  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
463  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
464  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
465  Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
466  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
467  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
468#if H_3D_NBDV
469  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
470  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
471  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
472  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
473#endif
474#if H_3D_NBDV
475  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
476  Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
477                                   UInt uiMvpDvPos
478#if H_3D_NBDV_REF
479  , Bool bDepthRefine = false
480#endif
481  );
482  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
483  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
484#if H_3D_NBDV_REF
485   , Bool bDepthRefine = false
486#endif
487   ); 
488   
489#if H_3D
490  Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
491  Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
492  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
493#endif
494
495#if H_3D_NBDV_REF
496  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
497  Void          estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );
498#endif //H_3D_NBDV_REF
499#endif
500#if  H_3D_FAST_TEXTURE_ENCODING
501  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
502#endif
503#if H_3D_SPIVMP
504  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
505  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
506  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
507#endif
508#if H_3D_IV_MERGE
509  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth           
510
511#if H_3D_SPIVMP
512    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
513#endif
514    );   
515#endif
516#if H_3D_ARP
517  UChar*        getARPW            ()                        { return m_puhARPW;               }
518  UChar         getARPW            ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
519  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
520  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
521  Double        getARPWFactor      ( UInt uiIdx );
522#endif
523#if H_3D_IC
524  Bool*         getICFlag          ()                        { return m_pbICFlag;               }
525  Bool          getICFlag          ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
526  Void          setICFlag          ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
527  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
528  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
529  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
530#else
531  // -------------------------------------------------------------------------------------------------------------------
532  // member functions for accessing partition information
533  // -------------------------------------------------------------------------------------------------------------------
534 
535  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
536#endif
537  UChar         getNumPartInter       ();
538  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
539
540#if H_3D_DIM
541  Pel*  getDimDeltaDC                 ( UInt dimType, UInt segId )                      { return m_dimDeltaDC[dimType][segId];        } 
542  Pel   getDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx )          { return m_dimDeltaDC[dimType][segId][uiIdx]; } 
543  Void  setDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val;  }
544#if H_3D_DIM_DMM
545  UInt* getDmmWedgeTabIdx             ( UInt dmmType )                          { return m_dmmWedgeTabIdx[dmmType];          }       
546  UInt  getDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx )              { return m_dmmWedgeTabIdx[dmmType][uiIdx];   }
547  Void  setDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; }
548  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
549
550#endif
551#if H_3D_DIM_SDC
552  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
553  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
554  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );
555 
556  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
557 
558  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
559  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
560  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
561#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
562  Void          setDmmPredictor ( Pel pOffset, UInt uiSeg) { m_apDmmPredictor[uiSeg] = pOffset; }
563  Pel           getDmmPredictor ( UInt uiSeg) { return m_apDmmPredictor[uiSeg]; }
564#endif
565  UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
566  UInt          getCtxAngleFlag        ( UInt   uiAbsPartIdx );
567#endif
568#endif
569 
570  // -------------------------------------------------------------------------------------------------------------------
571  // member functions for motion vector
572  // -------------------------------------------------------------------------------------------------------------------
573 
574  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
575 
576  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
577  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
578  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
579  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
580  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
581  Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
582
583  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
584  Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
585  Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
586 
587  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
588  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
589 
590  Void          clipMv                ( TComMv&     rcMv     );
591  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
592  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
593  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
594#if H_3D
595  Void          compressMV            ( Int scale );
596#else           
597  Void          compressMV            ();
598#endif 
599  // -------------------------------------------------------------------------------------------------------------------
600  // utility functions for neighbouring information
601  // -------------------------------------------------------------------------------------------------------------------
602 
603  TComDataCU*   getCULeft                   () { return m_pcCULeft;       }
604  TComDataCU*   getCUAbove                  () { return m_pcCUAbove;      }
605  TComDataCU*   getCUAboveLeft              () { return m_pcCUAboveLeft;  }
606  TComDataCU*   getCUAboveRight             () { return m_pcCUAboveRight; }
607  TComDataCU*   getCUColocated              ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; }
608
609
610  TComDataCU*   getPULeft                   ( UInt&  uiLPartUnitIdx, 
611                                              UInt uiCurrPartUnitIdx, 
612                                              Bool bEnforceSliceRestriction=true, 
613                                              Bool bEnforceTileRestriction=true );
614  TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx,
615                                              UInt uiCurrPartUnitIdx, 
616                                              Bool bEnforceSliceRestriction=true, 
617                                              Bool planarAtLCUBoundary = false,
618                                              Bool bEnforceTileRestriction=true );
619  TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
620  TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
621  TComDataCU*   getPUBelowLeft              ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
622
623  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU );
624  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU );
625  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
626
627  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
628  TComDataCU*   getPUBelowLeftAdi           ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
629 
630  Void          deriveLeftRightTopIdx       ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
631  Void          deriveLeftBottomIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLB );
632 
633  Void          deriveLeftRightTopIdxAdi    ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth );
634  Void          deriveLeftBottomIdxAdi      ( UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth );
635 
636  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
637
638#if H_3D
639  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
640  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
641  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
642  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
643  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
644  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
645  Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
646  Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
647#else
648  Void          getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
649#endif
650#if H_3D_VSP
651                                            , Int* vspFlag
652                                            , InheritedVSPDisInfo*  inheritedVSPDisInfo
653#endif
654#if H_3D_SPIVMP
655                                            , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
656#endif
657                                            , Int& numValidMergeCand, Int mrgCandIdx = -1
658                                            );
659
660#if H_3D_VSP
661  inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
662
663#if H_3D_SPIVMP
664  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
665  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
666  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
667  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
668#endif
669
670  Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
671  Char          getVSPFlag        ( UInt uiIdx )            { return m_piVSPFlag[uiIdx];   }
672  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
673  Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
674  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
675#endif
676  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
677  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
678 
679 
680  // -------------------------------------------------------------------------------------------------------------------
681  // member functions for modes
682  // -------------------------------------------------------------------------------------------------------------------
683 
684  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
685  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
686  Bool          isBipredRestriction( UInt puIdx );
687
688#if H_3D_IC
689  Bool          isIC      ( UInt uiPartIdx );
690#endif
691
692  // -------------------------------------------------------------------------------------------------------------------
693  // member functions for symbol prediction (most probable / mode conversion)
694  // -------------------------------------------------------------------------------------------------------------------
695 
696  UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
697 
698  Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
699  Int           getIntraDirLumaPredictor        ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL );
700 
701  // -------------------------------------------------------------------------------------------------------------------
702  // member functions for SBAC context
703  // -------------------------------------------------------------------------------------------------------------------
704 
705  UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
706  UInt          getCtxQtCbf                     ( TextType eType, UInt uiTrDepth );
707
708  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
709  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
710 
711#if H_3D_ARP
712  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
713#endif 
714  UInt          getSliceStartCU         ( UInt pos )                  { return m_sliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
715  UInt          getSliceSegmentStartCU  ( UInt pos )                  { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
716  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
717  // -------------------------------------------------------------------------------------------------------------------
718  // member functions for RD cost storage
719  // -------------------------------------------------------------------------------------------------------------------
720 
721  Double&       getTotalCost()                  { return m_dTotalCost;        }
722#if H_3D_VSO
723  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
724#else
725  UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
726#endif
727  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
728  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
729
730  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
731
732#if H_3D_DDD
733  UChar*       getDDDepth        ()                        { return m_pucDisparityDerivedDepth;        }
734  UChar        getDDDepth        ( UInt uiIdx )            { return m_pucDisparityDerivedDepth[uiIdx]; }
735  Void         setDDDepth        ( UInt uiIdx, UChar n )   { m_pucDisparityDerivedDepth[uiIdx] = n;    }
736  Void         setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
737
738  Bool*        getUseDDD        ()                        { return m_pbUseDDD;        }
739  Bool         getUseDDD        ( UInt uiIdx )            { return m_pbUseDDD[uiIdx]; }
740  Void         setUseDDD        ( UInt uiIdx, Bool n )     { m_pbUseDDD[uiIdx] = n;    }
741  Void         setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth );
742
743  Void         setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
744
745  UChar        getDDTmpDepth(){ return m_ucDDTmpDepth; }
746  Int          getUseDDDCandIdx(){ return m_iUseDDDCandIdx;}
747
748#endif
749};
750
751namespace RasterAddress
752{
753  /** Check whether 2 addresses point to the same column
754   * \param addrA          First address in raster scan order
755   * \param addrB          Second address in raters scan order
756   * \param numUnitsPerRow Number of units in a row
757   * \return Result of test
758   */
759  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
760  {
761    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
762    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
763  }
764 
765  /** Check whether 2 addresses point to the same row
766   * \param addrA          First address in raster scan order
767   * \param addrB          Second address in raters scan order
768   * \param numUnitsPerRow Number of units in a row
769   * \return Result of test
770   */
771  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
772  {
773    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
774    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
775  }
776 
777  /** Check whether 2 addresses point to the same row or column
778   * \param addrA          First address in raster scan order
779   * \param addrB          Second address in raters scan order
780   * \param numUnitsPerRow Number of units in a row
781   * \return Result of test
782   */
783  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
784  {
785    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
786  }
787 
788  /** Check whether one address points to the first column
789   * \param addr           Address in raster scan order
790   * \param numUnitsPerRow Number of units in a row
791   * \return Result of test
792   */
793  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
794  {
795    // addr % numUnitsPerRow == 0
796    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
797  }
798 
799  /** Check whether one address points to the first row
800   * \param addr           Address in raster scan order
801   * \param numUnitsPerRow Number of units in a row
802   * \return Result of test
803   */
804  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
805  {
806    // addr / numUnitsPerRow == 0
807    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
808  }
809 
810  /** Check whether one address points to a column whose index is smaller than a given value
811   * \param addr           Address in raster scan order
812   * \param val            Given column index value
813   * \param numUnitsPerRow Number of units in a row
814   * \return Result of test
815   */
816  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
817  {
818    // addr % numUnitsPerRow < val
819    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
820  }
821 
822  /** Check whether one address points to a row whose index is smaller than a given value
823   * \param addr           Address in raster scan order
824   * \param val            Given row index value
825   * \param numUnitsPerRow Number of units in a row
826   * \return Result of test
827   */
828  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
829  {
830    // addr / numUnitsPerRow < val
831    return addr < val * numUnitsPerRow;
832  }
833};
834
835//! \}
836
837#endif
Note: See TracBrowser for help on using the repository browser.