source: 3DVCSoftware/branches/HTM-10.2-dev0/source/Lib/TLibCommon/TComDataCU.h @ 936

Last change on this file since 936 was 936, checked in by tech, 10 years ago

Merged 10.2-dev2-MediaTek@930.

  • Property svn:eol-style set to native
File size: 47.8 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6* Copyright (c) 2010-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_DBBP_NO_SPU_H0057
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
237#if ETRIKHU_CLEANUP_H0083
238  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
239  Int           m_baseListidc;
240#endif
241
242protected:
243 
244  /// add possible motion vector predictor candidates
245  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
246  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
247#if H_3D_VSP
248#if ETRIKHU_CLEANUP_H0083
249  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
250#else
251  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
252                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
253#endif
254#endif
255#if H_3D_IV_MERGE
256#if ETRIKHU_CLEANUP_H0083
257  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); 
258#else
259  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
260                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   ); 
261#endif
262#if ETRIKHU_CLEANUP_H0083
263  Bool          xGetPosFirstAvailDmvCand( Int iCount, Int& iFirDispCand );
264#else
265  Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
266#endif
267#endif
268
269  Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
270  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
271#if H_3D_TMVP
272  ,
273  Bool bMRG = true
274#endif
275  );
276 
277  /// compute required bits to encode MVD (used in AMVP)
278  UInt          xGetMvdBits           ( TComMv cMvd );
279  UInt          xGetComponentBits     ( Int iVal );
280 
281  /// compute scaling factor from POC difference
282#if !H_3D_ARP
283  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
284#endif
285
286  Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
287
288#if H_3D_VSP
289  Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
290#endif
291
292public:
293  TComDataCU();
294  virtual ~TComDataCU();
295 
296  // -------------------------------------------------------------------------------------------------------------------
297  // create / destroy / initialize / copy
298  // -------------------------------------------------------------------------------------------------------------------
299#if H_3D_ARP
300  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
301#endif
302  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
303#if ADAPTIVE_QP_SELECTION
304    , Bool bGlobalRMARLBuffer = false
305#endif 
306    );
307  Void          destroy               ();
308 
309  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
310  Void          initEstData           ( UInt uiDepth, Int qp, Bool bTransquantBypass );
311  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
312  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
313#if H_3D_NBDV
314  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
315#endif
316  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
317  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
318#if H_3D_NBDV
319  , Bool bNBDV = false
320#endif
321  );
322  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
323 
324  Void          copyToPic             ( UChar uiDepth );
325  Void          copyToPic             ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth );
326 
327  // -------------------------------------------------------------------------------------------------------------------
328  // member functions for CU description
329  // -------------------------------------------------------------------------------------------------------------------
330 
331  TComPic*      getPic                ()                        { return m_pcPic;           }
332  TComSlice*    getSlice              ()                        { return m_pcSlice;         }
333  UInt&         getAddr               ()                        { return m_uiCUAddr;        }
334  UInt&         getZorderIdxInCU      ()                        { return m_uiAbsIdxInLCU; }
335  UInt          getSCUAddr            ();
336  UInt          getCUPelX             ()                        { return m_uiCUPelX;        }
337  UInt          getCUPelY             ()                        { return m_uiCUPelY;        }
338  TComPattern*  getPattern            ()                        { return m_pcPattern;       }
339 
340  UChar*        getDepth              ()                        { return m_puhDepth;        }
341  UChar         getDepth              ( UInt uiIdx )            { return m_puhDepth[uiIdx]; }
342  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
343 
344  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
345#if H_3D
346  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
347#endif
348 
349  // -------------------------------------------------------------------------------------------------------------------
350  // member functions for CU data
351  // -------------------------------------------------------------------------------------------------------------------
352 
353  Char*         getPartitionSize      ()                        { return m_pePartSize;        }
354  PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
355  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
356  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
357  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
358 
359#if H_3D_DBBP
360  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
361#endif
362 
363  Bool*        getSkipFlag            ()                        { return m_skipFlag;          }
364  Bool         getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
365  Void         setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
366  Void         setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
367
368  Char*         getPredictionMode     ()                        { return m_pePredMode;        }
369  PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
370  Bool*         getCUTransquantBypass ()                        { return m_CUTransquantBypass;        }
371  Bool          getCUTransquantBypass( UInt uiIdx )             { return m_CUTransquantBypass[uiIdx]; }
372  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
373  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
374 
375#if H_3D_DBBP
376  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
377  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
378  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
379  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
380  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
381#endif
382 
383  UChar*        getWidth              ()                        { return m_puhWidth;          }
384  UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
385  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
386 
387  UChar*        getHeight             ()                        { return m_puhHeight;         }
388  UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
389  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
390 
391  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
392 
393  Char*         getQP                 ()                        { return m_phQP;              }
394  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
395  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
396  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
397  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
398  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
399  Void          setQPSubCUs           ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );
400  Void          setCodedQP            ( Char qp )               { m_codedQP = qp;             }
401  Char          getCodedQP            ()                        { return m_codedQP;           }
402
403  Bool          isLosslessCoded(UInt absPartIdx);
404 
405  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
406  UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
407  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
408
409  UChar*        getTransformSkip      ( TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];}
410  UChar         getTransformSkip      ( UInt uiIdx,TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];}
411  Void          setTransformSkipSubParts  ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); 
412  Void          setTransformSkipSubParts  ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth );
413
414  UInt          getQuadtreeTULog2MinSizeInCU( UInt absPartIdx );
415 
416  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
417 
418  TCoeff*&      getCoeffY             ()                        { return m_pcTrCoeffY;        }
419  TCoeff*&      getCoeffCb            ()                        { return m_pcTrCoeffCb;       }
420  TCoeff*&      getCoeffCr            ()                        { return m_pcTrCoeffCr;       }
421#if ADAPTIVE_QP_SELECTION
422  Int*&         getArlCoeffY          ()                        { return m_pcArlCoeffY;       }
423  Int*&         getArlCoeffCb         ()                        { return m_pcArlCoeffCb;      }
424  Int*&         getArlCoeffCr         ()                        { return m_pcArlCoeffCr;      }
425#endif
426 
427  Pel*&         getPCMSampleY         ()                        { return m_pcIPCMSampleY;     }
428  Pel*&         getPCMSampleCb        ()                        { return m_pcIPCMSampleCb;    }
429  Pel*&         getPCMSampleCr        ()                        { return m_pcIPCMSampleCr;    }
430
431  UChar         getCbf    ( UInt uiIdx, TextType eType )                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];  }
432  UChar*        getCbf    ( TextType eType )                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];         }
433  UChar         getCbf    ( UInt uiIdx, TextType eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
434  Void          setCbf    ( UInt uiIdx, TextType eType, UChar uh )        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;    }
435  Void          clearCbf  ( UInt uiIdx, TextType eType, UInt uiNumParts );
436  UChar         getQtRootCbf          ( UInt uiIdx )                      { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); }
437 
438  Void          setCbfSubParts        ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth          );
439  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth                    );
440  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
441 
442  // -------------------------------------------------------------------------------------------------------------------
443  // member functions for coding tool information
444  // -------------------------------------------------------------------------------------------------------------------
445 
446  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
447  Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
448  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
449  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
450
451  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
452  UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
453  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
454  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
455  template <typename T>
456  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
457#if H_3D_VSP
458  template<typename T>
459  Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
460#endif
461#if AMP_MRG
462  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
463  Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
464#endif
465
466  UChar*        getLumaIntraDir       ()                        { return m_puhLumaIntraDir;           }
467  UChar         getLumaIntraDir       ( UInt uiIdx )            { return m_puhLumaIntraDir[uiIdx];    }
468  Void          setLumaIntraDir       ( UInt uiIdx, UChar  uh ) { m_puhLumaIntraDir[uiIdx] = uh;      }
469  Void          setLumaIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
470 
471  UChar*        getChromaIntraDir     ()                        { return m_puhChromaIntraDir;         }
472  UChar         getChromaIntraDir     ( UInt uiIdx )            { return m_puhChromaIntraDir[uiIdx];  }
473  Void          setChromaIntraDir     ( UInt uiIdx, UChar  uh ) { m_puhChromaIntraDir[uiIdx] = uh;    }
474  Void          setChromIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
475 
476  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
477  UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
478  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
479  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
480  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
481  Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
482  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
483  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
484#if H_3D_NBDV
485  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
486  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
487  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
488  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
489#endif
490#if H_3D_NBDV
491  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
492  Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
493                                   UInt uiMvpDvPos
494#if H_3D_NBDV_REF
495  , Bool bDepthRefine = false
496#endif
497  );
498  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
499  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
500#if H_3D_NBDV_REF
501   , Bool bDepthRefine = false
502#endif
503   ); 
504   
505#if H_3D
506#if !ETRIKHU_CLEANUP_H0083
507  Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
508#endif
509  Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
510  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
511#endif
512
513#if H_3D_NBDV_REF
514  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
515  Void          estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );
516#endif //H_3D_NBDV_REF
517#endif
518#if  H_3D_FAST_TEXTURE_ENCODING
519  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
520#endif
521#if H_3D_SPIVMP
522  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
523  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
524  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
525#endif
526#if H_3D_IV_MERGE
527  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth           
528
529#if H_3D_SPIVMP
530    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
531#endif
532#if SEC_ADAPT_DISABLE_IVMP
533    , Bool bICFlag
534#endif
535    );   
536#endif
537#if H_3D_ARP
538  UChar*        getARPW            ()                        { return m_puhARPW;               }
539  UChar         getARPW            ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
540  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
541  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
542  Double        getARPWFactor      ( UInt uiIdx );
543#endif
544#if H_3D_IC
545  Bool*         getICFlag          ()                        { return m_pbICFlag;               }
546  Bool          getICFlag          ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
547  Void          setICFlag          ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
548  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
549  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
550  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
551#else
552  // -------------------------------------------------------------------------------------------------------------------
553  // member functions for accessing partition information
554  // -------------------------------------------------------------------------------------------------------------------
555 
556  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
557#endif
558  UChar         getNumPartInter       ();
559  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
560
561#if H_3D_DIM
562  Pel*  getDimDeltaDC                 ( UInt dimType, UInt segId )                      { return m_dimDeltaDC[dimType][segId];        } 
563  Pel   getDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx )          { return m_dimDeltaDC[dimType][segId][uiIdx]; } 
564  Void  setDimDeltaDC                 ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val;  }
565#if H_3D_DIM_DMM
566  UInt* getDmmWedgeTabIdx             ( UInt dmmType )                          { return m_dmmWedgeTabIdx[dmmType];          }       
567  UInt  getDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx )              { return m_dmmWedgeTabIdx[dmmType][uiIdx];   }
568  Void  setDmmWedgeTabIdx             ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; }
569  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
570
571#endif
572#if H_3D_DIM_SDC
573  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
574  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
575  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );
576 
577  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
578 
579  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
580  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
581  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
582  UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
583  UInt          getCtxAngleFlag        ( UInt   uiAbsPartIdx );
584#endif
585#endif
586 
587  // -------------------------------------------------------------------------------------------------------------------
588  // member functions for motion vector
589  // -------------------------------------------------------------------------------------------------------------------
590 
591  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
592 
593  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
594  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
595  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
596  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
597  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
598  Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
599
600  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
601  Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
602  Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
603 
604  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
605  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
606 
607  Void          clipMv                ( TComMv&     rcMv     );
608  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
609  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
610  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
611#if H_3D
612  Void          compressMV            ( Int scale );
613#else           
614  Void          compressMV            ();
615#endif 
616  // -------------------------------------------------------------------------------------------------------------------
617  // utility functions for neighbouring information
618  // -------------------------------------------------------------------------------------------------------------------
619 
620  TComDataCU*   getCULeft                   () { return m_pcCULeft;       }
621  TComDataCU*   getCUAbove                  () { return m_pcCUAbove;      }
622  TComDataCU*   getCUAboveLeft              () { return m_pcCUAboveLeft;  }
623  TComDataCU*   getCUAboveRight             () { return m_pcCUAboveRight; }
624  TComDataCU*   getCUColocated              ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; }
625
626
627  TComDataCU*   getPULeft                   ( UInt&  uiLPartUnitIdx, 
628                                              UInt uiCurrPartUnitIdx, 
629                                              Bool bEnforceSliceRestriction=true, 
630                                              Bool bEnforceTileRestriction=true );
631  TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx,
632                                              UInt uiCurrPartUnitIdx, 
633                                              Bool bEnforceSliceRestriction=true, 
634                                              Bool planarAtLCUBoundary = false,
635                                              Bool bEnforceTileRestriction=true );
636  TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
637  TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
638  TComDataCU*   getPUBelowLeft              ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
639
640  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU );
641  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU );
642  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
643
644  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
645  TComDataCU*   getPUBelowLeftAdi           ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
646 
647  Void          deriveLeftRightTopIdx       ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
648  Void          deriveLeftBottomIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLB );
649 
650  Void          deriveLeftRightTopIdxAdi    ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth );
651  Void          deriveLeftBottomIdxAdi      ( UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth );
652 
653  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
654
655#if H_3D
656  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
657  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
658  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
659  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
660  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
661#if ETRIKHU_CLEANUP_H0083
662  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
663  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
664#if H_3D_VSP
665    , Int* vspFlag
666#endif
667#if H_3D_SPIVMP
668    , Bool* pbSPIVMPFlag
669#endif
670    , Int& numValidMergeCand
671    );
672#else
673  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
674#endif
675  Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
676  Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
677#else
678  Void          getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
679#endif
680#if H_3D_VSP
681#if !ETRIKHU_CLEANUP_H0083
682                                            , Int* vspFlag
683#endif
684                                            , InheritedVSPDisInfo*  inheritedVSPDisInfo
685#endif
686#if H_3D_SPIVMP
687#if ETRIKHU_CLEANUP_H0083
688                                            , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
689#else
690                                            , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
691#endif
692#endif
693                                            , Int& numValidMergeCand, Int mrgCandIdx = -1
694                                            );
695
696#if H_3D_VSP
697  inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
698
699#if H_3D_SPIVMP
700  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
701  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
702  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
703  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
704#endif
705
706  Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
707  Char          getVSPFlag        ( UInt uiIdx )            { return m_piVSPFlag[uiIdx];   }
708  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
709  Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
710  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
711#endif
712  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
713  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
714 
715 
716  // -------------------------------------------------------------------------------------------------------------------
717  // member functions for modes
718  // -------------------------------------------------------------------------------------------------------------------
719 
720  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
721  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
722  Bool          isBipredRestriction( UInt puIdx );
723
724#if H_3D_IC
725  Bool          isIC      ( UInt uiPartIdx );
726#endif
727
728  // -------------------------------------------------------------------------------------------------------------------
729  // member functions for symbol prediction (most probable / mode conversion)
730  // -------------------------------------------------------------------------------------------------------------------
731 
732  UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
733 
734  Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
735  Int           getIntraDirLumaPredictor        ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL );
736 
737  // -------------------------------------------------------------------------------------------------------------------
738  // member functions for SBAC context
739  // -------------------------------------------------------------------------------------------------------------------
740 
741  UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
742  UInt          getCtxQtCbf                     ( TextType eType, UInt uiTrDepth );
743
744  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
745  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
746 
747#if H_3D_ARP
748  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
749#endif 
750  UInt          getSliceStartCU         ( UInt pos )                  { return m_sliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
751  UInt          getSliceSegmentStartCU  ( UInt pos )                  { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
752  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
753  // -------------------------------------------------------------------------------------------------------------------
754  // member functions for RD cost storage
755  // -------------------------------------------------------------------------------------------------------------------
756 
757  Double&       getTotalCost()                  { return m_dTotalCost;        }
758#if H_3D_VSO
759  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
760#else
761  UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
762#endif
763  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
764  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
765
766  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
767
768#if H_3D_DDD
769  UChar*       getDDDepth        ()                        { return m_pucDisparityDerivedDepth;        }
770  UChar        getDDDepth        ( UInt uiIdx )            { return m_pucDisparityDerivedDepth[uiIdx]; }
771  Void         setDDDepth        ( UInt uiIdx, UChar n )   { m_pucDisparityDerivedDepth[uiIdx] = n;    }
772  Void         setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
773
774  Bool*        getUseDDD        ()                        { return m_pbUseDDD;        }
775  Bool         getUseDDD        ( UInt uiIdx )            { return m_pbUseDDD[uiIdx]; }
776  Void         setUseDDD        ( UInt uiIdx, Bool n )     { m_pbUseDDD[uiIdx] = n;    }
777  Void         setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth );
778
779  Void         setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
780
781  UChar        getDDTmpDepth(){ return m_ucDDTmpDepth; }
782  Int          getUseDDDCandIdx(){ return m_iUseDDDCandIdx;}
783
784#endif
785};
786
787namespace RasterAddress
788{
789  /** Check whether 2 addresses point to the same column
790   * \param addrA          First address in raster scan order
791   * \param addrB          Second address in raters scan order
792   * \param numUnitsPerRow Number of units in a row
793   * \return Result of test
794   */
795  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
796  {
797    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
798    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
799  }
800 
801  /** Check whether 2 addresses point to the same row
802   * \param addrA          First address in raster scan order
803   * \param addrB          Second address in raters scan order
804   * \param numUnitsPerRow Number of units in a row
805   * \return Result of test
806   */
807  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
808  {
809    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
810    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
811  }
812 
813  /** Check whether 2 addresses point to the same row or column
814   * \param addrA          First address in raster scan order
815   * \param addrB          Second address in raters scan order
816   * \param numUnitsPerRow Number of units in a row
817   * \return Result of test
818   */
819  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
820  {
821    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
822  }
823 
824  /** Check whether one address points to the first column
825   * \param addr           Address in raster scan order
826   * \param numUnitsPerRow Number of units in a row
827   * \return Result of test
828   */
829  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
830  {
831    // addr % numUnitsPerRow == 0
832    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
833  }
834 
835  /** Check whether one address points to the first row
836   * \param addr           Address in raster scan order
837   * \param numUnitsPerRow Number of units in a row
838   * \return Result of test
839   */
840  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
841  {
842    // addr / numUnitsPerRow == 0
843    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
844  }
845 
846  /** Check whether one address points to a column whose index is smaller than a given value
847   * \param addr           Address in raster scan order
848   * \param val            Given column index value
849   * \param numUnitsPerRow Number of units in a row
850   * \return Result of test
851   */
852  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
853  {
854    // addr % numUnitsPerRow < val
855    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
856  }
857 
858  /** Check whether one address points to a row whose index is smaller than a given value
859   * \param addr           Address in raster scan order
860   * \param val            Given row index value
861   * \param numUnitsPerRow Number of units in a row
862   * \return Result of test
863   */
864  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
865  {
866    // addr / numUnitsPerRow < val
867    return addr < val * numUnitsPerRow;
868  }
869};
870
871//! \}
872
873#endif
Note: See TracBrowser for help on using the repository browser.