source: 3DVCSoftware/branches/HTM-6.2-dev1-LG/source/Lib/TLibCommon/TComSlice.h @ 423

Last change on this file since 423 was 408, checked in by lg, 12 years ago

D0135->D0092->D0091

  • Property svn:eol-style set to native
File size: 74.4 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     TComSlice.h
35    \brief    slice header and SPS class (header)
36*/
37
38#ifndef __TCOMSLICE__
39#define __TCOMSLICE__
40
41#include <cstring>
42#include <map>
43#include <vector>
44#include "CommonDef.h"
45#include "TComRom.h"
46#include "TComList.h"
47
48//! \ingroup TLibCommon
49//! \{
50
51class TComPic;
52class TComTrQuant;
53#if DEPTH_MAP_GENERATION
54class TComDepthMapGenerator;
55#endif
56#if H3D_IVRP
57class TComResidualGenerator;
58#endif
59// ====================================================================================================================
60// Constants
61// ====================================================================================================================
62
63/// max number of supported APS in software
64#define MAX_NUM_SUPPORTED_APS 1
65
66// ====================================================================================================================
67// Class definition
68// ====================================================================================================================
69
70/// Reference Picture Set class
71class TComReferencePictureSet
72{
73private:
74  Int  m_numberOfPictures;
75  Int  m_numberOfNegativePictures;
76  Int  m_numberOfPositivePictures;
77  Int  m_numberOfLongtermPictures;
78  Int  m_deltaPOC[MAX_NUM_REF_PICS];
79  Int  m_POC[MAX_NUM_REF_PICS];
80  Bool m_used[MAX_NUM_REF_PICS];
81  Bool m_interRPSPrediction;
82  Int  m_deltaRIdxMinus1;   
83  Int  m_deltaRPS; 
84  Int  m_numRefIdc; 
85  Int  m_refIdc[MAX_NUM_REF_PICS+1];
86
87public:
88  TComReferencePictureSet();
89  virtual ~TComReferencePictureSet();
90
91  Void setNumberOfPictures(Int numberOfPictures);
92  Int  getNumberOfPictures();
93  Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
94  Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
95  Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
96  Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
97  Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
98  Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
99
100  Void setDeltaPOC(Int bufferNum, Int deltaPOC);
101  Int  getDeltaPOC(Int bufferNum);
102  Void setPOC(Int bufferNum, Int deltaPOC);
103  Int  getPOC(Int bufferNum);
104
105  Void setUsed(Int bufferNum, Bool used);
106  Int  getUsed(Int bufferNum);
107
108  Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
109  Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
110  Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
111  Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
112  Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
113  Int  getDeltaRPS()                            { return m_deltaRPS; }
114  Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
115  Int  getNumRefIdc()                           { return m_numRefIdc; }
116
117  Void setRefIdc(Int bufferNum, Int refIdc);
118  Int  getRefIdc(Int bufferNum);
119
120  Void sortDeltaPOC();
121  Void printDeltaPOC();
122};
123
124/// Reference Picture Set set class
125class TComRPSList
126{
127private:
128  Int  m_numberOfReferencePictureSets;
129  TComReferencePictureSet* m_referencePictureSets;
130 
131public:
132  TComRPSList();
133  virtual ~TComRPSList();
134 
135  Void  create  (Int numberOfEntries);
136  Void  destroy ();
137
138
139  TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
140  Int getNumberOfReferencePictureSets();
141  Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
142};
143
144#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
145/// VPS class
146
147class TComVPS
148{
149private:
150  Int         m_VPSId;
151  UInt        m_uiMaxTLayers;
152  UInt        m_uiMaxLayers;
153  Bool        m_bTemporalIdNestingFlag;
154
155  UInt        m_uiExtensionType;
156#if !QC_MVHEVC_B0046 
157  Bool        m_bDependentFlag[MAX_LAYER_NUM];
158#else
159  UInt        m_uiNumHRDParameter;
160  UInt        m_numAddiLayerOperationPoints;
161  UInt        m_numAddiProLevelSets;
162  UInt        m_numDirectRefLayer[MAX_LAYER_NUM];
163  UInt        m_numDirectRefID[MAX_LAYER_NUM][MAX_LAYER_NUM];
164  UInt        m_numOpLayerIdMinus1[MAX_LAYER_NUM];
165  UInt        m_numOpLayerId[MAX_LAYER_NUM][MAX_LAYER_NUM];
166#endif
167  UInt        m_uiViewId[MAX_LAYER_NUM];
168#if !QC_MVHEVC_B0046 
169  Bool        m_bDepthFlag[MAX_LAYER_NUM];
170#endif
171  Int         m_iViewOrderIdx[MAX_LAYER_NUM];
172#if !QC_MVHEVC_B0046 
173  UInt        m_uiDependentLayer[MAX_LAYER_NUM];
174#endif
175
176  UInt        m_numReorderPics[MAX_TLAYER];
177  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
178  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
179#if INTER_VIEW_VECTOR_SCALING_C0115
180  Bool          m_bIVScalingFlag;
181#endif
182
183#if MTK_D0156
184#if MERL_VSP_COMPENSATION_C0152
185  Bool      m_abUseVSPCompensation[ MAX_TLAYER ];
186#endif
187  Bool      m_abUseDVPRefine[ MAX_TLAYER ];
188#endif
189
190public:
191  TComVPS();
192  virtual ~TComVPS();
193 
194  Int     getVPSId       ()                   { return m_VPSId;          }
195  Void    setVPSId       (Int i)              { m_VPSId = i;             }
196 
197  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
198  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
199   
200  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
201  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
202 
203  Bool    getTemporalNestingFlag   ()         { return m_uiMaxLayers;   }
204  Void    setTemporalNestingFlag   (UInt t)   { m_bTemporalIdNestingFlag = t; }
205#if !QC_MVHEVC_B0046
206  Void    setExtensionType(UInt v)                     { m_uiExtensionType = v;    }
207  UInt    getExtensionType()                             { return m_uiExtensionType; }
208 
209  Void    setDependentFlag(Bool d, UInt layer)              { m_bDependentFlag[layer] = d;    }
210  Bool    getDependentFlag(UInt layer)                      { return m_bDependentFlag[layer]; }
211#endif
212  Void    setViewId(UInt v, UInt layer)                     { m_uiViewId[layer] = v;    }
213  UInt    getViewId(UInt layer)                             { return m_uiViewId[layer]; }
214#if !QC_MVHEVC_B0046
215  Void    setDepthFlag(Bool d, UInt layer)                  { m_bDepthFlag[layer] = d;    }
216  Bool    getDepthFlag(UInt layer)                          { return m_bDepthFlag[layer]; }
217#endif
218  Void    setViewOrderIdx(Int v, UInt layer)                { m_iViewOrderIdx[layer] = v;    }
219  Int     getViewOrderIdx(UInt layer)                       { return m_iViewOrderIdx[layer]; }
220#if !QC_MVHEVC_B0046   
221  Void    setDependentLayer(UInt v, UInt layer)                     { m_uiDependentLayer[layer] = v;    }
222  UInt    getDependentLayer(UInt layer)                             { return m_uiDependentLayer[layer]; }
223#endif
224#if INTER_VIEW_VECTOR_SCALING_C0115
225  Bool getIVScalingFlag( )                                   { return m_bIVScalingFlag; }
226  Void setIVScalingFlag(Bool b)                              { m_bIVScalingFlag = b;    }
227#endif
228  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
229  UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
230 
231  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)          { m_uiMaxDecPicBuffering[tLayer] = v;    }
232  UInt    getMaxDecPicBuffering(UInt tLayer)                  { return m_uiMaxDecPicBuffering[tLayer]; }
233 
234  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)                { m_uiMaxLatencyIncrease[tLayer] = v;    }
235  UInt    getMaxLatencyIncrease(UInt tLayer)                        { return m_uiMaxLatencyIncrease[tLayer]; }
236#if QC_MVHEVC_B0046
237  Void    setNumHRDParameters(UInt n)                                { m_uiNumHRDParameter = n;    }
238  UInt    getNumHRDParameters()                                      { return m_uiNumHRDParameter; }
239  Void    setNumDirectRefLayer(UInt n, UInt layer)                   { m_numDirectRefLayer[layer] = n;        };
240  UInt    getNumDirectRefLayer(UInt layer)                           { return m_numDirectRefLayer[layer];     };
241  Void    setDirectRefLayerId (UInt n, UInt layer, UInt refId)       { m_numDirectRefID[layer][refId] = n;   assert(refId < MAX_NUM_REF ); };
242  UInt    getDirectRefLayerId (        UInt layer, UInt refId)       { return m_numDirectRefID[layer][refId]; };
243  UInt    getNumAddiLayerOperationPoints(      )               { return m_numAddiLayerOperationPoints;  };
244  Void    setNumAddiLayerOperationPoints(UInt n)                {  m_numAddiLayerOperationPoints = n;  };
245  Void    setNumAddiProLevelSets        (UInt n)                     {  m_numAddiProLevelSets = n;}
246  UInt    getNumAddiProLevelSets        (      )                     { return m_numAddiProLevelSets;}
247
248  Void    setNumOpLayerIdMinus1         (UInt n, UInt layer)                     {  m_numOpLayerIdMinus1[layer] = n;}
249  UInt    getNumOpLayerIdMinus1         (UInt layer      )                       { return m_numOpLayerIdMinus1[layer];}
250
251  Void    setNumOpLayerId               (UInt n, UInt layer, UInt OpId)                     {  m_numOpLayerId[layer][OpId] = n;}
252  UInt    getNumOpLayerId               (UInt layer, UInt OpId        )                     { return m_numOpLayerId[layer][OpId];}
253 
254#endif
255
256#if MTK_D0156
257#if MERL_VSP_COMPENSATION_C0152
258  Bool    getUseVSPCompensation( UInt tLayer ){  return m_abUseVSPCompensation[ tLayer ];}
259  Void    setUseVSPCompensation( Bool bValue, UInt tLayer ){ m_abUseVSPCompensation[ tLayer ] = bValue;}
260#endif
261  Bool    getUseDVPRefine( UInt tLayer ){  return m_abUseDVPRefine[ tLayer ];}
262  Void    setUseDVPRefine( Bool bValue, UInt tLayer ){ m_abUseDVPRefine[ tLayer ] = bValue;}
263#endif
264};
265
266#endif
267
268/// SPS class
269class TComSPS
270{
271private:
272#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
273  Int          m_VPSId;
274#endif
275  Int         m_SPSId;
276  Int         m_ProfileIdc;
277  Int         m_LevelIdc;
278  Int         m_chromaFormatIdc;
279
280  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
281
282  UInt        m_uiViewId;
283  Int         m_iViewOrderIdx;
284  Bool        m_bDepth;
285  UInt        m_uiCamParPrecision;
286  Bool        m_bCamParInSliceHeader;
287  Int         m_aaiCodedScale [2][MAX_VIEW_NUM];
288  Int         m_aaiCodedOffset[2][MAX_VIEW_NUM];
289
290  // Structure
291  UInt        m_picWidthInLumaSamples;
292  UInt        m_picHeightInLumaSamples;
293  Bool        m_picCroppingFlag;
294  Int         m_picCropLeftOffset;
295  Int         m_picCropRightOffset;
296  Int         m_picCropTopOffset;
297  Int         m_picCropBottomOffset;
298  UInt        m_uiMaxCUWidth;
299  UInt        m_uiMaxCUHeight;
300  UInt        m_uiMaxCUDepth;
301  UInt        m_uiMinTrDepth;
302  UInt        m_uiMaxTrDepth;
303  TComRPSList* m_RPSList;
304  Bool        m_bLongTermRefsPresent;
305  Int         m_numReorderPics[MAX_TLAYER];
306 
307  Int         m_iNumberOfUsableInterViewRefs;
308  Int         m_aiUsableInterViewRefs[MAX_VIEW_NUM];
309
310  // Tool list
311  UInt        m_uiQuadtreeTULog2MaxSize;
312  UInt        m_uiQuadtreeTULog2MinSize;
313  UInt        m_uiQuadtreeTUMaxDepthInter;
314  UInt        m_uiQuadtreeTUMaxDepthIntra;
315  Bool        m_usePCM;
316  UInt        m_pcmLog2MaxSize;
317  UInt        m_uiPCMLog2MinSize;
318  Bool        m_bDisInter4x4;
319  Bool        m_useAMP;
320  Bool        m_bUseALF;
321  Bool        m_bALFCoefInSlice;
322  Bool        m_bUseLMChroma; // JL:
323
324  Bool        m_bUseLComb;
325  Bool        m_bLCMod;
326  Bool        m_useNSQT;
327 
328  Bool        m_restrictedRefPicListsFlag;
329  Bool        m_listsModificationPresentFlag;
330
331  // Parameter
332  AMVP_MODE   m_aeAMVPMode[MAX_CU_DEPTH];
333  UInt        m_uiBitDepth;
334  UInt        m_uiBitIncrement;
335  Int         m_qpBDOffsetY;
336  Int         m_qpBDOffsetC;
337
338#if LOSSLESS_CODING
339  Bool        m_useLossless;
340#endif
341
342  UInt        m_uiPCMBitDepthLuma;
343  UInt        m_uiPCMBitDepthChroma;
344  Bool        m_bPCMFilterDisableFlag;
345
346  UInt        m_uiBitsForPOC;
347  // Max physical transform size
348  UInt        m_uiMaxTrSize;
349 
350  Int m_iAMPAcc[MAX_CU_DEPTH];
351
352  Bool        m_bLFCrossSliceBoundaryFlag;
353  Bool        m_bUseSAO; 
354#if HHI_MPI
355  Bool        m_bUseMVI;
356#endif
357 
358#if RWTH_SDC_DLT_B0036
359  Bool        m_bUseDLT;
360 
361  UInt        m_uiBitsPerDepthValue;
362  UInt        m_uiNumDepthmapValues;
363  UInt*       m_uiDepthValue2Idx;
364  UInt*       m_uiIdx2DepthValue;
365#endif
366
367  Bool     m_bLFCrossTileBoundaryFlag;
368  Int      m_iUniformSpacingIdr;
369  Int      m_iTileBoundaryIndependenceIdr;
370  Int      m_iNumColumnsMinus1;
371  UInt*    m_puiColumnWidth;
372  Int      m_iNumRowsMinus1;
373  UInt*    m_puiRowHeight;
374 
375  Bool        m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
376
377  Bool        m_scalingListEnabledFlag;
378  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
379  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
380
381  Bool        m_useDF;
382
383  UInt        m_tilesOrEntropyCodingSyncIdc;
384  Int         m_numSubstreams;
385
386#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
387  Bool  m_bUseDMM;
388#endif
389
390#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER_M23723
391  Bool  m_bUseDMM34;
392#endif
393
394#if H3D_QTL
395  Bool m_bUseQTLPC;
396#endif
397
398#if DEPTH_MAP_GENERATION
399  UInt  m_uiPredDepthMapGeneration;
400  UInt  m_uiPdmPrecision;
401  Int   m_aiPdmScaleNomDelta[MAX_VIEW_NUM];
402  Int   m_aiPdmOffset       [MAX_VIEW_NUM];
403#endif
404
405#if H3D_IVMP
406  UInt  m_uiMultiviewMvPredMode;
407#endif
408#if H3D_IVRP
409  UInt  m_uiMultiviewResPredMode;
410#endif
411
412#if DEPTH_MAP_GENERATION
413  TComDepthMapGenerator* m_pcDepthMapGenerator;
414#endif
415#if H3D_IVRP
416  TComResidualGenerator* m_pcResidualGenerator;
417#endif
418
419#if MTK_D0156
420#if MERL_VSP_COMPENSATION_C0152
421  Bool      m_bUseVSPCompensation;
422#endif
423  Bool      m_bUseDVPRefine;
424#endif
425
426public:
427  TComSPS();
428  virtual ~TComSPS();
429#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
430  Int  getVPSId       ()         { return m_VPSId;          }
431  Void setVPSId       (Int i)    { m_VPSId = i;             }
432#endif
433  Int  getSPSId       ()         { return m_SPSId;          }
434  Void setSPSId       (Int i)    { m_SPSId = i;             }
435  Int  getProfileIdc  ()         { return m_ProfileIdc;     }
436  Void setProfileIdc  (Int i)    { m_ProfileIdc = i;        }
437  Int  getLevelIdc    ()         { return m_LevelIdc;       }
438  Void setLevelIdc    (Int i)    { m_LevelIdc = i;          }
439
440  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
441  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
442 
443  // structure
444  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
445  UInt getPicWidthInLumaSamples       ()         { return  m_picWidthInLumaSamples;    }
446  Void setPicHeightInLumaSamples      ( UInt u ) { m_picHeightInLumaSamples = u;       }
447  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
448
449  Bool getPicCroppingFlag() const          { return m_picCroppingFlag; }
450  Void setPicCroppingFlag(Bool val)        { m_picCroppingFlag = val; }
451  Int  getPicCropLeftOffset() const        { return m_picCropLeftOffset; }
452  Void setPicCropLeftOffset(Int val)       { m_picCropLeftOffset = val; }
453  Int  getPicCropRightOffset() const       { return m_picCropRightOffset; }
454  Void setPicCropRightOffset(Int val)      { m_picCropRightOffset = val; }
455  Int  getPicCropTopOffset() const         { return m_picCropTopOffset; }
456  Void setPicCropTopOffset(Int val)        { m_picCropTopOffset = val; }
457  Int  getPicCropBottomOffset() const      { return m_picCropBottomOffset; }
458  Void setPicCropBottomOffset(Int val)     { m_picCropBottomOffset = val; }
459
460  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
461  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
462  Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u;     }
463  UInt getMaxCUHeight ()         { return  m_uiMaxCUHeight; }
464  Void setMaxCUDepth  ( UInt u ) { m_uiMaxCUDepth = u;      }
465  UInt getMaxCUDepth  ()         { return  m_uiMaxCUDepth;  }
466  Void setUsePCM      ( Bool b ) { m_usePCM = b;           }
467  Bool getUsePCM      ()         { return m_usePCM;        }
468  Void setPCMLog2MaxSize  ( UInt u ) { m_pcmLog2MaxSize = u;      }
469  UInt getPCMLog2MaxSize  ()         { return  m_pcmLog2MaxSize;  }
470  Void setPCMLog2MinSize  ( UInt u ) { m_uiPCMLog2MinSize = u;      }
471  UInt getPCMLog2MinSize  ()         { return  m_uiPCMLog2MinSize;  }
472  Void setBitsForPOC  ( UInt u ) { m_uiBitsForPOC = u;      }
473  UInt getBitsForPOC  ()         { return m_uiBitsForPOC;   }
474  Bool getDisInter4x4()         { return m_bDisInter4x4;        }
475  Void setDisInter4x4      ( Bool b ) { m_bDisInter4x4  = b;          }
476  Bool getUseAMP() { return m_useAMP; }
477  Void setUseAMP( Bool b ) { m_useAMP = b; }
478  Void setMinTrDepth  ( UInt u ) { m_uiMinTrDepth = u;      }
479  UInt getMinTrDepth  ()         { return  m_uiMinTrDepth;  }
480  Void setMaxTrDepth  ( UInt u ) { m_uiMaxTrDepth = u;      }
481  UInt getMaxTrDepth  ()         { return  m_uiMaxTrDepth;  }
482  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
483  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
484  Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u;    }
485  UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
486  Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u;    }
487  Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u;    }
488  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
489  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
490  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
491  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
492  Void      setRPSList( TComRPSList* RPSList )   { m_RPSList = RPSList;       }
493  TComRPSList* getRPSList()                      { return m_RPSList;          }
494  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
495  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
496
497  Void setNumberOfUsableInterViewRefs( Int number )      { m_iNumberOfUsableInterViewRefs = number;    }
498  Int  getNumberOfUsableInterViewRefs()                  { return m_iNumberOfUsableInterViewRefs;      }
499  Void setUsableInterViewRef( Int pos, Int deltaViewId ) { m_aiUsableInterViewRefs[pos] = deltaViewId; }
500  Int  getUsableInterViewRef( Int pos )                  { return m_aiUsableInterViewRefs[pos];        }
501
502 
503  // physical transform
504  Void setMaxTrSize   ( UInt u ) { m_uiMaxTrSize = u;       }
505  UInt getMaxTrSize   ()         { return  m_uiMaxTrSize;   }
506 
507  // Tool list
508  Bool getUseALF      ()         { return m_bUseALF;        }
509  Void setUseALFCoefInSlice(Bool b) {m_bALFCoefInSlice = b;}
510  Bool getUseALFCoefInSlice()    {return m_bALFCoefInSlice;}
511
512  Void setUseALF      ( Bool b ) { m_bUseALF  = b;          }
513  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
514  Bool getUseLComb    ()         { return m_bUseLComb;      }
515  Void setLCMod       (Bool b)   { m_bLCMod = b;     }
516  Bool getLCMod       ()         { return m_bLCMod;  }
517
518  Bool getUseLMChroma ()         { return m_bUseLMChroma;        }
519  Void setUseLMChroma ( Bool b ) { m_bUseLMChroma  = b;          }
520
521#if LOSSLESS_CODING
522  Bool getUseLossless ()         { return m_useLossless; }
523  Void setUseLossless ( Bool b ) { m_useLossless  = b; }
524#endif
525  Bool getUseNSQT() { return m_useNSQT; }
526  Void setUseNSQT( Bool b ) { m_useNSQT = b; }
527 
528  Bool getRestrictedRefPicListsFlag    ()          { return m_restrictedRefPicListsFlag;   }
529  Void setRestrictedRefPicListsFlag    ( Bool b )  { m_restrictedRefPicListsFlag = b;      }
530  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
531  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
532
533  // AMVP mode (for each depth)
534  AMVP_MODE getAMVPMode ( UInt uiDepth ) { assert(uiDepth < g_uiMaxCUDepth);  return m_aeAMVPMode[uiDepth]; }
535  Void      setAMVPMode ( UInt uiDepth, AMVP_MODE eMode) { assert(uiDepth < g_uiMaxCUDepth);  m_aeAMVPMode[uiDepth] = eMode; }
536 
537  // AMP accuracy
538  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
539  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
540
541  // Bit-depth
542  UInt      getBitDepth     ()         { return m_uiBitDepth;     }
543  Void      setBitDepth     ( UInt u ) { m_uiBitDepth = u;        }
544  UInt      getBitIncrement ()         { return m_uiBitIncrement; }
545  Void      setBitIncrement ( UInt u ) { m_uiBitIncrement = u;    }
546  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
547  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
548  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
549  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
550
551  Void      setLFCrossSliceBoundaryFlag     ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
552  Bool      getLFCrossSliceBoundaryFlag     ()                    { return m_bLFCrossSliceBoundaryFlag;   } 
553
554  Void setUseDF                   ( Bool b ) { m_useDF = b; }
555  Bool getUseDF                   ()         { return m_useDF; }
556
557  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
558  Bool getUseSAO                  ()           {return m_bUseSAO;}
559
560#if HHI_MPI
561  Void setUseMVI                  (Bool bVal)  {m_bUseMVI = bVal;}
562  Bool getUseMVI                  ()           {return m_bUseMVI;}
563#endif
564 
565#if RWTH_SDC_DLT_B0036
566  Bool getUseDLT      ()          { return m_bUseDLT; }
567  Void setUseDLT      ( Bool b ) { m_bUseDLT  = b;          }
568 
569  UInt getBitsPerDepthValue()       { return m_bUseDLT?m_uiBitsPerDepthValue:g_uiBitDepth; }
570  UInt getNumDepthValues()          { return m_bUseDLT?m_uiNumDepthmapValues:g_uiIBDI_MAX; }
571  UInt depthValue2idx(Pel uiValue)  { return m_bUseDLT?m_uiDepthValue2Idx[uiValue]:uiValue; }
572  Pel  idx2DepthValue(UInt uiIdx)   { return m_bUseDLT?m_uiIdx2DepthValue[uiIdx]:uiIdx; }
573  Void setDepthLUTs   (UInt* uidx2DepthValue = NULL, UInt uiNumDepthValues = 0);
574#endif
575
576  UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
577  Void      setMaxTLayers( UInt uiMaxTLayers )        { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
578
579  Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
580  Void      setTemporalIdNestingFlag( Bool bValue )   { m_bTemporalIdNestingFlag = bValue; }
581  UInt      getPCMBitDepthLuma     ()         { return m_uiPCMBitDepthLuma;     }
582  Void      setPCMBitDepthLuma     ( UInt u ) { m_uiPCMBitDepthLuma = u;        }
583  UInt      getPCMBitDepthChroma   ()         { return m_uiPCMBitDepthChroma;   }
584  Void      setPCMBitDepthChroma   ( UInt u ) { m_uiPCMBitDepthChroma = u;      }
585  Void      setPCMFilterDisableFlag     ( Bool   bValue  )    { m_bPCMFilterDisableFlag = bValue; }
586  Bool      getPCMFilterDisableFlag     ()                    { return m_bPCMFilterDisableFlag;   } 
587
588  Void    setLFCrossTileBoundaryFlag               ( Bool   bValue  )    { m_bLFCrossTileBoundaryFlag = bValue; }
589  Bool    getLFCrossTileBoundaryFlag               ()                    { return m_bLFCrossTileBoundaryFlag;   }
590  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
591  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
592  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
593  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
594  Void     setColumnWidth ( UInt* columnWidth )
595  {
596    if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 )
597    {
598      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
599
600      for(Int i=0; i<m_iNumColumnsMinus1; i++)
601      {
602        m_puiColumnWidth[i] = columnWidth[i];
603     }
604    }
605  }
606  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
607  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
608  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
609  Void     setRowHeight    ( UInt* rowHeight )
610  {
611    if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )
612    {
613      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
614
615      for(Int i=0; i<m_iNumRowsMinus1; i++)
616      {
617        m_puiRowHeight[i] = rowHeight[i];
618      }
619    }
620  }
621  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
622  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
623  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
624  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
625  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
626  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
627  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
628  UInt getTilesOrEntropyCodingSyncIdc ()                    { return m_tilesOrEntropyCodingSyncIdc;   }
629  Void setTilesOrEntropyCodingSyncIdc ( UInt val )          { m_tilesOrEntropyCodingSyncIdc = val;    }
630  Int  getNumSubstreams               ()                    { return m_numSubstreams;                 }
631  Void setNumSubstreams               ( Int numSubstreams ) { m_numSubstreams = numSubstreams;        }
632
633#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
634  Bool getUseDMM()         { return m_bUseDMM; }
635  Void setUseDMM( Bool b ) { m_bUseDMM = b;    }
636#endif
637
638#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER_M23723
639  Bool getUseDMM34()         { return m_bUseDMM34; }
640  Void setUseDMM34( Bool b ) { m_bUseDMM34 = b;    }
641#endif
642
643#if H3D_QTL
644  Void setUseQTLPC( Bool b ) { m_bUseQTLPC = b;    }
645  Bool getUseQTLPC()         { return m_bUseQTLPC; }
646#endif
647
648  Void initMultiviewSPS      ( UInt uiViewId, Int iViewOrderIdx = 0, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
649#if FCO_FIX_SPS_CHANGE
650  Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
651#else
652  Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx );
653#endif
654
655  UInt getViewId             ()  { return m_uiViewId; }
656  Int  getViewOrderIdx       ()  { return m_iViewOrderIdx; }
657  Bool isDepth               ()  { return m_bDepth; }
658  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
659  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
660  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
661  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
662  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
663  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
664
665
666#if DEPTH_MAP_GENERATION
667  Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
668#endif
669#if H3D_IVRP
670  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
671#endif
672
673#if DEPTH_MAP_GENERATION
674  UInt getPredDepthMapGeneration()          { return m_uiPredDepthMapGeneration; }
675  UInt getPdmPrecision          ()          { return m_uiPdmPrecision;           }
676  Int* getPdmScaleNomDelta      ()          { return m_aiPdmScaleNomDelta;       }
677  Int* getPdmOffset             ()          { return m_aiPdmOffset;              }
678#endif
679
680#if H3D_IVMP
681  UInt  getMultiviewMvPredMode   ()          { return m_uiMultiviewMvPredMode;    }
682#endif
683#if H3D_IVRP
684  UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
685#endif
686
687#if DEPTH_MAP_GENERATION
688  Void                    setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
689  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
690#endif
691#if H3D_IVRP
692  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
693  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
694#endif
695
696#if MTK_D0156
697
698#if MERL_VSP_COMPENSATION_C0152
699  Bool    getUseVSPCompensation( ){  return m_bUseVSPCompensation;}
700  Void    setUseVSPCompensation( Bool bValue ){ m_bUseVSPCompensation = bValue;}
701#endif
702
703  Bool    getUseDVPRefine( ){  return m_bUseDVPRefine;}
704  Void    setUseDVPRefine( Bool bValue ){ m_bUseDVPRefine = bValue;}
705
706#endif
707};
708
709
710/// Reference Picture Lists class
711class TComRefPicListModification
712{
713private:
714  UInt      m_bRefPicListModificationFlagL0; 
715  UInt      m_bRefPicListModificationFlagL1; 
716  UInt      m_RefPicSetIdxL0[32];
717  UInt      m_RefPicSetIdxL1[32];
718   
719public:
720  TComRefPicListModification();
721  virtual ~TComRefPicListModification();
722 
723  Void  create                    ();
724  Void  destroy                   ();
725
726  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
727  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
728  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
729  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
730  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
731  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
732  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
733  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
734};
735
736/// PPS class
737class TComPPS
738{
739private:
740  Int         m_PPSId;                    // pic_parameter_set_id
741  Int         m_SPSId;                    // seq_parameter_set_id
742  Int         m_picInitQPMinus26;
743  Bool        m_useDQP;
744  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
745 
746  // access channel
747  TComSPS*    m_pcSPS;
748  UInt        m_uiMaxCuDQPDepth;
749  UInt        m_uiMinCuDQPSize;
750
751  Int        m_iChromaQpOffset;
752  Int        m_iChromaQpOffset2nd;
753
754
755
756  Int         m_iSliceGranularity;
757
758  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
759  UInt        m_uiBiPredIdc;              // Use of Weighting Bi-Prediction (B_SLICE)
760
761  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
762
763  Int      m_iTileBehaviorControlPresentFlag;
764  Bool     m_bLFCrossTileBoundaryFlag;
765  Int      m_iColumnRowInfoPresent;
766  Int      m_iUniformSpacingIdr;
767  Int      m_iNumColumnsMinus1;
768  UInt*    m_puiColumnWidth;
769  Int      m_iNumRowsMinus1;
770  UInt*    m_puiRowHeight;
771 
772  Int      m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header!
773  Int      m_iNumSubstreams;
774
775  Bool     m_enableTMVPFlag;
776
777  Int      m_signHideFlag;
778  Int      m_signHidingThreshold;
779
780#if CABAC_INIT_FLAG
781  Bool     m_cabacInitPresentFlag;
782  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
783#if FIX_POZNAN_CABAC_INIT_FLAG
784  UInt     m_encPrevPOC;
785#endif
786#endif
787  Bool     m_DeblockingFilterControlPresent;
788  UInt m_log2ParallelMergeLevelMinus2;
789public:
790  TComPPS();
791  virtual ~TComPPS();
792 
793  Int       getPPSId ()      { return m_PPSId; }
794  Void      setPPSId (Int i) { m_PPSId = i; }
795  Int       getSPSId ()      { return m_SPSId; }
796  Void      setSPSId (Int i) { m_SPSId = i; }
797 
798  Int       getSliceGranularity()        { return m_iSliceGranularity; }
799  Void      setSliceGranularity( Int i ) { m_iSliceGranularity = i;    }
800  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
801  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
802  Bool      getUseDQP ()                   { return m_useDQP;        }
803  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
804  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
805  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
806
807
808  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
809  TComSPS*  getSPS              ()         { return m_pcSPS;          }
810  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
811  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
812  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
813  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
814
815  Void      setChromaQpOffset   ( Int i ) { m_iChromaQpOffset = i; }
816  Int       getChromaQpOffset   () { return m_iChromaQpOffset;}
817  Void      setChromaQpOffset2nd( Int i ) { m_iChromaQpOffset2nd = i; }
818  Int       getChromaQpOffset2nd() { return m_iChromaQpOffset2nd;}
819
820  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
821  UInt getWPBiPredIdc               ()          { return m_uiBiPredIdc;     }
822
823  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
824  Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;        }
825
826  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
827  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
828
829  Void    setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
830  Int     getTileBehaviorControlPresentFlag        ()                    { return m_iTileBehaviorControlPresentFlag; }
831  Void    setLFCrossTileBoundaryFlag               ( Bool   bValue  )    { m_bLFCrossTileBoundaryFlag = bValue; }
832  Bool    getLFCrossTileBoundaryFlag               ()                    { return m_bLFCrossTileBoundaryFlag;   }
833  Void     setColumnRowInfoPresent          ( Int i )           { m_iColumnRowInfoPresent = i; }
834  Int      getColumnRowInfoPresent          ()                  { return m_iColumnRowInfoPresent; }
835  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
836  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
837  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
838  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
839  Void     setColumnWidth ( UInt* columnWidth )
840  {
841    if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 )
842    {
843      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
844
845      for(Int i=0; i<m_iNumColumnsMinus1; i++)
846      {
847        m_puiColumnWidth[i] = columnWidth[i];
848      }
849    }
850  }
851  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
852  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
853  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
854  Void     setRowHeight    ( UInt* rowHeight )
855  {
856    if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )
857    {
858      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
859
860      for(Int i=0; i<m_iNumRowsMinus1; i++)
861      {
862        m_puiRowHeight[i] = rowHeight[i];
863      }
864    }
865  }
866  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
867  Void     setEntropyCodingMode(Int iEntropyCodingMode)       { m_iEntropyCodingMode = iEntropyCodingMode; }
868  Int      getEntropyCodingMode()                             { return m_iEntropyCodingMode; }
869  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
870  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
871
872  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
873  Void      setTSIG( Int tsig )                 { m_signHidingThreshold = tsig; }
874  Int       getSignHideFlag()                    { return m_signHideFlag; }
875  Int       getTSIG()                            { return m_signHidingThreshold; }
876
877  Void     setEnableTMVPFlag( Bool b )  { m_enableTMVPFlag = b;    }
878  Bool     getEnableTMVPFlag()          { return m_enableTMVPFlag; }
879
880#if CABAC_INIT_FLAG
881  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
882  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
883  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
884  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
885#if FIX_POZNAN_CABAC_INIT_FLAG
886  Void     setEncPrevPOC(UInt uiPOC)                { m_encPrevPOC = uiPOC;             }
887  UInt     getEncPrevPOC()                          { return m_encPrevPOC;              }
888#endif
889#endif
890  Void setDeblockingFilterControlPresent    ( Bool bValue )       { m_DeblockingFilterControlPresent = bValue; }
891  Bool getDeblockingFilterControlPresent    ()                    { return m_DeblockingFilterControlPresent; }
892  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
893  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
894};
895
896/// SCALING_LIST class
897class TComScalingList
898{
899public:
900  TComScalingList();
901  virtual ~TComScalingList();
902  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
903  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
904  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
905  Bool     checkPredMode                  (UInt sizeId, UInt listId);
906  Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
907  UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
908  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
909  Void     processDefaultMarix            (UInt sizeId, UInt listId);
910  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
911  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
912  Void     checkDcOfMatrix                ();
913  Void     setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b)   { m_useDefaultScalingMatrixFlag[sizeId][listId] = b;    } //!< set default matrix enabled/disabled in each matrix
914  Bool     getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId)           { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix
915  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
916  Bool     xParseScalingList              (char* pchFile);
917
918private:
919  Void     init                    ();
920  Void     destroy                 ();
921  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
922  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
923  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
924  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
925  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
926  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
927};
928
929/// APS class
930class TComAPS
931{
932public:
933  TComAPS();
934  virtual ~TComAPS();
935
936  Void      setAPSID      (Int iID)   {m_apsID = iID;            }  //!< set APS ID
937  Int       getAPSID      ()          {return m_apsID;           }  //!< get APS ID
938  Void      setSaoEnabled (Bool bVal) {m_bSaoEnabled = bVal;     }  //!< set SAO enabled/disabled in APS
939  Bool      getSaoEnabled ()          {return m_bSaoEnabled;     }  //!< get SAO enabled/disabled in APS
940  Void      setAlfEnabled (Bool bVal) {m_bAlfEnabled = bVal;     }  //!< set ALF enabled/disabled in APS
941  Bool      getAlfEnabled ()          {return m_bAlfEnabled;     }  //!< get ALF enabled/disabled in APS
942
943  AlfParamSet* getAlfParam   ()          {return m_alfParamSet;}
944  SAOParam* getSaoParam   ()          {return m_pSaoParam;       }  //!< get SAO parameters in APS
945
946  Void      createSaoParam();   //!< create SAO parameter object
947  Void      destroySaoParam();  //!< destroy SAO parameter object
948
949  Void      createAlfParam();   //!< create ALF parameter object
950  Void      destroyAlfParam();  //!< destroy ALF parameter object
951
952  Void      setLoopFilterOffsetInAPS(Bool val)  {m_loopFilterOffsetInAPS = val; }      //!< set offset for deblocking filter enabled/disabled in APS
953  Bool      getLoopFilterOffsetInAPS()          {return m_loopFilterOffsetInAPS; }     //!< get offset for deblocking filter enabled/disabled in APS
954  Void      setLoopFilterDisable(Bool val)      {m_loopFilterDisable = val; }          //!< set offset for deblocking filter disabled
955  Bool      getLoopFilterDisable()              {return m_loopFilterDisable; }         //!< get offset for deblocking filter disabled
956  Void      setLoopFilterBetaOffset(Int val)    {m_loopFilterBetaOffsetDiv2 = val; }    //!< set beta offset for deblocking filter
957  Int       getLoopFilterBetaOffset()           {return m_loopFilterBetaOffsetDiv2; }   //!< get beta offset for deblocking filter
958  Void      setLoopFilterTcOffset(Int val)      {m_loopFilterTcOffsetDiv2 = val; }      //!< set tc offset for deblocking filter
959  Int       getLoopFilterTcOffset()             {return m_loopFilterTcOffsetDiv2; }     //!< get tc offset for deblocking filter
960
961  Void      createScalingList();
962  Void      destroyScalingList();
963  Void      setScalingListEnabled (Bool bVal) { m_scalingListEnabled = bVal; }  //!< set ScalingList enabled/disabled in APS
964  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
965  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
966#if !LGE_SAO_MIGRATION_D0091
967  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
968  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
969#endif
970
971private:
972  Int         m_apsID;        //!< APS ID
973  Bool        m_bSaoEnabled;  //!< SAO enabled/disabled in APS (true for enabled)
974  Bool        m_bAlfEnabled;  //!< ALF enabled/disabled in APS (true for enabled)
975  SAOParam*   m_pSaoParam;    //!< SAO parameter object pointer
976  AlfParamSet*   m_alfParamSet;
977  Bool        m_loopFilterOffsetInAPS;       //< offset for deblocking filter in 0 = slice header, 1 = APS
978  Bool        m_loopFilterDisable;           //< Deblocking filter enabled/disabled in APS
979  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
980  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
981  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
982  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
983#if !LGE_SAO_MIGRATION_D0091
984  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
985#endif
986
987public:
988  TComAPS& operator= (const TComAPS& src);  //!< "=" operator for APS object
989};
990
991typedef struct {
992  // Explicit weighted prediction parameters parsed in slice header,
993  // or Implicit weighted prediction parameters (8 bits depth values).
994  Bool        bPresentFlag;
995  UInt        uiLog2WeightDenom;
996  Int         iWeight;
997  Int         iOffset;
998
999  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
1000  Int         w, o, offset, shift, round;
1001} wpScalingParam;
1002
1003typedef struct {
1004  Int64 iAC;
1005  Int64 iDC;
1006} wpACDCParam;
1007
1008/// slice header class
1009class TComSlice
1010{
1011 
1012private:
1013  //  Bitstream writing
1014  Int         m_iAPSId; //!< APS ID in slice header
1015  bool       m_alfEnabledFlag;
1016  bool       m_saoEnabledFlag;
1017#if LGE_SAO_MIGRATION_D0091
1018  bool       m_saoEnabledFlagChroma;      ///< SAO Cb&Cr enabled flag
1019#else
1020  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
1021  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
1022  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
1023#endif
1024  Int         m_iPPSId;               ///< picture parameter set ID
1025  Bool        m_PicOutputFlag;        ///< pic_output_flag
1026  Int         m_iPOC;
1027  Int         m_iLastIDR;
1028  static Int  m_prevPOC;
1029  TComReferencePictureSet *m_pcRPS;
1030  TComReferencePictureSet m_LocalRPS;
1031  Int         m_iBDidx; 
1032  Int         m_iCombinationBDidx;
1033  Bool        m_bCombineWithReferenceFlag;
1034  TComRefPicListModification m_RefPicListModification;
1035  NalUnitType m_eNalUnitType;            ///< Nal unit type for the slice
1036  NalUnitType m_eNalUnitTypeBaseViewMvc; ///< Nal unit type of the base view slice for multiview coding
1037  SliceType   m_eSliceType;
1038  Int         m_iSliceQp;
1039#if ADAPTIVE_QP_SELECTION
1040  Int         m_iSliceQpBase;
1041#endif
1042  Bool        m_bLoopFilterDisable;
1043  Bool        m_loopFilterOffsetInAPS;
1044  Bool        m_inheritDblParamFromAPS;      //< offsets for deblocking filter inherit from APS
1045  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1046  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1047 
1048  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
1049
1050  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
1051  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
1052  Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
1053  Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
1054  Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
1055  Bool        m_bRefPicListModificationFlagLC;
1056  Bool        m_bRefPicListCombinationFlag;
1057
1058  Bool        m_bCheckLDC;
1059#if QC_TMVP_MRG_REFIDX_C0047
1060  Int         m_aiNewRefIdx    [2]; 
1061#endif
1062
1063  //  Data
1064  Int         m_iSliceQpDelta;
1065  TComPic*    m_apcRefPicList  [2][MAX_NUM_REF+1];
1066  Int         m_aiRefPOCList   [2][MAX_NUM_REF+1];
1067  Int         m_aiRefViewIdList[2][MAX_NUM_REF+1];
1068  TComPic*    m_pcTexturePic;
1069  Int         m_iDepth;
1070 
1071  // referenced slice?
1072  Bool        m_bRefenced;
1073 
1074  // access channel
1075#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1076  TComVPS*    m_pcVPS;
1077#endif
1078#if QC_IV_AS_LT_B0046
1079  Bool        m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
1080#endif
1081  TComSPS*    m_pcSPS;
1082  TComPPS*    m_pcPPS;
1083  TComPic*    m_pcPic;
1084#if ADAPTIVE_QP_SELECTION
1085  TComTrQuant* m_pcTrQuant;
1086#endif 
1087  TComAPS*    m_pcAPS;  //!< pointer to APS parameter object
1088
1089  UInt        m_uiColDir;  // direction to get colocated CUs
1090 
1091#if COLLOCATED_REF_IDX
1092  UInt        m_colRefIdx;
1093#endif
1094
1095#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA
1096  Double      m_dLambdaLuma;
1097  Double      m_dLambdaChroma;
1098#else
1099  Double      m_dLambda;
1100#endif
1101
1102  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
1103 
1104  Bool        m_bNoBackPredFlag;
1105  Bool        m_bRefIdxCombineCoding;
1106
1107  UInt        m_uiTLayer;
1108  Bool        m_bTLayerSwitchingFlag;
1109
1110  UInt        m_uiSliceMode;
1111  UInt        m_uiSliceArgument;
1112  UInt        m_uiSliceCurStartCUAddr;
1113  UInt        m_uiSliceCurEndCUAddr;
1114  UInt        m_uiSliceIdx;
1115  UInt        m_uiEntropySliceMode;
1116  UInt        m_uiEntropySliceArgument;
1117  UInt        m_uiEntropySliceCurStartCUAddr;
1118  UInt        m_uiEntropySliceCurEndCUAddr;
1119  Bool        m_bNextSlice;
1120  Bool        m_bNextEntropySlice;
1121  UInt        m_uiSliceBits;
1122  UInt        m_uiEntropySliceCounter;
1123  Bool        m_bFinalized;
1124
1125  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
1126  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
1127  wpScalingParam  m_weightPredTableLC[2*MAX_NUM_REF][3]; // [refIdxLC][0:Y, 1:U, 2:V]
1128
1129  UInt        *m_uiTileByteLocation;
1130  UInt        m_uiTileCount;
1131  Int         m_iTileMarkerFlag;
1132  UInt        m_uiTileOffstForMultES;
1133
1134  UInt*       m_puiSubstreamSizes;
1135  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
1136#if CABAC_INIT_FLAG
1137  Bool        m_cabacInitFlag; 
1138#else
1139  Int         m_cabacInitIdc; 
1140#endif
1141
1142  Bool       m_bLMvdL1Zero;
1143  Int         m_numEntryPointOffsets;
1144
1145  Int        m_viewId;
1146  Bool       m_isDepth;
1147  Int        m_aaiCodedScale [2][MAX_VIEW_NUM];
1148  Int        m_aaiCodedOffset[2][MAX_VIEW_NUM];
1149
1150#if LGE_ILLUCOMP_B0045
1151  Bool        m_bApplyIC;
1152#if SHARP_ILLUCOMP_PARSE_D0060
1153  Bool        m_icSkipParseFlag;
1154#endif
1155#endif
1156#if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
1157  Bool       m_bIVScalingFlag;
1158  Int        m_iViewOrderIdx;    // will be changed to view_id
1159#endif
1160
1161#if MERL_VSP_C0152
1162  TComPic*     m_apcRefPicBaseTxt;
1163  TComPic*     m_apcRefPicBaseDepth;
1164  Int*         m_aiShiftLUT;
1165  Int          m_iShiftPrec;
1166#endif
1167
1168
1169public:
1170  TComSlice();
1171  virtual ~TComSlice();
1172 
1173  Void      initSlice       ();
1174  Void      initTiles();
1175
1176#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1177  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
1178  TComVPS*  getVPS          () { return m_pcVPS; }
1179#endif
1180#if QC_IV_AS_LT_B0046
1181  Void          setWasLongTerm( Bool lt,  RefPicList e, Int iRefIdx ) { m_bWasLongTerm[e][iRefIdx] = lt; }
1182  Bool          getWasLongTerm( RefPicList e, Int iRefIdx           ) { return m_bWasLongTerm[e][iRefIdx] ; }
1183#endif
1184
1185  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1186  TComSPS*  getSPS          () { return m_pcSPS; }
1187 
1188  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
1189  TComPPS*  getPPS          () { return m_pcPPS; }
1190
1191#if ADAPTIVE_QP_SELECTION
1192  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
1193  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
1194#endif
1195
1196  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
1197  Int       getPPSId        () { return m_iPPSId; }
1198  Void      setAPS          ( TComAPS* pcAPS ) { m_pcAPS = pcAPS; } //!< set APS pointer
1199  TComAPS*  getAPS          ()                 { return m_pcAPS;  } //!< get APS pointer
1200  Void      setAPSId        ( Int Id)          { m_iAPSId =Id;    } //!< set APS ID
1201  Int       getAPSId        ()                 { return m_iAPSId; } //!< get APS ID
1202  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
1203  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
1204  Void      setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; }
1205  Bool      getAlfEnabledFlag() { return m_alfEnabledFlag; }
1206  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
1207  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
1208#if LGE_SAO_MIGRATION_D0091
1209  Void      setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; }       //!< set SAO Cb&Cr enabled flag
1210  Bool      getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; }        //!< get SAO Cb&Cr enabled flag
1211#else
1212  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
1213  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
1214  Void      setSaoEnabledFlagCb(Bool s) {m_saoEnabledFlagCb =s; }       //!< set SAO Cb enabled flag
1215  Bool      getSaoEnabledFlagCb() { return m_saoEnabledFlagCb; }        //!< get SAO Cb enabled flag
1216  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
1217  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
1218#endif
1219  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
1220  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
1221  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
1222
1223  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
1224  Int       getRPSidx          () { return m_iBDidx; }
1225  Void      setCombinationBDidx          ( Int iCombinationBDidx ) { m_iCombinationBDidx = iCombinationBDidx; }
1226  Int       getCombinationBDidx          () { return m_iCombinationBDidx; }
1227  Void      setCombineWithReferenceFlag          ( Bool bCombineWithReferenceFlag ) { m_bCombineWithReferenceFlag = bCombineWithReferenceFlag; }
1228  Bool      getCombineWithReferenceFlag          () { return m_bCombineWithReferenceFlag; }
1229  Int       getPrevPOC      ()                          { return  m_prevPOC;       }
1230
1231  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
1232  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
1233  Int       getLastIDR()                                  { return m_iLastIDR; }
1234  SliceType getSliceType    ()                          { return  m_eSliceType;         }
1235  Int       getPOC          ()                          { return  m_iPOC;           }
1236  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
1237#if ADAPTIVE_QP_SELECTION
1238  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
1239#endif
1240  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
1241  Bool      getLoopFilterDisable()                      { return  m_bLoopFilterDisable; }
1242  Bool      getLoopFilterOffsetInAPS()                  { return  m_loopFilterOffsetInAPS;}
1243  Bool      getInheritDblParamFromAPS()                 { return  m_inheritDblParamFromAPS; }
1244  Int       getLoopFilterBetaOffset()                   { return  m_loopFilterBetaOffsetDiv2; }
1245  Int       getLoopFilterTcOffset()                     { return  m_loopFilterTcOffsetDiv2; }
1246
1247  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
1248  TComPic*  getPic              ()                              { return  m_pcPic;                      }
1249  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
1250  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
1251  Int       getRefViewId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefViewIdList[e][iRefIdx]; }
1252  TComPic*  getTexturePic       () const                        { return  m_pcTexturePic; }
1253  Int       getDepth            ()                              { return  m_iDepth;                     }
1254  UInt      getColDir           ()                              { return  m_uiColDir;                   }
1255#if COLLOCATED_REF_IDX
1256  Bool      getColRefIdx        ()                              { return  m_colRefIdx;                  }
1257  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
1258#endif
1259  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
1260  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
1261  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
1262  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
1263  Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
1264  Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
1265  Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
1266  Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
1267  Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
1268  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
1269  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}     
1270  Void      setListIdFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_eListIdFromIdxOfLC[iRefIdx]=uiVal; }
1271  Void      setRefIdxFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_iRefIdxFromIdxOfLC[iRefIdx]=uiVal; }
1272  Void      setRefIdxOfLC       (RefPicList e, Int iRefIdx, Int RefIdxLC)     { m_iRefIdxOfLC[e][iRefIdx]=RefIdxLC;}
1273
1274  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
1275  Bool      isReferenced()                                      { return m_bRefenced; }
1276 
1277  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
1278  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
1279  NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
1280  Void      setNalUnitTypeBaseViewMvc  ( NalUnitType e )        { m_eNalUnitTypeBaseViewMvc = e;    }
1281  NalUnitType getNalUnitTypeBaseViewMvc()                       { return m_eNalUnitTypeBaseViewMvc; }
1282  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic);
1283  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
1284  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
1285  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
1286#if ADAPTIVE_QP_SELECTION
1287  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
1288#endif
1289  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
1290  Void      setLoopFilterDisable( Bool b )                      { m_bLoopFilterDisable= b;      }
1291  Void      setLoopFilterOffsetInAPS( Bool b )                  { m_loopFilterOffsetInAPS = b;}
1292  Void      setInheritDblParamFromAPS( Bool b )                 { m_inheritDblParamFromAPS = b; }
1293  Void      setLoopFilterBetaOffset( Int i )                    { m_loopFilterBetaOffsetDiv2 = i; }
1294  Void      setLoopFilterTcOffset( Int i )                      { m_loopFilterTcOffsetDiv2 = i; }
1295 
1296  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
1297  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
1298  Void      setRefViewId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewIdList[e][iRefIdx] = i; }
1299  Void      setTexturePic       ( TComPic *pcTexturePic )       { m_pcTexturePic = pcTexturePic; }
1300  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
1301  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
1302  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
1303 
1304  Int       getNumPocTotalCurr();
1305  Int       getNumPocTotalCurrMvc();
1306  Void      setRefPicListMvc    ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics );
1307  Void      setRefPOCnViewListsMvc();
1308
1309  Void      setColDir           ( UInt uiDir ) { m_uiColDir = uiDir; }
1310#if COLLOCATED_REF_IDX
1311  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
1312#endif
1313  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
1314  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
1315
1316  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
1317  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
1318  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
1319 
1320#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 
1321  Void      setLambda( Double d, Double e ) { m_dLambdaLuma = d; m_dLambdaChroma = e;}
1322  Double    getLambdaLuma() { return m_dLambdaLuma;        }
1323  Double    getLambdaChroma() { return m_dLambdaChroma;        }
1324#else
1325  Void      setLambda( Double d ) { m_dLambda = d; }
1326  Double    getLambda() { return m_dLambda;        }
1327#endif
1328 
1329  Void      initEqualRef();
1330  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
1331  {
1332    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
1333    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
1334  }
1335 
1336  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
1337  {
1338    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
1339  }
1340 
1341  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
1342 
1343  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
1344  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
1345  Bool getRefIdxCombineCoding() { return m_bRefIdxCombineCoding; }
1346  Void setRefIdxCombineCoding( Bool b ) { m_bRefIdxCombineCoding = b; }
1347  Void generateCombinedList       ();
1348
1349  UInt getTLayer             ()                            { return m_uiTLayer;                      }
1350  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
1351
1352
1353  Void setTLayerInfo( UInt uiTLayer );
1354  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
1355  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1356#if H0566_TLA_SET_FOR_SWITCHING_POINTS
1357  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1358#endif
1359  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0);
1360  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
1361
1362  Void decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC );
1363
1364  UInt m_uiMaxNumMergeCand;
1365  Void setMaxNumMergeCand               (UInt maxNumMergeCand ) { m_uiMaxNumMergeCand = maxNumMergeCand;  }
1366  UInt getMaxNumMergeCand               ()                  {return m_uiMaxNumMergeCand;                  }
1367
1368  Void setSliceMode                     ( UInt uiMode )     { m_uiSliceMode = uiMode;                     }
1369  UInt getSliceMode                     ()                  { return m_uiSliceMode;                       }
1370  Void setSliceArgument                 ( UInt uiArgument ) { m_uiSliceArgument = uiArgument;             }
1371  UInt getSliceArgument                 ()                  { return m_uiSliceArgument;                   }
1372  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_uiSliceCurStartCUAddr = uiAddr;           }
1373  UInt getSliceCurStartCUAddr           ()                  { return m_uiSliceCurStartCUAddr;             }
1374  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_uiSliceCurEndCUAddr = uiAddr;             }
1375  UInt getSliceCurEndCUAddr             ()                  { return m_uiSliceCurEndCUAddr;               }
1376  Void setSliceIdx                      ( UInt i)           { m_uiSliceIdx = i;                           }
1377  UInt getSliceIdx                      ()                  { return  m_uiSliceIdx;                       }
1378  Void copySliceInfo                    (TComSlice *pcSliceSrc);
1379  Void setEntropySliceMode              ( UInt uiMode )     { m_uiEntropySliceMode = uiMode;              }
1380  UInt getEntropySliceMode              ()                  { return m_uiEntropySliceMode;                }
1381  Void setEntropySliceArgument          ( UInt uiArgument ) { m_uiEntropySliceArgument = uiArgument;      }
1382  UInt getEntropySliceArgument          ()                  { return m_uiEntropySliceArgument;            }
1383  Void setEntropySliceCurStartCUAddr    ( UInt uiAddr )     { m_uiEntropySliceCurStartCUAddr = uiAddr;    }
1384  UInt getEntropySliceCurStartCUAddr    ()                  { return m_uiEntropySliceCurStartCUAddr;      }
1385  Void setEntropySliceCurEndCUAddr      ( UInt uiAddr )     { m_uiEntropySliceCurEndCUAddr = uiAddr;      }
1386  UInt getEntropySliceCurEndCUAddr      ()                  { return m_uiEntropySliceCurEndCUAddr;        }
1387  Void setNextSlice                     ( Bool b )          { m_bNextSlice = b;                           }
1388  Bool isNextSlice                      ()                  { return m_bNextSlice;                        }
1389  Void setNextEntropySlice              ( Bool b )          { m_bNextEntropySlice = b;                    }
1390  Bool isNextEntropySlice               ()                  { return m_bNextEntropySlice;                 }
1391  Void setSliceBits                     ( UInt uiVal )      { m_uiSliceBits = uiVal;                      }
1392  UInt getSliceBits                     ()                  { return m_uiSliceBits;                       } 
1393  Void setEntropySliceCounter           ( UInt uiVal )      { m_uiEntropySliceCounter = uiVal;            }
1394  UInt getEntropySliceCounter           ()                  { return m_uiEntropySliceCounter;             }
1395  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
1396  Bool getFinalized                     ()                  { return m_bFinalized;                        }
1397  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
1398  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
1399
1400  Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1401  Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1402  Void  initWpScaling   ();
1403  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPredIdc()) ); }
1404 
1405  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
1406  Void  getWpAcDcParam  ( wpACDCParam *&wp );
1407  Void  initWpAcDcParam ();
1408  Void  copyWPtable     (wpScalingParam *&wp_src, wpScalingParam *&wp_dst);
1409  Void  getWpScalingLC  ( Int iRefIdx, wpScalingParam *&wp);
1410  Void  resetWpScalingLC(wpScalingParam  wp[2*MAX_NUM_REF][3]);
1411  Void  setWpParamforLC();
1412  Void setTileLocationCount             ( UInt uiCount )      { m_uiTileCount = uiCount;                  }
1413  UInt getTileLocationCount             ()                    { return m_uiTileCount;                     }
1414  Void setTileLocation                  ( Int i, UInt uiLOC ) { m_uiTileByteLocation[i] = uiLOC;          }
1415  UInt getTileLocation                  ( Int i )             { return m_uiTileByteLocation[i];           }
1416  Void setTileMarkerFlag                ( Int iFlag )         { m_iTileMarkerFlag = iFlag;                }
1417  Int  getTileMarkerFlag                ()                    { return m_iTileMarkerFlag;                 }
1418  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
1419  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
1420  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
1421  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
1422  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
1423  TComScalingList*   getScalingList ()                               { return m_scalingList; }
1424  Void  setDefaultScalingList       ();
1425  Bool  checkDefaultScalingList     ();
1426#if CABAC_INIT_FLAG
1427  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
1428  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
1429#else
1430  Void      setCABACinitIDC(Int iVal) {m_cabacInitIdc = iVal;    }  //!< set CABAC initial IDC number
1431  Int       getCABACinitIDC()         {return m_cabacInitIdc;    }  //!< get CABAC initial IDC number
1432#endif
1433  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
1434  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
1435
1436  Void setViewId( Int viewId )       { m_viewId = viewId;   }
1437  Int  getViewId()                   { return m_viewId;     }
1438#if QC_MVHEVC_B0046
1439  Void    setViewOrderIdx(Int v, UInt layer)                { m_iViewOrderIdx = v;    }
1440  Int     getViewOrderIdx()                                 { return m_iViewOrderIdx; }
1441#endif
1442  Void setIsDepth( Bool isDepth )    { m_isDepth = isDepth; }
1443  Bool getIsDepth()                  { return m_isDepth;    }
1444 
1445  Void      initMultiviewSlice    ( Int** aaiScale = 0, Int** aaiOffset = 0 );
1446
1447  Int*      getCodedScale         ()  { return m_aaiCodedScale [0]; }
1448  Int*      getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
1449  Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
1450  Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
1451
1452#if LGE_ILLUCOMP_B0045
1453  Void      setApplyIC            ( Bool b ) { m_bApplyIC = b; }
1454  Bool      getApplyIC            ()  { return m_bApplyIC; }
1455  Void      xSetApplyIC           ();
1456#if SHARP_ILLUCOMP_PARSE_D0060
1457  Void      setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; }
1458  Bool      getIcSkipParseFlag() { return m_icSkipParseFlag; }
1459#endif
1460#endif
1461#if QC_TMVP_MRG_REFIDX_C0047
1462  Int       getNewRefIdx        ( RefPicList e )                { return  m_aiNewRefIdx[e];     }
1463  Void      setNewRefIdx        ( RefPicList e, Int i )         { m_aiNewRefIdx[e]    = i;      }
1464#endif
1465#if INTER_VIEW_VECTOR_SCALING_C0115
1466  Void setIVScalingFlag( Bool val )         { m_bIVScalingFlag = val;     }
1467  Bool getIVScalingFlag()                   { return m_bIVScalingFlag;    }
1468  Void setViewOrderIdx     ( Int i )        { m_iViewOrderIdx     = i;    }   // will be changed to view_id
1469  Int  getViewOrderIdx     ()               { return  m_iViewOrderIdx;    }   // will be changed to view_id
1470#endif
1471
1472#if MERL_VSP_C0152
1473  TComPic*     getRefPicBaseTxt          ()                        { return  m_apcRefPicBaseTxt; }
1474  Void         setRefPicBaseTxt          ( TComPic* RefPic)        { m_apcRefPicBaseTxt = RefPic; }
1475  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
1476  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
1477
1478  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
1479  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
1480#endif
1481
1482protected:
1483  TComPic*  xGetRefPic        (TComList<TComPic*>& rcListPic, UInt uiPOC);
1484  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, UInt uiPOC);
1485  TComPic*  xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId );
1486};// END CLASS DEFINITION TComSlice
1487
1488
1489template <class T> class ParameterSetMap
1490{
1491public:
1492  ParameterSetMap(Int maxId)
1493  :m_maxId (maxId)
1494  {}
1495
1496  ~ParameterSetMap()
1497  {
1498    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
1499    {
1500      delete (*i).second;
1501    }
1502  }
1503
1504  Void storePS(Int psId, T *ps)
1505  {
1506    assert ( psId < m_maxId );
1507    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
1508    {
1509      delete m_paramsetMap[psId];
1510    }
1511    m_paramsetMap[psId] = ps; 
1512  }
1513
1514  Void mergePSList(ParameterSetMap<T> &rPsList)
1515  {
1516    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
1517    {
1518      storePS(i->first, i->second);
1519    }
1520    rPsList.m_paramsetMap.clear();
1521  }
1522
1523
1524  T* getPS(Int psId)
1525  {
1526    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
1527  }
1528
1529  T* getFirstPS()
1530  {
1531    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
1532  }
1533
1534#if QC_MVHEVC_B0046
1535  Void clearPSList()
1536  {
1537    m_paramsetMap.clear();
1538  }
1539#endif
1540private:
1541  std::map<Int,T *> m_paramsetMap;
1542  Int               m_maxId;
1543};
1544
1545class ParameterSetManager
1546{
1547public:
1548  ParameterSetManager();
1549  virtual ~ParameterSetManager();
1550#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1551  //! store video parameter set and take ownership of it
1552  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
1553  //! get pointer to existing video parameter set 
1554  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
1555  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
1556#if QC_MVHEVC_B0046
1557  Void     clearVPS()         { m_vpsMap.clearPSList(); };
1558  Void     clearSPS()         { m_spsMap.clearPSList(); };
1559  Void     clearPPS()         { m_ppsMap.clearPSList(); };
1560#endif
1561#endif
1562  //! store sequence parameter set and take ownership of it
1563  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
1564  //! get pointer to existing sequence parameter set 
1565  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
1566  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
1567
1568  //! store picture parameter set and take ownership of it
1569  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
1570  //! get pointer to existing picture parameter set 
1571  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
1572  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
1573
1574  //! store adaptation parameter set and take ownership of it
1575  Void storeAPS(TComAPS *aps) { m_apsMap.storePS( aps->getAPSID(), aps); };
1576  //! getPointer to existing adaptation parameter set 
1577  TComAPS* getAPS(Int apsId)  { return m_apsMap.getPS(apsId); };
1578
1579protected:
1580  ParameterSetMap<TComSPS> m_spsMap; 
1581  ParameterSetMap<TComPPS> m_ppsMap; 
1582  ParameterSetMap<TComAPS> m_apsMap; 
1583#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1584  ParameterSetMap<TComVPS> m_vpsMap; 
1585#endif
1586};
1587
1588//! \}
1589
1590#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.