source: 3DVCSoftware/branches/HTM-5.0-Nokia/source/Lib/TLibCommon/TComDataCU.h @ 199

Last change on this file since 199 was 189, checked in by tech, 12 years ago

Reintegrated branch 4.1-dev0 Rev. 188.

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