source: SHVCSoftware/branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.h @ 449

Last change on this file since 449 was 448, checked in by seregin, 12 years ago

remove SCALED_REF_LAYER_OFFSETS macro

  • Property svn:eol-style set to native
File size: 105.3 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-2013, 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  Void  destroy ();
143
144
145  TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
146  Int getNumberOfReferencePictureSets();
147  Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
148};
149
150/// SCALING_LIST class
151class TComScalingList
152{
153public:
154  TComScalingList();
155  virtual ~TComScalingList();
156  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
157  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
158
159#if IL_SL_SIGNALLING_N0371
160  UInt     m_layerId;
161
162  Void     setPredScalingListFlag    (Bool b)                               { m_predScalingListFlag = b;    }
163  Bool     getPredScalingListFlag    ()                                     { return m_predScalingListFlag; }
164  Void     setScalingListRefLayerId  (UInt b)                               { m_scalingListRefLayerId = b;  }
165  UInt     getScalingListRefLayerId  ()                                     { return m_scalingListRefLayerId; }
166#endif
167
168  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
169  Bool     checkPredMode                  (UInt sizeId, UInt listId);
170  Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
171  UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
172  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
173
174#if IL_SL_SIGNALLING_N0371
175  Void     processDefaultMarix            (UInt sizeId, UInt listId, UInt layerId );
176#else
177  Void     processDefaultMarix            (UInt sizeId, UInt listId);
178#endif
179
180  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
181
182  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
183
184#if IL_SL_SIGNALLING_N0371
185  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
186  UInt     getLayerId() { return m_layerId; }
187  Void     checkDcOfMatrix                ( UInt m_layerId );
188#else
189  Void     checkDcOfMatrix                ();
190#endif
191
192  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
193  Bool     xParseScalingList              (Char* pchFile);
194
195private:
196  Void     init                    ();
197  Void     destroy                 ();
198  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
199  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
200  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
201  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
202
203#if IL_SL_SIGNALLING_N0371
204  Bool     m_predScalingListFlag;                                                   //!< flag for inter-layer scaling-list prediction
205  UInt     m_scalingListRefLayerId;                                                 //!< scaling_list_ref_layer_id 
206#endif
207
208  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
209  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix                                           
210};
211
212class ProfileTierLevel
213{
214  Int     m_profileSpace;
215  Bool    m_tierFlag;
216  Int     m_profileIdc;
217  Bool    m_profileCompatibilityFlag[32];
218  Int     m_levelIdc;
219
220  Bool m_progressiveSourceFlag;
221  Bool m_interlacedSourceFlag;
222  Bool m_nonPackedConstraintFlag;
223  Bool m_frameOnlyConstraintFlag;
224 
225public:
226  ProfileTierLevel();
227
228  Int   getProfileSpace() const   { return m_profileSpace; }
229  Void  setProfileSpace(Int x)    { m_profileSpace = x; }
230
231  Bool  getTierFlag()     const   { return m_tierFlag; }
232  Void  setTierFlag(Bool x)       { m_tierFlag = x; }
233
234  Int   getProfileIdc()   const   { return m_profileIdc; }
235  Void  setProfileIdc(Int x)      { m_profileIdc = x; }
236
237  Bool  getProfileCompatibilityFlag(Int i) const    { return m_profileCompatibilityFlag[i]; }
238  Void  setProfileCompatibilityFlag(Int i, Bool x)  { m_profileCompatibilityFlag[i] = x; }
239
240  Int   getLevelIdc()   const   { return m_levelIdc; }
241  Void  setLevelIdc(Int x)      { m_levelIdc = x; }
242 
243  Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
244  Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
245 
246  Bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag; }
247  Void setInterlacedSourceFlag(Bool b) { m_interlacedSourceFlag = b; }
248 
249  Bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; }
250  Void setNonPackedConstraintFlag(Bool b) { m_nonPackedConstraintFlag = b; }
251 
252  Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
253  Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
254#if VPS_EXTN_PROFILE_INFO
255  Void copyProfileInfo(ProfileTierLevel *ptl);
256#endif
257};
258
259
260class TComPTL
261{
262  ProfileTierLevel m_generalPTL;
263  ProfileTierLevel m_subLayerPTL[6];      // max. value of max_sub_layers_minus1 is 6
264  Bool m_subLayerProfilePresentFlag[6];
265  Bool m_subLayerLevelPresentFlag[6];
266
267public:
268  TComPTL();
269  Bool getSubLayerProfilePresentFlag(Int i) const { return m_subLayerProfilePresentFlag[i]; }
270  Void setSubLayerProfilePresentFlag(Int i, Bool x) { m_subLayerProfilePresentFlag[i] = x; }
271 
272  Bool getSubLayerLevelPresentFlag(Int i) const { return m_subLayerLevelPresentFlag[i]; }
273  Void setSubLayerLevelPresentFlag(Int i, Bool x) { m_subLayerLevelPresentFlag[i] = x; }
274
275  ProfileTierLevel* getGeneralPTL()  { return &m_generalPTL; }
276  ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i]; }
277#if VPS_EXTN_PROFILE_INFO
278  Void copyProfileInfo(TComPTL *ptl);
279#endif
280};
281/// VPS class
282
283struct HrdSubLayerInfo
284{
285  Bool fixedPicRateFlag;
286  Bool fixedPicRateWithinCvsFlag;
287  UInt picDurationInTcMinus1;
288  Bool lowDelayHrdFlag;
289  UInt cpbCntMinus1;
290  UInt bitRateValueMinus1[MAX_CPB_CNT][2];
291  UInt cpbSizeValue      [MAX_CPB_CNT][2];
292  UInt ducpbSizeValue    [MAX_CPB_CNT][2];
293  UInt cbrFlag           [MAX_CPB_CNT][2];
294  UInt duBitRateValue    [MAX_CPB_CNT][2];
295};
296
297class TComHRD
298{
299private:
300  Bool m_nalHrdParametersPresentFlag;
301  Bool m_vclHrdParametersPresentFlag;
302  Bool m_subPicCpbParamsPresentFlag;
303  UInt m_tickDivisorMinus2;
304  UInt m_duCpbRemovalDelayLengthMinus1;
305  Bool m_subPicCpbParamsInPicTimingSEIFlag;
306  UInt m_dpbOutputDelayDuLengthMinus1;
307  UInt m_bitRateScale;
308  UInt m_cpbSizeScale;
309  UInt m_ducpbSizeScale;
310  UInt m_initialCpbRemovalDelayLengthMinus1;
311  UInt m_cpbRemovalDelayLengthMinus1;
312  UInt m_dpbOutputDelayLengthMinus1;
313  UInt m_numDU;
314  HrdSubLayerInfo m_HRD[MAX_TLAYER];
315
316public:
317  TComHRD()
318  :m_nalHrdParametersPresentFlag(0)
319  ,m_vclHrdParametersPresentFlag(0)
320  ,m_subPicCpbParamsPresentFlag(false)
321  ,m_tickDivisorMinus2(0)
322  ,m_duCpbRemovalDelayLengthMinus1(0)
323  ,m_subPicCpbParamsInPicTimingSEIFlag(false)
324  ,m_dpbOutputDelayDuLengthMinus1(0)
325  ,m_bitRateScale(0)
326  ,m_cpbSizeScale(0)
327  ,m_initialCpbRemovalDelayLengthMinus1(0)
328  ,m_cpbRemovalDelayLengthMinus1(0)
329  ,m_dpbOutputDelayLengthMinus1(0)
330  {}
331
332  virtual ~TComHRD() {}
333
334  Void setNalHrdParametersPresentFlag       ( Bool flag )  { m_nalHrdParametersPresentFlag = flag;         }
335  Bool getNalHrdParametersPresentFlag       ( )            { return m_nalHrdParametersPresentFlag;         }
336
337  Void setVclHrdParametersPresentFlag       ( Bool flag )  { m_vclHrdParametersPresentFlag = flag;         }
338  Bool getVclHrdParametersPresentFlag       ( )            { return m_vclHrdParametersPresentFlag;         }
339
340  Void setSubPicCpbParamsPresentFlag        ( Bool flag )  { m_subPicCpbParamsPresentFlag = flag;          }
341  Bool getSubPicCpbParamsPresentFlag        ( )            { return m_subPicCpbParamsPresentFlag;          }
342 
343  Void setTickDivisorMinus2                 ( UInt value ) { m_tickDivisorMinus2 = value;                  }
344  UInt getTickDivisorMinus2                 ( )            { return m_tickDivisorMinus2;                   }
345
346  Void setDuCpbRemovalDelayLengthMinus1     ( UInt value ) { m_duCpbRemovalDelayLengthMinus1 = value;      }
347  UInt getDuCpbRemovalDelayLengthMinus1     ( )            { return m_duCpbRemovalDelayLengthMinus1;       }
348
349  Void setSubPicCpbParamsInPicTimingSEIFlag ( Bool flag)   { m_subPicCpbParamsInPicTimingSEIFlag = flag;   }
350  Bool getSubPicCpbParamsInPicTimingSEIFlag ()             { return m_subPicCpbParamsInPicTimingSEIFlag;   }
351
352  Void setDpbOutputDelayDuLengthMinus1      (UInt value )  { m_dpbOutputDelayDuLengthMinus1 = value;       }
353  UInt getDpbOutputDelayDuLengthMinus1      ()             { return m_dpbOutputDelayDuLengthMinus1;        }
354
355  Void setBitRateScale                      ( UInt value ) { m_bitRateScale = value;                       }
356  UInt getBitRateScale                      ( )            { return m_bitRateScale;                        }
357
358  Void setCpbSizeScale                      ( UInt value ) { m_cpbSizeScale = value;                       }
359  UInt getCpbSizeScale                      ( )            { return m_cpbSizeScale;                        }
360  Void setDuCpbSizeScale                    ( UInt value ) { m_ducpbSizeScale = value;                     }
361  UInt getDuCpbSizeScale                    ( )            { return m_ducpbSizeScale;                      }
362
363  Void setInitialCpbRemovalDelayLengthMinus1( UInt value ) { m_initialCpbRemovalDelayLengthMinus1 = value; }
364  UInt getInitialCpbRemovalDelayLengthMinus1( )            { return m_initialCpbRemovalDelayLengthMinus1;  }
365
366  Void setCpbRemovalDelayLengthMinus1       ( UInt value ) { m_cpbRemovalDelayLengthMinus1 = value;        }
367  UInt getCpbRemovalDelayLengthMinus1       ( )            { return m_cpbRemovalDelayLengthMinus1;         }
368
369  Void setDpbOutputDelayLengthMinus1        ( UInt value ) { m_dpbOutputDelayLengthMinus1 = value;         }
370  UInt getDpbOutputDelayLengthMinus1        ( )            { return m_dpbOutputDelayLengthMinus1;          }
371
372  Void setFixedPicRateFlag       ( Int layer, Bool flag )  { m_HRD[layer].fixedPicRateFlag = flag;         }
373  Bool getFixedPicRateFlag       ( Int layer            )  { return m_HRD[layer].fixedPicRateFlag;         }
374
375  Void setFixedPicRateWithinCvsFlag       ( Int layer, Bool flag )  { m_HRD[layer].fixedPicRateWithinCvsFlag = flag;         }
376  Bool getFixedPicRateWithinCvsFlag       ( Int layer            )  { return m_HRD[layer].fixedPicRateWithinCvsFlag;         }
377
378  Void setPicDurationInTcMinus1  ( Int layer, UInt value ) { m_HRD[layer].picDurationInTcMinus1 = value;   }
379  UInt getPicDurationInTcMinus1  ( Int layer             ) { return m_HRD[layer].picDurationInTcMinus1;    }
380
381  Void setLowDelayHrdFlag        ( Int layer, Bool flag )  { m_HRD[layer].lowDelayHrdFlag = flag;          }
382  Bool getLowDelayHrdFlag        ( Int layer            )  { return m_HRD[layer].lowDelayHrdFlag;          }
383
384  Void setCpbCntMinus1           ( Int layer, UInt value ) { m_HRD[layer].cpbCntMinus1 = value; }
385  UInt getCpbCntMinus1           ( Int layer            )  { return m_HRD[layer].cpbCntMinus1; }
386
387  Void setBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; }
388  UInt getBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];  }
389
390  Void setCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value;       }
391  UInt getCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl];        }
392  Void setDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;       }
393  UInt getDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];        }
394  Void setDuBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;       }
395  UInt getDuBitRateValueMinus1     (Int layer, Int cpbcnt, Int nalOrVcl )              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];        }
396  Void setCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
397  Bool getCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
398
399  Void setNumDU                              ( UInt value ) { m_numDU = value;                            }
400  UInt getNumDU                              ( )            { return m_numDU;          }
401  Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
402};
403
404class TimingInfo
405{
406  Bool m_timingInfoPresentFlag;
407  UInt m_numUnitsInTick;
408  UInt m_timeScale;
409  Bool m_pocProportionalToTimingFlag;
410  Int  m_numTicksPocDiffOneMinus1;
411public:
412  TimingInfo()
413  : m_timingInfoPresentFlag(false)
414  , m_numUnitsInTick(1001)
415  , m_timeScale(60000)
416  , m_pocProportionalToTimingFlag(false)
417  , m_numTicksPocDiffOneMinus1(0) {}
418
419  Void setTimingInfoPresentFlag             ( Bool flag )  { m_timingInfoPresentFlag = flag;               }
420  Bool getTimingInfoPresentFlag             ( )            { return m_timingInfoPresentFlag;               }
421
422  Void setNumUnitsInTick                    ( UInt value ) { m_numUnitsInTick = value;                     }
423  UInt getNumUnitsInTick                    ( )            { return m_numUnitsInTick;                      }
424
425  Void setTimeScale                         ( UInt value ) { m_timeScale = value;                          }
426  UInt getTimeScale                         ( )            { return m_timeScale;                           }
427 
428  Bool getPocProportionalToTimingFlag       ( )            { return m_pocProportionalToTimingFlag;         }
429  Void setPocProportionalToTimingFlag       (Bool x      ) { m_pocProportionalToTimingFlag = x;            }
430 
431  Int  getNumTicksPocDiffOneMinus1          ( )            { return m_numTicksPocDiffOneMinus1;            }
432  Void setNumTicksPocDiffOneMinus1          (Int x       ) { m_numTicksPocDiffOneMinus1 = x;               }
433};
434
435#if REPN_FORMAT_IN_VPS
436class RepFormat
437{
438  Int  m_chromaFormatVpsIdc;
439  Bool m_separateColourPlaneVpsFlag;
440  Int  m_picWidthVpsInLumaSamples;
441  Int  m_picHeightVpsInLumaSamples;
442  Int  m_bitDepthVpsLuma;               // coded as minus8
443  Int  m_bitDepthVpsChroma;             // coded as minus8
444
445public:
446  RepFormat();
447
448  Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
449  Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
450
451  Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
452  Void setSeparateColourPlaneVpsFlag(Bool x)  { m_separateColourPlaneVpsFlag = x;    }
453
454  Int  getPicWidthVpsInLumaSamples()        { return m_picWidthVpsInLumaSamples; }
455  Void setPicWidthVpsInLumaSamples(Int x)   { m_picWidthVpsInLumaSamples = x;    }
456
457  Int  getPicHeightVpsInLumaSamples()        { return m_picHeightVpsInLumaSamples; }
458  Void setPicHeightVpsInLumaSamples(Int x)   { m_picHeightVpsInLumaSamples = x;    }
459
460  Int  getBitDepthVpsLuma()           { return m_bitDepthVpsLuma;   }
461  Void setBitDepthVpsLuma(Int x)      { m_bitDepthVpsLuma = x;      }
462
463  Int  getBitDepthVpsChroma()           { return m_bitDepthVpsChroma;   }
464  Void setBitDepthVpsChroma(Int x)      { m_bitDepthVpsChroma = x;      }
465};
466#endif
467class TComVPS
468{
469private:
470  Int         m_VPSId;
471  UInt        m_uiMaxTLayers;
472  UInt        m_uiMaxLayers;
473  Bool        m_bTemporalIdNestingFlag;
474 
475  UInt        m_numReorderPics[MAX_TLAYER];
476  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
477  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)
478
479  UInt        m_numHrdParameters;
480#if !VPS_RENAME
481  UInt        m_maxNuhReservedZeroLayerId;
482#endif
483  TComHRD*    m_hrdParameters;
484  UInt*       m_hrdOpSetIdx;
485  Bool*       m_cprmsPresentFlag;
486#if VPS_RENAME
487  UInt        m_maxLayerId;
488  UInt        m_numLayerSets;
489  Bool        m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
490#else
491  UInt        m_numOpSets;
492  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
493#endif
494#if DERIVE_LAYER_ID_LIST_VARIABLES
495  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
496  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
497#endif
498#if IL_SL_SIGNALLING_N0371
499  Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
500#endif
501#if VPS_EXTN_OFFSET
502  UInt        m_extensionOffset;
503#endif
504  TComPTL     m_pcPTL;
505  TimingInfo  m_timingInfo;
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 ILP_SSH_SIG
524  Bool       m_ilpSshSignalingEnabledFlag;
525#endif
526#if VPS_EXTN_PROFILE_INFO
527  // Profile-tier-level signalling related
528  Bool       m_profilePresentFlag[MAX_VPS_LAYER_SETS_PLUS1];    // The value with index 0 will not be used.
529  UInt       m_profileLayerSetRef[MAX_VPS_LAYER_SETS_PLUS1];    // The value with index 0 will not be used.
530  std::vector<TComPTL>    m_pcPTLForExtn; 
531#endif
532#if VPS_EXTN_OP_LAYER_SETS
533  // .. More declarations here
534  // Target output layer signalling related
535  UInt       m_numOutputLayerSets;
536  UInt       m_outputLayerSetIdx[MAX_VPS_LAYER_SETS_PLUS1];
537  Bool       m_outputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
538#endif
539#if VPS_EXTN_DIRECT_REF_LAYERS
540  Bool       m_directDependencyFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
541  UInt       m_numDirectRefLayers[MAX_VPS_LAYER_ID_PLUS1];
542  UInt       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
543#if M0457_PREDICTION_INDICATIONS
544  UInt       m_directDepTypeLen;
545  UInt       m_directDependencyType[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
546#endif
547#endif
548#if VPS_PROFILE_OUTPUT_LAYERS
549  UInt       m_numProfileTierLevel;
550  Bool       m_moreOutputLayerSetsThanDefaultFlag;
551  Int        m_numAddOutputLayerSets;
552  Bool       m_defaultOneTargetOutputLayerFlag;
553  Int        m_profileLevelTierIdx[64];     
554#endif
555#if JCTVC_M0458_INTERLAYER_RPS_SIG
556  Bool       m_maxOneActiveRefLayerFlag;
557#endif
558#if N0147_IRAP_ALIGN_FLAG
559  Bool       m_crossLayerIrapAlignFlag;
560#endif
561#if JCTVC_M0203_INTERLAYER_PRED_IDC
562  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
563#endif
564#if N0120_MAX_TID_REF_PRESENT_FLAG
565  Bool       m_maxTidRefPresentFlag;
566#endif
567#if M0040_ADAPTIVE_RESOLUTION_CHANGE
568  Bool       m_singleLayerForNonIrapFlag;
569#endif
570#if TILE_BOUNDARY_ALIGNED_FLAG
571  Bool       m_tileBoundariesAlignedFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
572#endif
573#if N0160_VUI_EXT_ILP_REF   
574  Bool        m_numIlpRestrictedRefLayers;
575  Int         m_minSpatialSegmentOffsetPlus1[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
576  Bool        m_ctuBasedOffsetEnabledFlag   [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
577  Int         m_minHorizontalCtuOffsetPlus1 [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
578#endif
579#if VPS_VUI_BITRATE_PICRATE
580  Bool        m_bitRatePresentVpsFlag;
581  Bool        m_picRatePresentVpsFlag;
582  Bool        m_bitRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
583  Bool        m_picRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
584  Int         m_avgBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
585  Int         m_maxBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
586  Int         m_constPicRateIdc     [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
587  Int         m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
588#endif
589#if REPN_FORMAT_IN_VPS
590  Bool       m_repFormatIdxPresentFlag;
591  Int        m_vpsNumRepFormats;            // coded as minus1
592  RepFormat  m_vpsRepFormat[16];
593  Int        m_vpsRepFormatIdx[16];
594#endif
595#if VIEW_ID_RELATED_SIGNALING
596  Int         m_viewIdLenMinus1;
597  Int         m_viewIdVal                [MAX_LAYERS];
598#endif
599public:
600  TComVPS();
601  virtual ~TComVPS();
602
603  Void    createHrdParamBuffer()
604  {
605    m_hrdParameters    = new TComHRD[ getNumHrdParameters() ];
606    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
607    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
608  }
609
610  TComHRD* getHrdParameters   ( UInt i )             { return &m_hrdParameters[ i ]; }
611  UInt    getHrdOpSetIdx      ( UInt i )             { return m_hrdOpSetIdx[ i ]; }
612  Void    setHrdOpSetIdx      ( UInt val, UInt i )   { m_hrdOpSetIdx[ i ] = val;  }
613  Bool    getCprmsPresentFlag ( UInt i )             { return m_cprmsPresentFlag[ i ]; }
614  Void    setCprmsPresentFlag ( Bool val, UInt i )   { m_cprmsPresentFlag[ i ] = val;  }
615
616  Int     getVPSId       ()                   { return m_VPSId;          }
617  Void    setVPSId       (Int i)              { m_VPSId = i;             }
618
619  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
620  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
621 
622  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
623  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
624
625  Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
626  Void    setTemporalNestingFlag   (Bool t)   { m_bTemporalIdNestingFlag = t; }
627 
628  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
629  UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
630 
631  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[tLayer] = v;    }
632  UInt    getMaxDecPicBuffering(UInt tLayer)                    { return m_uiMaxDecPicBuffering[tLayer]; }
633 
634  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;    }
635  UInt    getMaxLatencyIncrease(UInt tLayer)                    { return m_uiMaxLatencyIncrease[tLayer]; }
636
637  UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
638  Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
639
640#if VPS_RENAME
641  UInt    getMaxLayerId()                                       { return m_maxLayerId; }
642  Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
643
644  UInt    getNumLayerSets()                                     { return m_numLayerSets; }
645  Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
646#else
647  UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
648  Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
649
650  UInt    getMaxOpSets()                                        { return m_numOpSets; }
651  Void    setMaxOpSets(UInt v)                                  { m_numOpSets = v;    }
652#endif
653  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
654  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
655#if DERIVE_LAYER_ID_LIST_VARIABLES
656  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
657  Void    setLayerSetLayerIdList(Int set, Int layerId, Int x)   { m_layerSetLayerIdList[set][layerId] = x   ; }
658
659  Int     getNumLayersInIdList(Int set)                          { return m_numLayerInIdList[set]; }
660  Void    setNumLayersInIdList(Int set, Int x)                   { m_numLayerInIdList[set] = x   ; }
661
662  Void    deriveLayerIdListVariables();
663#endif
664
665#if IL_SL_SIGNALLING_N0371
666  Bool    checkLayerDependency(UInt i, UInt j);
667  Bool    getScalingListLayerDependency  ( UInt layerId, UInt refLayerId )            { return m_scalingListLayerDependency[layerId][refLayerId]; }
668  Void    setScalingListLayerDependency  ( UInt layerId, UInt refLayerId, Bool val  ) { m_scalingListLayerDependency[layerId][refLayerId] = val;  }
669#endif
670
671  TComPTL* getPTL() { return &m_pcPTL; }
672  TimingInfo* getTimingInfo() { return &m_timingInfo; }
673#if VPS_EXTN_MASK_AND_DIM_INFO
674  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
675  Void   setAvcBaseLayerFlag(Bool x)                            { m_avcBaseLayerFlag = x;          }
676
677  Bool   getSplittingFlag()                                     { return m_splittingFlag;          }
678  Void   setSplittingFlag(Bool x)                               { m_splittingFlag = x;             }
679
680  Bool   getScalabilityMask(Int id)                             { return m_scalabilityMask[id];    }
681  Void   setScalabilityMask(Int id, Bool x)                     { m_scalabilityMask[id] = x;       }
682
683  UInt   getDimensionIdLen(Int id)                              { return m_dimensionIdLen[id];     }
684  Void   setDimensionIdLen(Int id, UInt x)                      { m_dimensionIdLen[id] = x;        }
685
686  Bool   getNuhLayerIdPresentFlag()                             { return m_nuhLayerIdPresentFlag;  }
687  Void   setNuhLayerIdPresentFlag(Bool x)                       { m_nuhLayerIdPresentFlag = x;     }
688
689  UInt   getLayerIdInNuh(Int id)                                { return m_layerIdInNuh[id];       }
690  Void   setLayerIdInNuh(Int id, UInt x)                        { m_layerIdInNuh[id] = x;          }
691
692  UInt   getDimensionId(Int lyrId, Int id)                      { return m_dimensionId[lyrId][id]; }
693  Void   setDimensionId(Int lyrId, Int id, UInt x)              { m_dimensionId[lyrId][id] = x;    }
694
695  UInt   getNumScalabilityTypes()                               { return m_numScalabilityTypes;    }
696  Void   setNumScalabilityTypes(UInt x)                         { m_numScalabilityTypes = x;       }
697
698  UInt   getLayerIdInVps(Int id)                                { return m_layerIdInVps[id];       }
699  Void   setLayerIdInVps(Int id, UInt x)                        { m_layerIdInVps[id] = x;          }
700#endif
701#if ILP_SSH_SIG
702    Bool   getIlpSshSignalingEnabledFlag()                      { return m_ilpSshSignalingEnabledFlag;}
703    Void   setIlpSshSignalingEnabledFlag(Bool x)                { m_ilpSshSignalingEnabledFlag = x;}
704#endif
705#if VPS_EXTN_PROFILE_INFO
706  Bool   getProfilePresentFlag(Int id)                          { return m_profilePresentFlag[id]; }
707  Void   setProfilePresentFlag(Int id, Bool x)                  { m_profilePresentFlag[id] = x;    }
708
709  UInt   getProfileLayerSetRef(Int id)                          { return m_profileLayerSetRef[id]; }
710  Void   setProfileLayerSetRef(Int id, Bool x)                  { m_profileLayerSetRef[id] = x;    }
711
712  std::vector<TComPTL>* getPTLForExtnPtr()                      { return &m_pcPTLForExtn;          }
713  TComPTL* getPTLForExtn(Int id)                                { return &m_pcPTLForExtn[id];      }
714#endif
715#if VPS_EXTN_OP_LAYER_SETS
716  // Target output layer signalling related
717  UInt   getNumOutputLayerSets()                                { return m_numOutputLayerSets;     } 
718  Void   setNumOutputLayerSets(Int x)                           { m_numOutputLayerSets = x;        }
719 
720  UInt   getOutputLayerSetIdx(Int idx)                          { return m_outputLayerSetIdx[idx]; }
721  Void   setOutputLayerSetIdx(Int idx, UInt x)                  { m_outputLayerSetIdx[idx] = x;    }
722
723  Bool   getOutputLayerFlag(Int layerSet, Int layerId)          { return m_outputLayerFlag[layerSet][layerId]; }
724  Void   setOutputLayerFlag(Int layerSet, Int layerId, Bool x)  { m_outputLayerFlag[layerSet][layerId] = x;    }
725#endif
726#if VPS_EXTN_DIRECT_REF_LAYERS
727  // Direct dependency of layers
728  Bool   getDirectDependencyFlag(Int currLayerId, Int refLayerId)               { return m_directDependencyFlag[currLayerId][refLayerId]; }
729  Void   setDirectDependencyFlag(Int currLayerId, Int refLayerId, Bool x)       { m_directDependencyFlag[currLayerId][refLayerId] = x;    }
730 
731  UInt   getNumDirectRefLayers(Int layerId)                                     { return m_numDirectRefLayers[layerId];                   }
732  Void   setNumDirectRefLayers(Int layerId, UInt refLayerNum)                   { m_numDirectRefLayers[layerId] = refLayerNum;            }
733
734  UInt   getRefLayerId(Int layerId, Int refLayerIdx)                            { return m_refLayerId[layerId][refLayerIdx];              }
735  Void   setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId)           { m_refLayerId[layerId][refLayerIdx] = refLayerId;        }
736
737#if M0457_PREDICTION_INDICATIONS
738  UInt   getDirectDepTypeLen()                                                  { return m_directDepTypeLen;                              }
739  Void   setDirectDepTypeLen(UInt x)                                            { m_directDepTypeLen = x;                                 }
740
741  UInt   getDirectDependencyType(Int currLayerId, Int refLayerId)               { return m_directDependencyType[currLayerId][refLayerId]; }
742  Void   setDirectDependencyType(Int currLayerId, Int refLayerId, UInt x)       { m_directDependencyType[currLayerId][refLayerId] = x;    }
743#endif
744#endif
745#if VPS_PROFILE_OUTPUT_LAYERS
746  UInt   getNumProfileTierLevel()                                { return m_numProfileTierLevel; }
747  Void   setNumProfileTierLevel(Int x)                           { m_numProfileTierLevel = x;    }
748
749  Bool   getMoreOutputLayerSetsThanDefaultFlag()                 { return m_moreOutputLayerSetsThanDefaultFlag;}
750  Void   setMoreOutputLayerSetsThanDefaultFlag(Bool x)           { m_moreOutputLayerSetsThanDefaultFlag = x   ;}
751
752  Int    getNumAddOutputLayerSets()                              { return m_numAddOutputLayerSets; }
753  Void   setNumAddOutputLayerSets(Int x)                         { m_numAddOutputLayerSets = x   ; }
754
755  Bool   getDefaultOneTargetOutputLayerFlag()                 { return m_defaultOneTargetOutputLayerFlag;}
756  Void   setDefaultOneTargetOutputLayerFlag(Bool x)           { m_defaultOneTargetOutputLayerFlag= x    ;}
757
758  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
759  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
760#endif
761#if JCTVC_M0458_INTERLAYER_RPS_SIG
762  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
763  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
764#endif
765#if N0147_IRAP_ALIGN_FLAG
766  Bool   getCrossLayerIrapAlignFlag()                                           { return m_crossLayerIrapAlignFlag;                      }
767  Void   setCrossLayerIrapAlignFlag(Bool x)                                     { m_crossLayerIrapAlignFlag = x;                         }
768#endif
769#if JCTVC_M0203_INTERLAYER_PRED_IDC
770  UInt   getMaxTidIlRefPicsPlus1(Int layerId)                     { return m_maxTidIlRefPicsPlus1[layerId];                   }
771  Void   setMaxTidIlRefPicsPlus1(Int layerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId] = maxSublayer;            }
772#endif
773#if N0120_MAX_TID_REF_PRESENT_FLAG
774  Bool   getMaxTidRefPresentFlag()                                  { return m_maxTidRefPresentFlag ;}
775  Void   setMaxTidRefPresentFlag(Bool x)                            { m_maxTidRefPresentFlag = x;}
776#endif
777#if M0040_ADAPTIVE_RESOLUTION_CHANGE
778  Bool   getSingleLayerForNonIrapFlag()                             { return m_singleLayerForNonIrapFlag; }
779  Void   setSingleLayerForNonIrapFlag(Bool x)                       { m_singleLayerForNonIrapFlag = x;    }
780#endif
781#if TILE_BOUNDARY_ALIGNED_FLAG 
782  Bool   getTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId)           { return m_tileBoundariesAlignedFlag[currLayerId][refLayerId]; }
783  Void   setTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId, Bool x)   { m_tileBoundariesAlignedFlag[currLayerId][refLayerId] = x; } 
784#endif
785#if N0160_VUI_EXT_ILP_REF 
786  Bool  getNumIlpRestrictedRefLayers   ( )                                         { return m_numIlpRestrictedRefLayers        ;}
787  Void  setNumIlpRestrictedRefLayers   ( Int val )                                 { m_numIlpRestrictedRefLayers         = val;}
788 
789  Int  getMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId )          { return m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId];}
790  Void setMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId, Int val ) { m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId] = val;}
791 
792  Bool getCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId )            { return m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId];}
793  Void setCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId, Bool flag ) { m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId] = flag;}
794 
795  Int  getMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId )            { return m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId];}
796  Void setMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId, Int val )   { m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId] = val;} 
797#endif
798#if VPS_VUI_BITRATE_PICRATE
799  Bool getBitRatePresentVpsFlag()       { return m_bitRatePresentVpsFlag; }
800  Void setBitRatePresentVpsFlag(Bool x) { m_bitRatePresentVpsFlag = x;    }
801  Bool getPicRatePresentVpsFlag()       { return m_picRatePresentVpsFlag; }
802  Void setPicRatePresentVpsFlag(Bool x) { m_picRatePresentVpsFlag = x;    }
803
804  Bool getBitRatePresentFlag(Int i, Int j)          { return m_bitRatePresentFlag[i][j]; }
805  Void setBitRatePresentFlag(Int i, Int j, Bool x)  { m_bitRatePresentFlag[i][j] = x;    }
806  Bool getPicRatePresentFlag(Int i, Int j)          { return m_picRatePresentFlag[i][j]; }
807  Void setPicRatePresentFlag(Int i, Int j, Bool x)  { m_picRatePresentFlag[i][j] = x;    }
808 
809  Int  getAvgBitRate(Int i, Int j)          { return m_avgBitRate[i][j]; }
810  Void setAvgBitRate(Int i, Int j, Int x)   { m_avgBitRate[i][j] = x;    }
811  Int  getMaxBitRate(Int i, Int j)          { return m_maxBitRate[i][j]; }
812  Void setMaxBitRate(Int i, Int j, Int x)   { m_maxBitRate[i][j] = x;    }
813 
814  Int  getConstPicRateIdc(Int i, Int j)          { return m_constPicRateIdc[i][j]; }
815  Void setConstPicRateIdc(Int i, Int j, Int x)   { m_constPicRateIdc[i][j] = x;    }
816  Int  getAvgPicRate(Int i, Int j)          { return m_avgPicRate[i][j]; }
817  Void setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
818#endif
819
820#if REPN_FORMAT_IN_VPS
821  Bool   getRepFormatIdxPresentFlag()       { return m_repFormatIdxPresentFlag; }
822  Void   setRepFormatIdxPresentFlag(Bool x) { m_repFormatIdxPresentFlag = x;    }
823
824  Int    getVpsNumRepFormats()              { return m_vpsNumRepFormats;        }
825  Void   setVpsNumRepFormats(Int x)         { m_vpsNumRepFormats = x;           }
826
827  RepFormat* getVpsRepFormat(Int idx)       { return &m_vpsRepFormat[idx];      }
828
829  Int    getVpsRepFormatIdx(Int idx)        { return m_vpsRepFormatIdx[idx];   }
830  Void   setVpsRepFormatIdx(Int idx, Int x) { m_vpsRepFormatIdx[idx] = x;      }         
831#endif
832#if VIEW_ID_RELATED_SIGNALING
833  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; } 
834  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; } 
835
836  Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; } 
837  Int     getViewIdVal( Int viewOrderIndex )                               { return m_viewIdVal[viewOrderIndex]; } 
838  Int     getScalabilityId(Int, ScalabilityType scalType );
839
840  Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
841
842  Int     getNumViews();
843  Int     scalTypeToScalIdx( ScalabilityType scalType );
844#endif
845#if VPS_EXTN_OFFSET
846  Int     getExtensionOffset()                 { return m_extensionOffset;   }
847  Void    setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
848#endif
849};
850
851class Window
852{
853private:
854  Bool          m_enabledFlag;
855  Int           m_winLeftOffset;
856  Int           m_winRightOffset;
857  Int           m_winTopOffset;
858  Int           m_winBottomOffset;
859public:
860  Window()
861  : m_enabledFlag (false)
862  , m_winLeftOffset     (0)
863  , m_winRightOffset    (0)
864  , m_winTopOffset      (0)
865  , m_winBottomOffset   (0)
866  { }
867
868  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
869  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; }
870  Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
871  Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
872  Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
873  Void          setWindowRightOffset(Int val)     { m_winRightOffset = val; m_enabledFlag = true; }
874  Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
875  Void          setWindowTopOffset(Int val)       { m_winTopOffset = val; m_enabledFlag = true; }
876  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
877  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
878
879  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
880  {
881    m_enabledFlag       = true;
882    m_winLeftOffset     = offsetLeft;
883    m_winRightOffset    = offsetLRight;
884    m_winTopOffset      = offsetLTop;
885    m_winBottomOffset   = offsetLBottom;
886  }
887};
888
889
890class TComVUI
891{
892private:
893  Bool m_aspectRatioInfoPresentFlag;
894  Int  m_aspectRatioIdc;
895  Int  m_sarWidth;
896  Int  m_sarHeight;
897  Bool m_overscanInfoPresentFlag;
898  Bool m_overscanAppropriateFlag;
899  Bool m_videoSignalTypePresentFlag;
900  Int  m_videoFormat;
901  Bool m_videoFullRangeFlag;
902  Bool m_colourDescriptionPresentFlag;
903  Int  m_colourPrimaries;
904  Int  m_transferCharacteristics;
905  Int  m_matrixCoefficients;
906  Bool m_chromaLocInfoPresentFlag;
907  Int  m_chromaSampleLocTypeTopField;
908  Int  m_chromaSampleLocTypeBottomField;
909  Bool m_neutralChromaIndicationFlag;
910  Bool m_fieldSeqFlag;
911
912  Window m_defaultDisplayWindow;
913  Bool m_frameFieldInfoPresentFlag;
914  Bool m_hrdParametersPresentFlag;
915  Bool m_bitstreamRestrictionFlag;
916  Bool m_tilesFixedStructureFlag;
917  Bool m_motionVectorsOverPicBoundariesFlag;
918  Bool m_restrictedRefPicListsFlag;
919  Int  m_minSpatialSegmentationIdc;
920  Int  m_maxBytesPerPicDenom;
921  Int  m_maxBitsPerMinCuDenom;
922  Int  m_log2MaxMvLengthHorizontal;
923  Int  m_log2MaxMvLengthVertical;
924  TComHRD m_hrdParameters;
925  TimingInfo m_timingInfo;
926
927public:
928  TComVUI()
929    :m_aspectRatioInfoPresentFlag(false)
930    ,m_aspectRatioIdc(0)
931    ,m_sarWidth(0)
932    ,m_sarHeight(0)
933    ,m_overscanInfoPresentFlag(false)
934    ,m_overscanAppropriateFlag(false)
935    ,m_videoSignalTypePresentFlag(false)
936    ,m_videoFormat(5)
937    ,m_videoFullRangeFlag(false)
938    ,m_colourDescriptionPresentFlag(false)
939    ,m_colourPrimaries(2)
940    ,m_transferCharacteristics(2)
941    ,m_matrixCoefficients(2)
942    ,m_chromaLocInfoPresentFlag(false)
943    ,m_chromaSampleLocTypeTopField(0)
944    ,m_chromaSampleLocTypeBottomField(0)
945    ,m_neutralChromaIndicationFlag(false)
946    ,m_fieldSeqFlag(false)
947    ,m_frameFieldInfoPresentFlag(false)
948    ,m_hrdParametersPresentFlag(false)
949    ,m_bitstreamRestrictionFlag(false)
950    ,m_tilesFixedStructureFlag(false)
951    ,m_motionVectorsOverPicBoundariesFlag(true)
952    ,m_restrictedRefPicListsFlag(1)
953    ,m_minSpatialSegmentationIdc(0)
954    ,m_maxBytesPerPicDenom(2)
955    ,m_maxBitsPerMinCuDenom(1)
956    ,m_log2MaxMvLengthHorizontal(15)
957    ,m_log2MaxMvLengthVertical(15)
958  {}
959
960  virtual ~TComVUI() {}
961
962  Bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag; }
963  Void setAspectRatioInfoPresentFlag(Bool i) { m_aspectRatioInfoPresentFlag = i; }
964
965  Int getAspectRatioIdc() { return m_aspectRatioIdc; }
966  Void setAspectRatioIdc(Int i) { m_aspectRatioIdc = i; }
967
968  Int getSarWidth() { return m_sarWidth; }
969  Void setSarWidth(Int i) { m_sarWidth = i; }
970
971  Int getSarHeight() { return m_sarHeight; }
972  Void setSarHeight(Int i) { m_sarHeight = i; }
973
974  Bool getOverscanInfoPresentFlag() { return m_overscanInfoPresentFlag; }
975  Void setOverscanInfoPresentFlag(Bool i) { m_overscanInfoPresentFlag = i; }
976
977  Bool getOverscanAppropriateFlag() { return m_overscanAppropriateFlag; }
978  Void setOverscanAppropriateFlag(Bool i) { m_overscanAppropriateFlag = i; }
979
980  Bool getVideoSignalTypePresentFlag() { return m_videoSignalTypePresentFlag; }
981  Void setVideoSignalTypePresentFlag(Bool i) { m_videoSignalTypePresentFlag = i; }
982
983  Int getVideoFormat() { return m_videoFormat; }
984  Void setVideoFormat(Int i) { m_videoFormat = i; }
985
986  Bool getVideoFullRangeFlag() { return m_videoFullRangeFlag; }
987  Void setVideoFullRangeFlag(Bool i) { m_videoFullRangeFlag = i; }
988
989  Bool getColourDescriptionPresentFlag() { return m_colourDescriptionPresentFlag; }
990  Void setColourDescriptionPresentFlag(Bool i) { m_colourDescriptionPresentFlag = i; }
991
992  Int getColourPrimaries() { return m_colourPrimaries; }
993  Void setColourPrimaries(Int i) { m_colourPrimaries = i; }
994
995  Int getTransferCharacteristics() { return m_transferCharacteristics; }
996  Void setTransferCharacteristics(Int i) { m_transferCharacteristics = i; }
997
998  Int getMatrixCoefficients() { return m_matrixCoefficients; }
999  Void setMatrixCoefficients(Int i) { m_matrixCoefficients = i; }
1000
1001  Bool getChromaLocInfoPresentFlag() { return m_chromaLocInfoPresentFlag; }
1002  Void setChromaLocInfoPresentFlag(Bool i) { m_chromaLocInfoPresentFlag = i; }
1003
1004  Int getChromaSampleLocTypeTopField() { return m_chromaSampleLocTypeTopField; }
1005  Void setChromaSampleLocTypeTopField(Int i) { m_chromaSampleLocTypeTopField = i; }
1006
1007  Int getChromaSampleLocTypeBottomField() { return m_chromaSampleLocTypeBottomField; }
1008  Void setChromaSampleLocTypeBottomField(Int i) { m_chromaSampleLocTypeBottomField = i; }
1009
1010  Bool getNeutralChromaIndicationFlag() { return m_neutralChromaIndicationFlag; }
1011  Void setNeutralChromaIndicationFlag(Bool i) { m_neutralChromaIndicationFlag = i; }
1012
1013  Bool getFieldSeqFlag() { return m_fieldSeqFlag; }
1014  Void setFieldSeqFlag(Bool i) { m_fieldSeqFlag = i; }
1015
1016  Bool getFrameFieldInfoPresentFlag() { return m_frameFieldInfoPresentFlag; }
1017  Void setFrameFieldInfoPresentFlag(Bool i) { m_frameFieldInfoPresentFlag = i; }
1018
1019  Window& getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;                }
1020  Void    setDefaultDisplayWindow(Window& defaultDisplayWindow ) { m_defaultDisplayWindow = defaultDisplayWindow; }
1021
1022  Bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; }
1023  Void setHrdParametersPresentFlag(Bool i) { m_hrdParametersPresentFlag = i; }
1024
1025  Bool getBitstreamRestrictionFlag() { return m_bitstreamRestrictionFlag; }
1026  Void setBitstreamRestrictionFlag(Bool i) { m_bitstreamRestrictionFlag = i; }
1027
1028  Bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag; }
1029  Void setTilesFixedStructureFlag(Bool i) { m_tilesFixedStructureFlag = i; }
1030
1031  Bool getMotionVectorsOverPicBoundariesFlag() { return m_motionVectorsOverPicBoundariesFlag; }
1032  Void setMotionVectorsOverPicBoundariesFlag(Bool i) { m_motionVectorsOverPicBoundariesFlag = i; }
1033
1034  Bool getRestrictedRefPicListsFlag() { return m_restrictedRefPicListsFlag; }
1035  Void setRestrictedRefPicListsFlag(Bool b) { m_restrictedRefPicListsFlag = b; }
1036
1037  Int getMinSpatialSegmentationIdc() { return m_minSpatialSegmentationIdc; }
1038  Void setMinSpatialSegmentationIdc(Int i) { m_minSpatialSegmentationIdc = i; }
1039  Int getMaxBytesPerPicDenom() { return m_maxBytesPerPicDenom; }
1040  Void setMaxBytesPerPicDenom(Int i) { m_maxBytesPerPicDenom = i; }
1041
1042  Int getMaxBitsPerMinCuDenom() { return m_maxBitsPerMinCuDenom; }
1043  Void setMaxBitsPerMinCuDenom(Int i) { m_maxBitsPerMinCuDenom = i; }
1044
1045  Int getLog2MaxMvLengthHorizontal() { return m_log2MaxMvLengthHorizontal; }
1046  Void setLog2MaxMvLengthHorizontal(Int i) { m_log2MaxMvLengthHorizontal = i; }
1047
1048  Int getLog2MaxMvLengthVertical() { return m_log2MaxMvLengthVertical; }
1049  Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; }
1050
1051  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
1052  TimingInfo* getTimingInfo() { return &m_timingInfo; }
1053};
1054
1055/// SPS class
1056class TComSPS
1057{
1058private:
1059  Int         m_SPSId;
1060  Int         m_VPSId;
1061  Int         m_chromaFormatIdc;
1062
1063  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
1064
1065  // Structure
1066  UInt        m_picWidthInLumaSamples;
1067  UInt        m_picHeightInLumaSamples;
1068 
1069  Int         m_log2MinCodingBlockSize;
1070  Int         m_log2DiffMaxMinCodingBlockSize;
1071  UInt        m_uiMaxCUWidth;
1072  UInt        m_uiMaxCUHeight;
1073  UInt        m_uiMaxCUDepth;
1074
1075  Window      m_conformanceWindow;
1076
1077  TComRPSList m_RPSList;
1078  Bool        m_bLongTermRefsPresent;
1079  Bool        m_TMVPFlagsPresent;
1080  Int         m_numReorderPics[MAX_TLAYER];
1081 
1082  // Tool list
1083  UInt        m_uiQuadtreeTULog2MaxSize;
1084  UInt        m_uiQuadtreeTULog2MinSize;
1085  UInt        m_uiQuadtreeTUMaxDepthInter;
1086  UInt        m_uiQuadtreeTUMaxDepthIntra;
1087  Bool        m_usePCM;
1088  UInt        m_pcmLog2MaxSize;
1089  UInt        m_uiPCMLog2MinSize;
1090  Bool        m_useAMP;
1091
1092  // Parameter
1093  Int         m_bitDepthY;
1094  Int         m_bitDepthC;
1095  Int         m_qpBDOffsetY;
1096  Int         m_qpBDOffsetC;
1097
1098  Bool        m_useLossless;
1099
1100  UInt        m_uiPCMBitDepthLuma;
1101  UInt        m_uiPCMBitDepthChroma;
1102  Bool        m_bPCMFilterDisableFlag;
1103
1104  UInt        m_uiBitsForPOC;
1105  UInt        m_numLongTermRefPicSPS;
1106  UInt        m_ltRefPicPocLsbSps[33];
1107  Bool        m_usedByCurrPicLtSPSFlag[33];
1108  // Max physical transform size
1109  UInt        m_uiMaxTrSize;
1110 
1111  Int m_iAMPAcc[MAX_CU_DEPTH];
1112  Bool        m_bUseSAO; 
1113
1114  Bool        m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
1115
1116  Bool        m_scalingListEnabledFlag;
1117  Bool        m_scalingListPresentFlag;
1118
1119  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
1120
1121  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
1122  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
1123
1124  Bool        m_useDF;
1125  Bool        m_useStrongIntraSmoothing;
1126
1127  Bool        m_vuiParametersPresentFlag;
1128  TComVUI     m_vuiParameters;
1129
1130  static const Int   m_winUnitX[MAX_CHROMA_FORMAT_IDC+1];
1131  static const Int   m_winUnitY[MAX_CHROMA_FORMAT_IDC+1];
1132  TComPTL     m_pcPTL;
1133
1134#if SVC_EXTENSION
1135#if M0463_VUI_EXT_ILP_REF
1136  Bool        m_interViewMvVertConstraintFlag;
1137  Int         m_numIlpRestrictedRefLayers        ;
1138  Int         m_minSpatialSegmentOffsetPlus1[MAX_LAYERS];
1139  Bool        m_ctuBasedOffsetEnabledFlag   [MAX_LAYERS];
1140  Int         m_minHorizontalCtuOffsetPlus1 [MAX_LAYERS];
1141#endif
1142
1143  UInt m_layerId;
1144
1145#if IL_SL_SIGNALLING_N0371
1146  TComVPS*    m_pVPS;
1147  static TComSPS* m_pcSPS[MAX_LAYERS];
1148  Bool        m_predScalingListFlag;
1149  UInt        m_scalingListRefLayerId;
1150#endif
1151
1152#if REF_IDX_MFM
1153#if !M0457_COL_PICTURE_SIGNALING
1154  Bool m_bMFMEnabledFlag;
1155#endif
1156#endif
1157  UInt        m_numScaledRefLayerOffsets;
1158  Window      m_scaledRefLayerWindow[MAX_LAYERS];
1159#if REPN_FORMAT_IN_VPS
1160  Bool m_updateRepFormatFlag;
1161#endif
1162#endif //SVC_EXTENSION
1163public:
1164  TComSPS();
1165  virtual ~TComSPS();
1166
1167  Int  getVPSId       ()         { return m_VPSId;          }
1168  Void setVPSId       (Int i)    { m_VPSId = i;             }
1169  Int  getSPSId       ()         { return m_SPSId;          }
1170  Void setSPSId       (Int i)    { m_SPSId = i;             }
1171  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
1172  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
1173
1174  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
1175  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
1176 
1177  // structure
1178  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
1179  UInt getPicWidthInLumaSamples       ()         { return  m_picWidthInLumaSamples;    }
1180  Void setPicHeightInLumaSamples      ( UInt u ) { m_picHeightInLumaSamples = u;       }
1181  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
1182
1183  Window& getConformanceWindow()                           { return  m_conformanceWindow;             }
1184  Void    setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
1185
1186  UInt  getNumLongTermRefPicSPS()             { return m_numLongTermRefPicSPS; }
1187  Void  setNumLongTermRefPicSPS(UInt val)     { m_numLongTermRefPicSPS = val; }
1188
1189  UInt  getLtRefPicPocLsbSps(UInt index)             { return m_ltRefPicPocLsbSps[index]; }
1190  Void  setLtRefPicPocLsbSps(UInt index, UInt val)     { m_ltRefPicPocLsbSps[index] = val; }
1191
1192  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
1193  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
1194
1195  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
1196  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
1197  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
1198  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
1199
1200  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
1201  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
1202  Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u;     }
1203  UInt getMaxCUHeight ()         { return  m_uiMaxCUHeight; }
1204  Void setMaxCUDepth  ( UInt u ) { m_uiMaxCUDepth = u;      }
1205  UInt getMaxCUDepth  ()         { return  m_uiMaxCUDepth;  }
1206  Void setUsePCM      ( Bool b ) { m_usePCM = b;           }
1207  Bool getUsePCM      ()         { return m_usePCM;        }
1208  Void setPCMLog2MaxSize  ( UInt u ) { m_pcmLog2MaxSize = u;      }
1209  UInt getPCMLog2MaxSize  ()         { return  m_pcmLog2MaxSize;  }
1210  Void setPCMLog2MinSize  ( UInt u ) { m_uiPCMLog2MinSize = u;      }
1211  UInt getPCMLog2MinSize  ()         { return  m_uiPCMLog2MinSize;  }
1212  Void setBitsForPOC  ( UInt u ) { m_uiBitsForPOC = u;      }
1213  UInt getBitsForPOC  ()         { return m_uiBitsForPOC;   }
1214  Bool getUseAMP() { return m_useAMP; }
1215  Void setUseAMP( Bool b ) { m_useAMP = b; }
1216  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
1217  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
1218  Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u;    }
1219  UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
1220  Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u;    }
1221  Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u;    }
1222  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
1223  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
1224  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
1225  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
1226  Void         createRPSList( Int numRPS );
1227  TComRPSList* getRPSList()                      { return &m_RPSList;          }
1228  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
1229  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
1230  Bool      getTMVPFlagsPresent()         { return m_TMVPFlagsPresent; }
1231  Void      setTMVPFlagsPresent(Bool b)   { m_TMVPFlagsPresent=b;      } 
1232  // physical transform
1233  Void setMaxTrSize   ( UInt u ) { m_uiMaxTrSize = u;       }
1234  UInt getMaxTrSize   ()         { return  m_uiMaxTrSize;   }
1235 
1236  // Tool list
1237  Bool getUseLossless ()         { return m_useLossless; }
1238  Void setUseLossless ( Bool b ) { m_useLossless  = b; }
1239 
1240  // AMP accuracy
1241  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
1242  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
1243
1244  // Bit-depth
1245  Int      getBitDepthY() { return m_bitDepthY; }
1246  Void     setBitDepthY(Int u) { m_bitDepthY = u; }
1247  Int      getBitDepthC() { return m_bitDepthC; }
1248  Void     setBitDepthC(Int u) { m_bitDepthC = u; }
1249  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
1250  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
1251  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
1252  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
1253  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
1254  Bool getUseSAO                  ()           {return m_bUseSAO;}
1255
1256  UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
1257  Void      setMaxTLayers( UInt uiMaxTLayers )        { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
1258
1259  Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
1260  Void      setTemporalIdNestingFlag( Bool bValue )   { m_bTemporalIdNestingFlag = bValue; }
1261  UInt      getPCMBitDepthLuma     ()         { return m_uiPCMBitDepthLuma;     }
1262  Void      setPCMBitDepthLuma     ( UInt u ) { m_uiPCMBitDepthLuma = u;        }
1263  UInt      getPCMBitDepthChroma   ()         { return m_uiPCMBitDepthChroma;   }
1264  Void      setPCMBitDepthChroma   ( UInt u ) { m_uiPCMBitDepthChroma = u;      }
1265  Void      setPCMFilterDisableFlag     ( Bool   bValue  )    { m_bPCMFilterDisableFlag = bValue; }
1266  Bool      getPCMFilterDisableFlag     ()                    { return m_bPCMFilterDisableFlag;   } 
1267
1268  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
1269  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
1270  Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1271  Void setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1272
1273#if IL_SL_SIGNALLING_N0371
1274  Bool getPredScalingListFlag()         { return m_predScalingListFlag;     }
1275  Void setPredScalingListFlag( Bool b ) { m_predScalingListFlag  = b;       }
1276  UInt getScalingListRefLayerId()         { return m_scalingListRefLayerId;   }
1277  Void setScalingListRefLayerId( UInt b ) { m_scalingListRefLayerId  = b;       }
1278
1279  TComVPS*  getVPS()                      { return  m_pVPS; }
1280  Void      setVPS( TComVPS* vps )        { m_pVPS = vps;   }
1281  static   TComSPS* getSPS(UInt layerId)               { return m_pcSPS[layerId]; }
1282  static   Void     setSPS(UInt layerId, TComSPS* sps) { m_pcSPS[layerId] = sps;  }
1283#endif
1284
1285  Void setScalingList      ( TComScalingList *scalingList);
1286  TComScalingList* getScalingList ()       { return m_scalingList; }               //!< get ScalingList class pointer in SPS
1287
1288  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
1289  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
1290  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
1291  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
1292
1293  Void setUseStrongIntraSmoothing (Bool bVal)  {m_useStrongIntraSmoothing = bVal;}
1294  Bool getUseStrongIntraSmoothing ()           {return m_useStrongIntraSmoothing;}
1295
1296  Bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; }
1297  Void setVuiParametersPresentFlag(Bool b) { m_vuiParametersPresentFlag = b; }
1298  TComVUI* getVuiParameters() { return &m_vuiParameters; }
1299  Void setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
1300
1301  TComPTL* getPTL()     { return &m_pcPTL; }
1302
1303#if SVC_EXTENSION
1304#if M0463_VUI_EXT_ILP_REF
1305  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
1306  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
1307
1308  ////  sps_extension_vui_parameters( )
1309  Void setNumIlpRestrictedRefLayers   ( Int val )        { m_numIlpRestrictedRefLayers         = val;}
1310  Int  getNumIlpRestrictedRefLayers   ( )                { return m_numIlpRestrictedRefLayers        ;}
1311
1312  Void setMinSpatialSegmentOffsetPlus1( Int i, Int val ) { m_minSpatialSegmentOffsetPlus1[ i ] = val;}
1313  Int  getMinSpatialSegmentOffsetPlus1( Int i )          { return m_minSpatialSegmentOffsetPlus1[ i ];}
1314
1315  Void setCtuBasedOffsetEnabledFlag   ( Int i, Bool flag ) { m_ctuBasedOffsetEnabledFlag   [ i ] = flag;}
1316  Bool getCtuBasedOffsetEnabledFlag   ( Int i )            { return m_ctuBasedOffsetEnabledFlag   [ i ];}
1317
1318  Void setMinHorizontalCtuOffsetPlus1 ( Int i, Int val )   { m_minHorizontalCtuOffsetPlus1 [ i ] = val;}
1319  Int  getMinHorizontalCtuOffsetPlus1 ( Int i )            { return m_minHorizontalCtuOffsetPlus1 [ i ];}
1320#endif
1321  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
1322  UInt     getLayerId() { return m_layerId; }
1323#if REF_IDX_MFM
1324#if !M0457_COL_PICTURE_SIGNALING
1325  Void     setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;}
1326  Bool     getMFMEnabledFlag()          {return m_bMFMEnabledFlag;}
1327#endif
1328#endif
1329  UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
1330  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
1331  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
1332#if REPN_FORMAT_IN_VPS
1333  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
1334  Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
1335#endif
1336#endif //SVC_EXTENSION
1337};
1338
1339/// Reference Picture Lists class
1340class TComRefPicListModification
1341{
1342private:
1343  UInt      m_bRefPicListModificationFlagL0; 
1344  UInt      m_bRefPicListModificationFlagL1; 
1345  UInt      m_RefPicSetIdxL0[32];
1346  UInt      m_RefPicSetIdxL1[32];
1347   
1348public:
1349  TComRefPicListModification();
1350  virtual ~TComRefPicListModification();
1351 
1352  Void  create                    ();
1353  Void  destroy                   ();
1354
1355  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
1356  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
1357  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
1358  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
1359  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
1360  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
1361  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
1362  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
1363};
1364
1365/// PPS class
1366class TComPPS
1367{
1368private:
1369  Int         m_PPSId;                    // pic_parameter_set_id
1370  Int         m_SPSId;                    // seq_parameter_set_id
1371  Int         m_picInitQPMinus26;
1372  Bool        m_useDQP;
1373  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
1374  Bool        m_bSliceChromaQpFlag;       // slicelevel_chroma_qp_flag
1375
1376  // access channel
1377  TComSPS*    m_pcSPS;
1378  UInt        m_uiMaxCuDQPDepth;
1379  UInt        m_uiMinCuDQPSize;
1380
1381  Int         m_chromaCbQpOffset;
1382  Int         m_chromaCrQpOffset;
1383
1384  UInt        m_numRefIdxL0DefaultActive;
1385  UInt        m_numRefIdxL1DefaultActive;
1386
1387  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
1388  Bool        m_useWeightedBiPred;        // Use of Weighting Bi-Prediction (B_SLICE)
1389  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
1390
1391  Bool        m_TransquantBypassEnableFlag; // Indicates presence of cu_transquant_bypass_flag in CUs.
1392  Bool        m_useTransformSkip;
1393  Bool        m_dependentSliceSegmentsEnabledFlag;     //!< Indicates the presence of dependent slices
1394  Bool        m_tilesEnabledFlag;              //!< Indicates the presence of tiles
1395  Bool        m_entropyCodingSyncEnabledFlag;  //!< Indicates the presence of wavefronts
1396 
1397  Bool     m_loopFilterAcrossTilesEnabledFlag;
1398  Int      m_uniformSpacingFlag;
1399  Int      m_iNumColumnsMinus1;
1400  UInt*    m_puiColumnWidth;
1401  Int      m_iNumRowsMinus1;
1402  UInt*    m_puiRowHeight;
1403
1404  Int      m_iNumSubstreams;
1405
1406  Int      m_signHideFlag;
1407
1408  Bool     m_cabacInitPresentFlag;
1409  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
1410
1411  Bool     m_sliceHeaderExtensionPresentFlag;
1412  Bool     m_loopFilterAcrossSlicesEnabledFlag;
1413  Bool     m_deblockingFilterControlPresentFlag;
1414  Bool     m_deblockingFilterOverrideEnabledFlag;
1415  Bool     m_picDisableDeblockingFilterFlag;
1416  Int      m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1417  Int      m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1418  Bool     m_scalingListPresentFlag;
1419
1420#if SVC_EXTENSION
1421  UInt m_layerId;
1422
1423#if IL_SL_SIGNALLING_N0371
1424  static TComPPS* m_pcPPS[MAX_LAYERS];
1425  Bool     m_predScalingListFlag;
1426  UInt     m_scalingListRefLayerId;
1427#endif
1428
1429#endif
1430
1431  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
1432
1433  Bool m_listsModificationPresentFlag;
1434  UInt m_log2ParallelMergeLevelMinus2;
1435  Int m_numExtraSliceHeaderBits;
1436
1437public:
1438  TComPPS();
1439  virtual ~TComPPS();
1440 
1441  Int       getPPSId ()      { return m_PPSId; }
1442  Void      setPPSId (Int i) { m_PPSId = i; }
1443  Int       getSPSId ()      { return m_SPSId; }
1444  Void      setSPSId (Int i) { m_SPSId = i; }
1445 
1446  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
1447  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
1448  Bool      getUseDQP ()                   { return m_useDQP;        }
1449  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
1450  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
1451  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
1452  Bool      getSliceChromaQpFlag ()         { return  m_bSliceChromaQpFlag; }
1453  Void      setSliceChromaQpFlag ( Bool b ) { m_bSliceChromaQpFlag = b;     }
1454
1455  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1456  TComSPS*  getSPS              ()         { return m_pcSPS;          }
1457  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
1458  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
1459  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
1460  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
1461
1462  Void      setChromaCbQpOffset( Int i ) { m_chromaCbQpOffset = i;    }
1463  Int       getChromaCbQpOffset()        { return m_chromaCbQpOffset; }
1464  Void      setChromaCrQpOffset( Int i ) { m_chromaCrQpOffset = i;    }
1465  Int       getChromaCrQpOffset()        { return m_chromaCrQpOffset; }
1466
1467  Void      setNumRefIdxL0DefaultActive(UInt ui)    { m_numRefIdxL0DefaultActive=ui;     }
1468  UInt      getNumRefIdxL0DefaultActive()           { return m_numRefIdxL0DefaultActive; }
1469  Void      setNumRefIdxL1DefaultActive(UInt ui)    { m_numRefIdxL1DefaultActive=ui;     }
1470  UInt      getNumRefIdxL1DefaultActive()           { return m_numRefIdxL1DefaultActive; }
1471
1472  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
1473  Bool getWPBiPred                  ()          { return m_useWeightedBiPred;     }
1474  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
1475  Void setWPBiPred                  ( Bool b )  { m_useWeightedBiPred = b;  }
1476  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
1477  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
1478  Void      setTransquantBypassEnableFlag( Bool b ) { m_TransquantBypassEnableFlag = b; }
1479  Bool      getTransquantBypassEnableFlag()         { return m_TransquantBypassEnableFlag; }
1480
1481  Bool      getUseTransformSkip       ()         { return m_useTransformSkip;     }
1482  Void      setUseTransformSkip       ( Bool b ) { m_useTransformSkip  = b;       }
1483
1484  Void    setLoopFilterAcrossTilesEnabledFlag  (Bool b)    { m_loopFilterAcrossTilesEnabledFlag = b; }
1485  Bool    getLoopFilterAcrossTilesEnabledFlag  ()          { return m_loopFilterAcrossTilesEnabledFlag;   }
1486  Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag; }
1487  Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val; }
1488  Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag; }
1489  Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val; }
1490  Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag; }
1491  Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val; }
1492  Void     setUniformSpacingFlag            ( Bool b )          { m_uniformSpacingFlag = b; }
1493  Bool     getUniformSpacingFlag            ()                  { return m_uniformSpacingFlag; }
1494  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
1495  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
1496  Void     setColumnWidth ( UInt* columnWidth )
1497  {
1498    if( m_uniformSpacingFlag == 0 && m_iNumColumnsMinus1 > 0 )
1499    {
1500      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
1501
1502      for(Int i=0; i<m_iNumColumnsMinus1; i++)
1503      {
1504        m_puiColumnWidth[i] = columnWidth[i];
1505      }
1506    }
1507  }
1508  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
1509  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
1510  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
1511  Void     setRowHeight    ( UInt* rowHeight )
1512  {
1513    if( m_uniformSpacingFlag == 0 && m_iNumRowsMinus1 > 0 )
1514    {
1515      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
1516
1517      for(Int i=0; i<m_iNumRowsMinus1; i++)
1518      {
1519        m_puiRowHeight[i] = rowHeight[i];
1520      }
1521    }
1522  }
1523  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
1524  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
1525  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
1526
1527  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
1528  Int       getSignHideFlag()                    { return m_signHideFlag; }
1529
1530  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
1531  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
1532  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
1533  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
1534  Void     setDeblockingFilterControlPresentFlag( Bool val )  { m_deblockingFilterControlPresentFlag = val; }
1535  Bool     getDeblockingFilterControlPresentFlag()            { return m_deblockingFilterControlPresentFlag; }
1536  Void     setDeblockingFilterOverrideEnabledFlag( Bool val ) { m_deblockingFilterOverrideEnabledFlag = val; }
1537  Bool     getDeblockingFilterOverrideEnabledFlag()           { return m_deblockingFilterOverrideEnabledFlag; }
1538  Void     setPicDisableDeblockingFilterFlag(Bool val)        { m_picDisableDeblockingFilterFlag = val; }       //!< set offset for deblocking filter disabled
1539  Bool     getPicDisableDeblockingFilterFlag()                { return m_picDisableDeblockingFilterFlag; }      //!< get offset for deblocking filter disabled
1540  Void     setDeblockingFilterBetaOffsetDiv2(Int val)         { m_deblockingFilterBetaOffsetDiv2 = val; }       //!< set beta offset for deblocking filter
1541  Int      getDeblockingFilterBetaOffsetDiv2()                { return m_deblockingFilterBetaOffsetDiv2; }      //!< get beta offset for deblocking filter
1542  Void     setDeblockingFilterTcOffsetDiv2(Int val)           { m_deblockingFilterTcOffsetDiv2 = val; }               //!< set tc offset for deblocking filter
1543  Int      getDeblockingFilterTcOffsetDiv2()                  { return m_deblockingFilterTcOffsetDiv2; }              //!< get tc offset for deblocking filter
1544  Bool     getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1545  Void     setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1546
1547#if IL_SL_SIGNALLING_N0371
1548  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
1549  UInt     getLayerId() { return m_layerId; }
1550
1551  Bool     getPredScalingListFlag()         { return m_predScalingListFlag;     }
1552  Void     setPredScalingListFlag( Bool b ) { m_predScalingListFlag  = b;       }
1553  UInt     getScalingListRefLayerId()         { return m_scalingListRefLayerId;     }
1554  Void     setScalingListRefLayerId( UInt b ) { m_scalingListRefLayerId  = b;       }
1555
1556  static   TComPPS* getPPS(UInt layerId)               { return m_pcPPS[layerId]; }
1557  static   Void     setPPS(UInt layerId, TComPPS* pps) { m_pcPPS[layerId] = pps;  }
1558#endif
1559
1560  Void     setScalingList      ( TComScalingList *scalingList);
1561  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in PPS
1562  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
1563  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
1564  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
1565  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
1566  Int getNumExtraSliceHeaderBits() { return m_numExtraSliceHeaderBits; }
1567  Void setNumExtraSliceHeaderBits(Int i) { m_numExtraSliceHeaderBits = i; }
1568  Void      setLoopFilterAcrossSlicesEnabledFlag ( Bool   bValue  )    { m_loopFilterAcrossSlicesEnabledFlag = bValue; }
1569  Bool      getLoopFilterAcrossSlicesEnabledFlag ()                    { return m_loopFilterAcrossSlicesEnabledFlag;   } 
1570  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
1571  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
1572};
1573
1574typedef struct
1575{
1576  // Explicit weighted prediction parameters parsed in slice header,
1577  // or Implicit weighted prediction parameters (8 bits depth values).
1578  Bool        bPresentFlag;
1579  UInt        uiLog2WeightDenom;
1580  Int         iWeight;
1581  Int         iOffset;
1582
1583  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
1584  Int         w, o, offset, shift, round;
1585} wpScalingParam;
1586
1587typedef struct
1588{
1589  Int64 iAC;
1590  Int64 iDC;
1591} wpACDCParam;
1592
1593/// slice header class
1594class TComSlice
1595{
1596 
1597private:
1598  //  Bitstream writing
1599  Bool       m_saoEnabledFlag;
1600  Bool       m_saoEnabledFlagChroma;      ///< SAO Cb&Cr enabled flag
1601  Int         m_iPPSId;               ///< picture parameter set ID
1602  Bool        m_PicOutputFlag;        ///< pic_output_flag
1603  Int         m_iPOC;
1604  Int         m_iLastIDR;
1605  Int         m_iAssociatedIRAP;
1606  NalUnitType m_iAssociatedIRAPType;
1607  static Int  m_prevTid0POC;
1608  TComReferencePictureSet *m_pcRPS;
1609  TComReferencePictureSet m_LocalRPS;
1610  Int         m_iBDidx; 
1611  TComRefPicListModification m_RefPicListModification;
1612  NalUnitType m_eNalUnitType;         ///< Nal unit type for the slice
1613  SliceType   m_eSliceType;
1614  Int         m_iSliceQp;
1615  Bool        m_dependentSliceSegmentFlag;
1616#if ADAPTIVE_QP_SELECTION
1617  Int         m_iSliceQpBase;
1618#endif
1619  Bool        m_deblockingFilterDisable;
1620  Bool        m_deblockingFilterOverrideFlag;      //< offsets for deblocking filter inherit from PPS
1621  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1622  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1623#if JCTVC_M0458_INTERLAYER_RPS_SIG
1624  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
1625  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
1626#else
1627#if SVC_EXTENSION
1628  Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
1629#endif
1630#endif
1631#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
1632  Int         m_numSamplePredRefLayers;
1633  Bool        m_interLayerSamplePredOnlyFlag;
1634#endif
1635  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
1636  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
1637
1638  Bool        m_bCheckLDC;
1639
1640  //  Data
1641  Int         m_iSliceQpDelta;
1642  Int         m_iSliceQpDeltaCb;
1643  Int         m_iSliceQpDeltaCr;
1644  TComPic*    m_apcRefPicList [2][MAX_NUM_REF+1];
1645  Int         m_aiRefPOCList  [2][MAX_NUM_REF+1];
1646  Bool        m_bIsUsedAsLongTerm[2][MAX_NUM_REF+1];
1647  Int         m_iDepth;
1648 
1649  // referenced slice?
1650  Bool        m_bRefenced;
1651 
1652#if POC_RESET_FLAG
1653  Bool        m_bPocResetFlag;
1654  Int         m_pocValueBeforeReset;
1655#endif 
1656#if SH_DISCARDABLE_FLAG
1657  Bool        m_bDiscardableFlag;
1658#endif
1659  // access channel
1660  TComVPS*    m_pcVPS;
1661  TComSPS*    m_pcSPS;
1662  TComPPS*    m_pcPPS;
1663  TComPic*    m_pcPic;
1664#if ADAPTIVE_QP_SELECTION
1665  TComTrQuant* m_pcTrQuant;
1666#endif 
1667  UInt        m_colFromL0Flag;  // collocated picture from List0 flag
1668 
1669  UInt        m_colRefIdx;
1670  UInt        m_maxNumMergeCand;
1671
1672
1673#if SAO_CHROMA_LAMBDA
1674  Double      m_dLambdaLuma;
1675  Double      m_dLambdaChroma;
1676#else
1677  Double      m_dLambda;
1678#endif
1679
1680  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
1681  UInt        m_uiTLayer;
1682#if SVC_EXTENSION
1683  UInt        m_layerId;
1684  TComPic*    m_pcBaseColPic[MAX_LAYERS];
1685  TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
1686#if M0457_COL_PICTURE_SIGNALING
1687  Int         m_numMotionPredRefLayers;
1688#if REF_IDX_MFM
1689  Bool        m_bMFMEnabledFlag;
1690  Int         m_colRefLayerIdx;
1691  Bool        m_altColIndicationFlag;
1692  TComPic*    m_pcIlpPic;
1693#endif
1694#endif
1695#endif
1696  Bool        m_bTLayerSwitchingFlag;
1697
1698  UInt        m_sliceMode;
1699  UInt        m_sliceArgument;
1700  UInt        m_sliceCurStartCUAddr;
1701  UInt        m_sliceCurEndCUAddr;
1702  UInt        m_sliceIdx;
1703  UInt        m_sliceSegmentMode;
1704  UInt        m_sliceSegmentArgument;
1705  UInt        m_sliceSegmentCurStartCUAddr;
1706  UInt        m_sliceSegmentCurEndCUAddr;
1707  Bool        m_nextSlice;
1708  Bool        m_nextSliceSegment;
1709  UInt        m_sliceBits;
1710  UInt        m_sliceSegmentBits;
1711  Bool        m_bFinalized;
1712
1713  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
1714  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
1715
1716  std::vector<UInt> m_tileByteLocation;
1717  UInt        m_uiTileOffstForMultES;
1718
1719  UInt*       m_puiSubstreamSizes;
1720  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
1721  Bool        m_cabacInitFlag; 
1722
1723  Bool       m_bLMvdL1Zero;
1724  Int         m_numEntryPointOffsets;
1725  Bool       m_temporalLayerNonReferenceFlag;
1726  Bool       m_LFCrossSliceBoundaryFlag;
1727
1728  Bool       m_enableTMVPFlag;
1729#if JCTVC_M0458_INTERLAYER_RPS_SIG
1730  Bool       m_interLayerPredEnabledFlag;
1731#endif
1732public:
1733  TComSlice();
1734  virtual ~TComSlice(); 
1735#if SVC_EXTENSION
1736  Void      initSlice       ( UInt layerId );
1737#else
1738  Void      initSlice       ();
1739#endif
1740
1741  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
1742  TComVPS*  getVPS          () { return m_pcVPS; }
1743  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1744  TComSPS*  getSPS          () { return m_pcSPS; }
1745 
1746  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
1747  TComPPS*  getPPS          () { return m_pcPPS; }
1748
1749#if ADAPTIVE_QP_SELECTION
1750  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
1751  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
1752#endif
1753
1754  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
1755  Int       getPPSId        () { return m_iPPSId; }
1756  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
1757  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
1758  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
1759  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
1760  Void      setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; }       //!< set SAO Cb&Cr enabled flag
1761  Bool      getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; }        //!< get SAO Cb&Cr enabled flag
1762  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
1763  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
1764  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
1765
1766  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
1767  Int       getRPSidx          () { return m_iBDidx; }
1768  Int       getPrevTid0POC      ()                        { return  m_prevTid0POC;       }
1769  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
1770  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
1771  Int       getLastIDR()                                  { return m_iLastIDR; }
1772  Void      setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)             { m_iAssociatedIRAP = iAssociatedIRAPPOC; }
1773  Int       getAssociatedIRAPPOC()                        { return m_iAssociatedIRAP; }
1774  Void      setAssociatedIRAPType(NalUnitType associatedIRAPType)    { m_iAssociatedIRAPType = associatedIRAPType; }
1775  NalUnitType getAssociatedIRAPType()                        { return m_iAssociatedIRAPType; }
1776  SliceType getSliceType    ()                          { return  m_eSliceType;         }
1777  Int       getPOC          ()                          { return  m_iPOC;           }
1778  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
1779  Bool      getDependentSliceSegmentFlag() const        { return m_dependentSliceSegmentFlag; }
1780  void      setDependentSliceSegmentFlag(Bool val)      { m_dependentSliceSegmentFlag = val; }
1781#if ADAPTIVE_QP_SELECTION
1782  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
1783#endif
1784  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
1785  Int       getSliceQpDeltaCb ()                          { return  m_iSliceQpDeltaCb;      }
1786  Int       getSliceQpDeltaCr ()                          { return  m_iSliceQpDeltaCr;      }
1787  Bool      getDeblockingFilterDisable()                { return  m_deblockingFilterDisable; }
1788  Bool      getDeblockingFilterOverrideFlag()           { return  m_deblockingFilterOverrideFlag; }
1789  Int       getDeblockingFilterBetaOffsetDiv2()         { return  m_deblockingFilterBetaOffsetDiv2; }
1790  Int       getDeblockingFilterTcOffsetDiv2()           { return  m_deblockingFilterTcOffsetDiv2; }
1791
1792  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
1793  TComPic*  getPic              ()                              { return  m_pcPic;                      }
1794  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
1795  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
1796  Int       getDepth            ()                              { return  m_iDepth;                     }
1797  UInt      getColFromL0Flag    ()                              { return  m_colFromL0Flag;              }
1798  UInt      getColRefIdx        ()                              { return  m_colRefIdx;                  }
1799  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
1800  Bool      getIsUsedAsLongTerm (Int i, Int j)                  { return m_bIsUsedAsLongTerm[i][j]; }
1801  Void      setIsUsedAsLongTerm (Int i, Int j, Bool value)      { m_bIsUsedAsLongTerm[i][j] = value; }
1802  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
1803  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
1804  Int       getNumRpsCurrTempList();
1805#if RPL_INIT_N0316_N0082
1806  Int       getNumNegativeRpsCurrTempList();
1807#endif
1808  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
1809  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
1810  Bool      isReferenced()                                      { return m_bRefenced; }
1811  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) ); }
1812  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;} }
1813  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
1814  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
1815  Bool      getRapPicFlag       (); 
1816  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
1817  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
1818#if RESTR_CHK
1819   Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
1820   Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
1821#endif
1822
1823#if POC_RESET_FLAG
1824  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag; }
1825  Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b; }
1826  Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
1827  Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ; }
1828#endif
1829#if SH_DISCARDABLE_FLAG
1830  Bool      getDiscardableFlag  ()                              { return m_bDiscardableFlag; }
1831  Void      setDiscardableFlag  (Bool b)                        { m_bDiscardableFlag = b; }
1832#endif
1833
1834  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
1835  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
1836  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
1837  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
1838#if ADAPTIVE_QP_SELECTION
1839  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
1840#endif
1841  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
1842  Void      setSliceQpDeltaCb   ( Int i )                       { m_iSliceQpDeltaCb   = i;      }
1843  Void      setSliceQpDeltaCr   ( Int i )                       { m_iSliceQpDeltaCr   = i;      }
1844  Void      setDeblockingFilterDisable( Bool b )                { m_deblockingFilterDisable= b;      }
1845  Void      setDeblockingFilterOverrideFlag( Bool b )           { m_deblockingFilterOverrideFlag = b; }
1846  Void      setDeblockingFilterBetaOffsetDiv2( Int i )          { m_deblockingFilterBetaOffsetDiv2 = i; }
1847  Void      setDeblockingFilterTcOffsetDiv2( Int i )            { m_deblockingFilterTcOffsetDiv2 = i; }
1848 
1849  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
1850  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
1851  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
1852  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
1853  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
1854
1855#if FIX1071
1856#if SVC_EXTENSION
1857  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL );
1858#else
1859  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
1860#endif
1861#else
1862  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
1863#endif
1864  Void      setRefPOCList       ();
1865  Void      setColFromL0Flag    ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; }
1866  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
1867  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
1868  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
1869
1870  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
1871  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
1872  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
1873 
1874#if SAO_CHROMA_LAMBDA 
1875  Void      setLambda( Double d, Double e ) { m_dLambdaLuma = d; m_dLambdaChroma = e;}
1876  Double    getLambdaLuma() { return m_dLambdaLuma;        }
1877  Double    getLambdaChroma() { return m_dLambdaChroma;        }
1878#else
1879  Void      setLambda( Double d ) { m_dLambda = d; }
1880  Double    getLambda() { return m_dLambda;        }
1881#endif
1882 
1883  Void      initEqualRef();
1884  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
1885  {
1886    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
1887    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
1888  }
1889 
1890  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
1891  {
1892    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
1893  }
1894 
1895  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
1896  Void setList1IdxToList0Idx();
1897
1898  UInt getTLayer             ()                            { return m_uiTLayer;                      }
1899  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
1900
1901  Void setTLayerInfo( UInt uiTLayer );
1902  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
1903  Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic );
1904  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1905  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
1906  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
1907  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
1908#if FIX1071
1909  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
1910#else
1911  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
1912#endif
1913
1914  Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
1915  UInt getMaxNumMergeCand               ()                  { return m_maxNumMergeCand;                   }
1916
1917  Void setSliceMode                     ( UInt uiMode )     { m_sliceMode = uiMode;                     }
1918  UInt getSliceMode                     ()                  { return m_sliceMode;                       }
1919  Void setSliceArgument                 ( UInt uiArgument ) { m_sliceArgument = uiArgument;             }
1920  UInt getSliceArgument                 ()                  { return m_sliceArgument;                   }
1921  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_sliceCurStartCUAddr = uiAddr;           }
1922  UInt getSliceCurStartCUAddr           ()                  { return m_sliceCurStartCUAddr;             }
1923  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_sliceCurEndCUAddr = uiAddr;             }
1924  UInt getSliceCurEndCUAddr             ()                  { return m_sliceCurEndCUAddr;               }
1925  Void setSliceIdx                      ( UInt i)           { m_sliceIdx = i;                           }
1926  UInt getSliceIdx                      ()                  { return  m_sliceIdx;                       }
1927  Void copySliceInfo                    (TComSlice *pcSliceSrc);
1928  Void setSliceSegmentMode              ( UInt uiMode )     { m_sliceSegmentMode = uiMode;              }
1929  UInt getSliceSegmentMode              ()                  { return m_sliceSegmentMode;                }
1930  Void setSliceSegmentArgument          ( UInt uiArgument ) { m_sliceSegmentArgument = uiArgument;      }
1931  UInt getSliceSegmentArgument          ()                  { return m_sliceSegmentArgument;            }
1932  Void setSliceSegmentCurStartCUAddr    ( UInt uiAddr )     { m_sliceSegmentCurStartCUAddr = uiAddr;    }
1933  UInt getSliceSegmentCurStartCUAddr    ()                  { return m_sliceSegmentCurStartCUAddr;      }
1934  Void setSliceSegmentCurEndCUAddr      ( UInt uiAddr )     { m_sliceSegmentCurEndCUAddr = uiAddr;      }
1935  UInt getSliceSegmentCurEndCUAddr      ()                  { return m_sliceSegmentCurEndCUAddr;        }
1936  Void setNextSlice                     ( Bool b )          { m_nextSlice = b;                           }
1937  Bool isNextSlice                      ()                  { return m_nextSlice;                        }
1938  Void setNextSliceSegment              ( Bool b )          { m_nextSliceSegment = b;                    }
1939  Bool isNextSliceSegment               ()                  { return m_nextSliceSegment;                 }
1940  Void setSliceBits                     ( UInt uiVal )      { m_sliceBits = uiVal;                      }
1941  UInt getSliceBits                     ()                  { return m_sliceBits;                       } 
1942  Void setSliceSegmentBits              ( UInt uiVal )      { m_sliceSegmentBits = uiVal;            }
1943  UInt getSliceSegmentBits              ()                  { return m_sliceSegmentBits;             }
1944  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
1945  Bool getFinalized                     ()                  { return m_bFinalized;                        }
1946  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
1947  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
1948
1949  Void  resetWpScaling  ();
1950  Void  initWpScaling   ();
1951  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
1952
1953  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
1954  Void  getWpAcDcParam  ( wpACDCParam *&wp );
1955  Void  initWpAcDcParam ();
1956 
1957  Void setTileLocationCount             ( UInt cnt )               { return m_tileByteLocation.resize(cnt);    }
1958  UInt getTileLocationCount             ()                         { return (UInt) m_tileByteLocation.size();  }
1959  Void setTileLocation                  ( Int idx, UInt location ) { assert (idx<m_tileByteLocation.size());
1960                                                                     m_tileByteLocation[idx] = location;       }
1961  Void addTileLocation                  ( UInt location )          { m_tileByteLocation.push_back(location);   }
1962  UInt getTileLocation                  ( Int idx )                { return m_tileByteLocation[idx];           }
1963
1964  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
1965  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
1966  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
1967  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
1968  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
1969  TComScalingList*   getScalingList ()                               { return m_scalingList; }
1970
1971#if IL_SL_SIGNALLING_N0371
1972  Void  setDefaultScalingList       ( UInt m_layerId );
1973#else
1974  Void  setDefaultScalingList       ();
1975#endif
1976
1977  Bool  checkDefaultScalingList     ();
1978  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
1979  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
1980  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
1981  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
1982  Bool      getTemporalLayerNonReferenceFlag()       { return m_temporalLayerNonReferenceFlag;}
1983  Void      setTemporalLayerNonReferenceFlag(Bool x) { m_temporalLayerNonReferenceFlag = x;}
1984  Void      setLFCrossSliceBoundaryFlag     ( Bool   val )    { m_LFCrossSliceBoundaryFlag = val; }
1985  Bool      getLFCrossSliceBoundaryFlag     ()                { return m_LFCrossSliceBoundaryFlag;} 
1986
1987  Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
1988  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
1989
1990#if SVC_EXTENSION
1991  Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt refLayerIdc );
1992  Void      setBaseColPic       (UInt refLayerIdc, TComPic* p)     { m_pcBaseColPic[refLayerIdc] = p; }
1993  TComPic*  getBaseColPic       (UInt refLayerIdc)                { return m_pcBaseColPic[refLayerIdc]; }
1994  TComPic** getBaseColPic       ()                { return &m_pcBaseColPic[0]; }
1995
1996  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
1997  UInt      getLayerId ()               { return m_layerId;    }
1998
1999  Void        setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
2000  TComPicYuv* getFullPelBaseRec   (UInt refLayerIdc)               { return  m_pcFullPelBaseRec[refLayerIdc];  }
2001
2002#if AVC_SYNTAX
2003  Void      initBaseLayerRPL( TComSlice *pcSlice );
2004#endif
2005
2006  Void      setRefPicListModificationSvc();
2007  Int       getNumILRRefIdx     ( )                     { return  m_pcVPS->getNumDirectRefLayers( m_layerId ); }
2008
2009#if REF_IDX_MFM
2010  Void      setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL);
2011#endif
2012
2013#if JCTVC_M0458_INTERLAYER_RPS_SIG
2014  Int       getActiveNumILRRefIdx     ( )               { return  m_activeNumILRRefIdx; }
2015  Void      setActiveNumILRRefIdx     ( Int i )         { m_activeNumILRRefIdx = i;     } 
2016
2017  Int       getInterLayerPredLayerIdc (UInt layerIdx)                        { return  m_interLayerPredLayerIdc[layerIdx];}
2018  Void      setInterLayerPredLayerIdc (UInt refLayerIdc, UInt layerIdx)      { m_interLayerPredLayerIdc[layerIdx] = refLayerIdc;  }
2019
2020  Void      setInterLayerPredEnabledFlag     ( Bool   val )    { m_interLayerPredEnabledFlag = val; }
2021  Bool      getInterLayerPredEnabledFlag     ()                { return m_interLayerPredEnabledFlag;}
2022#else
2023  Void      setNumILRRefIdx     ( Int i )               { m_numILRRefIdx = i;     }
2024#endif
2025
2026#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
2027  Int       getNumSamplePredRefLayers      ( )          { return  m_numSamplePredRefLayers;       }
2028  Void      setNumSamplePredRefLayers      ( Int i )    { m_numSamplePredRefLayers = i;           }
2029  Bool      getInterLayerSamplePredOnlyFlag( )          { return  m_interLayerSamplePredOnlyFlag; }
2030  Void      setInterLayerSamplePredOnlyFlag( Bool val ) { m_interLayerSamplePredOnlyFlag = val;   }
2031#endif
2032
2033#if M0457_COL_PICTURE_SIGNALING
2034  Void      setNumMotionPredRefLayers(int i)            { m_numMotionPredRefLayers = i; }
2035  Int       getNumMotionPredRefLayers()                 { return m_numMotionPredRefLayers; }
2036#if REF_IDX_MFM
2037  Void      setMFMEnabledFlag(Bool flag)                { m_bMFMEnabledFlag = flag; }
2038  Bool      getMFMEnabledFlag()                         { return m_bMFMEnabledFlag; }
2039#if !REMOVE_COL_PICTURE_SIGNALING
2040  Void      setColRefLayerIdx(Int i)                    { m_colRefLayerIdx = i;     }
2041  Int       getColRefLayerIdx()                         { return m_colRefLayerIdx;  }
2042  Void      setAltColIndicationFlag(Bool i)             { m_altColIndicationFlag = i; }
2043  Bool      getAltColIndicationFlag()                   { return m_altColIndicationFlag; }
2044  Void      setMotionPredIlp(TComPic *ilpPic)           { m_pcIlpPic = ilpPic; }
2045  TComPic*  getMotionPredIlp()                          { return m_pcIlpPic; }
2046#endif
2047#endif
2048#endif
2049
2050TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); } 
2051
2052#endif //SVC_EXTENSION
2053
2054#if REPN_FORMAT_IN_VPS
2055  UInt getPicWidthInLumaSamples();
2056  UInt getPicHeightInLumaSamples();
2057  UInt getChromaFormatIdc();
2058  UInt getBitDepthY();
2059  UInt getBitDepthC();
2060  Int getQpBDOffsetY();
2061  Int getQpBDOffsetC();
2062#endif
2063protected:
2064  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
2065                         Int                 poc);
2066  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
2067};// END CLASS DEFINITION TComSlice
2068
2069
2070template <class T> class ParameterSetMap
2071{
2072public:
2073  ParameterSetMap(Int maxId)
2074  :m_maxId (maxId)
2075  {}
2076
2077  ~ParameterSetMap()
2078  {
2079    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
2080    {
2081      delete (*i).second;
2082    }
2083  }
2084
2085  Void storePS(Int psId, T *ps)
2086  {
2087    assert ( psId < m_maxId );
2088    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
2089    {
2090      delete m_paramsetMap[psId];
2091    }
2092    m_paramsetMap[psId] = ps; 
2093  }
2094
2095  Void mergePSList(ParameterSetMap<T> &rPsList)
2096  {
2097    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
2098    {
2099      storePS(i->first, i->second);
2100    }
2101    rPsList.m_paramsetMap.clear();
2102  }
2103
2104
2105  T* getPS(Int psId)
2106  {
2107    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
2108  }
2109
2110  T* getFirstPS()
2111  {
2112    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
2113  }
2114
2115private:
2116  std::map<Int,T *> m_paramsetMap;
2117  Int               m_maxId;
2118};
2119
2120class ParameterSetManager
2121{
2122public:
2123  ParameterSetManager();
2124  virtual ~ParameterSetManager();
2125
2126  //! store sequence parameter set and take ownership of it
2127  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
2128  //! get pointer to existing video parameter set 
2129  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
2130  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
2131 
2132  //! store sequence parameter set and take ownership of it
2133  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
2134  //! get pointer to existing sequence parameter set 
2135  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
2136  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
2137
2138  //! store picture parameter set and take ownership of it
2139  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
2140  //! get pointer to existing picture parameter set 
2141  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
2142  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
2143
2144  //! activate a SPS from a active parameter sets SEI message
2145  //! \returns true, if activation is successful
2146  Bool activateSPSWithSEI(Int SPSId);
2147
2148  //! activate a PPS and depending on isIDR parameter also SPS and VPS
2149  //! \returns true, if activation is successful
2150  Bool activatePPS(Int ppsId, Bool isIRAP);
2151
2152  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
2153  TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
2154  TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
2155
2156protected:
2157
2158#if SVC_EXTENSION
2159  static ParameterSetMap<TComVPS> m_vpsMap;
2160#else
2161  ParameterSetMap<TComVPS> m_vpsMap;
2162#endif
2163  ParameterSetMap<TComSPS> m_spsMap; 
2164  ParameterSetMap<TComPPS> m_ppsMap;
2165
2166#if SVC_EXTENSION
2167  static Int m_activeVPSId;
2168#else
2169  Int m_activeVPSId;
2170#endif
2171  Int m_activeSPSId;
2172  Int m_activePPSId;
2173};
2174
2175//! \}
2176
2177#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.