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

Last change on this file since 479 was 479, checked in by tech, 11 years ago
  • changed IV-MERGE HLS to match Test Model 4 spec
  • incorporated iv-refpic list to TComSlice
  • removed TComDepthMapGenerator
  • Property svn:eol-style set to native
File size: 90.3 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6 * Copyright (c) 2010-2013, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TComSlice.h
35    \brief    slice header and SPS class (header)
36*/
37
38#ifndef __TCOMSLICE__
39#define __TCOMSLICE__
40
41#include <cstring>
42#include <map>
43#include <vector>
44#include "CommonDef.h"
45#include "TComRom.h"
46#include "TComList.h"
47
48//! \ingroup TLibCommon
49//! \{
50
51class TComPic;
52class TComTrQuant;
53#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_maxNuhLayerId;
490#else
491  UInt        m_maxNuhReservedZeroLayerId;
492#endif
493  TComHRD*    m_hrdParameters;
494  UInt*       m_hrdOpSetIdx;
495  Bool*       m_cprmsPresentFlag;
496  UInt        m_numOpSets;
497#if H_MV
498  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_LAYER_ID_PLUS1];
499#else
500  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
501#endif
502
503#if H_MV
504  TComPTL     m_pcPTL[MAX_VPS_OP_SETS_PLUS1];
505#else
506  TComPTL     m_pcPTL;
507#endif
508#if SIGNAL_BITRATE_PICRATE_IN_VPS
509  TComBitRatePicRateInfo    m_bitRatePicRateInfo;
510#endif
511#if L0043_TIMING_INFO
512  TimingInfo  m_timingInfo;
513#endif
514
515#if H_MV
516  Bool        m_avcBaseLayerFlag;
517  Bool        m_splittingFlag;
518  Bool        m_scalabilityMask          [MAX_NUM_SCALABILITY_TYPES];
519  Int         m_dimensionIdLen           [MAX_NUM_SCALABILITY_TYPES];
520  Bool        m_vpsNuhLayerIdPresentFlag;
521  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
522  Int         m_layerIdInVps             [MAX_NUM_LAYERS   ];
523  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
524#if H_3D
525  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
526#endif
527
528 
529  Bool        m_vpsProfilePresentFlag    [MAX_VPS_OP_SETS_PLUS1];
530  Int         m_profileLayerSetRefMinus1 [MAX_VPS_OP_SETS_PLUS1];
531  Int         m_numOutputLayerSets;
532  Int         m_outputLayerSetIdx        [MAX_VPS_OP_SETS_PLUS1];
533  Bool        m_outputLayerFlag          [MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_LAYER_ID_PLUS1];
534  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
535
536  Int         m_numDirectRefLayers       [ MAX_NUM_LAYERS ];
537  Int         m_refLayerId               [ MAX_NUM_LAYERS ][MAX_NUM_LAYERS]; 
538
539#if H_3D_IV_MERGE
540  Bool        m_ivMvPredFlag             [ MAX_NUM_LAYERS ]; 
541#endif
542#endif
543public:
544  TComVPS();
545  virtual ~TComVPS();
546
547  Void    createHrdParamBuffer()
548  {
549    m_hrdParameters    = new TComHRD[ getNumHrdParameters() ];
550    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
551    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
552  }
553
554  TComHRD* getHrdParameters   ( UInt i )             { return &m_hrdParameters[ i ]; }
555  UInt    getHrdOpSetIdx      ( UInt i )             { return m_hrdOpSetIdx[ i ]; }
556  Void    setHrdOpSetIdx      ( UInt val, UInt i )   { m_hrdOpSetIdx[ i ] = val;  }
557  Bool    getCprmsPresentFlag ( UInt i )             { return m_cprmsPresentFlag[ i ]; }
558  Void    setCprmsPresentFlag ( Bool val, UInt i )   { m_cprmsPresentFlag[ i ] = val;  }
559
560  Int     getVPSId       ()                   { return m_VPSId;          }
561  Void    setVPSId       (Int i)              { m_VPSId = i;             }
562
563  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
564  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
565 
566  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
567  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
568
569  Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
570  Void    setTemporalNestingFlag   (Bool t)   { m_bTemporalIdNestingFlag = t; }
571 
572  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
573  UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
574 
575  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[tLayer] = v;    }
576  UInt    getMaxDecPicBuffering(UInt tLayer)                    { return m_uiMaxDecPicBuffering[tLayer]; }
577 
578  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;    }
579  UInt    getMaxLatencyIncrease(UInt tLayer)                    { return m_uiMaxLatencyIncrease[tLayer]; }
580
581  UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
582  Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
583
584#if H_MV
585  UInt    getMaxNuhLayerId()                                    { return m_maxNuhLayerId; }
586  Void    setMaxNuhLayerId(UInt v)                              { m_maxNuhLayerId = v;    }
587#else
588  UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
589  Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
590#endif
591
592  UInt    getMaxOpSets()                                        { return m_numOpSets; }
593  Void    setMaxOpSets(UInt v)                                  { m_numOpSets = v;    }
594  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
595  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
596
597#if H_MV
598  TComPTL* getPTL( Int layerSet = 0 ) { return &m_pcPTL[layerSet]; }
599#else
600  TComPTL* getPTL() { return &m_pcPTL; }
601#endif
602#if SIGNAL_BITRATE_PICRATE_IN_VPS
603  TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }
604#endif
605#if L0043_TIMING_INFO
606  TimingInfo* getTimingInfo() { return &m_timingInfo; }
607#endif
608#if H_MV
609  Void    setAvcBaseLayerFlag( Bool val )                                  { m_avcBaseLayerFlag = val;  }
610  Bool    getAvcBaseLayerFlag()                                            { return m_avcBaseLayerFlag; } 
611
612  Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
613  Bool    getSplittingFlag()                                               { return m_splittingFlag; }
614
615  Void    setScalabilityMask( UInt val );
616
617  Void    setScalabilityMask( Int scalType, Bool val )              { m_scalabilityMask[scalType] = val;  }
618  Bool    getScalabilityMask( Int scalType )                        { return m_scalabilityMask[scalType]; }
619
620  Int     getNumScalabilityTypes( );
621
622  Void    setDimensionIdLen( Int sIdx, Int val )                           { m_dimensionIdLen[sIdx] = val;  }
623  Int     getDimensionIdLen( Int sIdx )                                    { assert( m_dimensionIdLen[sIdx] > 0) ; return m_dimensionIdLen[sIdx]; } 
624
625  Void    setVpsNuhLayerIdPresentFlag( Bool val )                          { m_vpsNuhLayerIdPresentFlag = val; }
626  Bool    getVpsNuhLayerIdPresentFlag()                                    { return m_vpsNuhLayerIdPresentFlag; }
627
628  Void    setLayerIdInNuh( Int layerIdInVps, Int val )                     { m_layerIdInNuh[layerIdInVps] = val;  }
629  Int     getLayerIdInNuh( Int layerIdInVps )                              { assert( m_layerIdInNuh[layerIdInVps] >= 0 ); return m_layerIdInNuh[layerIdInVps]; }
630
631  Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
632  Int     getLayerIdInVps( Int layerIdInNuh )                              { assert( m_layerIdInVps[layerIdInNuh] >= 0 ); return m_layerIdInVps[layerIdInNuh]; }
633
634  Bool    nuhLayerIdIncluded( Int layerIdinNuh )                           { return ( m_layerIdInVps[ layerIdinNuh ] > 0 );  }
635
636  Void    setDimensionId( Int layerIdInVps, Int scalIdx, Int val )         { m_dimensionId[layerIdInVps][scalIdx] = val;  }
637  Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
638
639  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
640
641  Int     getViewId  ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, VIEW_ID  ); }
642#if H_3D 
643  Void    initViewIndex(); 
644  Int     getViewIndex    ( Int layerIdInVps )                             { return m_viewIndex[ layerIdInVps ]; }   
645  Int     getDepthId      ( Int layerIdInVps )                             { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
646  Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag ); 
647#endif
648
649
650  Void    setVpsProfilePresentFlag( Int layerSet, Bool val )               { m_vpsProfilePresentFlag[layerSet] = val;  }
651  Bool    getVpsProfilePresentFlag( Int layerSet )                         { return m_vpsProfilePresentFlag[layerSet]; }
652
653  Void    setProfileLayerSetRefMinus1( Int layerSet, Int val )             { m_profileLayerSetRefMinus1[layerSet] = val;  }
654  Bool    getProfileLayerSetRefMinus1( Int layerSet )                      { return m_profileLayerSetRefMinus1[layerSet]; }
655
656  Void    setNumOutputLayerSets( Int val )                                 { m_numOutputLayerSets = val;  }
657  Int     getNumOutputLayerSets()                                          { return m_numOutputLayerSets; }
658
659  Void    setOutputLayerSetIdx( Int layerSet, Int val )                    { m_outputLayerSetIdx[layerSet] = val;  }
660  Int     getOutputLayerSetIdx( Int layerSet )                             { return m_outputLayerSetIdx[layerSet]; }
661
662  Void    setOutputLayerFlag( Int layerSet, Int layer, Bool val )          { m_outputLayerFlag[layerSet][layer] = val;  }
663  Bool    getOutputLayerFlag( Int layerSet, Int layer )                    { return m_outputLayerFlag[layerSet][layer]; }
664
665  Void    setDirectDependencyFlag( Int layerHigh, Int layerLow, Bool val ) { m_directDependencyFlag[layerHigh][layerLow] = val;  }
666  Bool    getDirectDependencyFlag( Int layerHigh, Int layerLow )           { return m_directDependencyFlag[layerHigh][layerLow]; }
667
668  Void    calcIvRefLayers(); 
669
670  Int     getNumDirectRefLayers( Int layerIdInVps )          { return m_numDirectRefLayers[ layerIdInVps ];  };                               
671  Int     getRefLayerId        ( Int layerIdInVps, Int idx );; 
672 
673  Bool    checkVPSExtensionSyntax(); 
674  Int     scalTypeToScalIdx   ( ScalabilityType scalType );
675#if H_3D_IV_MERGE
676  Void    setIvMvPredFlag     ( Int layerIdInVps, Bool val )  { m_ivMvPredFlag[ layerIdInVps ] = val; }
677  Bool    getIvMvPredFlag     ( Int layerIdInVps )            { return m_ivMvPredFlag[ layerIdInVps ]; }; 
678#endif
679#endif
680};
681
682class Window
683{
684private:
685  Bool          m_enabledFlag;
686  Int           m_winLeftOffset;
687  Int           m_winRightOffset;
688  Int           m_winTopOffset;
689  Int           m_winBottomOffset;
690public:
691  Window()
692  : m_enabledFlag (false)
693  , m_winLeftOffset     (0)
694  , m_winRightOffset    (0)
695  , m_winTopOffset      (0)
696  , m_winBottomOffset   (0)
697  { }
698
699  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
700  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; }
701  Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
702  Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
703  Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
704  Void          setWindowRightOffset(Int val)     { m_winRightOffset = val; m_enabledFlag = true; }
705  Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
706  Void          setWindowTopOffset(Int val)       { m_winTopOffset = val; m_enabledFlag = true; }
707  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
708  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
709
710  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
711  {
712    m_enabledFlag       = true;
713    m_winLeftOffset     = offsetLeft;
714    m_winRightOffset    = offsetLRight;
715    m_winTopOffset      = offsetLTop;
716    m_winBottomOffset   = offsetLBottom;
717  }
718};
719
720
721class TComVUI
722{
723private:
724  Bool m_aspectRatioInfoPresentFlag;
725  Int  m_aspectRatioIdc;
726  Int  m_sarWidth;
727  Int  m_sarHeight;
728  Bool m_overscanInfoPresentFlag;
729  Bool m_overscanAppropriateFlag;
730  Bool m_videoSignalTypePresentFlag;
731  Int  m_videoFormat;
732  Bool m_videoFullRangeFlag;
733  Bool m_colourDescriptionPresentFlag;
734  Int  m_colourPrimaries;
735  Int  m_transferCharacteristics;
736  Int  m_matrixCoefficients;
737  Bool m_chromaLocInfoPresentFlag;
738  Int  m_chromaSampleLocTypeTopField;
739  Int  m_chromaSampleLocTypeBottomField;
740  Bool m_neutralChromaIndicationFlag;
741  Bool m_fieldSeqFlag;
742
743  Window m_defaultDisplayWindow;
744  Bool m_frameFieldInfoPresentFlag;
745  Bool m_hrdParametersPresentFlag;
746  Bool m_bitstreamRestrictionFlag;
747  Bool m_tilesFixedStructureFlag;
748  Bool m_motionVectorsOverPicBoundariesFlag;
749  Bool m_restrictedRefPicListsFlag;
750  Int  m_minSpatialSegmentationIdc;
751  Int  m_maxBytesPerPicDenom;
752  Int  m_maxBitsPerMinCuDenom;
753  Int  m_log2MaxMvLengthHorizontal;
754  Int  m_log2MaxMvLengthVertical;
755  TComHRD m_hrdParameters;
756#if L0043_TIMING_INFO
757  TimingInfo m_timingInfo;
758#else
759  Bool m_pocProportionalToTimingFlag;
760  Int  m_numTicksPocDiffOneMinus1;
761#endif
762
763public:
764  TComVUI()
765    :m_aspectRatioInfoPresentFlag(false)
766    ,m_aspectRatioIdc(0)
767    ,m_sarWidth(0)
768    ,m_sarHeight(0)
769    ,m_overscanInfoPresentFlag(false)
770    ,m_overscanAppropriateFlag(false)
771    ,m_videoSignalTypePresentFlag(false)
772    ,m_videoFormat(5)
773    ,m_videoFullRangeFlag(false)
774    ,m_colourDescriptionPresentFlag(false)
775    ,m_colourPrimaries(2)
776    ,m_transferCharacteristics(2)
777    ,m_matrixCoefficients(2)
778    ,m_chromaLocInfoPresentFlag(false)
779    ,m_chromaSampleLocTypeTopField(0)
780    ,m_chromaSampleLocTypeBottomField(0)
781    ,m_neutralChromaIndicationFlag(false)
782    ,m_fieldSeqFlag(false)
783    ,m_frameFieldInfoPresentFlag(false)
784    ,m_hrdParametersPresentFlag(false)
785    ,m_bitstreamRestrictionFlag(false)
786    ,m_tilesFixedStructureFlag(false)
787    ,m_motionVectorsOverPicBoundariesFlag(true)
788    ,m_restrictedRefPicListsFlag(1)
789    ,m_minSpatialSegmentationIdc(0)
790    ,m_maxBytesPerPicDenom(2)
791    ,m_maxBitsPerMinCuDenom(1)
792    ,m_log2MaxMvLengthHorizontal(15)
793    ,m_log2MaxMvLengthVertical(15)
794#if !L0043_TIMING_INFO 
795    ,m_pocProportionalToTimingFlag(false)
796    ,m_numTicksPocDiffOneMinus1(0)
797#endif
798  {}
799
800  virtual ~TComVUI() {}
801
802  Bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag; }
803  Void setAspectRatioInfoPresentFlag(Bool i) { m_aspectRatioInfoPresentFlag = i; }
804
805  Int getAspectRatioIdc() { return m_aspectRatioIdc; }
806  Void setAspectRatioIdc(Int i) { m_aspectRatioIdc = i; }
807
808  Int getSarWidth() { return m_sarWidth; }
809  Void setSarWidth(Int i) { m_sarWidth = i; }
810
811  Int getSarHeight() { return m_sarHeight; }
812  Void setSarHeight(Int i) { m_sarHeight = i; }
813
814  Bool getOverscanInfoPresentFlag() { return m_overscanInfoPresentFlag; }
815  Void setOverscanInfoPresentFlag(Bool i) { m_overscanInfoPresentFlag = i; }
816
817  Bool getOverscanAppropriateFlag() { return m_overscanAppropriateFlag; }
818  Void setOverscanAppropriateFlag(Bool i) { m_overscanAppropriateFlag = i; }
819
820  Bool getVideoSignalTypePresentFlag() { return m_videoSignalTypePresentFlag; }
821  Void setVideoSignalTypePresentFlag(Bool i) { m_videoSignalTypePresentFlag = i; }
822
823  Int getVideoFormat() { return m_videoFormat; }
824  Void setVideoFormat(Int i) { m_videoFormat = i; }
825
826  Bool getVideoFullRangeFlag() { return m_videoFullRangeFlag; }
827  Void setVideoFullRangeFlag(Bool i) { m_videoFullRangeFlag = i; }
828
829  Bool getColourDescriptionPresentFlag() { return m_colourDescriptionPresentFlag; }
830  Void setColourDescriptionPresentFlag(Bool i) { m_colourDescriptionPresentFlag = i; }
831
832  Int getColourPrimaries() { return m_colourPrimaries; }
833  Void setColourPrimaries(Int i) { m_colourPrimaries = i; }
834
835  Int getTransferCharacteristics() { return m_transferCharacteristics; }
836  Void setTransferCharacteristics(Int i) { m_transferCharacteristics = i; }
837
838  Int getMatrixCoefficients() { return m_matrixCoefficients; }
839  Void setMatrixCoefficients(Int i) { m_matrixCoefficients = i; }
840
841  Bool getChromaLocInfoPresentFlag() { return m_chromaLocInfoPresentFlag; }
842  Void setChromaLocInfoPresentFlag(Bool i) { m_chromaLocInfoPresentFlag = i; }
843
844  Int getChromaSampleLocTypeTopField() { return m_chromaSampleLocTypeTopField; }
845  Void setChromaSampleLocTypeTopField(Int i) { m_chromaSampleLocTypeTopField = i; }
846
847  Int getChromaSampleLocTypeBottomField() { return m_chromaSampleLocTypeBottomField; }
848  Void setChromaSampleLocTypeBottomField(Int i) { m_chromaSampleLocTypeBottomField = i; }
849
850  Bool getNeutralChromaIndicationFlag() { return m_neutralChromaIndicationFlag; }
851  Void setNeutralChromaIndicationFlag(Bool i) { m_neutralChromaIndicationFlag = i; }
852
853  Bool getFieldSeqFlag() { return m_fieldSeqFlag; }
854  Void setFieldSeqFlag(Bool i) { m_fieldSeqFlag = i; }
855
856  Bool getFrameFieldInfoPresentFlag() { return m_frameFieldInfoPresentFlag; }
857  Void setFrameFieldInfoPresentFlag(Bool i) { m_frameFieldInfoPresentFlag = i; }
858
859  Window& getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;                }
860  Void    setDefaultDisplayWindow(Window& defaultDisplayWindow ) { m_defaultDisplayWindow = defaultDisplayWindow; }
861
862  Bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; }
863  Void setHrdParametersPresentFlag(Bool i) { m_hrdParametersPresentFlag = i; }
864
865  Bool getBitstreamRestrictionFlag() { return m_bitstreamRestrictionFlag; }
866  Void setBitstreamRestrictionFlag(Bool i) { m_bitstreamRestrictionFlag = i; }
867
868  Bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag; }
869  Void setTilesFixedStructureFlag(Bool i) { m_tilesFixedStructureFlag = i; }
870
871  Bool getMotionVectorsOverPicBoundariesFlag() { return m_motionVectorsOverPicBoundariesFlag; }
872  Void setMotionVectorsOverPicBoundariesFlag(Bool i) { m_motionVectorsOverPicBoundariesFlag = i; }
873
874  Bool getRestrictedRefPicListsFlag() { return m_restrictedRefPicListsFlag; }
875  Void setRestrictedRefPicListsFlag(Bool b) { m_restrictedRefPicListsFlag = b; }
876
877  Int getMinSpatialSegmentationIdc() { return m_minSpatialSegmentationIdc; }
878  Void setMinSpatialSegmentationIdc(Int i) { m_minSpatialSegmentationIdc = i; }
879  Int getMaxBytesPerPicDenom() { return m_maxBytesPerPicDenom; }
880  Void setMaxBytesPerPicDenom(Int i) { m_maxBytesPerPicDenom = i; }
881
882  Int getMaxBitsPerMinCuDenom() { return m_maxBitsPerMinCuDenom; }
883  Void setMaxBitsPerMinCuDenom(Int i) { m_maxBitsPerMinCuDenom = i; }
884
885  Int getLog2MaxMvLengthHorizontal() { return m_log2MaxMvLengthHorizontal; }
886  Void setLog2MaxMvLengthHorizontal(Int i) { m_log2MaxMvLengthHorizontal = i; }
887
888  Int getLog2MaxMvLengthVertical() { return m_log2MaxMvLengthVertical; }
889  Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; }
890
891  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
892#if L0043_TIMING_INFO
893  TimingInfo* getTimingInfo() { return &m_timingInfo; }
894#else
895  Bool getPocProportionalToTimingFlag() {return m_pocProportionalToTimingFlag; }
896  Void setPocProportionalToTimingFlag(Bool x) {m_pocProportionalToTimingFlag = x;}
897  Int  getNumTicksPocDiffOneMinus1() {return m_numTicksPocDiffOneMinus1;}
898  Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}
899#endif
900};
901
902/// SPS class
903class TComSPS
904{
905private:
906  Int         m_SPSId;
907  Int         m_VPSId;
908  Int         m_chromaFormatIdc;
909
910  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
911
912  // Structure
913  UInt        m_picWidthInLumaSamples;
914  UInt        m_picHeightInLumaSamples;
915 
916  Int         m_log2MinCodingBlockSize;
917  Int         m_log2DiffMaxMinCodingBlockSize;
918  UInt        m_uiMaxCUWidth;
919  UInt        m_uiMaxCUHeight;
920  UInt        m_uiMaxCUDepth;
921
922  Window      m_conformanceWindow;
923
924  TComRPSList m_RPSList;
925  Bool        m_bLongTermRefsPresent;
926  Bool        m_TMVPFlagsPresent;
927  Int         m_numReorderPics[MAX_TLAYER];
928 
929  // Tool list
930  UInt        m_uiQuadtreeTULog2MaxSize;
931  UInt        m_uiQuadtreeTULog2MinSize;
932  UInt        m_uiQuadtreeTUMaxDepthInter;
933  UInt        m_uiQuadtreeTUMaxDepthIntra;
934  Bool        m_usePCM;
935  UInt        m_pcmLog2MaxSize;
936  UInt        m_uiPCMLog2MinSize;
937  Bool        m_useAMP;
938
939#if !L0034_COMBINED_LIST_CLEANUP
940  Bool        m_bUseLComb;
941#endif
942 
943  // Parameter
944  Int         m_bitDepthY;
945  Int         m_bitDepthC;
946  Int         m_qpBDOffsetY;
947  Int         m_qpBDOffsetC;
948
949  Bool        m_useLossless;
950
951  UInt        m_uiPCMBitDepthLuma;
952  UInt        m_uiPCMBitDepthChroma;
953  Bool        m_bPCMFilterDisableFlag;
954
955  UInt        m_uiBitsForPOC;
956  UInt        m_numLongTermRefPicSPS;
957  UInt        m_ltRefPicPocLsbSps[33];
958  Bool        m_usedByCurrPicLtSPSFlag[33];
959  // Max physical transform size
960  UInt        m_uiMaxTrSize;
961 
962  Int m_iAMPAcc[MAX_CU_DEPTH];
963  Bool        m_bUseSAO; 
964
965  Bool        m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
966
967  Bool        m_scalingListEnabledFlag;
968  Bool        m_scalingListPresentFlag;
969  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
970  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
971  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
972
973  Bool        m_useDF;
974  Bool        m_useStrongIntraSmoothing;
975
976  Bool        m_vuiParametersPresentFlag;
977  TComVUI     m_vuiParameters;
978
979  static const Int   m_winUnitX[MAX_CHROMA_FORMAT_IDC+1];
980  static const Int   m_winUnitY[MAX_CHROMA_FORMAT_IDC+1];
981  TComPTL     m_pcPTL;
982#if H_MV
983  Bool        m_interViewMvVertConstraintFlag;
984#endif
985#if H_3D
986  UInt        m_uiCamParPrecision;
987  Bool        m_bCamParInSliceHeader;
988  Int         m_aaiCodedScale [2][MAX_NUM_LAYERS];
989  Int         m_aaiCodedOffset[2][MAX_NUM_LAYERS];
990#endif
991public:
992  TComSPS();
993  virtual ~TComSPS();
994
995  Int  getVPSId       ()         { return m_VPSId;          }
996  Void setVPSId       (Int i)    { m_VPSId = i;             }
997  Int  getSPSId       ()         { return m_SPSId;          }
998  Void setSPSId       (Int i)    { m_SPSId = i;             }
999  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
1000  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
1001
1002  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
1003  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
1004 
1005  // structure
1006  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
1007  UInt getPicWidthInLumaSamples       ()         { return  m_picWidthInLumaSamples;    }
1008  Void setPicHeightInLumaSamples      ( UInt u ) { m_picHeightInLumaSamples = u;       }
1009  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
1010
1011  Window& getConformanceWindow()                           { return  m_conformanceWindow;             }
1012  Void    setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
1013
1014  UInt  getNumLongTermRefPicSPS()             { return m_numLongTermRefPicSPS; }
1015  Void  setNumLongTermRefPicSPS(UInt val)     { m_numLongTermRefPicSPS = val; }
1016
1017  UInt  getLtRefPicPocLsbSps(UInt index)             { return m_ltRefPicPocLsbSps[index]; }
1018  Void  setLtRefPicPocLsbSps(UInt index, UInt val)     { m_ltRefPicPocLsbSps[index] = val; }
1019
1020  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
1021  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
1022
1023  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
1024  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
1025  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
1026  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
1027
1028  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
1029  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
1030  Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u;     }
1031  UInt getMaxCUHeight ()         { return  m_uiMaxCUHeight; }
1032  Void setMaxCUDepth  ( UInt u ) { m_uiMaxCUDepth = u;      }
1033  UInt getMaxCUDepth  ()         { return  m_uiMaxCUDepth;  }
1034  Void setUsePCM      ( Bool b ) { m_usePCM = b;           }
1035  Bool getUsePCM      ()         { return m_usePCM;        }
1036  Void setPCMLog2MaxSize  ( UInt u ) { m_pcmLog2MaxSize = u;      }
1037  UInt getPCMLog2MaxSize  ()         { return  m_pcmLog2MaxSize;  }
1038  Void setPCMLog2MinSize  ( UInt u ) { m_uiPCMLog2MinSize = u;      }
1039  UInt getPCMLog2MinSize  ()         { return  m_uiPCMLog2MinSize;  }
1040  Void setBitsForPOC  ( UInt u ) { m_uiBitsForPOC = u;      }
1041  UInt getBitsForPOC  ()         { return m_uiBitsForPOC;   }
1042  Bool getUseAMP() { return m_useAMP; }
1043  Void setUseAMP( Bool b ) { m_useAMP = b; }
1044  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
1045  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
1046  Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u;    }
1047  UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
1048  Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u;    }
1049  Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u;    }
1050  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
1051  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
1052  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
1053  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
1054  Void         createRPSList( Int numRPS );
1055  TComRPSList* getRPSList()                      { return &m_RPSList;          }
1056  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
1057  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
1058  Bool      getTMVPFlagsPresent()         { return m_TMVPFlagsPresent; }
1059  Void      setTMVPFlagsPresent(Bool b)   { m_TMVPFlagsPresent=b;      } 
1060  // physical transform
1061  Void setMaxTrSize   ( UInt u ) { m_uiMaxTrSize = u;       }
1062  UInt getMaxTrSize   ()         { return  m_uiMaxTrSize;   }
1063 
1064  // Tool list
1065#if !L0034_COMBINED_LIST_CLEANUP
1066  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
1067  Bool getUseLComb    ()         { return m_bUseLComb;      }
1068#endif
1069
1070  Bool getUseLossless ()         { return m_useLossless; }
1071  Void setUseLossless ( Bool b ) { m_useLossless  = b; }
1072 
1073  // AMP accuracy
1074  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
1075  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
1076
1077  // Bit-depth
1078  Int      getBitDepthY() { return m_bitDepthY; }
1079  Void     setBitDepthY(Int u) { m_bitDepthY = u; }
1080  Int      getBitDepthC() { return m_bitDepthC; }
1081  Void     setBitDepthC(Int u) { m_bitDepthC = u; }
1082  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
1083  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
1084  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
1085  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
1086  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
1087  Bool getUseSAO                  ()           {return m_bUseSAO;}
1088
1089  UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
1090  Void      setMaxTLayers( UInt uiMaxTLayers )        { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
1091
1092  Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
1093  Void      setTemporalIdNestingFlag( Bool bValue )   { m_bTemporalIdNestingFlag = bValue; }
1094  UInt      getPCMBitDepthLuma     ()         { return m_uiPCMBitDepthLuma;     }
1095  Void      setPCMBitDepthLuma     ( UInt u ) { m_uiPCMBitDepthLuma = u;        }
1096  UInt      getPCMBitDepthChroma   ()         { return m_uiPCMBitDepthChroma;   }
1097  Void      setPCMBitDepthChroma   ( UInt u ) { m_uiPCMBitDepthChroma = u;      }
1098  Void      setPCMFilterDisableFlag     ( Bool   bValue  )    { m_bPCMFilterDisableFlag = bValue; }
1099  Bool      getPCMFilterDisableFlag     ()                    { return m_bPCMFilterDisableFlag;   } 
1100
1101  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
1102  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
1103  Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1104  Void setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1105  Void setScalingList      ( TComScalingList *scalingList);
1106  TComScalingList* getScalingList ()       { return m_scalingList; }               //!< get ScalingList class pointer in SPS
1107  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
1108  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
1109  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
1110  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
1111
1112  Void setUseStrongIntraSmoothing (Bool bVal)  {m_useStrongIntraSmoothing = bVal;}
1113  Bool getUseStrongIntraSmoothing ()           {return m_useStrongIntraSmoothing;}
1114
1115  Bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; }
1116  Void setVuiParametersPresentFlag(Bool b) { m_vuiParametersPresentFlag = b; }
1117  TComVUI* getVuiParameters() { return &m_vuiParameters; }
1118  Void setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
1119
1120  TComPTL* getPTL()     { return &m_pcPTL; }
1121#if H_MV
1122  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
1123  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
1124#endif
1125#if H_3D
1126  Void initCamParaSPS      (  UInt uiViewIndex, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
1127  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
1128  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
1129  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
1130  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
1131  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
1132  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
1133#endif
1134};
1135
1136/// Reference Picture Lists class
1137class TComRefPicListModification
1138{
1139private:
1140  UInt      m_bRefPicListModificationFlagL0; 
1141  UInt      m_bRefPicListModificationFlagL1; 
1142  UInt      m_RefPicSetIdxL0[32];
1143  UInt      m_RefPicSetIdxL1[32];
1144   
1145public:
1146  TComRefPicListModification();
1147  virtual ~TComRefPicListModification();
1148 
1149  Void  create                    ();
1150  Void  destroy                   ();
1151
1152  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
1153  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
1154  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
1155  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
1156  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
1157  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
1158  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
1159  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
1160#if H_MV
1161  // Why not an listIdx for all members, would avoid code duplication??
1162  Void       setRefPicSetIdxL(UInt li, UInt idx, UInt refPicSetIdx) {( li==0 ? m_RefPicSetIdxL0[idx] : m_RefPicSetIdxL1[idx] ) = refPicSetIdx; };
1163  Void       setRefPicListModificationFlagL(UInt li, Bool flag) { ( li==0  ? m_bRefPicListModificationFlagL0 : m_bRefPicListModificationFlagL1 ) = flag;  }; 
1164#endif
1165};
1166
1167/// PPS class
1168class TComPPS
1169{
1170private:
1171  Int         m_PPSId;                    // pic_parameter_set_id
1172  Int         m_SPSId;                    // seq_parameter_set_id
1173  Int         m_picInitQPMinus26;
1174  Bool        m_useDQP;
1175  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
1176  Bool        m_bSliceChromaQpFlag;       // slicelevel_chroma_qp_flag
1177
1178  // access channel
1179  TComSPS*    m_pcSPS;
1180  UInt        m_uiMaxCuDQPDepth;
1181  UInt        m_uiMinCuDQPSize;
1182
1183  Int         m_chromaCbQpOffset;
1184  Int         m_chromaCrQpOffset;
1185
1186  UInt        m_numRefIdxL0DefaultActive;
1187  UInt        m_numRefIdxL1DefaultActive;
1188
1189  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
1190  Bool        m_useWeightedBiPred;        // Use of Weighting Bi-Prediction (B_SLICE)
1191  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
1192
1193  Bool        m_TransquantBypassEnableFlag; // Indicates presence of cu_transquant_bypass_flag in CUs.
1194  Bool        m_useTransformSkip;
1195  Bool        m_dependentSliceSegmentsEnabledFlag;     //!< Indicates the presence of dependent slices
1196  Bool        m_tilesEnabledFlag;              //!< Indicates the presence of tiles
1197  Bool        m_entropyCodingSyncEnabledFlag;  //!< Indicates the presence of wavefronts
1198 
1199  Bool     m_loopFilterAcrossTilesEnabledFlag;
1200  Int      m_uniformSpacingFlag;
1201  Int      m_iNumColumnsMinus1;
1202  UInt*    m_puiColumnWidth;
1203  Int      m_iNumRowsMinus1;
1204  UInt*    m_puiRowHeight;
1205
1206  Int      m_iNumSubstreams;
1207
1208  Int      m_signHideFlag;
1209
1210  Bool     m_cabacInitPresentFlag;
1211  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
1212
1213  Bool     m_sliceHeaderExtensionPresentFlag;
1214  Bool     m_loopFilterAcrossSlicesEnabledFlag;
1215  Bool     m_deblockingFilterControlPresentFlag;
1216  Bool     m_deblockingFilterOverrideEnabledFlag;
1217  Bool     m_picDisableDeblockingFilterFlag;
1218  Int      m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1219  Int      m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1220  Bool     m_scalingListPresentFlag;
1221  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
1222  Bool m_listsModificationPresentFlag;
1223  UInt m_log2ParallelMergeLevelMinus2;
1224  Int m_numExtraSliceHeaderBits;
1225
1226public:
1227  TComPPS();
1228  virtual ~TComPPS();
1229 
1230  Int       getPPSId ()      { return m_PPSId; }
1231  Void      setPPSId (Int i) { m_PPSId = i; }
1232  Int       getSPSId ()      { return m_SPSId; }
1233  Void      setSPSId (Int i) { m_SPSId = i; }
1234 
1235  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
1236  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
1237  Bool      getUseDQP ()                   { return m_useDQP;        }
1238  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
1239  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
1240  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
1241  Bool      getSliceChromaQpFlag ()         { return  m_bSliceChromaQpFlag; }
1242  Void      setSliceChromaQpFlag ( Bool b ) { m_bSliceChromaQpFlag = b;     }
1243
1244  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1245  TComSPS*  getSPS              ()         { return m_pcSPS;          }
1246  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
1247  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
1248  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
1249  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
1250
1251  Void      setChromaCbQpOffset( Int i ) { m_chromaCbQpOffset = i;    }
1252  Int       getChromaCbQpOffset()        { return m_chromaCbQpOffset; }
1253  Void      setChromaCrQpOffset( Int i ) { m_chromaCrQpOffset = i;    }
1254  Int       getChromaCrQpOffset()        { return m_chromaCrQpOffset; }
1255
1256  Void      setNumRefIdxL0DefaultActive(UInt ui)    { m_numRefIdxL0DefaultActive=ui;     }
1257  UInt      getNumRefIdxL0DefaultActive()           { return m_numRefIdxL0DefaultActive; }
1258  Void      setNumRefIdxL1DefaultActive(UInt ui)    { m_numRefIdxL1DefaultActive=ui;     }
1259  UInt      getNumRefIdxL1DefaultActive()           { return m_numRefIdxL1DefaultActive; }
1260
1261  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
1262  Bool getWPBiPred                  ()          { return m_useWeightedBiPred;     }
1263  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
1264  Void setWPBiPred                  ( Bool b )  { m_useWeightedBiPred = b;  }
1265  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
1266  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
1267  Void      setTransquantBypassEnableFlag( Bool b ) { m_TransquantBypassEnableFlag = b; }
1268  Bool      getTransquantBypassEnableFlag()         { return m_TransquantBypassEnableFlag; }
1269
1270  Bool      getUseTransformSkip       ()         { return m_useTransformSkip;     }
1271  Void      setUseTransformSkip       ( Bool b ) { m_useTransformSkip  = b;       }
1272
1273  Void    setLoopFilterAcrossTilesEnabledFlag  (Bool b)    { m_loopFilterAcrossTilesEnabledFlag = b; }
1274  Bool    getLoopFilterAcrossTilesEnabledFlag  ()          { return m_loopFilterAcrossTilesEnabledFlag;   }
1275  Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag; }
1276  Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val; }
1277  Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag; }
1278  Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val; }
1279  Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag; }
1280  Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val; }
1281  Void     setUniformSpacingFlag            ( Bool b )          { m_uniformSpacingFlag = b; }
1282  Bool     getUniformSpacingFlag            ()                  { return m_uniformSpacingFlag; }
1283  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
1284  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
1285  Void     setColumnWidth ( UInt* columnWidth )
1286  {
1287    if( m_uniformSpacingFlag == 0 && m_iNumColumnsMinus1 > 0 )
1288    {
1289      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
1290
1291      for(Int i=0; i<m_iNumColumnsMinus1; i++)
1292      {
1293        m_puiColumnWidth[i] = columnWidth[i];
1294      }
1295    }
1296  }
1297  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
1298  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
1299  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
1300  Void     setRowHeight    ( UInt* rowHeight )
1301  {
1302    if( m_uniformSpacingFlag == 0 && m_iNumRowsMinus1 > 0 )
1303    {
1304      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
1305
1306      for(Int i=0; i<m_iNumRowsMinus1; i++)
1307      {
1308        m_puiRowHeight[i] = rowHeight[i];
1309      }
1310    }
1311  }
1312  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
1313  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
1314  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
1315
1316  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
1317  Int       getSignHideFlag()                    { return m_signHideFlag; }
1318
1319  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
1320  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
1321  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
1322  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
1323  Void     setDeblockingFilterControlPresentFlag( Bool val )  { m_deblockingFilterControlPresentFlag = val; }
1324  Bool     getDeblockingFilterControlPresentFlag()            { return m_deblockingFilterControlPresentFlag; }
1325  Void     setDeblockingFilterOverrideEnabledFlag( Bool val ) { m_deblockingFilterOverrideEnabledFlag = val; }
1326  Bool     getDeblockingFilterOverrideEnabledFlag()           { return m_deblockingFilterOverrideEnabledFlag; }
1327  Void     setPicDisableDeblockingFilterFlag(Bool val)        { m_picDisableDeblockingFilterFlag = val; }       //!< set offset for deblocking filter disabled
1328  Bool     getPicDisableDeblockingFilterFlag()                { return m_picDisableDeblockingFilterFlag; }      //!< get offset for deblocking filter disabled
1329  Void     setDeblockingFilterBetaOffsetDiv2(Int val)         { m_deblockingFilterBetaOffsetDiv2 = val; }       //!< set beta offset for deblocking filter
1330  Int      getDeblockingFilterBetaOffsetDiv2()                { return m_deblockingFilterBetaOffsetDiv2; }      //!< get beta offset for deblocking filter
1331  Void     setDeblockingFilterTcOffsetDiv2(Int val)           { m_deblockingFilterTcOffsetDiv2 = val; }               //!< set tc offset for deblocking filter
1332  Int      getDeblockingFilterTcOffsetDiv2()                  { return m_deblockingFilterTcOffsetDiv2; }              //!< get tc offset for deblocking filter
1333  Bool     getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
1334  Void     setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
1335  Void     setScalingList      ( TComScalingList *scalingList);
1336  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in PPS
1337  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
1338  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
1339  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
1340  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
1341  Int getNumExtraSliceHeaderBits() { return m_numExtraSliceHeaderBits; }
1342  Void setNumExtraSliceHeaderBits(Int i) { m_numExtraSliceHeaderBits = i; }
1343  Void      setLoopFilterAcrossSlicesEnabledFlag ( Bool   bValue  )    { m_loopFilterAcrossSlicesEnabledFlag = bValue; }
1344  Bool      getLoopFilterAcrossSlicesEnabledFlag ()                    { return m_loopFilterAcrossSlicesEnabledFlag;   } 
1345  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
1346  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
1347};
1348
1349typedef struct
1350{
1351  // Explicit weighted prediction parameters parsed in slice header,
1352  // or Implicit weighted prediction parameters (8 bits depth values).
1353  Bool        bPresentFlag;
1354  UInt        uiLog2WeightDenom;
1355  Int         iWeight;
1356  Int         iOffset;
1357
1358  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
1359  Int         w, o, offset, shift, round;
1360} wpScalingParam;
1361
1362typedef struct
1363{
1364  Int64 iAC;
1365  Int64 iDC;
1366} wpACDCParam;
1367
1368/// slice header class
1369class TComSlice
1370{
1371 
1372private:
1373  //  Bitstream writing
1374  Bool       m_saoEnabledFlag;
1375  Bool       m_saoEnabledFlagChroma;      ///< SAO Cb&Cr enabled flag
1376  Int         m_iPPSId;               ///< picture parameter set ID
1377  Bool        m_PicOutputFlag;        ///< pic_output_flag
1378  Int         m_iPOC;
1379  Int         m_iLastIDR;
1380  static Int  m_prevPOC;
1381  TComReferencePictureSet *m_pcRPS;
1382  TComReferencePictureSet m_LocalRPS;
1383  Int         m_iBDidx; 
1384  TComRefPicListModification m_RefPicListModification;
1385  NalUnitType m_eNalUnitType;         ///< Nal unit type for the slice
1386  SliceType   m_eSliceType;
1387  Int         m_iSliceQp;
1388  Bool        m_dependentSliceSegmentFlag;
1389#if ADAPTIVE_QP_SELECTION
1390  Int         m_iSliceQpBase;
1391#endif
1392  Bool        m_deblockingFilterDisable;
1393  Bool        m_deblockingFilterOverrideFlag;      //< offsets for deblocking filter inherit from PPS
1394  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1395  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1396#if L0034_COMBINED_LIST_CLEANUP
1397  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
1398  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
1399#else
1400  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
1401
1402  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
1403  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
1404  Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
1405  Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
1406  Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
1407  Bool        m_bRefPicListModificationFlagLC;
1408  Bool        m_bRefPicListCombinationFlag;
1409#endif
1410
1411  Bool        m_bCheckLDC;
1412
1413  //  Data
1414  Int         m_iSliceQpDelta;
1415  Int         m_iSliceQpDeltaCb;
1416  Int         m_iSliceQpDeltaCr;
1417  TComPic*    m_apcRefPicList [2][MAX_NUM_REF+1];
1418  Int         m_aiRefPOCList  [2][MAX_NUM_REF+1];
1419#if H_MV
1420  Int         m_aiRefLayerIdList[2][MAX_NUM_REF+1];
1421#endif
1422  Bool        m_bIsUsedAsLongTerm[2][MAX_NUM_REF+1];
1423  Int         m_iDepth;
1424 
1425  // referenced slice?
1426  Bool        m_bRefenced;
1427 
1428  // access channel
1429  TComVPS*    m_pcVPS;
1430  TComSPS*    m_pcSPS;
1431  TComPPS*    m_pcPPS;
1432  TComPic*    m_pcPic;
1433#if ADAPTIVE_QP_SELECTION
1434  TComTrQuant* m_pcTrQuant;
1435#endif 
1436  UInt        m_colFromL0Flag;  // collocated picture from List0 flag
1437 
1438  UInt        m_colRefIdx;
1439  UInt        m_maxNumMergeCand;
1440
1441
1442#if SAO_CHROMA_LAMBDA
1443  Double      m_dLambdaLuma;
1444  Double      m_dLambdaChroma;
1445#else
1446  Double      m_dLambda;
1447#endif
1448
1449  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
1450#if !L0034_COMBINED_LIST_CLEANUP
1451  Bool        m_bNoBackPredFlag;
1452#endif
1453  UInt        m_uiTLayer;
1454  Bool        m_bTLayerSwitchingFlag;
1455
1456  UInt        m_sliceMode;
1457  UInt        m_sliceArgument;
1458  UInt        m_sliceCurStartCUAddr;
1459  UInt        m_sliceCurEndCUAddr;
1460  UInt        m_sliceIdx;
1461  UInt        m_sliceSegmentMode;
1462  UInt        m_sliceSegmentArgument;
1463  UInt        m_sliceSegmentCurStartCUAddr;
1464  UInt        m_sliceSegmentCurEndCUAddr;
1465  Bool        m_nextSlice;
1466  Bool        m_nextSliceSegment;
1467  UInt        m_sliceBits;
1468  UInt        m_sliceSegmentBits;
1469  Bool        m_bFinalized;
1470
1471  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
1472  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
1473
1474  std::vector<UInt> m_tileByteLocation;
1475  UInt        m_uiTileOffstForMultES;
1476
1477  UInt*       m_puiSubstreamSizes;
1478  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
1479  Bool        m_cabacInitFlag; 
1480
1481  Bool       m_bLMvdL1Zero;
1482  Int         m_numEntryPointOffsets;
1483  Bool       m_temporalLayerNonReferenceFlag;
1484  Bool       m_LFCrossSliceBoundaryFlag;
1485
1486  Bool       m_enableTMVPFlag;
1487#if H_MV
1488  Int        m_layerId; 
1489  Int        m_viewId;
1490#if H_3D
1491  Int        m_viewIndex; 
1492  Bool       m_isDepth;
1493  Int        m_aaiCodedScale [2][MAX_NUM_LAYERS];
1494  Int        m_aaiCodedOffset[2][MAX_NUM_LAYERS]; 
1495#if H_3D_GEN
1496  TComPic*   m_ivPicsCurrPoc [2][MAX_NUM_LAYERS]; 
1497#endif
1498#endif
1499#endif
1500public:
1501  TComSlice();
1502  virtual ~TComSlice(); 
1503  Void      initSlice       ();
1504
1505  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
1506  TComVPS*  getVPS          () { return m_pcVPS; }
1507  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1508  TComSPS*  getSPS          () { return m_pcSPS; }
1509 
1510  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
1511  TComPPS*  getPPS          () { return m_pcPPS; }
1512
1513#if ADAPTIVE_QP_SELECTION
1514  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
1515  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
1516#endif
1517
1518  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
1519  Int       getPPSId        () { return m_iPPSId; }
1520  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
1521  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
1522  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
1523  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
1524  Void      setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; }       //!< set SAO Cb&Cr enabled flag
1525  Bool      getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; }        //!< get SAO Cb&Cr enabled flag
1526  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
1527  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
1528  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
1529
1530  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
1531  Int       getRPSidx          () { return m_iBDidx; }
1532  Int       getPrevPOC      ()                          { return  m_prevPOC;       }
1533  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
1534  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
1535  Int       getLastIDR()                                  { return m_iLastIDR; }
1536  SliceType getSliceType    ()                          { return  m_eSliceType;         }
1537  Int       getPOC          ()                          { return  m_iPOC;           }
1538  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
1539  Bool      getDependentSliceSegmentFlag() const        { return m_dependentSliceSegmentFlag; }
1540  void      setDependentSliceSegmentFlag(Bool val)      { m_dependentSliceSegmentFlag = val; }
1541#if ADAPTIVE_QP_SELECTION
1542  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
1543#endif
1544  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
1545  Int       getSliceQpDeltaCb ()                          { return  m_iSliceQpDeltaCb;      }
1546  Int       getSliceQpDeltaCr ()                          { return  m_iSliceQpDeltaCr;      }
1547  Bool      getDeblockingFilterDisable()                { return  m_deblockingFilterDisable; }
1548  Bool      getDeblockingFilterOverrideFlag()           { return  m_deblockingFilterOverrideFlag; }
1549  Int       getDeblockingFilterBetaOffsetDiv2()         { return  m_deblockingFilterBetaOffsetDiv2; }
1550  Int       getDeblockingFilterTcOffsetDiv2()           { return  m_deblockingFilterTcOffsetDiv2; }
1551
1552  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
1553  TComPic*  getPic              ()                              { return  m_pcPic;                      }
1554  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
1555  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
1556#if H_3D_GEN
1557  TComPic*  getIvPic            ( Bool depthFlag, Int viewIndex){ return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ]; }
1558#endif
1559#if H_3D_IV_MERGE
1560  TComPic*  getTexturePic       ()                              { return  m_ivPicsCurrPoc[0][ m_viewIndex ]; }
1561#endif
1562  Int       getDepth            ()                              { return  m_iDepth;                     }
1563  UInt      getColFromL0Flag    ()                              { return  m_colFromL0Flag;              }
1564  UInt      getColRefIdx        ()                              { return  m_colRefIdx;                  }
1565  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
1566  Bool      getIsUsedAsLongTerm (Int i, Int j)                  { return m_bIsUsedAsLongTerm[i][j]; }
1567  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
1568  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
1569#if H_MV  // This is a temporary fix of the temporary fix L0177
1570  Int       getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL );
1571#else
1572  Int       getNumRpsCurrTempList();
1573#endif
1574#if L0034_COMBINED_LIST_CLEANUP
1575  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
1576#else
1577  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
1578  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
1579  Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
1580  Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
1581  Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
1582  Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
1583  Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
1584  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
1585  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
1586#endif
1587  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
1588  Bool      isReferenced()                                      { return m_bRefenced; }
1589  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
1590  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
1591  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
1592  Bool      getRapPicFlag       (); 
1593  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
1594  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
1595  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
1596  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
1597  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
1598  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
1599#if ADAPTIVE_QP_SELECTION
1600  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
1601#endif
1602  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
1603  Void      setSliceQpDeltaCb   ( Int i )                       { m_iSliceQpDeltaCb   = i;      }
1604  Void      setSliceQpDeltaCr   ( Int i )                       { m_iSliceQpDeltaCr   = i;      }
1605  Void      setDeblockingFilterDisable( Bool b )                { m_deblockingFilterDisable= b;      }
1606  Void      setDeblockingFilterOverrideFlag( Bool b )           { m_deblockingFilterOverrideFlag = b; }
1607  Void      setDeblockingFilterBetaOffsetDiv2( Int i )          { m_deblockingFilterBetaOffsetDiv2 = i; }
1608  Void      setDeblockingFilterTcOffsetDiv2( Int i )            { m_deblockingFilterTcOffsetDiv2 = i; }
1609 
1610  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
1611  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
1612  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
1613  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
1614  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
1615 
1616#if H_MV
1617  Int       getRefLayerId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefLayerIdList[e][iRefIdx]; }
1618  Void      setRefLayerId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefLayerIdList[e][iRefIdx] = i; }
1619#endif
1620#if H_MV
1621  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false );
1622#else
1623#if FIX1071
1624  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
1625#else
1626  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
1627#endif
1628#endif
1629  Void      setRefPOCList       ();
1630  Void      setColFromL0Flag    ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; }
1631  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
1632  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
1633  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
1634
1635  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
1636  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
1637  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
1638 
1639#if SAO_CHROMA_LAMBDA 
1640  Void      setLambda( Double d, Double e ) { m_dLambdaLuma = d; m_dLambdaChroma = e;}
1641  Double    getLambdaLuma() { return m_dLambdaLuma;        }
1642  Double    getLambdaChroma() { return m_dLambdaChroma;        }
1643#else
1644  Void      setLambda( Double d ) { m_dLambda = d; }
1645  Double    getLambda() { return m_dLambda;        }
1646#endif
1647 
1648  Void      initEqualRef();
1649  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
1650  {
1651    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
1652    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
1653  }
1654 
1655  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
1656  {
1657    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
1658  }
1659 
1660  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
1661#if L0034_COMBINED_LIST_CLEANUP
1662  Void setList1IdxToList0Idx();
1663#else
1664  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
1665  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
1666  Void generateCombinedList       ();
1667#endif
1668
1669  UInt getTLayer             ()                            { return m_uiTLayer;                      }
1670  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
1671
1672  Void setTLayerInfo( UInt uiTLayer );
1673  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
1674  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1675#if H_MV
1676  Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
1677  static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer );
1678  static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
1679
1680
1681  Void xPrintRefPicList();
1682#endif
1683  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
1684  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
1685  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
1686  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
1687
1688  Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
1689  UInt getMaxNumMergeCand               ()                  { return m_maxNumMergeCand;                   }
1690
1691  Void setSliceMode                     ( UInt uiMode )     { m_sliceMode = uiMode;                     }
1692  UInt getSliceMode                     ()                  { return m_sliceMode;                       }
1693  Void setSliceArgument                 ( UInt uiArgument ) { m_sliceArgument = uiArgument;             }
1694  UInt getSliceArgument                 ()                  { return m_sliceArgument;                   }
1695  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_sliceCurStartCUAddr = uiAddr;           }
1696  UInt getSliceCurStartCUAddr           ()                  { return m_sliceCurStartCUAddr;             }
1697  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_sliceCurEndCUAddr = uiAddr;             }
1698  UInt getSliceCurEndCUAddr             ()                  { return m_sliceCurEndCUAddr;               }
1699  Void setSliceIdx                      ( UInt i)           { m_sliceIdx = i;                           }
1700  UInt getSliceIdx                      ()                  { return  m_sliceIdx;                       }
1701  Void copySliceInfo                    (TComSlice *pcSliceSrc);
1702  Void setSliceSegmentMode              ( UInt uiMode )     { m_sliceSegmentMode = uiMode;              }
1703  UInt getSliceSegmentMode              ()                  { return m_sliceSegmentMode;                }
1704  Void setSliceSegmentArgument          ( UInt uiArgument ) { m_sliceSegmentArgument = uiArgument;      }
1705  UInt getSliceSegmentArgument          ()                  { return m_sliceSegmentArgument;            }
1706  Void setSliceSegmentCurStartCUAddr    ( UInt uiAddr )     { m_sliceSegmentCurStartCUAddr = uiAddr;    }
1707  UInt getSliceSegmentCurStartCUAddr    ()                  { return m_sliceSegmentCurStartCUAddr;      }
1708  Void setSliceSegmentCurEndCUAddr      ( UInt uiAddr )     { m_sliceSegmentCurEndCUAddr = uiAddr;      }
1709  UInt getSliceSegmentCurEndCUAddr      ()                  { return m_sliceSegmentCurEndCUAddr;        }
1710  Void setNextSlice                     ( Bool b )          { m_nextSlice = b;                           }
1711  Bool isNextSlice                      ()                  { return m_nextSlice;                        }
1712  Void setNextSliceSegment              ( Bool b )          { m_nextSliceSegment = b;                    }
1713  Bool isNextSliceSegment               ()                  { return m_nextSliceSegment;                 }
1714  Void setSliceBits                     ( UInt uiVal )      { m_sliceBits = uiVal;                      }
1715  UInt getSliceBits                     ()                  { return m_sliceBits;                       } 
1716  Void setSliceSegmentBits              ( UInt uiVal )      { m_sliceSegmentBits = uiVal;            }
1717  UInt getSliceSegmentBits              ()                  { return m_sliceSegmentBits;             }
1718  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
1719  Bool getFinalized                     ()                  { return m_bFinalized;                        }
1720  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
1721  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
1722
1723  Void  resetWpScaling  ();
1724  Void  initWpScaling   ();
1725  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
1726
1727  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
1728  Void  getWpAcDcParam  ( wpACDCParam *&wp );
1729  Void  initWpAcDcParam ();
1730 
1731  Void setTileLocationCount             ( UInt cnt )               { return m_tileByteLocation.resize(cnt);    }
1732  UInt getTileLocationCount             ()                         { return (UInt) m_tileByteLocation.size();  }
1733  Void setTileLocation                  ( Int idx, UInt location ) { assert (idx<m_tileByteLocation.size());
1734                                                                     m_tileByteLocation[idx] = location;       }
1735  Void addTileLocation                  ( UInt location )          { m_tileByteLocation.push_back(location);   }
1736  UInt getTileLocation                  ( Int idx )                { return m_tileByteLocation[idx];           }
1737
1738  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
1739  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
1740  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
1741  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
1742  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
1743  TComScalingList*   getScalingList ()                               { return m_scalingList; }
1744  Void  setDefaultScalingList       ();
1745  Bool  checkDefaultScalingList     ();
1746  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
1747  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
1748  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
1749  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
1750  Bool      getTemporalLayerNonReferenceFlag()       { return m_temporalLayerNonReferenceFlag;}
1751  Void      setTemporalLayerNonReferenceFlag(Bool x) { m_temporalLayerNonReferenceFlag = x;}
1752  Void      setLFCrossSliceBoundaryFlag     ( Bool   val )    { m_LFCrossSliceBoundaryFlag = val; }
1753  Bool      getLFCrossSliceBoundaryFlag     ()                { return m_LFCrossSliceBoundaryFlag;} 
1754
1755  Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
1756  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
1757
1758#if H_MV
1759  Void      setLayerId            ( Int layerId )    { m_layerId      = layerId; }
1760  Int       getLayerId            ()                 { return m_layerId;    }
1761  Int       getLayerIdInVps       ()                 { return getVPS()->getLayerIdInVps( m_layerId ); }; 
1762  Void      setViewId             ( Int viewId )     { m_viewId = viewId;   }
1763  Int       getViewId             ()                 { return m_viewId;     }
1764#if H_3D
1765  Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
1766  Int       getViewIndex          ()                 { return m_viewIndex;     }
1767  Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
1768  Bool      getIsDepth            ()                 { return m_isDepth; }
1769  Void      setCamparaSlice       ( Int** aaiScale = 0, Int** aaiOffset = 0 );
1770  Int*      getCodedScale         ()  { return m_aaiCodedScale [0]; }
1771  Int*      getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
1772  Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
1773  Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
1774#endif
1775#endif
1776#if H_3D_GEN
1777  Void    setIvPicLists( TComPicLists* m_ivPicLists );
1778#endif
1779
1780protected:
1781  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
1782                         Int                 poc);
1783TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
1784#if H_MV
1785  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); 
1786#endif
1787};// END CLASS DEFINITION TComSlice
1788
1789
1790template <class T> class ParameterSetMap
1791{
1792public:
1793  ParameterSetMap(Int maxId)
1794  :m_maxId (maxId)
1795  {}
1796
1797  ~ParameterSetMap()
1798  {
1799    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
1800    {
1801      delete (*i).second;
1802    }
1803  }
1804
1805  Void storePS(Int psId, T *ps)
1806  {
1807    assert ( psId < m_maxId );
1808    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
1809    {
1810      delete m_paramsetMap[psId];
1811    }
1812    m_paramsetMap[psId] = ps; 
1813  }
1814
1815  Void mergePSList(ParameterSetMap<T> &rPsList)
1816  {
1817    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
1818    {
1819      storePS(i->first, i->second);
1820    }
1821    rPsList.m_paramsetMap.clear();
1822  }
1823
1824
1825  T* getPS(Int psId)
1826  {
1827    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
1828  }
1829
1830  T* getFirstPS()
1831  {
1832    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
1833  }
1834
1835private:
1836  std::map<Int,T *> m_paramsetMap;
1837  Int               m_maxId;
1838};
1839
1840class ParameterSetManager
1841{
1842public:
1843  ParameterSetManager();
1844  virtual ~ParameterSetManager();
1845
1846  //! store sequence parameter set and take ownership of it
1847  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
1848  //! get pointer to existing video parameter set 
1849  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
1850  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
1851 
1852  //! store sequence parameter set and take ownership of it
1853  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
1854  //! get pointer to existing sequence parameter set 
1855  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
1856  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
1857
1858  //! store picture parameter set and take ownership of it
1859  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
1860  //! get pointer to existing picture parameter set 
1861  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
1862  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
1863
1864  //! activate a SPS from a active parameter sets SEI message
1865  //! \returns true, if activation is successful
1866  Bool activateSPSWithSEI(Int SPSId);
1867
1868  //! activate a PPS and depending on isIDR parameter also SPS and VPS
1869  //! \returns true, if activation is successful
1870  Bool activatePPS(Int ppsId, Bool isIRAP);
1871
1872  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
1873  TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
1874  TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
1875
1876protected:
1877 
1878  ParameterSetMap<TComVPS> m_vpsMap;
1879  ParameterSetMap<TComSPS> m_spsMap; 
1880  ParameterSetMap<TComPPS> m_ppsMap;
1881
1882  Int m_activeVPSId;
1883  Int m_activeSPSId;
1884  Int m_activePPSId;
1885};
1886
1887//! \}
1888
1889#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.