source: 3DVCSoftware/branches/HTM-10.2-dev1-Samsung/source/Lib/TLibCommon/TComDataCU.h @ 917

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

Integration of JCT3V-H0070: Adaptive Disabling IVMP

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