source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComDataCU.h @ 443

Last change on this file since 443 was 443, checked in by tech, 11 years ago
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
  • Property svn:eol-style set to native
File size: 56.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-2012, 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 H3D_IVRP
52#include "TComYuv.h"
53#endif
54
55#include <algorithm>
56#include <vector>
57
58//! \ingroup TLibCommon
59//! \{
60
61// ====================================================================================================================
62// Non-deblocking in-loop filter processing block data structure
63// ====================================================================================================================
64
65/// Non-deblocking filter processing block border tag
66enum NDBFBlockBorderTag
67{
68  SGU_L = 0,
69  SGU_R,
70  SGU_T,
71  SGU_B,
72  SGU_TL,
73  SGU_TR,
74  SGU_BL,
75  SGU_BR,
76  NUM_SGU_BORDER
77};
78
79/// Non-deblocking filter processing block information
80struct NDBFBlockInfo
81{
82  Int   tileID;   //!< tile ID
83  Int   sliceID;  //!< slice ID
84  UInt  startSU;  //!< starting SU z-scan address in LCU
85  UInt  endSU;    //!< ending SU z-scan address in LCU
86  UInt  widthSU;  //!< number of SUs in width
87  UInt  heightSU; //!< number of SUs in height
88  UInt  posX;     //!< top-left X coordinate in picture
89  UInt  posY;     //!< top-left Y coordinate in picture
90  UInt  width;    //!< number of pixels in width
91  UInt  height;   //!< number of pixels in height
92  Bool  isBorderAvailable[NUM_SGU_BORDER];  //!< the border availabilities
93  Bool  allBordersAvailable;
94
95  NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor
96  const NDBFBlockInfo& operator= (const NDBFBlockInfo& src);  //!< "=" operator
97};
98
99
100// ====================================================================================================================
101// Class definition
102// ====================================================================================================================
103
104/// CU data structure class
105class TComDataCU
106{
107private:
108 
109  // -------------------------------------------------------------------------------------------------------------------
110  // class pointers
111  // -------------------------------------------------------------------------------------------------------------------
112 
113  TComPic*      m_pcPic;              ///< picture class pointer
114  TComSlice*    m_pcSlice;            ///< slice header pointer
115  TComPattern*  m_pcPattern;          ///< neighbour access class pointer
116 
117  // -------------------------------------------------------------------------------------------------------------------
118  // CU description
119  // -------------------------------------------------------------------------------------------------------------------
120 
121  UInt          m_uiCUAddr;           ///< CU address in a slice
122  UInt          m_uiAbsIdxInLCU;      ///< absolute address in a CU. It's Z scan order
123  UInt          m_uiCUPelX;           ///< CU position in a pixel (X)
124  UInt          m_uiCUPelY;           ///< CU position in a pixel (Y)
125  UInt          m_uiNumPartition;     ///< total number of minimum partitions in a CU
126  UChar*        m_puhWidth;           ///< array of widths
127  UChar*        m_puhHeight;          ///< array of heights
128  UChar*        m_puhDepth;           ///< array of depths
129  Int           m_unitSize;           ///< size of a "minimum partition"
130#if HHI_MPI
131  Int*          m_piTextureModeDepth; ///< at which depth are prediction data inherited from texture picture ( -1 : none )
132#endif
133 
134  // -------------------------------------------------------------------------------------------------------------------
135  // CU data
136  // -------------------------------------------------------------------------------------------------------------------
137 
138  Char*         m_pePartSize;         ///< array of partition sizes
139#if HHI_INTERVIEW_SKIP
140  Bool*         m_pbRenderable;        ///< array of merge flags
141#endif
142  Char*         m_pePredMode;         ///< array of prediction modes
143  Char*         m_phQP;               ///< array of QP values
144  UChar*        m_puhTrIdx;           ///< array of transform indices
145  UChar*        m_nsqtPartIdx;        ///< array of absPartIdx mapping table, map zigzag to NSQT
146  UChar*        m_puhCbf[3];          ///< array of coded block flags (CBF)
147  TComCUMvField m_acCUMvField[2];     ///< array of motion vectors
148  TCoeff*       m_pcTrCoeffY;         ///< transformed coefficient buffer (Y)
149  TCoeff*       m_pcTrCoeffCb;        ///< transformed coefficient buffer (Cb)
150  TCoeff*       m_pcTrCoeffCr;        ///< transformed coefficient buffer (Cr)
151#if ADAPTIVE_QP_SELECTION
152  Int*          m_pcArlCoeffY;        ///< ARL coefficient buffer (Y)
153  Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
154  Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
155  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
156
157  static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
158  static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
159  static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
160
161#endif
162 
163  Pel*          m_pcIPCMSampleY;      ///< PCM sample buffer (Y)
164  Pel*          m_pcIPCMSampleCb;     ///< PCM sample buffer (Cb)
165  Pel*          m_pcIPCMSampleCr;     ///< PCM sample buffer (Cr)
166
167  Int*          m_piSliceSUMap;       ///< pointer of slice ID map
168  std::vector<NDBFBlockInfo> m_vNDFBlock;
169
170  // -------------------------------------------------------------------------------------------------------------------
171  // neighbour access variables
172  // -------------------------------------------------------------------------------------------------------------------
173 
174  TComDataCU*   m_pcCUAboveLeft;      ///< pointer of above-left CU
175  TComDataCU*   m_pcCUAboveRight;     ///< pointer of above-right CU
176  TComDataCU*   m_pcCUAbove;          ///< pointer of above CU
177  TComDataCU*   m_pcCULeft;           ///< pointer of left CU
178  TComDataCU*   m_apcCUColocated[2];  ///< pointer of temporally colocated CU's for both directions
179  TComMvField   m_cMvFieldA;          ///< motion vector of position A
180  TComMvField   m_cMvFieldB;          ///< motion vector of position B
181  TComMvField   m_cMvFieldC;          ///< motion vector of position C
182  TComMv        m_cMvPred;            ///< motion vector predictor
183 
184  // -------------------------------------------------------------------------------------------------------------------
185  // coding tool information
186  // -------------------------------------------------------------------------------------------------------------------
187 
188  Bool*         m_pbMergeFlag;        ///< array of merge flags
189#if LGE_ILLUCOMP_B0045
190  Bool*         m_pbICFlag;           ///< array of IC flags
191#endif
192  UChar*        m_puhMergeIndex;      ///< array of merge candidate indices
193#if MERL_VSP_C0152
194  Char*         m_piVSPIndex;         ///< array of VSP flags to indicate the current block uses synthetic predictor or not
195                                      ///< value 0: non-VSP, value 1: VSP
196#endif
197#if MERL_VSP_NBDV_RefVId_Fix_D0166
198  Char*         m_piVSPDir;           ///< 0: LIST0; 1: LIST1
199#endif
200#if AMP_MRG
201  Bool          m_bIsMergeAMP;
202#endif
203  UChar*        m_puhLumaIntraDir;    ///< array of intra directions (luma)
204  UChar*        m_puhChromaIntraDir;  ///< array of intra directions (chroma)
205  UChar*        m_puhInterDir;        ///< array of inter directions
206  Char*         m_apiMVPIdx[2];       ///< array of motion vector predictor candidates
207  Char*         m_apiMVPNum[2];       ///< array of number of possible motion vectors predictors
208  Bool*         m_puiAlfCtrlFlag;     ///< array of ALF flags
209  Bool*         m_puiTmpAlfCtrlFlag;  ///< temporal array of ALF flags
210 
211  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
212
213  Int           m_numSucIPCM;         ///< the number of succesive IPCM blocks associated with the current log2CUSize
214  Bool          m_lastCUSucIPCMFlag;  ///< True indicates that the last CU is IPCM and shares the same root as the current CU. 
215#if H3D_IVRP
216  Bool*         m_pbResPredAvailable; ///< array of residual prediction available flags
217  Bool*         m_pbResPredFlag;      ///< array of residual prediction flags
218#endif
219#if QC_ARP_D0177
220  UChar*        m_puhARPW;
221#endif
222#if LGE_EDGE_INTRA_A0070
223  UChar*        m_pucEdgeCode;          ///< array of edge code
224  UChar*        m_pucEdgeNumber;        ///< total number of edge
225  UChar*        m_pucEdgeStartPos;      ///< starting point position
226  Bool*         m_pbEdgeLeftFirst;      ///< true if edge should be checked in left boundary first
227  Bool*         m_pbEdgePartition;      ///< true if it belongs to region 1, otherwise, region 0
228#if LGE_EDGE_INTRA_DELTA_DC
229  Int*          m_piEdgeDeltaDC0;
230  Int*          m_piEdgeDeltaDC1;
231#endif
232#endif
233
234  // -------------------------------------------------------------------------------------------------------------------
235  // misc. variables
236  // -------------------------------------------------------------------------------------------------------------------
237 
238  Bool          m_bDecSubCu;          ///< indicates decoder-mode
239  Double        m_dTotalCost;         ///< sum of partition RD costs
240  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
241  UInt          m_uiTotalBits;        ///< sum of partition bits
242  UInt          m_uiTotalBins;       ///< sum of partition bins
243  UInt*         m_uiSliceStartCU;    ///< Start CU address of current slice
244  UInt*         m_uiEntropySliceStartCU; ///< Start CU address of current slice
245 
246  // -------------------------------------------------------------------------------------------------------------------
247  // depth model mode data
248  // -------------------------------------------------------------------------------------------------------------------
249#if HHI_DMM_WEDGE_INTRA
250  UInt*         m_puiWedgeFullTabIdx;
251  Int*          m_piWedgeFullDeltaDC1;
252  Int*          m_piWedgeFullDeltaDC2;
253
254  UInt*         m_puiWedgePredDirTabIdx;
255  Int*          m_piWedgePredDirDeltaDC1;
256  Int*          m_piWedgePredDirDeltaDC2;
257  Int*          m_piWedgePredDirDeltaEnd;
258#endif
259#if HHI_DMM_PRED_TEX
260  UInt*         m_puiWedgePredTexTabIdx;
261#if LGE_DMM3_SIMP_C0044
262  UInt*         m_puiWedgePredTexIntraTabIdx;
263#endif
264  Int*          m_piWedgePredTexDeltaDC1;
265  Int*          m_piWedgePredTexDeltaDC2;
266
267  Int*          m_piContourPredTexDeltaDC1;
268  Int*          m_piContourPredTexDeltaDC2;
269#endif
270 
271#if RWTH_SDC_DLT_B0036
272  Bool*         m_pbSDCFlag;
273  Pel*          m_apSegmentDCOffset[2];
274#endif
275#if QC_CU_NBDV_D0181
276  DisInfo*      m_pDvInfo;
277#endif
278protected:
279 
280  /// add possible motion vector predictor candidates
281  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
282  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
283#if MERL_VSP_C0152
284  inline Bool   xAddVspMergeCand      ( 
285 UChar ucVspMergePos,
286#if !LGE_VSP_INHERIT_D0092
287 Int vspIdx,
288 Bool* bVspMvZeroDone,
289#endif
290 UInt uiDepth,
291 Bool* abCandIsInter,
292 Int& iCount,
293 UChar* puhInterDirNeighbours,
294 TComMvField* pcMvFieldNeighbours,
295 Int* iVSPIndexTrue,
296 Int mrgCandIdx,
297 DisInfo* pDisInfo
298#if MERL_VSP_NBDV_RefVId_Fix_D0166
299 , Int*   iVspDirTrue = NULL
300#endif
301                                        );
302  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
303#if QC_BVSP_CleanUP_D0191
304   ,UChar *puhInterDirNeighbours
305#endif
306#if MERL_VSP_NBDV_RefVId_Fix_D0166
307                                      , Int *iVSPDirTrue
308#endif
309    ) ;
310#endif
311  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
312  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
313#if QC_TMVP_MRG_REFIDX_C0047
314  ,
315  Bool bMRG = 0
316#endif
317  );
318#if H3D_NBDV
319  Void          xDeriveRightBottomNbIdx( PartSize eCUMode, UInt uiPartIdx, Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
320  Bool          xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, UInt uiPartIdx, UInt uiPartAddr, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, McpDisInfo* paMvpDvInfo, UInt uiMvpDvPos, Bool bDepthRefine );
321  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
322#endif
323 
324
325  Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand );
326  /// compute required bits to encode MVD (used in AMVP)
327  UInt          xGetMvdBits           ( TComMv cMvd );
328  UInt          xGetComponentBits     ( Int iVal );
329 
330  /// compute scaling factor from POC difference
331#if !QC_ARP_D0177
332  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
333#endif
334  Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter );
335  Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv );
336 
337  Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr);
338
339
340public:
341  TComDataCU();
342  virtual ~TComDataCU();
343 
344  // -------------------------------------------------------------------------------------------------------------------
345  // create / destroy / initialize / copy
346  // -------------------------------------------------------------------------------------------------------------------
347#if QC_ARP_D0177
348  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
349#endif 
350
351  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
352#if ADAPTIVE_QP_SELECTION
353    , Bool bGlobalRMARLBuffer = false
354#endif 
355    );
356  Void          destroy               ();
357 
358  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
359  Void          initEstData           ( UInt uiDepth, Int qp );
360  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
361  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
362#if QC_CU_NBDV_D0181
363  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
364#endif
365  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
366  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
367#if QC_CU_NBDV_D0181
368  , Bool bNBDV = false
369#endif
370  );
371  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth
372#if QC_ARP_D0177
373      ,
374      Bool bRP = false
375#endif
376  );
377 
378  Void          copyToPic             ( UChar uiDepth );
379  Void          copyToPic             ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth );
380 
381  // -------------------------------------------------------------------------------------------------------------------
382  // member functions for CU description
383  // -------------------------------------------------------------------------------------------------------------------
384 
385  TComPic*      getPic                ()                        { return m_pcPic;           }
386  TComSlice*    getSlice              ()                        { return m_pcSlice;         }
387  UInt&         getAddr               ()                        { return m_uiCUAddr;        }
388  UInt&         getZorderIdxInCU      ()                        { return m_uiAbsIdxInLCU; }
389  UInt          getSCUAddr            ();
390  UInt          getCUPelX             ()                        { return m_uiCUPelX;        }
391  UInt          getCUPelY             ()                        { return m_uiCUPelY;        }
392  TComPattern*  getPattern            ()                        { return m_pcPattern;       }
393 
394  UChar*        getDepth              ()                        { return m_puhDepth;        }
395  UChar         getDepth              ( UInt uiIdx )            { return m_puhDepth[uiIdx]; }
396  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
397 
398  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
399  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
400#if HHI_MPI
401  Int*          getTextureModeDepth   ()                        { return m_piTextureModeDepth; }
402  Int           getTextureModeDepth   ( UInt uiIdx )            { return m_piTextureModeDepth[uiIdx]; }
403  Void          setTextureModeDepth   ( UInt uiIdx, Int iTextureModeDepth ){ m_piTextureModeDepth[uiIdx] = iTextureModeDepth; }
404  Void          setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth );
405  Void          copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 );
406#endif
407
408   // -------------------------------------------------------------------------------------------------------------------
409  // member functions for CU data
410  // -------------------------------------------------------------------------------------------------------------------
411 
412  Char*         getPartitionSize      ()                        { return m_pePartSize;        }
413  PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
414  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
415  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
416 
417#if HHI_INTERVIEW_SKIP
418  Bool*         getRenderable          ()                        { return m_pbRenderable;               }
419    Bool          getRenderable          ( UInt uiIdx )            { return m_pbRenderable[uiIdx];        }
420    Void          setRenderable          ( UInt uiIdx, Bool b )    { m_pbRenderable[uiIdx] = b;           }
421    Void          setRenderableSubParts  ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth );
422#endif
423 
424  Char*         getPredictionMode     ()                        { return m_pePredMode;        }
425  PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
426  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
427  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
428 
429  UChar*        getWidth              ()                        { return m_puhWidth;          }
430  UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
431  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
432 
433  UChar*        getHeight             ()                        { return m_puhHeight;         }
434  UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
435  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
436 
437  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
438 
439  Char*         getQP                 ()                        { return m_phQP;              }
440  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
441  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
442  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
443  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
444  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
445
446#if LOSSLESS_CODING
447  Bool          isLosslessCoded(UInt absPartIdx);
448#endif
449  UChar*        getNSQTPartIdx        ()                        { return m_nsqtPartIdx;        }
450  UChar         getNSQTPartIdx        ( UInt idx )              { return m_nsqtPartIdx[idx];   }
451  Void          setNSQTIdxSubParts    ( UInt absPartIdx, UInt depth );
452  Void          setNSQTIdxSubParts    ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode );
453 
454  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
455  UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
456  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
457 
458  UInt          getQuadtreeTULog2MinSizeInCU( UInt absPartIdx );
459 
460  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
461 
462  TCoeff*&      getCoeffY             ()                        { return m_pcTrCoeffY;        }
463  TCoeff*&      getCoeffCb            ()                        { return m_pcTrCoeffCb;       }
464  TCoeff*&      getCoeffCr            ()                        { return m_pcTrCoeffCr;       }
465#if ADAPTIVE_QP_SELECTION
466  Int*&         getArlCoeffY          ()                        { return m_pcArlCoeffY;       }
467  Int*&         getArlCoeffCb         ()                        { return m_pcArlCoeffCb;      }
468  Int*&         getArlCoeffCr         ()                        { return m_pcArlCoeffCr;      }
469#endif
470 
471  Pel*&         getPCMSampleY         ()                        { return m_pcIPCMSampleY;     }
472  Pel*&         getPCMSampleCb        ()                        { return m_pcIPCMSampleCb;    }
473  Pel*&         getPCMSampleCr        ()                        { return m_pcIPCMSampleCr;    }
474
475  UChar         getCbf    ( UInt uiIdx, TextType eType )                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];  }
476  UChar*        getCbf    ( TextType eType )                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];         }
477  UChar         getCbf    ( UInt uiIdx, TextType eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
478  Void          setCbf    ( UInt uiIdx, TextType eType, UChar uh )        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;    }
479  Void          clearCbf  ( UInt uiIdx, TextType eType, UInt uiNumParts );
480  UChar         getQtRootCbf          ( UInt uiIdx )                      { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); }
481 
482  Void          setCbfSubParts        ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth          );
483  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth                    );
484  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
485 
486  // -------------------------------------------------------------------------------------------------------------------
487  // member functions for coding tool information
488  // -------------------------------------------------------------------------------------------------------------------
489 
490  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
491  Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
492  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
493  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
494
495  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
496  UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
497  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
498  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
499
500#if MERL_VSP_C0152
501  Char*         getVSPIndex        ()                        { return m_piVSPIndex;        }
502  Char          getVSPIndex        ( UInt uiIdx )            { return m_piVSPIndex[uiIdx]; }
503  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
504  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
505#endif
506#if MERL_VSP_NBDV_RefVId_Fix_D0166
507  Char*         getVSPDir          ()                        { return m_piVSPDir;                           }
508  Char          getVSPDir          ( UInt uiIdx )            { return m_piVSPDir[uiIdx];                  }
509  Void          setVSPDir          ( UInt uiIdx, Int n )     { m_piVSPDir[uiIdx] = n;  }
510  Void          setVSPDirSubParts  ( Char bVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
511  Bool          getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx);
512#endif
513
514  template <typename T>
515  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
516
517#if LGE_ILLUCOMP_B0045
518  Bool*         getICFlag             ()                        { return m_pbICFlag;               }
519  Bool          getICFlag             ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
520  Void          setICFlag             ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
521  Void          setICFlagSubParts     ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
522#if LGE_ILLUCOMP_DEPTH_C0046
523  Bool          isICFlagRequired      (UInt uiAbsPartIdx, UInt uiDepth); //This modification is not needed after integrating JCT3V-C0137
524#else
525  Bool          isICFlagRequired      (UInt uiAbsPartIdx);
526#endif
527#endif
528#if QC_CU_NBDV_D0181
529  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                }
530  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];         }
531  Void          setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
532#endif
533
534#if AMP_MRG
535  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
536  Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
537#endif
538
539  UChar*        getLumaIntraDir       ()                        { return m_puhLumaIntraDir;           }
540  UChar         getLumaIntraDir       ( UInt uiIdx )            { return m_puhLumaIntraDir[uiIdx];    }
541  Void          setLumaIntraDir       ( UInt uiIdx, UChar  uh ) { m_puhLumaIntraDir[uiIdx] = uh;      }
542  Void          setLumaIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
543 
544  UChar*        getChromaIntraDir     ()                        { return m_puhChromaIntraDir;         }
545  UChar         getChromaIntraDir     ( UInt uiIdx )            { return m_puhChromaIntraDir[uiIdx];  }
546  Void          setChromaIntraDir     ( UInt uiIdx, UChar  uh ) { m_puhChromaIntraDir[uiIdx] = uh;    }
547  Void          setChromIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
548 
549  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
550  UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
551  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
552  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
553 
554  Bool*         getAlfCtrlFlag        ()                        { return m_puiAlfCtrlFlag;            }
555  Bool          getAlfCtrlFlag        ( UInt uiIdx )            { return m_puiAlfCtrlFlag[uiIdx];     }
556  Void          setAlfCtrlFlag        ( UInt uiIdx, Bool uiFlag){ m_puiAlfCtrlFlag[uiIdx] = uiFlag;   }
557  Void          setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth );
558 
559  Void          createTmpAlfCtrlFlag  ();
560  Void          destroyTmpAlfCtrlFlag ();
561  Void          copyAlfCtrlFlagToTmp  ();
562  Void          copyAlfCtrlFlagFromTmp();
563 
564  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
565  Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
566  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
567  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
568
569  Int           getNumSucIPCM         ()                        { return m_numSucIPCM;             }
570  Void          setNumSucIPCM         ( Int num )               { m_numSucIPCM = num;              }
571  Bool          getLastCUSucIPCMFlag  ()                        { return m_lastCUSucIPCMFlag;        }
572  Void          setLastCUSucIPCMFlag  ( Bool flg )              { m_lastCUSucIPCMFlag = flg;         }
573
574  /// get slice ID for SU
575  Int           getSUSliceID          (UInt uiIdx)              {return m_piSliceSUMap[uiIdx];      } 
576
577  /// get the pointer of slice ID map
578  Int*          getSliceSUMap         ()                        {return m_piSliceSUMap;             }
579
580  /// set the pointer of slice ID map
581  Void          setSliceSUMap         (Int *pi)                 {m_piSliceSUMap = pi;               }
582
583  std::vector<NDBFBlockInfo>* getNDBFilterBlocks()      {return &m_vNDFBlock;}
584  Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight
585                                          ,Bool bIndependentSliceBoundaryEnabled
586                                          ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary
587                                          ,Bool bIndependentTileBoundaryEnabled );
588
589#if H3D_IVMP
590#if !H3D_NBDV
591  Int           getPdmMergeCandidate      ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
592  Bool          getPdmMvPred              ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
593#else //!H3D_NBDV
594  Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
595  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
596#if QC_CU_NBDV_D0181
597  Bool          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
598#else
599  Void          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
600#endif
601#if MERL_VSP_C0152
602                              , Bool bDepthRefine = false
603#endif //MERL_VSP_C0152
604    );
605#endif // !H3D_NBDV
606
607
608
609#if MERL_VSP_C0152
610  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
611  Void          estimateDVFromDM(
612#if MERL_VSP_NBDV_RefVId_Fix_D0166
613                Int refViewIdx,
614#endif
615                UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
616#endif
617  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
618#endif //  H3D_IVMP
619#if H3D_IVRP
620  Bool*         getResPredAvail         ()                        { return m_pbResPredAvailable;        }
621  Bool          getResPredAvail         ( UInt uiIdx )            { return m_pbResPredAvailable[uiIdx]; }
622  Void          setResPredAvail         ( UInt uiIdx, Bool b )    { m_pbResPredAvailable[uiIdx] = b;    }
623  Void          setResPredAvailSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
624
625  Bool*         getResPredFlag          ()                        { return m_pbResPredFlag;        }
626  Bool          getResPredFlag          ( UInt uiIdx )            { return m_pbResPredFlag[uiIdx]; }
627  Void          setResPredFlag          ( UInt uiIdx, Bool b )    { m_pbResPredFlag[uiIdx] = b;    }
628  Void          setResPredFlagSubParts  ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
629
630  Void          setResPredIndicator     ( Bool bAv, Bool bRP )    { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; }
631#endif
632#if H3D_IVRP
633  Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
634#endif
635#if QC_ARP_D0177
636  UChar*        getARPW          ()                        { return m_puhARPW;               }
637  UChar         getARPW          ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
638  Void          setARPW          ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
639  Void          setARPWSubParts  ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
640  Double        getARPWFactor    ( UInt uiIdx );
641#endif
642  // -------------------------------------------------------------------------------------------------------------------
643  // member functions for accessing partition information
644  // -------------------------------------------------------------------------------------------------------------------
645#if H3D_IVRP
646  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
647#endif
648  UChar         getNumPartInter       ();
649  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
650 
651  // -------------------------------------------------------------------------------------------------------------------
652  // member functions for motion vector
653  // -------------------------------------------------------------------------------------------------------------------
654 
655  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
656 
657  AMVP_MODE     getAMVPMode           ( UInt uiIdx );
658#if H3D_IVMP
659  Void          fillMvpCandBase       ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
660  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
661#endif
662  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
663  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
664  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
665  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
666  Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
667
668  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
669  Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
670  Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
671 
672  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
673  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
674 
675  Void          clipMv                ( TComMv&     rcMv     );
676  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
677  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
678  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
679 
680  Void          compressMV            ();
681 
682  // -------------------------------------------------------------------------------------------------------------------
683  // utility functions for neighbouring information
684  // -------------------------------------------------------------------------------------------------------------------
685 
686  TComDataCU*   getCULeft                   () { return m_pcCULeft;       }
687  TComDataCU*   getCUAbove                  () { return m_pcCUAbove;      }
688  TComDataCU*   getCUAboveLeft              () { return m_pcCUAboveLeft;  }
689  TComDataCU*   getCUAboveRight             () { return m_pcCUAboveRight; }
690  TComDataCU*   getCUColocated              ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; }
691
692
693  TComDataCU*   getPULeft                   ( UInt&  uiLPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true
694                                            , Bool bEnforceTileRestriction=true 
695                                            );
696
697  TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false
698                                            , Bool planarAtLCUBoundary = false 
699                                            , Bool bEnforceTileRestriction=true 
700                                            );
701
702  TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false );
703  TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false );
704  TComDataCU*   getPUBelowLeft              ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
705
706  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
707  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true );
708  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
709
710  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
711  TComDataCU*   getPUBelowLeftAdi           ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
712 
713  Void          deriveLeftRightTopIdx       ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
714  Void          deriveLeftBottomIdx         ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB );
715 
716  Void          deriveLeftRightTopIdxAdi    ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth );
717  Void          deriveLeftBottomIdxAdi      ( UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth );
718 
719  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
720#if MERL_VSP_C0152
721  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, 
722#if MERL_VSP_NBDV_RefVId_Fix_D0166
723                Int* iVSPDir,
724#endif
725                Int mrgCandIdx = -1 );
726#else
727  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
728#endif
729  Void          deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
730  Void          deriveLeftBottomIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
731 
732 
733  // -------------------------------------------------------------------------------------------------------------------
734  // member functions for modes
735  // -------------------------------------------------------------------------------------------------------------------
736 
737  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
738  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
739 
740  // -------------------------------------------------------------------------------------------------------------------
741  // member functions for symbol prediction (most probable / mode conversion)
742  // -------------------------------------------------------------------------------------------------------------------
743 
744  UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
745  Void          convertTransIdx                 ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode );
746 
747  Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
748  Int           getIntraDirLumaPredictor        ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL );
749 
750  // -------------------------------------------------------------------------------------------------------------------
751  // member functions for SBAC context
752  // -------------------------------------------------------------------------------------------------------------------
753 
754  UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
755  UInt          getCtxQtCbf                     ( UInt   uiAbsPartIdx, TextType eType, UInt uiTrDepth );
756
757  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
758#if LGE_ILLUCOMP_B0045
759  UInt          getCtxICFlag                    ( UInt   uiAbsPartIdx                                 );
760#endif
761  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
762
763#if H3D_IVRP
764  UInt          getCtxResPredFlag               ( UInt   uiAbsPartIdx                                 );
765#endif
766#if QC_ARP_D0177
767  UInt          getCTXARPWFlag                 ( UInt   uiAbsPartIdx                                 );
768#endif 
769  UInt          getSliceStartCU         ( UInt pos )                  { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
770  UInt          getEntropySliceStartCU  ( UInt pos )                  { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
771  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
772
773#if LGE_EDGE_INTRA_A0070
774  UInt          getCtxEdgeIntra ( UInt uiAbsPartIdx );
775#endif
776
777  // -------------------------------------------------------------------------------------------------------------------
778  // member functions for RD cost storage
779  // -------------------------------------------------------------------------------------------------------------------
780 
781  Double&       getTotalCost()                  { return m_dTotalCost;        }
782  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
783  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
784  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
785
786  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
787
788  Bool          useNonSquareTrans( UInt uiTrMode, Int absPartIdx );
789  Void          getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight);
790  Bool          useNonSquarePU   ( UInt absPartIdx);
791  UInt          getInterTUSplitDirection ( Int width, Int height, Int trLastWidth, Int trLastHeight );
792  UInt          getNSAbsPartIdx  ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode );
793  UInt          getNSAddrChroma   ( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx );
794 
795// -------------------------------------------------------------------------------------------------------------------
796  // member functions for depth model modes
797  // -------------------------------------------------------------------------------------------------------------------
798#if HHI_DMM_WEDGE_INTRA
799  UInt* getWedgeFullTabIdx                ()                      { return m_puiWedgeFullTabIdx;              }
800  UInt  getWedgeFullTabIdx                ( UInt uiIdx )          { return m_puiWedgeFullTabIdx[uiIdx];       }
801  Void  setWedgeFullTabIdx                ( UInt uiIdx, UInt uh ) { m_puiWedgeFullTabIdx[uiIdx] = uh;         }
802  Void  setWedgeFullTabIdxSubParts        ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
803  Int*  getWedgeFullDeltaDC1              ()                      { return m_piWedgeFullDeltaDC1;             }
804  Int   getWedgeFullDeltaDC1              ( UInt uiIdx )          { return m_piWedgeFullDeltaDC1[uiIdx];      }
805  Void  setWedgeFullDeltaDC1              ( UInt uiIdx, Int i )   { m_piWedgeFullDeltaDC1[uiIdx] = i;         }
806  Void  setWedgeFullDeltaDC1SubParts      ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
807  Int*  getWedgeFullDeltaDC2              ()                      { return m_piWedgeFullDeltaDC2;             }
808  Int   getWedgeFullDeltaDC2              ( UInt uiIdx )          { return m_piWedgeFullDeltaDC2[uiIdx];      }
809  Void  setWedgeFullDeltaDC2              ( UInt uiIdx, Int i )   { m_piWedgeFullDeltaDC2[uiIdx] = i;         }
810  Void  setWedgeFullDeltaDC2SubParts      ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
811
812  UInt* getWedgePredDirTabIdx             ()                      { return m_puiWedgePredDirTabIdx;           }
813  UInt  getWedgePredDirTabIdx             ( UInt uiIdx )          { return m_puiWedgePredDirTabIdx[uiIdx];    }
814  Void  setWedgePredDirTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredDirTabIdx[uiIdx] = uh;      }
815  Void  setWedgePredDirTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
816  Int*  getWedgePredDirDeltaDC1           ()                      { return m_piWedgePredDirDeltaDC1;          }
817  Int   getWedgePredDirDeltaDC1           ( UInt uiIdx )          { return m_piWedgePredDirDeltaDC1[uiIdx];   }
818  Void  setWedgePredDirDeltaDC1           ( UInt uiIdx, Int i )   { m_piWedgePredDirDeltaDC1[uiIdx] = i;      }
819  Void  setWedgePredDirDeltaDC1SubParts   ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
820  Int*  getWedgePredDirDeltaDC2           ()                      { return m_piWedgePredDirDeltaDC2;          }
821  Int   getWedgePredDirDeltaDC2           ( UInt uiIdx )          { return m_piWedgePredDirDeltaDC2[uiIdx];   }
822  Void  setWedgePredDirDeltaDC2           ( UInt uiIdx, Int i )   { m_piWedgePredDirDeltaDC2[uiIdx] = i;      }
823  Void  setWedgePredDirDeltaDC2SubParts   ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
824  Int*  getWedgePredDirDeltaEnd           ()                      { return m_piWedgePredDirDeltaEnd;          }
825  Int   getWedgePredDirDeltaEnd           ( UInt uiIdx )          { return m_piWedgePredDirDeltaEnd[uiIdx];   }
826  Void  setWedgePredDirDeltaEnd           ( UInt uiIdx, Int iD )  { m_piWedgePredDirDeltaEnd[uiIdx] = iD;     }
827  Void  setWedgePredDirDeltaEndSubParts   ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth );
828#endif
829#if HHI_DMM_PRED_TEX
830  UInt* getWedgePredTexTabIdx             ()                      { return m_puiWedgePredTexTabIdx;           }
831  UInt  getWedgePredTexTabIdx             ( UInt uiIdx )          { return m_puiWedgePredTexTabIdx[uiIdx];    }
832  Void  setWedgePredTexTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh;      }
833  Void  setWedgePredTexTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
834#if LGE_DMM3_SIMP_C0044
835  UInt* getWedgePredTexIntraTabIdx             ()                      { return m_puiWedgePredTexIntraTabIdx;           }
836  UInt  getWedgePredTexIntraTabIdx             ( UInt uiIdx )          { return m_puiWedgePredTexIntraTabIdx[uiIdx];    }
837  Void  setWedgePredTexIntraTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexIntraTabIdx[uiIdx] = uh;      }
838  Void  setWedgePredTexIntraTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
839#endif
840  Int*  getWedgePredTexDeltaDC1           ()                      { return m_piWedgePredTexDeltaDC1;          }
841  Int   getWedgePredTexDeltaDC1           ( UInt uiIdx )          { return m_piWedgePredTexDeltaDC1[uiIdx];   }
842  Void  setWedgePredTexDeltaDC1           ( UInt uiIdx, Int i )   { m_piWedgePredTexDeltaDC1[uiIdx] = i;      }
843  Void  setWedgePredTexDeltaDC1SubParts   ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
844  Int*  getWedgePredTexDeltaDC2           ()                      { return m_piWedgePredTexDeltaDC2;          }
845  Int   getWedgePredTexDeltaDC2           ( UInt uiIdx )          { return m_piWedgePredTexDeltaDC2[uiIdx];   }
846  Void  setWedgePredTexDeltaDC2           ( UInt uiIdx, Int i )   { m_piWedgePredTexDeltaDC2[uiIdx] = i;      }
847  Void  setWedgePredTexDeltaDC2SubParts   ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
848
849  Int*  getContourPredTexDeltaDC1         ()                      { return m_piContourPredTexDeltaDC1;        }
850  Int   getContourPredTexDeltaDC1         ( UInt uiIdx )          { return m_piContourPredTexDeltaDC1[uiIdx]; }
851  Void  setContourPredTexDeltaDC1         ( UInt uiIdx, Int i )   { m_piContourPredTexDeltaDC1[uiIdx] = i;    }
852  Void  setContourPredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
853  Int*  getContourPredTexDeltaDC2         ()                      { return m_piContourPredTexDeltaDC2;        }
854  Int   getContourPredTexDeltaDC2         ( UInt uiIdx )          { return m_piContourPredTexDeltaDC2[uiIdx]; }
855  Void  setContourPredTexDeltaDC2         ( UInt uiIdx, Int i )   { m_piContourPredTexDeltaDC2[uiIdx] = i;    }
856  Void  setContourPredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
857#endif
858
859#if LGE_EDGE_INTRA_A0070
860  UChar*        getEdgeCode( UInt uiIdx )                 { return &m_pucEdgeCode[uiIdx * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4]; }
861  UChar*        getEdgeNumber( )                          { return m_pucEdgeNumber;           }
862  UChar         getEdgeNumber( UInt uiIdx )               { return m_pucEdgeNumber[uiIdx];    }
863  Void          setEdgeNumber( UInt uiIdx, UChar val )    { m_pucEdgeNumber[uiIdx] = val;     }
864  UChar*        getEdgeStartPos( )                        { return m_pucEdgeStartPos;         }
865  UChar         getEdgeStartPos( UInt uiIdx )             { return m_pucEdgeStartPos[uiIdx];  }
866  Void          setEdgeStartPos( UInt uiIdx, UChar val )  { m_pucEdgeStartPos[uiIdx] = val;   }
867  Bool*         getEdgeLeftFirst( )                       { return m_pbEdgeLeftFirst;         }
868  Bool          getEdgeLeftFirst( UInt uiIdx )            { return m_pbEdgeLeftFirst[uiIdx];  }
869  Void          setEdgeLeftFirst( UInt uiIdx, Bool val )  { m_pbEdgeLeftFirst[uiIdx] = val;   }
870  Bool*         getEdgePartition( UInt uiIdx )              { return &m_pbEdgePartition[uiIdx * 16]; }
871  Void          reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion );
872
873#if LGE_EDGE_INTRA_DELTA_DC
874  Int*          getEdgeDeltaDC0( )                          { return m_piEdgeDeltaDC0; }
875  Int*          getEdgeDeltaDC1( )                          { return m_piEdgeDeltaDC1; }
876  Int           getEdgeDeltaDC0( UInt uiIdx )               { return m_piEdgeDeltaDC0[uiIdx]; }
877  Int           getEdgeDeltaDC1( UInt uiIdx )               { return m_piEdgeDeltaDC1[uiIdx]; }
878  Void          setEdgeDeltaDC0( UInt uiIdx, Int val )      { m_piEdgeDeltaDC0[uiIdx] = val;  }
879  Void          setEdgeDeltaDC1( UInt uiIdx, Int val )      { m_piEdgeDeltaDC1[uiIdx] = val;  }
880#endif
881#endif
882 
883#if RWTH_SDC_DLT_B0036
884  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
885  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
886  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
887 
888#if !PKU_QC_DEPTH_INTRA_UNI_D0195
889  UInt          getCtxSDCFlag              ( UInt uiAbsPartIdx );
890#endif
891 
892  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
893 
894  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
895  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
896  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
897 
898
899#endif
900};
901
902namespace RasterAddress
903{
904  /** Check whether 2 addresses point to the same column
905   * \param addrA          First address in raster scan order
906   * \param addrB          Second address in raters scan order
907   * \param numUnitsPerRow Number of units in a row
908   * \return Result of test
909   */
910  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
911  {
912    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
913    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
914  }
915 
916  /** Check whether 2 addresses point to the same row
917   * \param addrA          First address in raster scan order
918   * \param addrB          Second address in raters scan order
919   * \param numUnitsPerRow Number of units in a row
920   * \return Result of test
921   */
922  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
923  {
924    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
925    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
926  }
927 
928  /** Check whether 2 addresses point to the same row or column
929   * \param addrA          First address in raster scan order
930   * \param addrB          Second address in raters scan order
931   * \param numUnitsPerRow Number of units in a row
932   * \return Result of test
933   */
934  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
935  {
936    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
937  }
938 
939  /** Check whether one address points to the first column
940   * \param addr           Address in raster scan order
941   * \param numUnitsPerRow Number of units in a row
942   * \return Result of test
943   */
944  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
945  {
946    // addr % numUnitsPerRow == 0
947    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
948  }
949 
950  /** Check whether one address points to the first row
951   * \param addr           Address in raster scan order
952   * \param numUnitsPerRow Number of units in a row
953   * \return Result of test
954   */
955  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
956  {
957    // addr / numUnitsPerRow == 0
958    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
959  }
960 
961  /** Check whether one address points to a column whose index is smaller than a given value
962   * \param addr           Address in raster scan order
963   * \param val            Given column index value
964   * \param numUnitsPerRow Number of units in a row
965   * \return Result of test
966   */
967  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
968  {
969    // addr % numUnitsPerRow < val
970    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
971  }
972 
973  /** Check whether one address points to a row whose index is smaller than a given value
974   * \param addr           Address in raster scan order
975   * \param val            Given row index value
976   * \param numUnitsPerRow Number of units in a row
977   * \return Result of test
978   */
979  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
980  {
981    // addr / numUnitsPerRow < val
982    return addr < val * numUnitsPerRow;
983  }
984};
985
986//! \}
987
988#endif
Note: See TracBrowser for help on using the repository browser.