source: 3DVCSoftware/branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComSlice.h @ 280

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

Integration of branch dev 2.

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