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

Last change on this file since 296 was 296, checked in by tech, 11 years ago

Reintegrated branch 5.1-dev0 rev. 295.

  • Property svn:eol-style set to native
File size: 54.9 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6 * Copyright (c) 2010-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 AMP_MRG
198  Bool          m_bIsMergeAMP;
199#endif
200  UChar*        m_puhLumaIntraDir;    ///< array of intra directions (luma)
201  UChar*        m_puhChromaIntraDir;  ///< array of intra directions (chroma)
202  UChar*        m_puhInterDir;        ///< array of inter directions
203  Char*         m_apiMVPIdx[2];       ///< array of motion vector predictor candidates
204  Char*         m_apiMVPNum[2];       ///< array of number of possible motion vectors predictors
205  Bool*         m_puiAlfCtrlFlag;     ///< array of ALF flags
206  Bool*         m_puiTmpAlfCtrlFlag;  ///< temporal array of ALF flags
207 
208  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
209
210  Int           m_numSucIPCM;         ///< the number of succesive IPCM blocks associated with the current log2CUSize
211  Bool          m_lastCUSucIPCMFlag;  ///< True indicates that the last CU is IPCM and shares the same root as the current CU. 
212#if H3D_IVRP
213  Bool*         m_pbResPredAvailable; ///< array of residual prediction available flags
214  Bool*         m_pbResPredFlag;      ///< array of residual prediction flags
215#endif
216
217#if LGE_EDGE_INTRA_A0070
218  UChar*        m_pucEdgeCode;          ///< array of edge code
219  UChar*        m_pucEdgeNumber;        ///< total number of edge
220  UChar*        m_pucEdgeStartPos;      ///< starting point position
221  Bool*         m_pbEdgeLeftFirst;      ///< true if edge should be checked in left boundary first
222  Bool*         m_pbEdgePartition;      ///< true if it belongs to region 1, otherwise, region 0
223#if LGE_EDGE_INTRA_DELTA_DC
224  Int*          m_piEdgeDeltaDC0;
225  Int*          m_piEdgeDeltaDC1;
226#endif
227#endif
228
229  // -------------------------------------------------------------------------------------------------------------------
230  // misc. variables
231  // -------------------------------------------------------------------------------------------------------------------
232 
233  Bool          m_bDecSubCu;          ///< indicates decoder-mode
234  Double        m_dTotalCost;         ///< sum of partition RD costs
235  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
236  UInt          m_uiTotalBits;        ///< sum of partition bits
237  UInt          m_uiTotalBins;       ///< sum of partition bins
238  UInt*         m_uiSliceStartCU;    ///< Start CU address of current slice
239  UInt*         m_uiEntropySliceStartCU; ///< Start CU address of current slice
240 
241  // -------------------------------------------------------------------------------------------------------------------
242  // depth model mode data
243  // -------------------------------------------------------------------------------------------------------------------
244#if HHI_DMM_WEDGE_INTRA
245  UInt*         m_puiWedgeFullTabIdx;
246  Int*          m_piWedgeFullDeltaDC1;
247  Int*          m_piWedgeFullDeltaDC2;
248
249  UInt*         m_puiWedgePredDirTabIdx;
250  Int*          m_piWedgePredDirDeltaDC1;
251  Int*          m_piWedgePredDirDeltaDC2;
252  Int*          m_piWedgePredDirDeltaEnd;
253#endif
254#if HHI_DMM_PRED_TEX
255  UInt*         m_puiWedgePredTexTabIdx;
256#if LGE_DMM3_SIMP_C0044
257  UInt*         m_puiWedgePredTexIntraTabIdx;
258#endif
259  Int*          m_piWedgePredTexDeltaDC1;
260  Int*          m_piWedgePredTexDeltaDC2;
261
262  Int*          m_piContourPredTexDeltaDC1;
263  Int*          m_piContourPredTexDeltaDC2;
264#endif
265 
266#if RWTH_SDC_DLT_B0036
267  Bool*         m_pbSDCFlag;
268  Pel*          m_apSegmentDCOffset[2];
269#endif
270
271protected:
272 
273  /// add possible motion vector predictor candidates
274  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
275  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
276#if MERL_VSP_C0152
277  inline Bool   xAddVspMergeCand      ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
278                                        UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo );
279  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ;
280#endif
281  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
282  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
283#if QC_TMVP_MRG_REFIDX_C0047
284  ,
285  Bool bMRG = 0
286#endif
287  );
288#if H3D_NBDV
289  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
290#endif
291 
292
293  Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand );
294  /// compute required bits to encode MVD (used in AMVP)
295  UInt          xGetMvdBits           ( TComMv cMvd );
296  UInt          xGetComponentBits     ( Int iVal );
297 
298  /// compute scaling factor from POC difference
299  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
300 
301  Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter );
302  Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv );
303 
304  Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr);
305
306
307public:
308  TComDataCU();
309  virtual ~TComDataCU();
310 
311  // -------------------------------------------------------------------------------------------------------------------
312  // create / destroy / initialize / copy
313  // -------------------------------------------------------------------------------------------------------------------
314 
315  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
316#if ADAPTIVE_QP_SELECTION
317    , Bool bGlobalRMARLBuffer = false
318#endif 
319    );
320  Void          destroy               ();
321 
322  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
323  Void          initEstData           ( UInt uiDepth, Int qp );
324  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
325  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
326
327  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
328  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList );
329  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
330 
331  Void          copyToPic             ( UChar uiDepth );
332  Void          copyToPic             ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth );
333 
334  // -------------------------------------------------------------------------------------------------------------------
335  // member functions for CU description
336  // -------------------------------------------------------------------------------------------------------------------
337 
338  TComPic*      getPic                ()                        { return m_pcPic;           }
339  TComSlice*    getSlice              ()                        { return m_pcSlice;         }
340  UInt&         getAddr               ()                        { return m_uiCUAddr;        }
341  UInt&         getZorderIdxInCU      ()                        { return m_uiAbsIdxInLCU; }
342  UInt          getSCUAddr            ();
343  UInt          getCUPelX             ()                        { return m_uiCUPelX;        }
344  UInt          getCUPelY             ()                        { return m_uiCUPelY;        }
345  TComPattern*  getPattern            ()                        { return m_pcPattern;       }
346 
347  UChar*        getDepth              ()                        { return m_puhDepth;        }
348  UChar         getDepth              ( UInt uiIdx )            { return m_puhDepth[uiIdx]; }
349  Void          setDepth              ( UInt uiIdx, UChar  uh ) { m_puhDepth[uiIdx] = uh;   }
350 
351  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
352  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
353#if HHI_MPI
354  Int*          getTextureModeDepth   ()                        { return m_piTextureModeDepth; }
355  Int           getTextureModeDepth   ( UInt uiIdx )            { return m_piTextureModeDepth[uiIdx]; }
356  Void          setTextureModeDepth   ( UInt uiIdx, Int iTextureModeDepth ){ m_piTextureModeDepth[uiIdx] = iTextureModeDepth; }
357  Void          setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth );
358  Void          copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 );
359#endif
360
361   // -------------------------------------------------------------------------------------------------------------------
362  // member functions for CU data
363  // -------------------------------------------------------------------------------------------------------------------
364 
365  Char*         getPartitionSize      ()                        { return m_pePartSize;        }
366  PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
367  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
368  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
369 
370#if HHI_INTERVIEW_SKIP
371  Bool*         getRenderable          ()                        { return m_pbRenderable;               }
372    Bool          getRenderable          ( UInt uiIdx )            { return m_pbRenderable[uiIdx];        }
373    Void          setRenderable          ( UInt uiIdx, Bool b )    { m_pbRenderable[uiIdx] = b;           }
374    Void          setRenderableSubParts  ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth );
375#endif
376 
377  Char*         getPredictionMode     ()                        { return m_pePredMode;        }
378  PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
379  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
380  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
381 
382  UChar*        getWidth              ()                        { return m_puhWidth;          }
383  UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
384  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
385 
386  UChar*        getHeight             ()                        { return m_puhHeight;         }
387  UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
388  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
389 
390  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
391 
392  Char*         getQP                 ()                        { return m_phQP;              }
393  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
394  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
395  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
396  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
397  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
398
399#if LOSSLESS_CODING
400  Bool          isLosslessCoded(UInt absPartIdx);
401#endif
402  UChar*        getNSQTPartIdx        ()                        { return m_nsqtPartIdx;        }
403  UChar         getNSQTPartIdx        ( UInt idx )              { return m_nsqtPartIdx[idx];   }
404  Void          setNSQTIdxSubParts    ( UInt absPartIdx, UInt depth );
405  Void          setNSQTIdxSubParts    ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode );
406 
407  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
408  UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
409  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
410 
411  UInt          getQuadtreeTULog2MinSizeInCU( UInt absPartIdx );
412 
413  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
414 
415  TCoeff*&      getCoeffY             ()                        { return m_pcTrCoeffY;        }
416  TCoeff*&      getCoeffCb            ()                        { return m_pcTrCoeffCb;       }
417  TCoeff*&      getCoeffCr            ()                        { return m_pcTrCoeffCr;       }
418#if ADAPTIVE_QP_SELECTION
419  Int*&         getArlCoeffY          ()                        { return m_pcArlCoeffY;       }
420  Int*&         getArlCoeffCb         ()                        { return m_pcArlCoeffCb;      }
421  Int*&         getArlCoeffCr         ()                        { return m_pcArlCoeffCr;      }
422#endif
423 
424  Pel*&         getPCMSampleY         ()                        { return m_pcIPCMSampleY;     }
425  Pel*&         getPCMSampleCb        ()                        { return m_pcIPCMSampleCb;    }
426  Pel*&         getPCMSampleCr        ()                        { return m_pcIPCMSampleCr;    }
427
428  UChar         getCbf    ( UInt uiIdx, TextType eType )                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];  }
429  UChar*        getCbf    ( TextType eType )                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];         }
430  UChar         getCbf    ( UInt uiIdx, TextType eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
431  Void          setCbf    ( UInt uiIdx, TextType eType, UChar uh )        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;    }
432  Void          clearCbf  ( UInt uiIdx, TextType eType, UInt uiNumParts );
433  UChar         getQtRootCbf          ( UInt uiIdx )                      { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); }
434 
435  Void          setCbfSubParts        ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth          );
436  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth                    );
437  Void          setCbfSubParts        ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth    );
438 
439  // -------------------------------------------------------------------------------------------------------------------
440  // member functions for coding tool information
441  // -------------------------------------------------------------------------------------------------------------------
442 
443  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
444  Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
445  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
446  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
447
448  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
449  UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
450  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
451  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
452
453#if MERL_VSP_C0152
454  Char*         getVSPIndex        ()                        { return m_piVSPIndex;        }
455  Char          getVSPIndex        ( UInt uiIdx )            { return m_piVSPIndex[uiIdx]; }
456  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
457  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
458#endif
459
460  template <typename T>
461  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
462
463#if LGE_ILLUCOMP_B0045
464  Bool*         getICFlag             ()                        { return m_pbICFlag;               }
465  Bool          getICFlag             ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
466  Void          setICFlag             ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
467  Void          setICFlagSubParts     ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
468#if LGE_ILLUCOMP_DEPTH_C0046
469  Bool          isICFlagRequired      (UInt uiAbsPartIdx, UInt uiDepth); //This modification is not needed after integrating JCT3V-C0137
470#else
471  Bool          isICFlagRequired      (UInt uiAbsPartIdx);
472#endif
473#endif
474
475#if AMP_MRG
476  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
477  Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
478#endif
479
480  UChar*        getLumaIntraDir       ()                        { return m_puhLumaIntraDir;           }
481  UChar         getLumaIntraDir       ( UInt uiIdx )            { return m_puhLumaIntraDir[uiIdx];    }
482  Void          setLumaIntraDir       ( UInt uiIdx, UChar  uh ) { m_puhLumaIntraDir[uiIdx] = uh;      }
483  Void          setLumaIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
484 
485  UChar*        getChromaIntraDir     ()                        { return m_puhChromaIntraDir;         }
486  UChar         getChromaIntraDir     ( UInt uiIdx )            { return m_puhChromaIntraDir[uiIdx];  }
487  Void          setChromaIntraDir     ( UInt uiIdx, UChar  uh ) { m_puhChromaIntraDir[uiIdx] = uh;    }
488  Void          setChromIntraDirSubParts( UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth );
489 
490  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
491  UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
492  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
493  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
494 
495  Bool*         getAlfCtrlFlag        ()                        { return m_puiAlfCtrlFlag;            }
496  Bool          getAlfCtrlFlag        ( UInt uiIdx )            { return m_puiAlfCtrlFlag[uiIdx];     }
497  Void          setAlfCtrlFlag        ( UInt uiIdx, Bool uiFlag){ m_puiAlfCtrlFlag[uiIdx] = uiFlag;   }
498  Void          setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth );
499 
500  Void          createTmpAlfCtrlFlag  ();
501  Void          destroyTmpAlfCtrlFlag ();
502  Void          copyAlfCtrlFlagToTmp  ();
503  Void          copyAlfCtrlFlagFromTmp();
504 
505  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
506  Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
507  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
508  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
509
510  Int           getNumSucIPCM         ()                        { return m_numSucIPCM;             }
511  Void          setNumSucIPCM         ( Int num )               { m_numSucIPCM = num;              }
512  Bool          getLastCUSucIPCMFlag  ()                        { return m_lastCUSucIPCMFlag;        }
513  Void          setLastCUSucIPCMFlag  ( Bool flg )              { m_lastCUSucIPCMFlag = flg;         }
514
515  /// get slice ID for SU
516  Int           getSUSliceID          (UInt uiIdx)              {return m_piSliceSUMap[uiIdx];      } 
517
518  /// get the pointer of slice ID map
519  Int*          getSliceSUMap         ()                        {return m_piSliceSUMap;             }
520
521  /// set the pointer of slice ID map
522  Void          setSliceSUMap         (Int *pi)                 {m_piSliceSUMap = pi;               }
523
524  std::vector<NDBFBlockInfo>* getNDBFilterBlocks()      {return &m_vNDFBlock;}
525  Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight
526                                          ,Bool bIndependentSliceBoundaryEnabled
527                                          ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary
528                                          ,Bool bIndependentTileBoundaryEnabled );
529
530#if H3D_IVMP
531#if !H3D_NBDV
532  Int           getPdmMergeCandidate      ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
533  Bool          getPdmMvPred              ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
534#else //!H3D_NBDV
535#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
536  Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
537#else //QC_AMVP_MRG_UNIFY_IVCAN_C0051
538  Bool          getPdmMvPredDisCan        ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
539  Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm );
540#endif //QC_AMVP_MRG_UNIFY_IVCAN_C0051
541  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
542  Void          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
543#if MERL_VSP_C0152
544                              , Bool bDepthRefine = false
545#endif //MERL_VSP_C0152
546    );
547#endif // !H3D_NBDV
548
549
550
551#if MERL_VSP_C0152
552#if LGE_SIMP_DVP_REFINE_C0112
553  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
554  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
555#else
556  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec);
557  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred);
558#endif
559#endif
560  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
561#endif //  H3D_IVMP
562#if H3D_IVRP
563  Bool*         getResPredAvail         ()                        { return m_pbResPredAvailable;        }
564  Bool          getResPredAvail         ( UInt uiIdx )            { return m_pbResPredAvailable[uiIdx]; }
565  Void          setResPredAvail         ( UInt uiIdx, Bool b )    { m_pbResPredAvailable[uiIdx] = b;    }
566  Void          setResPredAvailSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
567
568  Bool*         getResPredFlag          ()                        { return m_pbResPredFlag;        }
569  Bool          getResPredFlag          ( UInt uiIdx )            { return m_pbResPredFlag[uiIdx]; }
570  Void          setResPredFlag          ( UInt uiIdx, Bool b )    { m_pbResPredFlag[uiIdx] = b;    }
571  Void          setResPredFlagSubParts  ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
572
573  Void          setResPredIndicator     ( Bool bAv, Bool bRP )    { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; }
574#endif
575#if H3D_IVRP
576  Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
577#endif
578  // -------------------------------------------------------------------------------------------------------------------
579  // member functions for accessing partition information
580  // -------------------------------------------------------------------------------------------------------------------
581#if LG_RESTRICTEDRESPRED_M24766
582  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
583#else
584  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
585#endif
586#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
587  Int           getResiPredMode(UInt uiPartAddr);
588  Void          getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex);
589#endif
590  UChar         getNumPartInter       ();
591  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
592 
593  // -------------------------------------------------------------------------------------------------------------------
594  // member functions for motion vector
595  // -------------------------------------------------------------------------------------------------------------------
596 
597  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
598 
599  AMVP_MODE     getAMVPMode           ( UInt uiIdx );
600#if H3D_IVMP
601  Void          fillMvpCandBase       ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
602  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
603#endif
604  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
605  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
606  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
607  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
608  Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
609
610  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
611  Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
612  Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
613 
614  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
615  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
616 
617  Void          clipMv                ( TComMv&     rcMv     );
618  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
619  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
620  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
621 
622  Void          compressMV            ();
623 
624  // -------------------------------------------------------------------------------------------------------------------
625  // utility functions for neighbouring information
626  // -------------------------------------------------------------------------------------------------------------------
627 
628  TComDataCU*   getCULeft                   () { return m_pcCULeft;       }
629  TComDataCU*   getCUAbove                  () { return m_pcCUAbove;      }
630  TComDataCU*   getCUAboveLeft              () { return m_pcCUAboveLeft;  }
631  TComDataCU*   getCUAboveRight             () { return m_pcCUAboveRight; }
632  TComDataCU*   getCUColocated              ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; }
633
634
635  TComDataCU*   getPULeft                   ( UInt&  uiLPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true
636                                            , Bool bEnforceTileRestriction=true 
637                                            );
638
639  TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false
640                                            , Bool planarAtLCUBoundary = false 
641                                            , Bool bEnforceTileRestriction=true 
642                                            );
643
644  TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false );
645  TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false );
646  TComDataCU*   getPUBelowLeft              ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
647
648  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
649  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true );
650  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
651
652  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
653  TComDataCU*   getPUBelowLeftAdi           ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
654 
655  Void          deriveLeftRightTopIdx       ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
656  Void          deriveLeftBottomIdx         ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB );
657 
658  Void          deriveLeftRightTopIdxAdi    ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth );
659  Void          deriveLeftBottomIdxAdi      ( UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth );
660 
661  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
662#if MERL_VSP_C0152
663  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
664#else
665  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
666#endif
667  Void          deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
668  Void          deriveLeftBottomIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
669 
670 
671  // -------------------------------------------------------------------------------------------------------------------
672  // member functions for modes
673  // -------------------------------------------------------------------------------------------------------------------
674 
675  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
676  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
677 
678  // -------------------------------------------------------------------------------------------------------------------
679  // member functions for symbol prediction (most probable / mode conversion)
680  // -------------------------------------------------------------------------------------------------------------------
681 
682  UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
683  Void          convertTransIdx                 ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode );
684 
685  Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
686  Int           getIntraDirLumaPredictor        ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL );
687 
688  // -------------------------------------------------------------------------------------------------------------------
689  // member functions for SBAC context
690  // -------------------------------------------------------------------------------------------------------------------
691 
692  UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
693  UInt          getCtxQtCbf                     ( UInt   uiAbsPartIdx, TextType eType, UInt uiTrDepth );
694
695  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
696#if LGE_ILLUCOMP_B0045
697  UInt          getCtxICFlag                    ( UInt   uiAbsPartIdx                                 );
698#endif
699  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
700
701#if H3D_IVRP
702  UInt          getCtxResPredFlag               ( UInt   uiAbsPartIdx                                 );
703#endif
704 
705  UInt          getSliceStartCU         ( UInt pos )                  { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
706  UInt          getEntropySliceStartCU  ( UInt pos )                  { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
707  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
708
709#if LGE_EDGE_INTRA_A0070
710  UInt          getCtxEdgeIntra ( UInt uiAbsPartIdx );
711#endif
712
713  // -------------------------------------------------------------------------------------------------------------------
714  // member functions for RD cost storage
715  // -------------------------------------------------------------------------------------------------------------------
716 
717  Double&       getTotalCost()                  { return m_dTotalCost;        }
718  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
719  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
720  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
721
722  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
723
724  Bool          useNonSquareTrans( UInt uiTrMode, Int absPartIdx );
725  Void          getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight);
726  Bool          useNonSquarePU   ( UInt absPartIdx);
727  UInt          getInterTUSplitDirection ( Int width, Int height, Int trLastWidth, Int trLastHeight );
728  UInt          getNSAbsPartIdx  ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode );
729  UInt          getNSAddrChroma   ( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx );
730 
731// -------------------------------------------------------------------------------------------------------------------
732  // member functions for depth model modes
733  // -------------------------------------------------------------------------------------------------------------------
734#if HHI_DMM_WEDGE_INTRA
735  UInt* getWedgeFullTabIdx                ()                      { return m_puiWedgeFullTabIdx;              }
736  UInt  getWedgeFullTabIdx                ( UInt uiIdx )          { return m_puiWedgeFullTabIdx[uiIdx];       }
737  Void  setWedgeFullTabIdx                ( UInt uiIdx, UInt uh ) { m_puiWedgeFullTabIdx[uiIdx] = uh;         }
738  Void  setWedgeFullTabIdxSubParts        ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
739  Int*  getWedgeFullDeltaDC1              ()                      { return m_piWedgeFullDeltaDC1;             }
740  Int   getWedgeFullDeltaDC1              ( UInt uiIdx )          { return m_piWedgeFullDeltaDC1[uiIdx];      }
741  Void  setWedgeFullDeltaDC1              ( UInt uiIdx, Int i )   { m_piWedgeFullDeltaDC1[uiIdx] = i;         }
742  Void  setWedgeFullDeltaDC1SubParts      ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
743  Int*  getWedgeFullDeltaDC2              ()                      { return m_piWedgeFullDeltaDC2;             }
744  Int   getWedgeFullDeltaDC2              ( UInt uiIdx )          { return m_piWedgeFullDeltaDC2[uiIdx];      }
745  Void  setWedgeFullDeltaDC2              ( UInt uiIdx, Int i )   { m_piWedgeFullDeltaDC2[uiIdx] = i;         }
746  Void  setWedgeFullDeltaDC2SubParts      ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
747
748  UInt* getWedgePredDirTabIdx             ()                      { return m_puiWedgePredDirTabIdx;           }
749  UInt  getWedgePredDirTabIdx             ( UInt uiIdx )          { return m_puiWedgePredDirTabIdx[uiIdx];    }
750  Void  setWedgePredDirTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredDirTabIdx[uiIdx] = uh;      }
751  Void  setWedgePredDirTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
752  Int*  getWedgePredDirDeltaDC1           ()                      { return m_piWedgePredDirDeltaDC1;          }
753  Int   getWedgePredDirDeltaDC1           ( UInt uiIdx )          { return m_piWedgePredDirDeltaDC1[uiIdx];   }
754  Void  setWedgePredDirDeltaDC1           ( UInt uiIdx, Int i )   { m_piWedgePredDirDeltaDC1[uiIdx] = i;      }
755  Void  setWedgePredDirDeltaDC1SubParts   ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
756  Int*  getWedgePredDirDeltaDC2           ()                      { return m_piWedgePredDirDeltaDC2;          }
757  Int   getWedgePredDirDeltaDC2           ( UInt uiIdx )          { return m_piWedgePredDirDeltaDC2[uiIdx];   }
758  Void  setWedgePredDirDeltaDC2           ( UInt uiIdx, Int i )   { m_piWedgePredDirDeltaDC2[uiIdx] = i;      }
759  Void  setWedgePredDirDeltaDC2SubParts   ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
760  Int*  getWedgePredDirDeltaEnd           ()                      { return m_piWedgePredDirDeltaEnd;          }
761  Int   getWedgePredDirDeltaEnd           ( UInt uiIdx )          { return m_piWedgePredDirDeltaEnd[uiIdx];   }
762  Void  setWedgePredDirDeltaEnd           ( UInt uiIdx, Int iD )  { m_piWedgePredDirDeltaEnd[uiIdx] = iD;     }
763  Void  setWedgePredDirDeltaEndSubParts   ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth );
764#endif
765#if HHI_DMM_PRED_TEX
766  UInt* getWedgePredTexTabIdx             ()                      { return m_puiWedgePredTexTabIdx;           }
767  UInt  getWedgePredTexTabIdx             ( UInt uiIdx )          { return m_puiWedgePredTexTabIdx[uiIdx];    }
768  Void  setWedgePredTexTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh;      }
769  Void  setWedgePredTexTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
770#if LGE_DMM3_SIMP_C0044
771  UInt* getWedgePredTexIntraTabIdx             ()                      { return m_puiWedgePredTexIntraTabIdx;           }
772  UInt  getWedgePredTexIntraTabIdx             ( UInt uiIdx )          { return m_puiWedgePredTexIntraTabIdx[uiIdx];    }
773  Void  setWedgePredTexIntraTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexIntraTabIdx[uiIdx] = uh;      }
774  Void  setWedgePredTexIntraTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
775#endif
776  Int*  getWedgePredTexDeltaDC1           ()                      { return m_piWedgePredTexDeltaDC1;          }
777  Int   getWedgePredTexDeltaDC1           ( UInt uiIdx )          { return m_piWedgePredTexDeltaDC1[uiIdx];   }
778  Void  setWedgePredTexDeltaDC1           ( UInt uiIdx, Int i )   { m_piWedgePredTexDeltaDC1[uiIdx] = i;      }
779  Void  setWedgePredTexDeltaDC1SubParts   ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
780  Int*  getWedgePredTexDeltaDC2           ()                      { return m_piWedgePredTexDeltaDC2;          }
781  Int   getWedgePredTexDeltaDC2           ( UInt uiIdx )          { return m_piWedgePredTexDeltaDC2[uiIdx];   }
782  Void  setWedgePredTexDeltaDC2           ( UInt uiIdx, Int i )   { m_piWedgePredTexDeltaDC2[uiIdx] = i;      }
783  Void  setWedgePredTexDeltaDC2SubParts   ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
784
785  Int*  getContourPredTexDeltaDC1         ()                      { return m_piContourPredTexDeltaDC1;        }
786  Int   getContourPredTexDeltaDC1         ( UInt uiIdx )          { return m_piContourPredTexDeltaDC1[uiIdx]; }
787  Void  setContourPredTexDeltaDC1         ( UInt uiIdx, Int i )   { m_piContourPredTexDeltaDC1[uiIdx] = i;    }
788  Void  setContourPredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth );
789  Int*  getContourPredTexDeltaDC2         ()                      { return m_piContourPredTexDeltaDC2;        }
790  Int   getContourPredTexDeltaDC2         ( UInt uiIdx )          { return m_piContourPredTexDeltaDC2[uiIdx]; }
791  Void  setContourPredTexDeltaDC2         ( UInt uiIdx, Int i )   { m_piContourPredTexDeltaDC2[uiIdx] = i;    }
792  Void  setContourPredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
793#endif
794
795#if LGE_EDGE_INTRA_A0070
796  UChar*        getEdgeCode( UInt uiIdx )                 { return &m_pucEdgeCode[uiIdx * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4]; }
797  UChar*        getEdgeNumber( )                          { return m_pucEdgeNumber;           }
798  UChar         getEdgeNumber( UInt uiIdx )               { return m_pucEdgeNumber[uiIdx];    }
799  Void          setEdgeNumber( UInt uiIdx, UChar val )    { m_pucEdgeNumber[uiIdx] = val;     }
800  UChar*        getEdgeStartPos( )                        { return m_pucEdgeStartPos;         }
801  UChar         getEdgeStartPos( UInt uiIdx )             { return m_pucEdgeStartPos[uiIdx];  }
802  Void          setEdgeStartPos( UInt uiIdx, UChar val )  { m_pucEdgeStartPos[uiIdx] = val;   }
803  Bool*         getEdgeLeftFirst( )                       { return m_pbEdgeLeftFirst;         }
804  Bool          getEdgeLeftFirst( UInt uiIdx )            { return m_pbEdgeLeftFirst[uiIdx];  }
805  Void          setEdgeLeftFirst( UInt uiIdx, Bool val )  { m_pbEdgeLeftFirst[uiIdx] = val;   }
806  Bool*         getEdgePartition( UInt uiIdx )              { return &m_pbEdgePartition[uiIdx * 16]; }
807  Void          reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion );
808
809#if LGE_EDGE_INTRA_DELTA_DC
810  Int*          getEdgeDeltaDC0( )                          { return m_piEdgeDeltaDC0; }
811  Int*          getEdgeDeltaDC1( )                          { return m_piEdgeDeltaDC1; }
812  Int           getEdgeDeltaDC0( UInt uiIdx )               { return m_piEdgeDeltaDC0[uiIdx]; }
813  Int           getEdgeDeltaDC1( UInt uiIdx )               { return m_piEdgeDeltaDC1[uiIdx]; }
814  Void          setEdgeDeltaDC0( UInt uiIdx, Int val )      { m_piEdgeDeltaDC0[uiIdx] = val;  }
815  Void          setEdgeDeltaDC1( UInt uiIdx, Int val )      { m_piEdgeDeltaDC1[uiIdx] = val;  }
816#endif
817#endif
818 
819#if RWTH_SDC_DLT_B0036
820  Bool*         getSDCFlag          ()                        { return m_pbSDCFlag;               }
821  Bool          getSDCFlag          ( UInt uiIdx )            { return m_pbSDCFlag[uiIdx];        }
822  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
823 
824  UInt          getCtxSDCFlag              ( UInt uiAbsPartIdx );
825 
826  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
827 
828  Pel*          getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }
829  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
830  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
831#endif
832};
833
834namespace RasterAddress
835{
836  /** Check whether 2 addresses point to the same column
837   * \param addrA          First address in raster scan order
838   * \param addrB          Second address in raters scan order
839   * \param numUnitsPerRow Number of units in a row
840   * \return Result of test
841   */
842  static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow )
843  {
844    // addrA % numUnitsPerRow == addrB % numUnitsPerRow
845    return (( addrA ^ addrB ) &  ( numUnitsPerRow - 1 ) ) == 0;
846  }
847 
848  /** Check whether 2 addresses point to the same row
849   * \param addrA          First address in raster scan order
850   * \param addrB          Second address in raters scan order
851   * \param numUnitsPerRow Number of units in a row
852   * \return Result of test
853   */
854  static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow )
855  {
856    // addrA / numUnitsPerRow == addrB / numUnitsPerRow
857    return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0;
858  }
859 
860  /** Check whether 2 addresses point to the same row or column
861   * \param addrA          First address in raster scan order
862   * \param addrB          Second address in raters scan order
863   * \param numUnitsPerRow Number of units in a row
864   * \return Result of test
865   */
866  static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow )
867  {
868    return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow );
869  }
870 
871  /** Check whether one address points to the first column
872   * \param addr           Address in raster scan order
873   * \param numUnitsPerRow Number of units in a row
874   * \return Result of test
875   */
876  static inline Bool isZeroCol( Int addr, Int numUnitsPerRow )
877  {
878    // addr % numUnitsPerRow == 0
879    return ( addr & ( numUnitsPerRow - 1 ) ) == 0;
880  }
881 
882  /** Check whether one address points to the first row
883   * \param addr           Address in raster scan order
884   * \param numUnitsPerRow Number of units in a row
885   * \return Result of test
886   */
887  static inline Bool isZeroRow( Int addr, Int numUnitsPerRow )
888  {
889    // addr / numUnitsPerRow == 0
890    return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0;
891  }
892 
893  /** Check whether one address points to a column whose index is smaller than a given value
894   * \param addr           Address in raster scan order
895   * \param val            Given column index value
896   * \param numUnitsPerRow Number of units in a row
897   * \return Result of test
898   */
899  static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow )
900  {
901    // addr % numUnitsPerRow < val
902    return ( addr & ( numUnitsPerRow - 1 ) ) < val;
903  }
904 
905  /** Check whether one address points to a row whose index is smaller than a given value
906   * \param addr           Address in raster scan order
907   * \param val            Given row index value
908   * \param numUnitsPerRow Number of units in a row
909   * \return Result of test
910   */
911  static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow )
912  {
913    // addr / numUnitsPerRow < val
914    return addr < val * numUnitsPerRow;
915  }
916};
917
918//! \}
919
920#endif
Note: See TracBrowser for help on using the repository browser.