source: 3DVCSoftware/branches/HTM-6.0-dev0/source/Lib/TLibCommon/TComSlice.h @ 312

Last change on this file since 312 was 303, checked in by mediatek-htm, 11 years ago

Added FCO_FIX, FCO_FIX_SPS_CHANGE, and FCO_DVP_REFINE_C0132_C0170 macros to support FCO.
The new macros are default disabled in CTC.

  • Property svn:eol-style set to native
File size: 72.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-2012, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TComSlice.h
35    \brief    slice header and SPS class (header)
36*/
37
38#ifndef __TCOMSLICE__
39#define __TCOMSLICE__
40
41#include <cstring>
42#include <map>
43#include <vector>
44#include "CommonDef.h"
45#include "TComRom.h"
46#include "TComList.h"
47
48//! \ingroup TLibCommon
49//! \{
50
51class TComPic;
52class TComTrQuant;
53#if DEPTH_MAP_GENERATION
54class TComDepthMapGenerator;
55#endif
56#if H3D_IVRP
57class TComResidualGenerator;
58#endif
59// ====================================================================================================================
60// Constants
61// ====================================================================================================================
62
63/// max number of supported APS in software
64#define MAX_NUM_SUPPORTED_APS 1
65
66// ====================================================================================================================
67// Class definition
68// ====================================================================================================================
69
70/// Reference Picture Set class
71class TComReferencePictureSet
72{
73private:
74  Int  m_numberOfPictures;
75  Int  m_numberOfNegativePictures;
76  Int  m_numberOfPositivePictures;
77  Int  m_numberOfLongtermPictures;
78  Int  m_deltaPOC[MAX_NUM_REF_PICS];
79  Int  m_POC[MAX_NUM_REF_PICS];
80  Bool m_used[MAX_NUM_REF_PICS];
81  Bool m_interRPSPrediction;
82  Int  m_deltaRIdxMinus1;   
83  Int  m_deltaRPS; 
84  Int  m_numRefIdc; 
85  Int  m_refIdc[MAX_NUM_REF_PICS+1];
86
87public:
88  TComReferencePictureSet();
89  virtual ~TComReferencePictureSet();
90
91  Void setNumberOfPictures(Int numberOfPictures);
92  Int  getNumberOfPictures();
93  Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
94  Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
95  Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
96  Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
97  Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
98  Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
99
100  Void setDeltaPOC(Int bufferNum, Int deltaPOC);
101  Int  getDeltaPOC(Int bufferNum);
102  Void setPOC(Int bufferNum, Int deltaPOC);
103  Int  getPOC(Int bufferNum);
104
105  Void setUsed(Int bufferNum, Bool used);
106  Int  getUsed(Int bufferNum);
107
108  Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
109  Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
110  Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
111  Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
112  Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
113  Int  getDeltaRPS()                            { return m_deltaRPS; }
114  Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
115  Int  getNumRefIdc()                           { return m_numRefIdc; }
116
117  Void setRefIdc(Int bufferNum, Int refIdc);
118  Int  getRefIdc(Int bufferNum);
119
120  Void sortDeltaPOC();
121  Void printDeltaPOC();
122};
123
124/// Reference Picture Set set class
125class TComRPSList
126{
127private:
128  Int  m_numberOfReferencePictureSets;
129  TComReferencePictureSet* m_referencePictureSets;
130 
131public:
132  TComRPSList();
133  virtual ~TComRPSList();
134 
135  Void  create  (Int numberOfEntries);
136  Void  destroy ();
137
138
139  TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
140  Int getNumberOfReferencePictureSets();
141  Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
142};
143
144#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
145/// VPS class
146
147class TComVPS
148{
149private:
150  Int         m_VPSId;
151  UInt        m_uiMaxTLayers;
152  UInt        m_uiMaxLayers;
153  Bool        m_bTemporalIdNestingFlag;
154
155  UInt        m_uiExtensionType;
156#if !QC_MVHEVC_B0046 
157  Bool        m_bDependentFlag[MAX_LAYER_NUM];
158#else
159  UInt        m_uiNumHRDParameter;
160  UInt        m_numAddiLayerOperationPoints;
161  UInt        m_numAddiProLevelSets;
162  UInt        m_numDirectRefLayer[MAX_LAYER_NUM];
163  UInt        m_numDirectRefID[MAX_LAYER_NUM][MAX_LAYER_NUM];
164  UInt        m_numOpLayerIdMinus1[MAX_LAYER_NUM];
165  UInt        m_numOpLayerId[MAX_LAYER_NUM][MAX_LAYER_NUM];
166#endif
167  UInt        m_uiViewId[MAX_LAYER_NUM];
168#if !QC_MVHEVC_B0046 
169  Bool        m_bDepthFlag[MAX_LAYER_NUM];
170#endif
171  Int         m_iViewOrderIdx[MAX_LAYER_NUM];
172#if !QC_MVHEVC_B0046 
173  UInt        m_uiDependentLayer[MAX_LAYER_NUM];
174#endif
175
176  UInt        m_numReorderPics[MAX_TLAYER];
177  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
178  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
179#if INTER_VIEW_VECTOR_SCALING_C0115
180  Bool          m_bIVScalingFlag;
181#endif
182public:
183  TComVPS();
184  virtual ~TComVPS();
185 
186  Int     getVPSId       ()                   { return m_VPSId;          }
187  Void    setVPSId       (Int i)              { m_VPSId = i;             }
188 
189  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
190  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
191   
192  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
193  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
194 
195  Bool    getTemporalNestingFlag   ()         { return m_uiMaxLayers;   }
196  Void    setTemporalNestingFlag   (UInt t)   { m_bTemporalIdNestingFlag = t; }
197#if !QC_MVHEVC_B0046
198  Void    setExtensionType(UInt v)                     { m_uiExtensionType = v;    }
199  UInt    getExtensionType()                             { return m_uiExtensionType; }
200 
201  Void    setDependentFlag(Bool d, UInt layer)              { m_bDependentFlag[layer] = d;    }
202  Bool    getDependentFlag(UInt layer)                      { return m_bDependentFlag[layer]; }
203#endif
204  Void    setViewId(UInt v, UInt layer)                     { m_uiViewId[layer] = v;    }
205  UInt    getViewId(UInt layer)                             { return m_uiViewId[layer]; }
206#if !QC_MVHEVC_B0046
207  Void    setDepthFlag(Bool d, UInt layer)                  { m_bDepthFlag[layer] = d;    }
208  Bool    getDepthFlag(UInt layer)                          { return m_bDepthFlag[layer]; }
209#endif
210  Void    setViewOrderIdx(Int v, UInt layer)                { m_iViewOrderIdx[layer] = v;    }
211  Int     getViewOrderIdx(UInt layer)                       { return m_iViewOrderIdx[layer]; }
212#if !QC_MVHEVC_B0046   
213  Void    setDependentLayer(UInt v, UInt layer)                     { m_uiDependentLayer[layer] = v;    }
214  UInt    getDependentLayer(UInt layer)                             { return m_uiDependentLayer[layer]; }
215#endif
216#if INTER_VIEW_VECTOR_SCALING_C0115
217  Bool getIVScalingFlag( )                                   { return m_bIVScalingFlag; }
218  Void setIVScalingFlag(Bool b)                              { m_bIVScalingFlag = b;    }
219#endif
220  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
221  UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
222 
223  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)          { m_uiMaxDecPicBuffering[tLayer] = v;    }
224  UInt    getMaxDecPicBuffering(UInt tLayer)                  { return m_uiMaxDecPicBuffering[tLayer]; }
225 
226  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)                { m_uiMaxLatencyIncrease[tLayer] = v;    }
227  UInt    getMaxLatencyIncrease(UInt tLayer)                        { return m_uiMaxLatencyIncrease[tLayer]; }
228#if QC_MVHEVC_B0046
229  Void    setNumHRDParameters(UInt n)                                { m_uiNumHRDParameter = n;    }
230  UInt    getNumHRDParameters()                                      { return m_uiNumHRDParameter; }
231  Void    setNumDirectRefLayer(UInt n, UInt layer)                   { m_numDirectRefLayer[layer] = n;        };
232  UInt    getNumDirectRefLayer(UInt layer)                           { return m_numDirectRefLayer[layer];     };
233  Void    setDirectRefLayerId (UInt n, UInt layer, UInt refId)       { m_numDirectRefID[layer][refId] = n;   assert(refId < MAX_NUM_REF ); };
234  UInt    getDirectRefLayerId (        UInt layer, UInt refId)       { return m_numDirectRefID[layer][refId]; };
235  UInt    getNumAddiLayerOperationPoints(      )               { return m_numAddiLayerOperationPoints;  };
236  Void    setNumAddiLayerOperationPoints(UInt n)                {  m_numAddiLayerOperationPoints = n;  };
237  Void    setNumAddiProLevelSets        (UInt n)                     {  m_numAddiProLevelSets = n;}
238  UInt    getNumAddiProLevelSets        (      )                     { return m_numAddiProLevelSets;}
239
240  Void    setNumOpLayerIdMinus1         (UInt n, UInt layer)                     {  m_numOpLayerIdMinus1[layer] = n;}
241  UInt    getNumOpLayerIdMinus1         (UInt layer      )                       { return m_numOpLayerIdMinus1[layer];}
242
243  Void    setNumOpLayerId               (UInt n, UInt layer, UInt OpId)                     {  m_numOpLayerId[layer][OpId] = n;}
244  UInt    getNumOpLayerId               (UInt layer, UInt OpId        )                     { return m_numOpLayerId[layer][OpId];}
245 
246#endif
247};
248
249#endif
250
251/// SPS class
252class TComSPS
253{
254private:
255#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
256  Int          m_VPSId;
257#endif
258  Int         m_SPSId;
259  Int         m_ProfileIdc;
260  Int         m_LevelIdc;
261  Int         m_chromaFormatIdc;
262
263  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
264
265  UInt        m_uiViewId;
266  Int         m_iViewOrderIdx;
267  Bool        m_bDepth;
268  UInt        m_uiCamParPrecision;
269  Bool        m_bCamParInSliceHeader;
270  Int         m_aaiCodedScale [2][MAX_VIEW_NUM];
271  Int         m_aaiCodedOffset[2][MAX_VIEW_NUM];
272
273  // Structure
274  UInt        m_picWidthInLumaSamples;
275  UInt        m_picHeightInLumaSamples;
276  Bool        m_picCroppingFlag;
277  Int         m_picCropLeftOffset;
278  Int         m_picCropRightOffset;
279  Int         m_picCropTopOffset;
280  Int         m_picCropBottomOffset;
281  UInt        m_uiMaxCUWidth;
282  UInt        m_uiMaxCUHeight;
283  UInt        m_uiMaxCUDepth;
284  UInt        m_uiMinTrDepth;
285  UInt        m_uiMaxTrDepth;
286  TComRPSList* m_RPSList;
287  Bool        m_bLongTermRefsPresent;
288  Int         m_numReorderPics[MAX_TLAYER];
289 
290  Int         m_iNumberOfUsableInterViewRefs;
291  Int         m_aiUsableInterViewRefs[MAX_VIEW_NUM];
292
293  // Tool list
294  UInt        m_uiQuadtreeTULog2MaxSize;
295  UInt        m_uiQuadtreeTULog2MinSize;
296  UInt        m_uiQuadtreeTUMaxDepthInter;
297  UInt        m_uiQuadtreeTUMaxDepthIntra;
298  Bool        m_usePCM;
299  UInt        m_pcmLog2MaxSize;
300  UInt        m_uiPCMLog2MinSize;
301  Bool        m_bDisInter4x4;
302  Bool        m_useAMP;
303  Bool        m_bUseALF;
304  Bool        m_bALFCoefInSlice;
305  Bool        m_bUseLMChroma; // JL:
306
307  Bool        m_bUseLComb;
308  Bool        m_bLCMod;
309  Bool        m_useNSQT;
310 
311  Bool        m_restrictedRefPicListsFlag;
312  Bool        m_listsModificationPresentFlag;
313
314  // Parameter
315  AMVP_MODE   m_aeAMVPMode[MAX_CU_DEPTH];
316  UInt        m_uiBitDepth;
317  UInt        m_uiBitIncrement;
318  Int         m_qpBDOffsetY;
319  Int         m_qpBDOffsetC;
320
321#if LOSSLESS_CODING
322  Bool        m_useLossless;
323#endif
324
325  UInt        m_uiPCMBitDepthLuma;
326  UInt        m_uiPCMBitDepthChroma;
327  Bool        m_bPCMFilterDisableFlag;
328
329  UInt        m_uiBitsForPOC;
330  // Max physical transform size
331  UInt        m_uiMaxTrSize;
332 
333  Int m_iAMPAcc[MAX_CU_DEPTH];
334
335  Bool        m_bLFCrossSliceBoundaryFlag;
336  Bool        m_bUseSAO; 
337#if HHI_MPI
338  Bool        m_bUseMVI;
339#endif
340 
341#if RWTH_SDC_DLT_B0036
342  Bool        m_bUseDLT;
343 
344  UInt        m_uiBitsPerDepthValue;
345  UInt        m_uiNumDepthmapValues;
346  UInt*       m_uiDepthValue2Idx;
347  UInt*       m_uiIdx2DepthValue;
348#endif
349
350  Bool     m_bLFCrossTileBoundaryFlag;
351  Int      m_iUniformSpacingIdr;
352  Int      m_iTileBoundaryIndependenceIdr;
353  Int      m_iNumColumnsMinus1;
354  UInt*    m_puiColumnWidth;
355  Int      m_iNumRowsMinus1;
356  UInt*    m_puiRowHeight;
357 
358  Bool        m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
359
360  Bool        m_scalingListEnabledFlag;
361  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
362  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
363
364  Bool        m_useDF;
365
366  UInt        m_tilesOrEntropyCodingSyncIdc;
367  Int         m_numSubstreams;
368
369#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
370  Bool  m_bUseDMM;
371#endif
372
373#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER_M23723
374  Bool  m_bUseDMM34;
375#endif
376
377#if OL_QTLIMIT_PREDCODING_B0068
378  Bool m_bUseQTLPC;
379#endif
380
381#if DEPTH_MAP_GENERATION
382  UInt  m_uiPredDepthMapGeneration;
383  UInt  m_uiPdmPrecision;
384  Int   m_aiPdmScaleNomDelta[MAX_VIEW_NUM];
385  Int   m_aiPdmOffset       [MAX_VIEW_NUM];
386#endif
387
388#if H3D_IVMP
389  UInt  m_uiMultiviewMvPredMode;
390#endif
391#if H3D_IVRP
392  UInt  m_uiMultiviewResPredMode;
393#endif
394
395#if DEPTH_MAP_GENERATION
396  TComDepthMapGenerator* m_pcDepthMapGenerator;
397#endif
398#if H3D_IVRP
399  TComResidualGenerator* m_pcResidualGenerator;
400#endif
401
402public:
403  TComSPS();
404  virtual ~TComSPS();
405#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
406  Int  getVPSId       ()         { return m_VPSId;          }
407  Void setVPSId       (Int i)    { m_VPSId = i;             }
408#endif
409  Int  getSPSId       ()         { return m_SPSId;          }
410  Void setSPSId       (Int i)    { m_SPSId = i;             }
411  Int  getProfileIdc  ()         { return m_ProfileIdc;     }
412  Void setProfileIdc  (Int i)    { m_ProfileIdc = i;        }
413  Int  getLevelIdc    ()         { return m_LevelIdc;       }
414  Void setLevelIdc    (Int i)    { m_LevelIdc = i;          }
415
416  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
417  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
418 
419  // structure
420  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
421  UInt getPicWidthInLumaSamples       ()         { return  m_picWidthInLumaSamples;    }
422  Void setPicHeightInLumaSamples      ( UInt u ) { m_picHeightInLumaSamples = u;       }
423  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
424
425  Bool getPicCroppingFlag() const          { return m_picCroppingFlag; }
426  Void setPicCroppingFlag(Bool val)        { m_picCroppingFlag = val; }
427  Int  getPicCropLeftOffset() const        { return m_picCropLeftOffset; }
428  Void setPicCropLeftOffset(Int val)       { m_picCropLeftOffset = val; }
429  Int  getPicCropRightOffset() const       { return m_picCropRightOffset; }
430  Void setPicCropRightOffset(Int val)      { m_picCropRightOffset = val; }
431  Int  getPicCropTopOffset() const         { return m_picCropTopOffset; }
432  Void setPicCropTopOffset(Int val)        { m_picCropTopOffset = val; }
433  Int  getPicCropBottomOffset() const      { return m_picCropBottomOffset; }
434  Void setPicCropBottomOffset(Int val)     { m_picCropBottomOffset = val; }
435
436  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
437  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
438  Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u;     }
439  UInt getMaxCUHeight ()         { return  m_uiMaxCUHeight; }
440  Void setMaxCUDepth  ( UInt u ) { m_uiMaxCUDepth = u;      }
441  UInt getMaxCUDepth  ()         { return  m_uiMaxCUDepth;  }
442  Void setUsePCM      ( Bool b ) { m_usePCM = b;           }
443  Bool getUsePCM      ()         { return m_usePCM;        }
444  Void setPCMLog2MaxSize  ( UInt u ) { m_pcmLog2MaxSize = u;      }
445  UInt getPCMLog2MaxSize  ()         { return  m_pcmLog2MaxSize;  }
446  Void setPCMLog2MinSize  ( UInt u ) { m_uiPCMLog2MinSize = u;      }
447  UInt getPCMLog2MinSize  ()         { return  m_uiPCMLog2MinSize;  }
448  Void setBitsForPOC  ( UInt u ) { m_uiBitsForPOC = u;      }
449  UInt getBitsForPOC  ()         { return m_uiBitsForPOC;   }
450  Bool getDisInter4x4()         { return m_bDisInter4x4;        }
451  Void setDisInter4x4      ( Bool b ) { m_bDisInter4x4  = b;          }
452  Bool getUseAMP() { return m_useAMP; }
453  Void setUseAMP( Bool b ) { m_useAMP = b; }
454  Void setMinTrDepth  ( UInt u ) { m_uiMinTrDepth = u;      }
455  UInt getMinTrDepth  ()         { return  m_uiMinTrDepth;  }
456  Void setMaxTrDepth  ( UInt u ) { m_uiMaxTrDepth = u;      }
457  UInt getMaxTrDepth  ()         { return  m_uiMaxTrDepth;  }
458  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
459  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
460  Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u;    }
461  UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
462  Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u;    }
463  Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u;    }
464  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
465  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
466  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
467  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
468  Void      setRPSList( TComRPSList* RPSList )   { m_RPSList = RPSList;       }
469  TComRPSList* getRPSList()                      { return m_RPSList;          }
470  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
471  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
472
473  Void setNumberOfUsableInterViewRefs( Int number )      { m_iNumberOfUsableInterViewRefs = number;    }
474  Int  getNumberOfUsableInterViewRefs()                  { return m_iNumberOfUsableInterViewRefs;      }
475  Void setUsableInterViewRef( Int pos, Int deltaViewId ) { m_aiUsableInterViewRefs[pos] = deltaViewId; }
476  Int  getUsableInterViewRef( Int pos )                  { return m_aiUsableInterViewRefs[pos];        }
477
478 
479  // physical transform
480  Void setMaxTrSize   ( UInt u ) { m_uiMaxTrSize = u;       }
481  UInt getMaxTrSize   ()         { return  m_uiMaxTrSize;   }
482 
483  // Tool list
484  Bool getUseALF      ()         { return m_bUseALF;        }
485  Void setUseALFCoefInSlice(Bool b) {m_bALFCoefInSlice = b;}
486  Bool getUseALFCoefInSlice()    {return m_bALFCoefInSlice;}
487
488  Void setUseALF      ( Bool b ) { m_bUseALF  = b;          }
489  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
490  Bool getUseLComb    ()         { return m_bUseLComb;      }
491  Void setLCMod       (Bool b)   { m_bLCMod = b;     }
492  Bool getLCMod       ()         { return m_bLCMod;  }
493
494  Bool getUseLMChroma ()         { return m_bUseLMChroma;        }
495  Void setUseLMChroma ( Bool b ) { m_bUseLMChroma  = b;          }
496
497#if LOSSLESS_CODING
498  Bool getUseLossless ()         { return m_useLossless; }
499  Void setUseLossless ( Bool b ) { m_useLossless  = b; }
500#endif
501  Bool getUseNSQT() { return m_useNSQT; }
502  Void setUseNSQT( Bool b ) { m_useNSQT = b; }
503 
504  Bool getRestrictedRefPicListsFlag    ()          { return m_restrictedRefPicListsFlag;   }
505  Void setRestrictedRefPicListsFlag    ( Bool b )  { m_restrictedRefPicListsFlag = b;      }
506  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
507  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
508
509  // AMVP mode (for each depth)
510  AMVP_MODE getAMVPMode ( UInt uiDepth ) { assert(uiDepth < g_uiMaxCUDepth);  return m_aeAMVPMode[uiDepth]; }
511  Void      setAMVPMode ( UInt uiDepth, AMVP_MODE eMode) { assert(uiDepth < g_uiMaxCUDepth);  m_aeAMVPMode[uiDepth] = eMode; }
512 
513  // AMP accuracy
514  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
515  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
516
517  // Bit-depth
518  UInt      getBitDepth     ()         { return m_uiBitDepth;     }
519  Void      setBitDepth     ( UInt u ) { m_uiBitDepth = u;        }
520  UInt      getBitIncrement ()         { return m_uiBitIncrement; }
521  Void      setBitIncrement ( UInt u ) { m_uiBitIncrement = u;    }
522  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
523  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
524  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
525  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
526
527  Void      setLFCrossSliceBoundaryFlag     ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
528  Bool      getLFCrossSliceBoundaryFlag     ()                    { return m_bLFCrossSliceBoundaryFlag;   } 
529
530  Void setUseDF                   ( Bool b ) { m_useDF = b; }
531  Bool getUseDF                   ()         { return m_useDF; }
532
533  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
534  Bool getUseSAO                  ()           {return m_bUseSAO;}
535
536#if HHI_MPI
537  Void setUseMVI                  (Bool bVal)  {m_bUseMVI = bVal;}
538  Bool getUseMVI                  ()           {return m_bUseMVI;}
539#endif
540 
541#if RWTH_SDC_DLT_B0036
542  Bool getUseDLT      ()          { return m_bUseDLT; }
543  Void setUseDLT      ( Bool b ) { m_bUseDLT  = b;          }
544 
545  UInt getBitsPerDepthValue()       { return m_bUseDLT?m_uiBitsPerDepthValue:g_uiBitDepth; }
546  UInt getNumDepthValues()          { return m_bUseDLT?m_uiNumDepthmapValues:g_uiIBDI_MAX; }
547  UInt depthValue2idx(Pel uiValue)  { return m_bUseDLT?m_uiDepthValue2Idx[uiValue]:uiValue; }
548  Pel  idx2DepthValue(UInt uiIdx)   { return m_bUseDLT?m_uiIdx2DepthValue[uiIdx]:uiIdx; }
549  Void setDepthLUTs   (UInt* uidx2DepthValue = NULL, UInt uiNumDepthValues = 0);
550#endif
551
552  UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
553  Void      setMaxTLayers( UInt uiMaxTLayers )        { assert( uiMaxTLayers <= MAX_TLAYER ); m_uiMaxTLayers = uiMaxTLayers; }
554
555  Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
556  Void      setTemporalIdNestingFlag( Bool bValue )   { m_bTemporalIdNestingFlag = bValue; }
557  UInt      getPCMBitDepthLuma     ()         { return m_uiPCMBitDepthLuma;     }
558  Void      setPCMBitDepthLuma     ( UInt u ) { m_uiPCMBitDepthLuma = u;        }
559  UInt      getPCMBitDepthChroma   ()         { return m_uiPCMBitDepthChroma;   }
560  Void      setPCMBitDepthChroma   ( UInt u ) { m_uiPCMBitDepthChroma = u;      }
561  Void      setPCMFilterDisableFlag     ( Bool   bValue  )    { m_bPCMFilterDisableFlag = bValue; }
562  Bool      getPCMFilterDisableFlag     ()                    { return m_bPCMFilterDisableFlag;   } 
563
564  Void    setLFCrossTileBoundaryFlag               ( Bool   bValue  )    { m_bLFCrossTileBoundaryFlag = bValue; }
565  Bool    getLFCrossTileBoundaryFlag               ()                    { return m_bLFCrossTileBoundaryFlag;   }
566  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
567  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
568  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
569  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
570  Void     setColumnWidth ( UInt* columnWidth )
571  {
572    if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 )
573    {
574      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
575
576      for(Int i=0; i<m_iNumColumnsMinus1; i++)
577      {
578        m_puiColumnWidth[i] = columnWidth[i];
579     }
580    }
581  }
582  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
583  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
584  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
585  Void     setRowHeight    ( UInt* rowHeight )
586  {
587    if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )
588    {
589      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
590
591      for(Int i=0; i<m_iNumRowsMinus1; i++)
592      {
593        m_puiRowHeight[i] = rowHeight[i];
594      }
595    }
596  }
597  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
598  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
599  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
600  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
601  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
602  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
603  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
604  UInt getTilesOrEntropyCodingSyncIdc ()                    { return m_tilesOrEntropyCodingSyncIdc;   }
605  Void setTilesOrEntropyCodingSyncIdc ( UInt val )          { m_tilesOrEntropyCodingSyncIdc = val;    }
606  Int  getNumSubstreams               ()                    { return m_numSubstreams;                 }
607  Void setNumSubstreams               ( Int numSubstreams ) { m_numSubstreams = numSubstreams;        }
608
609#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
610  Bool getUseDMM()         { return m_bUseDMM; }
611  Void setUseDMM( Bool b ) { m_bUseDMM = b;    }
612#endif
613
614#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER_M23723
615  Bool getUseDMM34()         { return m_bUseDMM34; }
616  Void setUseDMM34( Bool b ) { m_bUseDMM34 = b;    }
617#endif
618
619#if OL_QTLIMIT_PREDCODING_B0068
620  Void setUseQTLPC( Bool b ) { m_bUseQTLPC = b;    }
621  Bool getUseQTLPC()         { return m_bUseQTLPC; }
622#endif
623
624  Void initMultiviewSPS      ( UInt uiViewId, Int iViewOrderIdx = 0, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
625#if FCO_FIX_SPS_CHANGE
626  Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
627#else
628  Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx );
629#endif
630
631  UInt getViewId             ()  { return m_uiViewId; }
632  Int  getViewOrderIdx       ()  { return m_iViewOrderIdx; }
633  Bool isDepth               ()  { return m_bDepth; }
634  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
635  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
636  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
637  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
638  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
639  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
640
641
642#if DEPTH_MAP_GENERATION
643  Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
644#endif
645#if H3D_IVRP
646  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
647#endif
648
649#if DEPTH_MAP_GENERATION
650  UInt getPredDepthMapGeneration()          { return m_uiPredDepthMapGeneration; }
651  UInt getPdmPrecision          ()          { return m_uiPdmPrecision;           }
652  Int* getPdmScaleNomDelta      ()          { return m_aiPdmScaleNomDelta;       }
653  Int* getPdmOffset             ()          { return m_aiPdmOffset;              }
654#endif
655
656#if H3D_IVMP
657  UInt  getMultiviewMvPredMode   ()          { return m_uiMultiviewMvPredMode;    }
658#endif
659#if H3D_IVRP
660  UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
661#endif
662
663#if DEPTH_MAP_GENERATION
664  Void                    setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
665  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
666#endif
667#if H3D_IVRP
668  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
669  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
670#endif
671};
672
673
674/// Reference Picture Lists class
675class TComRefPicListModification
676{
677private:
678  UInt      m_bRefPicListModificationFlagL0; 
679  UInt      m_bRefPicListModificationFlagL1; 
680  UInt      m_RefPicSetIdxL0[32];
681  UInt      m_RefPicSetIdxL1[32];
682   
683public:
684  TComRefPicListModification();
685  virtual ~TComRefPicListModification();
686 
687  Void  create                    ();
688  Void  destroy                   ();
689
690  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
691  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
692  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
693  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
694  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
695  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
696  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
697  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
698};
699
700/// PPS class
701class TComPPS
702{
703private:
704  Int         m_PPSId;                    // pic_parameter_set_id
705  Int         m_SPSId;                    // seq_parameter_set_id
706  Int         m_picInitQPMinus26;
707  Bool        m_useDQP;
708  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
709 
710  // access channel
711  TComSPS*    m_pcSPS;
712  UInt        m_uiMaxCuDQPDepth;
713  UInt        m_uiMinCuDQPSize;
714
715  Int        m_iChromaQpOffset;
716  Int        m_iChromaQpOffset2nd;
717
718
719
720  Int         m_iSliceGranularity;
721
722  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
723  UInt        m_uiBiPredIdc;              // Use of Weighting Bi-Prediction (B_SLICE)
724
725  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
726
727  Int      m_iTileBehaviorControlPresentFlag;
728  Bool     m_bLFCrossTileBoundaryFlag;
729  Int      m_iColumnRowInfoPresent;
730  Int      m_iUniformSpacingIdr;
731  Int      m_iNumColumnsMinus1;
732  UInt*    m_puiColumnWidth;
733  Int      m_iNumRowsMinus1;
734  UInt*    m_puiRowHeight;
735 
736  Int      m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header!
737  Int      m_iNumSubstreams;
738
739  Bool     m_enableTMVPFlag;
740
741  Int      m_signHideFlag;
742  Int      m_signHidingThreshold;
743
744#if CABAC_INIT_FLAG
745  Bool     m_cabacInitPresentFlag;
746  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
747#if FIX_POZNAN_CABAC_INIT_FLAG
748  UInt     m_encPrevPOC;
749#endif
750#endif
751  Bool     m_DeblockingFilterControlPresent;
752  UInt m_log2ParallelMergeLevelMinus2;
753public:
754  TComPPS();
755  virtual ~TComPPS();
756 
757  Int       getPPSId ()      { return m_PPSId; }
758  Void      setPPSId (Int i) { m_PPSId = i; }
759  Int       getSPSId ()      { return m_SPSId; }
760  Void      setSPSId (Int i) { m_SPSId = i; }
761 
762  Int       getSliceGranularity()        { return m_iSliceGranularity; }
763  Void      setSliceGranularity( Int i ) { m_iSliceGranularity = i;    }
764  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
765  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
766  Bool      getUseDQP ()                   { return m_useDQP;        }
767  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
768  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
769  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
770
771
772  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
773  TComSPS*  getSPS              ()         { return m_pcSPS;          }
774  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
775  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
776  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
777  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
778
779  Void      setChromaQpOffset   ( Int i ) { m_iChromaQpOffset = i; }
780  Int       getChromaQpOffset   () { return m_iChromaQpOffset;}
781  Void      setChromaQpOffset2nd( Int i ) { m_iChromaQpOffset2nd = i; }
782  Int       getChromaQpOffset2nd() { return m_iChromaQpOffset2nd;}
783
784  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
785  UInt getWPBiPredIdc               ()          { return m_uiBiPredIdc;     }
786
787  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
788  Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;        }
789
790  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
791  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
792
793  Void    setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
794  Int     getTileBehaviorControlPresentFlag        ()                    { return m_iTileBehaviorControlPresentFlag; }
795  Void    setLFCrossTileBoundaryFlag               ( Bool   bValue  )    { m_bLFCrossTileBoundaryFlag = bValue; }
796  Bool    getLFCrossTileBoundaryFlag               ()                    { return m_bLFCrossTileBoundaryFlag;   }
797  Void     setColumnRowInfoPresent          ( Int i )           { m_iColumnRowInfoPresent = i; }
798  Int      getColumnRowInfoPresent          ()                  { return m_iColumnRowInfoPresent; }
799  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
800  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
801  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
802  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
803  Void     setColumnWidth ( UInt* columnWidth )
804  {
805    if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 )
806    {
807      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
808
809      for(Int i=0; i<m_iNumColumnsMinus1; i++)
810      {
811        m_puiColumnWidth[i] = columnWidth[i];
812      }
813    }
814  }
815  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
816  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
817  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
818  Void     setRowHeight    ( UInt* rowHeight )
819  {
820    if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )
821    {
822      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
823
824      for(Int i=0; i<m_iNumRowsMinus1; i++)
825      {
826        m_puiRowHeight[i] = rowHeight[i];
827      }
828    }
829  }
830  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
831  Void     setEntropyCodingMode(Int iEntropyCodingMode)       { m_iEntropyCodingMode = iEntropyCodingMode; }
832  Int      getEntropyCodingMode()                             { return m_iEntropyCodingMode; }
833  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
834  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
835
836  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
837  Void      setTSIG( Int tsig )                 { m_signHidingThreshold = tsig; }
838  Int       getSignHideFlag()                    { return m_signHideFlag; }
839  Int       getTSIG()                            { return m_signHidingThreshold; }
840
841  Void     setEnableTMVPFlag( Bool b )  { m_enableTMVPFlag = b;    }
842  Bool     getEnableTMVPFlag()          { return m_enableTMVPFlag; }
843
844#if CABAC_INIT_FLAG
845  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
846  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
847  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
848  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
849#if FIX_POZNAN_CABAC_INIT_FLAG
850  Void     setEncPrevPOC(UInt uiPOC)                { m_encPrevPOC = uiPOC;             }
851  UInt     getEncPrevPOC()                          { return m_encPrevPOC;              }
852#endif
853#endif
854  Void setDeblockingFilterControlPresent    ( Bool bValue )       { m_DeblockingFilterControlPresent = bValue; }
855  Bool getDeblockingFilterControlPresent    ()                    { return m_DeblockingFilterControlPresent; }
856  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
857  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
858};
859
860/// SCALING_LIST class
861class TComScalingList
862{
863public:
864  TComScalingList();
865  virtual ~TComScalingList();
866  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
867  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
868  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
869  Bool     checkPredMode                  (UInt sizeId, UInt listId);
870  Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
871  UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
872  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
873  Void     processDefaultMarix            (UInt sizeId, UInt listId);
874  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
875  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
876  Void     checkDcOfMatrix                ();
877  Void     setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b)   { m_useDefaultScalingMatrixFlag[sizeId][listId] = b;    } //!< set default matrix enabled/disabled in each matrix
878  Bool     getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId)           { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix
879  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
880  Bool     xParseScalingList              (char* pchFile);
881
882private:
883  Void     init                    ();
884  Void     destroy                 ();
885  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
886  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
887  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
888  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
889  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
890  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
891};
892
893/// APS class
894class TComAPS
895{
896public:
897  TComAPS();
898  virtual ~TComAPS();
899
900  Void      setAPSID      (Int iID)   {m_apsID = iID;            }  //!< set APS ID
901  Int       getAPSID      ()          {return m_apsID;           }  //!< get APS ID
902  Void      setSaoEnabled (Bool bVal) {m_bSaoEnabled = bVal;     }  //!< set SAO enabled/disabled in APS
903  Bool      getSaoEnabled ()          {return m_bSaoEnabled;     }  //!< get SAO enabled/disabled in APS
904  Void      setAlfEnabled (Bool bVal) {m_bAlfEnabled = bVal;     }  //!< set ALF enabled/disabled in APS
905  Bool      getAlfEnabled ()          {return m_bAlfEnabled;     }  //!< get ALF enabled/disabled in APS
906
907  AlfParamSet* getAlfParam   ()          {return m_alfParamSet;}
908  SAOParam* getSaoParam   ()          {return m_pSaoParam;       }  //!< get SAO parameters in APS
909
910  Void      createSaoParam();   //!< create SAO parameter object
911  Void      destroySaoParam();  //!< destroy SAO parameter object
912
913  Void      createAlfParam();   //!< create ALF parameter object
914  Void      destroyAlfParam();  //!< destroy ALF parameter object
915
916  Void      setLoopFilterOffsetInAPS(Bool val)  {m_loopFilterOffsetInAPS = val; }      //!< set offset for deblocking filter enabled/disabled in APS
917  Bool      getLoopFilterOffsetInAPS()          {return m_loopFilterOffsetInAPS; }     //!< get offset for deblocking filter enabled/disabled in APS
918  Void      setLoopFilterDisable(Bool val)      {m_loopFilterDisable = val; }          //!< set offset for deblocking filter disabled
919  Bool      getLoopFilterDisable()              {return m_loopFilterDisable; }         //!< get offset for deblocking filter disabled
920  Void      setLoopFilterBetaOffset(Int val)    {m_loopFilterBetaOffsetDiv2 = val; }    //!< set beta offset for deblocking filter
921  Int       getLoopFilterBetaOffset()           {return m_loopFilterBetaOffsetDiv2; }   //!< get beta offset for deblocking filter
922  Void      setLoopFilterTcOffset(Int val)      {m_loopFilterTcOffsetDiv2 = val; }      //!< set tc offset for deblocking filter
923  Int       getLoopFilterTcOffset()             {return m_loopFilterTcOffsetDiv2; }     //!< get tc offset for deblocking filter
924
925  Void      createScalingList();
926  Void      destroyScalingList();
927  Void      setScalingListEnabled (Bool bVal) { m_scalingListEnabled = bVal; }  //!< set ScalingList enabled/disabled in APS
928  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
929  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
930  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
931  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
932
933private:
934  Int         m_apsID;        //!< APS ID
935  Bool        m_bSaoEnabled;  //!< SAO enabled/disabled in APS (true for enabled)
936  Bool        m_bAlfEnabled;  //!< ALF enabled/disabled in APS (true for enabled)
937  SAOParam*   m_pSaoParam;    //!< SAO parameter object pointer
938  AlfParamSet*   m_alfParamSet;
939  Bool        m_loopFilterOffsetInAPS;       //< offset for deblocking filter in 0 = slice header, 1 = APS
940  Bool        m_loopFilterDisable;           //< Deblocking filter enabled/disabled in APS
941  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
942  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
943  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
944  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
945  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
946
947public:
948  TComAPS& operator= (const TComAPS& src);  //!< "=" operator for APS object
949};
950
951typedef struct {
952  // Explicit weighted prediction parameters parsed in slice header,
953  // or Implicit weighted prediction parameters (8 bits depth values).
954  Bool        bPresentFlag;
955  UInt        uiLog2WeightDenom;
956  Int         iWeight;
957  Int         iOffset;
958
959  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
960  Int         w, o, offset, shift, round;
961} wpScalingParam;
962
963typedef struct {
964  Int64 iAC;
965  Int64 iDC;
966} wpACDCParam;
967
968/// slice header class
969class TComSlice
970{
971 
972private:
973  //  Bitstream writing
974  Int         m_iAPSId; //!< APS ID in slice header
975  bool       m_alfEnabledFlag;
976  bool       m_saoEnabledFlag;
977  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
978  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
979  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
980  Int         m_iPPSId;               ///< picture parameter set ID
981  Bool        m_PicOutputFlag;        ///< pic_output_flag
982  Int         m_iPOC;
983  Int         m_iLastIDR;
984  static Int  m_prevPOC;
985  TComReferencePictureSet *m_pcRPS;
986  TComReferencePictureSet m_LocalRPS;
987  Int         m_iBDidx; 
988  Int         m_iCombinationBDidx;
989  Bool        m_bCombineWithReferenceFlag;
990  TComRefPicListModification m_RefPicListModification;
991  NalUnitType m_eNalUnitType;            ///< Nal unit type for the slice
992  NalUnitType m_eNalUnitTypeBaseViewMvc; ///< Nal unit type of the base view slice for multiview coding
993  SliceType   m_eSliceType;
994  Int         m_iSliceQp;
995#if ADAPTIVE_QP_SELECTION
996  Int         m_iSliceQpBase;
997#endif
998  Bool        m_bLoopFilterDisable;
999  Bool        m_loopFilterOffsetInAPS;
1000  Bool        m_inheritDblParamFromAPS;      //< offsets for deblocking filter inherit from APS
1001  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
1002  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
1003 
1004  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
1005
1006  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
1007  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
1008  Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
1009  Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
1010  Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
1011  Bool        m_bRefPicListModificationFlagLC;
1012  Bool        m_bRefPicListCombinationFlag;
1013
1014  Bool        m_bCheckLDC;
1015#if QC_TMVP_MRG_REFIDX_C0047
1016  Int         m_aiNewRefIdx    [2]; 
1017#endif
1018
1019  //  Data
1020  Int         m_iSliceQpDelta;
1021  TComPic*    m_apcRefPicList  [2][MAX_NUM_REF+1];
1022  Int         m_aiRefPOCList   [2][MAX_NUM_REF+1];
1023  Int         m_aiRefViewIdList[2][MAX_NUM_REF+1];
1024  TComPic*    m_pcTexturePic;
1025  Int         m_iDepth;
1026 
1027  // referenced slice?
1028  Bool        m_bRefenced;
1029 
1030  // access channel
1031#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1032  TComVPS*    m_pcVPS;
1033#endif
1034#if QC_IV_AS_LT_B0046
1035  Bool        m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
1036#endif
1037  TComSPS*    m_pcSPS;
1038  TComPPS*    m_pcPPS;
1039  TComPic*    m_pcPic;
1040#if ADAPTIVE_QP_SELECTION
1041  TComTrQuant* m_pcTrQuant;
1042#endif 
1043  TComAPS*    m_pcAPS;  //!< pointer to APS parameter object
1044
1045  UInt        m_uiColDir;  // direction to get colocated CUs
1046 
1047#if COLLOCATED_REF_IDX
1048  UInt        m_colRefIdx;
1049#endif
1050
1051#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA
1052  Double      m_dLambdaLuma;
1053  Double      m_dLambdaChroma;
1054#else
1055  Double      m_dLambda;
1056#endif
1057
1058  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
1059 
1060  Bool        m_bNoBackPredFlag;
1061  Bool        m_bRefIdxCombineCoding;
1062
1063  UInt        m_uiTLayer;
1064  Bool        m_bTLayerSwitchingFlag;
1065
1066  UInt        m_uiSliceMode;
1067  UInt        m_uiSliceArgument;
1068  UInt        m_uiSliceCurStartCUAddr;
1069  UInt        m_uiSliceCurEndCUAddr;
1070  UInt        m_uiSliceIdx;
1071  UInt        m_uiEntropySliceMode;
1072  UInt        m_uiEntropySliceArgument;
1073  UInt        m_uiEntropySliceCurStartCUAddr;
1074  UInt        m_uiEntropySliceCurEndCUAddr;
1075  Bool        m_bNextSlice;
1076  Bool        m_bNextEntropySlice;
1077  UInt        m_uiSliceBits;
1078  UInt        m_uiEntropySliceCounter;
1079  Bool        m_bFinalized;
1080
1081  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
1082  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
1083  wpScalingParam  m_weightPredTableLC[2*MAX_NUM_REF][3]; // [refIdxLC][0:Y, 1:U, 2:V]
1084
1085  UInt        *m_uiTileByteLocation;
1086  UInt        m_uiTileCount;
1087  Int         m_iTileMarkerFlag;
1088  UInt        m_uiTileOffstForMultES;
1089
1090  UInt*       m_puiSubstreamSizes;
1091  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
1092#if CABAC_INIT_FLAG
1093  Bool        m_cabacInitFlag; 
1094#else
1095  Int         m_cabacInitIdc; 
1096#endif
1097
1098  Bool       m_bLMvdL1Zero;
1099  Int         m_numEntryPointOffsets;
1100
1101  Int        m_viewId;
1102  Bool       m_isDepth;
1103  Int        m_aaiCodedScale [2][MAX_VIEW_NUM];
1104  Int        m_aaiCodedOffset[2][MAX_VIEW_NUM];
1105
1106#if LGE_ILLUCOMP_B0045
1107  Bool        m_bApplyIC;
1108#endif
1109#if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
1110  Bool       m_bIVScalingFlag;
1111  Int        m_iViewOrderIdx;    // will be changed to view_id
1112#endif
1113
1114#if MERL_VSP_C0152
1115  TComPic*     m_apcRefPicBaseTxt;
1116  TComPic*     m_apcRefPicBaseDepth;
1117  Int*         m_aiShiftLUT;
1118  Int          m_iShiftPrec;
1119#endif
1120
1121public:
1122  TComSlice();
1123  virtual ~TComSlice();
1124 
1125  Void      initSlice       ();
1126  Void      initTiles();
1127
1128#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1129  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
1130  TComVPS*  getVPS          () { return m_pcVPS; }
1131#endif
1132#if QC_IV_AS_LT_B0046
1133  Void          setWasLongTerm( Bool lt,  RefPicList e, Int iRefIdx ) { m_bWasLongTerm[e][iRefIdx] = lt; }
1134  Bool          getWasLongTerm( RefPicList e, Int iRefIdx           ) { return m_bWasLongTerm[e][iRefIdx] ; }
1135#endif
1136
1137  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1138  TComSPS*  getSPS          () { return m_pcSPS; }
1139 
1140  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
1141  TComPPS*  getPPS          () { return m_pcPPS; }
1142
1143#if ADAPTIVE_QP_SELECTION
1144  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
1145  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
1146#endif
1147
1148  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
1149  Int       getPPSId        () { return m_iPPSId; }
1150  Void      setAPS          ( TComAPS* pcAPS ) { m_pcAPS = pcAPS; } //!< set APS pointer
1151  TComAPS*  getAPS          ()                 { return m_pcAPS;  } //!< get APS pointer
1152  Void      setAPSId        ( Int Id)          { m_iAPSId =Id;    } //!< set APS ID
1153  Int       getAPSId        ()                 { return m_iAPSId; } //!< get APS ID
1154  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
1155  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
1156  Void      setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; }
1157  Bool      getAlfEnabledFlag() { return m_alfEnabledFlag; }
1158  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
1159  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
1160  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
1161  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
1162  Void      setSaoEnabledFlagCb(Bool s) {m_saoEnabledFlagCb =s; }       //!< set SAO Cb enabled flag
1163  Bool      getSaoEnabledFlagCb() { return m_saoEnabledFlagCb; }        //!< get SAO Cb enabled flag
1164  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
1165  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
1166  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
1167  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
1168  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
1169
1170  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
1171  Int       getRPSidx          () { return m_iBDidx; }
1172  Void      setCombinationBDidx          ( Int iCombinationBDidx ) { m_iCombinationBDidx = iCombinationBDidx; }
1173  Int       getCombinationBDidx          () { return m_iCombinationBDidx; }
1174  Void      setCombineWithReferenceFlag          ( Bool bCombineWithReferenceFlag ) { m_bCombineWithReferenceFlag = bCombineWithReferenceFlag; }
1175  Bool      getCombineWithReferenceFlag          () { return m_bCombineWithReferenceFlag; }
1176  Int       getPrevPOC      ()                          { return  m_prevPOC;       }
1177
1178  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
1179  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
1180  Int       getLastIDR()                                  { return m_iLastIDR; }
1181  SliceType getSliceType    ()                          { return  m_eSliceType;         }
1182  Int       getPOC          ()                          { return  m_iPOC;           }
1183  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
1184#if ADAPTIVE_QP_SELECTION
1185  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
1186#endif
1187  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
1188  Bool      getLoopFilterDisable()                      { return  m_bLoopFilterDisable; }
1189  Bool      getLoopFilterOffsetInAPS()                  { return  m_loopFilterOffsetInAPS;}
1190  Bool      getInheritDblParamFromAPS()                 { return  m_inheritDblParamFromAPS; }
1191  Int       getLoopFilterBetaOffset()                   { return  m_loopFilterBetaOffsetDiv2; }
1192  Int       getLoopFilterTcOffset()                     { return  m_loopFilterTcOffsetDiv2; }
1193
1194  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
1195  TComPic*  getPic              ()                              { return  m_pcPic;                      }
1196  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
1197  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
1198  Int       getRefViewId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefViewIdList[e][iRefIdx]; }
1199  TComPic*  getTexturePic       () const                        { return  m_pcTexturePic; }
1200  Int       getDepth            ()                              { return  m_iDepth;                     }
1201  UInt      getColDir           ()                              { return  m_uiColDir;                   }
1202#if COLLOCATED_REF_IDX
1203  Bool      getColRefIdx        ()                              { return  m_colRefIdx;                  }
1204  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
1205#endif
1206  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
1207  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
1208  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
1209  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
1210  Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
1211  Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
1212  Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
1213  Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
1214  Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
1215  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
1216  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}     
1217  Void      setListIdFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_eListIdFromIdxOfLC[iRefIdx]=uiVal; }
1218  Void      setRefIdxFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_iRefIdxFromIdxOfLC[iRefIdx]=uiVal; }
1219  Void      setRefIdxOfLC       (RefPicList e, Int iRefIdx, Int RefIdxLC)     { m_iRefIdxOfLC[e][iRefIdx]=RefIdxLC;}
1220
1221  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
1222  Bool      isReferenced()                                      { return m_bRefenced; }
1223 
1224  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
1225  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
1226  NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
1227  Void      setNalUnitTypeBaseViewMvc  ( NalUnitType e )        { m_eNalUnitTypeBaseViewMvc = e;    }
1228  NalUnitType getNalUnitTypeBaseViewMvc()                       { return m_eNalUnitTypeBaseViewMvc; }
1229  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic);
1230  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
1231  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
1232  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
1233#if ADAPTIVE_QP_SELECTION
1234  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
1235#endif
1236  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
1237  Void      setLoopFilterDisable( Bool b )                      { m_bLoopFilterDisable= b;      }
1238  Void      setLoopFilterOffsetInAPS( Bool b )                  { m_loopFilterOffsetInAPS = b;}
1239  Void      setInheritDblParamFromAPS( Bool b )                 { m_inheritDblParamFromAPS = b; }
1240  Void      setLoopFilterBetaOffset( Int i )                    { m_loopFilterBetaOffsetDiv2 = i; }
1241  Void      setLoopFilterTcOffset( Int i )                      { m_loopFilterTcOffsetDiv2 = i; }
1242 
1243  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
1244  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
1245  Void      setRefViewId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewIdList[e][iRefIdx] = i; }
1246  Void      setTexturePic       ( TComPic *pcTexturePic )       { m_pcTexturePic = pcTexturePic; }
1247  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
1248  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
1249  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
1250 
1251  Int       getNumPocTotalCurr();
1252  Int       getNumPocTotalCurrMvc();
1253  Void      setRefPicListMvc    ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics );
1254  Void      setRefPOCnViewListsMvc();
1255
1256  Void      setColDir           ( UInt uiDir ) { m_uiColDir = uiDir; }
1257#if COLLOCATED_REF_IDX
1258  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
1259#endif
1260  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
1261  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
1262
1263  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
1264  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
1265  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
1266 
1267#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 
1268  Void      setLambda( Double d, Double e ) { m_dLambdaLuma = d; m_dLambdaChroma = e;}
1269  Double    getLambdaLuma() { return m_dLambdaLuma;        }
1270  Double    getLambdaChroma() { return m_dLambdaChroma;        }
1271#else
1272  Void      setLambda( Double d ) { m_dLambda = d; }
1273  Double    getLambda() { return m_dLambda;        }
1274#endif
1275 
1276  Void      initEqualRef();
1277  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
1278  {
1279    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
1280    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
1281  }
1282 
1283  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
1284  {
1285    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
1286  }
1287 
1288  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
1289 
1290  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
1291  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
1292  Bool getRefIdxCombineCoding() { return m_bRefIdxCombineCoding; }
1293  Void setRefIdxCombineCoding( Bool b ) { m_bRefIdxCombineCoding = b; }
1294  Void generateCombinedList       ();
1295
1296  UInt getTLayer             ()                            { return m_uiTLayer;                      }
1297  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
1298
1299
1300  Void setTLayerInfo( UInt uiTLayer );
1301  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
1302  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1303#if H0566_TLA_SET_FOR_SWITCHING_POINTS
1304  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1305#endif
1306  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0);
1307  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
1308
1309  Void decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC );
1310
1311  UInt m_uiMaxNumMergeCand;
1312  Void setMaxNumMergeCand               (UInt maxNumMergeCand ) { m_uiMaxNumMergeCand = maxNumMergeCand;  }
1313  UInt getMaxNumMergeCand               ()                  {return m_uiMaxNumMergeCand;                  }
1314
1315  Void setSliceMode                     ( UInt uiMode )     { m_uiSliceMode = uiMode;                     }
1316  UInt getSliceMode                     ()                  { return m_uiSliceMode;                       }
1317  Void setSliceArgument                 ( UInt uiArgument ) { m_uiSliceArgument = uiArgument;             }
1318  UInt getSliceArgument                 ()                  { return m_uiSliceArgument;                   }
1319  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_uiSliceCurStartCUAddr = uiAddr;           }
1320  UInt getSliceCurStartCUAddr           ()                  { return m_uiSliceCurStartCUAddr;             }
1321  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_uiSliceCurEndCUAddr = uiAddr;             }
1322  UInt getSliceCurEndCUAddr             ()                  { return m_uiSliceCurEndCUAddr;               }
1323  Void setSliceIdx                      ( UInt i)           { m_uiSliceIdx = i;                           }
1324  UInt getSliceIdx                      ()                  { return  m_uiSliceIdx;                       }
1325  Void copySliceInfo                    (TComSlice *pcSliceSrc);
1326  Void setEntropySliceMode              ( UInt uiMode )     { m_uiEntropySliceMode = uiMode;              }
1327  UInt getEntropySliceMode              ()                  { return m_uiEntropySliceMode;                }
1328  Void setEntropySliceArgument          ( UInt uiArgument ) { m_uiEntropySliceArgument = uiArgument;      }
1329  UInt getEntropySliceArgument          ()                  { return m_uiEntropySliceArgument;            }
1330  Void setEntropySliceCurStartCUAddr    ( UInt uiAddr )     { m_uiEntropySliceCurStartCUAddr = uiAddr;    }
1331  UInt getEntropySliceCurStartCUAddr    ()                  { return m_uiEntropySliceCurStartCUAddr;      }
1332  Void setEntropySliceCurEndCUAddr      ( UInt uiAddr )     { m_uiEntropySliceCurEndCUAddr = uiAddr;      }
1333  UInt getEntropySliceCurEndCUAddr      ()                  { return m_uiEntropySliceCurEndCUAddr;        }
1334  Void setNextSlice                     ( Bool b )          { m_bNextSlice = b;                           }
1335  Bool isNextSlice                      ()                  { return m_bNextSlice;                        }
1336  Void setNextEntropySlice              ( Bool b )          { m_bNextEntropySlice = b;                    }
1337  Bool isNextEntropySlice               ()                  { return m_bNextEntropySlice;                 }
1338  Void setSliceBits                     ( UInt uiVal )      { m_uiSliceBits = uiVal;                      }
1339  UInt getSliceBits                     ()                  { return m_uiSliceBits;                       } 
1340  Void setEntropySliceCounter           ( UInt uiVal )      { m_uiEntropySliceCounter = uiVal;            }
1341  UInt getEntropySliceCounter           ()                  { return m_uiEntropySliceCounter;             }
1342  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
1343  Bool getFinalized                     ()                  { return m_bFinalized;                        }
1344  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
1345  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
1346
1347  Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1348  Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1349  Void  initWpScaling   ();
1350  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPredIdc()) ); }
1351 
1352  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
1353  Void  getWpAcDcParam  ( wpACDCParam *&wp );
1354  Void  initWpAcDcParam ();
1355  Void  copyWPtable     (wpScalingParam *&wp_src, wpScalingParam *&wp_dst);
1356  Void  getWpScalingLC  ( Int iRefIdx, wpScalingParam *&wp);
1357  Void  resetWpScalingLC(wpScalingParam  wp[2*MAX_NUM_REF][3]);
1358  Void  setWpParamforLC();
1359  Void setTileLocationCount             ( UInt uiCount )      { m_uiTileCount = uiCount;                  }
1360  UInt getTileLocationCount             ()                    { return m_uiTileCount;                     }
1361  Void setTileLocation                  ( Int i, UInt uiLOC ) { m_uiTileByteLocation[i] = uiLOC;          }
1362  UInt getTileLocation                  ( Int i )             { return m_uiTileByteLocation[i];           }
1363  Void setTileMarkerFlag                ( Int iFlag )         { m_iTileMarkerFlag = iFlag;                }
1364  Int  getTileMarkerFlag                ()                    { return m_iTileMarkerFlag;                 }
1365  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
1366  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
1367  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
1368  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
1369  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
1370  TComScalingList*   getScalingList ()                               { return m_scalingList; }
1371  Void  setDefaultScalingList       ();
1372  Bool  checkDefaultScalingList     ();
1373#if CABAC_INIT_FLAG
1374  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
1375  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
1376#else
1377  Void      setCABACinitIDC(Int iVal) {m_cabacInitIdc = iVal;    }  //!< set CABAC initial IDC number
1378  Int       getCABACinitIDC()         {return m_cabacInitIdc;    }  //!< get CABAC initial IDC number
1379#endif
1380  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
1381  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
1382
1383  Void setViewId( Int viewId )       { m_viewId = viewId;   }
1384  Int  getViewId()                   { return m_viewId;     }
1385#if QC_MVHEVC_B0046
1386  Void    setViewOrderIdx(Int v, UInt layer)                { m_iViewOrderIdx = v;    }
1387  Int     getViewOrderIdx()                                 { return m_iViewOrderIdx; }
1388#endif
1389  Void setIsDepth( Bool isDepth )    { m_isDepth = isDepth; }
1390  Bool getIsDepth()                  { return m_isDepth;    }
1391 
1392  Void      initMultiviewSlice    ( Int** aaiScale = 0, Int** aaiOffset = 0 );
1393
1394  Int*      getCodedScale         ()  { return m_aaiCodedScale [0]; }
1395  Int*      getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
1396  Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
1397  Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
1398
1399#if LGE_ILLUCOMP_B0045
1400  Void      setApplyIC            ( Bool b ) { m_bApplyIC = b; }
1401  Bool      getApplyIC            ()  { return m_bApplyIC; }
1402  Void      xSetApplyIC           ();
1403#endif
1404#if QC_TMVP_MRG_REFIDX_C0047
1405  Int       getNewRefIdx        ( RefPicList e )                { return  m_aiNewRefIdx[e];     }
1406  Void      setNewRefIdx        ( RefPicList e, Int i )         { m_aiNewRefIdx[e]    = i;      }
1407#endif
1408#if INTER_VIEW_VECTOR_SCALING_C0115
1409  Void setIVScalingFlag( Bool val )         { m_bIVScalingFlag = val;     }
1410  Bool getIVScalingFlag()                   { return m_bIVScalingFlag;    }
1411  Void setViewOrderIdx     ( Int i )        { m_iViewOrderIdx     = i;    }   // will be changed to view_id
1412  Int  getViewOrderIdx     ()               { return  m_iViewOrderIdx;    }   // will be changed to view_id
1413#endif
1414
1415#if MERL_VSP_C0152
1416  TComPic*     getRefPicBaseTxt          ()                        { return  m_apcRefPicBaseTxt; }
1417  Void         setRefPicBaseTxt          ( TComPic* RefPic)        { m_apcRefPicBaseTxt = RefPic; }
1418  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
1419  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
1420
1421  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
1422  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
1423#endif
1424
1425protected:
1426  TComPic*  xGetRefPic        (TComList<TComPic*>& rcListPic, UInt uiPOC);
1427  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, UInt uiPOC);
1428  TComPic*  xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId );
1429};// END CLASS DEFINITION TComSlice
1430
1431
1432template <class T> class ParameterSetMap
1433{
1434public:
1435  ParameterSetMap(Int maxId)
1436  :m_maxId (maxId)
1437  {}
1438
1439  ~ParameterSetMap()
1440  {
1441    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
1442    {
1443      delete (*i).second;
1444    }
1445  }
1446
1447  Void storePS(Int psId, T *ps)
1448  {
1449    assert ( psId < m_maxId );
1450    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
1451    {
1452      delete m_paramsetMap[psId];
1453    }
1454    m_paramsetMap[psId] = ps; 
1455  }
1456
1457  Void mergePSList(ParameterSetMap<T> &rPsList)
1458  {
1459    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
1460    {
1461      storePS(i->first, i->second);
1462    }
1463    rPsList.m_paramsetMap.clear();
1464  }
1465
1466
1467  T* getPS(Int psId)
1468  {
1469    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
1470  }
1471
1472  T* getFirstPS()
1473  {
1474    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
1475  }
1476
1477#if QC_MVHEVC_B0046
1478  Void clearPSList()
1479  {
1480    m_paramsetMap.clear();
1481  }
1482#endif
1483private:
1484  std::map<Int,T *> m_paramsetMap;
1485  Int               m_maxId;
1486};
1487
1488class ParameterSetManager
1489{
1490public:
1491  ParameterSetManager();
1492  virtual ~ParameterSetManager();
1493#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1494  //! store video parameter set and take ownership of it
1495  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
1496  //! get pointer to existing video parameter set 
1497  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
1498  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
1499#if QC_MVHEVC_B0046
1500  Void     clearVPS()         { m_vpsMap.clearPSList(); };
1501  Void     clearSPS()         { m_spsMap.clearPSList(); };
1502  Void     clearPPS()         { m_ppsMap.clearPSList(); };
1503#endif
1504#endif
1505  //! store sequence parameter set and take ownership of it
1506  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
1507  //! get pointer to existing sequence parameter set 
1508  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
1509  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
1510
1511  //! store picture parameter set and take ownership of it
1512  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
1513  //! get pointer to existing picture parameter set 
1514  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
1515  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
1516
1517  //! store adaptation parameter set and take ownership of it
1518  Void storeAPS(TComAPS *aps) { m_apsMap.storePS( aps->getAPSID(), aps); };
1519  //! getPointer to existing adaptation parameter set 
1520  TComAPS* getAPS(Int apsId)  { return m_apsMap.getPS(apsId); };
1521
1522protected:
1523  ParameterSetMap<TComSPS> m_spsMap; 
1524  ParameterSetMap<TComPPS> m_ppsMap; 
1525  ParameterSetMap<TComAPS> m_apsMap; 
1526#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1527  ParameterSetMap<TComVPS> m_vpsMap; 
1528#endif
1529};
1530
1531//! \}
1532
1533#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.