source: SHVCSoftware/branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h @ 789

Last change on this file since 789 was 782, checked in by seregin, 11 years ago

remove ILP_SSH_SIG and ILP_SSH_SIG_FIX

  • Property svn:eol-style set to native
File size: 128.2 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-2014, 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
54#if SVC_EXTENSION
55class TComPicYuv;
56#endif
57// ====================================================================================================================
58// Constants
59// ====================================================================================================================
60
61// ====================================================================================================================
62// Class definition
63// ====================================================================================================================
64
65/// Reference Picture Set class
66class TComReferencePictureSet
67{
68private:
69  Int  m_numberOfPictures;
70  Int  m_numberOfNegativePictures;
71  Int  m_numberOfPositivePictures;
72  Int  m_numberOfLongtermPictures;
73  Int  m_deltaPOC[MAX_NUM_REF_PICS];
74  Int  m_POC[MAX_NUM_REF_PICS];
75  Bool m_used[MAX_NUM_REF_PICS];
76  Bool m_interRPSPrediction;
77  Int  m_deltaRIdxMinus1;   
78  Int  m_deltaRPS; 
79  Int  m_numRefIdc; 
80  Int  m_refIdc[MAX_NUM_REF_PICS+1];
81  Bool m_bCheckLTMSB[MAX_NUM_REF_PICS];
82  Int  m_pocLSBLT[MAX_NUM_REF_PICS];
83  Int  m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS];
84  Bool m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS];
85
86public:
87  TComReferencePictureSet();
88  virtual ~TComReferencePictureSet();
89  Int   getPocLSBLT(Int i)                       { return m_pocLSBLT[i]; }
90  Void  setPocLSBLT(Int i, Int x)                { m_pocLSBLT[i] = x; }
91  Int   getDeltaPocMSBCycleLT(Int i)             { return m_deltaPOCMSBCycleLT[i]; }
92  Void  setDeltaPocMSBCycleLT(Int i, Int x)      { m_deltaPOCMSBCycleLT[i] = x; }
93  Bool  getDeltaPocMSBPresentFlag(Int i)         { return m_deltaPocMSBPresentFlag[i]; }
94  Void  setDeltaPocMSBPresentFlag(Int i, Bool x) { m_deltaPocMSBPresentFlag[i] = x;    }
95  Void setUsed(Int bufferNum, Bool used);
96  Void setDeltaPOC(Int bufferNum, Int deltaPOC);
97  Void setPOC(Int bufferNum, Int deltaPOC);
98  Void setNumberOfPictures(Int numberOfPictures);
99  Void setCheckLTMSBPresent(Int bufferNum, Bool b );
100  Bool getCheckLTMSBPresent(Int bufferNum);
101
102  Int  getUsed(Int bufferNum);
103  Int  getDeltaPOC(Int bufferNum);
104  Int  getPOC(Int bufferNum);
105  Int  getNumberOfPictures();
106
107  Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
108  Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
109  Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
110  Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
111  Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
112  Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
113
114  Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
115  Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
116  Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
117  Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
118  Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
119  Int  getDeltaRPS()                            { return m_deltaRPS; }
120  Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
121  Int  getNumRefIdc()                           { return m_numRefIdc; }
122
123  Void setRefIdc(Int bufferNum, Int refIdc);
124  Int  getRefIdc(Int bufferNum);
125
126  Void sortDeltaPOC();
127  Void printDeltaPOC();
128};
129
130/// Reference Picture Set set class
131class TComRPSList
132{
133private:
134  Int  m_numberOfReferencePictureSets;
135  TComReferencePictureSet* m_referencePictureSets;
136 
137public:
138  TComRPSList();
139  virtual ~TComRPSList();
140 
141  Void  create  (Int numberOfEntries);
142#if Q0078_ADD_LAYER_SETS
143  Void  copy(TComRPSList& a);
144#endif
145  Void  destroy();
146
147
148  TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
149  Int getNumberOfReferencePictureSets();
150  Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
151};
152
153/// SCALING_LIST class
154class TComScalingList
155{
156public:
157  TComScalingList();
158  virtual ~TComScalingList();
159  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
160  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
161  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
162  Bool     checkPredMode                  (UInt sizeId, UInt listId);
163  Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
164  UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
165  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
166  Void     processDefaultMatrix            (UInt sizeId, UInt listId);
167  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
168
169  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
170  Void     checkDcOfMatrix                ();
171  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
172  Bool     xParseScalingList              (Char* pchFile);
173
174private:
175  Void     init                    ();
176  Void     destroy                 ();
177  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
178  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
179  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
180  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
181  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
182  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix                                           
183};
184
185class ProfileTierLevel
186{
187  Int     m_profileSpace;
188  Bool    m_tierFlag;
189  Int     m_profileIdc;
190  Bool    m_profileCompatibilityFlag[32];
191  Int     m_levelIdc;
192
193  Bool m_progressiveSourceFlag;
194  Bool m_interlacedSourceFlag;
195  Bool m_nonPackedConstraintFlag;
196  Bool m_frameOnlyConstraintFlag;
197 
198public:
199  ProfileTierLevel();
200
201  Int   getProfileSpace() const   { return m_profileSpace; }
202  Void  setProfileSpace(Int x)    { m_profileSpace = x; }
203
204  Bool  getTierFlag()     const   { return m_tierFlag; }
205  Void  setTierFlag(Bool x)       { m_tierFlag = x; }
206
207  Int   getProfileIdc()   const   { return m_profileIdc; }
208  Void  setProfileIdc(Int x)      { m_profileIdc = x; }
209
210  Bool  getProfileCompatibilityFlag(Int i) const    { return m_profileCompatibilityFlag[i]; }
211  Void  setProfileCompatibilityFlag(Int i, Bool x)  { m_profileCompatibilityFlag[i] = x; }
212
213  Int   getLevelIdc()   const   { return m_levelIdc; }
214  Void  setLevelIdc(Int x)      { m_levelIdc = x; }
215 
216  Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
217  Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
218 
219  Bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag; }
220  Void setInterlacedSourceFlag(Bool b) { m_interlacedSourceFlag = b; }
221 
222  Bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; }
223  Void setNonPackedConstraintFlag(Bool b) { m_nonPackedConstraintFlag = b; }
224 
225  Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
226  Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
227#if VPS_EXTN_PROFILE_INFO
228  Void copyProfileInfo(ProfileTierLevel *ptl);
229#endif
230};
231
232
233class TComPTL
234{
235  ProfileTierLevel m_generalPTL;
236  ProfileTierLevel m_subLayerPTL    [MAX_TLAYER-1];      // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 (= 6)
237  Bool m_subLayerProfilePresentFlag [MAX_TLAYER-1];
238  Bool m_subLayerLevelPresentFlag   [MAX_TLAYER-1];
239
240public:
241  TComPTL();
242  Bool getSubLayerProfilePresentFlag(Int i) const { return m_subLayerProfilePresentFlag[i]; }
243  Void setSubLayerProfilePresentFlag(Int i, Bool x) { m_subLayerProfilePresentFlag[i] = x; }
244 
245  Bool getSubLayerLevelPresentFlag(Int i) const { return m_subLayerLevelPresentFlag[i]; }
246  Void setSubLayerLevelPresentFlag(Int i, Bool x) { m_subLayerLevelPresentFlag[i] = x; }
247
248  ProfileTierLevel* getGeneralPTL()  { return &m_generalPTL; }
249  ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i]; }
250#if VPS_EXTN_PROFILE_INFO
251  Void copyProfileInfo(TComPTL *ptl);
252#endif
253};
254/// VPS class
255
256struct HrdSubLayerInfo
257{
258  Bool fixedPicRateFlag;
259  Bool fixedPicRateWithinCvsFlag;
260  UInt picDurationInTcMinus1;
261  Bool lowDelayHrdFlag;
262  UInt cpbCntMinus1;
263  UInt bitRateValueMinus1[MAX_CPB_CNT][2];
264  UInt cpbSizeValue      [MAX_CPB_CNT][2];
265  UInt ducpbSizeValue    [MAX_CPB_CNT][2];
266  UInt cbrFlag           [MAX_CPB_CNT][2];
267  UInt duBitRateValue    [MAX_CPB_CNT][2];
268};
269
270class TComHRD
271{
272private:
273  Bool m_nalHrdParametersPresentFlag;
274  Bool m_vclHrdParametersPresentFlag;
275  Bool m_subPicCpbParamsPresentFlag;
276  UInt m_tickDivisorMinus2;
277  UInt m_duCpbRemovalDelayLengthMinus1;
278  Bool m_subPicCpbParamsInPicTimingSEIFlag;
279  UInt m_dpbOutputDelayDuLengthMinus1;
280  UInt m_bitRateScale;
281  UInt m_cpbSizeScale;
282  UInt m_ducpbSizeScale;
283  UInt m_initialCpbRemovalDelayLengthMinus1;
284  UInt m_cpbRemovalDelayLengthMinus1;
285  UInt m_dpbOutputDelayLengthMinus1;
286  UInt m_numDU;
287  HrdSubLayerInfo m_HRD[MAX_TLAYER];
288
289public:
290  TComHRD()
291  :m_nalHrdParametersPresentFlag(0)
292  ,m_vclHrdParametersPresentFlag(0)
293  ,m_subPicCpbParamsPresentFlag(false)
294  ,m_tickDivisorMinus2(0)
295  ,m_duCpbRemovalDelayLengthMinus1(0)
296  ,m_subPicCpbParamsInPicTimingSEIFlag(false)
297  ,m_dpbOutputDelayDuLengthMinus1(0)
298  ,m_bitRateScale(0)
299  ,m_cpbSizeScale(0)
300  ,m_initialCpbRemovalDelayLengthMinus1(0)
301  ,m_cpbRemovalDelayLengthMinus1(0)
302  ,m_dpbOutputDelayLengthMinus1(0)
303  {}
304
305  virtual ~TComHRD() {}
306
307  Void setNalHrdParametersPresentFlag       ( Bool flag )  { m_nalHrdParametersPresentFlag = flag;         }
308  Bool getNalHrdParametersPresentFlag       ( )            { return m_nalHrdParametersPresentFlag;         }
309
310  Void setVclHrdParametersPresentFlag       ( Bool flag )  { m_vclHrdParametersPresentFlag = flag;         }
311  Bool getVclHrdParametersPresentFlag       ( )            { return m_vclHrdParametersPresentFlag;         }
312
313  Void setSubPicCpbParamsPresentFlag        ( Bool flag )  { m_subPicCpbParamsPresentFlag = flag;          }
314  Bool getSubPicCpbParamsPresentFlag        ( )            { return m_subPicCpbParamsPresentFlag;          }
315 
316  Void setTickDivisorMinus2                 ( UInt value ) { m_tickDivisorMinus2 = value;                  }
317  UInt getTickDivisorMinus2                 ( )            { return m_tickDivisorMinus2;                   }
318
319  Void setDuCpbRemovalDelayLengthMinus1     ( UInt value ) { m_duCpbRemovalDelayLengthMinus1 = value;      }
320  UInt getDuCpbRemovalDelayLengthMinus1     ( )            { return m_duCpbRemovalDelayLengthMinus1;       }
321
322  Void setSubPicCpbParamsInPicTimingSEIFlag ( Bool flag)   { m_subPicCpbParamsInPicTimingSEIFlag = flag;   }
323  Bool getSubPicCpbParamsInPicTimingSEIFlag ()             { return m_subPicCpbParamsInPicTimingSEIFlag;   }
324
325  Void setDpbOutputDelayDuLengthMinus1      (UInt value )  { m_dpbOutputDelayDuLengthMinus1 = value;       }
326  UInt getDpbOutputDelayDuLengthMinus1      ()             { return m_dpbOutputDelayDuLengthMinus1;        }
327
328  Void setBitRateScale                      ( UInt value ) { m_bitRateScale = value;                       }
329  UInt getBitRateScale                      ( )            { return m_bitRateScale;                        }
330
331  Void setCpbSizeScale                      ( UInt value ) { m_cpbSizeScale = value;                       }
332  UInt getCpbSizeScale                      ( )            { return m_cpbSizeScale;                        }
333  Void setDuCpbSizeScale                    ( UInt value ) { m_ducpbSizeScale = value;                     }
334  UInt getDuCpbSizeScale                    ( )            { return m_ducpbSizeScale;                      }
335
336  Void setInitialCpbRemovalDelayLengthMinus1( UInt value ) { m_initialCpbRemovalDelayLengthMinus1 = value; }
337  UInt getInitialCpbRemovalDelayLengthMinus1( )            { return m_initialCpbRemovalDelayLengthMinus1;  }
338
339  Void setCpbRemovalDelayLengthMinus1       ( UInt value ) { m_cpbRemovalDelayLengthMinus1 = value;        }
340  UInt getCpbRemovalDelayLengthMinus1       ( )            { return m_cpbRemovalDelayLengthMinus1;         }
341
342  Void setDpbOutputDelayLengthMinus1        ( UInt value ) { m_dpbOutputDelayLengthMinus1 = value;         }
343  UInt getDpbOutputDelayLengthMinus1        ( )            { return m_dpbOutputDelayLengthMinus1;          }
344
345  Void setFixedPicRateFlag       ( Int layer, Bool flag )  { m_HRD[layer].fixedPicRateFlag = flag;         }
346  Bool getFixedPicRateFlag       ( Int layer            )  { return m_HRD[layer].fixedPicRateFlag;         }
347
348  Void setFixedPicRateWithinCvsFlag       ( Int layer, Bool flag )  { m_HRD[layer].fixedPicRateWithinCvsFlag = flag;         }
349  Bool getFixedPicRateWithinCvsFlag       ( Int layer            )  { return m_HRD[layer].fixedPicRateWithinCvsFlag;         }
350
351  Void setPicDurationInTcMinus1  ( Int layer, UInt value ) { m_HRD[layer].picDurationInTcMinus1 = value;   }
352  UInt getPicDurationInTcMinus1  ( Int layer             ) { return m_HRD[layer].picDurationInTcMinus1;    }
353
354  Void setLowDelayHrdFlag        ( Int layer, Bool flag )  { m_HRD[layer].lowDelayHrdFlag = flag;          }
355  Bool getLowDelayHrdFlag        ( Int layer            )  { return m_HRD[layer].lowDelayHrdFlag;          }
356
357  Void setCpbCntMinus1           ( Int layer, UInt value ) { m_HRD[layer].cpbCntMinus1 = value; }
358  UInt getCpbCntMinus1           ( Int layer            )  { return m_HRD[layer].cpbCntMinus1; }
359
360  Void setBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; }
361  UInt getBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];  }
362
363  Void setCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value;       }
364  UInt getCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl];        }
365  Void setDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;       }
366  UInt getDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];        }
367  Void setDuBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;       }
368  UInt getDuBitRateValueMinus1     (Int layer, Int cpbcnt, Int nalOrVcl )              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];        }
369  Void setCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
370  Bool getCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
371
372  Void setNumDU                              ( UInt value ) { m_numDU = value;                            }
373  UInt getNumDU                              ( )            { return m_numDU;          }
374  Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
375};
376
377class TimingInfo
378{
379  Bool m_timingInfoPresentFlag;
380  UInt m_numUnitsInTick;
381  UInt m_timeScale;
382  Bool m_pocProportionalToTimingFlag;
383  Int  m_numTicksPocDiffOneMinus1;
384public:
385  TimingInfo()
386  : m_timingInfoPresentFlag(false)
387  , m_numUnitsInTick(1001)
388  , m_timeScale(60000)
389  , m_pocProportionalToTimingFlag(false)
390  , m_numTicksPocDiffOneMinus1(0) {}
391
392  Void setTimingInfoPresentFlag             ( Bool flag )  { m_timingInfoPresentFlag = flag;               }
393  Bool getTimingInfoPresentFlag             ( )            { return m_timingInfoPresentFlag;               }
394
395  Void setNumUnitsInTick                    ( UInt value ) { m_numUnitsInTick = value;                     }
396  UInt getNumUnitsInTick                    ( )            { return m_numUnitsInTick;                      }
397
398  Void setTimeScale                         ( UInt value ) { m_timeScale = value;                          }
399  UInt getTimeScale                         ( )            { return m_timeScale;                           }
400 
401  Bool getPocProportionalToTimingFlag       ( )            { return m_pocProportionalToTimingFlag;         }
402  Void setPocProportionalToTimingFlag       (Bool x      ) { m_pocProportionalToTimingFlag = x;            }
403 
404  Int  getNumTicksPocDiffOneMinus1          ( )            { return m_numTicksPocDiffOneMinus1;            }
405  Void setNumTicksPocDiffOneMinus1          (Int x       ) { m_numTicksPocDiffOneMinus1 = x;               }
406};
407
408#if REPN_FORMAT_IN_VPS
409class RepFormat
410{
411#if REPN_FORMAT_CONTROL_FLAG
412  Bool m_chromaAndBitDepthVpsPresentFlag;
413#endif
414#if AUXILIARY_PICTURES
415  ChromaFormat m_chromaFormatVpsIdc;
416#else
417  Int  m_chromaFormatVpsIdc;
418#endif
419  Bool m_separateColourPlaneVpsFlag;
420  Int  m_picWidthVpsInLumaSamples;
421  Int  m_picHeightVpsInLumaSamples;
422  Int  m_bitDepthVpsLuma;               // coded as minus8
423  Int  m_bitDepthVpsChroma;             // coded as minus8
424
425public:
426  RepFormat();
427#if RESOLUTION_BASED_DPB
428  Void init();
429  RepFormat& operator= (const RepFormat &);
430  static Bool checkSameSubDpb(const RepFormat &x, const RepFormat &y);
431#endif
432#if REPN_FORMAT_CONTROL_FLAG
433  Bool getChromaAndBitDepthVpsPresentFlag() { return m_chromaAndBitDepthVpsPresentFlag; }
434  void setChromaAndBitDepthVpsPresentFlag(Bool x) { m_chromaAndBitDepthVpsPresentFlag = x; }
435#endif
436
437#if AUXILIARY_PICTURES
438  ChromaFormat getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
439  Void setChromaFormatVpsIdc(ChromaFormat x)  { m_chromaFormatVpsIdc = x;    }
440#else
441  Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
442  Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
443#endif
444
445  Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
446  Void setSeparateColourPlaneVpsFlag(Bool x)  { m_separateColourPlaneVpsFlag = x;    }
447
448  Int  getPicWidthVpsInLumaSamples()        { return m_picWidthVpsInLumaSamples; }
449  Void setPicWidthVpsInLumaSamples(Int x)   { m_picWidthVpsInLumaSamples = x;    }
450
451  Int  getPicHeightVpsInLumaSamples()        { return m_picHeightVpsInLumaSamples; }
452  Void setPicHeightVpsInLumaSamples(Int x)   { m_picHeightVpsInLumaSamples = x;    }
453
454  Int  getBitDepthVpsLuma()           { return m_bitDepthVpsLuma;   }
455  Void setBitDepthVpsLuma(Int x)      { m_bitDepthVpsLuma = x;      }
456
457  Int  getBitDepthVpsChroma()           { return m_bitDepthVpsChroma;   }
458  Void setBitDepthVpsChroma(Int x)      { m_bitDepthVpsChroma = x;      }
459};
460#endif
461class TComVPS
462{
463private:
464  Int         m_VPSId;
465  UInt        m_uiMaxTLayers;
466  UInt        m_uiMaxLayers;
467  Bool        m_bTemporalIdNestingFlag;
468 
469  UInt        m_numReorderPics[MAX_TLAYER];
470  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
471  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)
472
473  UInt        m_numHrdParameters;
474#if !VPS_RENAME
475  UInt        m_maxNuhReservedZeroLayerId;
476#endif
477  TComHRD*    m_hrdParameters;
478  UInt*       m_hrdOpSetIdx;
479  Bool*       m_cprmsPresentFlag;
480#if !SVC_EXTENSION
481  UInt        m_numOpSets;
482  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
483#endif
484  TComPTL     m_pcPTL;
485  TimingInfo  m_timingInfo;
486
487#if SVC_EXTENSION
488#if DERIVE_LAYER_ID_LIST_VARIABLES
489  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
490  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
491#endif
492#if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED
493#if VPS_EXTN_OFFSET
494  UInt        m_extensionOffset;
495#endif
496#endif
497#if VPS_RENAME
498  UInt        m_maxLayerId;
499  UInt        m_numLayerSets;
500#if Q0078_ADD_LAYER_SETS
501  Bool        m_layerIdIncludedFlag[2*MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
502#else
503  Bool        m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
504#endif
505#endif
506
507  // ------------------------------------------
508  // Variables related to VPS extensions
509  // ------------------------------------------
510#if VPS_EXTN_MASK_AND_DIM_INFO
511  Bool       m_avcBaseLayerFlag;                                // For now, always set to true.
512  Bool       m_splittingFlag;
513  Bool       m_scalabilityMask[MAX_VPS_NUM_SCALABILITY_TYPES];
514  UInt       m_dimensionIdLen[MAX_VPS_NUM_SCALABILITY_TYPES];
515  Bool       m_nuhLayerIdPresentFlag;
516  UInt       m_layerIdInNuh[MAX_VPS_LAYER_ID_PLUS1];            // Maps layer ID in the VPS with layer_id_in_nuh
517  UInt       m_dimensionId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_NUM_SCALABILITY_TYPES];
518
519  // Below are derived variables
520  UInt       m_numScalabilityTypes;
521  UInt       m_layerIdInVps[MAX_VPS_LAYER_ID_PLUS1];            // Maps layer_id_in_nuh with the layer ID in the VPS
522#endif
523#if BITRATE_PICRATE_SIGNALLING
524  UInt       m_maxSLInLayerSetMinus1[MAX_VPS_LAYER_SETS_PLUS1];
525#endif
526   
527  Bool       m_ilpSshSignalingEnabledFlag;
528#if VPS_EXTN_PROFILE_INFO
529  // Profile-tier-level signalling related
530  Bool       m_profilePresentFlag[MAX_VPS_LAYER_SETS_PLUS1];    // The value with index 0 will not be used.
531#if !P0048_REMOVE_PROFILE_REF
532  UInt       m_profileLayerSetRef[MAX_VPS_LAYER_SETS_PLUS1];    // The value with index 0 will not be used.
533#endif
534  std::vector<TComPTL>    m_pcPTLForExtn; 
535#endif
536#if VPS_EXTN_OP_LAYER_SETS
537  // .. More declarations here
538  // Target output layer signalling related
539  UInt       m_numOutputLayerSets;
540  UInt       m_outputLayerSetIdx[MAX_VPS_LAYER_SETS_PLUS1];
541  Bool       m_outputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
542#endif
543#if VPS_EXTN_DIRECT_REF_LAYERS
544  Bool       m_directDependencyFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
545  UInt       m_numDirectRefLayers[MAX_VPS_LAYER_ID_PLUS1];
546  UInt       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
547  UInt       m_directDepTypeLen;
548#if O0096_DEFAULT_DEPENDENCY_TYPE
549  Bool       m_defaultDirectDependencyTypeFlag;
550  UInt       m_defaultDirectDependencyType;
551#endif
552  UInt       m_directDependencyType[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
553#endif
554  UInt       m_numProfileTierLevel;
555#if !VPS_EXTN_UEV_CODING
556  Bool       m_moreOutputLayerSetsThanDefaultFlag;
557#endif
558  Int        m_numAddOutputLayerSets;
559#if P0295_DEFAULT_OUT_LAYER_IDC
560  UInt       m_defaultTargetOutputLayerIdc;
561#else
562#if O0109_DEFAULT_ONE_OUT_LAYER_IDC
563  UInt       m_defaultOneTargetOutputLayerIdc;
564#else
565  Bool       m_defaultOneTargetOutputLayerFlag;
566#endif
567#endif
568  Int        m_profileLevelTierIdx[64];     
569  Bool       m_maxOneActiveRefLayerFlag;
570#if O0062_POC_LSB_NOT_PRESENT_FLAG
571  Bool       m_pocLsbNotPresentFlag[MAX_VPS_LAYER_ID_PLUS1];
572#endif
573#if O0223_PICTURE_TYPES_ALIGN_FLAG
574  Bool       m_crossLayerPictureTypeAlignFlag;
575#endif
576  Bool       m_crossLayerIrapAlignFlag;
577#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
578  Bool       m_crossLayerAlignedIdrOnlyFlag;
579#endif
580#if O0225_MAX_TID_FOR_REF_LAYERS
581  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1][MAX_VPS_LAYER_ID_PLUS1];
582#else
583  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
584#endif
585  Bool       m_maxTidRefPresentFlag;
586#if VPS_TSLAYERS
587  Bool       m_maxTSLayersPresentFlag;
588  UInt       m_maxTSLayerMinus1[MAX_LAYERS];
589#endif
590#if M0040_ADAPTIVE_RESOLUTION_CHANGE
591  Bool       m_singleLayerForNonIrapFlag;
592#endif
593#if HIGHER_LAYER_IRAP_SKIP_FLAG
594  Bool       m_higherLayerIrapSkipFlag;
595#endif
596#if VPS_VUI_TILES_NOT_IN_USE__FLAG
597  Bool       m_tilesNotInUseFlag;
598  Bool       m_tilesInUseFlag[MAX_VPS_LAYER_ID_PLUS1];
599  Bool       m_loopFilterNotAcrossTilesFlag[MAX_VPS_LAYER_ID_PLUS1];
600#endif
601#if TILE_BOUNDARY_ALIGNED_FLAG
602  Bool       m_tileBoundariesAlignedFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
603#endif
604#if VPS_VUI_WPP_NOT_IN_USE__FLAG
605  Bool       m_wppNotInUseFlag;
606  Bool       m_wppInUseFlag[MAX_VPS_LAYER_ID_PLUS1];
607#endif
608#if N0160_VUI_EXT_ILP_REF   
609  Bool       m_ilpRestrictedRefLayersFlag;
610  Int        m_minSpatialSegmentOffsetPlus1[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
611  Bool       m_ctuBasedOffsetEnabledFlag   [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
612  Int        m_minHorizontalCtuOffsetPlus1 [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
613#endif
614#if VPS_VUI_VIDEO_SIGNAL
615  Bool       m_vidSigPresentVpsFlag;
616  Int        m_vpsVidSigInfo;
617  Int        m_vpsVidSigIdx[MAX_VPS_LAYER_ID_PLUS1];
618  Int        m_vpsVidFormat[16];
619  Bool       m_vpsFullRangeFlag[16];
620  Int        m_vpsColorPrimaries[16];
621  Int        m_vpsTransChar[16];
622  Int        m_vpsMatCoeff[16];
623#endif
624
625  Bool       m_bitRatePresentVpsFlag;
626  Bool       m_picRatePresentVpsFlag;
627  Bool       m_bitRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
628  Bool       m_picRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
629  Int        m_avgBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
630  Int        m_maxBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
631  Int        m_constPicRateIdc     [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
632  Int        m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
633 
634#if P0312_VERT_PHASE_ADJ
635  Bool       m_vpsVuiVertPhaseInUseFlag;
636#endif
637
638#if P0300_ALT_OUTPUT_LAYER_FLAG
639  Bool       m_altOutputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1];
640#else
641#if O0153_ALT_OUTPUT_LAYER_FLAG
642  Bool       m_altOutputLayerFlag;
643#endif
644#endif
645#if REPN_FORMAT_IN_VPS
646  Bool       m_repFormatIdxPresentFlag;
647  Int        m_vpsNumRepFormats;            // coded as minus1
648  RepFormat  m_vpsRepFormat[16];
649  Int        m_vpsRepFormatIdx[16];
650#endif
651#if VIEW_ID_RELATED_SIGNALING
652#if O0109_VIEW_ID_LEN
653  Int        m_viewIdLen;
654#else
655  Int        m_viewIdLenMinus1;
656#endif
657  Int        m_viewIdVal                [MAX_LAYERS];
658#endif
659
660#if O0215_PHASE_ALIGNMENT
661  Bool       m_phaseAlignFlag;
662#endif
663
664#if O0092_0094_DEPENDENCY_CONSTRAINT
665  Int        m_numberRefLayers[MAX_NUM_LAYER_IDS];  // number of direct and indirect reference layers of a coding layer
666  Bool       m_recursiveRefLayerFlag[MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];  // flag to indicate if j-th layer is a direct or indirect reference layer of i-th layer
667#endif
668#if Q0078_ADD_LAYER_SETS
669  Int        m_numAddLayerSets;
670  UInt       m_highestLayerIdxPlus1[MAX_VPS_LAYER_SETS_PLUS1][MAX_NUM_LAYER_IDS];
671  UInt       m_predictedLayerId[MAX_NUM_LAYER_IDS][64];
672  UInt       m_numPredictedLayers[MAX_NUM_LAYER_IDS];
673  Int        m_numIndependentLayers;
674  Int        m_numLayersInTreePartition[MAX_NUM_LAYER_IDS];
675  UInt       m_treePartitionLayerIdList[MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
676#endif
677#if SPS_DPB_PARAMS
678  Int        m_TolsIdx;
679#endif
680#if VPS_DPB_SIZE_TABLE
681  Bool       m_subLayerFlagInfoPresentFlag [MAX_VPS_OP_LAYER_SETS_PLUS1];
682  Bool       m_subLayerDpbInfoPresentFlag  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
683  Int        m_maxVpsDecPicBufferingMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER];
684#if RESOLUTION_BASED_DPB
685  Int        m_maxVpsLayerDecPicBuffMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 
686#endif
687  Int        m_maxVpsNumReorderPics        [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
688  Int        m_maxVpsLatencyIncreasePlus1  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
689#if CHANGE_NUMSUBDPB_IDX
690  Int        m_numSubDpbs                  [MAX_VPS_LAYER_SETS_PLUS1];
691#else
692  Int        m_numSubDpbs                  [MAX_VPS_OP_LAYER_SETS_PLUS1];
693#endif
694#endif
695
696#if O0109_MOVE_VPS_VUI_FLAG
697  Bool       m_vpsVuiPresentFlag;
698#endif
699  Bool       m_vpsExtensionFlag;
700
701#if O0164_MULTI_LAYER_HRD
702  Bool       m_vpsVuiBspHrdPresentFlag;
703  UInt       m_vpsNumBspHrdParametersMinus1;
704  Bool       m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
705  TComHRD    *m_bspHrd;
706  UInt       m_numBitstreamPartitions[MAX_VPS_LAYER_SETS_PLUS1];
707  Bool       m_layerInBspFlag[MAX_VPS_LAYER_SETS_PLUS1][8][MAX_LAYERS];
708  UInt       m_numBspSchedCombinations[MAX_VPS_LAYER_SETS_PLUS1];
709  UInt       m_bspCombHrdIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
710  UInt       m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
711#endif
712
713#if P0182_VPS_VUI_PS_FLAG
714  UInt       m_SPSId[MAX_LAYERS];
715  UInt       m_PPSId[MAX_LAYERS];
716  UInt       m_baseLayerPSCompatibilityFlag[MAX_LAYERS];
717#endif
718
719#if !P0307_REMOVE_VPS_VUI_OFFSET
720#if VPS_VUI_OFFSET
721  Int        m_vpsVuiOffset;
722#endif
723#endif
724#if P0307_VPS_NON_VUI_EXTENSION
725  Int        m_vpsNonVuiExtLength;
726#endif
727#if RESOLUTION_BASED_DPB
728  Int        m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
729#endif
730#endif //SVC_EXTENSION
731public:
732  TComVPS();
733  virtual ~TComVPS();
734
735  Void    createHrdParamBuffer()
736  {
737    m_hrdParameters    = new TComHRD[ getNumHrdParameters() ];
738    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
739    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
740  }
741
742#if O0164_MULTI_LAYER_HRD
743  Void    createBspHrdParamBuffer(UInt numHrds)
744  {
745    m_bspHrd    = new TComHRD[ numHrds ];
746//    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
747//    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
748  }
749#endif
750#if HRD_BPB
751  Int getBspHrdParamBufferCpbCntMinus1(UInt i, UInt sl)
752  {
753    return m_bspHrd->getCpbCntMinus1(sl);
754  }
755#endif
756
757  TComHRD* getHrdParameters   ( UInt i )             { return &m_hrdParameters[ i ]; }
758  UInt    getHrdOpSetIdx      ( UInt i )             { return m_hrdOpSetIdx[ i ]; }
759  Void    setHrdOpSetIdx      ( UInt val, UInt i )   { m_hrdOpSetIdx[ i ] = val;  }
760  Bool    getCprmsPresentFlag ( UInt i )             { return m_cprmsPresentFlag[ i ]; }
761  Void    setCprmsPresentFlag ( Bool val, UInt i )   { m_cprmsPresentFlag[ i ] = val;  }
762
763  Int     getVPSId       ()                   { return m_VPSId;          }
764  Void    setVPSId       (Int i)              { m_VPSId = i;             }
765
766  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
767  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
768 
769  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
770  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
771
772  Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
773  Void    setTemporalNestingFlag   (Bool t)   { m_bTemporalIdNestingFlag = t; }
774 
775  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
776  UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
777 
778  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { assert(tLayer < MAX_TLAYER); m_uiMaxDecPicBuffering[tLayer] = v;    }
779  UInt    getMaxDecPicBuffering(UInt tLayer)                    { return m_uiMaxDecPicBuffering[tLayer]; }
780 
781  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;    }
782  UInt    getMaxLatencyIncrease(UInt tLayer)                    { return m_uiMaxLatencyIncrease[tLayer]; }
783
784  UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
785  Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
786 
787#if !SVC_EXTENSION
788  UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
789  Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
790
791  UInt    getMaxOpSets()                                        { return m_numOpSets; }
792  Void    setMaxOpSets(UInt v)                                  { m_numOpSets = v;    }
793#endif
794  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
795  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
796
797  TComPTL* getPTL() { return &m_pcPTL; }
798  TimingInfo* getTimingInfo() { return &m_timingInfo; }
799
800#if SVC_EXTENSION
801#if DERIVE_LAYER_ID_LIST_VARIABLES
802  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
803  Void    setLayerSetLayerIdList(Int set, Int layerId, Int x)   { m_layerSetLayerIdList[set][layerId] = x   ; }
804
805  Int     getNumLayersInIdList(Int set)                          { return m_numLayerInIdList[set]; }
806  Void    setNumLayersInIdList(Int set, Int x)                   { m_numLayerInIdList[set] = x   ; }
807
808  Void    deriveLayerIdListVariables();
809#endif
810#if VPS_DPB_SIZE_TABLE
811Void      deriveNumberOfSubDpbs();
812#endif
813
814#if O0092_0094_DEPENDENCY_CONSTRAINT
815  Void    setRefLayersFlags(Int currLayerId);
816  Bool    getRecursiveRefLayerFlag(Int currLayerId, Int refLayerId)              { return m_recursiveRefLayerFlag[currLayerId][refLayerId];}
817  Void    setRecursiveRefLayerFlag(Int currLayerId, Int refLayerId, Bool x)      { m_recursiveRefLayerFlag[currLayerId][refLayerId] = x;   }
818  Int     getNumRefLayers(Int currLayerId)                                       { return m_numberRefLayers[currLayerId];                  }
819  Void    setNumRefLayers();
820#endif
821#if Q0078_ADD_LAYER_SETS
822  UInt    getNumAddLayerSets()                                                   { return m_numAddLayerSets; }
823  Void    setNumAddLayerSets(UInt x)                                             { m_numAddLayerSets = x; }
824  UInt    getHighestLayerIdxPlus1(UInt set, UInt idx)                             { return m_highestLayerIdxPlus1[set][idx]; }
825  Void    setHighestLayerIdxPlus1(UInt set, UInt idx, UInt layerIdx)              { m_highestLayerIdxPlus1[set][idx] = layerIdx; }
826  Void    setPredictedLayerIds();
827  UInt    getPredictedLayerId(UInt layerIdx, UInt predIdx)                       { return m_predictedLayerId[layerIdx][predIdx]; }
828  Void    setPredictedLayerId(UInt layerIdx, UInt predIdx, UInt x)               { m_predictedLayerId[layerIdx][predIdx] = x; }
829  UInt    getNumPredictedLayers(UInt layerId)                                    { return m_numPredictedLayers[layerId]; }
830  Void    setNumPredictedLayers(UInt layerId, UInt x)                            { m_numPredictedLayers[layerId] = x; }
831  Void    setTreePartitionLayerIdList();
832  Int     getNumIndependentLayers()                                              { return m_numIndependentLayers; }
833  Void    setNumIndependentLayers(Int x)                                         { m_numIndependentLayers = x; }
834  Int     getNumLayersInTreePartition(Int idx)                                   { return m_numLayersInTreePartition[idx]; }
835  Void    setNumLayersInTreePartition(Int idx, Int x)                            { m_numLayersInTreePartition[idx] = x; }
836  UInt    getTreePartitionLayerId(Int idx, Int layerIdx)                         { return m_treePartitionLayerIdList[idx][layerIdx]; }
837  Void    setTreePartitionLayerId(Int idx, Int layerIdx, UInt layerId)           { m_treePartitionLayerIdList[idx][layerIdx] = layerId; }
838#endif
839#if VPS_RENAME
840  UInt    getMaxLayerId()                                       { return m_maxLayerId; }
841  Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
842
843  UInt    getNumLayerSets()                                     { return m_numLayerSets; }
844  Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
845#endif
846#if VPS_EXTN_MASK_AND_DIM_INFO
847  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
848  Void   setAvcBaseLayerFlag(Bool x)                            { m_avcBaseLayerFlag = x;          }
849
850  Bool   getSplittingFlag()                                     { return m_splittingFlag;          }
851  Void   setSplittingFlag(Bool x)                               { m_splittingFlag = x;             }
852
853  Bool   getScalabilityMask(Int id)                             { return m_scalabilityMask[id];    }
854  Void   setScalabilityMask(Int id, Bool x)                     { m_scalabilityMask[id] = x;       }
855
856  UInt   getDimensionIdLen(Int id)                              { return m_dimensionIdLen[id];     }
857  Void   setDimensionIdLen(Int id, UInt x)                      { m_dimensionIdLen[id] = x;        }
858
859  Bool   getNuhLayerIdPresentFlag()                             { return m_nuhLayerIdPresentFlag;  }
860  Void   setNuhLayerIdPresentFlag(Bool x)                       { m_nuhLayerIdPresentFlag = x;     }
861
862  UInt   getLayerIdInNuh(Int id)                                { return m_layerIdInNuh[id];       }
863  Void   setLayerIdInNuh(Int id, UInt x)                        { m_layerIdInNuh[id] = x;          }
864
865  UInt   getDimensionId(Int lyrId, Int id)                      { return m_dimensionId[lyrId][id]; }
866  Void   setDimensionId(Int lyrId, Int id, UInt x)              { m_dimensionId[lyrId][id] = x;    }
867
868  UInt   getNumScalabilityTypes()                               { return m_numScalabilityTypes;    }
869  Void   setNumScalabilityTypes(UInt x)                         { m_numScalabilityTypes = x;       }
870
871  UInt   getLayerIdInVps(Int id)                                { return m_layerIdInVps[id];       }
872  Void   setLayerIdInVps(Int id, UInt x)                        { m_layerIdInVps[id] = x;          }
873#endif
874#if BITRATE_PICRATE_SIGNALLING
875    UInt   getMaxSLayersInLayerSetMinus1(Int ls)                { return m_maxSLInLayerSetMinus1[ls];    }
876    Void   setMaxSLayersInLayerSetMinus1(Int ls, Int x)         { m_maxSLInLayerSetMinus1[ls] = x;       }
877#endif
878  Bool   getIlpSshSignalingEnabledFlag()                      { return m_ilpSshSignalingEnabledFlag;}
879  Void   setIlpSshSignalingEnabledFlag(Bool x)                { m_ilpSshSignalingEnabledFlag = x;}
880#if VPS_EXTN_PROFILE_INFO
881  Bool   getProfilePresentFlag(Int id)                          { return m_profilePresentFlag[id]; }
882  Void   setProfilePresentFlag(Int id, Bool x)                  { m_profilePresentFlag[id] = x;    }
883
884#if !P0048_REMOVE_PROFILE_REF
885  UInt   getProfileLayerSetRef(Int id)                          { return m_profileLayerSetRef[id]; }
886  Void   setProfileLayerSetRef(Int id, Bool x)                  { m_profileLayerSetRef[id] = x;    }
887#endif
888
889  std::vector<TComPTL>* getPTLForExtnPtr()                      { return &m_pcPTLForExtn;          }
890  TComPTL* getPTLForExtn(Int id)                                { return &m_pcPTLForExtn[id];      }
891#endif
892#if VPS_EXTN_OP_LAYER_SETS
893  // Target output layer signalling related
894  UInt   getNumOutputLayerSets()                                { return m_numOutputLayerSets;     } 
895  Void   setNumOutputLayerSets(Int x)                           { m_numOutputLayerSets = x;        }
896 
897  UInt   getOutputLayerSetIdx(Int idx)                          { return m_outputLayerSetIdx[idx]; }
898  Void   setOutputLayerSetIdx(Int idx, UInt x)                  { m_outputLayerSetIdx[idx] = x;    }
899
900  Bool   getOutputLayerFlag(Int layerSet, Int layerId)          { return m_outputLayerFlag[layerSet][layerId]; }
901  Void   setOutputLayerFlag(Int layerSet, Int layerId, Bool x)  { m_outputLayerFlag[layerSet][layerId] = x;    }
902#endif
903#if VPS_EXTN_DIRECT_REF_LAYERS
904  // Direct dependency of layers
905  Bool   getDirectDependencyFlag(Int currLayerId, Int refLayerId)               { return m_directDependencyFlag[currLayerId][refLayerId]; }
906  Void   setDirectDependencyFlag(Int currLayerId, Int refLayerId, Bool x)       { m_directDependencyFlag[currLayerId][refLayerId] = x;    }
907 
908  UInt   getNumDirectRefLayers(Int layerId)                                     { return m_numDirectRefLayers[layerId];                   }
909  Void   setNumDirectRefLayers(Int layerId, UInt refLayerNum)                   { m_numDirectRefLayers[layerId] = refLayerNum;            }
910
911  UInt   getRefLayerId(Int layerId, Int refLayerIdx)                            { return m_refLayerId[layerId][refLayerIdx];              }
912  Void   setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId)           { m_refLayerId[layerId][refLayerIdx] = refLayerId;        }
913
914  UInt   getDirectDepTypeLen()                                                  { return m_directDepTypeLen;                              }
915  Void   setDirectDepTypeLen(UInt x)                                            { m_directDepTypeLen = x;                                 }
916#if O0096_DEFAULT_DEPENDENCY_TYPE
917  Bool   getDefaultDirectDependencyTypeFlag()                                   { return m_defaultDirectDependencyTypeFlag;               }
918  Void   setDefaultDirectDependecyTypeFlag(Bool x)                              { m_defaultDirectDependencyTypeFlag = x;                  }
919  UInt   getDefaultDirectDependencyType()                                       { return m_defaultDirectDependencyType;                   }
920  Void   setDefaultDirectDependecyType(UInt x)                                  { m_defaultDirectDependencyType = x;                      }
921#endif
922  UInt   getDirectDependencyType(Int currLayerId, Int refLayerId)               { return m_directDependencyType[currLayerId][refLayerId]; }
923  Void   setDirectDependencyType(Int currLayerId, Int refLayerId, UInt x)       { m_directDependencyType[currLayerId][refLayerId] = x;    }
924  Bool   isSamplePredictionType(Int currLayerId, Int refLayerId)                { assert(currLayerId != refLayerId); return ( ( m_directDependencyType[currLayerId][refLayerId] + 1 ) & 1 ) ? true : false; }
925  Bool   isMotionPredictionType(Int currLayerId, Int refLayerId)                { assert(currLayerId != refLayerId); return ( ( ( m_directDependencyType[currLayerId][refLayerId] + 1 ) & 2 ) >> 1 ) ? true : false; }
926#endif
927  UInt   getNumProfileTierLevel()                                { return m_numProfileTierLevel; }
928  Void   setNumProfileTierLevel(Int x)                           { m_numProfileTierLevel = x;    }
929
930#if !VPS_EXTN_UEV_CODING
931  Bool   getMoreOutputLayerSetsThanDefaultFlag()                 { return m_moreOutputLayerSetsThanDefaultFlag;}
932  Void   setMoreOutputLayerSetsThanDefaultFlag(Bool x)           { m_moreOutputLayerSetsThanDefaultFlag = x   ;}
933#endif
934
935  Int    getNumAddOutputLayerSets()                              { return m_numAddOutputLayerSets; }
936  Void   setNumAddOutputLayerSets(Int x)                         { m_numAddOutputLayerSets = x   ; }
937
938#if P0295_DEFAULT_OUT_LAYER_IDC
939  UInt   getDefaultTargetOutputLayerIdc()                 { return m_defaultTargetOutputLayerIdc;}
940  Void   setDefaultTargetOutputLayerIdc(UInt x)           { m_defaultTargetOutputLayerIdc = x    ;}
941#else
942#if O0109_DEFAULT_ONE_OUT_LAYER_IDC
943  UInt   getDefaultOneTargetOutputLayerIdc()                 { return m_defaultOneTargetOutputLayerIdc;}
944  Void   setDefaultOneTargetOutputLayerIdc(UInt x)           { m_defaultOneTargetOutputLayerIdc= x    ;}
945#else
946  Bool   getDefaultOneTargetOutputLayerFlag()                 { return m_defaultOneTargetOutputLayerFlag;}
947  Void   setDefaultOneTargetOutputLayerFlag(Bool x)           { m_defaultOneTargetOutputLayerFlag= x    ;}
948#endif
949#endif
950  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
951  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
952  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
953  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
954#if O0062_POC_LSB_NOT_PRESENT_FLAG
955  UInt   getPocLsbNotPresentFlag(Int i)                                         { return m_pocLsbNotPresentFlag[i]; }
956  Void   setPocLsbNotPresentFlag(Int i, Bool x)                                 { m_pocLsbNotPresentFlag[i] = x;    }
957#endif
958#if O0223_PICTURE_TYPES_ALIGN_FLAG
959  Bool   getCrossLayerPictureTypeAlignFlag()                                    { return m_crossLayerPictureTypeAlignFlag;                      }
960  Void   setCrossLayerPictureTypeAlignFlag(Bool x)                              { m_crossLayerPictureTypeAlignFlag = x;                         }
961#endif
962#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
963  Bool   getCrossLayerAlignedIdrOnlyFlag()                                    { return m_crossLayerAlignedIdrOnlyFlag;                      }
964  Void   setCrossLayerAlignedIdrOnlyFlag(Bool x)                              { m_crossLayerAlignedIdrOnlyFlag = x;                         }
965#endif
966  Bool   getCrossLayerIrapAlignFlag()                                           { return m_crossLayerIrapAlignFlag;                      }
967  Void   setCrossLayerIrapAlignFlag(Bool x)                                     { m_crossLayerIrapAlignFlag = x;                         }
968#if O0225_MAX_TID_FOR_REF_LAYERS
969  UInt   getMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId)                     { return m_maxTidIlRefPicsPlus1[layerId][refLayerId];           }
970  Void   setMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId][refLayerId] = maxSublayer;    }
971#else
972  UInt   getMaxTidIlRefPicsPlus1(Int layerId)                     { return m_maxTidIlRefPicsPlus1[layerId];                   }
973  Void   setMaxTidIlRefPicsPlus1(Int layerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId] = maxSublayer;            }
974#endif
975  Bool   getMaxTidRefPresentFlag()                                  { return m_maxTidRefPresentFlag ;}
976  Void   setMaxTidRefPresentFlag(Bool x)                            { m_maxTidRefPresentFlag = x;}
977#if VPS_TSLAYERS
978  Bool   getMaxTSLayersPresentFlag()                                  { return m_maxTSLayersPresentFlag ;}
979  Void   setMaxTSLayersPresentFlag(Bool x)                            { m_maxTSLayersPresentFlag = x;}
980  UInt   getMaxTSLayersMinus1(Int layerId)                            { return m_maxTSLayerMinus1[layerId];}
981  Void   setMaxTSLayersMinus1(Int layerId, UInt maxTSublayer)         { m_maxTSLayerMinus1[layerId] = maxTSublayer;}
982#endif
983#if M0040_ADAPTIVE_RESOLUTION_CHANGE
984  Bool   getSingleLayerForNonIrapFlag()                             { return m_singleLayerForNonIrapFlag; }
985  Void   setSingleLayerForNonIrapFlag(Bool x)                       { m_singleLayerForNonIrapFlag = x;    }
986#endif
987#if HIGHER_LAYER_IRAP_SKIP_FLAG
988  Bool   getHigherLayerIrapSkipFlag()                             { return m_higherLayerIrapSkipFlag; }
989  Void   setHigherLayerIrapSkipFlag(Bool x)                       { m_higherLayerIrapSkipFlag = x;    }
990#endif
991#if VPS_VUI_TILES_NOT_IN_USE__FLAG 
992  Bool   getTilesNotInUseFlag()         { return m_tilesNotInUseFlag; }
993  Void   setTilesNotInUseFlag(Bool x); 
994  Bool   getTilesInUseFlag(Int currLayerId)    { return m_tilesInUseFlag[currLayerId]; }
995  Void   setTilesInUseFlag(Int currLayerId, Bool x)    { m_tilesInUseFlag[currLayerId] = x; } 
996  Bool   getLoopFilterNotAcrossTilesFlag(Int currLayerId)    { return m_loopFilterNotAcrossTilesFlag[currLayerId]; }
997  Void   setLoopFilterNotAcrossTilesFlag(Int currLayerId, Bool x)    { m_loopFilterNotAcrossTilesFlag[currLayerId] = x; } 
998#endif
999#if TILE_BOUNDARY_ALIGNED_FLAG 
1000  Bool   getTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId)           { return m_tileBoundariesAlignedFlag[currLayerId][refLayerId]; }
1001  Void   setTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId, Bool x)   { m_tileBoundariesAlignedFlag[currLayerId][refLayerId] = x; } 
1002#endif
1003#if VPS_VUI_WPP_NOT_IN_USE__FLAG 
1004  Bool   getWppNotInUseFlag()         { return m_wppNotInUseFlag; }
1005  Void   setWppNotInUseFlag(Bool x); 
1006  Bool   getWppInUseFlag(Int currLayerId)    { return m_wppInUseFlag[currLayerId]; }
1007  Void   setWppInUseFlag(Int currLayerId, Bool x)    { m_wppInUseFlag[currLayerId] = x; } 
1008#endif
1009#if N0160_VUI_EXT_ILP_REF 
1010  Bool   getIlpRestrictedRefLayersFlag   ( )                                        { return m_ilpRestrictedRefLayersFlag        ;}
1011  Void   setIlpRestrictedRefLayersFlag   ( Int val )                                { m_ilpRestrictedRefLayersFlag         = val;}
1012 
1013  Int    getMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId )          { return m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId];}
1014  Void   setMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId, Int val ) { m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId] = val;}
1015 
1016  Bool   getCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId )            { return m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId];}
1017  Void   setCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId, Bool flag ) { m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId] = flag;}
1018 
1019  Int    getMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId )            { return m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId];}
1020  Void   setMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId, Int val )   { m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId] = val;} 
1021#endif
1022#if VPS_VUI_VIDEO_SIGNAL
1023  Bool   getVideoSigPresentVpsFlag()           { return m_vidSigPresentVpsFlag; }
1024  Void   setVideoSigPresentVpsFlag(Bool x)     { m_vidSigPresentVpsFlag = x;    }
1025  Int    getNumVideoSignalInfo()               { return m_vpsVidSigInfo;        }
1026  Void   setNumVideoSignalInfo(Int x)          { m_vpsVidSigInfo = x;           }
1027  Int    getVideoSignalInfoIdx(Int idx)        { return m_vpsVidSigIdx[idx];    }
1028  Void   setVideoSignalInfoIdx(Int idx, Int x) { m_vpsVidSigIdx[idx] = x;       }
1029  Int    getVideoVPSFormat(Int idx)            { return m_vpsVidFormat[idx];    }
1030  Void   setVideoVPSFormat(Int idx, Int x)     { m_vpsVidFormat[idx] = x;       }
1031  Bool   getVideoFullRangeVpsFlag(Int idx)     { return m_vpsFullRangeFlag[idx];}
1032  Void   setVideoFullRangeVpsFlag(Int idx, Bool x) { m_vpsFullRangeFlag[idx] = x;   }
1033  Int    getColorPrimaries(Int idx)            { return m_vpsColorPrimaries[idx];   }
1034  Void   setColorPrimaries(Int idx, Int x)     { m_vpsColorPrimaries[idx] = x;      }
1035  Int    getTransCharacter(Int idx)            { return m_vpsTransChar[idx];    }
1036  Void   setTransCharacter(Int idx, Int x)     { m_vpsTransChar[idx] = x;       }
1037  Int    getMaxtrixCoeff(Int idx)              { return m_vpsMatCoeff[idx];     }
1038  Void   setMaxtrixCoeff(Int idx, Int x)       { m_vpsMatCoeff[idx] = x;        }
1039#endif
1040  Bool   getBitRatePresentVpsFlag()       { return m_bitRatePresentVpsFlag; }
1041  Void   setBitRatePresentVpsFlag(Bool x) { m_bitRatePresentVpsFlag = x;    }
1042  Bool   getPicRatePresentVpsFlag()       { return m_picRatePresentVpsFlag; }
1043  Void   setPicRatePresentVpsFlag(Bool x) { m_picRatePresentVpsFlag = x;    }
1044         
1045  Bool   getBitRatePresentFlag(Int i, Int j)          { return m_bitRatePresentFlag[i][j]; }
1046  Void   setBitRatePresentFlag(Int i, Int j, Bool x)  { m_bitRatePresentFlag[i][j] = x;    }
1047  Bool   getPicRatePresentFlag(Int i, Int j)          { return m_picRatePresentFlag[i][j]; }
1048  Void   setPicRatePresentFlag(Int i, Int j, Bool x)  { m_picRatePresentFlag[i][j] = x;    }
1049         
1050  Int    getAvgBitRate(Int i, Int j)          { return m_avgBitRate[i][j]; }
1051  Void   setAvgBitRate(Int i, Int j, Int x)   { m_avgBitRate[i][j] = x;    }
1052  Int    getMaxBitRate(Int i, Int j)          { return m_maxBitRate[i][j]; }
1053  Void   setMaxBitRate(Int i, Int j, Int x)   { m_maxBitRate[i][j] = x;    }
1054         
1055  Int    getConstPicRateIdc(Int i, Int j)          { return m_constPicRateIdc[i][j]; }
1056  Void   setConstPicRateIdc(Int i, Int j, Int x)   { m_constPicRateIdc[i][j] = x;    }
1057  Int    getAvgPicRate(Int i, Int j)          { return m_avgPicRate[i][j]; }
1058  Void   setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
1059#if O0164_MULTI_LAYER_HRD
1060  Bool     getVpsVuiBspHrdPresentFlag()                         { return m_vpsVuiBspHrdPresentFlag;      }
1061  Void     setVpsVuiBspHrdPresentFlag(Bool x)                   { m_vpsVuiBspHrdPresentFlag = x;         }
1062  UInt     getVpsNumBspHrdParametersMinus1()                    { return m_vpsNumBspHrdParametersMinus1; }
1063  Void     setVpsNumBspHrdParametersMinus1(UInt i)              { m_vpsNumBspHrdParametersMinus1 = i;    }
1064  Bool     getBspCprmsPresentFlag(UInt i)                       { return m_bspCprmsPresentFlag[i];       }
1065  Void     setBspCprmsPresentFlag(UInt i, Bool val)             { m_bspCprmsPresentFlag[i] = val;        }
1066  TComHRD* getBspHrd(UInt i)                                    { return &m_bspHrd[i];                    }
1067  UInt     getNumBitstreamPartitions(UInt i)                    { return m_numBitstreamPartitions[i];    }
1068  Void     setNumBitstreamPartitions(UInt i, UInt val)          { m_numBitstreamPartitions[i] = val;     }
1069  UInt     getLayerInBspFlag(UInt h, UInt i, UInt j)            { return m_layerInBspFlag[h][i][j];      }
1070  Void     setLayerInBspFlag(UInt h, UInt i, UInt j, UInt val)  { m_layerInBspFlag[h][i][j] = val;       }
1071  UInt     getNumBspSchedCombinations(UInt i)                   { return m_numBspSchedCombinations[i];   }
1072  Void     setNumBspSchedCombinations(UInt i, UInt val)         { m_numBspSchedCombinations[i] = val;    }
1073  UInt     getBspCombHrdIdx(UInt h, UInt i, UInt j)             { return m_bspCombHrdIdx[h][i][j];       }
1074  Void     setBspCombHrdIdx(UInt h, UInt i, UInt j, UInt val)   { m_bspCombHrdIdx[h][i][j] = val;        }
1075  UInt     getBspCombSchedIdx(UInt h, UInt i, UInt j)           { return m_bspCombSchedIdx[h][i][j];     }
1076  Void     setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val;      }
1077#endif
1078#if P0182_VPS_VUI_PS_FLAG
1079  Int    getSPSId       (Int layer)                   { return m_SPSId[layer];       }
1080  Void   setSPSId       (Int layer, Int val)          { m_SPSId[layer] = val;        }
1081  Int    getPPSId       (Int layer)                   { return m_PPSId[layer];       }
1082  Void   setPPSId       (Int layer, Int val)          { m_PPSId[layer] = val;        }
1083  Void   setBaseLayerPSCompatibilityFlag (Int layer, int val)        { m_baseLayerPSCompatibilityFlag[layer] = val; }
1084  Int    getBaseLayerPSCompatibilityFlag (Int layer)   { return m_baseLayerPSCompatibilityFlag[layer];}
1085#endif
1086
1087#if P0312_VERT_PHASE_ADJ
1088  Bool   getVpsVuiVertPhaseInUseFlag()       { return m_vpsVuiVertPhaseInUseFlag; }
1089  Void   setVpsVuiVertPhaseInUseFlag(Bool x) { m_vpsVuiVertPhaseInUseFlag = x;    }
1090#endif
1091
1092#if P0300_ALT_OUTPUT_LAYER_FLAG
1093  Bool   getAltOuputLayerFlag(Int idx)         { return m_altOutputLayerFlag[idx]; }
1094  Void   setAltOuputLayerFlag(Int idx, Bool x) { m_altOutputLayerFlag[idx] = x;    }
1095#else
1096#if O0153_ALT_OUTPUT_LAYER_FLAG
1097  Bool   getAltOuputLayerFlag()             { return m_altOutputLayerFlag; }
1098  Void   setAltOuputLayerFlag(Bool x)       { m_altOutputLayerFlag = x;    }
1099#endif
1100#endif
1101#if REPN_FORMAT_IN_VPS
1102  Bool   getRepFormatIdxPresentFlag()       { return m_repFormatIdxPresentFlag; }
1103  Void   setRepFormatIdxPresentFlag(Bool x) { m_repFormatIdxPresentFlag = x;    }
1104
1105  Int    getVpsNumRepFormats()              { return m_vpsNumRepFormats;        }
1106  Void   setVpsNumRepFormats(Int x)         { m_vpsNumRepFormats = x;           }
1107
1108  RepFormat* getVpsRepFormat(Int idx)       { return &m_vpsRepFormat[idx];      }
1109
1110  Int    getVpsRepFormatIdx(Int idx)        { return m_vpsRepFormatIdx[idx];    }
1111  Void   setVpsRepFormatIdx(Int idx, Int x) { m_vpsRepFormatIdx[idx] = x;       }         
1112#endif
1113#if VIEW_ID_RELATED_SIGNALING
1114#if O0109_VIEW_ID_LEN
1115  Void   setViewIdLen( Int  val )                                   { m_viewIdLen = val;  } 
1116  Int    getViewIdLen(  )                                           { return m_viewIdLen; } 
1117#else
1118  Void   setViewIdLenMinus1( Int  val )                             { m_viewIdLenMinus1 = val;  } 
1119  Int    getViewIdLenMinus1(  )                                     { return m_viewIdLenMinus1; } 
1120#endif
1121
1122  Void   setViewIdVal( Int viewOrderIndex, Int  val )               { m_viewIdVal[viewOrderIndex] = val;  } 
1123  Int    getViewIdVal( Int viewOrderIndex )                         { return m_viewIdVal[viewOrderIndex]; } 
1124  Int    getScalabilityId(Int, ScalabilityType scalType );
1125
1126  Int    getViewIndex    ( Int layerIdInNuh )                       { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
1127
1128  Int    getNumViews();
1129  Int    scalTypeToScalIdx( ScalabilityType scalType );
1130#endif
1131#if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED
1132#if VPS_EXTN_OFFSET
1133  Int    getExtensionOffset()                 { return m_extensionOffset;   }
1134  Void   setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
1135#endif
1136#endif
1137#if O0215_PHASE_ALIGNMENT
1138  Bool   getPhaseAlignFlag()                             { return m_phaseAlignFlag; }
1139  Void   setPhaseAlignFlag(Bool x)                       { m_phaseAlignFlag = x;    }
1140#endif
1141#if VPS_DPB_SIZE_TABLE
1142  Bool   getSubLayerFlagInfoPresentFlag(Int i)         {return m_subLayerFlagInfoPresentFlag[i]; }
1143  Void   setSubLayerFlagInfoPresentFlag(Int i, Bool x) {m_subLayerFlagInfoPresentFlag[i] = x;    }
1144
1145  Bool   getSubLayerDpbInfoPresentFlag(Int i, Int j)         {return m_subLayerDpbInfoPresentFlag[i][j]; }
1146  Void   setSubLayerDpbInfoPresentFlag(Int i, Int j, Bool x) {m_subLayerDpbInfoPresentFlag[i][j] = x;    }
1147
1148  // For the 0-th output layer set, use the date from the active SPS for base layer.
1149  Int    getMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j)         { assert(i != 0); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
1150  Void   setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x;    }
1151
1152#if RESOLUTION_BASED_DPB
1153  Int    getMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j)        { assert(i != 0); return m_maxVpsLayerDecPicBuffMinus1[i][k][j]; }
1154  Void   setMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j, Int x) { m_maxVpsLayerDecPicBuffMinus1[i][k][j] = x;    }
1155#endif
1156
1157  Int    getMaxVpsNumReorderPics(Int i, Int j)        { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; }
1158  Void   setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x;    }
1159
1160  Int    getMaxVpsLatencyIncreasePlus1(Int i, Int j)        { assert(i != 0); return m_maxVpsLatencyIncreasePlus1[i][j]; }
1161  Void   setMaxVpsLatencyIncreasePlus1(Int i, Int j, Int x) { m_maxVpsLatencyIncreasePlus1[i][j] = x;    }
1162
1163  Int    getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
1164  Void   setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
1165  Void   determineSubDpbInfoFlags();
1166#endif
1167
1168#if O0109_MOVE_VPS_VUI_FLAG
1169  Bool   getVpsVuiPresentFlag()                        { return m_vpsVuiPresentFlag; }
1170  Void   setVpsVuiPresentFlag(Bool x)                  { m_vpsVuiPresentFlag = x;    }
1171#endif
1172  Bool   getVpsExtensionFlag()                         { return m_vpsExtensionFlag;  }
1173  Void   setVpsExtensionFlag(Bool x)                   { m_vpsExtensionFlag = x;     }
1174
1175#if !P0307_REMOVE_VPS_VUI_OFFSET
1176#if VPS_VUI_OFFSET
1177  Int    getVpsVuiOffset()         { return m_vpsVuiOffset; }
1178  Void   setVpsVuiOffset(Int x)    { m_vpsVuiOffset = x; }
1179#endif
1180#endif
1181#if P0307_VPS_NON_VUI_EXTENSION
1182  Int    getVpsNonVuiExtLength()         { return m_vpsNonVuiExtLength; }
1183  Void   setVpsNonVuiExtLength(Int x)    { m_vpsNonVuiExtLength = x; }
1184#endif
1185#if RESOLUTION_BASED_DPB
1186  Void   assignSubDpbIndices();
1187  Int    getSubDpbAssigned  (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; }
1188  Int    findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId );
1189#endif
1190#if O0164_MULTI_LAYER_HRD
1191  Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
1192#endif
1193#endif //SVC_EXTENSION
1194};
1195
1196class Window
1197{
1198private:
1199  Bool          m_enabledFlag;
1200  Int           m_winLeftOffset;
1201  Int           m_winRightOffset;
1202  Int           m_winTopOffset;
1203  Int           m_winBottomOffset;
1204#if P0312_VERT_PHASE_ADJ
1205  Bool          m_vertPhasePositionEnableFlag;
1206#endif
1207public:
1208  Window()
1209  : m_enabledFlag (false)
1210  , m_winLeftOffset     (0)
1211  , m_winRightOffset    (0)
1212  , m_winTopOffset      (0)
1213  , m_winBottomOffset   (0)
1214#if P0312_VERT_PHASE_ADJ
1215  , m_vertPhasePositionEnableFlag(false) 
1216#endif
1217  { }
1218
1219  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
1220#if P0312_VERT_PHASE_ADJ
1221  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; } 
1222#else
1223  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;} 
1224#endif
1225  Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
1226  Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
1227  Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
1228  Void          setWindowRightOffset(Int val)     { m_winRightOffset = val; m_enabledFlag = true; }
1229  Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
1230  Void          setWindowTopOffset(Int val)       { m_winTopOffset = val; m_enabledFlag = true; }
1231  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
1232  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
1233
1234#if P0312_VERT_PHASE_ADJ
1235  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
1236  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
1237  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
1238#else
1239  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
1240#endif
1241  {
1242    m_enabledFlag       = true;
1243    m_winLeftOffset     = offsetLeft;
1244    m_winRightOffset    = offsetLRight;
1245    m_winTopOffset      = offsetLTop;
1246    m_winBottomOffset   = offsetLBottom;
1247#if P0312_VERT_PHASE_ADJ
1248    m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag;   
1249#endif
1250  }
1251};
1252
1253
1254class TComVUI
1255{
1256private:
1257  Bool m_aspectRatioInfoPresentFlag;
1258  Int  m_aspectRatioIdc;
1259  Int  m_sarWidth;
1260  Int  m_sarHeight;
1261  Bool m_overscanInfoPresentFlag;
1262  Bool m_overscanAppropriateFlag;
1263  Bool m_videoSignalTypePresentFlag;
1264  Int  m_videoFormat;
1265  Bool m_videoFullRangeFlag;
1266  Bool m_colourDescriptionPresentFlag;
1267  Int  m_colourPrimaries;
1268  Int  m_transferCharacteristics;
1269  Int  m_matrixCoefficients;
1270  Bool m_chromaLocInfoPresentFlag;
1271  Int  m_chromaSampleLocTypeTopField;
1272  Int  m_chromaSampleLocTypeBottomField;
1273  Bool m_neutralChromaIndicationFlag;
1274  Bool m_fieldSeqFlag;
1275
1276  Window m_defaultDisplayWindow;
1277  Bool m_frameFieldInfoPresentFlag;
1278  Bool m_hrdParametersPresentFlag;
1279  Bool m_bitstreamRestrictionFlag;
1280  Bool m_tilesFixedStructureFlag;
1281  Bool m_motionVectorsOverPicBoundariesFlag;
1282  Bool m_restrictedRefPicListsFlag;
1283  Int  m_minSpatialSegmentationIdc;
1284  Int  m_maxBytesPerPicDenom;
1285  Int  m_maxBitsPerMinCuDenom;
1286  Int  m_log2MaxMvLengthHorizontal;
1287  Int  m_log2MaxMvLengthVertical;
1288  TComHRD m_hrdParameters;
1289  TimingInfo m_timingInfo;
1290
1291public:
1292  TComVUI()
1293    :m_aspectRatioInfoPresentFlag(false)
1294    ,m_aspectRatioIdc(0)
1295    ,m_sarWidth(0)
1296    ,m_sarHeight(0)
1297    ,m_overscanInfoPresentFlag(false)
1298    ,m_overscanAppropriateFlag(false)
1299    ,m_videoSignalTypePresentFlag(false)
1300    ,m_videoFormat(5)
1301    ,m_videoFullRangeFlag(false)
1302    ,m_colourDescriptionPresentFlag(false)
1303    ,m_colourPrimaries(2)
1304    ,m_transferCharacteristics(2)
1305    ,m_matrixCoefficients(2)
1306    ,m_chromaLocInfoPresentFlag(false)
1307    ,m_chromaSampleLocTypeTopField(0)
1308    ,m_chromaSampleLocTypeBottomField(0)
1309    ,m_neutralChromaIndicationFlag(false)
1310    ,m_fieldSeqFlag(false)
1311    ,m_frameFieldInfoPresentFlag(false)
1312    ,m_hrdParametersPresentFlag(false)
1313    ,m_bitstreamRestrictionFlag(false)
1314    ,m_tilesFixedStructureFlag(false)
1315    ,m_motionVectorsOverPicBoundariesFlag(true)
1316    ,m_restrictedRefPicListsFlag(1)
1317    ,m_minSpatialSegmentationIdc(0)
1318    ,m_maxBytesPerPicDenom(2)
1319    ,m_maxBitsPerMinCuDenom(1)
1320    ,m_log2MaxMvLengthHorizontal(15)
1321    ,m_log2MaxMvLengthVertical(15)
1322  {}
1323
1324  virtual ~TComVUI() {}
1325
1326  Bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag; }
1327  Void setAspectRatioInfoPresentFlag(Bool i) { m_aspectRatioInfoPresentFlag = i; }
1328
1329  Int getAspectRatioIdc() { return m_aspectRatioIdc; }
1330  Void setAspectRatioIdc(Int i) { m_aspectRatioIdc = i; }
1331
1332  Int getSarWidth() { return m_sarWidth; }
1333  Void setSarWidth(Int i) { m_sarWidth = i; }
1334
1335  Int getSarHeight() { return m_sarHeight; }
1336  Void setSarHeight(Int i) { m_sarHeight = i; }
1337
1338  Bool getOverscanInfoPresentFlag() { return m_overscanInfoPresentFlag; }
1339  Void setOverscanInfoPresentFlag(Bool i) { m_overscanInfoPresentFlag = i; }
1340
1341  Bool getOverscanAppropriateFlag() { return m_overscanAppropriateFlag; }
1342  Void setOverscanAppropriateFlag(Bool i) { m_overscanAppropriateFlag = i; }
1343
1344  Bool getVideoSignalTypePresentFlag() { return m_videoSignalTypePresentFlag; }
1345  Void setVideoSignalTypePresentFlag(Bool i) { m_videoSignalTypePresentFlag = i; }
1346
1347  Int getVideoFormat() { return m_videoFormat; }
1348  Void setVideoFormat(Int i) { m_videoFormat = i; }
1349
1350  Bool getVideoFullRangeFlag() { return m_videoFullRangeFlag; }
1351  Void setVideoFullRangeFlag(Bool i) { m_videoFullRangeFlag = i; }
1352
1353  Bool getColourDescriptionPresentFlag() { return m_colourDescriptionPresentFlag; }
1354  Void setColourDescriptionPresentFlag(Bool i) { m_colourDescriptionPresentFlag = i; }
1355
1356  Int getColourPrimaries() { return m_colourPrimaries; }
1357  Void setColourPrimaries(Int i) { m_colourPrimaries = i; }
1358
1359  Int getTransferCharacteristics() { return m_transferCharacteristics; }
1360  Void setTransferCharacteristics(Int i) { m_transferCharacteristics = i; }
1361
1362  Int getMatrixCoefficients() { return m_matrixCoefficients; }
1363  Void setMatrixCoefficients(Int i) { m_matrixCoefficients = i; }
1364
1365  Bool getChromaLocInfoPresentFlag() { return m_chromaLocInfoPresentFlag; }
1366  Void setChromaLocInfoPresentFlag(Bool i) { m_chromaLocInfoPresentFlag = i; }
1367
1368  Int getChromaSampleLocTypeTopField() { return m_chromaSampleLocTypeTopField; }
1369  Void setChromaSampleLocTypeTopField(Int i) { m_chromaSampleLocTypeTopField = i; }
1370
1371  Int getChromaSampleLocTypeBottomField() { return m_chromaSampleLocTypeBottomField; }
1372  Void setChromaSampleLocTypeBottomField(Int i) { m_chromaSampleLocTypeBottomField = i; }
1373
1374  Bool getNeutralChromaIndicationFlag() { return m_neutralChromaIndicationFlag; }
1375  Void setNeutralChromaIndicationFlag(Bool i) { m_neutralChromaIndicationFlag = i; }
1376
1377  Bool getFieldSeqFlag() { return m_fieldSeqFlag; }
1378  Void setFieldSeqFlag(Bool i) { m_fieldSeqFlag = i; }
1379
1380  Bool getFrameFieldInfoPresentFlag() { return m_frameFieldInfoPresentFlag; }
1381  Void setFrameFieldInfoPresentFlag(Bool i) { m_frameFieldInfoPresentFlag = i; }
1382
1383  Window& getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;                }
1384  Void    setDefaultDisplayWindow(Window& defaultDisplayWindow ) { m_defaultDisplayWindow = defaultDisplayWindow; }
1385
1386  Bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; }
1387  Void setHrdParametersPresentFlag(Bool i) { m_hrdParametersPresentFlag = i; }
1388
1389  Bool getBitstreamRestrictionFlag() { return m_bitstreamRestrictionFlag; }
1390  Void setBitstreamRestrictionFlag(Bool i) { m_bitstreamRestrictionFlag = i; }
1391
1392  Bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag; }
1393  Void setTilesFixedStructureFlag(Bool i) { m_tilesFixedStructureFlag = i; }
1394
1395  Bool getMotionVectorsOverPicBoundariesFlag() { return m_motionVectorsOverPicBoundariesFlag; }
1396  Void setMotionVectorsOverPicBoundariesFlag(Bool i) { m_motionVectorsOverPicBoundariesFlag = i; }
1397
1398  Bool getRestrictedRefPicListsFlag() { return m_restrictedRefPicListsFlag; }
1399  Void setRestrictedRefPicListsFlag(Bool b) { m_restrictedRefPicListsFlag = b; }
1400
1401  Int getMinSpatialSegmentationIdc() { return m_minSpatialSegmentationIdc; }
1402  Void setMinSpatialSegmentationIdc(Int i) { m_minSpatialSegmentationIdc = i; }
1403  Int getMaxBytesPerPicDenom() { return m_maxBytesPerPicDenom; }
1404  Void setMaxBytesPerPicDenom(Int i) { m_maxBytesPerPicDenom = i; }
1405
1406  Int getMaxBitsPerMinCuDenom() { return m_maxBitsPerMinCuDenom; }
1407  Void setMaxBitsPerMinCuDenom(Int i) { m_maxBitsPerMinCuDenom = i; }
1408
1409  Int getLog2MaxMvLengthHorizontal() { return m_log2MaxMvLengthHorizontal; }
1410  Void setLog2MaxMvLengthHorizontal(Int i) { m_log2MaxMvLengthHorizontal = i; }
1411
1412  Int getLog2MaxMvLengthVertical() { return m_log2MaxMvLengthVertical; }
1413  Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; }
1414
1415  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
1416  TimingInfo* getTimingInfo() { return &m_timingInfo; }
1417};
1418
1419/// SPS class
1420class TComSPS
1421{
1422private:
1423  Int         m_SPSId;
1424  Int         m_VPSId;
1425#if AUXILIARY_PICTURES
1426  ChromaFormat m_chromaFormatIdc;
1427#else
1428  Int         m_chromaFormatIdc;
1429#endif
1430
1431  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
1432
1433  // Structure
1434  UInt        m_picWidthInLumaSamples;
1435  UInt        m_picHeightInLumaSamples;
1436 
1437  Int         m_log2MinCodingBlockSize;
1438  Int         m_log2DiffMaxMinCodingBlockSize;
1439  UInt        m_uiMaxCUWidth;
1440  UInt        m_uiMaxCUHeight;
1441  UInt        m_uiMaxCUDepth;
1442
1443  Window      m_conformanceWindow;
1444
1445  TComRPSList m_RPSList;
1446  Bool        m_bLongTermRefsPresent;
1447  Bool        m_TMVPFlagsPresent;
1448  Int         m_numReorderPics[MAX_TLAYER];
1449 
1450  // Tool list
1451  UInt        m_uiQuadtreeTULog2MaxSize;
1452  UInt        m_uiQuadtreeTULog2MinSize;
1453  UInt        m_uiQuadtreeTUMaxDepthInter;
1454  UInt        m_uiQuadtreeTUMaxDepthIntra;
1455  Bool        m_usePCM;
1456  UInt        m_pcmLog2MaxSize;
1457  UInt        m_uiPCMLog2MinSize;
1458  Bool        m_useAMP;
1459
1460  // Parameter
1461  Int         m_bitDepthY;
1462  Int         m_bitDepthC;
1463  Int         m_qpBDOffsetY;
1464  Int         m_qpBDOffsetC;
1465
1466  UInt        m_uiPCMBitDepthLuma;
1467  UInt        m_uiPCMBitDepthChroma;
1468  Bool        m_bPCMFilterDisableFlag;
1469
1470  UInt        m_uiBitsForPOC;
1471  UInt        m_numLongTermRefPicSPS;
1472  UInt        m_ltRefPicPocLsbSps[33];
1473  Bool        m_usedByCurrPicLtSPSFlag[33];
1474  // Max physical transform size
1475  UInt        m_uiMaxTrSize;
1476 
1477  Int m_iAMPAcc[MAX_CU_DEPTH];
1478  Bool        m_bUseSAO; 
1479
1480  Bool        m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
1481
1482  Bool        m_scalingListEnabledFlag;
1483  Bool        m_scalingListPresentFlag;
1484  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
1485  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
1486  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
1487
1488  Bool        m_useDF;
1489  Bool        m_useStrongIntraSmoothing;
1490
1491  Bool        m_vuiParametersPresentFlag;
1492  TComVUI     m_vuiParameters;
1493
1494  static const Int   m_winUnitX[MAX_CHROMA_FORMAT_IDC+1];
1495  static const Int   m_winUnitY[MAX_CHROMA_FORMAT_IDC+1];
1496  TComPTL     m_pcPTL;
1497
1498#if SVC_EXTENSION
1499  UInt        m_layerId;
1500  UInt        m_numScaledRefLayerOffsets;
1501#if P0312_VERT_PHASE_ADJ
1502 Bool         m_vertPhasePositionEnableFlag[MAX_LAYERS];
1503#endif
1504#if O0098_SCALED_REF_LAYER_ID
1505  UInt        m_scaledRefLayerId[MAX_LAYERS];
1506#endif
1507  Window      m_scaledRefLayerWindow[MAX_LAYERS];
1508#if REPN_FORMAT_IN_VPS
1509  Bool        m_updateRepFormatFlag;
1510#if O0096_REP_FORMAT_INDEX
1511  UInt        m_updateRepFormatIndex;
1512#endif
1513#endif
1514#if SCALINGLIST_INFERRING
1515  Bool        m_inferScalingListFlag;
1516  UInt        m_scalingListRefLayerId;
1517#endif
1518#endif //SVC_EXTENSION
1519public:
1520  TComSPS();
1521  virtual ~TComSPS();
1522
1523  Int  getVPSId       ()         { return m_VPSId;          }
1524  Void setVPSId       (Int i)    { m_VPSId = i;             }
1525  Int  getSPSId       ()         { return m_SPSId;          }
1526  Void setSPSId       (Int i)    { m_SPSId = i;             }
1527
1528#if AUXILIARY_PICTURES
1529  ChromaFormat getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
1530  Void setChromaFormatIdc (ChromaFormat i)   { m_chromaFormatIdc = i;          }
1531
1532  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
1533  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
1534#else
1535  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
1536  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
1537
1538  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
1539  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
1540#endif
1541 
1542  // structure
1543  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
1544  UInt getPicWidthInLumaSamples       ()         { return  m_picWidthInLumaSamples;    }
1545  Void setPicHeightInLumaSamples      ( UInt u ) { m_picHeightInLumaSamples = u;       }
1546  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
1547
1548  Window& getConformanceWindow()                           { return  m_conformanceWindow;             }
1549  Void    setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
1550
1551  UInt  getNumLongTermRefPicSPS()             { return m_numLongTermRefPicSPS; }
1552  Void  setNumLongTermRefPicSPS(UInt val)     { m_numLongTermRefPicSPS = val; }
1553
1554  UInt  getLtRefPicPocLsbSps(UInt index)             { return m_ltRefPicPocLsbSps[index]; }
1555  Void  setLtRefPicPocLsbSps(UInt index, UInt val)     { m_ltRefPicPocLsbSps[index] = val; }
1556
1557  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
1558  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
1559
1560  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
1561  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
1562  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
1563  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
1564
1565  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
1566  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
1567  Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u;     }
1568  UInt getMaxCUHeight ()         { return  m_uiMaxCUHeight; }
1569  Void setMaxCUDepth  ( UInt u ) { m_uiMaxCUDepth = u;      }
1570  UInt getMaxCUDepth  ()         { return  m_uiMaxCUDepth;  }
1571  Void setUsePCM      ( Bool b ) { m_usePCM = b;           }
1572  Bool getUsePCM      ()         { return m_usePCM;        }
1573  Void setPCMLog2MaxSize  ( UInt u ) { m_pcmLog2MaxSize = u;      }
1574  UInt getPCMLog2MaxSize  ()         { return  m_pcmLog2MaxSize;  }
1575  Void setPCMLog2MinSize  ( UInt u ) { m_uiPCMLog2MinSize = u;      }
1576  UInt getPCMLog2MinSize  ()         { return  m_uiPCMLog2MinSize;  }
1577  Void setBitsForPOC  ( UInt u ) { m_uiBitsForPOC = u;      }
1578  UInt getBitsForPOC  ()         { return m_uiBitsForPOC;   }
1579  Bool getUseAMP() { return m_useAMP; }
1580  Void setUseAMP( Bool b ) { m_useAMP = b; }
1581  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
1582  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
1583  Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u;    }
1584  UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
1585  Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u;    }
1586  Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u;    }
1587  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
1588  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
1589  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
1590  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
1591  Void         createRPSList( Int numRPS );
1592  TComRPSList* getRPSList()                      { return &m_RPSList;          }
1593  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
1594  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
1595  Bool      getTMVPFlagsPresent()         { return m_TMVPFlagsPresent; }
1596  Void      setTMVPFlagsPresent(Bool b)   { m_TMVPFlagsPresent=b;      } 
1597  // physical transform
1598  Void setMaxTrSize   ( UInt u ) { m_uiMaxTrSize = u;       }
1599  UInt getMaxTrSize   ()         { return  m_uiMaxTrSize;   }
1600 
1601  // AMP accuracy
1602  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
1603  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
1604
1605  // Bit-depth
1606  Int      getBitDepthY() { return m_bitDepthY; }
1607  Void     setBitDepthY(Int u) { m_bitDepthY = u; }
1608  Int      getBitDepthC() { return m_bitDepthC; }
1609  Void     setBitDepthC(Int u) { m_bitDepthC = u; }
1610  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
1611  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
1612  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
1613  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
1614  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
1615  Bool getUseSAO                  ()           {return m_bUseSAO;}
1616
1617  UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
1618  Void      setMaxTLayers( UInt uiMaxTLayers )        { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
1619
1620  Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
1621  Void      setTemporalIdNestingFlag( Bool bValue )   { m_bTemporalIdNestingFlag = bValue; }
1622  UInt      getPCMBitDepthLuma     ()         { return m_uiPCMBitDepthLuma;     }
1623  Void      setPCMBitDepthLuma     ( UInt u ) { m_uiPCMBitDepthLuma = u;        }
1624  UInt      getPCMBitDepthChroma   ()         { return m_uiPCMBitDepthChroma;   }
1625  Void      setPCMBitDepthChroma   ( UInt u ) { m_uiPCMBitDepthChroma = u;      }
1626  Void      setPCMFilterDisableFlag     ( Bool   bValue  )    { m_bPCMFilterDisableFlag = bValue; }
1627  Bool      getPCMFilterDisableFlag     ()                    { return m_bPCMFilterDisableFlag;   } 
1628
1629  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
1630  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
1631  Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1632  Void setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1633
1634#if SCALINGLIST_INFERRING
1635  Void setScalingList( TComScalingList *scalingList ) { m_scalingList = scalingList; }
1636#else
1637  Void setScalingList      ( TComScalingList *scalingList);
1638#endif
1639  TComScalingList* getScalingList ()       { return m_scalingList; }               //!< get ScalingList class pointer in SPS
1640  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
1641  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { assert(tlayer < MAX_TLAYER);  m_uiMaxDecPicBuffering[tlayer] = ui;   }
1642  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
1643  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
1644
1645  Void setUseStrongIntraSmoothing (Bool bVal)  {m_useStrongIntraSmoothing = bVal;}
1646  Bool getUseStrongIntraSmoothing ()           {return m_useStrongIntraSmoothing;}
1647
1648  Bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; }
1649  Void setVuiParametersPresentFlag(Bool b) { m_vuiParametersPresentFlag = b; }
1650  TComVUI* getVuiParameters() { return &m_vuiParameters; }
1651  Void setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
1652
1653  TComPTL* getPTL()     { return &m_pcPTL; }
1654
1655#if SVC_EXTENSION
1656  Void     setLayerId(UInt layerId)            { m_layerId = layerId; }
1657  UInt     getLayerId()                        { return m_layerId;    }
1658  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
1659  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
1660#if P0312_VERT_PHASE_ADJ
1661  Bool     getVertPhasePositionEnableFlag(Int x)          { return m_vertPhasePositionEnableFlag[x]; }
1662  Void     setVertPhasePositionEnableFlag(Int x, Bool b)  { m_vertPhasePositionEnableFlag[x] = b;    } 
1663#endif
1664#if O0098_SCALED_REF_LAYER_ID
1665  UInt     getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
1666  Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
1667  Window&  getScaledRefLayerWindowForLayer( Int layerId );
1668#endif
1669  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
1670#if REPN_FORMAT_IN_VPS
1671  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
1672  Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
1673#if O0096_REP_FORMAT_INDEX
1674  Int      getUpdateRepFormatIndex()      { return m_updateRepFormatIndex; }
1675  Void     setUpdateRepFormatIndex(UInt index)  { m_updateRepFormatIndex = index; }
1676#endif
1677#endif
1678#if SCALINGLIST_INFERRING
1679  Bool     getInferScalingListFlag()  { return m_inferScalingListFlag;  }
1680  UInt     getScalingListRefLayerId() { return m_scalingListRefLayerId; }
1681  Void     setInferScalingListFlag( Bool flag )     { m_inferScalingListFlag = flag;     }
1682  Void     setScalingListRefLayerId( UInt layerId ) { m_scalingListRefLayerId = layerId; }
1683#endif
1684#endif //SVC_EXTENSION
1685};
1686
1687/// Reference Picture Lists class
1688class TComRefPicListModification
1689{
1690private:
1691  UInt      m_bRefPicListModificationFlagL0; 
1692  UInt      m_bRefPicListModificationFlagL1; 
1693  UInt      m_RefPicSetIdxL0[32];
1694  UInt      m_RefPicSetIdxL1[32];
1695   
1696public:
1697  TComRefPicListModification();
1698  virtual ~TComRefPicListModification();
1699 
1700  Void  create                    ();
1701  Void  destroy                   ();
1702
1703  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
1704  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
1705  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
1706  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
1707  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
1708  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
1709  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
1710  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
1711};
1712
1713/// PPS class
1714class TComPPS
1715{
1716private:
1717  Int         m_PPSId;                    // pic_parameter_set_id
1718  Int         m_SPSId;                    // seq_parameter_set_id
1719  Int         m_picInitQPMinus26;
1720  Bool        m_useDQP;
1721  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
1722  Bool        m_bSliceChromaQpFlag;       // slicelevel_chroma_qp_flag
1723
1724  // access channel
1725  TComSPS*    m_pcSPS;
1726  UInt        m_uiMaxCuDQPDepth;
1727  UInt        m_uiMinCuDQPSize;
1728
1729  Int         m_chromaCbQpOffset;
1730  Int         m_chromaCrQpOffset;
1731
1732  UInt        m_numRefIdxL0DefaultActive;
1733  UInt        m_numRefIdxL1DefaultActive;
1734
1735  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
1736  Bool        m_useWeightedBiPred;        // Use of Weighting Bi-Prediction (B_SLICE)
1737  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
1738
1739  Bool        m_TransquantBypassEnableFlag; // Indicates presence of cu_transquant_bypass_flag in CUs.
1740  Bool        m_useTransformSkip;
1741  Bool        m_dependentSliceSegmentsEnabledFlag;     //!< Indicates the presence of dependent slices
1742  Bool        m_tilesEnabledFlag;              //!< Indicates the presence of tiles
1743  Bool        m_entropyCodingSyncEnabledFlag;  //!< Indicates the presence of wavefronts
1744 
1745  Bool     m_loopFilterAcrossTilesEnabledFlag;
1746  Int      m_uniformSpacingFlag;
1747  Int      m_iNumColumnsMinus1;
1748  UInt*    m_puiColumnWidth;
1749  Int      m_iNumRowsMinus1;
1750  UInt*    m_puiRowHeight;
1751
1752  Int      m_iNumSubstreams;
1753
1754  Int      m_signHideFlag;
1755
1756  Bool     m_cabacInitPresentFlag;
1757  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
1758
1759  Bool     m_sliceHeaderExtensionPresentFlag;
1760  Bool     m_loopFilterAcrossSlicesEnabledFlag;
1761  Bool     m_deblockingFilterControlPresentFlag;
1762  Bool     m_deblockingFilterOverrideEnabledFlag;
1763  Bool     m_picDisableDeblockingFilterFlag;
1764  Int      m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1765  Int      m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1766  Bool     m_scalingListPresentFlag;
1767  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
1768  Bool m_listsModificationPresentFlag;
1769  UInt m_log2ParallelMergeLevelMinus2;
1770  Int m_numExtraSliceHeaderBits;
1771
1772#if SVC_EXTENSION
1773  Bool     m_extensionFlag;
1774#if SCALINGLIST_INFERRING
1775  UInt     m_layerId;
1776  Bool     m_inferScalingListFlag;
1777  UInt     m_scalingListRefLayerId;
1778#endif
1779#if POC_RESET_IDC
1780  Bool     m_pocResetInfoPresentFlag;
1781#endif
1782#if Q0048_CGS_3D_ASYMLUT
1783  Int      m_nCGSFlag;
1784  Int      m_nCGSOutputBitDepthY; // not for syntax
1785  Int      m_nCGSOutputBitDepthC; // not for syntax
1786#endif
1787#endif
1788
1789public:
1790  TComPPS();
1791  virtual ~TComPPS();
1792 
1793  Int       getPPSId ()      { return m_PPSId; }
1794  Void      setPPSId (Int i) { m_PPSId = i; }
1795  Int       getSPSId ()      { return m_SPSId; }
1796  Void      setSPSId (Int i) { m_SPSId = i; }
1797 
1798  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
1799  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
1800  Bool      getUseDQP ()                   { return m_useDQP;        }
1801  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
1802  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
1803  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
1804  Bool      getSliceChromaQpFlag ()         { return  m_bSliceChromaQpFlag; }
1805  Void      setSliceChromaQpFlag ( Bool b ) { m_bSliceChromaQpFlag = b;     }
1806
1807  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1808  TComSPS*  getSPS              ()         { return m_pcSPS;          }
1809  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
1810  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
1811  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
1812  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
1813
1814  Void      setChromaCbQpOffset( Int i ) { m_chromaCbQpOffset = i;    }
1815  Int       getChromaCbQpOffset()        { return m_chromaCbQpOffset; }
1816  Void      setChromaCrQpOffset( Int i ) { m_chromaCrQpOffset = i;    }
1817  Int       getChromaCrQpOffset()        { return m_chromaCrQpOffset; }
1818
1819  Void      setNumRefIdxL0DefaultActive(UInt ui)    { m_numRefIdxL0DefaultActive=ui;     }
1820  UInt      getNumRefIdxL0DefaultActive()           { return m_numRefIdxL0DefaultActive; }
1821  Void      setNumRefIdxL1DefaultActive(UInt ui)    { m_numRefIdxL1DefaultActive=ui;     }
1822  UInt      getNumRefIdxL1DefaultActive()           { return m_numRefIdxL1DefaultActive; }
1823
1824  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
1825  Bool getWPBiPred                  ()          { return m_useWeightedBiPred;     }
1826  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
1827  Void setWPBiPred                  ( Bool b )  { m_useWeightedBiPred = b;  }
1828  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
1829  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
1830  Void      setTransquantBypassEnableFlag( Bool b ) { m_TransquantBypassEnableFlag = b; }
1831  Bool      getTransquantBypassEnableFlag()         { return m_TransquantBypassEnableFlag; }
1832
1833  Bool      getUseTransformSkip       ()         { return m_useTransformSkip;     }
1834  Void      setUseTransformSkip       ( Bool b ) { m_useTransformSkip  = b;       }
1835
1836  Void    setLoopFilterAcrossTilesEnabledFlag  (Bool b)    { m_loopFilterAcrossTilesEnabledFlag = b; }
1837  Bool    getLoopFilterAcrossTilesEnabledFlag  ()          { return m_loopFilterAcrossTilesEnabledFlag;   }
1838  Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag; }
1839  Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val; }
1840  Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag; }
1841  Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val; }
1842  Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag; }
1843  Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val; }
1844  Void     setUniformSpacingFlag            ( Bool b )          { m_uniformSpacingFlag = b; }
1845  Bool     getUniformSpacingFlag            ()                  { return m_uniformSpacingFlag; }
1846  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
1847  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
1848  Void     setColumnWidth ( UInt* columnWidth )
1849  {
1850    if( m_uniformSpacingFlag == 0 && m_iNumColumnsMinus1 > 0 )
1851    {
1852      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
1853
1854      for(Int i=0; i<m_iNumColumnsMinus1; i++)
1855      {
1856        m_puiColumnWidth[i] = columnWidth[i];
1857      }
1858    }
1859  }
1860  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
1861  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
1862  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
1863  Void     setRowHeight    ( UInt* rowHeight )
1864  {
1865    if( m_uniformSpacingFlag == 0 && m_iNumRowsMinus1 > 0 )
1866    {
1867      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
1868
1869      for(Int i=0; i<m_iNumRowsMinus1; i++)
1870      {
1871        m_puiRowHeight[i] = rowHeight[i];
1872      }
1873    }
1874  }
1875  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
1876  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
1877  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
1878
1879  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
1880  Int       getSignHideFlag()                    { return m_signHideFlag; }
1881
1882  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
1883  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
1884  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
1885  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
1886  Void     setDeblockingFilterControlPresentFlag( Bool val )  { m_deblockingFilterControlPresentFlag = val; }
1887  Bool     getDeblockingFilterControlPresentFlag()            { return m_deblockingFilterControlPresentFlag; }
1888  Void     setDeblockingFilterOverrideEnabledFlag( Bool val ) { m_deblockingFilterOverrideEnabledFlag = val; }
1889  Bool     getDeblockingFilterOverrideEnabledFlag()           { return m_deblockingFilterOverrideEnabledFlag; }
1890  Void     setPicDisableDeblockingFilterFlag(Bool val)        { m_picDisableDeblockingFilterFlag = val; }       //!< set offset for deblocking filter disabled
1891  Bool     getPicDisableDeblockingFilterFlag()                { return m_picDisableDeblockingFilterFlag; }      //!< get offset for deblocking filter disabled
1892  Void     setDeblockingFilterBetaOffsetDiv2(Int val)         { m_deblockingFilterBetaOffsetDiv2 = val; }       //!< set beta offset for deblocking filter
1893  Int      getDeblockingFilterBetaOffsetDiv2()                { return m_deblockingFilterBetaOffsetDiv2; }      //!< get beta offset for deblocking filter
1894  Void     setDeblockingFilterTcOffsetDiv2(Int val)           { m_deblockingFilterTcOffsetDiv2 = val; }               //!< set tc offset for deblocking filter
1895  Int      getDeblockingFilterTcOffsetDiv2()                  { return m_deblockingFilterTcOffsetDiv2; }              //!< get tc offset for deblocking filter
1896  Bool     getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1897  Void     setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1898
1899#if SCALINGLIST_INFERRING
1900  Void     setScalingList( TComScalingList *scalingList ) { m_scalingList = scalingList; }
1901#else
1902  Void     setScalingList      ( TComScalingList *scalingList);
1903#endif
1904  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in PPS
1905  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
1906  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
1907  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
1908  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
1909  Int getNumExtraSliceHeaderBits() { return m_numExtraSliceHeaderBits; }
1910  Void setNumExtraSliceHeaderBits(Int i) { m_numExtraSliceHeaderBits = i; }
1911  Void      setLoopFilterAcrossSlicesEnabledFlag ( Bool   bValue  )    { m_loopFilterAcrossSlicesEnabledFlag = bValue; }
1912  Bool      getLoopFilterAcrossSlicesEnabledFlag ()                    { return m_loopFilterAcrossSlicesEnabledFlag;   } 
1913  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
1914  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
1915#if SVC_EXTENSION
1916  Int     getExtensionFlag()                { return m_extensionFlag;  }
1917  Void    setExtensionFlag(Int n)           { m_extensionFlag = n;     }
1918#if SCALINGLIST_INFERRING
1919  UInt     getLayerId() { return m_layerId; }
1920  Void     setLayerId( UInt layerId ) { m_layerId = layerId;            }
1921  Bool     getInferScalingListFlag()  { return m_inferScalingListFlag;  }
1922  UInt     getScalingListRefLayerId() { return m_scalingListRefLayerId; }
1923  Void     setInferScalingListFlag( Bool flag )     { m_inferScalingListFlag = flag;     }
1924  Void     setScalingListRefLayerId( UInt layerId ) { m_scalingListRefLayerId = layerId; }
1925#endif
1926#if POC_RESET_IDC
1927  Bool getPocResetInfoPresentFlag   ()                    { return m_pocResetInfoPresentFlag; }
1928  Void setPocResetInfoPresentFlag   (const Bool val)      { m_pocResetInfoPresentFlag = val; }
1929#endif
1930#if Q0048_CGS_3D_ASYMLUT
1931  Int     getCGSFlag()                { return m_nCGSFlag;  }
1932  Void    setCGSFlag(Int n)           { m_nCGSFlag = n;     }
1933  Int     getCGSOutputBitDepthY()     { return m_nCGSOutputBitDepthY;  }
1934  Void    setCGSOutputBitDepthY(Int n){ m_nCGSOutputBitDepthY = n;     }
1935  Int     getCGSOutputBitDepthC()     { return m_nCGSOutputBitDepthC;  }
1936  Void    setCGSOutputBitDepthC(Int n){ m_nCGSOutputBitDepthC = n;     }
1937#endif
1938#endif //SVC_EXTENSION
1939};
1940
1941typedef struct
1942{
1943  // Explicit weighted prediction parameters parsed in slice header,
1944  // or Implicit weighted prediction parameters (8 bits depth values).
1945  Bool        bPresentFlag;
1946  UInt        uiLog2WeightDenom;
1947  Int         iWeight;
1948  Int         iOffset;
1949
1950  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
1951  Int         w, o, offset, shift, round;
1952} wpScalingParam;
1953
1954typedef struct
1955{
1956  Int64 iAC;
1957  Int64 iDC;
1958#if O0194_WEIGHTED_PREDICTION_CGS
1959  Int iSamples;
1960#endif
1961} wpACDCParam;
1962
1963/// slice header class
1964class TComSlice
1965{
1966 
1967private:
1968  //  Bitstream writing
1969  Bool       m_saoEnabledFlag;
1970  Bool       m_saoEnabledFlagChroma;      ///< SAO Cb&Cr enabled flag
1971  Int         m_iPPSId;               ///< picture parameter set ID
1972  Bool        m_PicOutputFlag;        ///< pic_output_flag
1973  Int         m_iPOC;
1974  Int         m_iLastIDR;
1975  Int         m_iAssociatedIRAP;
1976  NalUnitType m_iAssociatedIRAPType;
1977  static Int  m_prevTid0POC;
1978  TComReferencePictureSet *m_pcRPS;
1979  TComReferencePictureSet m_LocalRPS;
1980  Int         m_iBDidx; 
1981  TComRefPicListModification m_RefPicListModification;
1982  NalUnitType m_eNalUnitType;         ///< Nal unit type for the slice
1983  SliceType   m_eSliceType;
1984  Int         m_iSliceQp;
1985  Bool        m_dependentSliceSegmentFlag;
1986#if ADAPTIVE_QP_SELECTION
1987  Int         m_iSliceQpBase;
1988#endif
1989  Bool        m_deblockingFilterDisable;
1990  Bool        m_deblockingFilterOverrideFlag;      //< offsets for deblocking filter inherit from PPS
1991  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1992  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1993  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
1994  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
1995
1996  Bool        m_bCheckLDC;
1997
1998  //  Data
1999  Int         m_iSliceQpDelta;
2000  Int         m_iSliceQpDeltaCb;
2001  Int         m_iSliceQpDeltaCr;
2002  TComPic*    m_apcRefPicList [2][MAX_NUM_REF+1];
2003  Int         m_aiRefPOCList  [2][MAX_NUM_REF+1];
2004  Bool        m_bIsUsedAsLongTerm[2][MAX_NUM_REF+1];
2005  Int         m_iDepth;
2006 
2007  // referenced slice?
2008  Bool        m_bRefenced;
2009
2010  // access channel
2011  TComVPS*    m_pcVPS;
2012  TComSPS*    m_pcSPS;
2013  TComPPS*    m_pcPPS;
2014  TComPic*    m_pcPic;
2015#if ADAPTIVE_QP_SELECTION
2016  TComTrQuant* m_pcTrQuant;
2017#endif 
2018  UInt        m_colFromL0Flag;  // collocated picture from List0 flag
2019 
2020#if SETTING_NO_OUT_PIC_PRIOR
2021  Bool        m_noOutputPriorPicsFlag;
2022  Bool        m_noRaslOutputFlag;
2023  Bool        m_handleCraAsBlaFlag;
2024#endif
2025 
2026  UInt        m_colRefIdx;
2027  UInt        m_maxNumMergeCand;
2028
2029  Double      m_lambdas[3];
2030
2031  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
2032  UInt        m_uiTLayer;
2033  Bool        m_bTLayerSwitchingFlag;
2034
2035  UInt        m_sliceMode;
2036  UInt        m_sliceArgument;
2037  UInt        m_sliceCurStartCUAddr;
2038  UInt        m_sliceCurEndCUAddr;
2039  UInt        m_sliceIdx;
2040  UInt        m_sliceSegmentMode;
2041  UInt        m_sliceSegmentArgument;
2042  UInt        m_sliceSegmentCurStartCUAddr;
2043  UInt        m_sliceSegmentCurEndCUAddr;
2044  Bool        m_nextSlice;
2045  Bool        m_nextSliceSegment;
2046  UInt        m_sliceBits;
2047  UInt        m_sliceSegmentBits;
2048  Bool        m_bFinalized;
2049
2050  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
2051  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
2052
2053  std::vector<UInt> m_tileByteLocation;
2054  UInt        m_uiTileOffstForMultES;
2055
2056  UInt*       m_puiSubstreamSizes;
2057  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
2058  Bool        m_cabacInitFlag; 
2059
2060  Bool       m_bLMvdL1Zero;
2061  Int         m_numEntryPointOffsets;
2062  Bool       m_temporalLayerNonReferenceFlag;
2063  Bool       m_LFCrossSliceBoundaryFlag;
2064
2065  Bool       m_enableTMVPFlag;
2066
2067#if SVC_EXTENSION
2068  UInt        m_layerId;
2069  TComPic*    m_pcBaseColPic[MAX_LAYERS];
2070  TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
2071  Int         m_numMotionPredRefLayers;
2072#if REF_IDX_MFM
2073  Bool        m_bMFMEnabledFlag;
2074  Int         m_colRefLayerIdx;
2075  Bool        m_altColIndicationFlag;
2076  TComPic*    m_pcIlpPic;
2077#endif
2078
2079  Bool        m_interLayerPredEnabledFlag;
2080  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
2081  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
2082#if P0312_VERT_PHASE_ADJ
2083  Bool        m_vertPhasePositionFlag[MAX_VPS_LAYER_ID_PLUS1];
2084#endif
2085#if POC_RESET_FLAG
2086  Bool        m_bPocResetFlag;
2087  Int         m_pocValueBeforeReset;
2088#endif 
2089  Bool        m_bDiscardableFlag;
2090#if O0149_CROSS_LAYER_BLA_FLAG
2091  Bool        m_bCrossLayerBLAFlag;
2092#endif
2093#if POC_RESET_IDC_SIGNALLING
2094  Int         m_pocResetIdc;
2095  Int         m_pocResetPeriodId;
2096  Bool        m_fullPocResetFlag;
2097  Int         m_pocLsbVal;
2098  Int         m_pocMsbVal;
2099  Bool        m_pocMsbValRequiredFlag;
2100  Bool        m_pocMsbValPresentFlag;
2101#endif
2102#if Q0048_CGS_3D_ASYMLUT
2103  Int        m_nCGSOverWritePPS;  // for optimization, not output to bitstream
2104#endif
2105#endif //SVC_EXTENSION
2106
2107public:
2108  TComSlice();
2109  virtual ~TComSlice(); 
2110#if SVC_EXTENSION
2111  Void      initSlice       ( UInt layerId );
2112#else
2113  Void      initSlice       ();
2114#endif
2115
2116  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
2117  TComVPS*  getVPS          () { return m_pcVPS; }
2118  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
2119  TComSPS*  getSPS          () { return m_pcSPS; }
2120 
2121  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
2122  TComPPS*  getPPS          () { return m_pcPPS; }
2123
2124#if ADAPTIVE_QP_SELECTION
2125  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
2126  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
2127#endif
2128
2129  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
2130  Int       getPPSId        () { return m_iPPSId; }
2131  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
2132  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
2133  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
2134  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
2135  Void      setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; }       //!< set SAO Cb&Cr enabled flag
2136  Bool      getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; }        //!< get SAO Cb&Cr enabled flag
2137  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
2138  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
2139  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
2140
2141  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
2142  Int       getRPSidx          () { return m_iBDidx; }
2143  Int       getPrevTid0POC      ()                        { return  m_prevTid0POC;       }
2144#if PREVTID0_POC_RESET
2145    Void     adjustPrevTid0POC      (Int adj)             { m_prevTid0POC=m_prevTid0POC-adj; }
2146#endif
2147  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
2148  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
2149  Int       getLastIDR()                                  { return m_iLastIDR; }
2150  Void      setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)             { m_iAssociatedIRAP = iAssociatedIRAPPOC; }
2151  Int       getAssociatedIRAPPOC()                        { return m_iAssociatedIRAP; }
2152  Void      setAssociatedIRAPType(NalUnitType associatedIRAPType)    { m_iAssociatedIRAPType = associatedIRAPType; }
2153  NalUnitType getAssociatedIRAPType()                        { return m_iAssociatedIRAPType; }
2154  SliceType getSliceType    ()                          { return  m_eSliceType;         }
2155  Int       getPOC          ()                          { return  m_iPOC;           }
2156  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
2157  Bool      getDependentSliceSegmentFlag() const        { return m_dependentSliceSegmentFlag; }
2158  void      setDependentSliceSegmentFlag(Bool val)      { m_dependentSliceSegmentFlag = val; }
2159#if ADAPTIVE_QP_SELECTION
2160  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
2161#endif
2162  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
2163  Int       getSliceQpDeltaCb ()                          { return  m_iSliceQpDeltaCb;      }
2164  Int       getSliceQpDeltaCr ()                          { return  m_iSliceQpDeltaCr;      }
2165  Bool      getDeblockingFilterDisable()                { return  m_deblockingFilterDisable; }
2166  Bool      getDeblockingFilterOverrideFlag()           { return  m_deblockingFilterOverrideFlag; }
2167  Int       getDeblockingFilterBetaOffsetDiv2()         { return  m_deblockingFilterBetaOffsetDiv2; }
2168  Int       getDeblockingFilterTcOffsetDiv2()           { return  m_deblockingFilterTcOffsetDiv2; }
2169
2170  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
2171  TComPic*  getPic              ()                              { return  m_pcPic;                      }
2172  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
2173  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
2174  Int       getDepth            ()                              { return  m_iDepth;                     }
2175  UInt      getColFromL0Flag    ()                              { return  m_colFromL0Flag;              }
2176  UInt      getColRefIdx        ()                              { return  m_colRefIdx;                  }
2177  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
2178  Bool      getIsUsedAsLongTerm (Int i, Int j)                  { return m_bIsUsedAsLongTerm[i][j]; }
2179  Void      setIsUsedAsLongTerm (Int i, Int j, Bool value)      { m_bIsUsedAsLongTerm[i][j] = value; }
2180  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
2181  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
2182  Int       getNumRpsCurrTempList();
2183  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
2184  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
2185  Bool      isReferenced()                                      { return m_bRefenced; }
2186  Bool      isReferenceNalu()                                   { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); }
2187  Void      setPOC              ( Int i )                       { m_iPOC              = i; if ((getTLayer()==0) && (isReferenceNalu() && (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) {m_prevTid0POC=i;} }
2188  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
2189  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
2190  Bool      getRapPicFlag       (); 
2191  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
2192  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
2193  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
2194#if NO_CLRAS_OUTPUT_FLAG
2195  Void      decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag );
2196  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag);
2197#else
2198  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
2199#endif
2200  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
2201  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
2202#if ADAPTIVE_QP_SELECTION
2203  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
2204#endif
2205  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
2206  Void      setSliceQpDeltaCb   ( Int i )                       { m_iSliceQpDeltaCb   = i;      }
2207  Void      setSliceQpDeltaCr   ( Int i )                       { m_iSliceQpDeltaCr   = i;      }
2208  Void      setDeblockingFilterDisable( Bool b )                { m_deblockingFilterDisable= b;      }
2209  Void      setDeblockingFilterOverrideFlag( Bool b )           { m_deblockingFilterOverrideFlag = b; }
2210  Void      setDeblockingFilterBetaOffsetDiv2( Int i )          { m_deblockingFilterBetaOffsetDiv2 = i; }
2211  Void      setDeblockingFilterTcOffsetDiv2( Int i )            { m_deblockingFilterTcOffsetDiv2 = i; }
2212 
2213  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
2214  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
2215  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
2216  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
2217  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
2218
2219#if SVC_EXTENSION
2220  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL );
2221#if Q0048_CGS_3D_ASYMLUT
2222  Int       getCGSOverWritePPS()              { return m_nCGSOverWritePPS;    }
2223  Void      setCGSOverWritePPS(Int n)         { m_nCGSOverWritePPS = n;       }
2224#endif
2225#else
2226  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
2227#endif
2228  Void      setRefPOCList       ();
2229  Void      setColFromL0Flag    ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; }
2230  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
2231  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
2232  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
2233
2234  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
2235  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
2236  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
2237 
2238  Void      setLambdas ( const Double lambdas[3] ) { for (Int component = 0; component < 3; component++) m_lambdas[component] = lambdas[component]; }
2239  const Double* getLambdas() const { return m_lambdas; }
2240 
2241  Void      initEqualRef();
2242  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
2243  {
2244    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
2245    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
2246  }
2247 
2248  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
2249  {
2250    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
2251  }
2252 
2253  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
2254  Void setList1IdxToList0Idx();
2255
2256  UInt getTLayer             ()                            { return m_uiTLayer;                      }
2257  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
2258
2259  Void setTLayerInfo( UInt uiTLayer );
2260  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
2261  Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic );
2262  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
2263  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
2264  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
2265#if ALLOW_RECOVERY_POINT_AS_RAP
2266  Int  checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0, Bool bUseRecoveryPoint = false);
2267  Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess = 0, Bool bUseRecoveryPoint = false);
2268#else
2269  Int  checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
2270  Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
2271#endif
2272
2273  Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
2274  UInt getMaxNumMergeCand               ()                  { return m_maxNumMergeCand;                   }
2275
2276#if SETTING_NO_OUT_PIC_PRIOR
2277  Void setNoOutputPriorPicsFlag         ( Bool val )        { m_noOutputPriorPicsFlag = val;                    }
2278  Bool getNoOutputPriorPicsFlag         ()                  { return m_noOutputPriorPicsFlag;                   }
2279
2280  Void setNoRaslOutputFlag              ( Bool val )        { m_noRaslOutputFlag = val;                    }
2281  Bool getNoRaslOutputFlag              ()                  { return m_noRaslOutputFlag;                   }
2282
2283  Void setHandleCraAsBlaFlag            ( Bool val )        { m_handleCraAsBlaFlag = val;                    }
2284  Bool getHandleCraAsBlaFlag            ()                  { return m_handleCraAsBlaFlag;                   }
2285#endif
2286
2287  Void setSliceMode                     ( UInt uiMode )     { m_sliceMode = uiMode;                     }
2288  UInt getSliceMode                     ()                  { return m_sliceMode;                       }
2289  Void setSliceArgument                 ( UInt uiArgument ) { m_sliceArgument = uiArgument;             }
2290  UInt getSliceArgument                 ()                  { return m_sliceArgument;                   }
2291  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_sliceCurStartCUAddr = uiAddr;           }
2292  UInt getSliceCurStartCUAddr           ()                  { return m_sliceCurStartCUAddr;             }
2293  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_sliceCurEndCUAddr = uiAddr;             }
2294  UInt getSliceCurEndCUAddr             ()                  { return m_sliceCurEndCUAddr;               }
2295  Void setSliceIdx                      ( UInt i)           { m_sliceIdx = i;                           }
2296  UInt getSliceIdx                      ()                  { return  m_sliceIdx;                       }
2297  Void copySliceInfo                    (TComSlice *pcSliceSrc);
2298  Void setSliceSegmentMode              ( UInt uiMode )     { m_sliceSegmentMode = uiMode;              }
2299  UInt getSliceSegmentMode              ()                  { return m_sliceSegmentMode;                }
2300  Void setSliceSegmentArgument          ( UInt uiArgument ) { m_sliceSegmentArgument = uiArgument;      }
2301  UInt getSliceSegmentArgument          ()                  { return m_sliceSegmentArgument;            }
2302  Void setSliceSegmentCurStartCUAddr    ( UInt uiAddr )     { m_sliceSegmentCurStartCUAddr = uiAddr;    }
2303  UInt getSliceSegmentCurStartCUAddr    ()                  { return m_sliceSegmentCurStartCUAddr;      }
2304  Void setSliceSegmentCurEndCUAddr      ( UInt uiAddr )     { m_sliceSegmentCurEndCUAddr = uiAddr;      }
2305  UInt getSliceSegmentCurEndCUAddr      ()                  { return m_sliceSegmentCurEndCUAddr;        }
2306  Void setNextSlice                     ( Bool b )          { m_nextSlice = b;                           }
2307  Bool isNextSlice                      ()                  { return m_nextSlice;                        }
2308  Void setNextSliceSegment              ( Bool b )          { m_nextSliceSegment = b;                    }
2309  Bool isNextSliceSegment               ()                  { return m_nextSliceSegment;                 }
2310  Void setSliceBits                     ( UInt uiVal )      { m_sliceBits = uiVal;                      }
2311  UInt getSliceBits                     ()                  { return m_sliceBits;                       } 
2312  Void setSliceSegmentBits              ( UInt uiVal )      { m_sliceSegmentBits = uiVal;            }
2313  UInt getSliceSegmentBits              ()                  { return m_sliceSegmentBits;             }
2314  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
2315  Bool getFinalized                     ()                  { return m_bFinalized;                        }
2316  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
2317  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
2318
2319  Void  resetWpScaling  ();
2320  Void  initWpScaling   ();
2321  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
2322
2323  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
2324  Void  getWpAcDcParam  ( wpACDCParam *&wp );
2325  Void  initWpAcDcParam ();
2326 
2327  Void setTileLocationCount             ( UInt cnt )               { return m_tileByteLocation.resize(cnt);    }
2328  UInt getTileLocationCount             ()                         { return (UInt) m_tileByteLocation.size();  }
2329  Void setTileLocation                  ( Int idx, UInt location ) { assert (idx<m_tileByteLocation.size());
2330                                                                     m_tileByteLocation[idx] = location;       }
2331  Void addTileLocation                  ( UInt location )          { m_tileByteLocation.push_back(location);   }
2332  UInt getTileLocation                  ( Int idx )                { return m_tileByteLocation[idx];           }
2333
2334  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
2335  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
2336  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
2337  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
2338  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
2339  TComScalingList*   getScalingList ()                               { return m_scalingList; }
2340  Void  setDefaultScalingList       ();
2341  Bool  checkDefaultScalingList     ();
2342  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
2343  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
2344  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
2345  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
2346  Bool      getTemporalLayerNonReferenceFlag()       { return m_temporalLayerNonReferenceFlag;}
2347  Void      setTemporalLayerNonReferenceFlag(Bool x) { m_temporalLayerNonReferenceFlag = x;}
2348  Void      setLFCrossSliceBoundaryFlag     ( Bool   val )    { m_LFCrossSliceBoundaryFlag = val; }
2349  Bool      getLFCrossSliceBoundaryFlag     ()                { return m_LFCrossSliceBoundaryFlag;} 
2350
2351  Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
2352  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
2353
2354#if SVC_EXTENSION
2355  Bool      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt refLayerIdc );
2356  Void      setBaseColPic       (UInt refLayerIdc, TComPic* p)     { m_pcBaseColPic[refLayerIdc] = p; }
2357  TComPic*  getBaseColPic       (UInt refLayerIdc)                { return m_pcBaseColPic[refLayerIdc]; }
2358  TComPic** getBaseColPic       ()                { return &m_pcBaseColPic[0]; }
2359#if MFM_ENCCONSTRAINT
2360  TComPic*  getBaseColPic( TComList<TComPic*>& rcListPic );
2361#endif
2362
2363  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
2364  UInt      getLayerId ()               { return m_layerId;    }
2365
2366  Void        setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
2367  TComPicYuv* getFullPelBaseRec   (UInt refLayerIdc)               { return  m_pcFullPelBaseRec[refLayerIdc];  }
2368
2369#if AVC_SYNTAX
2370  Void      initBaseLayerRPL( TComSlice *pcSlice );
2371#endif
2372
2373  Void      setRefPicListModificationSvc();
2374  Int       getNumILRRefIdx     ( )                     { return  m_pcVPS->getNumDirectRefLayers( m_layerId ); }
2375
2376#if REF_IDX_MFM
2377  Void      setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL);
2378#endif
2379
2380  Int       getActiveNumILRRefIdx     ( )               { return  m_activeNumILRRefIdx; }
2381  Void      setActiveNumILRRefIdx     ( Int i )         { m_activeNumILRRefIdx = i;     } 
2382
2383  Int       getInterLayerPredLayerIdc (UInt layerIdx)                        { return  m_interLayerPredLayerIdc[layerIdx];}
2384  Void      setInterLayerPredLayerIdc (UInt refLayerIdc, UInt layerIdx)      { m_interLayerPredLayerIdc[layerIdx] = refLayerIdc;  }
2385
2386  Void      setInterLayerPredEnabledFlag     ( Bool   val )    { m_interLayerPredEnabledFlag = val; }
2387  Bool      getInterLayerPredEnabledFlag     ()                { return m_interLayerPredEnabledFlag;}
2388
2389#if P0312_VERT_PHASE_ADJ
2390  Int       getVertPhasePositionFlag (UInt layerIdx)              { return   m_vertPhasePositionFlag[layerIdx];}
2391  Void      setVertPhasePositionFlag (Bool b, UInt layerIdx)      {  m_vertPhasePositionFlag[layerIdx] = b;  }
2392#endif
2393
2394  Void      setNumMotionPredRefLayers(int i)            { m_numMotionPredRefLayers = i; }
2395  Int       getNumMotionPredRefLayers()                 { return m_numMotionPredRefLayers; }
2396#if REF_IDX_MFM
2397  Void      setMFMEnabledFlag(Bool flag)                { m_bMFMEnabledFlag = flag; }
2398  Bool      getMFMEnabledFlag()                         { return m_bMFMEnabledFlag; }
2399#endif
2400
2401  TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); } 
2402
2403  Bool     isRADL()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
2404  Bool     isRASL()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
2405
2406#if POC_RESET_FLAG
2407  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag;       }
2408  Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b;          }
2409  Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
2410  Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ;   }
2411#endif
2412  Bool      getDiscardableFlag  ()                           { return m_bDiscardableFlag;    }
2413  Void      setDiscardableFlag  (Bool b)                     { m_bDiscardableFlag = b;       }
2414#if O0149_CROSS_LAYER_BLA_FLAG
2415  Bool      getCrossLayerBLAFlag  ()                         { return m_bCrossLayerBLAFlag;  }
2416  Void      setCrossLayerBLAFlag  (Bool b)                   { m_bCrossLayerBLAFlag = b;     }
2417#endif
2418
2419#if RPL_INIT_N0316_N0082
2420  Int       getNumNegativeRpsCurrTempList();
2421#endif
2422
2423#if REPN_FORMAT_IN_VPS
2424  UInt getPicWidthInLumaSamples();
2425  UInt getPicHeightInLumaSamples();
2426#if AUXILIARY_PICTURES
2427  ChromaFormat getChromaFormatIdc();
2428#else
2429  UInt getChromaFormatIdc();
2430#endif
2431  UInt getBitDepthY();
2432  UInt getBitDepthC();
2433  Int  getQpBDOffsetY();
2434  Int  getQpBDOffsetC();
2435#endif
2436
2437  Void setILRPic(TComPic **pcIlpPic);
2438#if POC_RESET_IDC_SIGNALLING
2439  Int       getPocResetIdc       ()                              { return m_pocResetIdc;       }
2440  Void      setPocResetIdc       (Int b)                         { m_pocResetIdc = b;          }
2441  Int       getPocResetPeriodId  ()                              { return m_pocResetPeriodId;       }
2442  Void      setPocResetPeriodId  (Int b)                         { m_pocResetPeriodId = b;          }
2443  Bool      getFullPocResetFlag  ()                              { return m_fullPocResetFlag;       }
2444  Void      setFullPocResetFlag  (Bool b)                        { m_fullPocResetFlag = b;          }
2445  Int       getPocLsbVal         ()                              { return m_pocLsbVal;       }
2446  Void      setPocLsbVal       (Int b)                           { m_pocLsbVal = b;          }
2447  Int       getPocMsbVal         ()                              { return m_pocMsbVal;       }
2448  Void      setPocMsbVal       (Int b)                           { m_pocMsbVal = b;          }
2449  Bool      getPocMsbValPresentFlag ()                           { return m_pocMsbValPresentFlag; }
2450  Void      setPocMsbValPresentFlag (Bool x)                     { m_pocMsbValPresentFlag = x; }
2451  Bool      getPocMsbValRequiredFlag ()                           { return m_pocMsbValRequiredFlag; }
2452  Void      setPocMsbValRequiredFlag (Bool x)                     { m_pocMsbValRequiredFlag = x; }
2453#endif
2454
2455#if NO_OUTPUT_OF_PRIOR_PICS
2456  Bool      getBlaPicFlag       ();
2457  Bool      getCraPicFlag       ();
2458#endif
2459
2460#endif //SVC_EXTENSION
2461protected:
2462  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
2463                         Int                 poc);
2464  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
2465};// END CLASS DEFINITION TComSlice
2466
2467
2468template <class T> class ParameterSetMap
2469{
2470public:
2471  ParameterSetMap(Int maxId)
2472  :m_maxId (maxId)
2473  {}
2474
2475  ~ParameterSetMap()
2476  {
2477    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
2478    {
2479      delete (*i).second;
2480    }
2481  }
2482
2483  Void storePS(Int psId, T *ps)
2484  {
2485    assert ( psId < m_maxId );
2486    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
2487    {
2488      delete m_paramsetMap[psId];
2489    }
2490    m_paramsetMap[psId] = ps; 
2491  }
2492
2493  Void mergePSList(ParameterSetMap<T> &rPsList)
2494  {
2495    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
2496    {
2497      storePS(i->first, i->second);
2498    }
2499    rPsList.m_paramsetMap.clear();
2500  }
2501
2502
2503  T* getPS(Int psId)
2504  {
2505    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
2506  }
2507
2508  T* getFirstPS()
2509  {
2510    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
2511  }
2512
2513#if Q0078_ADD_LAYER_SETS
2514  Void removePS(Int psId)
2515  {
2516    assert(psId < m_maxId);
2517    if (m_paramsetMap.find(psId) != m_paramsetMap.end())
2518    {
2519      m_paramsetMap.erase(psId);
2520    }
2521  }
2522#endif
2523
2524
2525private:
2526  std::map<Int,T *> m_paramsetMap;
2527  Int               m_maxId;
2528};
2529
2530class ParameterSetManager
2531{
2532public:
2533  ParameterSetManager();
2534  virtual ~ParameterSetManager();
2535
2536  //! store sequence parameter set and take ownership of it
2537  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
2538  //! get pointer to existing video parameter set 
2539  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
2540  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
2541 
2542  //! store sequence parameter set and take ownership of it
2543  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
2544  //! get pointer to existing sequence parameter set 
2545  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
2546  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
2547#if Q0078_ADD_LAYER_SETS
2548  Void     removeSPS(Int spsId) { m_spsMap.removePS(spsId); };
2549#endif
2550
2551  //! store picture parameter set and take ownership of it
2552  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
2553  //! get pointer to existing picture parameter set 
2554  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
2555  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
2556#if Q0078_ADD_LAYER_SETS
2557  Void     removePPS(Int ppsId) { m_ppsMap.removePS(ppsId); };
2558#endif
2559
2560  //! activate a SPS from a active parameter sets SEI message
2561  //! \returns true, if activation is successful
2562  Bool activateSPSWithSEI(Int SPSId);
2563
2564  //! activate a PPS and depending on isIDR parameter also SPS and VPS
2565  //! \returns true, if activation is successful
2566  Bool activatePPS(Int ppsId, Bool isIRAP);
2567
2568  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
2569  TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
2570  TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
2571
2572protected:
2573
2574#if SVC_EXTENSION
2575  static ParameterSetMap<TComVPS> m_vpsMap;
2576#else
2577  ParameterSetMap<TComVPS> m_vpsMap;
2578#endif
2579  ParameterSetMap<TComSPS> m_spsMap; 
2580  ParameterSetMap<TComPPS> m_ppsMap;
2581
2582#if SVC_EXTENSION
2583  static Int m_activeVPSId;
2584#else
2585  Int m_activeVPSId;
2586#endif
2587  Int m_activeSPSId;
2588  Int m_activePPSId;
2589};
2590
2591//! \}
2592
2593#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.