source: 3DVCSoftware/branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComSlice.h @ 1317

Last change on this file since 1317 was 1317, checked in by tech, 9 years ago

Clean-ups. HLS.

  • Property svn:eol-style set to native
File size: 242.7 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-2015, 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#include "TComChromaFormat.h"
48
49//! \ingroup TLibCommon
50//! \{
51
52class TComPic;
53class TComTrQuant;
54#if NH_MV
55class TComDecodedRps;
56class TComPicLists; 
57class TComVPS; 
58class TComSPS; 
59#endif
60// ====================================================================================================================
61// Constants
62// ====================================================================================================================
63
64static const UInt REF_PIC_LIST_NUM_IDX=32;
65
66// ====================================================================================================================
67// Class definition
68// ====================================================================================================================
69
70/// Reference Picture Set class
71
72#if NH_MV
73class TComStRefPicSet
74{
75  // This class is currently only used by the decoder.
76  // TBD: Modify encoder to use also it.
77
78private: 
79
80  // Syntax elements:
81
82  Bool m_interRefPicSetPredictionFlag;
83  Int  m_deltaIdxMinus1;
84  Bool m_deltaRpsSign;
85  Int  m_absDeltaRpsMinus1;
86  Bool m_usedByCurrPicFlag  [ MAX_NUM_PICS_RPS ];
87  Bool m_useDeltaFlag       [ MAX_NUM_PICS_RPS ];
88  Int  m_numNegativePics;   
89  Int  m_numPositivePics;   
90  Int  m_deltaPocS0Minus1   [ MAX_NUM_PICS_RPS ];
91  Bool m_usedByCurrPicS0Flag[ MAX_NUM_PICS_RPS ];
92  Int  m_deltaPocS1Minus1   [ MAX_NUM_PICS_RPS ];
93  Bool m_usedByCurrPicS1Flag[ MAX_NUM_PICS_RPS ];
94
95  // Semantic variables:
96  Int m_deltaPocS0Var       [ MAX_NUM_PICS_RPS ];
97  Int m_deltaPocS1Var       [ MAX_NUM_PICS_RPS ];
98  Int m_usedByCurrPicS0Var  [ MAX_NUM_PICS_RPS ];
99  Int m_usedByCurrPicS1Var  [ MAX_NUM_PICS_RPS ];
100  Int m_numNegativePicsVar  ;
101  Int m_numPositivePicsVar  ;
102
103public:
104
105  TComStRefPicSet( )
106  {
107    // Set default inheritance values:
108    setInterRefPicSetPredictionFlag( false ); 
109    setDeltaIdxMinus1( 0 );
110    for (Int j = 0; j < MAX_NUM_PICS_RPS; j++)
111    {
112      setUseDeltaFlag( j, true  ); 
113    }   
114  }
115
116  // Syntax elements:
117  Void  setInterRefPicSetPredictionFlag( Bool flag )           { m_interRefPicSetPredictionFlag = flag; }
118  Bool  getInterRefPicSetPredictionFlag(  ) const              { return m_interRefPicSetPredictionFlag; }
119
120  Void  setDeltaIdxMinus1( Int  val )                          { m_deltaIdxMinus1 = val;                }
121  Int   getDeltaIdxMinus1(  ) const                            { return m_deltaIdxMinus1;               }
122
123  Void  setDeltaRpsSign( Bool flag )                           { m_deltaRpsSign = flag;                 }
124  Bool  getDeltaRpsSign(  ) const                              { return m_deltaRpsSign;                 }
125
126  Void  setAbsDeltaRpsMinus1( Int  val )                       { m_absDeltaRpsMinus1 = val;             }
127  Int   getAbsDeltaRpsMinus1(  ) const                         { return m_absDeltaRpsMinus1;            }
128
129  Void  setUsedByCurrPicFlag( Int j, Bool flag )               { m_usedByCurrPicFlag[j] = flag;         }
130  Bool  getUsedByCurrPicFlag( Int j ) const                    { return m_usedByCurrPicFlag[j];         }
131
132  Void  setUseDeltaFlag( Int j, Bool flag )                    { m_useDeltaFlag[j] = flag;              }
133  Bool  getUseDeltaFlag( Int j ) const                         { return m_useDeltaFlag[j];              }
134
135  Void  setNumNegativePics( Int  val )                         { m_numNegativePics = val;               }
136  Int   getNumNegativePics(  ) const                           { return m_numNegativePics;              }
137
138  Void  setNumPositivePics( Int  val )                         { m_numPositivePics = val;               }
139  Int   getNumPositivePics(  ) const                           { return m_numPositivePics;              }
140
141  Void  setDeltaPocS0Minus1( Int i, Int  val )                 { m_deltaPocS0Minus1[i] = val;           }
142  Int   getDeltaPocS0Minus1( Int i ) const                     { return m_deltaPocS0Minus1[i];          }
143
144  Void  setUsedByCurrPicS0Flag( Int i, Bool flag )             { m_usedByCurrPicS0Flag[i] = flag;       }
145  Bool  getUsedByCurrPicS0Flag( Int i ) const                  { return m_usedByCurrPicS0Flag[i];       }
146
147  Void  setDeltaPocS1Minus1( Int i, Int  val )                 { m_deltaPocS1Minus1[i] = val;           }
148  Int   getDeltaPocS1Minus1( Int i ) const                     { return m_deltaPocS1Minus1[i];          }
149
150  Void  setUsedByCurrPicS1Flag( Int i, Bool flag )             { m_usedByCurrPicS1Flag[i] = flag;       }
151  Bool  getUsedByCurrPicS1Flag( Int i ) const                  { return m_usedByCurrPicS1Flag[i];       }
152
153  // Semantics variables:
154  Int   getRefRpsIdx(Int stRpsIdx ) const                      { return ( stRpsIdx - (getDeltaIdxMinus1() +  1) ); }
155  Int   getDeltaRps()  const                                   { return (  ( 1 - 2 * getDeltaRpsSign() ) * ( getAbsDeltaRpsMinus1() + 1 ) ); }
156  Int   getNumDeltaPocs() const                                { return ( getNumNegativePicsVar() + getNumPositivePicsVar());    }
157
158  Void  setNumNegativePicsVar( Int  val )                      { m_numNegativePicsVar = val;            }
159  Int   getNumNegativePicsVar(  ) const                        { return m_numNegativePicsVar;           }
160
161  Void  setNumPositivePicsVar( Int  val )                      { m_numPositivePicsVar = val;            }
162  Int   getNumPositivePicsVar(  ) const                        { return m_numPositivePicsVar;           }
163
164  Void  setDeltaPocS0Var( Int i, Int  val )                    { m_deltaPocS0Var[i] = val;              }
165  Int   getDeltaPocS0Var( Int i ) const                        { return m_deltaPocS0Var[i];             }
166
167  Void  setUsedByCurrPicS0Var( Int i, Bool flag )              { m_usedByCurrPicS0Var[i] = flag;       }
168  Bool  getUsedByCurrPicS0Var( Int i ) const                   { return m_usedByCurrPicS0Var[i];       }
169
170  Void  setDeltaPocS1Var( Int i, Int  val )                    { m_deltaPocS1Var[i] = val;             }
171  Int   getDeltaPocS1Var( Int i ) const                        { return m_deltaPocS1Var[i];            }
172
173  Void  setUsedByCurrPicS1Var( Int i, Bool flag )              { m_usedByCurrPicS1Var[i] = flag;       }
174  Bool  getUsedByCurrPicS1Var( Int i ) const                   { return m_usedByCurrPicS1Var[i];       }
175
176  Void  inferRps( Int stRpsIdx, TComSPS* sps, Bool encoder );
177};
178
179#endif
180
181class TComReferencePictureSet
182{
183private:
184  Int  m_numberOfPictures;
185  Int  m_numberOfNegativePictures;
186  Int  m_numberOfPositivePictures;
187  Int  m_numberOfLongtermPictures;
188  Int  m_deltaPOC[MAX_NUM_REF_PICS];
189  Int  m_POC[MAX_NUM_REF_PICS];
190  Bool m_used[MAX_NUM_REF_PICS];
191  Bool m_interRPSPrediction;
192  Int  m_deltaRIdxMinus1;
193  Int  m_deltaRPS;
194  Int  m_numRefIdc;
195  Int  m_refIdc[MAX_NUM_REF_PICS+1];
196  Bool m_bCheckLTMSB[MAX_NUM_REF_PICS];
197  Int  m_pocLSBLT[MAX_NUM_REF_PICS];
198  Int  m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS];
199  Bool m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS];
200
201public:
202          TComReferencePictureSet();
203  virtual ~TComReferencePictureSet();
204  Int     getPocLSBLT(Int i) const                     { return m_pocLSBLT[i];               }
205  Void    setPocLSBLT(Int i, Int x)                    { m_pocLSBLT[i] = x;                  }
206  Int     getDeltaPocMSBCycleLT(Int i) const           { return m_deltaPOCMSBCycleLT[i];     }
207  Void    setDeltaPocMSBCycleLT(Int i, Int x)          { m_deltaPOCMSBCycleLT[i] = x;        }
208  Bool    getDeltaPocMSBPresentFlag(Int i) const       { return m_deltaPocMSBPresentFlag[i]; }
209  Void    setDeltaPocMSBPresentFlag(Int i, Bool x)     { m_deltaPocMSBPresentFlag[i] = x;    }
210  Void    setUsed(Int bufferNum, Bool used);
211  Void    setDeltaPOC(Int bufferNum, Int deltaPOC);
212  Void    setPOC(Int bufferNum, Int deltaPOC);
213  Void    setNumberOfPictures(Int numberOfPictures);
214  Void    setCheckLTMSBPresent(Int bufferNum, Bool b );
215  Bool    getCheckLTMSBPresent(Int bufferNum) const;
216
217  Int     getUsed(Int bufferNum) const;
218  Int     getDeltaPOC(Int bufferNum) const;
219  Int     getPOC(Int bufferNum) const;
220  Int     getNumberOfPictures() const;
221
222  Void    setNumberOfNegativePictures(Int number)      { m_numberOfNegativePictures = number; }
223  Int     getNumberOfNegativePictures() const          { return m_numberOfNegativePictures;   }
224  Void    setNumberOfPositivePictures(Int number)      { m_numberOfPositivePictures = number; }
225  Int     getNumberOfPositivePictures() const          { return m_numberOfPositivePictures;   }
226  Void    setNumberOfLongtermPictures(Int number)      { m_numberOfLongtermPictures = number; }
227  Int     getNumberOfLongtermPictures() const          { return m_numberOfLongtermPictures;   }
228
229  Void    setInterRPSPrediction(Bool flag)             { m_interRPSPrediction = flag;         }
230  Bool    getInterRPSPrediction() const                { return m_interRPSPrediction;         }
231  Void    setDeltaRIdxMinus1(Int x)                    { m_deltaRIdxMinus1 = x;               }
232  Int     getDeltaRIdxMinus1() const                   { return m_deltaRIdxMinus1;            }
233  Void    setDeltaRPS(Int x)                           { m_deltaRPS = x;                      }
234  Int     getDeltaRPS() const                          { return m_deltaRPS;                   }
235  Void    setNumRefIdc(Int x)                          { m_numRefIdc = x;                     }
236  Int     getNumRefIdc() const                         { return m_numRefIdc;                  }
237
238  Void    setRefIdc(Int bufferNum, Int refIdc);
239  Int     getRefIdc(Int bufferNum) const ;
240
241  Void    sortDeltaPOC();
242  Void    printDeltaPOC() const;
243
244#if NH_MV
245  Void checkMaxNumPics( Bool vpsExtensionFlag, Int maxNumPics, Int nuhLayerId, Int spsMaxDecPicBufferingMinus1 ) const;
246#endif
247
248};
249
250/// Reference Picture Set set class
251class TComRPSList
252{
253private:
254  std::vector<TComReferencePictureSet> m_referencePictureSets;
255
256public:
257                                 TComRPSList()                                            { }
258  virtual                        ~TComRPSList()                                           { }
259
260  Void                           create  (Int numberOfEntries)                            { m_referencePictureSets.resize(numberOfEntries);         }
261  Void                           destroy ()                                               { }
262
263
264  TComReferencePictureSet*       getReferencePictureSet(Int referencePictureSetNum)       { return &m_referencePictureSets[referencePictureSetNum]; }
265  const TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum) const { return &m_referencePictureSets[referencePictureSetNum]; }
266
267  Int                            getNumberOfReferencePictureSets() const                  { return Int(m_referencePictureSets.size());              }
268};
269
270/// SCALING_LIST class
271class TComScalingList
272{
273public:
274             TComScalingList();
275  virtual    ~TComScalingList()                                                 { }
276  Int*       getScalingListAddress(UInt sizeId, UInt listId)                    { return &(m_scalingListCoef[sizeId][listId][0]);            } //!< get matrix coefficient
277  const Int* getScalingListAddress(UInt sizeId, UInt listId) const              { return &(m_scalingListCoef[sizeId][listId][0]);            } //!< get matrix coefficient
278  Void       checkPredMode(UInt sizeId, UInt listId);
279
280  Void       setRefMatrixId(UInt sizeId, UInt listId, UInt u)                   { m_refMatrixId[sizeId][listId] = u;                         } //!< set reference matrix ID
281  UInt       getRefMatrixId(UInt sizeId, UInt listId) const                     { return m_refMatrixId[sizeId][listId];                      } //!< get reference matrix ID
282
283  const Int* getScalingListDefaultAddress(UInt sizeId, UInt listId);                                                                           //!< get default matrix coefficient
284  Void       processDefaultMatrix(UInt sizeId, UInt listId);
285
286  Void       setScalingListDC(UInt sizeId, UInt listId, UInt u)                 { m_scalingListDC[sizeId][listId] = u;                       } //!< set DC value
287  Int        getScalingListDC(UInt sizeId, UInt listId) const                   { return m_scalingListDC[sizeId][listId];                    } //!< get DC value
288
289  Void       setScalingListPredModeFlag(UInt sizeId, UInt listId, Bool bIsDPCM) { m_scalingListPredModeFlagIsDPCM[sizeId][listId] = bIsDPCM; }
290  Bool       getScalingListPredModeFlag(UInt sizeId, UInt listId) const         { return m_scalingListPredModeFlagIsDPCM[sizeId][listId];    }
291
292  Void       checkDcOfMatrix();
293  Void       processRefMatrix(UInt sizeId, UInt listId , UInt refListId );
294  Bool       xParseScalingList(Char* pchFile);
295#if NH_MV
296  Void       inferFrom                      ( const TComScalingList& srcScLi );
297#endif
298  Void       setDefaultScalingList();
299  Bool       checkDefaultScalingList();
300
301private:
302  Void       outputScalingLists(std::ostream &os) const;
303  Bool             m_scalingListPredModeFlagIsDPCM [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
304  Int              m_scalingListDC                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
305  UInt             m_refMatrixId                   [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
306  std::vector<Int> m_scalingListCoef               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
307};
308
309class ProfileTierLevel
310{
311  Int               m_profileSpace;
312  Level::Tier       m_tierFlag;
313  Profile::Name     m_profileIdc;
314  Bool              m_profileCompatibilityFlag[32];
315  Level::Name       m_levelIdc;
316
317  Bool              m_progressiveSourceFlag;
318  Bool              m_interlacedSourceFlag;
319  Bool              m_nonPackedConstraintFlag;
320  Bool              m_frameOnlyConstraintFlag;
321  UInt              m_bitDepthConstraintValue;
322  ChromaFormat      m_chromaFormatConstraintValue;
323  Bool              m_intraConstraintFlag;
324  Bool              m_onePictureOnlyConstraintFlag;
325  Bool              m_lowerBitRateConstraintFlag;
326#if NH_MV
327  Bool              m_max12bitConstraintFlag;
328  Bool              m_max10bitConstraintFlag;
329  Bool              m_max8bitConstraintFlag;
330  Bool              m_max422chromaConstraintFlag;
331  Bool              m_max420chromaConstraintFlag;
332  Bool              m_maxMonochromeConstraintFlag;
333  Bool              m_inbldFlag;
334#endif
335public:
336                ProfileTierLevel();
337
338  Int           getProfileSpace() const                     { return m_profileSpace;                }
339  Void          setProfileSpace(Int x)                      { m_profileSpace = x;                   }
340
341  Level::Tier   getTierFlag() const                         { return m_tierFlag;                    }
342  Void          setTierFlag(Level::Tier x)                  { m_tierFlag = x;                       }
343
344  Profile::Name getProfileIdc() const                       { return m_profileIdc;                  }
345  Void          setProfileIdc(Profile::Name x)              { m_profileIdc = x;                     }
346
347  Bool          getProfileCompatibilityFlag(Int i) const    { return m_profileCompatibilityFlag[i]; }
348  Void          setProfileCompatibilityFlag(Int i, Bool x)  { m_profileCompatibilityFlag[i] = x;    }
349
350  Level::Name   getLevelIdc() const                         { return m_levelIdc;                    }
351  Void          setLevelIdc(Level::Name x)                  { m_levelIdc = x;                       }
352
353  Bool          getProgressiveSourceFlag() const            { return m_progressiveSourceFlag;       }
354  Void          setProgressiveSourceFlag(Bool b)            { m_progressiveSourceFlag = b;          }
355
356  Bool          getInterlacedSourceFlag() const             { return m_interlacedSourceFlag;        }
357  Void          setInterlacedSourceFlag(Bool b)             { m_interlacedSourceFlag = b;           }
358
359  Bool          getNonPackedConstraintFlag() const          { return m_nonPackedConstraintFlag;     }
360  Void          setNonPackedConstraintFlag(Bool b)          { m_nonPackedConstraintFlag = b;        }
361
362  Bool          getFrameOnlyConstraintFlag() const          { return m_frameOnlyConstraintFlag;     }
363  Void          setFrameOnlyConstraintFlag(Bool b)          { m_frameOnlyConstraintFlag = b;        }
364
365  UInt          getBitDepthConstraint() const               { return m_bitDepthConstraintValue;     }
366  Void          setBitDepthConstraint(UInt bitDepth)        { m_bitDepthConstraintValue=bitDepth;   }
367
368  ChromaFormat  getChromaFormatConstraint() const           { return m_chromaFormatConstraintValue; }
369  Void          setChromaFormatConstraint(ChromaFormat fmt) { m_chromaFormatConstraintValue=fmt;    }
370
371  Bool          getIntraConstraintFlag() const              { return m_intraConstraintFlag;         }
372  Void          setIntraConstraintFlag(Bool b)              { m_intraConstraintFlag = b;            }
373
374  Bool          getOnePictureOnlyConstraintFlag() const     { return m_onePictureOnlyConstraintFlag;}
375  Void          setOnePictureOnlyConstraintFlag(Bool b)     { m_onePictureOnlyConstraintFlag = b;   }
376
377  Bool          getLowerBitRateConstraintFlag() const       { return m_lowerBitRateConstraintFlag;  }
378  Void          setLowerBitRateConstraintFlag(Bool b)       { m_lowerBitRateConstraintFlag = b;     }
379
380#if NH_MV
381  Void          setMax12bitConstraintFlag( Bool flag )      { m_max12bitConstraintFlag = flag;      }
382  Bool          getMax12bitConstraintFlag(  ) const         { return m_max12bitConstraintFlag;      }
383
384  Void          setMax10bitConstraintFlag( Bool flag )      { m_max10bitConstraintFlag = flag;      }
385  Bool          getMax10bitConstraintFlag(  ) const         { return m_max10bitConstraintFlag;      }
386
387  Void          setMax8bitConstraintFlag( Bool flag )       { m_max8bitConstraintFlag = flag;       }
388  Bool          getMax8bitConstraintFlag(  ) const          { return m_max8bitConstraintFlag;       }
389
390  Void          setMax422chromaConstraintFlag( Bool flag )  { m_max422chromaConstraintFlag = flag;  }
391  Bool          getMax422chromaConstraintFlag(  ) const     { return m_max422chromaConstraintFlag;  }
392
393  Void          setMax420chromaConstraintFlag( Bool flag )  { m_max420chromaConstraintFlag = flag;  }
394  Bool          getMax420chromaConstraintFlag(  ) const     { return m_max420chromaConstraintFlag;  }
395
396  Void          setMaxMonochromeConstraintFlag( Bool flag ) { m_maxMonochromeConstraintFlag = flag; }
397  Bool          getMaxMonochromeConstraintFlag(  ) const    { return m_maxMonochromeConstraintFlag; }
398
399  Void          setInbldFlag( Bool flag )                   { m_inbldFlag = flag;                   }
400  Bool          getInbldFlag(  ) const                      { return m_inbldFlag;                   }
401
402  Bool          getV2ConstraintsPresentFlag() const;
403  Bool          getInbldPresentFlag() const;
404
405  Void          copyV2ConstraintFlags( ProfileTierLevel* ptlRef );
406  Void          copyProfile( ProfileTierLevel* ptlRef );
407#endif
408
409};
410
411
412class TComPTL
413{
414  ProfileTierLevel m_generalPTL;
415#if !NH_MV
416  ProfileTierLevel m_subLayerPTL    [MAX_TLAYER-1];      // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 (= 6)
417  Bool m_subLayerProfilePresentFlag [MAX_TLAYER-1];
418  Bool m_subLayerLevelPresentFlag   [MAX_TLAYER-1];
419#else
420  ProfileTierLevel m_subLayerPTL    [MAX_TLAYER];        // However, highest index is 6, so we need one more.
421  Bool m_subLayerProfilePresentFlag [MAX_TLAYER];
422  Bool m_subLayerLevelPresentFlag   [MAX_TLAYER];
423#endif
424
425public:
426                          TComPTL();
427  Bool                    getSubLayerProfilePresentFlag(Int i) const   { return m_subLayerProfilePresentFlag[i]; }
428  Void                    setSubLayerProfilePresentFlag(Int i, Bool x) { m_subLayerProfilePresentFlag[i] = x;    }
429
430  Bool                    getSubLayerLevelPresentFlag(Int i) const     { return m_subLayerLevelPresentFlag[i];   }
431  Void                    setSubLayerLevelPresentFlag(Int i, Bool x)   { m_subLayerLevelPresentFlag[i] = x;      }
432
433  ProfileTierLevel*       getGeneralPTL()                              { return &m_generalPTL;                   }
434  const ProfileTierLevel* getGeneralPTL() const                        { return &m_generalPTL;                   }
435  ProfileTierLevel*       getSubLayerPTL(Int i)                        { return &m_subLayerPTL[i];               }
436  const ProfileTierLevel* getSubLayerPTL(Int i) const                  { return &m_subLayerPTL[i];               }
437
438#if NH_MV
439  Void                    inferGeneralValues ( Bool profilePresentFlag  , Int k, TComPTL* refPTL );; 
440  Void                    inferSubLayerValues( Int maxNumSubLayersMinus1, Int k, TComPTL* refPTL );; 
441#endif
442
443};
444
445/// VPS class
446
447struct HrdSubLayerInfo
448{
449  Bool fixedPicRateFlag;
450  Bool fixedPicRateWithinCvsFlag;
451  UInt picDurationInTcMinus1;
452  Bool lowDelayHrdFlag;
453  UInt cpbCntMinus1;
454  UInt bitRateValueMinus1[MAX_CPB_CNT][2];
455  UInt cpbSizeValue      [MAX_CPB_CNT][2];
456  UInt ducpbSizeValue    [MAX_CPB_CNT][2];
457  Bool cbrFlag           [MAX_CPB_CNT][2];
458  UInt duBitRateValue    [MAX_CPB_CNT][2];
459};
460
461class TComHRD
462{
463private:
464  Bool m_nalHrdParametersPresentFlag;
465  Bool m_vclHrdParametersPresentFlag;
466  Bool m_subPicCpbParamsPresentFlag;
467  UInt m_tickDivisorMinus2;
468  UInt m_duCpbRemovalDelayLengthMinus1;
469  Bool m_subPicCpbParamsInPicTimingSEIFlag;
470  UInt m_dpbOutputDelayDuLengthMinus1;
471  UInt m_bitRateScale;
472  UInt m_cpbSizeScale;
473  UInt m_ducpbSizeScale;
474  UInt m_initialCpbRemovalDelayLengthMinus1;
475  UInt m_cpbRemovalDelayLengthMinus1;
476  UInt m_dpbOutputDelayLengthMinus1;
477  HrdSubLayerInfo m_HRD[MAX_TLAYER];
478
479public:
480  TComHRD()
481  :m_nalHrdParametersPresentFlag       (0)
482  ,m_vclHrdParametersPresentFlag       (0)
483  ,m_subPicCpbParamsPresentFlag        (false)
484  ,m_tickDivisorMinus2                 (0)
485  ,m_duCpbRemovalDelayLengthMinus1     (0)
486  ,m_subPicCpbParamsInPicTimingSEIFlag (false)
487  ,m_dpbOutputDelayDuLengthMinus1      (0)
488  ,m_bitRateScale                      (0)
489  ,m_cpbSizeScale                      (0)
490  ,m_initialCpbRemovalDelayLengthMinus1(23)
491  ,m_cpbRemovalDelayLengthMinus1       (23)
492  ,m_dpbOutputDelayLengthMinus1        (23)
493  {}
494
495  virtual ~TComHRD() {}
496
497  Void    setNalHrdParametersPresentFlag( Bool flag )                                { m_nalHrdParametersPresentFlag = flag;                      }
498  Bool    getNalHrdParametersPresentFlag( ) const                                    { return m_nalHrdParametersPresentFlag;                      }
499
500  Void    setVclHrdParametersPresentFlag( Bool flag )                                { m_vclHrdParametersPresentFlag = flag;                      }
501  Bool    getVclHrdParametersPresentFlag( ) const                                    { return m_vclHrdParametersPresentFlag;                      }
502
503  Void    setSubPicCpbParamsPresentFlag( Bool flag )                                 { m_subPicCpbParamsPresentFlag = flag;                       }
504  Bool    getSubPicCpbParamsPresentFlag( ) const                                     { return m_subPicCpbParamsPresentFlag;                       }
505
506  Void    setTickDivisorMinus2( UInt value )                                         { m_tickDivisorMinus2 = value;                               }
507  UInt    getTickDivisorMinus2( ) const                                              { return m_tickDivisorMinus2;                                }
508
509  Void    setDuCpbRemovalDelayLengthMinus1( UInt value )                             { m_duCpbRemovalDelayLengthMinus1 = value;                   }
510  UInt    getDuCpbRemovalDelayLengthMinus1( ) const                                  { return m_duCpbRemovalDelayLengthMinus1;                    }
511
512  Void    setSubPicCpbParamsInPicTimingSEIFlag( Bool flag)                           { m_subPicCpbParamsInPicTimingSEIFlag = flag;                }
513  Bool    getSubPicCpbParamsInPicTimingSEIFlag( ) const                              { return m_subPicCpbParamsInPicTimingSEIFlag;                }
514
515  Void    setDpbOutputDelayDuLengthMinus1(UInt value )                               { m_dpbOutputDelayDuLengthMinus1 = value;                    }
516  UInt    getDpbOutputDelayDuLengthMinus1( ) const                                   { return m_dpbOutputDelayDuLengthMinus1;                     }
517
518  Void    setBitRateScale( UInt value )                                              { m_bitRateScale = value;                                    }
519  UInt    getBitRateScale( ) const                                                   { return m_bitRateScale;                                     }
520
521  Void    setCpbSizeScale( UInt value )                                              { m_cpbSizeScale = value;                                    }
522  UInt    getCpbSizeScale( ) const                                                   { return m_cpbSizeScale;                                     }
523  Void    setDuCpbSizeScale( UInt value )                                            { m_ducpbSizeScale = value;                                  }
524  UInt    getDuCpbSizeScale( ) const                                                 { return m_ducpbSizeScale;                                   }
525
526  Void    setInitialCpbRemovalDelayLengthMinus1( UInt value )                        { m_initialCpbRemovalDelayLengthMinus1 = value;              }
527  UInt    getInitialCpbRemovalDelayLengthMinus1( ) const                             { return m_initialCpbRemovalDelayLengthMinus1;               }
528
529  Void    setCpbRemovalDelayLengthMinus1( UInt value )                               { m_cpbRemovalDelayLengthMinus1 = value;                     }
530  UInt    getCpbRemovalDelayLengthMinus1( ) const                                    { return m_cpbRemovalDelayLengthMinus1;                      }
531
532  Void    setDpbOutputDelayLengthMinus1( UInt value )                                { m_dpbOutputDelayLengthMinus1 = value;                      }
533  UInt    getDpbOutputDelayLengthMinus1( ) const                                     { return m_dpbOutputDelayLengthMinus1;                       }
534
535  Void    setFixedPicRateFlag( Int layer, Bool flag )                                { m_HRD[layer].fixedPicRateFlag = flag;                      }
536  Bool    getFixedPicRateFlag( Int layer ) const                                     { return m_HRD[layer].fixedPicRateFlag;                      }
537
538  Void    setFixedPicRateWithinCvsFlag( Int layer, Bool flag )                       { m_HRD[layer].fixedPicRateWithinCvsFlag = flag;             }
539  Bool    getFixedPicRateWithinCvsFlag( Int layer ) const                            { return m_HRD[layer].fixedPicRateWithinCvsFlag;             }
540
541  Void    setPicDurationInTcMinus1( Int layer, UInt value )                          { m_HRD[layer].picDurationInTcMinus1 = value;                }
542  UInt    getPicDurationInTcMinus1( Int layer ) const                                { return m_HRD[layer].picDurationInTcMinus1;                 }
543
544  Void    setLowDelayHrdFlag( Int layer, Bool flag )                                 { m_HRD[layer].lowDelayHrdFlag = flag;                       }
545  Bool    getLowDelayHrdFlag( Int layer ) const                                      { return m_HRD[layer].lowDelayHrdFlag;                       }
546
547  Void    setCpbCntMinus1( Int layer, UInt value )                                   { m_HRD[layer].cpbCntMinus1 = value;                         }
548  UInt    getCpbCntMinus1( Int layer ) const                                         { return m_HRD[layer].cpbCntMinus1;                          }
549
550  Void    setBitRateValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl, UInt value )   { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; }
551  UInt    getBitRateValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl ) const         { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];  }
552
553  Void    setCpbSizeValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl, UInt value )   { m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value;       }
554  UInt    getCpbSizeValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl ) const         { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl];        }
555  Void    setDuCpbSizeValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;     }
556  UInt    getDuCpbSizeValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl ) const       { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];      }
557  Void    setDuBitRateValueMinus1( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;     }
558  UInt    getDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl ) const        { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];      }
559  Void    setCbrFlag( Int layer, Int cpbcnt, Int nalOrVcl, Bool value )              { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
560  Bool    getCbrFlag( Int layer, Int cpbcnt, Int nalOrVcl ) const                    { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
561
562  Bool    getCpbDpbDelaysPresentFlag( ) const                      { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
563};
564
565class TimingInfo
566{
567  Bool m_timingInfoPresentFlag;
568  UInt m_numUnitsInTick;
569  UInt m_timeScale;
570  Bool m_pocProportionalToTimingFlag;
571  Int  m_numTicksPocDiffOneMinus1;
572public:
573  TimingInfo()
574  : m_timingInfoPresentFlag      (false)
575  , m_numUnitsInTick             (1001)
576  , m_timeScale                  (60000)
577  , m_pocProportionalToTimingFlag(false)
578  , m_numTicksPocDiffOneMinus1   (0)
579  {}
580
581  Void setTimingInfoPresentFlag( Bool flag )   { m_timingInfoPresentFlag = flag;       }
582  Bool getTimingInfoPresentFlag( ) const       { return m_timingInfoPresentFlag;       }
583
584  Void setNumUnitsInTick( UInt value )         { m_numUnitsInTick = value;             }
585  UInt getNumUnitsInTick( ) const              { return m_numUnitsInTick;              }
586
587  Void setTimeScale( UInt value )              { m_timeScale = value;                  }
588  UInt getTimeScale( ) const                   { return m_timeScale;                   }
589
590  Void setPocProportionalToTimingFlag(Bool x)  { m_pocProportionalToTimingFlag = x;    }
591  Bool getPocProportionalToTimingFlag( ) const { return m_pocProportionalToTimingFlag; }
592
593  Void setNumTicksPocDiffOneMinus1(Int x)      { m_numTicksPocDiffOneMinus1 = x;       }
594  Int  getNumTicksPocDiffOneMinus1( ) const    { return m_numTicksPocDiffOneMinus1;    }
595};
596
597struct ChromaQpAdj
598{
599  union
600  {
601    struct {
602      Int CbOffset;
603      Int CrOffset;
604    } comp;
605    Int offset[2]; /* two chroma components */
606  } u;
607};
608
609#if NH_MV
610
611class TComVideoSignalInfo
612{
613private: 
614  Int  m_videoVpsFormat;
615  Bool m_videoFullRangeVpsFlag;
616  Int  m_colourPrimariesVps;
617  Int  m_transferCharacteristicsVps;
618  Int  m_matrixCoeffsVps;
619public: 
620  Void    setVideoVpsFormat( Int  val )                                              { m_videoVpsFormat = val;                                    }
621  Int     getVideoVpsFormat(  ) const                                                { return m_videoVpsFormat;                                   }
622
623  Void    setVideoFullRangeVpsFlag( Bool flag )                                      { m_videoFullRangeVpsFlag = flag;                            }
624  Bool    getVideoFullRangeVpsFlag(  ) const                                         { return m_videoFullRangeVpsFlag;                            }
625
626  Void    setColourPrimariesVps( Int  val )                                          { m_colourPrimariesVps = val;                                }
627  Int     getColourPrimariesVps(  ) const                                            { return m_colourPrimariesVps;                               }
628
629  Void    setTransferCharacteristicsVps( Int  val )                                  { m_transferCharacteristicsVps = val;                        }
630  Int     getTransferCharacteristicsVps(  ) const                                    { return m_transferCharacteristicsVps;                       }
631
632  Void    setMatrixCoeffsVps( Int  val )                                             { m_matrixCoeffsVps = val;                                   }
633  Int     getMatrixCoeffsVps(  ) const                                               { return m_matrixCoeffsVps;                                  }
634};
635
636class TComVpsVuiBspHrdParameters
637{
638  /* Not yet tested */
639private: 
640
641  Int       m_vpsNumAddHrdParams;
642  BoolAry1d m_cprmsAddPresentFlag;
643  std::vector<TComHRD> m_hrdParameters; 
644  IntAry1d  m_numSubLayerHrdMinus1;
645  IntAry1d  m_numSignalledPartitioningSchemes;
646  IntAry2d  m_numPartitionsInSchemeMinus1;
647
648  BoolAry4d m_layerIncludedInPartitionFlag;
649  IntAry3d  m_numBspSchedulesMinus1;
650  IntAry5d  m_bspHrdIdx;
651  IntAry5d  m_bspSchedIdx;
652   
653  // Array sizes
654  Int      m_offsetHrdParamIdx;
655  Int      m_numHrdParam; 
656  Int      m_numOls; 
657  TComVPS* m_vps; 
658public:     
659 
660  Void    createAfterVpsNumAddHrdParams( const TComVPS* vps );
661  Void    createAfterNumSignalledPartitioningSchemes(const TComVPS* vps, Int h );
662  Void    createAfterNumPartitionsInSchemeMinus1(const TComVPS* vps, Int h, Int j);
663  Void    createAfterNumBspSchedulesMinus1(const TComVPS* vps, Int h, Int i, Int t);
664
665  Void    setVpsNumAddHrdParams( Int  val )                                          { m_vpsNumAddHrdParams = val;                                }
666  Int     getVpsNumAddHrdParams(  ) const                                            { return m_vpsNumAddHrdParams;                               }
667
668  Void    setCprmsAddPresentFlag( Int i, Bool flag )                                 { m_cprmsAddPresentFlag[i - m_offsetHrdParamIdx] = flag;     }
669  Bool    getCprmsAddPresentFlag( Int i ) const                                      { return m_cprmsAddPresentFlag[- m_offsetHrdParamIdx];    }
670
671  Void    setNumSubLayerHrdMinus1( Int i, Int  val )                                 { m_numSubLayerHrdMinus1[- m_offsetHrdParamIdx] = val;    }
672  Int     getNumSubLayerHrdMinus1( Int i ) const                                     { return m_numSubLayerHrdMinus1[- m_offsetHrdParamIdx];   }
673
674  Void    setNumSignalledPartitioningSchemes( Int h, Int  val )                      { m_numSignalledPartitioningSchemes[h] = val;                }
675  Int     getNumSignalledPartitioningSchemes( Int h ) const                          { return m_numSignalledPartitioningSchemes[h];               }
676
677  Void    setNumPartitionsInSchemeMinus1( Int h, Int j, Int  val )                   { m_numPartitionsInSchemeMinus1[h][j] = val;                 }
678  Int     getNumPartitionsInSchemeMinus1( Int h, Int j ) const                       { return m_numPartitionsInSchemeMinus1[h][j];                }
679
680  Void    setLayerIncludedInPartitionFlag( Int h, Int j, Int k, Int r, Bool flag )   { m_layerIncludedInPartitionFlag[h][j][k][r] = flag;         }
681  Bool    getLayerIncludedInPartitionFlag( Int h, Int j, Int k, Int r ) const        { return m_layerIncludedInPartitionFlag[h][j][k][r];         }
682
683  Void    setNumBspSchedulesMinus1( Int h, Int i, Int t, Int  val )                  { m_numBspSchedulesMinus1[h][i][t] = val;                    }
684  Int     getNumBspSchedulesMinus1( Int h, Int i, Int t ) const                      { return m_numBspSchedulesMinus1[h][i][t];                   }
685
686  Void    setBspHrdIdx( Int h, Int i, Int t, Int j, Int k, Int  val )                { m_bspHrdIdx[h][- m_offsetHrdParamIdx][t][j][k] = val;   }
687  Int     getBspHrdIdx( Int h, Int i, Int t, Int j, Int k ) const                    { return m_bspHrdIdx[h][- m_offsetHrdParamIdx][t][j][k];  }
688
689  Int     getBspHrdIdxLen ( const TComVPS* vps ) const ;
690
691  Void    setBspSchedIdx( Int h, Int i, Int t, Int j, Int k, Int  val )              { m_bspSchedIdx[h][i - m_offsetHrdParamIdx][t][j][k] = val;  }
692  Int     getBspSchedIdx( Int h, Int i, Int t, Int j, Int k ) const                  { return m_bspSchedIdx[h][i - m_offsetHrdParamIdx][t][j][k]; }
693
694  Void    setHrdParametermeters( Int k, TComHRD val  )                               {  m_hrdParameters[k] = val;                                 }
695  const   TComHRD* getHrdParametermeters( Int k ) const                              {  return &m_hrdParameters[k];                               }
696};
697
698class TComVPSVUI
699{
700private:
701  Bool                               m_crossLayerPicTypeAlignedFlag          ;
702  Bool                               m_crossLayerIrapAlignedFlag             ;
703  Bool                               m_allLayersIdrAlignedFlag               ;
704  Bool                               m_bitRatePresentVpsFlag                 ;
705  Bool                               m_picRatePresentVpsFlag                 ;                                     
706  BoolAry2d                          m_bitRatePresentFlag                    ;
707  BoolAry2d                          m_picRatePresentFlag                    ;
708  IntAry2d                           m_avgBitRate                            ;
709  IntAry2d                           m_maxBitRate                            ;
710  IntAry2d                           m_constantPicRateIdc                    ;
711  IntAry2d                           m_avgPicRate                            ;
712  Bool                               m_videoSignalInfoIdxPresentFlag         ;
713  Int                                m_vpsNumVideoSignalInfoMinus1           ;
714  std::vector< TComVideoSignalInfo > m_videoSignalInfo                       ;
715  IntAry1d                           m_vpsVideoSignalInfoIdx                 ;
716  Bool                               m_tilesNotInUseFlag;                    ;
717  BoolAry1d                          m_tilesInUseFlag                        ; 
718  BoolAry1d                          m_loopFilterNotAcrossTilesFlag          ; 
719  BoolAry2d                          m_tileBoundariesAlignedFlag             ;
720  Bool                               m_wppNotInUseFlag                       ;             
721  BoolAry1d                          m_wppInUseFlag                          ;               
722  Bool                               m_singleLayerForNonIrapFlag             ;
723  Bool                               m_higherLayerIrapSkipFlag               ;
724  Bool                               m_ilpRestrictedRefLayersFlag            ;
725  IntAry2d                           m_minSpatialSegmentOffsetPlus1          ;
726  BoolAry2d                          m_ctuBasedOffsetEnabledFlag             ;
727  IntAry2d                           m_minHorizontalCtuOffsetPlus1           ;
728  Bool                               m_vpsVuiBspHrdPresentFlag               ;
729  TComVpsVuiBspHrdParameters         m_vpsVuiBspHrdParameters                ; 
730  BoolAry1d                          m_baseLayerParameterSetCompatibilityFlag;
731
732public: 
733
734  Void    init( Int numLayerSets, Int maxNumSubLayers, Int maxNumLayers );
735
736  Void    setCrossLayerPicTypeAlignedFlag( Bool flag )                               { m_crossLayerPicTypeAlignedFlag = flag;                     }
737  Bool    getCrossLayerPicTypeAlignedFlag(  ) const                                  { return m_crossLayerPicTypeAlignedFlag;                     }
738
739  Void    setCrossLayerIrapAlignedFlag( Bool flag )                                  { m_crossLayerIrapAlignedFlag = flag;                        }
740  Bool    getCrossLayerIrapAlignedFlag(  ) const                                     { return m_crossLayerIrapAlignedFlag;                        }
741
742  Void    setAllLayersIdrAlignedFlag( Bool flag )                                    { m_allLayersIdrAlignedFlag = flag;                          }
743  Bool    getAllLayersIdrAlignedFlag(  ) const                                       { return m_allLayersIdrAlignedFlag;                          }
744
745  Void    setBitRatePresentVpsFlag( Bool flag )                                      { m_bitRatePresentVpsFlag = flag;                            }
746  Bool    getBitRatePresentVpsFlag(  ) const                                         { return m_bitRatePresentVpsFlag;                            }
747
748  Void    setPicRatePresentVpsFlag( Bool flag )                                      { m_picRatePresentVpsFlag = flag;                            }
749  Bool    getPicRatePresentVpsFlag(  ) const                                         { return m_picRatePresentVpsFlag;                            }
750
751  Void    setBitRatePresentFlag( Int i, Int j, Bool flag )                           { m_bitRatePresentFlag[i][j] = flag;                         }
752  Bool    getBitRatePresentFlag( Int i, Int j ) const                                { return m_bitRatePresentFlag[i][j];                         }
753
754  Void    setPicRatePresentFlag( Int i, Int j, Bool flag )                           { m_picRatePresentFlag[i][j] = flag;                         }
755  Bool    getPicRatePresentFlag( Int i, Int j ) const                                { return m_picRatePresentFlag[i][j];                         }
756
757  Void    setAvgBitRate( Int i, Int j, Int  val )                                    { m_avgBitRate[i][j] = val;                                  }
758  Int     getAvgBitRate( Int i, Int j ) const                                        { return m_avgBitRate[i][j];                                 }
759
760  Void    setMaxBitRate( Int i, Int j, Int  val )                                    { m_maxBitRate[i][j] = val;                                  }
761  Int     getMaxBitRate( Int i, Int j ) const                                        { return m_maxBitRate[i][j];                                 }
762
763  Void    setConstantPicRateIdc( Int i, Int j, Int  val )                            { m_constantPicRateIdc[i][j] = val;                          }
764  Int     getConstantPicRateIdc( Int i, Int j ) const                                { return m_constantPicRateIdc[i][j];                         }
765
766  Void    setAvgPicRate( Int i, Int j, Int  val )                                    { m_avgPicRate[i][j] = val;                                  }
767  Int     getAvgPicRate( Int i, Int j ) const                                        { return m_avgPicRate[i][j];                                 }
768
769  Void    setVideoSignalInfoIdxPresentFlag( Bool flag )                              { m_videoSignalInfoIdxPresentFlag = flag;                    }
770  Bool    getVideoSignalInfoIdxPresentFlag(  ) const                                 { return m_videoSignalInfoIdxPresentFlag;                    }
771
772  Void    setVideoSignalInfo( std::vector<TComVideoSignalInfo> val )                  { m_videoSignalInfo = val;                                  }
773  const   TComVideoSignalInfo* getVideoSignalInfo( Int i ) const                      { return &m_videoSignalInfo[i];                             }
774
775  Void    setVpsNumVideoSignalInfoMinus1( Int  val )                                 { m_vpsNumVideoSignalInfoMinus1 = val;                       }
776  Int     getVpsNumVideoSignalInfoMinus1(  ) const                                   { return m_vpsNumVideoSignalInfoMinus1;                      }
777
778  Void    setVpsVideoSignalInfoIdx( Int i, Int  val )                                { m_vpsVideoSignalInfoIdx[i] = val;                          }
779  Int     getVpsVideoSignalInfoIdx( Int i ) const                                    { return m_vpsVideoSignalInfoIdx[i];                         }
780
781  Void    setTilesNotInUseFlag( Bool flag )                                          { m_tilesNotInUseFlag = flag;                                }
782  Bool    getTilesNotInUseFlag(  ) const                                             { return m_tilesNotInUseFlag;                                }
783
784  Void    setTilesInUseFlag( Int i, Bool flag )                                      { m_tilesInUseFlag[i] = flag;                                }
785  Bool    getTilesInUseFlag( Int i ) const                                           { return m_tilesInUseFlag[i];                                }
786
787  Void    setLoopFilterNotAcrossTilesFlag( Int i, Int  val )                         { m_loopFilterNotAcrossTilesFlag[i] = val;                   }
788  Bool    getLoopFilterNotAcrossTilesFlag( Int i ) const                             { return m_loopFilterNotAcrossTilesFlag[i];                  }
789
790  Void    setTileBoundariesAlignedFlag( Int i, Int j, Bool flag )                    { m_tileBoundariesAlignedFlag[i][j] = flag;                  }
791  Bool    getTileBoundariesAlignedFlag( Int i, Int j ) const                         { return m_tileBoundariesAlignedFlag[i][j];                  }
792
793  Void    setWppNotInUseFlag( Bool flag )                                            { m_wppNotInUseFlag = flag;                                  }
794  Bool    getWppNotInUseFlag(  ) const                                               { return m_wppNotInUseFlag;                                  }
795
796  Void    setWppInUseFlag( Int i, Bool flag )                                        { m_wppInUseFlag[i] = flag;                                  }
797  Bool    getWppInUseFlag( Int i ) const                                             { return m_wppInUseFlag[i];                                  }
798
799  Void    setSingleLayerForNonIrapFlag( Bool flag )                                  { m_singleLayerForNonIrapFlag = flag;                        }
800  Bool    getSingleLayerForNonIrapFlag(  ) const                                     { return m_singleLayerForNonIrapFlag;                        }
801
802  Void    setHigherLayerIrapSkipFlag( Bool flag )                                    { m_higherLayerIrapSkipFlag = flag;                          }
803  Bool    getHigherLayerIrapSkipFlag(  ) const                                       { return m_higherLayerIrapSkipFlag;                          }
804
805  Void    setIlpRestrictedRefLayersFlag( Bool flag )                                 { m_ilpRestrictedRefLayersFlag = flag;                       }
806  Bool    getIlpRestrictedRefLayersFlag(  ) const                                    { return m_ilpRestrictedRefLayersFlag;                       }
807
808  Void    setMinSpatialSegmentOffsetPlus1( Int i, Int j, Int  val )                  { m_minSpatialSegmentOffsetPlus1[i][j] = val;                }
809  Int     getMinSpatialSegmentOffsetPlus1( Int i, Int j ) const                      { return m_minSpatialSegmentOffsetPlus1[i][j];               }
810
811  Void    setCtuBasedOffsetEnabledFlag( Int i, Int j, Bool flag )                    { m_ctuBasedOffsetEnabledFlag[i][j] = flag;                  }
812  Bool    getCtuBasedOffsetEnabledFlag( Int i, Int j ) const                         { return m_ctuBasedOffsetEnabledFlag[i][j];                  }
813
814  Void    setMinHorizontalCtuOffsetPlus1( Int i, Int j, Int  val )                   { m_minHorizontalCtuOffsetPlus1[i][j] = val;                 }
815  Int     getMinHorizontalCtuOffsetPlus1( Int i, Int j ) const                       { return m_minHorizontalCtuOffsetPlus1[i][j];                }
816
817  Void    setVpsVuiBspHrdPresentFlag( Bool flag )                                    { m_vpsVuiBspHrdPresentFlag = flag;                          }
818  Bool    getVpsVuiBspHrdPresentFlag(  ) const                                       { return m_vpsVuiBspHrdPresentFlag;                          }
819
820  Void    setVpsVuiBspHrdParameters( TComVpsVuiBspHrdParameters val)                 {  m_vpsVuiBspHrdParameters = val;                           }
821  const   TComVpsVuiBspHrdParameters* getVpsVuiBspHrdParameters(  ) const            { return &m_vpsVuiBspHrdParameters;                          }
822
823  Void    setBaseLayerParameterSetCompatibilityFlag( Int i, Bool flag )              { m_baseLayerParameterSetCompatibilityFlag[i] = flag;        }
824  Bool    getBaseLayerParameterSetCompatibilityFlag( Int i ) const                   { return m_baseLayerParameterSetCompatibilityFlag[i];        }
825};
826
827class TComRepFormat
828{
829private:
830  Bool m_chromaAndBitDepthVpsPresentFlag;
831  Int  m_chromaFormatVpsIdc;
832  Bool m_separateColourPlaneVpsFlag;
833  Int  m_picWidthVpsInLumaSamples;
834  Int  m_picHeightVpsInLumaSamples;
835  Int  m_bitDepthVpsLumaMinus8;
836  Int  m_bitDepthVpsChromaMinus8;
837  Bool m_conformanceWindowVpsFlag;
838  Int  m_confWinVpsLeftOffset;
839  Int  m_confWinVpsRightOffset;
840  Int  m_confWinVpsTopOffset;
841  Int  m_confWinVpsBottomOffset;
842
843public: 
844
845  TComRepFormat()
846  { 
847    m_conformanceWindowVpsFlag = 0;
848    m_confWinVpsLeftOffset     = 0;
849    m_confWinVpsRightOffset    = 0;
850    m_confWinVpsTopOffset      = 0;
851    m_confWinVpsBottomOffset   = 0;
852  }; 
853
854  Void    setChromaAndBitDepthVpsPresentFlag( Bool flag )                            { m_chromaAndBitDepthVpsPresentFlag = flag;                  }
855  Bool    getChromaAndBitDepthVpsPresentFlag(  ) const                               { return m_chromaAndBitDepthVpsPresentFlag;                  }
856  Void    checkChromaAndBitDepthVpsPresentFlag( Int i ) const                        { assert( i != 0 || m_chromaAndBitDepthVpsPresentFlag );     } // The value of chroma_and_bit_depth_vps_present_flag of the first rep_format( ) syntax structure in the VPS shall be equal to 1.
857
858  Void    inferChromaAndBitDepth     ( const TComRepFormat* prevRepFormat );
859  Void    checkInferChromaAndBitDepth( const TComRepFormat* prevRepFormat ) const;
860
861  Void    setChromaFormatVpsIdc( Int  val )                                          { m_chromaFormatVpsIdc = val;                                }
862  Int     getChromaFormatVpsIdc(  ) const                                            { return m_chromaFormatVpsIdc;                               }
863
864  Void    setSeparateColourPlaneVpsFlag( Bool flag )                                 { m_separateColourPlaneVpsFlag = flag;                       }
865  Bool    getSeparateColourPlaneVpsFlag(  ) const                                    { return m_separateColourPlaneVpsFlag;                       }
866
867  Void    setPicWidthVpsInLumaSamples( Int  val )                                    { m_picWidthVpsInLumaSamples = val;                          }
868  Int     getPicWidthVpsInLumaSamples(  ) const                                      { return m_picWidthVpsInLumaSamples;                         }
869
870  Void    setPicHeightVpsInLumaSamples( Int  val )                                   { m_picHeightVpsInLumaSamples = val;                         }
871  Int     getPicHeightVpsInLumaSamples(  ) const                                     { return m_picHeightVpsInLumaSamples;                        }
872
873  Void    setBitDepthVpsLumaMinus8( Int  val )                                       { m_bitDepthVpsLumaMinus8 = val;                             }
874  Int     getBitDepthVpsLumaMinus8(  ) const                                         { return m_bitDepthVpsLumaMinus8;                            }
875
876  Void    setBitDepthVpsChromaMinus8( Int  val )                                     { m_bitDepthVpsChromaMinus8 = val;                           }
877  Int     getBitDepthVpsChromaMinus8(  ) const                                       { return m_bitDepthVpsChromaMinus8;                          }
878
879  Void    setConformanceWindowVpsFlag( Bool flag )                                   { m_conformanceWindowVpsFlag = flag;                         }
880  Bool    getConformanceWindowVpsFlag(  ) const                                      { return m_conformanceWindowVpsFlag;                         }
881
882  Void    setConfWinVpsLeftOffset( Int  val )                                        { m_confWinVpsLeftOffset = val;                              }
883  Int     getConfWinVpsLeftOffset(  ) const                                          { return m_confWinVpsLeftOffset;                             }
884
885  Void    setConfWinVpsRightOffset( Int  val )                                       { m_confWinVpsRightOffset = val;                             }
886  Int     getConfWinVpsRightOffset(  ) const                                         { return m_confWinVpsRightOffset;                            }
887
888  Void    setConfWinVpsTopOffset( Int  val )                                         { m_confWinVpsTopOffset = val;                               }
889  Int     getConfWinVpsTopOffset(  ) const                                           { return m_confWinVpsTopOffset;                              }
890
891  Void    setConfWinVpsBottomOffset( Int  val )                                      { m_confWinVpsBottomOffset = val;                            }
892  Int     getConfWinVpsBottomOffset(  ) const                                        { return m_confWinVpsBottomOffset;                           }
893};
894
895
896class TComDpbSize
897{
898private:
899  BoolAry1d  m_subLayerFlagInfoPresentFlag;
900  BoolAry2d  m_subLayerDpbInfoPresentFlag ;
901  IntAry3d   m_maxVpsDecPicBufferingMinus1;
902  IntAry2d   m_maxVpsNumReorderPics       ;
903  IntAry2d   m_maxVpsLatencyIncreasePlus1 ;
904
905public: 
906  TComDpbSize() {}; 
907
908  Void          init( Int numOutputLayerSets, Int maxNumLayerIds, Int maxNumSubLayers );
909
910  Void          setSubLayerFlagInfoPresentFlag( Int i, Bool flag )                   { m_subLayerFlagInfoPresentFlag[i] = flag;                   }
911  Bool          getSubLayerFlagInfoPresentFlag( Int i ) const                        { return m_subLayerFlagInfoPresentFlag[i];                   }
912
913  Void          setSubLayerDpbInfoPresentFlag( Int i, Int j, Bool flag )             { m_subLayerDpbInfoPresentFlag[i][j] = flag;                 }
914  Bool          getSubLayerDpbInfoPresentFlag( Int i, Int j ) const                  { return m_subLayerDpbInfoPresentFlag[i][j];                 }
915
916  Void          setMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j, Int  val )      { m_maxVpsDecPicBufferingMinus1[i][k][j] = val;              }
917  Int           getMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j ) const          { assert( m_maxVpsDecPicBufferingMinus1[i][k][j] >= 0 ); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
918
919  Void          setMaxVpsNumReorderPics( Int i, Int j, Int  val )                    { m_maxVpsNumReorderPics[i][j] = val;                        }
920  Int           getMaxVpsNumReorderPics( Int i, Int j ) const                        { return m_maxVpsNumReorderPics[i][j];                       }
921
922  Void          setMaxVpsLatencyIncreasePlus1( Int i, Int j, Int  val )              { m_maxVpsLatencyIncreasePlus1[i][j] = val;                  }
923  Int           getMaxVpsLatencyIncreasePlus1( Int i, Int j ) const                  { return m_maxVpsLatencyIncreasePlus1[i][j];                 } 
924  Int           getVpsMaxLatencyPictures     ( Int i, Int j ) const;
925};
926#endif
927
928class TComVPS
929{
930private:
931  Int                   m_VPSId;
932#if NH_MV
933  Bool                  m_vpsBaseLayerInternalFlag;
934  Bool                  m_vpsBaseLayerAvailableFlag;
935#endif
936
937  UInt                  m_uiMaxTLayers;
938
939#if NH_MV
940  UInt                  m_uiMaxLayersMinus1;
941#else
942  UInt                  m_uiMaxLayers;
943#endif
944  Bool                  m_bTemporalIdNestingFlag;
945
946  UInt                  m_numReorderPics[MAX_TLAYER];
947  UInt                  m_uiMaxDecPicBuffering[MAX_TLAYER];
948  UInt                  m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)
949
950  UInt                  m_numHrdParameters;
951#if NH_MV
952  UInt                  m_maxLayerId;
953#else
954  UInt                  m_maxNuhReservedZeroLayerId;
955#endif
956  std::vector<TComHRD>  m_hrdParameters;
957  std::vector<UInt>     m_hrdOpSetIdx;
958  std::vector<Bool>     m_cprmsPresentFlag;
959#if NH_MV
960  UInt                  m_vpsNumLayerSetsMinus1;
961  Bool                  m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_LAYER_ID_PLUS1];
962#else
963  UInt                  m_numOpSets;
964  Bool                  m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
965#endif
966
967#if NH_MV
968  TComPTL               m_pcPTL[MAX_VPS_OP_SETS_PLUS1];
969#else
970  TComPTL               m_pcPTL;
971#endif
972  TimingInfo            m_timingInfo;
973#if NH_MV
974  Bool                  m_vpsExtensionFlag;
975
976  /// VPS EXTENSION SYNTAX ELEMENTS
977  Int         m_vpsNonVuiExtensionLength;
978  Bool        m_splittingFlag;
979  Bool        m_scalabilityMaskFlag          [MAX_NUM_SCALABILITY_TYPES];
980  Int         m_dimensionIdLen           [MAX_NUM_SCALABILITY_TYPES];
981  Bool        m_vpsNuhLayerIdPresentFlag;
982  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
983  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
984
985  Int         m_viewIdLen;
986  Int         m_viewIdVal                [MAX_NUM_LAYERS];
987  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
988  Bool        m_vpsSubLayersMaxMinus1PresentFlag;
989  Int         m_subLayersVpsMaxMinus1    [MAX_NUM_LAYERS];
990  Bool        m_maxTidRefPresentFlag;
991  Int         m_maxTidIlRefPicsPlus1     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
992  Bool        m_allRefLayersActiveFlag;
993  Int         m_vpsNumProfileTierLevelMinus1;   
994  Bool        m_vpsProfilePresentFlag    [MAX_VPS_OP_SETS_PLUS1];
995
996  Int         m_numAddLayerSets;   
997  Int         m_highestLayerIdxPlus1     [MAX_VPS_ADD_OUTPUT_LAYER_SETS][MAX_NUM_LAYERS];
998  Int         m_numAddOlss;
999
1000  Int         m_defaultOutputLayerIdc;
1001
1002  Int         m_layerSetIdxForOlsMinus1  [MAX_VPS_OUTPUTLAYER_SETS]; 
1003  Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
1004  Int         m_profileTierLevelIdx      [MAX_VPS_OUTPUTLAYER_SETS ][MAX_NUM_LAYERS];
1005  Bool        m_altOutputLayerFlag       [MAX_VPS_OUTPUTLAYER_SETS];
1006  Bool        m_repFormatIdxPresentFlag;
1007
1008  Int         m_vpsNumRepFormatsMinus1;
1009  Int         m_vpsRepFormatIdx          [MAX_NUM_LAYERS];
1010
1011  std::vector<TComRepFormat> m_repFormat; 
1012  Bool        m_maxOneActiveRefLayerFlag;       
1013  Bool        m_vpsPocLsbAlignedFlag;
1014  Bool        m_pocLsbNotPresentFlag     [MAX_NUM_LAYERS];
1015
1016  TComDpbSize m_dpbSize; 
1017  Int         m_directDepTypeLenMinus2;         
1018  Bool        m_defaultDirectDependencyFlag;
1019  Int         m_defaultDirectDependencyType;
1020 
1021  Bool        m_vpsVuiPresentFlag;
1022  TComVPSVUI  m_vpsVUI; 
1023  Int         m_directDependencyType     [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];
1024
1025  // VPS EXTENSION SEMANTICS VARIABLES
1026  Int         m_layerIdInVps             [MAX_NUM_LAYERS   ];
1027  Int         m_dependencyFlag           [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
1028
1029  Int         m_numViews; 
1030  Int         m_numDirectRefLayers       [MAX_NUM_LAYERS];
1031  Int         m_idDirectRefLayer         [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
1032#if NH_3D
1033  Int         m_numRefListLayers         [MAX_NUM_LAYERS];
1034  Int         m_idRefListLayer           [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
1035#endif
1036
1037
1038  Int         m_numRefLayers             [MAX_NUM_LAYER_IDS]; 
1039  Int         m_idRefLayer               [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
1040
1041
1042  Int         m_numPredictedLayers       [MAX_NUM_LAYERS ]; 
1043  Int         m_idPredictedLayer         [MAX_NUM_LAYERS][MAX_NUM_LAYER_IDS];
1044  Int         m_numIndependentLayers; 
1045  Int         m_numLayersInTreePartition [MAX_NUM_LAYER_IDS];
1046  Int         m_treePartitionLayerIdList [MAX_NUM_LAYERS][MAX_NUM_LAYER_IDS];
1047  Bool        m_recursiveRefLayerFlag    [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS]; 
1048  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
1049 
1050  IntAry2d    m_targetDecLayerIdLists;   //[TargetOptLayerSetIdx][i]
1051  IntAry2d    m_targetOptLayerIdLists; 
1052  IntAry2d    m_layerSetLayerIdList; 
1053
1054  Int         m_numNecessaryLayers        [MAX_VPS_OUTPUTLAYER_SETS];
1055  Bool        m_necessaryLayerFlag        [MAX_VPS_OUTPUTLAYER_SETS][MAX_NUM_LAYERS]; 
1056
1057  Int         xGetDimBitOffset( Int j ) const;
1058  Void        xSetRefLayerFlags( Int currLayerId );
1059
1060  // VPS EXTENSION 2 SYNTAX ELEMENTS
1061#if NH_3D
1062  IntAry1d       m_numCp; 
1063  IntAry2d       m_cpRefVoi;
1064  BoolAry2d      m_cpPresentFlag; 
1065  Int            m_cpPrecision;
1066  BoolAry1d      m_cpInSliceSegmentHeaderFlag;
1067  IntAry3d       m_aaaiCodedScale ;
1068  IntAry3d       m_aaaiCodedOffset;
1069
1070  IntAry1d       m_viewOIdxList;
1071  BoolAry2d      m_viewCompLayerPresentFlag;
1072  IntAry2d       m_viewCompLayerId;
1073#endif
1074
1075#endif
1076
1077public:
1078                    TComVPS();
1079
1080  virtual           ~TComVPS();
1081
1082  Void              createHrdParamBuffer()
1083  {
1084    m_hrdParameters.resize(getNumHrdParameters());
1085    m_hrdOpSetIdx.resize(getNumHrdParameters());
1086    m_cprmsPresentFlag.resize(getNumHrdParameters());
1087  }
1088
1089  TComHRD*          getHrdParameters( UInt i )                           { return &m_hrdParameters[ i ];                                    }
1090  const TComHRD*    getHrdParameters( UInt i ) const                     { return &m_hrdParameters[ i ];                                    }
1091  UInt              getHrdOpSetIdx( UInt i ) const                       { return m_hrdOpSetIdx[ i ];                                       }
1092  Void              setHrdOpSetIdx( UInt val, UInt i )                   { m_hrdOpSetIdx[ i ] = val;                                        }
1093  Bool              getCprmsPresentFlag( UInt i ) const                  { return m_cprmsPresentFlag[ i ];                                  }
1094  Void              setCprmsPresentFlag( Bool val, UInt i )              { m_cprmsPresentFlag[ i ] = val;                                   }
1095
1096  Int               getVPSId() const                                     { return m_VPSId;                                                  }
1097  Void              setVPSId(Int i)                                      { m_VPSId = i;                                                     }
1098#if NH_MV
1099  Void              setVpsBaseLayerInternalFlag( Bool flag )             { m_vpsBaseLayerInternalFlag = flag;                               } 
1100  Bool              getVpsBaseLayerInternalFlag(  )           const      { return m_vpsBaseLayerInternalFlag;                               } 
1101  Void              setVpsBaseLayerAvailableFlag( Bool flag )            { m_vpsBaseLayerAvailableFlag = flag;                              } 
1102  Bool              getVpsBaseLayerAvailableFlag(  )          const      { return m_vpsBaseLayerAvailableFlag;                              } 
1103#endif
1104
1105  UInt              getMaxTLayers() const                                { return m_uiMaxTLayers;                                           }
1106  Void              setMaxTLayers(UInt t)                                { m_uiMaxTLayers = t;                                              }
1107#if NH_MV   
1108  UInt              getMaxSubLayersMinus1()            const             { return m_uiMaxTLayers - 1;   }  // For consistency with draft spec
1109  Void              setMaxSubLayersMinus1(UInt val)                      { m_uiMaxTLayers = (val + 1);  }
1110  UInt              getMaxLayersMinus1()               const             { return m_uiMaxLayersMinus1;  } 
1111  Void              setMaxLayersMinus1(UInt l)                           { m_uiMaxLayersMinus1 = l;     }
1112#else
1113
1114  UInt              getMaxLayers() const                                 { return m_uiMaxLayers;                                            }
1115  Void              setMaxLayers(UInt l)                                 { m_uiMaxLayers = l;                                               }
1116#endif
1117
1118  Bool              getTemporalNestingFlag() const                       { return m_bTemporalIdNestingFlag;                                 }
1119  Void              setTemporalNestingFlag(Bool t)                       { m_bTemporalIdNestingFlag = t;                                    }
1120
1121  Void              setNumReorderPics(UInt v, UInt tLayer)               { m_numReorderPics[tLayer] = v;                                    }
1122  UInt              getNumReorderPics(UInt tLayer) const                 { return m_numReorderPics[tLayer];                                 }
1123
1124  Void              setMaxDecPicBuffering(UInt v, UInt tLayer)           { assert(tLayer < MAX_TLAYER); m_uiMaxDecPicBuffering[tLayer] = v; }
1125  UInt              getMaxDecPicBuffering(UInt tLayer) const             { return m_uiMaxDecPicBuffering[tLayer];                           }
1126
1127  Void              setMaxLatencyIncrease(UInt v, UInt tLayer)           { m_uiMaxLatencyIncrease[tLayer] = v;                              }
1128  UInt              getMaxLatencyIncrease(UInt tLayer) const             { return m_uiMaxLatencyIncrease[tLayer];                           }
1129
1130  UInt              getNumHrdParameters() const                          { return m_numHrdParameters;                                       }
1131  Void              setNumHrdParameters(UInt v)                          { m_numHrdParameters = v;                                          }
1132#if NH_MV
1133  UInt              getVpsMaxLayerId()                           const   { return m_maxLayerId; }
1134  Void              setVpsMaxLayerId(UInt v)                             { m_maxLayerId = v;    }
1135                   
1136  UInt              getVpsNumLayerSetsMinus1()                   const   { return m_vpsNumLayerSetsMinus1; }
1137  Void              setVpsNumLayerSetsMinus1(UInt v)                     { m_vpsNumLayerSetsMinus1 = v;    }
1138#else 
1139  UInt              getMaxNuhReservedZeroLayerId() const                 { return m_maxNuhReservedZeroLayerId;                              }
1140  Void              setMaxNuhReservedZeroLayerId(UInt v)                 { m_maxNuhReservedZeroLayerId = v;                                 }
1141
1142  UInt              getMaxOpSets() const                                 { return m_numOpSets;                                              }
1143  Void              setMaxOpSets(UInt v)                                 { m_numOpSets = v;                                                 }
1144#endif
1145  Bool              getLayerIdIncludedFlag(UInt opsIdx, UInt id) const   { return m_layerIdIncludedFlag[opsIdx][id];                        }
1146  Void              setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id) { m_layerIdIncludedFlag[opsIdx][id] = v;                           }
1147
1148#if NH_MV
1149  TComPTL*          getPTL( Int idx = 0 )                                { return &m_pcPTL[idx];                                            }
1150  const TComPTL*    getPTL( Int idx = 0 ) const                          { return &m_pcPTL[idx];                                            }
1151#else
1152  TComPTL*          getPTL()                                             { return &m_pcPTL;                                                 }
1153  const TComPTL*    getPTL() const                                       { return &m_pcPTL;                                                 }
1154#endif
1155  TimingInfo*       getTimingInfo()                                      { return &m_timingInfo;                                            }
1156  const TimingInfo* getTimingInfo() const                                { return &m_timingInfo;                                            }
1157
1158#if NH_MV
1159  Void    setVpsExtensionFlag( Bool flag )                                      { m_vpsExtensionFlag = flag; } 
1160  Bool    getVpsExtensionFlag(  )                                   const       { return m_vpsExtensionFlag; } 
1161
1162  Void    setVpsNonVuiExtensionLength( Int  val )                               { m_vpsNonVuiExtensionLength = val; } 
1163  Int     getVpsNonVuiExtensionLength(  )                           const       { return m_vpsNonVuiExtensionLength; } 
1164 
1165  // VPS Extension
1166  Void    setSplittingFlag( Bool val )                                          { m_splittingFlag = val;  }
1167  Bool    getSplittingFlag()                                        const       { return m_splittingFlag; }
1168
1169  Void    setScalabilityMaskFlag( UInt val );
1170  Void    setScalabilityMaskFlag( Int scalType, Bool val )                          { m_scalabilityMaskFlag[scalType] = val;  }
1171  Bool    getScalabilityMaskFlag( Int scalType )                    const           { return m_scalabilityMaskFlag[scalType]; }
1172 
1173  Int     getNumScalabilityTypes( ) const;                               
1174
1175  Void    setDimensionIdLen( Int sIdx, Int val )                                { m_dimensionIdLen[sIdx] = val;  }
1176  Int     getDimensionIdLen( Int sIdx )                             const       { assert( m_dimensionIdLen[sIdx] > 0) ; return m_dimensionIdLen[sIdx]; } 
1177
1178  Void    setVpsNuhLayerIdPresentFlag( Bool val )                               { m_vpsNuhLayerIdPresentFlag = val; }
1179  Bool    getVpsNuhLayerIdPresentFlag()                             const       { return m_vpsNuhLayerIdPresentFlag; }
1180
1181  Void    setLayerIdInNuh( Int layerIdInVps, Int val )                          { m_layerIdInNuh[layerIdInVps] = val;  }
1182  Int     getLayerIdInNuh( Int layerIdInVps )                       const       { assert( m_layerIdInNuh[layerIdInVps] >= 0 ); return m_layerIdInNuh[layerIdInVps]; }
1183
1184  Bool    nuhLayerIdIncluded( Int layerIdinNuh )                    const       { return ( m_layerIdInVps[ layerIdinNuh ] > 0 );  }
1185
1186  Void    setDimensionId( Int layerIdInVps, Int scalIdx, Int val )              { m_dimensionId[layerIdInVps][scalIdx] = val;  }
1187  Int     getDimensionId( Int layerIdInVps, Int scalIdx )           const       { return m_dimensionId[layerIdInVps][scalIdx]; }
1188
1189  Void    setViewIdLen( Int  val )                                              { m_viewIdLen = val; } 
1190  Int     getViewIdLen(  )                                          const       { return m_viewIdLen; } 
1191
1192  Void    setViewIdVal( Int viewOrderIndex, Int  val )                          { m_viewIdVal[viewOrderIndex] = val; } 
1193  Int     getViewIdVal( Int viewOrderIndex )                        const       { return m_viewIdVal[viewOrderIndex]; } 
1194 
1195  Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val )       { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
1196  Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           const { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
1197 
1198  Void    setVpsSubLayersMaxMinus1PresentFlag( Bool flag )                      { m_vpsSubLayersMaxMinus1PresentFlag = flag; } 
1199  Bool    getVpsSubLayersMaxMinus1PresentFlag(  )                    const      { return m_vpsSubLayersMaxMinus1PresentFlag; } 
1200 
1201  Void    setSubLayersVpsMaxMinus1( Int i, Int  val )                           { m_subLayersVpsMaxMinus1[i] = val; } 
1202  Int     getSubLayersVpsMaxMinus1( Int i )                          const      { return m_subLayersVpsMaxMinus1[i]; } 
1203  Void    checkSubLayersVpsMaxMinus1( Int i )                        const      { assert( m_subLayersVpsMaxMinus1[i] >= 0 && m_subLayersVpsMaxMinus1[i] <= m_uiMaxTLayers - 1 ); }
1204
1205  Void    setMaxTidRefPresentFlag( Bool flag )                                  { m_maxTidRefPresentFlag = flag; } 
1206  Bool    getMaxTidRefPresentFlag(  )                                const      { return m_maxTidRefPresentFlag; } 
1207
1208  Void    setMaxTidIlRefPicsPlus1( Int i, Int j, Int  val )                     { m_maxTidIlRefPicsPlus1[i][j] = val; } 
1209  Int     getMaxTidIlRefPicsPlus1( Int i, Int j )                    const      { return m_maxTidIlRefPicsPlus1[i][j]; } 
1210 
1211  Void    setAllRefLayersActiveFlag( Bool flag )                                { m_allRefLayersActiveFlag = flag; } 
1212  Bool    getAllRefLayersActiveFlag(  )                              const      { return m_allRefLayersActiveFlag; } 
1213 
1214  Void    setVpsNumProfileTierLevelMinus1( Int val )                            { m_vpsNumProfileTierLevelMinus1 = val;  } 
1215  Int     getVpsNumProfileTierLevelMinus1( )                         const      { return m_vpsNumProfileTierLevelMinus1; } 
1216 
1217  Void    setVpsProfilePresentFlag( Int idx, Bool val )                         { m_vpsProfilePresentFlag[idx] = val;  }
1218  Bool    getVpsProfilePresentFlag( Int idx )                        const      { return m_vpsProfilePresentFlag[idx]; }
1219
1220  Void    setNumAddLayerSets( Int val )                                         { m_numAddLayerSets = val; } 
1221  Int     getNumAddLayerSets( )                                      const      { return m_numAddLayerSets; } 
1222 
1223  Void    setHighestLayerIdxPlus1( Int i, Int j, Int  val )                     { m_highestLayerIdxPlus1[i][j] = val; } 
1224  Int     getHighestLayerIdxPlus1( Int i, Int j )                    const      { return m_highestLayerIdxPlus1[i][j]; } 
1225
1226  Void    setNumAddOlss( Int  val )                                             { m_numAddOlss = val; } 
1227  Int     getNumAddOlss(  )                                          const      { return m_numAddOlss; } 
1228
1229  Void    setDefaultOutputLayerIdc( Int  val )                                  { m_defaultOutputLayerIdc = val; } 
1230  Int     getDefaultOutputLayerIdc(  )                               const      { return m_defaultOutputLayerIdc; }   
1231 
1232  Void    setLayerSetIdxForOlsMinus1( Int outLayerSetIdx, Int val )             { m_layerSetIdxForOlsMinus1[ outLayerSetIdx ]  = val; } 
1233  Int     getLayerSetIdxForOlsMinus1( Int outLayerSetIdx )           const      { return m_layerSetIdxForOlsMinus1[ outLayerSetIdx ]; } 
1234  Int     getLayerSetIdxForOlsMinus1Len( Int outLayerSetIdx )        const      { return gCeilLog2( getNumLayerSets() - 1 ); } 
1235
1236  Void    setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag )            { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; } 
1237  Bool    getOutputLayerFlag( Int outLayerSetIdx, Int i )            const      { return m_outputLayerFlag[ outLayerSetIdx ][ i ]; } 
1238
1239  Bool    inferOutputLayerFlag( Int i, Int j )                       const;
1240
1241  Void    setProfileTierLevelIdx( Int i, Int j, Int val )                       { m_profileTierLevelIdx[ i ][ j ] = val; }
1242  Int     getProfileTierLevelIdx( Int i, Int j )                     const      { return m_profileTierLevelIdx[ i ][ j ]; } 
1243  Int     inferProfileTierLevelIdx( Int i, Int j )                   const; 
1244                                                                     
1245  Void    setAltOutputLayerFlag( Int i, Bool flag )                             { m_altOutputLayerFlag[i] = flag; } 
1246  Bool    getAltOutputLayerFlag( Int i )                             const      { return m_altOutputLayerFlag[i]; } 
1247                                                                     
1248  Void    setRepFormatIdxPresentFlag( Bool flag )                               { m_repFormatIdxPresentFlag = flag; } 
1249  Bool    getRepFormatIdxPresentFlag(  )                             const      { return m_repFormatIdxPresentFlag; } 
1250                                                                     
1251  Void    setVpsNumRepFormatsMinus1( Int  val )                                 { m_vpsNumRepFormatsMinus1 = val; } 
1252  Int     getVpsNumRepFormatsMinus1(  )                              const      { return m_vpsNumRepFormatsMinus1; } 
1253                                                                     
1254  Void    setVpsRepFormatIdx( Int i, Int  val )                                 { m_vpsRepFormatIdx[i] = val; } 
1255  Int     getVpsRepFormatIdx( Int i )                                const      { return m_vpsRepFormatIdx[i]; } 
1256
1257  Int     inferVpsRepFormatIdx( Int i )                              const      { return std::min( i, getVpsNumRepFormatsMinus1()  );  }
1258
1259  Void    setRepFormat( Int i, TComRepFormat val )                              { m_repFormat[i] = val;  }
1260  Void    setRepFormat( std::vector<TComRepFormat> val )                        { m_repFormat = val;  }
1261  const TComRepFormat* getRepFormat( Int i )                         const      { return &m_repFormat[i]; }
1262                                                                     
1263  Void    setMaxOneActiveRefLayerFlag( Bool flag)                               { m_maxOneActiveRefLayerFlag = flag; } 
1264  Bool    getMaxOneActiveRefLayerFlag( )                             const      { return m_maxOneActiveRefLayerFlag; } 
1265                                                                     
1266  Void    setVpsPocLsbAlignedFlag( Bool flag )                                  { m_vpsPocLsbAlignedFlag = flag; } 
1267  Bool    getVpsPocLsbAlignedFlag(  )                                const      { return m_vpsPocLsbAlignedFlag; } 
1268                                                                     
1269  Void    setDpbSize( TComDpbSize val )                                         { m_dpbSize = val; } 
1270  const TComDpbSize * getDpbSize( )                                  const      { return &m_dpbSize; } 
1271                                                                     
1272                                                                     
1273  Void    setPocLsbNotPresentFlag( Int i, Bool flag )                           { m_pocLsbNotPresentFlag[i] = flag; } 
1274  Bool    getPocLsbNotPresentFlag( Int i )                           const      { return m_pocLsbNotPresentFlag[i]; } 
1275                                                                     
1276  Void    setDirectDepTypeLenMinus2( Int val)                                   { m_directDepTypeLenMinus2 = val; } 
1277  Int     getDirectDepTypeLenMinus2( )                               const      { return m_directDepTypeLenMinus2; } 
1278                                                                     
1279  Void    setDefaultDirectDependencyFlag( Bool flag )                           { m_defaultDirectDependencyFlag = flag; } 
1280  Bool    getDefaultDirectDependencyFlag(  )                         const      { return m_defaultDirectDependencyFlag; } 
1281                                                                     
1282  Void    setDefaultDirectDependencyType( Int  val )                            { m_defaultDirectDependencyType = val; } 
1283  Int     getDefaultDirectDependencyType(  )                         const      { return m_defaultDirectDependencyType; } 
1284 
1285  Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; } 
1286  Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps) const { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; } 
1287
1288  Void    setVpsVuiPresentFlag( Bool flag )                                     { m_vpsVuiPresentFlag = flag; } 
1289  Bool    getVpsVuiPresentFlag(  )                                   const      { return m_vpsVuiPresentFlag; } 
1290                                                         
1291  const TComVPSVUI* getVPSVUI(  )                                    const      { return &m_vpsVUI;  }
1292  Void  setVPSVUI( TComVPSVUI val )                                             { m_vpsVUI = val;  }
1293 
1294 // VPS EXTENSION SEMANTICS VARIABLES
1295  Void    setLayerIdInVps( Int layerIdInNuh, Int val )                          { m_layerIdInVps[layerIdInNuh] = val;  }
1296  Int     getLayerIdInVps( Int layerIdInNuh )                        const      { assert( m_layerIdInVps[layerIdInNuh] >= 0 ); return m_layerIdInVps[layerIdInNuh]; }
1297
1298  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType ) const ;
1299  Int     getViewId        ( Int layerIdInNuh )                 const           { return m_viewIdVal[ getViewIndex( layerIdInNuh )]; }
1300  Void    setRefLayers(); 
1301
1302  // To be aligned with spec naming, getViewIndex will be removed in future versions
1303  Int     getViewOrderIdx ( Int layerIdInNuh ) const                            { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
1304  Int     getViewIndex    ( Int layerIdInNuh ) const                            { return getViewOrderIdx( layerIdInNuh ); }   
1305  Int     getAuxId        ( Int layerIdInNuh ) const                            { return getScalabilityId( getLayerIdInVps(layerIdInNuh), AUX_ID  ); }   
1306  Int     getDependencyId ( Int layerIdInNuh ) const                            { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPENDENCY_ID  ); }   
1307  Int     getNumViews()                        const                            { return m_numViews; }
1308  Void    initNumViews();
1309#if NH_3D
1310  Void    initViewCompLayer( );
1311  Int     getViewOIdxList( Int i )             const                            { return m_viewOIdxList[i]; }
1312  std::vector<Int> getViewOIdxList( )          const                            { return m_viewOIdxList; }
1313
1314  Int     getVoiInVps( Int viewOIdx )          const;
1315
1316  Bool    getViewCompLayerPresentFlag (Int i, Bool d ) const                    { return  m_viewCompLayerPresentFlag[ getVoiInVps(i) ][d]; }
1317  Bool    getViewCompLayerId          (Int i, Bool d ) const                    { return  m_viewCompLayerId         [ getVoiInVps(i) ][d]; }
1318#endif
1319  Bool    getDependencyFlag( Int i, Int j ) const                               { return m_dependencyFlag[i][j]; }
1320  Int     getNumDirectRefLayers( Int layerIdInNuh ) const                       { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
1321#if NH_3D                                                                     
1322  Int     getNumRefListLayers( Int layerIdInNuh )   const                       { return m_numRefListLayers[ layerIdInNuh ];  };                               
1323#endif
1324
1325  Int     getNumRefLayers            ( Int i )      const                       { return m_numRefLayers[i]; } 
1326  Int     getNumPredictedLayers      ( Int i )      const                       { return m_numPredictedLayers[i]; } 
1327                                                                               
1328  Int     getIdRefLayer              ( Int i, Int j ) const                     { assert( j >= 0 && j < getNumRefLayers      ( i )); return m_idRefLayer      [i][j]; } 
1329  Int     getIdPredictedLayer        ( Int i, Int j ) const                     { assert( j >= 0 && j < getNumPredictedLayers( i )); return m_idPredictedLayer[i][j]; } 
1330  Int     getIdDirectRefLayer        ( Int i, Int j ) const                     { assert( j >= 0 && j < getNumDirectRefLayers( i )); return m_idDirectRefLayer[i][j]; } 
1331#if NH_3D                                                                     
1332  Int     getIdRefListLayer          ( Int i, Int j ) const                     { assert( j >= 0 && j < getNumRefListLayers   ( i )); return m_idRefListLayer[i][j]; } 
1333#endif                                                                         
1334  Int     getNumIndependentLayers    (  )             const                     { return m_numIndependentLayers; } 
1335  Int     getNumLayersInTreePartition( Int i )        const                     { return m_numLayersInTreePartition[i]; } 
1336  Int     getTreePartitionLayerIdList( Int i, Int j ) const                     { return m_treePartitionLayerIdList[i][j]; } 
1337  Bool    getRecursiveRefLayerFlag   ( Int i, Int j ) const                     { return m_recursiveRefLayerFlag[i][j]; } 
1338  Int     getNumLayerSets( )                          const                     { return getVpsNumLayerSetsMinus1() + 1 + getNumAddLayerSets();  }; 
1339                                                                               
1340  Int     getFirstAddLayerSetIdx()                    const                     { return getVpsNumLayerSetsMinus1() + 1; } 
1341  Int     getLastAddLayerSetIdx()                     const                     { return getFirstAddLayerSetIdx() + getNumAddLayerSets() - 1; }
1342  Bool    checkVPSExtensionSyntax(); 
1343  Int     scalTypeToScalIdx   ( ScalabilityType scalType ) const ;
1344
1345  Int     getProfileTierLevelIdxLen()                 const                     { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
1346  Int     getVpsRepFormatIdxLen()                     const                     { return gCeilLog2( getVpsNumRepFormatsMinus1() + 1 ); };       
1347
1348  Int     getNumLayersInIdList ( Int lsIdx )          const; 
1349  Int     getLayerSetLayerIdList(Int lsIdx, Int j )   const                     { return m_layerSetLayerIdList[ lsIdx ][ j ]; }; 
1350
1351  Int     getNumOutputLayerSets()                     const; 
1352
1353  Bool    isOutputLayer( Int outLayerSetIdx, Int layerIdInNuh )  const;   
1354  Void    deriveLayerSetLayerIdList();
1355
1356  Int     olsIdxToLsIdx( Int i )                                       const    { return ( i < getNumLayerSets() ) ? i  : getLayerSetIdxForOlsMinus1( i ) + 1 ; };
1357  Void    initTargetLayerIdLists  ( );
1358  Void    deriveTargetLayerIdList ( Int i );
1359  std::vector<Int> getTargetDecLayerIdList( Int targetDecLayerSetIdx ) const     { return m_targetDecLayerIdLists[targetDecLayerSetIdx]; }; 
1360  std::vector<Int> getTargetOptLayerIdList( Int targetOptLayerSetIdx ) const     { return m_targetOptLayerIdLists[targetOptLayerSetIdx]; }; 
1361
1362  Int     getNumOutputLayersInOutputLayerSet( Int i )                  const     { return (Int) getTargetOptLayerIdList( i ).size(); }; 
1363  Int     getOlsHighestOutputLayerId( Int i )                          const     { return getTargetOptLayerIdList( i ).back(); }; 
1364
1365  Void    deriveAddLayerSetLayerIdList( Int i );
1366  Void    deriveNecessaryLayerFlags( Int olsIdx );
1367  Int     getNecessaryLayerFlag( Int i, Int j )                        const     { AOF( i >= 0 && i < getNumOutputLayerSets() ); AOF( j >= 0 && j < getNumLayersInIdList( olsIdxToLsIdx( i ) )  );  return m_necessaryLayerFlag[i][j]; }; 
1368
1369  Int     getMaxSubLayersInLayerSetMinus1( Int i )                     const;
1370  Int     getHighestLayerIdxPlus1Len( Int j )                          const     { return gCeilLog2( getNumLayersInTreePartition( j ) + 1 );   }; 
1371  Bool    getAltOutputLayerFlagVar( Int i )                            const;
1372
1373  // inference
1374  Int     inferDimensionId     ( Int i, Int j )                        const;
1375  Int     inferLastDimsionIdLenMinus1()                                const;
1376
1377  // helpers
1378  Void    printPTL()                                                   const;
1379  Void    printLayerDependencies()                                     const;
1380  Void    printScalabilityId()                                         const;
1381  Void    printLayerSets()                                             const;
1382
1383
1384  /// VPS EXTENSION 2 SYNTAX ELEMENTS
1385  Int     getDepthId                   ( Int layerIdInNuh)             const    { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
1386#if NH_3D                                                             
1387  Bool    getVpsDepthFlag              ( Int layerIdInNuh)             const    { return (getDepthId( layerIdInNuh ) > 0);  }
1388  Int     getLayerIdInNuh              ( Int viewIndex, Bool depthFlag ) const;   
1389         
1390  Void    createCamPars                ( Int iNumViews ); 
1391  Void    initCamParaVPS               ( Int vOIdxInVps, Int numCp, Bool cpInSliceSegmentHeaderFlag, Int* cpRefVoi, Int** aaiScale, Int** aaiOffset );                                               
1392                                       
1393  Void    setCpPrecision               ( Int  val )                             { m_cpPrecision = val;                       }
1394  Int     getCpPrecision               (  )                            const    { return m_cpPrecision;                      }
1395                                                                                                               
1396  Void    setNumCp                     ( Int i, Int  val )                      { m_numCp[i] = val;                          }
1397  Int     getNumCp                     ( Int i )                       const    { return m_numCp[i];                         }
1398                                                                                                               
1399  Void    setCpRefVoi                  ( Int i, Int m, Int  val )               { m_cpRefVoi[i][m] = val;                    }
1400  Int     getCpRefVoi                  ( Int i, Int m )                const    { return m_cpRefVoi[i][m];                   }
1401                                                                                                               
1402  Void    setCpInSliceSegmentHeaderFlag( Int i, Bool flag )                     { m_cpInSliceSegmentHeaderFlag[i] = flag;    }
1403  Bool    getCpInSliceSegmentHeaderFlag( Int i )                       const    { return m_cpInSliceSegmentHeaderFlag[i];    }
1404                                                                                                               
1405  Void    setVpsCpScale                ( Int i, Int j, Int val )                { m_aaaiCodedScale [i][0][j] = val;          }
1406  Int     getVpsCpScale                ( Int i, Int j )                const    { return m_aaaiCodedScale[i][0][j];          }
1407                                                                                                               
1408  Void    setVpsCpOff                  ( Int i, Int j, Int val )                { m_aaaiCodedOffset[i][0][j] = val;          }
1409  Int     getVpsCpOff                  ( Int i, Int j )                const    { return m_aaaiCodedOffset[i][0][j];         }
1410                                                                                                               
1411  Void    setVpsCpInvScale             ( Int i, Int j, Int val )                { m_aaaiCodedScale[i][1][j] = val;           }
1412  Int     getVpsCpInvScale             ( Int i, Int j )                const    { return m_aaaiCodedScale[i][1][j];          }
1413                                                                                                               
1414  Void    setVpsCpInvOff               ( Int i, Int j, Int val )                { m_aaaiCodedOffset[i][1][j] = val;          }
1415  Int     getVpsCpInvOff               ( Int i, Int j )                const    { return m_aaaiCodedOffset[i][1][j];         }
1416
1417// Derived
1418  Void    deriveCpPresentFlag          ( );                 
1419  Void    setCpPresentFlag             ( Int i, Int m, Bool flag )              { m_cpPresentFlag[i][m] = flag;             } 
1420  Bool    getCpPresentFlag             ( Int i, Int m )                const    { return m_cpPresentFlag[i][m];             }   
1421                                                                       
1422  const IntAry1d& getCodedScale        ( Int viewIndex )               const    { return m_aaaiCodedScale [viewIndex][0];   }
1423  const IntAry1d& getCodedOffset       ( Int viewIndex )               const    { return m_aaaiCodedOffset[viewIndex][0];   }
1424  const IntAry1d& getInvCodedScale     ( Int viewIndex )               const    { return m_aaaiCodedScale [viewIndex][1];   }
1425  const IntAry1d& getInvCodedOffset    ( Int viewIndex )               const    { return m_aaaiCodedOffset[viewIndex][1];   }
1426#endif
1427
1428  template <typename T, typename S, typename U> Void xPrintArray( const Char* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const
1429  {
1430    std::cout << std::endl; 
1431    for (Int j = 0; j < numElemDim1; j++ )
1432    { 
1433      std::cout << std::right << std::setw(27) << name; 
1434      if (printIdx)
1435      {
1436        std::cout << "[" << std::right << std::setw(3) << idx[ j ] << "]" ; 
1437      }
1438      else
1439      {
1440        std::cout << std::right << std::setw(5) << " "; 
1441      }
1442
1443      if ( printNumber )
1444      {
1445        std::cout << " (" << std::right << std::setw(3) << numElemDim2[j] << ")";       
1446      }         
1447      else
1448      {
1449        std::cout << std::right << std::setw(6) << " ";             
1450      }
1451
1452      std::cout << ":";
1453      for (Int i = 0; i < numElemDim2[j]; i++)
1454      {
1455        std::cout << std::right << std::setw(3) << vec[j][i];
1456      }   
1457      std::cout << std::endl; 
1458    }
1459  }
1460
1461  template <typename T> Void xPrintArray( const char* name, Int numElem, T vec, Bool printNumber  )  const
1462  {
1463    std::vector<Int> numElemDim2(1, numElem);   
1464    std::vector<T>   vec2       (1,  vec    );
1465    std::vector<Int> idx2       (0); 
1466    xPrintArray( name, 1, idx2, numElemDim2, vec2, printNumber, false );
1467  }
1468
1469#endif
1470};
1471
1472#if NH_3D_DLT
1473class TComDLT
1474{
1475private:
1476  Bool              m_bDltPresentFlag;
1477  Bool              m_bUseDLTFlag                 [ MAX_NUM_LAYERS ];
1478  Bool              m_bInterViewDltPredEnableFlag [ MAX_NUM_LAYERS ];
1479  Bool              m_bDltBitMapRepFlag           [ MAX_NUM_LAYERS ];
1480
1481  Int               m_iNumDepthmapValues          [ MAX_NUM_LAYERS ];
1482  std::vector<Int>  m_iDepthValue2Idx             [ MAX_NUM_LAYERS ];
1483  std::vector<Int>  m_iIdx2DepthValue             [ MAX_NUM_LAYERS ];
1484
1485  Int               m_iNumDepthViews;
1486  UInt              m_uiDepthViewBitDepth;
1487 
1488  // mapping
1489  Int               m_iDepthIdxToLayerId          [ MAX_NUM_LAYERS ];
1490
1491public:
1492  TComDLT();
1493  ~TComDLT();
1494 
1495  Int     getDepthIdxToLayerId(Int depthIdx) const        { return m_iDepthIdxToLayerId[depthIdx]; }
1496  Void    setDepthIdxToLayerId(Int depthIdx, Int layerId) { m_iDepthIdxToLayerId[depthIdx] = layerId; }
1497
1498  Bool    getDltPresentFlag  ()                           const   { return m_bDltPresentFlag; }
1499  Void    setDltPresentFlag  ( Bool b )                   { m_bDltPresentFlag = b;    }
1500
1501  Bool    getUseDLTFlag      ( Int layerIdInVps )         const   { return m_bUseDLTFlag[ layerIdInVps ]; }
1502  Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;   }
1503 
1504  Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         const   { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
1505  Void    setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b;    }
1506 
1507  Bool    getUseBitmapRep      ( Int layerIdInVps )         const   { return m_bDltBitMapRepFlag[ layerIdInVps ]; }
1508  Void    setUseBitmapRep      ( Int layerIdInVps, Bool b ) { m_bDltBitMapRepFlag[ layerIdInVps ]  = b;   }
1509
1510  Void    setNumDepthViews   ( Int n )                    { m_iNumDepthViews = n; }
1511  Int     getNumDepthViews   ()                           const   { return m_iNumDepthViews; }
1512
1513  Void    setDepthViewBitDepth( UInt n )                  { m_uiDepthViewBitDepth = n; }
1514  UInt    getDepthViewBitDepth()                          const   { return m_uiDepthViewBitDepth; }
1515
1516  Int     getNumDepthValues( Int layerIdInVps )           const   { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:(1 << m_uiDepthViewBitDepth); }
1517  Int     depthValue2idx( Int layerIdInVps, Pel value )   const   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
1518  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  const   { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipBD(uiIdx,m_uiDepthViewBitDepth)]:uiIdx; }
1519  Void    setDepthLUTs( Int layerIdInVps, std::vector<Int> idx2DepthValue, Int iNumDepthValues = 0 );
1520  std::vector<Int>    idx2DepthValue( Int layerIdInVps )  const   { return m_iIdx2DepthValue[layerIdInVps]; }
1521  Void    getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt& ruiDeltaDLTOutNum ) const;
1522  Void    setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum );
1523};
1524#endif
1525
1526
1527class Window
1528{
1529private:
1530  Bool m_enabledFlag;
1531  Int  m_winLeftOffset;
1532  Int  m_winRightOffset;
1533  Int  m_winTopOffset;
1534  Int  m_winBottomOffset;
1535#if NH_MV
1536  Bool          m_scaledFlag; 
1537#endif
1538public:
1539  Window()
1540  : m_enabledFlag    (false)
1541  , m_winLeftOffset  (0)
1542  , m_winRightOffset (0)
1543  , m_winTopOffset   (0)
1544  , m_winBottomOffset(0)
1545#if NH_MV
1546  , m_scaledFlag(true)
1547#endif
1548  { }
1549
1550  Bool getWindowEnabledFlag() const   { return m_enabledFlag;                          }
1551  Int  getWindowLeftOffset() const    { return m_enabledFlag ? m_winLeftOffset : 0;    }
1552  Void setWindowLeftOffset(Int val)   { m_winLeftOffset = val; m_enabledFlag = true;   }
1553  Int  getWindowRightOffset() const   { return m_enabledFlag ? m_winRightOffset : 0;   }
1554  Void setWindowRightOffset(Int val)  { m_winRightOffset = val; m_enabledFlag = true;  }
1555  Int  getWindowTopOffset() const     { return m_enabledFlag ? m_winTopOffset : 0;     }
1556  Void setWindowTopOffset(Int val)    { m_winTopOffset = val; m_enabledFlag = true;    }
1557  Int  getWindowBottomOffset() const  { return m_enabledFlag ? m_winBottomOffset: 0;   }
1558  Void setWindowBottomOffset(Int val) { m_winBottomOffset = val; m_enabledFlag = true; }
1559
1560#if NH_MV
1561  Void          setScaledFlag(Bool flag)          { m_scaledFlag = flag;  } 
1562  Bool          getScaledFlag() const             { return m_scaledFlag;  } 
1563  Void          scaleOffsets( Int scal );
1564#endif
1565  Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
1566  {
1567    m_enabledFlag     = true;
1568    m_winLeftOffset   = offsetLeft;
1569    m_winRightOffset  = offsetLRight;
1570    m_winTopOffset    = offsetLTop;
1571    m_winBottomOffset = offsetLBottom;
1572  }
1573};
1574
1575
1576class TComVUI
1577{
1578private:
1579  Bool       m_aspectRatioInfoPresentFlag;
1580  Int        m_aspectRatioIdc;
1581  Int        m_sarWidth;
1582  Int        m_sarHeight;
1583  Bool       m_overscanInfoPresentFlag;
1584  Bool       m_overscanAppropriateFlag;
1585  Bool       m_videoSignalTypePresentFlag;
1586  Int        m_videoFormat;
1587  Bool       m_videoFullRangeFlag;
1588  Bool       m_colourDescriptionPresentFlag;
1589  Int        m_colourPrimaries;
1590  Int        m_transferCharacteristics;
1591  Int        m_matrixCoefficients;
1592  Bool       m_chromaLocInfoPresentFlag;
1593  Int        m_chromaSampleLocTypeTopField;
1594  Int        m_chromaSampleLocTypeBottomField;
1595  Bool       m_neutralChromaIndicationFlag;
1596  Bool       m_fieldSeqFlag;
1597  Window     m_defaultDisplayWindow;
1598  Bool       m_frameFieldInfoPresentFlag;
1599  Bool       m_hrdParametersPresentFlag;
1600  Bool       m_bitstreamRestrictionFlag;
1601  Bool       m_tilesFixedStructureFlag;
1602  Bool       m_motionVectorsOverPicBoundariesFlag;
1603  Bool       m_restrictedRefPicListsFlag;
1604  Int        m_minSpatialSegmentationIdc;
1605  Int        m_maxBytesPerPicDenom;
1606  Int        m_maxBitsPerMinCuDenom;
1607  Int        m_log2MaxMvLengthHorizontal;
1608  Int        m_log2MaxMvLengthVertical;
1609  TComHRD    m_hrdParameters;
1610  TimingInfo m_timingInfo;
1611
1612public:
1613  TComVUI()
1614    : m_aspectRatioInfoPresentFlag        (false) //TODO: This initialiser list contains magic numbers
1615    , m_aspectRatioIdc                    (0)
1616    , m_sarWidth                          (0)
1617    , m_sarHeight                         (0)
1618    , m_overscanInfoPresentFlag           (false)
1619    , m_overscanAppropriateFlag           (false)
1620    , m_videoSignalTypePresentFlag        (false)
1621    , m_videoFormat                       (5)
1622    , m_videoFullRangeFlag                (false)
1623    , m_colourDescriptionPresentFlag      (false)
1624    , m_colourPrimaries                   (2)
1625    , m_transferCharacteristics           (2)
1626    , m_matrixCoefficients                (2)
1627    , m_chromaLocInfoPresentFlag          (false)
1628    , m_chromaSampleLocTypeTopField       (0)
1629    , m_chromaSampleLocTypeBottomField    (0)
1630    , m_neutralChromaIndicationFlag       (false)
1631    , m_fieldSeqFlag                      (false)
1632    , m_frameFieldInfoPresentFlag         (false)
1633    , m_hrdParametersPresentFlag          (false)
1634    , m_bitstreamRestrictionFlag          (false)
1635    , m_tilesFixedStructureFlag           (false)
1636    , m_motionVectorsOverPicBoundariesFlag(true)
1637    , m_restrictedRefPicListsFlag         (1)
1638    , m_minSpatialSegmentationIdc         (0)
1639    , m_maxBytesPerPicDenom               (2)
1640    , m_maxBitsPerMinCuDenom              (1)
1641    , m_log2MaxMvLengthHorizontal         (15)
1642    , m_log2MaxMvLengthVertical           (15)
1643  {}
1644
1645  virtual           ~TComVUI() {}
1646
1647  Bool              getAspectRatioInfoPresentFlag() const                  { return m_aspectRatioInfoPresentFlag;           }
1648  Void              setAspectRatioInfoPresentFlag(Bool i)                  { m_aspectRatioInfoPresentFlag = i;              }
1649
1650  Int               getAspectRatioIdc() const                              { return m_aspectRatioIdc;                       }
1651  Void              setAspectRatioIdc(Int i)                               { m_aspectRatioIdc = i;                          }
1652
1653  Int               getSarWidth() const                                    { return m_sarWidth;                             }
1654  Void              setSarWidth(Int i)                                     { m_sarWidth = i;                                }
1655
1656  Int               getSarHeight() const                                   { return m_sarHeight;                            }
1657  Void              setSarHeight(Int i)                                    { m_sarHeight = i;                               }
1658
1659  Bool              getOverscanInfoPresentFlag() const                     { return m_overscanInfoPresentFlag;              }
1660  Void              setOverscanInfoPresentFlag(Bool i)                     { m_overscanInfoPresentFlag = i;                 }
1661
1662  Bool              getOverscanAppropriateFlag() const                     { return m_overscanAppropriateFlag;              }
1663  Void              setOverscanAppropriateFlag(Bool i)                     { m_overscanAppropriateFlag = i;                 }
1664
1665  Bool              getVideoSignalTypePresentFlag() const                  { return m_videoSignalTypePresentFlag;           }
1666  Void              setVideoSignalTypePresentFlag(Bool i)                  { m_videoSignalTypePresentFlag = i;              }
1667
1668  Int               getVideoFormat() const                                 { return m_videoFormat;                          }
1669  Void              setVideoFormat(Int i)                                  { m_videoFormat = i;                             }
1670
1671  Bool              getVideoFullRangeFlag() const                          { return m_videoFullRangeFlag;                   }
1672  Void              setVideoFullRangeFlag(Bool i)                          { m_videoFullRangeFlag = i;                      }
1673
1674  Bool              getColourDescriptionPresentFlag() const                { return m_colourDescriptionPresentFlag;         }
1675  Void              setColourDescriptionPresentFlag(Bool i)                { m_colourDescriptionPresentFlag = i;            }
1676
1677  Int               getColourPrimaries() const                             { return m_colourPrimaries;                      }
1678  Void              setColourPrimaries(Int i)                              { m_colourPrimaries = i;                         }
1679
1680  Int               getTransferCharacteristics() const                     { return m_transferCharacteristics;              }
1681  Void              setTransferCharacteristics(Int i)                      { m_transferCharacteristics = i;                 }
1682
1683  Int               getMatrixCoefficients() const                          { return m_matrixCoefficients;                   }
1684  Void              setMatrixCoefficients(Int i)                           { m_matrixCoefficients = i;                      }
1685
1686  Bool              getChromaLocInfoPresentFlag() const                    { return m_chromaLocInfoPresentFlag;             }
1687  Void              setChromaLocInfoPresentFlag(Bool i)                    { m_chromaLocInfoPresentFlag = i;                }
1688
1689  Int               getChromaSampleLocTypeTopField() const                 { return m_chromaSampleLocTypeTopField;          }
1690  Void              setChromaSampleLocTypeTopField(Int i)                  { m_chromaSampleLocTypeTopField = i;             }
1691
1692  Int               getChromaSampleLocTypeBottomField() const              { return m_chromaSampleLocTypeBottomField;       }
1693  Void              setChromaSampleLocTypeBottomField(Int i)               { m_chromaSampleLocTypeBottomField = i;          }
1694
1695  Bool              getNeutralChromaIndicationFlag() const                 { return m_neutralChromaIndicationFlag;          }
1696  Void              setNeutralChromaIndicationFlag(Bool i)                 { m_neutralChromaIndicationFlag = i;             }
1697
1698  Bool              getFieldSeqFlag() const                                { return m_fieldSeqFlag;                         }
1699  Void              setFieldSeqFlag(Bool i)                                { m_fieldSeqFlag = i;                            }
1700
1701  Bool              getFrameFieldInfoPresentFlag() const                   { return m_frameFieldInfoPresentFlag;            }
1702  Void              setFrameFieldInfoPresentFlag(Bool i)                   { m_frameFieldInfoPresentFlag = i;               }
1703
1704  Window&           getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;                 }
1705  const Window&     getDefaultDisplayWindow() const                        { return m_defaultDisplayWindow;                 }
1706  Void              setDefaultDisplayWindow(Window& defaultDisplayWindow ) { m_defaultDisplayWindow = defaultDisplayWindow; }
1707
1708  Bool              getHrdParametersPresentFlag() const                    { return m_hrdParametersPresentFlag;             }
1709  Void              setHrdParametersPresentFlag(Bool i)                    { m_hrdParametersPresentFlag = i;                }
1710
1711  Bool              getBitstreamRestrictionFlag() const                    { return m_bitstreamRestrictionFlag;             }
1712  Void              setBitstreamRestrictionFlag(Bool i)                    { m_bitstreamRestrictionFlag = i;                }
1713
1714  Bool              getTilesFixedStructureFlag() const                     { return m_tilesFixedStructureFlag;              }
1715  Void              setTilesFixedStructureFlag(Bool i)                     { m_tilesFixedStructureFlag = i;                 }
1716
1717  Bool              getMotionVectorsOverPicBoundariesFlag() const          { return m_motionVectorsOverPicBoundariesFlag;   }
1718  Void              setMotionVectorsOverPicBoundariesFlag(Bool i)          { m_motionVectorsOverPicBoundariesFlag = i;      }
1719
1720  Bool              getRestrictedRefPicListsFlag() const                   { return m_restrictedRefPicListsFlag;            }
1721  Void              setRestrictedRefPicListsFlag(Bool b)                   { m_restrictedRefPicListsFlag = b;               }
1722
1723  Int               getMinSpatialSegmentationIdc() const                   { return m_minSpatialSegmentationIdc;            }
1724  Void              setMinSpatialSegmentationIdc(Int i)                    { m_minSpatialSegmentationIdc = i;               }
1725
1726  Int               getMaxBytesPerPicDenom() const                         { return m_maxBytesPerPicDenom;                  }
1727  Void              setMaxBytesPerPicDenom(Int i)                          { m_maxBytesPerPicDenom = i;                     }
1728
1729  Int               getMaxBitsPerMinCuDenom() const                        { return m_maxBitsPerMinCuDenom;                 }
1730  Void              setMaxBitsPerMinCuDenom(Int i)                         { m_maxBitsPerMinCuDenom = i;                    }
1731
1732  Int               getLog2MaxMvLengthHorizontal() const                   { return m_log2MaxMvLengthHorizontal;            }
1733  Void              setLog2MaxMvLengthHorizontal(Int i)                    { m_log2MaxMvLengthHorizontal = i;               }
1734
1735  Int               getLog2MaxMvLengthVertical() const                     { return m_log2MaxMvLengthVertical;              }
1736  Void              setLog2MaxMvLengthVertical(Int i)                      { m_log2MaxMvLengthVertical = i;                 }
1737
1738  TComHRD*          getHrdParameters()                                     { return &m_hrdParameters;                       }
1739  const TComHRD*    getHrdParameters()  const                              { return &m_hrdParameters;                       }
1740
1741  TimingInfo*       getTimingInfo()                                        { return &m_timingInfo;                          }
1742  const TimingInfo* getTimingInfo() const                                  { return &m_timingInfo;                          }
1743#if NH_MV
1744  Void              inferVideoSignalInfo( const TComVPS* vps, Int layerIdCurr );
1745#endif
1746};
1747
1748/// SPS RExt class
1749class TComSPSRExt // Names aligned to text specification
1750{
1751private:
1752  Bool             m_transformSkipRotationEnabledFlag;
1753  Bool             m_transformSkipContextEnabledFlag;
1754  Bool             m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];
1755  Bool             m_extendedPrecisionProcessingFlag;
1756  Bool             m_intraSmoothingDisabledFlag;
1757  Bool             m_highPrecisionOffsetsEnabledFlag;
1758  Bool             m_persistentRiceAdaptationEnabledFlag;
1759  Bool             m_cabacBypassAlignmentEnabledFlag;
1760
1761public:
1762  TComSPSRExt();
1763
1764  Bool settingsDifferFromDefaults() const
1765  {
1766    return getTransformSkipRotationEnabledFlag()
1767        || getTransformSkipContextEnabledFlag()
1768        || getRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT)
1769        || getRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT)
1770        || getExtendedPrecisionProcessingFlag()
1771        || getIntraSmoothingDisabledFlag()
1772        || getHighPrecisionOffsetsEnabledFlag()
1773        || getPersistentRiceAdaptationEnabledFlag()
1774        || getCabacBypassAlignmentEnabledFlag();
1775  }
1776
1777
1778  Bool getTransformSkipRotationEnabledFlag() const                                     { return m_transformSkipRotationEnabledFlag;     }
1779  Void setTransformSkipRotationEnabledFlag(const Bool value)                           { m_transformSkipRotationEnabledFlag = value;    }
1780
1781  Bool getTransformSkipContextEnabledFlag() const                                      { return m_transformSkipContextEnabledFlag;      }
1782  Void setTransformSkipContextEnabledFlag(const Bool value)                            { m_transformSkipContextEnabledFlag = value;     }
1783
1784  Bool getRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode) const             { return m_rdpcmEnabledFlag[signallingMode];     }
1785  Void setRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode, const Bool value) { m_rdpcmEnabledFlag[signallingMode] = value;    }
1786
1787  Bool getExtendedPrecisionProcessingFlag() const                                      { return m_extendedPrecisionProcessingFlag;      }
1788  Void setExtendedPrecisionProcessingFlag(Bool value)                                  { m_extendedPrecisionProcessingFlag = value;     }
1789
1790  Bool getIntraSmoothingDisabledFlag() const                                           { return m_intraSmoothingDisabledFlag;           }
1791  Void setIntraSmoothingDisabledFlag(Bool bValue)                                      { m_intraSmoothingDisabledFlag=bValue;           }
1792
1793  Bool getHighPrecisionOffsetsEnabledFlag() const                                      { return m_highPrecisionOffsetsEnabledFlag;      }
1794  Void setHighPrecisionOffsetsEnabledFlag(Bool value)                                  { m_highPrecisionOffsetsEnabledFlag = value;     }
1795
1796  Bool getPersistentRiceAdaptationEnabledFlag() const                                  { return m_persistentRiceAdaptationEnabledFlag;  }
1797  Void setPersistentRiceAdaptationEnabledFlag(const Bool value)                        { m_persistentRiceAdaptationEnabledFlag = value; }
1798
1799  Bool getCabacBypassAlignmentEnabledFlag() const                                      { return m_cabacBypassAlignmentEnabledFlag;      }
1800  Void setCabacBypassAlignmentEnabledFlag(const Bool value)                            { m_cabacBypassAlignmentEnabledFlag = value;     }
1801};
1802
1803
1804#if NH_3D
1805class TComSps3dExtension
1806{
1807public:
1808  TComSps3dExtension()
1809  {
1810    for (Int d = 0; d < 2; d++)
1811    {
1812      m_ivMvPredFlag          [d] = false; 
1813      m_ivMvScalingFlag       [d] = false; 
1814      m_log2SubPbSizeMinus3   [d] = 3; 
1815      m_ivResPredFlag         [d] = false; 
1816      m_depthRefinementFlag   [d] = false; 
1817      m_viewSynthesisPredFlag [d] = false; 
1818      m_depthBasedBlkPartFlag [d] = false; 
1819      m_mpiFlag               [d] = false; 
1820      m_log2MpiSubPbSizeMinus3[d] = 3; 
1821      m_intraContourFlag      [d] = false; 
1822      m_intraSdcWedgeFlag     [d] = false; 
1823      m_qtPredFlag            [d] = false; 
1824      m_interSdcFlag          [d] = false; 
1825      m_depthIntraSkipFlag    [d] = false;   
1826    }
1827  }
1828
1829  Void          setIvMvPredFlag( Int d, Bool flag )         { m_ivMvPredFlag[d] = flag;             }
1830  Bool          getIvMvPredFlag( Int d ) const              { return m_ivMvPredFlag[d];             }
1831
1832  Void          setIvMvScalingFlag( Int d, Bool flag )      { m_ivMvScalingFlag[d] = flag;          }
1833  Bool          getIvMvScalingFlag( Int d ) const           { return m_ivMvScalingFlag[d];          }
1834
1835  Void          setLog2SubPbSizeMinus3( Int d, Int  val )   { m_log2SubPbSizeMinus3[d] = val;       }
1836  Int           getLog2SubPbSizeMinus3( Int d ) const       { return m_log2SubPbSizeMinus3[d];      }
1837
1838  Void          setIvResPredFlag( Int d, Bool flag )        { m_ivResPredFlag[d] = flag;            }
1839  Bool          getIvResPredFlag( Int d ) const             { return m_ivResPredFlag[d];            }
1840
1841  Void          setDepthRefinementFlag( Int d, Bool flag )  { m_depthRefinementFlag[d] = flag;      }
1842  Bool          getDepthRefinementFlag( Int d ) const       { return m_depthRefinementFlag[d];      }
1843
1844  Void          setViewSynthesisPredFlag( Int d, Bool flag ) { m_viewSynthesisPredFlag[d] = flag;   }
1845  Bool          getViewSynthesisPredFlag( Int d ) const     { return m_viewSynthesisPredFlag[d];    }
1846
1847  Void          setDepthBasedBlkPartFlag( Int d, Bool flag ) { m_depthBasedBlkPartFlag[d] = flag;   }
1848  Bool          getDepthBasedBlkPartFlag( Int d ) const     { return m_depthBasedBlkPartFlag[d];    }
1849
1850  Void          setMpiFlag( Int d, Bool flag )              { m_mpiFlag[d] = flag;                  }
1851  Bool          getMpiFlag( Int d ) const                   { return m_mpiFlag[d];                  }
1852
1853  Void          setLog2MpiSubPbSizeMinus3( Int d, Int  val ) { m_log2MpiSubPbSizeMinus3[d] = val;   }
1854  Int           getLog2MpiSubPbSizeMinus3( Int d ) const    { return m_log2MpiSubPbSizeMinus3[d];   }
1855
1856  Void          setIntraContourFlag( Int d, Bool flag )     { m_intraContourFlag[d] = flag;         }
1857  Bool          getIntraContourFlag( Int d ) const          { return m_intraContourFlag[d];         }
1858
1859  Void          setIntraSdcWedgeFlag( Int d, Bool flag )    { m_intraSdcWedgeFlag[d] = flag;        }
1860  Bool          getIntraSdcWedgeFlag( Int d ) const         { return m_intraSdcWedgeFlag[d];        }
1861
1862  Void          setQtPredFlag( Int d, Bool flag )           { m_qtPredFlag[d] = flag;               }
1863  Bool          getQtPredFlag( Int d ) const                { return m_qtPredFlag[d];               }
1864
1865  Void          setInterSdcFlag( Int d, Bool flag )         { m_interSdcFlag[d] = flag;             }
1866  Bool          getInterSdcFlag( Int d ) const              { return m_interSdcFlag[d];             }
1867
1868  Void          setDepthIntraSkipFlag( Int d, Bool flag )   { m_depthIntraSkipFlag[d] = flag;       }
1869  Bool          getDepthIntraSkipFlag( Int d ) const        { return m_depthIntraSkipFlag[d];       }
1870private:
1871
1872  Bool        m_ivMvPredFlag          [2];
1873  Bool        m_ivMvScalingFlag       [2];
1874  Int         m_log2SubPbSizeMinus3   [2];
1875  Bool        m_ivResPredFlag         [2];
1876  Bool        m_depthRefinementFlag   [2];
1877  Bool        m_viewSynthesisPredFlag [2];
1878  Bool        m_depthBasedBlkPartFlag [2];
1879  Bool        m_mpiFlag               [2];
1880  Int         m_log2MpiSubPbSizeMinus3[2];
1881  Bool        m_intraContourFlag      [2];
1882  Bool        m_intraSdcWedgeFlag     [2];
1883  Bool        m_qtPredFlag            [2];
1884  Bool        m_interSdcFlag          [2];
1885  Bool        m_depthIntraSkipFlag    [2]; 
1886};
1887
1888#endif
1889
1890
1891/// SPS class
1892class TComSPS
1893{
1894private:
1895  Int              m_SPSId;
1896  Int              m_VPSId;
1897  ChromaFormat     m_chromaFormatIdc;
1898
1899  UInt             m_uiMaxTLayers;           // maximum number of temporal layers
1900
1901  // Structure
1902  UInt             m_picWidthInLumaSamples;
1903  UInt             m_picHeightInLumaSamples;
1904
1905  Int              m_log2MinCodingBlockSize;
1906  Int              m_log2DiffMaxMinCodingBlockSize;
1907  UInt             m_uiMaxCUWidth;
1908  UInt             m_uiMaxCUHeight;
1909  UInt             m_uiMaxTotalCUDepth; ///< Total CU depth, relative to the smallest possible transform block size.
1910
1911  Window           m_conformanceWindow;
1912
1913  TComRPSList      m_RPSList;
1914#if NH_MV
1915  std::vector<TComStRefPicSet> m_stRefPicSets; 
1916#endif
1917  Bool             m_bLongTermRefsPresent;
1918  Bool             m_TMVPFlagsPresent;
1919  Int              m_numReorderPics[MAX_TLAYER];
1920
1921  // Tool list
1922  UInt             m_uiQuadtreeTULog2MaxSize;
1923  UInt             m_uiQuadtreeTULog2MinSize;
1924  UInt             m_uiQuadtreeTUMaxDepthInter;
1925  UInt             m_uiQuadtreeTUMaxDepthIntra;
1926  Bool             m_usePCM;
1927  UInt             m_pcmLog2MaxSize;
1928  UInt             m_uiPCMLog2MinSize;
1929  Bool             m_useAMP;
1930
1931  // Parameter
1932  BitDepths        m_bitDepths;
1933  Int              m_qpBDOffset[MAX_NUM_CHANNEL_TYPE];
1934  Int              m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE];
1935  Bool             m_bPCMFilterDisableFlag;
1936
1937  UInt             m_uiBitsForPOC;
1938  UInt             m_numLongTermRefPicSPS;
1939#if NH_MV
1940  Int              m_numShortTermRefPicSets;
1941#endif
1942  UInt             m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS];
1943  Bool             m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS];
1944  // Max physical transform size
1945  UInt             m_uiMaxTrSize;
1946
1947  Bool             m_bUseSAO;
1948
1949  Bool             m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
1950
1951  Bool             m_scalingListEnabledFlag;
1952  Bool             m_scalingListPresentFlag;
1953  TComScalingList  m_scalingList;
1954  UInt             m_uiMaxDecPicBuffering[MAX_TLAYER];
1955#if NH_MV
1956  UInt             m_uiSpsMaxLatencyIncreasePlus1[MAX_TLAYER]; 
1957  // Calling a member m_uiMaxLatencyIncrease although it is m_uiMaxLatencyIncreasePlus1 is really bad style. 
1958#else
1959  UInt             m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
1960#endif
1961
1962  Bool             m_useStrongIntraSmoothing;
1963
1964  Bool             m_vuiParametersPresentFlag;
1965  TComVUI          m_vuiParameters;
1966
1967  TComSPSRExt      m_spsRangeExtension;
1968
1969  static const Int m_winUnitX[NUM_CHROMA_FORMAT];
1970  static const Int m_winUnitY[NUM_CHROMA_FORMAT];
1971  TComPTL          m_pcPTL;
1972
1973#if O0043_BEST_EFFORT_DECODING
1974  UInt             m_forceDecodeBitDepth; // 0 = do not force the decoder's bit depth, other = force the decoder's bit depth to this value (best effort decoding)
1975#endif
1976#if NH_MV
1977  TComVPS*         m_pcVPS; 
1978  // SPS           
1979  Int              m_spsMaxSubLayersMinus1;
1980  Int              m_spsExtOrMaxSubLayersMinus1;
1981  Bool             m_spsExtensionPresentFlag; 
1982                   
1983  Bool             m_spsRangeExtensionsFlag;
1984  Bool             m_spsMultilayerExtensionFlag;
1985
1986  Bool             m_sps3dExtensionFlag;
1987  Int              m_spsExtension5bits;
1988
1989  Bool             m_spsInferScalingListFlag;
1990  Int              m_spsScalingListRefLayerId;
1991  Bool             m_updateRepFormatFlag;
1992  Int              m_spsRepFormatIdx;
1993  // SPS Extension
1994  Bool             m_interViewMvVertConstraintFlag;
1995#endif
1996#if NH_3D
1997  TComSps3dExtension m_sps3dExtension; 
1998  Int              m_aaiCodedScale [2][MAX_NUM_LAYERS];
1999  Int              m_aaiCodedOffset[2][MAX_NUM_LAYERS];
2000#endif             
2001#if NH_MV           
2002  Int              m_layerId; 
2003#endif
2004
2005public:
2006                         TComSPS();
2007  virtual                ~TComSPS();
2008#if O0043_BEST_EFFORT_DECODING
2009  Void                   setForceDecodeBitDepth(UInt bitDepth)                                           { m_forceDecodeBitDepth = bitDepth;                                    }
2010  UInt                   getForceDecodeBitDepth()        const                                           { return m_forceDecodeBitDepth;                                        }
2011#endif
2012
2013  Int                    getVPSId() const                                                                { return m_VPSId;                                                      }
2014  Void                   setVPSId(Int i)                                                                 { m_VPSId = i;                                                         }
2015  Int                    getSPSId() const                                                                { return m_SPSId;                                                      }
2016  Void                   setSPSId(Int i)                                                                 { m_SPSId = i;                                                         }
2017  ChromaFormat           getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
2018  Void                   setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
2019
2020  static Int             getWinUnitX (Int chromaFormatIdc)                                               { assert (chromaFormatIdc >= 0 && chromaFormatIdc < NUM_CHROMA_FORMAT); return m_winUnitX[chromaFormatIdc]; }
2021  static Int             getWinUnitY (Int chromaFormatIdc)                                               { assert (chromaFormatIdc >= 0 && chromaFormatIdc < NUM_CHROMA_FORMAT); return m_winUnitY[chromaFormatIdc]; }
2022
2023  // structure
2024  Void                   setPicWidthInLumaSamples( UInt u )                                              { m_picWidthInLumaSamples = u;                                         }
2025  UInt                   getPicWidthInLumaSamples() const                                                { return  m_picWidthInLumaSamples;                                     }
2026  Void                   setPicHeightInLumaSamples( UInt u )                                             { m_picHeightInLumaSamples = u;                                        }
2027  UInt                   getPicHeightInLumaSamples() const                                               { return  m_picHeightInLumaSamples;                                    }
2028
2029  Window&                getConformanceWindow()                                                          { return  m_conformanceWindow;                                         }
2030  const Window&          getConformanceWindow() const                                                    { return  m_conformanceWindow;                                         }
2031  Void                   setConformanceWindow(Window& conformanceWindow )                                { m_conformanceWindow = conformanceWindow;                             }
2032
2033#if NH_MV
2034  UInt                   getNumLongTermRefPicsSps() const                                                 { return m_numLongTermRefPicSPS;                                       }
2035#endif
2036 
2037  UInt                   getNumLongTermRefPicSPS() const                                                 { return m_numLongTermRefPicSPS;                                       }
2038  Void                   setNumLongTermRefPicSPS(UInt val)                                               { m_numLongTermRefPicSPS = val;                                        }
2039
2040  UInt                   getLtRefPicPocLsbSps(UInt index) const                                          { assert( index < MAX_NUM_LONG_TERM_REF_PICS ); return m_ltRefPicPocLsbSps[index]; }
2041  Void                   setLtRefPicPocLsbSps(UInt index, UInt val)                                      { assert( index < MAX_NUM_LONG_TERM_REF_PICS ); m_ltRefPicPocLsbSps[index] = val;  }
2042
2043  Bool                   getUsedByCurrPicLtSPSFlag(Int i) const                                          { assert( i < MAX_NUM_LONG_TERM_REF_PICS ); return m_usedByCurrPicLtSPSFlag[i];    }
2044  Void                   setUsedByCurrPicLtSPSFlag(Int i, Bool x)                                        { assert( i < MAX_NUM_LONG_TERM_REF_PICS ); m_usedByCurrPicLtSPSFlag[i] = x;       }
2045
2046  Int                    getLog2MinCodingBlockSize() const                                               { return m_log2MinCodingBlockSize;                                     }
2047  Void                   setLog2MinCodingBlockSize(Int val)                                              { m_log2MinCodingBlockSize = val;                                      }
2048  Int                    getLog2DiffMaxMinCodingBlockSize() const                                        { return m_log2DiffMaxMinCodingBlockSize;                              }
2049  Void                   setLog2DiffMaxMinCodingBlockSize(Int val)                                       { m_log2DiffMaxMinCodingBlockSize = val;                               }
2050
2051  Void                   setMaxCUWidth( UInt u )                                                         { m_uiMaxCUWidth = u;                                                  }
2052  UInt                   getMaxCUWidth() const                                                           { return  m_uiMaxCUWidth;                                              }
2053  Void                   setMaxCUHeight( UInt u )                                                        { m_uiMaxCUHeight = u;                                                 }
2054  UInt                   getMaxCUHeight() const                                                          { return  m_uiMaxCUHeight;                                             }
2055  Void                   setMaxTotalCUDepth( UInt u )                                                    { m_uiMaxTotalCUDepth = u;                                             }
2056  UInt                   getMaxTotalCUDepth() const                                                      { return  m_uiMaxTotalCUDepth;                                         }
2057  Void                   setUsePCM( Bool b )                                                             { m_usePCM = b;                                                        }
2058  Bool                   getUsePCM() const                                                               { return m_usePCM;                                                     }
2059  Void                   setPCMLog2MaxSize( UInt u )                                                     { m_pcmLog2MaxSize = u;                                                }
2060  UInt                   getPCMLog2MaxSize() const                                                       { return  m_pcmLog2MaxSize;                                            }
2061  Void                   setPCMLog2MinSize( UInt u )                                                     { m_uiPCMLog2MinSize = u;                                              }
2062  UInt                   getPCMLog2MinSize() const                                                       { return  m_uiPCMLog2MinSize;                                          }
2063  Void                   setBitsForPOC( UInt u )                                                         { m_uiBitsForPOC = u;                                                  }
2064  UInt                   getBitsForPOC() const                                                           { return m_uiBitsForPOC;                                               }
2065#if NH_MV
2066  UInt                   getMaxPicOrderCntLsb() const                                                    { return (1 << ( getLog2MaxPicOrderCntLsbMinus4() + 4) );  }
2067  Int                    getLog2MaxPicOrderCntLsbMinus4() const                                          { return (getBitsForPOC() - 4);  }
2068#endif
2069  Bool                   getUseAMP() const                                                               { return m_useAMP;                                                     }
2070  Void                   setUseAMP( Bool b )                                                             { m_useAMP = b;                                                        }
2071  Void                   setQuadtreeTULog2MaxSize( UInt u )                                              { m_uiQuadtreeTULog2MaxSize = u;                                       }
2072  UInt                   getQuadtreeTULog2MaxSize() const                                                { return m_uiQuadtreeTULog2MaxSize;                                    }
2073  Void                   setQuadtreeTULog2MinSize( UInt u )                                              { m_uiQuadtreeTULog2MinSize = u;                                       }
2074  UInt                   getQuadtreeTULog2MinSize() const                                                { return m_uiQuadtreeTULog2MinSize;                                    }
2075  Void                   setQuadtreeTUMaxDepthInter( UInt u )                                            { m_uiQuadtreeTUMaxDepthInter = u;                                     }
2076  Void                   setQuadtreeTUMaxDepthIntra( UInt u )                                            { m_uiQuadtreeTUMaxDepthIntra = u;                                     }
2077  UInt                   getQuadtreeTUMaxDepthInter() const                                              { return m_uiQuadtreeTUMaxDepthInter;                                  }
2078  UInt                   getQuadtreeTUMaxDepthIntra() const                                              { return m_uiQuadtreeTUMaxDepthIntra;                                  }
2079  Void                   setNumReorderPics(Int i, UInt tlayer)                                           { m_numReorderPics[tlayer] = i;                                        }
2080  Int                    getNumReorderPics(UInt tlayer) const                                            { return m_numReorderPics[tlayer];                                     }
2081  Void                   createRPSList( Int numRPS );
2082  const TComRPSList*     getRPSList() const                                                              { return &m_RPSList;                                                   }
2083  TComRPSList*           getRPSList()                                                                    { return &m_RPSList;                                                   }
2084#if NH_MV
2085  Void                   initStRefPicSets( )                                                             { m_stRefPicSets.resize( getNumShortTermRefPicSets() );                }
2086  TComStRefPicSet*       getStRefPicSet( Int i )                                                         { return &(m_stRefPicSets[i]);                                         }
2087  const TComStRefPicSet* getStRefPicSet( Int i ) const                                                   { return &(m_stRefPicSets[i]);                                         }
2088  Bool                   getLongTermRefPicsPresentFlag() const                                           { return m_bLongTermRefsPresent;                                       }
2089  Void                   setLongTermRefPicsPresentFlag(Bool b)                                           { m_bLongTermRefsPresent=b;                                            }
2090#else
2091  Bool                   getLongTermRefsPresent() const                                                  { return m_bLongTermRefsPresent;                                       }
2092  Void                   setLongTermRefsPresent(Bool b)                                                  { m_bLongTermRefsPresent=b;                                            }
2093#endif
2094  Bool                   getTMVPFlagsPresent() const                                                     { return m_TMVPFlagsPresent;                                           }
2095  Void                   setTMVPFlagsPresent(Bool b)                                                     { m_TMVPFlagsPresent=b;                                                }
2096#if NH_MV
2097  Bool                   getSpsTemporalMvpEnabledFlag() const                                            { return m_TMVPFlagsPresent;                                           }
2098#endif
2099  // physical transform
2100  Void                   setMaxTrSize( UInt u )                                                          { m_uiMaxTrSize = u;                                                   }
2101  UInt                   getMaxTrSize() const                                                            { return  m_uiMaxTrSize;                                               }
2102
2103  // Bit-depth
2104  Int                    getBitDepth(ChannelType type) const                                             { return m_bitDepths.recon[type];                                      }
2105  Void                   setBitDepth(ChannelType type, Int u )                                           { m_bitDepths.recon[type] = u;                                         }
2106#if O0043_BEST_EFFORT_DECODING
2107  Int                    getStreamBitDepth(ChannelType type) const                                       { return m_bitDepths.stream[type];                                     }
2108  Void                   setStreamBitDepth(ChannelType type, Int u )                                     { m_bitDepths.stream[type] = u;                                        }
2109#endif
2110  const BitDepths&       getBitDepths() const                                                            { return m_bitDepths;                                                  }
2111  Int                    getMaxLog2TrDynamicRange(ChannelType channelType) const                         { return getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ? std::max<Int>(15, Int(m_bitDepths.recon[channelType] + 6)) : 15; }
2112
2113  Int                    getDifferentialLumaChromaBitDepth() const                                       { return Int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - Int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); }
2114  Int                    getQpBDOffset(ChannelType type) const                                           { return m_qpBDOffset[type];                                           }
2115  Void                   setQpBDOffset(ChannelType type, Int i)                                          { m_qpBDOffset[type] = i;                                              }
2116
2117  Void                   setUseSAO(Bool bVal)                                                            { m_bUseSAO = bVal;                                                    }
2118  Bool                   getUseSAO() const                                                               { return m_bUseSAO;                                                    }
2119
2120  UInt                   getMaxTLayers() const                                                           { return m_uiMaxTLayers; }
2121  Void                   setMaxTLayers( UInt uiMaxTLayers )                                              { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
2122
2123  Bool                   getTemporalIdNestingFlag() const                                                { return m_bTemporalIdNestingFlag;                                     }
2124  Void                   setTemporalIdNestingFlag( Bool bValue )                                         { m_bTemporalIdNestingFlag = bValue;                                   }
2125  UInt                   getPCMBitDepth(ChannelType type) const                                          { return m_pcmBitDepths[type];                                         }
2126  Void                   setPCMBitDepth(ChannelType type, UInt u)                                        { m_pcmBitDepths[type] = u;                                            }
2127  Void                   setPCMFilterDisableFlag( Bool bValue )                                          { m_bPCMFilterDisableFlag = bValue;                                    }
2128  Bool                   getPCMFilterDisableFlag() const                                                 { return m_bPCMFilterDisableFlag;                                      }
2129#if NH_MV
2130  Void                  setNumShortTermRefPicSets( Int  val )                                            { m_numShortTermRefPicSets = val; } 
2131  Int                   getNumShortTermRefPicSets(  )const                                               { return m_numShortTermRefPicSets; } 
2132#endif
2133  Bool                   getScalingListFlag() const                                                      { return m_scalingListEnabledFlag;                                     }
2134  Void                   setScalingListFlag( Bool b )                                                    { m_scalingListEnabledFlag  = b;                                       }
2135  Bool                   getScalingListPresentFlag() const                                               { return m_scalingListPresentFlag;                                     }
2136  Void                   setScalingListPresentFlag( Bool b )                                             { m_scalingListPresentFlag  = b;                                       }
2137  Void                   setScalingList( TComScalingList *scalingList);
2138  TComScalingList&       getScalingList()                                                                { return m_scalingList;                                                }
2139  const TComScalingList& getScalingList() const                                                          { return m_scalingList;                                                }
2140  UInt                   getMaxDecPicBuffering(UInt tlayer) const                                        { return m_uiMaxDecPicBuffering[tlayer];                               }
2141  Void                   setMaxDecPicBuffering( UInt ui, UInt tlayer )                                   { assert(tlayer < MAX_TLAYER); m_uiMaxDecPicBuffering[tlayer] = ui;    }
2142#if NH_MV
2143  UInt                   getSpsMaxDecPicBufferingMinus1(UInt tlayer) const                               { return m_uiMaxDecPicBuffering[tlayer] -1 ;                           }
2144  UInt                   getSpsMaxLatencyIncreasePlus1(UInt tlayer) const                                { return m_uiSpsMaxLatencyIncreasePlus1[tlayer];                       }
2145  Void                   setSpsMaxLatencyIncreasePlus1( UInt ui , UInt tlayer)                           { m_uiSpsMaxLatencyIncreasePlus1[tlayer] = ui;                         }
2146  Int                    getSpsMaxLatencyPictures( Int i )  const                                       { return ( getSpsMaxNumReorderPics(i) + getSpsMaxLatencyIncreasePlus1(i)-1); }
2147#else
2148  UInt                   getMaxLatencyIncrease(UInt tlayer) const                                        { return m_uiMaxLatencyIncrease[tlayer];                               }
2149  Void                   setMaxLatencyIncrease( UInt ui , UInt tlayer)                                   { m_uiMaxLatencyIncrease[tlayer] = ui;                                 }
2150#endif
2151
2152#if NH_MV
2153  Int                    getSpsMaxNumReorderPics(Int i ) const                                           { return getNumReorderPics( i );                                       }
2154#endif
2155
2156  Void                   setUseStrongIntraSmoothing(Bool bVal)                                           { m_useStrongIntraSmoothing = bVal;                                    }
2157  Bool                   getUseStrongIntraSmoothing() const                                              { return m_useStrongIntraSmoothing;                                    }
2158
2159  Bool                   getVuiParametersPresentFlag() const                                             { return m_vuiParametersPresentFlag;                                   }
2160  Void                   setVuiParametersPresentFlag(Bool b)                                             { m_vuiParametersPresentFlag = b;                                      }
2161  TComVUI*               getVuiParameters()                                                              { return &m_vuiParameters;                                             }
2162  const TComVUI*         getVuiParameters() const                                                        { return &m_vuiParameters;                                             }
2163  const TComPTL*         getPTL() const                                                                  { return &m_pcPTL;                                                     }
2164  TComPTL*               getPTL()                                                                        { return &m_pcPTL;                                                     }
2165
2166  const TComSPSRExt&     getSpsRangeExtension() const                                                    { return m_spsRangeExtension;                                          }
2167  TComSPSRExt&           getSpsRangeExtension()                                                          { return m_spsRangeExtension;                                          }
2168
2169  // Sequence parameter set range extension syntax
2170  // WAS: getUseResidualRotation and setUseResidualRotation
2171  // Now getSpsRangeExtension().getTransformSkipRotationEnabledFlag and getSpsRangeExtension().setTransformSkipRotationEnabledFlag
2172
2173  // WAS: getUseSingleSignificanceMapContext and setUseSingleSignificanceMapContext
2174  // Now: getSpsRangeExtension().getTransformSkipContextEnabledFlag and getSpsRangeExtension().setTransformSkipContextEnabledFlag
2175
2176  // WAS: getUseResidualDPCM and setUseResidualDPCM
2177  // Now: getSpsRangeExtension().getRdpcmEnabledFlag and getSpsRangeExtension().setRdpcmEnabledFlag and
2178
2179  // WAS: getUseExtendedPrecision and setUseExtendedPrecision
2180  // Now: getSpsRangeExtension().getExtendedPrecisionProcessingFlag and getSpsRangeExtension().setExtendedPrecisionProcessingFlag
2181
2182  // WAS: getDisableIntraReferenceSmoothing and setDisableIntraReferenceSmoothing
2183  // Now: getSpsRangeExtension().getIntraSmoothingDisabledFlag and getSpsRangeExtension().setIntraSmoothingDisabledFlag
2184
2185  // WAS: getUseHighPrecisionPredictionWeighting and setUseHighPrecisionPredictionWeighting
2186  // Now: getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag and getSpsRangeExtension().setHighPrecisionOffsetsEnabledFlag
2187
2188  // WAS: getUseGolombRiceParameterAdaptation and setUseGolombRiceParameterAdaptation
2189  // Now: getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag and getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag
2190
2191  // WAS: getAlignCABACBeforeBypass and setAlignCABACBeforeBypass
2192  // Now: getSpsRangeExtension().getCabacBypassAlignmentEnabledFlag and getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag
2193
2194
2195#if NH_MV
2196
2197  UInt                   getSpsMaxSubLayersMinus1() const                                                { return ( m_uiMaxTLayers - 1);                                        }
2198  Void                   setSpsMaxSubLayersMinus1( UInt val )                                            { setMaxTLayers( val + 1 );                                            }
2199
2200  Void                   setSpsExtOrMaxSubLayersMinus1( Int  val )                                       { m_spsExtOrMaxSubLayersMinus1 = val;                                  }
2201  Int                    getSpsExtOrMaxSubLayersMinus1(  )         const                                 { return m_spsExtOrMaxSubLayersMinus1;                                 }
2202  Void                   inferSpsMaxSubLayersMinus1( Bool atPsActivation, TComVPS* vps  );                                                                                     
2203                                                                                                                                                                               
2204  Bool                   getMultiLayerExtSpsFlag()            const { return ( getLayerId() != 0  &&  getSpsExtOrMaxSubLayersMinus1() == 7 );                                   }
2205  Void                   inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder );                                             
2206                                                                                                                                                                               
2207  Void                   setSpsExtensionPresentFlag( Bool flag )                                         { m_spsExtensionPresentFlag = flag;                                    }
2208  Bool                   getSpsExtensionPresentFlag( )           const                                   { return m_spsExtensionPresentFlag;                                    }
2209                                                                                                                                                                               
2210  Void                   setSpsRangeExtensionsFlag( Bool flag )                                          { m_spsRangeExtensionsFlag = flag;                                     }
2211  Bool                   getSpsRangeExtensionsFlag(  )                     const                         { return m_spsRangeExtensionsFlag;                                     }
2212                                                                                                                                                                               
2213  Void                   setSpsMultilayerExtensionFlag( Bool flag )                                      { m_spsMultilayerExtensionFlag = flag;                                 }
2214  Bool                   getSpsMultilayerExtensionFlag( )                  const                         { return m_spsMultilayerExtensionFlag;                                 }
2215
2216  Void                   setSps3dExtensionFlag( Bool flag )                                              { m_sps3dExtensionFlag = flag;                                         }
2217  Bool                   getSps3dExtensionFlag(  )                         const                         { return m_sps3dExtensionFlag;                                         }
2218                                                                                                                                                                               
2219  Void                   setSpsExtension5bits( Int  val )                                                { m_spsExtension5bits = val;                                           }
2220  Int                    getSpsExtension5bits(  )                          const                         { return m_spsExtension5bits;                                          }
2221                                                                                                                                                                               
2222  Void                   setVPS          ( TComVPS* pcVPS )                                              { m_pcVPS = pcVPS;                                                     }
2223  TComVPS*               getVPS          ()                 const                                        { return m_pcVPS;                                                      }
2224                                                                                                                                                                               
2225  Void                   setSpsInferScalingListFlag( Bool flag )                                         { m_spsInferScalingListFlag = flag;                                    }
2226  Bool                   getSpsInferScalingListFlag(  )          const                                   { return m_spsInferScalingListFlag;                                    }
2227                                                                                                                                                                               
2228  Void                   setSpsScalingListRefLayerId( Int  val )                                         { m_spsScalingListRefLayerId = val;                                    }
2229  Int                    getSpsScalingListRefLayerId(  )         const                                   { return m_spsScalingListRefLayerId;                                   }
2230                                                                                                                                                                               
2231  Void                   setUpdateRepFormatFlag( Bool flag )                                             { m_updateRepFormatFlag = flag;                                        }
2232  Bool                   getUpdateRepFormatFlag(  )              const                                   { return m_updateRepFormatFlag;                                        }
2233 
2234  Void                   setSpsRepFormatIdx( Int  val )                                                  { m_spsRepFormatIdx = val;                                             }
2235  Int                    getSpsRepFormatIdx(  )                  const                                   { return m_spsRepFormatIdx;                                            }
2236                                                                                                                                                                               
2237// SPS Extension                                                                                                                                                               
2238  Void                   setInterViewMvVertConstraintFlag(Bool val)                                      { m_interViewMvVertConstraintFlag = val;                               }
2239  Bool                   getInterViewMvVertConstraintFlag()         const                                { return m_interViewMvVertConstraintFlag;                              }
2240                                                                                                                                                                               
2241#if NH_3D
2242  Void                   setSps3dExtension ( TComSps3dExtension& sps3dExtension )                        { m_sps3dExtension = sps3dExtension;                                   }
2243  const TComSps3dExtension* getSps3dExtension ( )  const                                                 { return &m_sps3dExtension;                                            } 
2244#endif                 
2245                       
2246  // Inference         
2247                       
2248  Void                   inferRepFormat( TComVPS* vps, Int layerIdCurr, Bool encoder );
2249  Void                   inferScalingList( const TComSPS* spsSrc );
2250                       
2251  // others             
2252  Void                   checkRpsMaxNumPics( const TComVPS* vps, Int currLayerId ) const;
2253                       
2254  Int                    getLayerId            ()           const                                        { return m_layerId;                                                    }
2255  Void                   setLayerId            ( Int val )                                               { m_layerId = val;                                                     }
2256
2257#endif
2258
2259};
2260
2261
2262/// Reference Picture Lists class
2263
2264class TComRefPicListModification
2265{
2266private:
2267  Bool m_refPicListModificationFlagL0;
2268  Bool m_refPicListModificationFlagL1;
2269  UInt m_RefPicSetIdxL0[REF_PIC_LIST_NUM_IDX];
2270  UInt m_RefPicSetIdxL1[REF_PIC_LIST_NUM_IDX];
2271
2272public:
2273          TComRefPicListModification();
2274  virtual ~TComRefPicListModification();
2275
2276  Void    create();
2277  Void    destroy();
2278
2279  Bool    getRefPicListModificationFlagL0() const        { return m_refPicListModificationFlagL0;                                  }
2280  Void    setRefPicListModificationFlagL0(Bool flag)     { m_refPicListModificationFlagL0 = flag;                                  }
2281  Bool    getRefPicListModificationFlagL1() const        { return m_refPicListModificationFlagL1;                                  }
2282  Void    setRefPicListModificationFlagL1(Bool flag)     { m_refPicListModificationFlagL1 = flag;                                  }
2283  UInt    getRefPicSetIdxL0(UInt idx) const              { assert(idx<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL0[idx];         }
2284  Void    setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { assert(idx<REF_PIC_LIST_NUM_IDX); m_RefPicSetIdxL0[idx] = refPicSetIdx; }
2285  UInt    getRefPicSetIdxL1(UInt idx) const              { assert(idx<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL1[idx];         }
2286  Void    setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { assert(idx<REF_PIC_LIST_NUM_IDX); m_RefPicSetIdxL1[idx] = refPicSetIdx; }
2287#if NH_MV
2288 
2289  Void    setRefPicSetIdxL(UInt li, UInt idx, UInt refPicSetIdx) {( li==0 ? m_RefPicSetIdxL0[idx] : m_RefPicSetIdxL1[idx] ) = refPicSetIdx;              }
2290  UInt    getRefPicSetIdxL(UInt li, UInt idx )                   { return ( li == 0 ) ? m_RefPicSetIdxL0[idx] : m_RefPicSetIdxL1[idx] ;                  }
2291  Void    setRefPicListModificationFlagL(UInt li, Bool flag)     { ( li==0  ? m_refPicListModificationFlagL0 : m_refPicListModificationFlagL1 ) = flag;  }
2292  Bool    getRefPicListModificationFlagL(UInt li )               { return ( li== 0) ? m_refPicListModificationFlagL0 : m_refPicListModificationFlagL1;   }
2293
2294  Int     getListEntryL0( Int i) const                           { assert(i<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL0[i];         }
2295  Int     getListEntryL1( Int i) const                           { assert(i<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL1[i];         }
2296
2297  Int     getListEntryLXLen( Int numPicTotalCur ) const          { return gCeilLog2( numPicTotalCur );                                 } 
2298
2299  Void    setListEntryL0( Int i, Int  val )                      { m_RefPicSetIdxL0[i] = val;                                          } 
2300  Void    setListEntryL1( Int i, Int  val )                      { m_RefPicSetIdxL1[i] = val;                                          } 
2301
2302
2303#endif
2304};
2305
2306/// PPS RExt class
2307class TComPPSRExt // Names aligned to text specification
2308{
2309private:
2310  Int              m_log2MaxTransformSkipBlockSize;
2311  Bool             m_crossComponentPredictionEnabledFlag;
2312
2313  // Chroma QP Adjustments
2314  Int              m_diffCuChromaQpOffsetDepth;
2315  Int              m_chromaQpOffsetListLen; // size (excludes the null entry used in the following array).
2316  ChromaQpAdj      m_ChromaQpAdjTableIncludingNullEntry[1+MAX_QP_OFFSET_LIST_SIZE]; //!< Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
2317
2318  UInt             m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE];
2319
2320public:
2321  TComPPSRExt();
2322
2323  Bool settingsDifferFromDefaults(const bool bTransformSkipEnabledFlag) const
2324  {
2325    return (bTransformSkipEnabledFlag && (getLog2MaxTransformSkipBlockSize() !=2))
2326        || (getCrossComponentPredictionEnabledFlag() )
2327        || (getChromaQpOffsetListEnabledFlag() )
2328        || (getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA) !=0 )
2329        || (getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) !=0 );
2330  }
2331
2332  UInt                   getLog2MaxTransformSkipBlockSize() const                         { return m_log2MaxTransformSkipBlockSize;         }
2333  Void                   setLog2MaxTransformSkipBlockSize( UInt u )                       { m_log2MaxTransformSkipBlockSize  = u;           }
2334
2335  Bool                   getCrossComponentPredictionEnabledFlag() const                   { return m_crossComponentPredictionEnabledFlag;   }
2336  Void                   setCrossComponentPredictionEnabledFlag(Bool value)               { m_crossComponentPredictionEnabledFlag = value;  }
2337
2338  Void                   clearChromaQpOffsetList()                                        { m_chromaQpOffsetListLen = 0;                    }
2339
2340  UInt                   getDiffCuChromaQpOffsetDepth () const                            { return m_diffCuChromaQpOffsetDepth;             }
2341  Void                   setDiffCuChromaQpOffsetDepth ( UInt u )                          { m_diffCuChromaQpOffsetDepth = u;                }
2342
2343  Bool                   getChromaQpOffsetListEnabledFlag() const                         { return getChromaQpOffsetListLen()>0;            }
2344  Int                    getChromaQpOffsetListLen() const                                 { return m_chromaQpOffsetListLen;                 }
2345
2346  const ChromaQpAdj&     getChromaQpOffsetListEntry( Int cuChromaQpOffsetIdxPlus1 ) const
2347  {
2348    assert(cuChromaQpOffsetIdxPlus1 < m_chromaQpOffsetListLen+1);
2349    return m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1]; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
2350  }
2351
2352  Void                   setChromaQpOffsetListEntry( Int cuChromaQpOffsetIdxPlus1, Int cbOffset, Int crOffset )
2353  {
2354    assert (cuChromaQpOffsetIdxPlus1 != 0 && cuChromaQpOffsetIdxPlus1 <= MAX_QP_OFFSET_LIST_SIZE);
2355    m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CbOffset = cbOffset; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
2356    m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CrOffset = crOffset;
2357    m_chromaQpOffsetListLen = max(m_chromaQpOffsetListLen, cuChromaQpOffsetIdxPlus1);
2358  }
2359
2360  // Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale
2361  UInt                   getLog2SaoOffsetScale(ChannelType type) const                    { return m_log2SaoOffsetScale[type];             }
2362  Void                   setLog2SaoOffsetScale(ChannelType type, UInt uiBitShift)         { m_log2SaoOffsetScale[type] = uiBitShift;       }
2363
2364};
2365
2366
2367/// PPS class
2368class TComPPS
2369{
2370private:
2371  Int              m_PPSId;                    // pic_parameter_set_id
2372  Int              m_SPSId;                    // seq_parameter_set_id
2373  Int              m_picInitQPMinus26;
2374  Bool             m_useDQP;
2375  Bool             m_bConstrainedIntraPred;    // constrained_intra_pred_flag
2376  Bool             m_bSliceChromaQpFlag;       // slicelevel_chroma_qp_flag
2377
2378  // access channel
2379  UInt             m_uiMaxCuDQPDepth;
2380
2381  Int              m_chromaCbQpOffset;
2382  Int              m_chromaCrQpOffset;
2383
2384  UInt             m_numRefIdxL0DefaultActive;
2385  UInt             m_numRefIdxL1DefaultActive;
2386
2387  Bool             m_bUseWeightPred;                    //!< Use of Weighting Prediction (P_SLICE)
2388  Bool             m_useWeightedBiPred;                 //!< Use of Weighting Bi-Prediction (B_SLICE)
2389  Bool             m_OutputFlagPresentFlag;             //!< Indicates the presence of output_flag in slice header
2390  Bool             m_TransquantBypassEnableFlag;        //!< Indicates presence of cu_transquant_bypass_flag in CUs.
2391  Bool             m_useTransformSkip;
2392  Bool             m_dependentSliceSegmentsEnabledFlag; //!< Indicates the presence of dependent slices
2393  Bool             m_tilesEnabledFlag;                  //!< Indicates the presence of tiles
2394  Bool             m_entropyCodingSyncEnabledFlag;      //!< Indicates the presence of wavefronts
2395
2396  Bool             m_loopFilterAcrossTilesEnabledFlag;
2397  Bool             m_uniformSpacingFlag;
2398  Int              m_numTileColumnsMinus1;
2399  Int              m_numTileRowsMinus1;
2400  std::vector<Int> m_tileColumnWidth;
2401  std::vector<Int> m_tileRowHeight;
2402
2403  Bool             m_signHideFlag;
2404
2405  Bool             m_cabacInitPresentFlag;
2406
2407  Bool             m_sliceHeaderExtensionPresentFlag;
2408  Bool             m_loopFilterAcrossSlicesEnabledFlag;
2409  Bool             m_deblockingFilterControlPresentFlag;
2410  Bool             m_deblockingFilterOverrideEnabledFlag;
2411  Bool             m_picDisableDeblockingFilterFlag;
2412  Int              m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
2413  Int              m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
2414  Bool             m_scalingListPresentFlag;
2415  TComScalingList  m_scalingList;                       //!< ScalingList class
2416  Bool             m_listsModificationPresentFlag;
2417  UInt             m_log2ParallelMergeLevelMinus2;
2418  Int              m_numExtraSliceHeaderBits;
2419
2420  TComPPSRExt      m_ppsRangeExtension;
2421
2422#if NH_MV
2423  Int              m_layerId; 
2424  Bool             m_ppsInferScalingListFlag;
2425  Int              m_ppsScalingListRefLayerId;
2426                   
2427  Bool             m_ppsRangeExtensionsFlag;
2428  Bool             m_ppsMultilayerExtensionFlag;
2429  Bool             m_pps3dExtensionFlag;
2430  Int              m_ppsExtension5bits;
2431
2432  Bool             m_pocResetInfoPresentFlag;
2433#endif
2434
2435#if NH_3D_DLT
2436  TComDLT                m_cDLT;
2437#endif
2438
2439public:
2440                         TComPPS();
2441  virtual                ~TComPPS();
2442
2443  Int                    getPPSId() const                                                 { return m_PPSId;                               }
2444  Void                   setPPSId(Int i)                                                  { m_PPSId = i;                                  }
2445  Int                    getSPSId() const                                                 { return m_SPSId;                               }
2446  Void                   setSPSId(Int i)                                                  { m_SPSId = i;                                  }
2447
2448  Int                    getPicInitQPMinus26() const                                      { return  m_picInitQPMinus26;                   }
2449  Void                   setPicInitQPMinus26( Int i )                                     { m_picInitQPMinus26 = i;                       }
2450  Bool                   getUseDQP() const                                                { return m_useDQP;                              }
2451  Void                   setUseDQP( Bool b )                                              { m_useDQP   = b;                               }
2452  Bool                   getConstrainedIntraPred() const                                  { return  m_bConstrainedIntraPred;              }
2453  Void                   setConstrainedIntraPred( Bool b )                                { m_bConstrainedIntraPred = b;                  }
2454  Bool                   getSliceChromaQpFlag() const                                     { return  m_bSliceChromaQpFlag;                 }
2455  Void                   setSliceChromaQpFlag( Bool b )                                   { m_bSliceChromaQpFlag = b;                     }
2456
2457  Void                   setMaxCuDQPDepth( UInt u )                                       { m_uiMaxCuDQPDepth = u;                        }
2458  UInt                   getMaxCuDQPDepth() const                                         { return m_uiMaxCuDQPDepth;                     }
2459
2460#if NH_3D_DLT
2461  Void                   setDLT( TComDLT cDLT )                                           { m_cDLT = cDLT;                                }
2462  const TComDLT*         getDLT() const                                                   { return &m_cDLT;                               }
2463  TComDLT*               getDLT()                                                         { return &m_cDLT;                               }
2464#endif
2465
2466
2467  Void                   setQpOffset(ComponentID compID, Int i )
2468  {
2469    if      (compID==COMPONENT_Cb)
2470    {
2471      m_chromaCbQpOffset = i;
2472    }
2473    else if (compID==COMPONENT_Cr)
2474    {
2475      m_chromaCrQpOffset = i;
2476    }
2477    else
2478    {
2479      assert(0);
2480    }
2481  }
2482  Int                    getQpOffset(ComponentID compID) const
2483  {
2484    return (compID==COMPONENT_Y) ? 0 : (compID==COMPONENT_Cb ? m_chromaCbQpOffset : m_chromaCrQpOffset );
2485  }
2486
2487  Void                   setNumRefIdxL0DefaultActive(UInt ui)                             { m_numRefIdxL0DefaultActive=ui;                }
2488  UInt                   getNumRefIdxL0DefaultActive() const                              { return m_numRefIdxL0DefaultActive;            }
2489  Void                   setNumRefIdxL1DefaultActive(UInt ui)                             { m_numRefIdxL1DefaultActive=ui;                }
2490  UInt                   getNumRefIdxL1DefaultActive() const                              { return m_numRefIdxL1DefaultActive;            }
2491
2492  Bool                   getUseWP() const                                                 { return m_bUseWeightPred;                      }
2493  Bool                   getWPBiPred() const                                              { return m_useWeightedBiPred;                   }
2494  Void                   setUseWP( Bool b )                                               { m_bUseWeightPred = b;                         }
2495  Void                   setWPBiPred( Bool b )                                            { m_useWeightedBiPred = b;                      }
2496
2497  Void                   setOutputFlagPresentFlag( Bool b )                               { m_OutputFlagPresentFlag = b;                  }
2498  Bool                   getOutputFlagPresentFlag() const                                 { return m_OutputFlagPresentFlag;               }
2499  Void                   setTransquantBypassEnableFlag( Bool b )                          { m_TransquantBypassEnableFlag = b;             }
2500  Bool                   getTransquantBypassEnableFlag() const                            { return m_TransquantBypassEnableFlag;          }
2501
2502  Bool                   getUseTransformSkip() const                                      { return m_useTransformSkip;                    }
2503  Void                   setUseTransformSkip( Bool b )                                    { m_useTransformSkip  = b;                      }
2504
2505  Void                   setLoopFilterAcrossTilesEnabledFlag(Bool b)                      { m_loopFilterAcrossTilesEnabledFlag = b;       }
2506  Bool                   getLoopFilterAcrossTilesEnabledFlag() const                      { return m_loopFilterAcrossTilesEnabledFlag;    }
2507  Bool                   getDependentSliceSegmentsEnabledFlag() const                     { return m_dependentSliceSegmentsEnabledFlag;   }
2508  Void                   setDependentSliceSegmentsEnabledFlag(Bool val)                   { m_dependentSliceSegmentsEnabledFlag = val;    }
2509  Bool                   getEntropyCodingSyncEnabledFlag() const                          { return m_entropyCodingSyncEnabledFlag;        }
2510  Void                   setEntropyCodingSyncEnabledFlag(Bool val)                        { m_entropyCodingSyncEnabledFlag = val;         }
2511
2512  Void                   setTilesEnabledFlag(Bool val)                                    { m_tilesEnabledFlag = val;                     }
2513  Bool                   getTilesEnabledFlag() const                                      { return m_tilesEnabledFlag;                    }
2514  Void                   setTileUniformSpacingFlag(Bool b)                                { m_uniformSpacingFlag = b;                     }
2515  Bool                   getTileUniformSpacingFlag() const                                { return m_uniformSpacingFlag;                  }
2516  Void                   setNumTileColumnsMinus1(Int i)                                   { m_numTileColumnsMinus1 = i;                   }
2517  Int                    getNumTileColumnsMinus1() const                                  { return m_numTileColumnsMinus1;                }
2518  Void                   setTileColumnWidth(const std::vector<Int>& columnWidth )         { m_tileColumnWidth = columnWidth;              }
2519  UInt                   getTileColumnWidth(UInt columnIdx) const                         { return  m_tileColumnWidth[columnIdx];         }
2520  Void                   setNumTileRowsMinus1(Int i)                                      { m_numTileRowsMinus1 = i;                      }
2521  Int                    getNumTileRowsMinus1() const                                     { return m_numTileRowsMinus1;                   }
2522  Void                   setTileRowHeight(const std::vector<Int>& rowHeight)              { m_tileRowHeight = rowHeight;                  }
2523  UInt                   getTileRowHeight(UInt rowIdx) const                              { return m_tileRowHeight[rowIdx];               }
2524
2525  Void                   setSignHideFlag( Bool signHideFlag )                             { m_signHideFlag = signHideFlag;                }
2526  Bool                   getSignHideFlag() const                                          { return m_signHideFlag;                        }
2527
2528  Void                   setCabacInitPresentFlag( Bool flag )                             { m_cabacInitPresentFlag = flag;                }
2529  Bool                   getCabacInitPresentFlag() const                                  { return m_cabacInitPresentFlag;                }
2530  Void                   setDeblockingFilterControlPresentFlag( Bool val )                { m_deblockingFilterControlPresentFlag = val;   }
2531  Bool                   getDeblockingFilterControlPresentFlag() const                    { return m_deblockingFilterControlPresentFlag;  }
2532  Void                   setDeblockingFilterOverrideEnabledFlag( Bool val )               { m_deblockingFilterOverrideEnabledFlag = val;  }
2533  Bool                   getDeblockingFilterOverrideEnabledFlag() const                   { return m_deblockingFilterOverrideEnabledFlag; }
2534  Void                   setPicDisableDeblockingFilterFlag(Bool val)                      { m_picDisableDeblockingFilterFlag = val;       } //!< set offset for deblocking filter disabled
2535  Bool                   getPicDisableDeblockingFilterFlag() const                        { return m_picDisableDeblockingFilterFlag;      } //!< get offset for deblocking filter disabled
2536  Void                   setDeblockingFilterBetaOffsetDiv2(Int val)                       { m_deblockingFilterBetaOffsetDiv2 = val;       } //!< set beta offset for deblocking filter
2537  Int                    getDeblockingFilterBetaOffsetDiv2() const                        { return m_deblockingFilterBetaOffsetDiv2;      } //!< get beta offset for deblocking filter
2538  Void                   setDeblockingFilterTcOffsetDiv2(Int val)                         { m_deblockingFilterTcOffsetDiv2 = val;         } //!< set tc offset for deblocking filter
2539  Int                    getDeblockingFilterTcOffsetDiv2() const                          { return m_deblockingFilterTcOffsetDiv2;        } //!< get tc offset for deblocking filter
2540  Bool                   getScalingListPresentFlag() const                                { return m_scalingListPresentFlag;              }
2541  Void                   setScalingListPresentFlag( Bool b )                              { m_scalingListPresentFlag  = b;                }
2542  TComScalingList&       getScalingList()                                                 { return m_scalingList;                         }
2543  const TComScalingList& getScalingList() const                                           { return m_scalingList;                         }
2544  Bool                   getListsModificationPresentFlag() const                          { return m_listsModificationPresentFlag;        }
2545  Void                   setListsModificationPresentFlag( Bool b )                        { m_listsModificationPresentFlag = b;           }
2546  UInt                   getLog2ParallelMergeLevelMinus2() const                          { return m_log2ParallelMergeLevelMinus2;        }
2547  Void                   setLog2ParallelMergeLevelMinus2(UInt mrgLevel)                   { m_log2ParallelMergeLevelMinus2 = mrgLevel;    }
2548  Int                    getNumExtraSliceHeaderBits() const                               { return m_numExtraSliceHeaderBits;             }
2549  Void                   setNumExtraSliceHeaderBits(Int i)                                { m_numExtraSliceHeaderBits = i;                }
2550  Void                   setLoopFilterAcrossSlicesEnabledFlag( Bool bValue )              { m_loopFilterAcrossSlicesEnabledFlag = bValue; }
2551  Bool                   getLoopFilterAcrossSlicesEnabledFlag() const                     { return m_loopFilterAcrossSlicesEnabledFlag;   }
2552  Bool                   getSliceHeaderExtensionPresentFlag() const                       { return m_sliceHeaderExtensionPresentFlag;     }
2553  Void                   setSliceHeaderExtensionPresentFlag(Bool val)                     { m_sliceHeaderExtensionPresentFlag = val;      }
2554
2555
2556  const TComPPSRExt&     getPpsRangeExtension() const                                     { return m_ppsRangeExtension;                   }
2557  TComPPSRExt&           getPpsRangeExtension()                                           { return m_ppsRangeExtension;                   }
2558
2559  // WAS: getTransformSkipLog2MaxSize and setTransformSkipLog2MaxSize
2560  // Now: getPpsRangeExtension().getLog2MaxTransformSkipBlockSize and getPpsRangeExtension().setLog2MaxTransformSkipBlockSize
2561
2562  // WAS: getUseCrossComponentPrediction and setUseCrossComponentPrediction
2563  // Now: getPpsRangeExtension().getCrossComponentPredictionEnabledFlag and getPpsRangeExtension().setCrossComponentPredictionEnabledFlag
2564
2565  // WAS: clearChromaQpAdjTable
2566  // Now: getPpsRangeExtension().clearChromaQpOffsetList
2567
2568  // WAS: getMaxCuChromaQpAdjDepth and setMaxCuChromaQpAdjDepth
2569  // Now: getPpsRangeExtension().getDiffCuChromaQpOffsetDepth and getPpsRangeExtension().setDiffCuChromaQpOffsetDepth
2570
2571  // WAS: getChromaQpAdjTableSize
2572  // Now: getPpsRangeExtension().getChromaQpOffsetListLen
2573
2574  // WAS: getChromaQpAdjTableAt and setChromaQpAdjTableAt
2575  // Now: getPpsRangeExtension().getChromaQpOffsetListEntry and getPpsRangeExtension().setChromaQpOffsetListEntry
2576
2577  // WAS: getSaoOffsetBitShift and setSaoOffsetBitShift
2578  // Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale
2579
2580#if NH_MV
2581  Void    setLayerId( Int  val )                                                     { m_layerId = val;                                           }
2582  Int     getLayerId(  ) const                                                       { return m_layerId;                                          }
2583
2584  Void    setPpsInferScalingListFlag( Bool flag )                                    { m_ppsInferScalingListFlag = flag;                          }
2585  Bool    getPpsInferScalingListFlag(  ) const                                       { return m_ppsInferScalingListFlag;                          }
2586
2587  Void    setPpsScalingListRefLayerId( Int  val )                                    { m_ppsScalingListRefLayerId = val;                          }
2588  Int     getPpsScalingListRefLayerId(  ) const                                      { return m_ppsScalingListRefLayerId;                         }
2589
2590  Void    setPpsRangeExtensionsFlag( Bool flag )                                     { m_ppsRangeExtensionsFlag = flag;                           }
2591  Bool    getPpsRangeExtensionsFlag(  ) const                                        { return m_ppsRangeExtensionsFlag;                           }
2592
2593  Void    setPpsMultilayerExtensionFlag( Bool flag )                                 { m_ppsMultilayerExtensionFlag = flag;                       }
2594  Bool    getPpsMultilayerExtensionFlag(  ) const                                    { return m_ppsMultilayerExtensionFlag;                       }
2595
2596  Void    setPps3dExtensionFlag( Bool flag )                                         { m_pps3dExtensionFlag = flag;                               }
2597  Bool    getPps3dExtensionFlag(  ) const                                            { return m_pps3dExtensionFlag;                               }
2598
2599  Void    setPpsExtension5bits( Int  val )                                           { m_ppsExtension5bits = val;                                 }
2600  Int     getPpsExtension5bits(  ) const                                             { return m_ppsExtension5bits;                                }
2601
2602  Void    setPocResetInfoPresentFlag( Bool flag )                                    { m_pocResetInfoPresentFlag = flag;                          }
2603  Bool    getPocResetInfoPresentFlag(  ) const                                       { return m_pocResetInfoPresentFlag;                          }
2604#endif
2605};
2606struct WPScalingParam
2607{
2608  // Explicit weighted prediction parameters parsed in slice header,
2609  // or Implicit weighted prediction parameters (8 bits depth values).
2610  Bool bPresentFlag;
2611  UInt uiLog2WeightDenom;
2612  Int  iWeight;
2613  Int  iOffset;
2614
2615  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
2616  Int  w;
2617  Int  o;
2618  Int  offset;
2619  Int  shift;
2620  Int  round;
2621};
2622
2623struct WPACDCParam
2624{
2625  Int64 iAC;
2626  Int64 iDC;
2627};
2628
2629/// slice header class
2630class TComSlice
2631{
2632
2633private:
2634  //  Bitstream writing
2635#if NH_MV
2636  Bool                       m_firstSliceSegmentInPicFlag; 
2637#endif
2638  Bool                       m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE];
2639  Int                        m_iPPSId;               ///< picture parameter set ID
2640  Bool                       m_PicOutputFlag;        ///< pic_output_flag
2641#if NH_MV
2642  Int                        m_slicePicOrderCntLsb;   
2643  Bool                       m_shortTermRefPicSetSpsFlag;
2644  Int                        m_shortTermRefPicSetIdx;
2645  Int                        m_numLongTermSps;
2646  Int                        m_numLongTermPics;
2647  Int                        m_ltIdxSps                     [MAX_NUM_PICS_RPS];
2648  Int                        m_pocLsbLt                     [MAX_NUM_PICS_RPS];
2649  Bool                       m_usedByCurrPicLtFlag          [MAX_NUM_PICS_RPS];
2650  Bool                       m_deltaPocMsbPresentFlag       [MAX_NUM_PICS_RPS];
2651  Int                        m_deltaPocMsbCycleLt           [MAX_NUM_PICS_RPS];
2652  Bool                       m_sliceTemporalMvpEnabledFlag;
2653  TComStRefPicSet            m_stRefPicSet; 
2654#endif 
2655  Int                        m_iPOC;
2656#if NH_MV
2657  Int                        m_iPOCBeforeReset; 
2658#endif
2659  Int                        m_iLastIDR;
2660  Int                        m_iAssociatedIRAP;
2661  NalUnitType                m_iAssociatedIRAPType;
2662  const TComReferencePictureSet* m_pRPS;             //< pointer to RPS, either in the SPS or the local RPS in the same slice header
2663  TComReferencePictureSet    m_localRPS;             //< RPS when present in slice header
2664  Int                        m_rpsIdx;               //< index of used RPS in the SPS or -1 for local RPS in the slice header
2665  TComRefPicListModification m_RefPicListModification;
2666  NalUnitType                m_eNalUnitType;         ///< Nal unit type for the slice
2667  SliceType                  m_eSliceType;
2668  Int                        m_iSliceQp;
2669  Bool                       m_dependentSliceSegmentFlag;
2670#if ADAPTIVE_QP_SELECTION
2671  Int                        m_iSliceQpBase;
2672#endif
2673  Bool                       m_ChromaQpAdjEnabled;
2674  Bool                       m_deblockingFilterDisable;
2675  Bool                       m_deblockingFilterOverrideFlag;      //< offsets for deblocking filter inherit from PPS
2676  Int                        m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
2677  Int                        m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
2678  Int                        m_list1IdxToList0Idx[MAX_NUM_REF];
2679  Int                        m_aiNumRefIdx   [NUM_REF_PIC_LIST_01];    //  for multiple reference of current slice
2680
2681  Bool                       m_bCheckLDC;
2682
2683  //  Data
2684  Int                        m_iSliceQpDelta;
2685  Int                        m_iSliceChromaQpDelta[MAX_NUM_COMPONENT];
2686  TComPic*                   m_apcRefPicList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
2687  Int                        m_aiRefPOCList  [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
2688#if NH_MV
2689  Int                        m_aiRefLayerIdList[2][MAX_NUM_REF+1];
2690#endif
2691  Bool                       m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
2692  Int                        m_iDepth;
2693
2694  // referenced slice?
2695  Bool                       m_bRefenced;
2696
2697  // access channel
2698  const TComVPS*             m_pcVPS;
2699  const TComSPS*             m_pcSPS;
2700  const TComPPS*             m_pcPPS;
2701  TComPic*                   m_pcPic;
2702  Bool                       m_colFromL0Flag;  // collocated picture from List0 flag
2703
2704  Bool                       m_noOutputPriorPicsFlag;
2705  Bool                       m_noRaslOutputFlag;
2706  Bool                       m_handleCraAsBlaFlag;
2707
2708  UInt                       m_colRefIdx;
2709  UInt                       m_maxNumMergeCand;
2710
2711  Double                     m_lambdas[MAX_NUM_COMPONENT];
2712
2713  Bool                       m_abEqualRef  [NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_REF];
2714  UInt                       m_uiTLayer;
2715  Bool                       m_bTLayerSwitchingFlag;
2716
2717  SliceConstraint            m_sliceMode;
2718  UInt                       m_sliceArgument;
2719  UInt                       m_sliceCurStartCtuTsAddr;
2720  UInt                       m_sliceCurEndCtuTsAddr;
2721  UInt                       m_sliceIdx;
2722  SliceConstraint            m_sliceSegmentMode;
2723  UInt                       m_sliceSegmentArgument;
2724  UInt                       m_sliceSegmentCurStartCtuTsAddr;
2725  UInt                       m_sliceSegmentCurEndCtuTsAddr;
2726  Bool                       m_nextSlice;
2727  Bool                       m_nextSliceSegment;
2728  UInt                       m_sliceBits;
2729  UInt                       m_sliceSegmentBits;
2730  Bool                       m_bFinalized;
2731
2732  Bool                       m_bTestWeightPred;
2733  Bool                       m_bTestWeightBiPred;
2734  WPScalingParam             m_weightPredTable[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
2735  WPACDCParam                m_weightACDCParam[MAX_NUM_COMPONENT];
2736
2737  std::vector<UInt>          m_substreamSizes;
2738
2739  Bool                       m_cabacInitFlag;
2740
2741  Bool                       m_bLMvdL1Zero;
2742  Bool                       m_temporalLayerNonReferenceFlag;
2743  Bool                       m_LFCrossSliceBoundaryFlag;
2744
2745  Bool                       m_enableTMVPFlag;
2746
2747  SliceType                  m_encCABACTableIdx;           // Used to transmit table selection across slices.
2748#if NH_MV
2749
2750  std::vector<TComPic*>* m_refPicSetInterLayer0; 
2751  std::vector<TComPic*>* m_refPicSetInterLayer1; 
2752  Int        m_layerId; 
2753  Int        m_viewId;
2754  Int        m_viewIndex; 
2755#if NH_3D
2756  Bool       m_isDepth;
2757#endif
2758
2759// Additional slice header syntax elements
2760  Bool       m_pocResetFlag; 
2761
2762  Bool       m_crossLayerBlaFlag;
2763  Bool       m_discardableFlag;
2764  Bool       m_interLayerPredEnabledFlag;
2765  Int        m_numInterLayerRefPicsMinus1;
2766  Int        m_interLayerPredLayerIdc       [MAX_NUM_LAYERS];
2767
2768  Int        m_sliceSegmentHeaderExtensionLength;
2769  Int        m_pocResetIdc;
2770  Int        m_pocResetPeriodId;
2771
2772  Bool       m_hasPocResetPeriodIdPresent; 
2773  DecodingProcess m_decodingProcess; 
2774  DecodingProcess m_decProcPocAndRps; 
2775  Bool       m_fullPocResetFlag;
2776  Int        m_pocLsbVal;
2777  Bool       m_pocMsbCycleValPresentFlag;
2778  Int        m_pocMsbCycleVal;
2779  Bool       m_pocMsbValRequiredFlag;
2780
2781#if NH_3D
2782  IntAry2d   m_aaiCodedScale ;
2783  IntAry2d   m_aaiCodedOffset;
2784#endif
2785#if NH_3D_TMVP
2786  Int        m_aiAlterRefIdx   [2]; 
2787#endif
2788#if NH_3D_ARP
2789  Bool       m_arpRefPicAvailable[2][MAX_NUM_LAYERS];
2790  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
2791  UInt        m_nARPStepNum; 
2792  Int         m_aiFirstTRefIdx    [2];   
2793#endif
2794#if NH_3D
2795  std::vector<Int> m_pocsInCurrRPSs; 
2796#endif
2797#if NH_3D_IC
2798  Bool       m_bApplyIC;
2799  Bool       m_icSkipParseFlag;
2800#endif
2801#if NH_3D
2802  std::vector<Int> m_inCmpRefViewIdcs;
2803  Bool       m_inCmpPredAvailFlag; 
2804  Bool       m_inCmpPredFlag; 
2805  Bool       m_cpAvailableFlag; 
2806  Int        m_numViews; 
2807  TComPic*   m_ivPicsCurrPoc [2][MAX_NUM_LAYERS]; 
2808  Int**      m_depthToDisparityB; 
2809  Int**      m_depthToDisparityF; 
2810  Bool       m_bApplyDIS;
2811#endif
2812#endif
2813#if NH_3D_IC
2814  Int*       m_aICEnableCandidate;
2815  Int*       m_aICEnableNum;
2816#endif       
2817#if NH_3D   
2818  Int        m_iDefaultRefViewIdx;
2819  Bool       m_bDefaultRefViewIdxAvailableFlag;
2820             
2821  Bool       m_ivMvPredFlag         ;
2822  Bool       m_ivMvScalingFlag      ;
2823  Bool       m_ivResPredFlag        ;
2824  Bool       m_depthRefinementFlag  ;
2825  Bool       m_viewSynthesisPredFlag;
2826  Bool       m_depthBasedBlkPartFlag;
2827  Bool       m_mpiFlag              ;
2828  Bool       m_intraContourFlag     ;
2829  Bool       m_intraSdcWedgeFlag    ;
2830  Bool       m_qtPredFlag           ;
2831  Bool       m_interSdcFlag         ;
2832  Bool       m_depthIntraSkipFlag   ;
2833  Int        m_mpiSubPbSize         ; 
2834  Int        m_subPbSize            ; 
2835#endif
2836public:
2837                              TComSlice();
2838  virtual                     ~TComSlice();
2839  Void                        initSlice();
2840
2841  Void                        setVPS( TComVPS* pcVPS )                               { m_pcVPS = pcVPS;                                              }
2842  const TComVPS*              getVPS() const                                         { return m_pcVPS;                                               }
2843  Void                        setSPS( const TComSPS* pcSPS )                         { m_pcSPS = pcSPS;                                              }
2844  const TComSPS*              getSPS() const                                         { return m_pcSPS;                                               }
2845
2846  Void                        setPPS( const TComPPS* pcPPS )                         { m_pcPPS = pcPPS; m_iPPSId = (pcPPS) ? pcPPS->getPPSId() : -1; }
2847  const TComPPS*              getPPS() const                                         { return m_pcPPS;                                               }
2848
2849  Void                        setPPSId( Int PPSId )                                  { m_iPPSId = PPSId;                                             }
2850  Int                         getPPSId() const                                       { return m_iPPSId;                                              }
2851  Void                        setPicOutputFlag( Bool b   )                           { m_PicOutputFlag = b;                                          }
2852#if NH_MV
2853  Void                        setSlicePicOrderCntLsb( Int i )                        { m_slicePicOrderCntLsb = i;                                    }
2854  Int                         getSlicePicOrderCntLsb(  )  const                      { return m_slicePicOrderCntLsb;                                 }
2855
2856  Bool                        getFirstSliceSegementInPicFlag() const                 {  return m_firstSliceSegmentInPicFlag;                         }
2857  Void                        setFirstSliceSegementInPicFlag(Bool val)               { m_firstSliceSegmentInPicFlag = val;                           }
2858#endif
2859  Bool                        getPicOutputFlag() const                               { return m_PicOutputFlag;                                       }
2860  Void                        setSaoEnabledFlag(ChannelType chType, Bool s)          {m_saoEnabledFlag[chType] =s;                                   }
2861  Bool                        getSaoEnabledFlag(ChannelType chType) const            { return m_saoEnabledFlag[chType];                              }
2862  Void                        setRPS( const TComReferencePictureSet *pcRPS )         { m_pRPS = pcRPS;                                               }
2863  const TComReferencePictureSet* getRPS()                                            { return m_pRPS;                                                }
2864  TComReferencePictureSet*    getLocalRPS()                                          { return &m_localRPS;                                           }
2865
2866  Void                        setRPSidx( Int rpsIdx )                                { m_rpsIdx = rpsIdx;                                            }
2867  Int                         getRPSidx() const                                      { return m_rpsIdx;                                              }
2868  TComRefPicListModification* getRefPicListModification()                            { return &m_RefPicListModification;                             }
2869  Void                        setLastIDR(Int iIDRPOC)                                { m_iLastIDR = iIDRPOC;                                         }
2870  Int                         getLastIDR() const                                     { return m_iLastIDR;                                            }
2871  Void                        setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)           { m_iAssociatedIRAP = iAssociatedIRAPPOC;                       }
2872  Int                         getAssociatedIRAPPOC() const                           { return m_iAssociatedIRAP;                                     }
2873  Void                        setAssociatedIRAPType(NalUnitType associatedIRAPType)  { m_iAssociatedIRAPType = associatedIRAPType;                   }
2874  NalUnitType                 getAssociatedIRAPType() const                          { return m_iAssociatedIRAPType;                                 }
2875  SliceType                   getSliceType() const                                   { return m_eSliceType;                                          }
2876  Int                         getPOC() const                                         { return m_iPOC;                                                }
2877  Int                         getSliceQp() const                                     { return m_iSliceQp;                                            }
2878  Bool                        getDependentSliceSegmentFlag() const                   { return m_dependentSliceSegmentFlag;                           }
2879  Void                        setDependentSliceSegmentFlag(Bool val)                 { m_dependentSliceSegmentFlag = val;                            }
2880#if ADAPTIVE_QP_SELECTION
2881  Int                         getSliceQpBase() const                                 { return m_iSliceQpBase;                                        }
2882#endif
2883  Int                         getSliceQpDelta() const                                { return m_iSliceQpDelta;                                       }
2884  Int                         getSliceChromaQpDelta(ComponentID compID) const        { return isLuma(compID) ? 0 : m_iSliceChromaQpDelta[compID];    }
2885  Bool                        getUseChromaQpAdj() const                              { return m_ChromaQpAdjEnabled;                                  }
2886  Bool                        getDeblockingFilterDisable() const                     { return m_deblockingFilterDisable;                             }
2887  Bool                        getDeblockingFilterOverrideFlag() const                { return m_deblockingFilterOverrideFlag;                        }
2888  Int                         getDeblockingFilterBetaOffsetDiv2()const               { return m_deblockingFilterBetaOffsetDiv2;                      }
2889  Int                         getDeblockingFilterTcOffsetDiv2() const                { return m_deblockingFilterTcOffsetDiv2;                        }
2890
2891  Int                         getNumRefIdx( RefPicList e ) const                     { return m_aiNumRefIdx[e];                                      }
2892  TComPic*                    getPic()                                               { return m_pcPic;                                               }
2893  TComPic*                    getRefPic( RefPicList e, Int iRefIdx)                  { return m_apcRefPicList[e][iRefIdx];                           }
2894  Int                         getRefPOC( RefPicList e, Int iRefIdx)                  { return m_aiRefPOCList[e][iRefIdx];                            }
2895#if NH_3D
2896  Bool                        getInCmpPredAvailFlag( )                 const         { return m_inCmpPredAvailFlag;                                  }
2897  Bool                        getCpAvailableFlag( )                    const         { return m_cpAvailableFlag;                                     }
2898  Bool                        getInCompPredFlag( )                     const         { return m_inCmpPredFlag;                                       }
2899  Void                        setInCompPredFlag( Bool b )                            { m_inCmpPredFlag = b;                                          }
2900  Int                         getInCmpRefViewIdcs( Int i )             const         { return m_inCmpRefViewIdcs  [i];                               }
2901  Int                         getNumCurCmpLIds( )                      const         { return (Int) m_inCmpRefViewIdcs.size();                       }
2902  TComPic*                    getIvPic( Bool depthFlag, Int viewIndex) const         { return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ];    }
2903  TComPic*                    getTexturePic       ()                                 { return  m_ivPicsCurrPoc[0][ m_viewIndex ];                    }
2904#endif                           
2905#if NH_3D_IC                                                                                                                                         
2906  Void                        setApplyIC( Bool b )                                   { m_bApplyIC = b;                                               }
2907  Bool                        getApplyIC()                                           { return m_bApplyIC;                                            }
2908  Void                        xSetApplyIC();                                                                                                         
2909  Void                        xSetApplyIC(Bool bUseLowLatencyICEnc);                                                                                 
2910  Void                        setIcSkipParseFlag( Bool b )                           { m_icSkipParseFlag = b;                                        }
2911  Bool                        getIcSkipParseFlag()                                   { return m_icSkipParseFlag;                                     }
2912#endif                                                                                                                                               
2913#if NH_3D_ARP                                                                                                                                         
2914  Void                        setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic; }                 
2915  Void                        setARPStepNum( TComPicLists*ivPicLists );                                                                             
2916  Void                        setPocsInCurrRPSs( );
2917
2918  TComPic*                    getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )     { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
2919  UInt                        getARPStepNum( )                                       { return m_nARPStepNum;                                         } 
2920#endif
2921  Int                         getDepth() const                                       { return m_iDepth;                                              }
2922  Bool                        getColFromL0Flag() const                               { return m_colFromL0Flag;                                       }
2923  UInt                        getColRefIdx() const                                   { return m_colRefIdx;                                           }
2924  Void                        checkColRefIdx(UInt curSliceIdx, TComPic* pic);
2925  Bool                        getIsUsedAsLongTerm(Int i, Int j) const                { return m_bIsUsedAsLongTerm[i][j];                             }
2926  Void                        setIsUsedAsLongTerm(Int i, Int j, Bool value)          { m_bIsUsedAsLongTerm[i][j] = value;                            }
2927  Bool                        getCheckLDC() const                                    { return m_bCheckLDC;                                           }
2928  Bool                        getMvdL1ZeroFlag() const                               { return m_bLMvdL1Zero;                                         }
2929  Int                         getNumRpsCurrTempList() const;
2930#if NH_MV
2931  Int                         getNumPicTotalCurr() const;
2932#endif
2933  Int                         getList1IdxToList0Idx( Int list1Idx ) const            { return m_list1IdxToList0Idx[list1Idx];                        }
2934  Void                        setReferenced(Bool b)                                  { m_bRefenced = b;                                              }
2935  Bool                        isReferenced() const                                   { return m_bRefenced;                                           }
2936  Bool                        isReferenceNalu() const                                { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); }
2937  Void                        setPOC( Int i )                                        { m_iPOC              = i; }
2938  Void                        setNalUnitType( NalUnitType e )                        { m_eNalUnitType      = e;                                      }
2939  NalUnitType                 getNalUnitType() const                                 { return m_eNalUnitType;                                        }
2940#if NH_MV
2941  std::string                 getNalUnitTypeString(    )                             { return NALU_TYPE_STR[ getNalUnitType() ]; };
2942#endif
2943  Bool                        getRapPicFlag() const;
2944  Bool                        getIdrPicFlag() const                                  { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
2945  Bool                        isIRAP() const                                         { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23);  }
2946#if NH_MV 
2947  Bool                        isBla() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   )  || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); }
2948  Bool                        isIdr() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL )  || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ); }
2949  Bool                        isCra() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ); }
2950
2951  Bool                        isSlnr() const                                         { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N  ||   
2952                                                                                                getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N    ||   
2953                                                                                                getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N   ||   
2954                                                                                                getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N   ||   
2955                                                                                                getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N   ||   
2956                                                                                                getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10     ||
2957                                                                                                getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12     ||           
2958                                                                                                getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14     );  }
2959 
2960  Bool                        isRasl() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R )  || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N ); }
2961  Bool                        isRadl() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R )  || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N ); }
2962  Bool                        isStsa() const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R )  || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ); }
2963  Bool                        isTsa()  const                                          { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R )   || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ); }
2964
2965  Bool                        decProcClause8() const                                  { return ( m_decodingProcess == CLAUSE_8  ); }   
2966  Bool                        decProcAnnexF()  const                                  { return ( decProcAnnexG()  || decProcAnnexH() || decProcAnnexI() ) ; }
2967  Bool                        decProcAnnexG()  const                                  { return ( m_decodingProcess == ANNEX_G || decProcAnnexI()  ); }   
2968  Bool                        decProcAnnexH()  const                                  { return ( m_decodingProcess == ANNEX_H  ); }   
2969  Bool                        decProcAnnexI()  const                                  { return ( m_decodingProcess == ANNEX_I  ); }   
2970  Int                         getCurrRpsIdx() const                                   { return ( getShortTermRefPicSetSpsFlag() ? getShortTermRefPicSetIdx() : getSPS()->getNumShortTermRefPicSets() ) ;}
2971
2972#endif
2973
2974
2975  Void                        checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
2976  Void                        decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, const bool bEfficientFieldIRAPEnabled);
2977  Void                        setSliceType( SliceType e )                            { m_eSliceType        = e;                                      }
2978  Void                        setSliceQp( Int i )                                    { m_iSliceQp          = i;                                      }
2979#if ADAPTIVE_QP_SELECTION
2980  Void                        setSliceQpBase( Int i )                                { m_iSliceQpBase      = i;                                      }
2981#endif
2982  Void                        setSliceQpDelta( Int i )                               { m_iSliceQpDelta     = i;                                      }
2983  Void                        setSliceChromaQpDelta( ComponentID compID, Int i )     { m_iSliceChromaQpDelta[compID] = isLuma(compID) ? 0 : i;       }
2984  Void                        setUseChromaQpAdj( Bool b )                            { m_ChromaQpAdjEnabled = b;                                     }
2985  Void                        setDeblockingFilterDisable( Bool b )                   { m_deblockingFilterDisable= b;                                 }
2986  Void                        setDeblockingFilterOverrideFlag( Bool b )              { m_deblockingFilterOverrideFlag = b;                           }
2987  Void                        setDeblockingFilterBetaOffsetDiv2( Int i )             { m_deblockingFilterBetaOffsetDiv2 = i;                         }
2988  Void                        setDeblockingFilterTcOffsetDiv2( Int i )               { m_deblockingFilterTcOffsetDiv2 = i;                           }
2989
2990  Void                        setRefPic( TComPic* p, RefPicList e, Int iRefIdx )     { m_apcRefPicList[e][iRefIdx] = p;                              }
2991  Void                        setRefPOC( Int i, RefPicList e, Int iRefIdx )          { m_aiRefPOCList[e][iRefIdx] = i;                               }
2992  Void                        setNumRefIdx( RefPicList e, Int i )                    { m_aiNumRefIdx[e]    = i;                                      }
2993#if NH_MV
2994  Int                         getNumRefIdxL0ActiveMinus1() const                     { return ( getNumRefIdx(REF_PIC_LIST_0) -1);                    }
2995  Int                         getNumRefIdxL1ActiveMinus1() const                     { return ( getNumRefIdx(REF_PIC_LIST_1) -1);                    }
2996#endif
2997  Void                        setPic( TComPic* p )                                   { m_pcPic             = p;                                      }
2998  Void                        setDepth( Int iDepth )                                 { m_iDepth            = iDepth;                                 }
2999#if NH_MV
3000  Void                        setPocBeforeReset( Int i )                             { m_iPOCBeforeReset = i;                                        }
3001  Int                         getPocBeforeReset( )                                   { return m_iPOCBeforeReset;                                     }
3002  Int                         getRefLayerId( RefPicList e, Int iRefIdx)              { return  m_aiRefLayerIdList[e][iRefIdx];                       }
3003  Void                        setRefLayerId( Int i, RefPicList e, Int iRefIdx )      { m_aiRefLayerIdList[e][iRefIdx] = i;                        }
3004  Void                        getTempRefPicLists   ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1,                                     
3005                                                     std::vector<TComPic*> rpsCurrList[2], BoolAry1d usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr = false );
3006                             
3007  Void                        setRefPicList        ( std::vector<TComPic*> rpsCurrList[2], BoolAry1d usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr = false ); 
3008#else
3009  Void                        setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
3010#endif
3011  Void                        setRefPOCList();
3012  Void                        setColFromL0Flag( Bool colFromL0 )                     { m_colFromL0Flag = colFromL0;                                  }
3013  Void                        setColRefIdx( UInt refIdx)                             { m_colRefIdx = refIdx;                                         }
3014  Void                        setCheckLDC( Bool b )                                  { m_bCheckLDC = b;                                              }
3015  Void                        setMvdL1ZeroFlag( Bool b)                              { m_bLMvdL1Zero = b;                                            }
3016
3017  Bool                        isIntra() const                                        { return m_eSliceType == I_SLICE;                               }
3018  Bool                        isInterB() const                                       { return m_eSliceType == B_SLICE;                               }
3019  Bool                        isInterP() const                                       { return m_eSliceType == P_SLICE;                               }
3020
3021  Void                        setLambdas( const Double lambdas[MAX_NUM_COMPONENT] )  { for (Int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; }
3022  const Double*               getLambdas() const                                     { return m_lambdas;                                             }
3023
3024  Void                        initEqualRef();
3025  Bool                        isEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
3026  {
3027    assert(e<NUM_REF_PIC_LIST_01);
3028    if (iRefIdx1 < 0 || iRefIdx2 < 0)
3029    {
3030      return false;
3031    }
3032    else
3033    {
3034      return m_abEqualRef[e][iRefIdx1][iRefIdx2];
3035    }
3036  }
3037
3038  Void                        setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
3039  {
3040    assert(e<NUM_REF_PIC_LIST_01);
3041    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
3042  }
3043
3044  static Void                 sortPicList( TComList<TComPic*>& rcListPic );
3045  Void                        setList1IdxToList0Idx();
3046
3047  UInt                        getTLayer() const                                      { return m_uiTLayer;                                            }
3048  Void                        setTLayer( UInt uiTLayer )                             { m_uiTLayer = uiTLayer;                                        }
3049#if NH_MV
3050  Int                         getTemporalId( ) const                                 { return (Int) m_uiTLayer;                                      }
3051#endif
3052
3053  Void                        setTLayerInfo( UInt uiTLayer );
3054  Void                        decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
3055  Void                        checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic );
3056  Void                        applyReferencePictureSet( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *RPSList);
3057#if NH_MV
3058  Void                        createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 );
3059  Void                        f834decProcForRefPicListConst();
3060  Void                        cl834DecProcForRefPicListConst();
3061
3062  static Void                 markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 );
3063  static Void                 markCurrPic                 ( TComPic* currPic );
3064  Void                        printRefPicList();
3065#endif
3066  Bool                        isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
3067  Bool                        isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
3068  Int                         checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0, Bool bUseRecoveryPoint = false);
3069  Void                        createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint, const Bool bEfficientFieldIRAPEnabled);
3070  Void                        setMaxNumMergeCand(UInt val )                          { m_maxNumMergeCand = val;                                      }
3071  UInt                        getMaxNumMergeCand() const                             { return m_maxNumMergeCand;                                     }
3072
3073  Void                        setNoOutputPriorPicsFlag( Bool val )                   { m_noOutputPriorPicsFlag = val;                                }
3074  Bool                        getNoOutputPriorPicsFlag() const                       { return m_noOutputPriorPicsFlag;                               }
3075
3076  Void                        setNoRaslOutputFlag( Bool val )                        { m_noRaslOutputFlag = val;                                     }
3077  Bool                        getNoRaslOutputFlag() const                            { return m_noRaslOutputFlag;                                    }
3078
3079
3080  Void                        setHandleCraAsBlaFlag( Bool val )                      { m_handleCraAsBlaFlag = val;                                   }
3081  Bool                        getHandleCraAsBlaFlag() const                          { return m_handleCraAsBlaFlag;                                  }
3082
3083  Void                        setSliceMode( SliceConstraint mode )                   { m_sliceMode = mode;                                           }
3084  SliceConstraint             getSliceMode() const                                   { return m_sliceMode;                                           }
3085  Void                        setSliceArgument( UInt uiArgument )                    { m_sliceArgument = uiArgument;                                 }
3086  UInt                        getSliceArgument() const                               { return m_sliceArgument;                                       }
3087  Void                        setSliceCurStartCtuTsAddr( UInt ctuTsAddr )            { m_sliceCurStartCtuTsAddr = ctuTsAddr;                         } // CTU Tile-scan address (as opposed to raster-scan)
3088  UInt                        getSliceCurStartCtuTsAddr() const                      { return m_sliceCurStartCtuTsAddr;                              } // CTU Tile-scan address (as opposed to raster-scan)
3089  Void                        setSliceCurEndCtuTsAddr( UInt ctuTsAddr )              { m_sliceCurEndCtuTsAddr = ctuTsAddr;                           } // CTU Tile-scan address (as opposed to raster-scan)
3090  UInt                        getSliceCurEndCtuTsAddr() const                        { return m_sliceCurEndCtuTsAddr;                                } // CTU Tile-scan address (as opposed to raster-scan)
3091  Void                        setSliceIdx( UInt i)                                   { m_sliceIdx = i;                                               }
3092  UInt                        getSliceIdx() const                                    { return  m_sliceIdx;                                           }
3093  Void                        copySliceInfo(TComSlice *pcSliceSrc);
3094  Void                        setSliceSegmentMode( SliceConstraint mode )            { m_sliceSegmentMode = mode;                                    }
3095  SliceConstraint             getSliceSegmentMode() const                            { return m_sliceSegmentMode;                                    }
3096  Void                        setSliceSegmentArgument( UInt uiArgument )             { m_sliceSegmentArgument = uiArgument;                          }
3097  UInt                        getSliceSegmentArgument() const                        { return m_sliceSegmentArgument;                                }
3098  Void                        setSliceSegmentCurStartCtuTsAddr( UInt ctuTsAddr )     { m_sliceSegmentCurStartCtuTsAddr = ctuTsAddr;                  } // CTU Tile-scan address (as opposed to raster-scan)
3099  UInt                        getSliceSegmentCurStartCtuTsAddr() const               { return m_sliceSegmentCurStartCtuTsAddr;                       } // CTU Tile-scan address (as opposed to raster-scan)
3100  Void                        setSliceSegmentCurEndCtuTsAddr( UInt ctuTsAddr )       { m_sliceSegmentCurEndCtuTsAddr = ctuTsAddr;                    } // CTU Tile-scan address (as opposed to raster-scan)
3101  UInt                        getSliceSegmentCurEndCtuTsAddr() const                 { return m_sliceSegmentCurEndCtuTsAddr;                         } // CTU Tile-scan address (as opposed to raster-scan)
3102  Void                        setSliceBits( UInt uiVal )                             { m_sliceBits = uiVal;                                          }
3103  UInt                        getSliceBits() const                                   { return m_sliceBits;                                           }
3104  Void                        setSliceSegmentBits( UInt uiVal )                      { m_sliceSegmentBits = uiVal;                                   }
3105  UInt                        getSliceSegmentBits() const                            { return m_sliceSegmentBits;                                    }
3106  Void                        setFinalized( Bool uiVal )                             { m_bFinalized = uiVal;                                         }
3107  Bool                        getFinalized() const                                   { return m_bFinalized;                                          }
3108  Bool                        testWeightPred( ) const                                { return m_bTestWeightPred;                                     }
3109  Void                        setTestWeightPred( Bool bValue )                       { m_bTestWeightPred = bValue;                                   }
3110  Bool                        testWeightBiPred( ) const                              { return m_bTestWeightBiPred;                                   }
3111  Void                        setTestWeightBiPred( Bool bValue )                     { m_bTestWeightBiPred = bValue;                                 }
3112  Void                        setWpScaling( WPScalingParam  wp[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT] )
3113  {
3114    memcpy(m_weightPredTable, wp, sizeof(WPScalingParam)*NUM_REF_PIC_LIST_01*MAX_NUM_REF*MAX_NUM_COMPONENT);
3115  }
3116
3117  Void                        getWpScaling( RefPicList e, Int iRefIdx, WPScalingParam *&wp);
3118
3119  Void                        resetWpScaling();
3120  Void                        initWpScaling(const TComSPS *sps);
3121
3122  Void                        setWpAcDcParam( WPACDCParam wp[MAX_NUM_COMPONENT] )
3123  {
3124    memcpy(m_weightACDCParam, wp, sizeof(WPACDCParam)*MAX_NUM_COMPONENT);
3125  }
3126
3127  Void                        getWpAcDcParam( WPACDCParam *&wp );
3128  Void                        initWpAcDcParam();
3129
3130  Void                        clearSubstreamSizes( )                                 { return m_substreamSizes.clear();                              }
3131  UInt                        getNumberOfSubstreamSizes( )                           { return (UInt) m_substreamSizes.size();                        }
3132  Void                        addSubstreamSize( UInt size )                          { m_substreamSizes.push_back(size);                             }
3133  UInt                        getSubstreamSize( Int idx )                            { assert(idx<getNumberOfSubstreamSizes()); return m_substreamSizes[idx]; }
3134
3135  Void                        setCabacInitFlag( Bool val )                           { m_cabacInitFlag = val;                                        } //!< set CABAC initial flag
3136  Bool                        getCabacInitFlag()                                     { return m_cabacInitFlag;                                       } //!< get CABAC initial flag
3137  Bool                        getTemporalLayerNonReferenceFlag()                     { return m_temporalLayerNonReferenceFlag;                       }
3138  Void                        setTemporalLayerNonReferenceFlag(Bool x)               { m_temporalLayerNonReferenceFlag = x;                          }
3139  Void                        setLFCrossSliceBoundaryFlag( Bool   val )              { m_LFCrossSliceBoundaryFlag = val;                             }
3140  Bool                        getLFCrossSliceBoundaryFlag()                          { return m_LFCrossSliceBoundaryFlag;                            }
3141
3142#if NH_MV
3143  Void                        setShortTermRefPicSetSpsFlag( Bool flag )              { m_shortTermRefPicSetSpsFlag = flag;                           }
3144  Bool                        getShortTermRefPicSetSpsFlag(  ) const                 { return m_shortTermRefPicSetSpsFlag;                           }
3145
3146  Int                         getShortTermRefPicSetIdxLen() const                    { return gCeilLog2( getSPS()->getNumShortTermRefPicSets() );    }
3147  Void                        setShortTermRefPicSetIdx( Int  val )                   { m_shortTermRefPicSetIdx = val;                                }
3148  Int                         getShortTermRefPicSetIdx(  ) const                     { return m_shortTermRefPicSetIdx;                               }
3149 
3150  Void                        setNumLongTermSps( Int  val )                          { m_numLongTermSps = val;                                       }
3151  Int                         getNumLongTermSps(  ) const                            { return m_numLongTermSps;                                      }
3152
3153  Void                        setNumLongTermPics( Int  val )                         { m_numLongTermPics = val;                                      }
3154  Int                         getNumLongTermPics(  ) const                           { return m_numLongTermPics;                                     }
3155 
3156  Int                         getLtIdxSpsLen() const                                 { return gCeilLog2( getSPS()->getNumLongTermRefPicsSps() );     }
3157  Void                        setLtIdxSps( Int i, Int  val )                         { m_ltIdxSps[i] = val;                                          }
3158  Int                         getLtIdxSps( Int i ) const                             { return m_ltIdxSps[i];                                         }
3159
3160  Int                         getPocLsbLtLen() const                                 { return (getSPS()->getLog2MaxPicOrderCntLsbMinus4()+ 4);       }
3161  Void                        setPocLsbLt( Int i, Int  val )                         { m_pocLsbLt[i] = val;                                          }
3162  Int                         getPocLsbLt( Int i ) const                             { return m_pocLsbLt[i];                                         }
3163
3164  Void                        setUsedByCurrPicLtFlag( Int i, Bool flag )             { m_usedByCurrPicLtFlag[i] = flag;                              }
3165  Bool                        getUsedByCurrPicLtFlag( Int i ) const                  { return m_usedByCurrPicLtFlag[i];                              }
3166
3167  Void                        setDeltaPocMsbPresentFlag( Int i, Bool flag )          { m_deltaPocMsbPresentFlag[i] = flag;                           }
3168  Bool                        getDeltaPocMsbPresentFlag( Int i ) const               { return m_deltaPocMsbPresentFlag[i];                           }
3169
3170  Void                        setDeltaPocMsbCycleLt( Int i, Int  val )               { m_deltaPocMsbCycleLt[i] = val;                                }
3171  Int                         getDeltaPocMsbCycleLt( Int i ) const                   { return m_deltaPocMsbCycleLt[i];                               }
3172
3173  Void                        setSliceTemporalMvpEnabledFlag( Bool flag )            { m_enableTMVPFlag = flag;                         }
3174  Bool                        getSliceTemporalMvpEnabledFlag(  ) const               { return m_enableTMVPFlag;                         }
3175
3176  TComStRefPicSet*            getLocalStRps( )                                       { return &m_stRefPicSet; };
3177  const TComStRefPicSet*      getStRps( Int stRpsIdx ) const                         { return ( (stRpsIdx == getSPS()->getNumShortTermRefPicSets()) ? &m_stRefPicSet : getSPS()->getStRefPicSet( stRpsIdx ) ); };
3178
3179#endif
3180
3181  Void                        setEnableTMVPFlag( Bool   b )                          { m_enableTMVPFlag = b;                                         }
3182  Bool                        getEnableTMVPFlag()                                    { return m_enableTMVPFlag;                                      }
3183
3184  Void                        setEncCABACTableIdx( SliceType idx )                   { m_encCABACTableIdx = idx;                                     }
3185  SliceType                   getEncCABACTableIdx() const                            { return m_encCABACTableIdx;                                    }
3186
3187#if NH_MV
3188  Void                        setLayerId     ( Int layerId )                         { m_layerId      = layerId;                                     }
3189  Int                         getLayerId     ()                 const                { return m_layerId;                                             }
3190  Int                         getLayerIdInVps()                 const                { return getVPS()->getLayerIdInVps( m_layerId );                }
3191  Void                        setViewId      ( Int viewId )                          { m_viewId = viewId;                                            }
3192  Int                         getViewId      ()                 const                { return m_viewId;                                              }
3193  Void                        setViewIndex   ( Int viewIndex )                       { m_viewIndex = viewIndex;                                      }
3194  Int                         getViewIndex   ()                 const                { return m_viewIndex;                                           }
3195
3196  Void                        setDecodingProcess ( DecodingProcess decProc )         { m_decodingProcess = decProc;                                  }
3197
3198
3199#if NH_3D
3200#if NH_3D_TMVP
3201  Void                        generateAlterRefforTMVP ();   
3202  Void                        setAlterRefIdx          ( RefPicList e, Int i )        { m_aiAlterRefIdx[e]    = i;                                    }
3203  Int                         getAlterRefIdx          ( RefPicList e )               { return  m_aiAlterRefIdx[e];                                   }
3204#endif                                                                                                                                               
3205#if NH_3D_ARP                                                                                                                                         
3206  Int                         getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];                                  }
3207  Void                        setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;                                   }
3208  Bool                        getArpRefPicAvailable  ( RefPicList e, Int viewIdx)    { return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
3209  IntAry1d                    getPocsInCurrRPSs()                                    { return m_pocsInCurrRPSs;                                      } 
3210#endif                                                                                                                                               
3211  Void                        setIsDepth            ( Bool isDepth )                 { m_isDepth = isDepth;                                          }
3212  Bool                        getIsDepth            () const                         { return m_isDepth;                                             }
3213  Void                        setCamparaSlice       ( Int** aaiScale = 0, Int** aaiOffset = 0 );     
3214
3215  IntAry1d                    getCodedScale         () const                         { return m_aaiCodedScale [0];                                   }
3216  IntAry1d                    getCodedOffset        () const                         { return m_aaiCodedOffset[0];                                   }
3217  IntAry1d                    getInvCodedScale      () const                         { return m_aaiCodedScale [1];                                   }
3218  IntAry1d                    getInvCodedOffset     () const                         { return m_aaiCodedOffset[1];                                   }
3219                                                                                                                                                     
3220  Void                        setCpScale( Int j, Int  val )                          { m_aaiCodedScale[0][j] = val;                                  }
3221  Int                         getCpScale( Int j )                                    { return m_aaiCodedScale[0][j];                                 }
3222                                                                                                                                                     
3223  Void                        setCpOff( Int j, Int  val )                            { m_aaiCodedOffset[0][j] = val;                                 }
3224  Int                         getCpOff( Int j )                                      { return m_aaiCodedOffset[0][j];                                }
3225                                                                                                                                                     
3226  Void                        setCpInvScale( Int j, Int  val )                       { m_aaiCodedScale[1][j] = val;                                  }
3227  Int                         getCpInvScale( Int j )                                 { return m_aaiCodedScale[1][j];                                 }
3228                                                                                                                                                     
3229  Void                        setCpInvOff( Int j, Int  val )                         { m_aaiCodedOffset[1][j] = val;                                 }
3230  Int                         getCpInvOff( Int j )                                   { return m_aaiCodedOffset[1][j];                                }
3231                                                                                                                                                       
3232  Void                        setIvPicLists( TComPicLists* m_ivPicLists );                                                                             
3233  Void                        setDepthToDisparityLUTs();                                                                                               
3234                                                                                                                                                       
3235  Int*                        getDepthToDisparityB( Int refViewIdx )                 { return m_depthToDisparityB[ getVPS()->getVoiInVps( refViewIdx) ];}
3236  Int*                        getDepthToDisparityF( Int refViewIdx )                 { return m_depthToDisparityF[ getVPS()->getVoiInVps( refViewIdx) ];}
3237#if NH_3D_IC                                                                                                                                             
3238  Void                        setICEnableCandidate( Int* icEnableCandidate)          { m_aICEnableCandidate = icEnableCandidate;                     }
3239  Void                        setICEnableNum( Int* icEnableNum)                      { m_aICEnableNum = icEnableNum;                                 }
3240  Void                        setICEnableCandidate( UInt layer, Int value)           { m_aICEnableCandidate[ layer ] = value;                        }
3241  Void                        setICEnableNum( UInt layer, Int value)                 { m_aICEnableNum[ layer ] = value; ;                            }
3242                                                                                                                                                     
3243  Int                         getICEnableCandidate( Int layer)                       { return  m_aICEnableCandidate[ layer ];                        }
3244  Int                         getICEnableNum( Int layer)                             { return m_aICEnableNum[ layer ];                               }
3245#endif
3246#endif
3247// Additional slice header syntax elements
3248
3249  Void                        setCrossLayerBlaFlag( Bool flag )                      { m_crossLayerBlaFlag = flag;                                   }
3250  Bool                        getCrossLayerBlaFlag(  ) const                         { return m_crossLayerBlaFlag;                                   }
3251  Void                        checkCrossLayerBlaFlag ( ) const ;
3252
3253#if NH_MV
3254  Void                        setPocResetFlag( Bool flag )                           { m_pocResetFlag = flag;                                        }
3255  Bool                        getPocResetFlag(  ) const                              { return m_pocResetFlag;                                        }
3256#endif
3257
3258  Void                        setDiscardableFlag( Bool flag )                        { m_discardableFlag = flag;                                     }
3259  Bool                        getDiscardableFlag(  ) const                           { return m_discardableFlag;                                     }
3260
3261  Void                        setInterLayerPredEnabledFlag( Bool flag )              { m_interLayerPredEnabledFlag = flag;                           }
3262  Bool                        getInterLayerPredEnabledFlag(  ) const                 { return m_interLayerPredEnabledFlag;                           }
3263
3264  Void                        setNumInterLayerRefPicsMinus1( Int  val )              { m_numInterLayerRefPicsMinus1 = val;                           }
3265  Int                         getNumInterLayerRefPicsMinus1(  ) const                { return m_numInterLayerRefPicsMinus1;                          }
3266
3267  Void                        setInterLayerPredLayerIdc( Int i, Int  val )           { m_interLayerPredLayerIdc[i] = val;                            }
3268  Int                         getInterLayerPredLayerIdc( Int i ) const               { return m_interLayerPredLayerIdc[i];                           }
3269
3270  Void                        setSliceSegmentHeaderExtensionLength( Int  val )       { m_sliceSegmentHeaderExtensionLength = val;                    }
3271  Int                         getSliceSegmentHeaderExtensionLength(  ) const         { return m_sliceSegmentHeaderExtensionLength;                   }
3272
3273  Void                        setPocResetIdc( Int  val )                             { m_pocResetIdc = val;                                          }
3274  Int                         getPocResetIdc(  ) const                               { return m_pocResetIdc;                                         }
3275  Void                        checkPocResetIdc( ) const                              { assert( !(getVPS()->getPocLsbNotPresentFlag( getLayerIdInVps() ) )  || !(getSlicePicOrderCntLsb() > 0 ) || !( getPocResetIdc() == 2) ); }
3276
3277 
3278  Void                        setPocResetPeriodId( Int  val )                        { m_pocResetPeriodId = val;                                     }
3279  Int                         getPocResetPeriodId(  ) const                          { return m_pocResetPeriodId;                                    }
3280
3281  Void                        setFullPocResetFlag( Bool flag )                       { m_fullPocResetFlag = flag;                                    }
3282  Bool                        getFullPocResetFlag(  ) const                          { return m_fullPocResetFlag;                                    }
3283
3284  Void                        setPocLsbVal( Int  val )                               { m_pocLsbVal = val;                                            }
3285  Int                         getPocLsbVal(  )  const                                { return m_pocLsbVal;                                           }
3286  Void                        checkPocLsbVal( ) const                                { assert( !(getVPS()->getPocLsbNotPresentFlag( getLayerIdInVps() ) )  || !getFullPocResetFlag() || ( getPocLsbVal() == 0 ) ); }
3287
3288#if NH_MV
3289  Void                        setHasPocResetPeriodIdPresent( Bool  val )              { m_hasPocResetPeriodIdPresent = val;                                }
3290  Bool                        getHasPocResetPeriodIdPresent(  ) const                { return m_hasPocResetPeriodIdPresent;                               }
3291
3292  Void                        setPocMsbCycleValPresentFlag( Bool flag )              { m_pocMsbCycleValPresentFlag = flag;                                }
3293  Bool                        getPocMsbCycleValPresentFlag(  )          const        { return m_pocMsbCycleValPresentFlag;                                }
3294
3295  Void                        setPocMsbCycleVal( Int  val )                          { m_pocMsbCycleVal = val;                                            }
3296  Int                         getPocMsbCycleVal(  )         const                    { return m_pocMsbCycleVal;                                           }
3297 
3298  Int                         getPocLsbLtVar(Int i);
3299  Bool                        getUsedByCurrPicLtVar(Int i) const;
3300  Int                         getDeltaPocMsbCycleLtVar( Int i ) const;
3301
3302#else
3303  Void                        setPocMsbValPresentFlag( Bool flag )                   { m_pocMsbValPresentFlag = flag;                                }
3304  Bool                        getPocMsbValPresentFlag(  )          const             { return m_pocMsbValPresentFlag;                                }
3305
3306  Void                        setPocMsbVal( Int  val )                               { m_pocMsbVal = val;                                            }
3307  Int                         getPocMsbVal(  )         const                         { return m_pocMsbVal;                                           }
3308#endif
3309
3310
3311  Bool                        getCraOrBlaPicFlag()       const                       { return ( getCraPicFlag() || getBlaPicFlag() );                }
3312  Bool                        getPocMsbValRequiredFlag() const                       { return ( getCraOrBlaPicFlag() && ( getVPS()->getVpsPocLsbAlignedFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 0 ) );  }
3313
3314  UInt                        getPocLsbValLen() const                                { return getSPS()->getBitsForPOC();                             }; //log2_max_pic_order_cnt_lsb_minus4 + 4 
3315
3316  Bool getBlaPicFlag() const
3317  {
3318    return  getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
3319    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
3320    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP;
3321  }
3322  Bool getCraPicFlag () const 
3323  {
3324    return getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
3325  }
3326
3327  // Additional variables derived in slice header semantics
3328#if NH_3D
3329  Int                         getNumInterLayerRefPicsMinus1Len( ) const              { return gCeilLog2(  getVPS()->getNumRefListLayers( getLayerId() )); }
3330  Int                         getInterLayerPredLayerIdcLen    ( ) const              { return gCeilLog2(  getVPS()->getNumRefListLayers( getLayerId() )); }
3331#else
3332  Int                         getNumInterLayerRefPicsMinus1Len( ) const              { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
3333  Int                         getInterLayerPredLayerIdcLen    ( ) const              { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
3334#endif
3335
3336  Int                         getRefLayerPicFlag( Int i ) const;
3337  Int                         getRefLayerPicIdc ( Int j ) const;
3338  Int                         getNumRefLayerPics( ) const;
3339
3340  Int                         getNumActiveRefLayerPics( ) const;
3341
3342  Int                         getNumActiveRefLayerPics0( ) const                     { return (Int) m_refPicSetInterLayer0->size();                  };
3343  Int                         getNumActiveRefLayerPics1( ) const                     { return (Int) m_refPicSetInterLayer1->size();                  };
3344
3345  Int                         getRefPicLayerId             ( Int i ) const;
3346
3347  Void                        setRefPicSetInterLayer       ( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1);
3348  TComPic*                    getPicFromRefPicSetInterLayer ( Int setIdc, Int layerId ) const ;
3349
3350#if NH_3D
3351  // 3D-HEVC tool parameters
3352  Void                        deriveInCmpPredAndCpAvailFlag( );
3353  Void                        init3dToolParameters();
3354  Void                        checkInCompPredRefLayers();
3355
3356  Bool                        getIvMvPredFlag           ( )                          { return m_ivMvPredFlag           ;                             };
3357  Bool                        getIvMvScalingFlag        ( )                          { return m_ivMvScalingFlag        ;                             };
3358  Bool                        getIvResPredFlag          ( )                          { return m_ivResPredFlag          ;                             };
3359  Bool                        getDepthRefinementFlag    ( )                          { return m_depthRefinementFlag    ;                             };
3360  Bool                        getViewSynthesisPredFlag  ( )                          { return m_viewSynthesisPredFlag  ;                             };
3361  Bool                        getDepthBasedBlkPartFlag  ( )                          { return m_depthBasedBlkPartFlag  ;                             };
3362  Bool                        getMpiFlag                ( )                          { return m_mpiFlag                ;                             };
3363  Bool                        getIntraContourFlag       ( )                          { return m_intraContourFlag       ;                             };
3364  Bool                        getIntraSdcWedgeFlag      ( )                          { return m_intraSdcWedgeFlag      ;                             };
3365  Bool                        getQtPredFlag             ( )                          { return m_qtPredFlag             ;                             };
3366  Bool                        getInterSdcFlag           ( )                          { return m_interSdcFlag           ;                             };
3367  Bool                        getDepthIntraSkipFlag     ( )                          { return m_depthIntraSkipFlag     ;                             };
3368
3369  Int                         getMpiSubPbSize           ( )                          { return m_mpiSubPbSize           ;                             };
3370  Int                         getSubPbSize              ( )                          { return m_subPbSize              ;                             };
3371#if NH_3D_NBDV
3372  Int                         getDefaultRefViewIdx()                                 { return m_iDefaultRefViewIdx;                                  }
3373  Void                        setDefaultRefViewIdx(Int iViewIdx)                     { m_iDefaultRefViewIdx = iViewIdx;                              }
3374
3375  Bool                        getDefaultRefViewIdxAvailableFlag()                    { return m_bDefaultRefViewIdxAvailableFlag;                     }
3376  Void                        setDefaultRefViewIdxAvailableFlag(Bool bViewIdx)       { m_bDefaultRefViewIdxAvailableFlag = bViewIdx;                 }
3377  Void                        setDefaultRefView( );
3378#endif
3379#endif
3380#if NH_MV
3381 TComPic*                     getRefPicSetInterLayer( Int setIdc, Int i ) const; 
3382#endif
3383
3384  // Inference
3385#if NH_MV
3386  Bool                        inferPocMsbCycleValPresentFlag();
3387#else
3388  Bool                        inferPocMsbValPresentFlag();
3389#endif
3390#endif
3391protected:
3392  TComPic*                    xGetRefPic        (TComList<TComPic*>& rcListPic, Int poc);
3393  TComPic*                    xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
3394#if NH_MV
3395  TComPic*                    xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); 
3396#endif
3397};// END CLASS DEFINITION TComSlice
3398
3399
3400Void calculateParameterSetChangedFlag(Bool &bChanged, const std::vector<UChar> *pOldData, const std::vector<UChar> &newData);
3401
3402template <class T> class ParameterSetMap
3403{
3404public:
3405  template <class Tm>
3406  struct MapData
3407  {
3408    Bool                  bChanged;
3409    std::vector<UChar>   *pNaluData; // Can be null
3410    Tm*                   parameterSet;
3411  };
3412
3413  ParameterSetMap(Int maxId)
3414  :m_maxId (maxId)
3415  {}
3416
3417  ~ParameterSetMap()
3418  {
3419    for (typename std::map<Int,MapData<T> >::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
3420    {
3421      delete (*i).second.pNaluData;
3422      delete (*i).second.parameterSet;
3423    }
3424  }
3425
3426  Void storePS(Int psId, T *ps, const std::vector<UChar> &naluData)
3427  {
3428    assert ( psId < m_maxId );
3429    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
3430    {
3431      MapData<T> &mapData=m_paramsetMap[psId];
3432
3433      // work out changed flag
3434      calculateParameterSetChangedFlag(mapData.bChanged, mapData.pNaluData, naluData);
3435      delete m_paramsetMap[psId].pNaluData;
3436      delete m_paramsetMap[psId].parameterSet;
3437
3438      m_paramsetMap[psId].parameterSet = ps;
3439    }
3440    else
3441    {
3442      m_paramsetMap[psId].parameterSet = ps;
3443      m_paramsetMap[psId].bChanged = false;
3444    }
3445      m_paramsetMap[psId].pNaluData=new std::vector<UChar>;
3446    *(m_paramsetMap[psId].pNaluData) = naluData;
3447  }
3448
3449  Void clearChangedFlag(Int psId)
3450  {
3451    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
3452    {
3453      m_paramsetMap[psId].bChanged=false;
3454    }
3455  }
3456
3457  Bool getChangedFlag(Int psId) const
3458  {
3459    const typename std::map<Int,MapData<T> >::const_iterator constit=m_paramsetMap.find(psId);
3460    if ( constit != m_paramsetMap.end() )
3461    {
3462      return constit->second.bChanged;
3463    }
3464    return false;
3465  }
3466
3467  T* getPS(Int psId)
3468  {
3469    typename std::map<Int,MapData<T> >::iterator it=m_paramsetMap.find(psId);
3470    return ( it == m_paramsetMap.end() ) ? NULL : (it)->second.parameterSet;
3471  }
3472
3473  const T* getPS(Int psId) const
3474  {
3475    typename std::map<Int,MapData<T> >::const_iterator it=m_paramsetMap.find(psId);
3476    return ( it == m_paramsetMap.end() ) ? NULL : (it)->second.parameterSet;
3477  }
3478
3479  T* getFirstPS()
3480  {
3481    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second.parameterSet;
3482  }
3483
3484private:
3485  std::map<Int,MapData<T> > m_paramsetMap;
3486  Int                       m_maxId;
3487};
3488
3489class ParameterSetManager
3490{
3491public:
3492                 ParameterSetManager();
3493  virtual        ~ParameterSetManager();
3494
3495  //! store sequence parameter set and take ownership of it
3496  Void           storeVPS(TComVPS *vps, const std::vector<UChar> &naluData) { m_vpsMap.storePS( vps->getVPSId(), vps, naluData); };
3497  //! get pointer to existing video parameter set
3498  TComVPS*       getVPS(Int vpsId)                                           { return m_vpsMap.getPS(vpsId); };
3499  Bool           getVPSChangedFlag(Int vpsId) const                          { return m_vpsMap.getChangedFlag(vpsId); }
3500  Void           clearVPSChangedFlag(Int vpsId)                              { m_vpsMap.clearChangedFlag(vpsId); }
3501  TComVPS*       getFirstVPS()                                               { return m_vpsMap.getFirstPS(); };
3502
3503  //! store sequence parameter set and take ownership of it
3504  Void           storeSPS(TComSPS *sps, const std::vector<UChar> &naluData) { m_spsMap.storePS( sps->getSPSId(), sps, naluData); };
3505  //! get pointer to existing sequence parameter set
3506  TComSPS*       getSPS(Int spsId)                                           { return m_spsMap.getPS(spsId); };
3507  Bool           getSPSChangedFlag(Int spsId) const                          { return m_spsMap.getChangedFlag(spsId); }
3508  Void           clearSPSChangedFlag(Int spsId)                              { m_spsMap.clearChangedFlag(spsId); }
3509  TComSPS*       getFirstSPS()                                               { return m_spsMap.getFirstPS(); };
3510
3511  //! store picture parameter set and take ownership of it
3512  Void           storePPS(TComPPS *pps, const std::vector<UChar> &naluData) { m_ppsMap.storePS( pps->getPPSId(), pps, naluData); };
3513  //! get pointer to existing picture parameter set
3514  TComPPS*       getPPS(Int ppsId)                                           { return m_ppsMap.getPS(ppsId); };
3515  Bool           getPPSChangedFlag(Int ppsId) const                          { return m_ppsMap.getChangedFlag(ppsId); }
3516  Void           clearPPSChangedFlag(Int ppsId)                              { m_ppsMap.clearChangedFlag(ppsId); }
3517  TComPPS*       getFirstPPS()                                               { return m_ppsMap.getFirstPS(); };
3518
3519  //! activate a SPS from a active parameter sets SEI message
3520  //! \returns true, if activation is successful
3521#if NH_MV
3522  // Bool           activateSPSWithSEI(Int SPSId, Int layerId );
3523#else
3524  // Bool           activateSPSWithSEI(Int SPSId);
3525#endif
3526
3527  //! activate a PPS and depending on isIDR parameter also SPS and VPS
3528  //! \returns true, if activation is successful
3529#if NH_MV
3530  Bool           activatePPS(Int ppsId, Bool isIRAP, Int layerId );
3531#else
3532  Bool           activatePPS(Int ppsId, Bool isIRAP);
3533#endif
3534
3535  const TComVPS* getActiveVPS()const { return m_vpsMap.getPS(m_activeVPSId); };
3536
3537#if NH_MV 
3538  const TComSPS* getActiveSPS( Int layer )const { return m_spsMap.getPS(m_activeSPSId[layer]); };
3539#else 
3540  const TComSPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); };
3541#endif
3542
3543protected:
3544  ParameterSetMap<TComVPS> m_vpsMap;
3545  ParameterSetMap<TComSPS> m_spsMap;
3546  ParameterSetMap<TComPPS> m_ppsMap;
3547
3548  Int m_activeVPSId; // -1 for nothing active
3549#if NH_MV 
3550  Int m_activeSPSId[ MAX_NUM_LAYERS ]; // -1 for nothing active
3551#else 
3552  Int m_activeSPSId; // -1 for nothing active
3553#endif
3554};
3555
3556//! \}
3557
3558#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.