source: 3DVCSoftware/branches/HTM-10.2-dev2-RWTH/source/Lib/TLibCommon/TComDataCU.h @ 895

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