source: 3DVCSoftware/branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h @ 497

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

Fixes to RefPicList modification.

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