source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComSlice.h @ 296

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

Reintegrated branch 5.1-dev0 rev. 295.

  • Property svn:eol-style set to native
File size: 72.5 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  Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx );
626
627  UInt getViewId             ()  { return m_uiViewId; }
628  Int  getViewOrderIdx       ()  { return m_iViewOrderIdx; }
629  Bool isDepth               ()  { return m_bDepth; }
630  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
631  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
632  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
633  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
634  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
635  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
636
637
638#if DEPTH_MAP_GENERATION
639  Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
640#endif
641#if H3D_IVRP
642  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
643#endif
644
645#if DEPTH_MAP_GENERATION
646  UInt getPredDepthMapGeneration()          { return m_uiPredDepthMapGeneration; }
647  UInt getPdmPrecision          ()          { return m_uiPdmPrecision;           }
648  Int* getPdmScaleNomDelta      ()          { return m_aiPdmScaleNomDelta;       }
649  Int* getPdmOffset             ()          { return m_aiPdmOffset;              }
650#endif
651
652#if H3D_IVMP
653  UInt  getMultiviewMvPredMode   ()          { return m_uiMultiviewMvPredMode;    }
654#endif
655#if H3D_IVRP
656  UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
657#endif
658
659#if DEPTH_MAP_GENERATION
660  Void                    setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
661  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
662#endif
663#if H3D_IVRP
664  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
665  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
666#endif
667};
668
669
670/// Reference Picture Lists class
671class TComRefPicListModification
672{
673private:
674  UInt      m_bRefPicListModificationFlagL0; 
675  UInt      m_bRefPicListModificationFlagL1; 
676  UInt      m_RefPicSetIdxL0[32];
677  UInt      m_RefPicSetIdxL1[32];
678   
679public:
680  TComRefPicListModification();
681  virtual ~TComRefPicListModification();
682 
683  Void  create                    ();
684  Void  destroy                   ();
685
686  Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
687  Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
688  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
689  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
690  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
691  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
692  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
693  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
694};
695
696/// PPS class
697class TComPPS
698{
699private:
700  Int         m_PPSId;                    // pic_parameter_set_id
701  Int         m_SPSId;                    // seq_parameter_set_id
702  Int         m_picInitQPMinus26;
703  Bool        m_useDQP;
704  Bool        m_bConstrainedIntraPred;    // constrained_intra_pred_flag
705 
706  // access channel
707  TComSPS*    m_pcSPS;
708  UInt        m_uiMaxCuDQPDepth;
709  UInt        m_uiMinCuDQPSize;
710
711  Int        m_iChromaQpOffset;
712  Int        m_iChromaQpOffset2nd;
713
714
715
716  Int         m_iSliceGranularity;
717
718  Bool        m_bUseWeightPred;           // Use of Weighting Prediction (P_SLICE)
719  UInt        m_uiBiPredIdc;              // Use of Weighting Bi-Prediction (B_SLICE)
720
721  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
722
723  Int      m_iTileBehaviorControlPresentFlag;
724  Bool     m_bLFCrossTileBoundaryFlag;
725  Int      m_iColumnRowInfoPresent;
726  Int      m_iUniformSpacingIdr;
727  Int      m_iNumColumnsMinus1;
728  UInt*    m_puiColumnWidth;
729  Int      m_iNumRowsMinus1;
730  UInt*    m_puiRowHeight;
731 
732  Int      m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header!
733  Int      m_iNumSubstreams;
734
735  Bool     m_enableTMVPFlag;
736
737  Int      m_signHideFlag;
738  Int      m_signHidingThreshold;
739
740#if CABAC_INIT_FLAG
741  Bool     m_cabacInitPresentFlag;
742  UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
743#if FIX_POZNAN_CABAC_INIT_FLAG
744  UInt     m_encPrevPOC;
745#endif
746#endif
747  Bool     m_DeblockingFilterControlPresent;
748  UInt m_log2ParallelMergeLevelMinus2;
749public:
750  TComPPS();
751  virtual ~TComPPS();
752 
753  Int       getPPSId ()      { return m_PPSId; }
754  Void      setPPSId (Int i) { m_PPSId = i; }
755  Int       getSPSId ()      { return m_SPSId; }
756  Void      setSPSId (Int i) { m_SPSId = i; }
757 
758  Int       getSliceGranularity()        { return m_iSliceGranularity; }
759  Void      setSliceGranularity( Int i ) { m_iSliceGranularity = i;    }
760  Int       getPicInitQPMinus26 ()         { return  m_picInitQPMinus26; }
761  Void      setPicInitQPMinus26 ( Int i )  { m_picInitQPMinus26 = i;     }
762  Bool      getUseDQP ()                   { return m_useDQP;        }
763  Void      setUseDQP ( Bool b )           { m_useDQP   = b;         }
764  Bool      getConstrainedIntraPred ()         { return  m_bConstrainedIntraPred; }
765  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
766
767
768  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
769  TComSPS*  getSPS              ()         { return m_pcSPS;          }
770  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
771  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
772  Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
773  UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
774
775  Void      setChromaQpOffset   ( Int i ) { m_iChromaQpOffset = i; }
776  Int       getChromaQpOffset   () { return m_iChromaQpOffset;}
777  Void      setChromaQpOffset2nd( Int i ) { m_iChromaQpOffset2nd = i; }
778  Int       getChromaQpOffset2nd() { return m_iChromaQpOffset2nd;}
779
780  Bool getUseWP                     ()          { return m_bUseWeightPred;  }
781  UInt getWPBiPredIdc               ()          { return m_uiBiPredIdc;     }
782
783  Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;     }
784  Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;        }
785
786  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
787  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
788
789  Void    setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
790  Int     getTileBehaviorControlPresentFlag        ()                    { return m_iTileBehaviorControlPresentFlag; }
791  Void    setLFCrossTileBoundaryFlag               ( Bool   bValue  )    { m_bLFCrossTileBoundaryFlag = bValue; }
792  Bool    getLFCrossTileBoundaryFlag               ()                    { return m_bLFCrossTileBoundaryFlag;   }
793  Void     setColumnRowInfoPresent          ( Int i )           { m_iColumnRowInfoPresent = i; }
794  Int      getColumnRowInfoPresent          ()                  { return m_iColumnRowInfoPresent; }
795  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
796  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
797  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
798  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
799  Void     setColumnWidth ( UInt* columnWidth )
800  {
801    if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 )
802    {
803      m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
804
805      for(Int i=0; i<m_iNumColumnsMinus1; i++)
806      {
807        m_puiColumnWidth[i] = columnWidth[i];
808      }
809    }
810  }
811  UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
812  Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
813  Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
814  Void     setRowHeight    ( UInt* rowHeight )
815  {
816    if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )
817    {
818      m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
819
820      for(Int i=0; i<m_iNumRowsMinus1; i++)
821      {
822        m_puiRowHeight[i] = rowHeight[i];
823      }
824    }
825  }
826  UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
827  Void     setEntropyCodingMode(Int iEntropyCodingMode)       { m_iEntropyCodingMode = iEntropyCodingMode; }
828  Int      getEntropyCodingMode()                             { return m_iEntropyCodingMode; }
829  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
830  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
831
832  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
833  Void      setTSIG( Int tsig )                 { m_signHidingThreshold = tsig; }
834  Int       getSignHideFlag()                    { return m_signHideFlag; }
835  Int       getTSIG()                            { return m_signHidingThreshold; }
836
837  Void     setEnableTMVPFlag( Bool b )  { m_enableTMVPFlag = b;    }
838  Bool     getEnableTMVPFlag()          { return m_enableTMVPFlag; }
839
840#if CABAC_INIT_FLAG
841  Void     setCabacInitPresentFlag( Bool flag )     { m_cabacInitPresentFlag = flag;    }
842  Void     setEncCABACTableIdx( Int idx )           { m_encCABACTableIdx = idx;         }
843  Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
844  UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
845#if FIX_POZNAN_CABAC_INIT_FLAG
846  Void     setEncPrevPOC(UInt uiPOC)                { m_encPrevPOC = uiPOC;             }
847  UInt     getEncPrevPOC()                          { return m_encPrevPOC;              }
848#endif
849#endif
850  Void setDeblockingFilterControlPresent    ( Bool bValue )       { m_DeblockingFilterControlPresent = bValue; }
851  Bool getDeblockingFilterControlPresent    ()                    { return m_DeblockingFilterControlPresent; }
852  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
853  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
854};
855
856/// SCALING_LIST class
857class TComScalingList
858{
859public:
860  TComScalingList();
861  virtual ~TComScalingList();
862  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
863  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
864  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
865  Bool     checkPredMode                  (UInt sizeId, UInt listId);
866  Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
867  UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
868  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
869  Void     processDefaultMarix            (UInt sizeId, UInt listId);
870  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
871  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
872  Void     checkDcOfMatrix                ();
873  Void     setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b)   { m_useDefaultScalingMatrixFlag[sizeId][listId] = b;    } //!< set default matrix enabled/disabled in each matrix
874  Bool     getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId)           { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix
875  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
876  Bool     xParseScalingList              (char* pchFile);
877
878private:
879  Void     init                    ();
880  Void     destroy                 ();
881  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
882  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
883  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
884  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
885  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
886  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
887};
888
889/// APS class
890class TComAPS
891{
892public:
893  TComAPS();
894  virtual ~TComAPS();
895
896  Void      setAPSID      (Int iID)   {m_apsID = iID;            }  //!< set APS ID
897  Int       getAPSID      ()          {return m_apsID;           }  //!< get APS ID
898  Void      setSaoEnabled (Bool bVal) {m_bSaoEnabled = bVal;     }  //!< set SAO enabled/disabled in APS
899  Bool      getSaoEnabled ()          {return m_bSaoEnabled;     }  //!< get SAO enabled/disabled in APS
900  Void      setAlfEnabled (Bool bVal) {m_bAlfEnabled = bVal;     }  //!< set ALF enabled/disabled in APS
901  Bool      getAlfEnabled ()          {return m_bAlfEnabled;     }  //!< get ALF enabled/disabled in APS
902
903  AlfParamSet* getAlfParam   ()          {return m_alfParamSet;}
904  SAOParam* getSaoParam   ()          {return m_pSaoParam;       }  //!< get SAO parameters in APS
905
906  Void      createSaoParam();   //!< create SAO parameter object
907  Void      destroySaoParam();  //!< destroy SAO parameter object
908
909  Void      createAlfParam();   //!< create ALF parameter object
910  Void      destroyAlfParam();  //!< destroy ALF parameter object
911
912  Void      setLoopFilterOffsetInAPS(Bool val)  {m_loopFilterOffsetInAPS = val; }      //!< set offset for deblocking filter enabled/disabled in APS
913  Bool      getLoopFilterOffsetInAPS()          {return m_loopFilterOffsetInAPS; }     //!< get offset for deblocking filter enabled/disabled in APS
914  Void      setLoopFilterDisable(Bool val)      {m_loopFilterDisable = val; }          //!< set offset for deblocking filter disabled
915  Bool      getLoopFilterDisable()              {return m_loopFilterDisable; }         //!< get offset for deblocking filter disabled
916  Void      setLoopFilterBetaOffset(Int val)    {m_loopFilterBetaOffsetDiv2 = val; }    //!< set beta offset for deblocking filter
917  Int       getLoopFilterBetaOffset()           {return m_loopFilterBetaOffsetDiv2; }   //!< get beta offset for deblocking filter
918  Void      setLoopFilterTcOffset(Int val)      {m_loopFilterTcOffsetDiv2 = val; }      //!< set tc offset for deblocking filter
919  Int       getLoopFilterTcOffset()             {return m_loopFilterTcOffsetDiv2; }     //!< get tc offset for deblocking filter
920
921  Void      createScalingList();
922  Void      destroyScalingList();
923  Void      setScalingListEnabled (Bool bVal) { m_scalingListEnabled = bVal; }  //!< set ScalingList enabled/disabled in APS
924  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
925  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
926  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
927  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
928
929private:
930  Int         m_apsID;        //!< APS ID
931  Bool        m_bSaoEnabled;  //!< SAO enabled/disabled in APS (true for enabled)
932  Bool        m_bAlfEnabled;  //!< ALF enabled/disabled in APS (true for enabled)
933  SAOParam*   m_pSaoParam;    //!< SAO parameter object pointer
934  AlfParamSet*   m_alfParamSet;
935  Bool        m_loopFilterOffsetInAPS;       //< offset for deblocking filter in 0 = slice header, 1 = APS
936  Bool        m_loopFilterDisable;           //< Deblocking filter enabled/disabled in APS
937  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
938  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
939  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
940  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
941  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
942
943public:
944  TComAPS& operator= (const TComAPS& src);  //!< "=" operator for APS object
945};
946
947typedef struct {
948  // Explicit weighted prediction parameters parsed in slice header,
949  // or Implicit weighted prediction parameters (8 bits depth values).
950  Bool        bPresentFlag;
951  UInt        uiLog2WeightDenom;
952  Int         iWeight;
953  Int         iOffset;
954
955  // Weighted prediction scaling values built from above parameters (bitdepth scaled):
956  Int         w, o, offset, shift, round;
957} wpScalingParam;
958
959typedef struct {
960  Int64 iAC;
961  Int64 iDC;
962} wpACDCParam;
963
964/// slice header class
965class TComSlice
966{
967 
968private:
969  //  Bitstream writing
970  Int         m_iAPSId; //!< APS ID in slice header
971  bool       m_alfEnabledFlag;
972  bool       m_saoEnabledFlag;
973  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
974  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
975  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
976  Int         m_iPPSId;               ///< picture parameter set ID
977  Bool        m_PicOutputFlag;        ///< pic_output_flag
978  Int         m_iPOC;
979  Int         m_iLastIDR;
980  static Int  m_prevPOC;
981  TComReferencePictureSet *m_pcRPS;
982  TComReferencePictureSet m_LocalRPS;
983  Int         m_iBDidx; 
984  Int         m_iCombinationBDidx;
985  Bool        m_bCombineWithReferenceFlag;
986  TComRefPicListModification m_RefPicListModification;
987  NalUnitType m_eNalUnitType;            ///< Nal unit type for the slice
988  NalUnitType m_eNalUnitTypeBaseViewMvc; ///< Nal unit type of the base view slice for multiview coding
989  SliceType   m_eSliceType;
990  Int         m_iSliceQp;
991#if ADAPTIVE_QP_SELECTION
992  Int         m_iSliceQpBase;
993#endif
994  Bool        m_bLoopFilterDisable;
995  Bool        m_loopFilterOffsetInAPS;
996  Bool        m_inheritDblParamFromAPS;      //< offsets for deblocking filter inherit from APS
997  Int         m_loopFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
998  Int         m_loopFilterTcOffsetDiv2;      //< tc offset for deblocking filter
999 
1000  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
1001
1002  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
1003  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
1004  Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
1005  Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
1006  Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
1007  Bool        m_bRefPicListModificationFlagLC;
1008  Bool        m_bRefPicListCombinationFlag;
1009
1010  Bool        m_bCheckLDC;
1011#if QC_TMVP_MRG_REFIDX_C0047
1012  Int         m_aiNewRefIdx    [2]; 
1013#endif
1014
1015  //  Data
1016  Int         m_iSliceQpDelta;
1017  TComPic*    m_apcRefPicList  [2][MAX_NUM_REF+1];
1018  Int         m_aiRefPOCList   [2][MAX_NUM_REF+1];
1019  Int         m_aiRefViewIdList[2][MAX_NUM_REF+1];
1020  TComPic*    m_pcTexturePic;
1021  Int         m_iDepth;
1022 
1023  // referenced slice?
1024  Bool        m_bRefenced;
1025 
1026  // access channel
1027#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1028  TComVPS*    m_pcVPS;
1029#endif
1030#if QC_IV_AS_LT_B0046
1031  Bool        m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
1032#endif
1033  TComSPS*    m_pcSPS;
1034  TComPPS*    m_pcPPS;
1035  TComPic*    m_pcPic;
1036#if ADAPTIVE_QP_SELECTION
1037  TComTrQuant* m_pcTrQuant;
1038#endif 
1039  TComAPS*    m_pcAPS;  //!< pointer to APS parameter object
1040
1041  UInt        m_uiColDir;  // direction to get colocated CUs
1042 
1043#if COLLOCATED_REF_IDX
1044  UInt        m_colRefIdx;
1045#endif
1046
1047#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA
1048  Double      m_dLambdaLuma;
1049  Double      m_dLambdaChroma;
1050#else
1051  Double      m_dLambda;
1052#endif
1053
1054  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
1055 
1056  Bool        m_bNoBackPredFlag;
1057  Bool        m_bRefIdxCombineCoding;
1058
1059  UInt        m_uiTLayer;
1060  Bool        m_bTLayerSwitchingFlag;
1061
1062  UInt        m_uiSliceMode;
1063  UInt        m_uiSliceArgument;
1064  UInt        m_uiSliceCurStartCUAddr;
1065  UInt        m_uiSliceCurEndCUAddr;
1066  UInt        m_uiSliceIdx;
1067  UInt        m_uiEntropySliceMode;
1068  UInt        m_uiEntropySliceArgument;
1069  UInt        m_uiEntropySliceCurStartCUAddr;
1070  UInt        m_uiEntropySliceCurEndCUAddr;
1071  Bool        m_bNextSlice;
1072  Bool        m_bNextEntropySlice;
1073  UInt        m_uiSliceBits;
1074  UInt        m_uiEntropySliceCounter;
1075  Bool        m_bFinalized;
1076
1077  wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
1078  wpACDCParam    m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
1079  wpScalingParam  m_weightPredTableLC[2*MAX_NUM_REF][3]; // [refIdxLC][0:Y, 1:U, 2:V]
1080
1081  UInt        *m_uiTileByteLocation;
1082  UInt        m_uiTileCount;
1083  Int         m_iTileMarkerFlag;
1084  UInt        m_uiTileOffstForMultES;
1085
1086  UInt*       m_puiSubstreamSizes;
1087  TComScalingList*     m_scalingList;                 //!< pointer of quantization matrix
1088#if CABAC_INIT_FLAG
1089  Bool        m_cabacInitFlag; 
1090#else
1091  Int         m_cabacInitIdc; 
1092#endif
1093
1094  Bool       m_bLMvdL1Zero;
1095  Int         m_numEntryPointOffsets;
1096
1097  Int        m_viewId;
1098  Bool       m_isDepth;
1099  Int        m_aaiCodedScale [2][MAX_VIEW_NUM];
1100  Int        m_aaiCodedOffset[2][MAX_VIEW_NUM];
1101
1102#if LGE_ILLUCOMP_B0045
1103  Bool        m_bApplyIC;
1104#endif
1105#if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
1106  Bool       m_bIVScalingFlag;
1107  Int        m_iViewOrderIdx;    // will be changed to view_id
1108#endif
1109
1110#if MERL_VSP_C0152
1111  TComPic*     m_apcRefPicBaseTxt;
1112  TComPic*     m_apcRefPicBaseDepth;
1113  Int*         m_aiShiftLUT;
1114  Int          m_iShiftPrec;
1115#endif
1116
1117public:
1118  TComSlice();
1119  virtual ~TComSlice();
1120 
1121  Void      initSlice       ();
1122  Void      initTiles();
1123
1124#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1125  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
1126  TComVPS*  getVPS          () { return m_pcVPS; }
1127#endif
1128#if QC_IV_AS_LT_B0046
1129  Void          setWasLongTerm( Bool lt,  RefPicList e, Int iRefIdx ) { m_bWasLongTerm[e][iRefIdx] = lt; }
1130  Bool          getWasLongTerm( RefPicList e, Int iRefIdx           ) { return m_bWasLongTerm[e][iRefIdx] ; }
1131#endif
1132
1133  Void      setSPS          ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
1134  TComSPS*  getSPS          () { return m_pcSPS; }
1135 
1136  Void      setPPS          ( TComPPS* pcPPS )         { assert(pcPPS!=NULL); m_pcPPS = pcPPS; m_iPPSId = pcPPS->getPPSId(); }
1137  TComPPS*  getPPS          () { return m_pcPPS; }
1138
1139#if ADAPTIVE_QP_SELECTION
1140  Void          setTrQuant          ( TComTrQuant* pcTrQuant ) { m_pcTrQuant = pcTrQuant; }
1141  TComTrQuant*  getTrQuant          () { return m_pcTrQuant; }
1142#endif
1143
1144  Void      setPPSId        ( Int PPSId )         { m_iPPSId = PPSId; }
1145  Int       getPPSId        () { return m_iPPSId; }
1146  Void      setAPS          ( TComAPS* pcAPS ) { m_pcAPS = pcAPS; } //!< set APS pointer
1147  TComAPS*  getAPS          ()                 { return m_pcAPS;  } //!< get APS pointer
1148  Void      setAPSId        ( Int Id)          { m_iAPSId =Id;    } //!< set APS ID
1149  Int       getAPSId        ()                 { return m_iAPSId; } //!< get APS ID
1150  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
1151  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
1152  Void      setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; }
1153  Bool      getAlfEnabledFlag() { return m_alfEnabledFlag; }
1154  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
1155  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
1156  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
1157  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
1158  Void      setSaoEnabledFlagCb(Bool s) {m_saoEnabledFlagCb =s; }       //!< set SAO Cb enabled flag
1159  Bool      getSaoEnabledFlagCb() { return m_saoEnabledFlagCb; }        //!< get SAO Cb enabled flag
1160  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
1161  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
1162  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
1163  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
1164  TComReferencePictureSet*  getLocalRPS     () { return &m_LocalRPS; }
1165
1166  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
1167  Int       getRPSidx          () { return m_iBDidx; }
1168  Void      setCombinationBDidx          ( Int iCombinationBDidx ) { m_iCombinationBDidx = iCombinationBDidx; }
1169  Int       getCombinationBDidx          () { return m_iCombinationBDidx; }
1170  Void      setCombineWithReferenceFlag          ( Bool bCombineWithReferenceFlag ) { m_bCombineWithReferenceFlag = bCombineWithReferenceFlag; }
1171  Bool      getCombineWithReferenceFlag          () { return m_bCombineWithReferenceFlag; }
1172  Int       getPrevPOC      ()                          { return  m_prevPOC;       }
1173
1174  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
1175  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
1176  Int       getLastIDR()                                  { return m_iLastIDR; }
1177  SliceType getSliceType    ()                          { return  m_eSliceType;         }
1178  Int       getPOC          ()                          { return  m_iPOC;           }
1179  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
1180#if ADAPTIVE_QP_SELECTION
1181  Int       getSliceQpBase  ()                          { return  m_iSliceQpBase;       }
1182#endif
1183  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
1184  Bool      getLoopFilterDisable()                      { return  m_bLoopFilterDisable; }
1185  Bool      getLoopFilterOffsetInAPS()                  { return  m_loopFilterOffsetInAPS;}
1186  Bool      getInheritDblParamFromAPS()                 { return  m_inheritDblParamFromAPS; }
1187  Int       getLoopFilterBetaOffset()                   { return  m_loopFilterBetaOffsetDiv2; }
1188  Int       getLoopFilterTcOffset()                     { return  m_loopFilterTcOffsetDiv2; }
1189
1190  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
1191  TComPic*  getPic              ()                              { return  m_pcPic;                      }
1192  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
1193  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
1194  Int       getRefViewId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefViewIdList[e][iRefIdx]; }
1195  TComPic*  getTexturePic       () const                        { return  m_pcTexturePic; }
1196  Int       getDepth            ()                              { return  m_iDepth;                     }
1197  UInt      getColDir           ()                              { return  m_uiColDir;                   }
1198#if COLLOCATED_REF_IDX
1199  Bool      getColRefIdx        ()                              { return  m_colRefIdx;                  }
1200  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
1201#endif
1202  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
1203  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
1204  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
1205  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
1206  Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
1207  Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
1208  Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
1209  Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
1210  Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
1211  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
1212  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}     
1213  Void      setListIdFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_eListIdFromIdxOfLC[iRefIdx]=uiVal; }
1214  Void      setRefIdxFromIdxOfLC(Int  iRefIdx, UInt uiVal)      { m_iRefIdxFromIdxOfLC[iRefIdx]=uiVal; }
1215  Void      setRefIdxOfLC       (RefPicList e, Int iRefIdx, Int RefIdxLC)     { m_iRefIdxOfLC[e][iRefIdx]=RefIdxLC;}
1216
1217  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
1218  Bool      isReferenced()                                      { return m_bRefenced; }
1219 
1220  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
1221  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
1222  NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
1223  Void      setNalUnitTypeBaseViewMvc  ( NalUnitType e )        { m_eNalUnitTypeBaseViewMvc = e;    }
1224  NalUnitType getNalUnitTypeBaseViewMvc()                       { return m_eNalUnitTypeBaseViewMvc; }
1225  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic);
1226  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
1227  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
1228  Void      setSliceQp          ( Int i )                       { m_iSliceQp          = i;      }
1229#if ADAPTIVE_QP_SELECTION
1230  Void      setSliceQpBase      ( Int i )                       { m_iSliceQpBase      = i;      }
1231#endif
1232  Void      setSliceQpDelta     ( Int i )                       { m_iSliceQpDelta     = i;      }
1233  Void      setLoopFilterDisable( Bool b )                      { m_bLoopFilterDisable= b;      }
1234  Void      setLoopFilterOffsetInAPS( Bool b )                  { m_loopFilterOffsetInAPS = b;}
1235  Void      setInheritDblParamFromAPS( Bool b )                 { m_inheritDblParamFromAPS = b; }
1236  Void      setLoopFilterBetaOffset( Int i )                    { m_loopFilterBetaOffsetDiv2 = i; }
1237  Void      setLoopFilterTcOffset( Int i )                      { m_loopFilterTcOffsetDiv2 = i; }
1238 
1239  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
1240  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
1241  Void      setRefViewId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewIdList[e][iRefIdx] = i; }
1242  Void      setTexturePic       ( TComPic *pcTexturePic )       { m_pcTexturePic = pcTexturePic; }
1243  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
1244  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
1245  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
1246 
1247  Int       getNumPocTotalCurr();
1248  Int       getNumPocTotalCurrMvc();
1249  Void      setRefPicListMvc    ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics );
1250  Void      setRefPOCnViewListsMvc();
1251
1252  Void      setColDir           ( UInt uiDir ) { m_uiColDir = uiDir; }
1253#if COLLOCATED_REF_IDX
1254  Void      setColRefIdx        ( UInt refIdx) { m_colRefIdx = refIdx; }
1255#endif
1256  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
1257  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
1258
1259  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
1260  Bool      isInterB        ()                          { return  m_eSliceType == B_SLICE;  }
1261  Bool      isInterP        ()                          { return  m_eSliceType == P_SLICE;  }
1262 
1263#if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 
1264  Void      setLambda( Double d, Double e ) { m_dLambdaLuma = d; m_dLambdaChroma = e;}
1265  Double    getLambdaLuma() { return m_dLambdaLuma;        }
1266  Double    getLambdaChroma() { return m_dLambdaChroma;        }
1267#else
1268  Void      setLambda( Double d ) { m_dLambda = d; }
1269  Double    getLambda() { return m_dLambda;        }
1270#endif
1271 
1272  Void      initEqualRef();
1273  Bool      isEqualRef  ( RefPicList e, Int iRefIdx1, Int iRefIdx2 )
1274  {
1275    if (iRefIdx1 < 0 || iRefIdx2 < 0) return false;
1276    return m_abEqualRef[e][iRefIdx1][iRefIdx2];
1277  }
1278 
1279  Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b)
1280  {
1281    m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
1282  }
1283 
1284  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
1285 
1286  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
1287  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
1288  Bool getRefIdxCombineCoding() { return m_bRefIdxCombineCoding; }
1289  Void setRefIdxCombineCoding( Bool b ) { m_bRefIdxCombineCoding = b; }
1290  Void generateCombinedList       ();
1291
1292  UInt getTLayer             ()                            { return m_uiTLayer;                      }
1293  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
1294
1295
1296  Void setTLayerInfo( UInt uiTLayer );
1297  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 
1298  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1299#if H0566_TLA_SET_FOR_SWITCHING_POINTS
1300  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
1301#endif
1302  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0);
1303  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
1304
1305  Void decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC );
1306
1307  UInt m_uiMaxNumMergeCand;
1308  Void setMaxNumMergeCand               (UInt maxNumMergeCand ) { m_uiMaxNumMergeCand = maxNumMergeCand;  }
1309  UInt getMaxNumMergeCand               ()                  {return m_uiMaxNumMergeCand;                  }
1310
1311  Void setSliceMode                     ( UInt uiMode )     { m_uiSliceMode = uiMode;                     }
1312  UInt getSliceMode                     ()                  { return m_uiSliceMode;                       }
1313  Void setSliceArgument                 ( UInt uiArgument ) { m_uiSliceArgument = uiArgument;             }
1314  UInt getSliceArgument                 ()                  { return m_uiSliceArgument;                   }
1315  Void setSliceCurStartCUAddr           ( UInt uiAddr )     { m_uiSliceCurStartCUAddr = uiAddr;           }
1316  UInt getSliceCurStartCUAddr           ()                  { return m_uiSliceCurStartCUAddr;             }
1317  Void setSliceCurEndCUAddr             ( UInt uiAddr )     { m_uiSliceCurEndCUAddr = uiAddr;             }
1318  UInt getSliceCurEndCUAddr             ()                  { return m_uiSliceCurEndCUAddr;               }
1319  Void setSliceIdx                      ( UInt i)           { m_uiSliceIdx = i;                           }
1320  UInt getSliceIdx                      ()                  { return  m_uiSliceIdx;                       }
1321  Void copySliceInfo                    (TComSlice *pcSliceSrc);
1322  Void setEntropySliceMode              ( UInt uiMode )     { m_uiEntropySliceMode = uiMode;              }
1323  UInt getEntropySliceMode              ()                  { return m_uiEntropySliceMode;                }
1324  Void setEntropySliceArgument          ( UInt uiArgument ) { m_uiEntropySliceArgument = uiArgument;      }
1325  UInt getEntropySliceArgument          ()                  { return m_uiEntropySliceArgument;            }
1326  Void setEntropySliceCurStartCUAddr    ( UInt uiAddr )     { m_uiEntropySliceCurStartCUAddr = uiAddr;    }
1327  UInt getEntropySliceCurStartCUAddr    ()                  { return m_uiEntropySliceCurStartCUAddr;      }
1328  Void setEntropySliceCurEndCUAddr      ( UInt uiAddr )     { m_uiEntropySliceCurEndCUAddr = uiAddr;      }
1329  UInt getEntropySliceCurEndCUAddr      ()                  { return m_uiEntropySliceCurEndCUAddr;        }
1330  Void setNextSlice                     ( Bool b )          { m_bNextSlice = b;                           }
1331  Bool isNextSlice                      ()                  { return m_bNextSlice;                        }
1332  Void setNextEntropySlice              ( Bool b )          { m_bNextEntropySlice = b;                    }
1333  Bool isNextEntropySlice               ()                  { return m_bNextEntropySlice;                 }
1334  Void setSliceBits                     ( UInt uiVal )      { m_uiSliceBits = uiVal;                      }
1335  UInt getSliceBits                     ()                  { return m_uiSliceBits;                       } 
1336  Void setEntropySliceCounter           ( UInt uiVal )      { m_uiEntropySliceCounter = uiVal;            }
1337  UInt getEntropySliceCounter           ()                  { return m_uiEntropySliceCounter;             }
1338  Void setFinalized                     ( Bool uiVal )      { m_bFinalized = uiVal;                       }
1339  Bool getFinalized                     ()                  { return m_bFinalized;                        }
1340  Void  setWpScaling    ( wpScalingParam  wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); }
1341  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
1342
1343  Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1344  Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
1345  Void  initWpScaling   ();
1346  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPredIdc()) ); }
1347 
1348  Void  setWpAcDcParam  ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); }
1349  Void  getWpAcDcParam  ( wpACDCParam *&wp );
1350  Void  initWpAcDcParam ();
1351  Void  copyWPtable     (wpScalingParam *&wp_src, wpScalingParam *&wp_dst);
1352  Void  getWpScalingLC  ( Int iRefIdx, wpScalingParam *&wp);
1353  Void  resetWpScalingLC(wpScalingParam  wp[2*MAX_NUM_REF][3]);
1354  Void  setWpParamforLC();
1355  Void setTileLocationCount             ( UInt uiCount )      { m_uiTileCount = uiCount;                  }
1356  UInt getTileLocationCount             ()                    { return m_uiTileCount;                     }
1357  Void setTileLocation                  ( Int i, UInt uiLOC ) { m_uiTileByteLocation[i] = uiLOC;          }
1358  UInt getTileLocation                  ( Int i )             { return m_uiTileByteLocation[i];           }
1359  Void setTileMarkerFlag                ( Int iFlag )         { m_iTileMarkerFlag = iFlag;                }
1360  Int  getTileMarkerFlag                ()                    { return m_iTileMarkerFlag;                 }
1361  Void setTileOffstForMultES            (UInt uiOffset )      { m_uiTileOffstForMultES = uiOffset;        }
1362  UInt getTileOffstForMultES            ()                    { return m_uiTileOffstForMultES;            }
1363  Void allocSubstreamSizes              ( UInt uiNumSubstreams );
1364  UInt* getSubstreamSizes               ()                  { return m_puiSubstreamSizes; }
1365  Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
1366  TComScalingList*   getScalingList ()                               { return m_scalingList; }
1367  Void  setDefaultScalingList       ();
1368  Bool  checkDefaultScalingList     ();
1369#if CABAC_INIT_FLAG
1370  Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag
1371  Bool      getCabacInitFlag  ()           { return m_cabacInitFlag;     }  //!< get CABAC initial flag
1372#else
1373  Void      setCABACinitIDC(Int iVal) {m_cabacInitIdc = iVal;    }  //!< set CABAC initial IDC number
1374  Int       getCABACinitIDC()         {return m_cabacInitIdc;    }  //!< get CABAC initial IDC number
1375#endif
1376  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
1377  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
1378
1379  Void setViewId( Int viewId )       { m_viewId = viewId;   }
1380  Int  getViewId()                   { return m_viewId;     }
1381#if QC_MVHEVC_B0046
1382  Void    setViewOrderIdx(Int v, UInt layer)                { m_iViewOrderIdx = v;    }
1383  Int     getViewOrderIdx()                                 { return m_iViewOrderIdx; }
1384#endif
1385  Void setIsDepth( Bool isDepth )    { m_isDepth = isDepth; }
1386  Bool getIsDepth()                  { return m_isDepth;    }
1387 
1388  Void      initMultiviewSlice    ( Int** aaiScale = 0, Int** aaiOffset = 0 );
1389
1390  Int*      getCodedScale         ()  { return m_aaiCodedScale [0]; }
1391  Int*      getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
1392  Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
1393  Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
1394
1395#if LGE_ILLUCOMP_B0045
1396  Void      setApplyIC            ( Bool b ) { m_bApplyIC = b; }
1397  Bool      getApplyIC            ()  { return m_bApplyIC; }
1398  Void      xSetApplyIC           ();
1399#endif
1400#if QC_TMVP_MRG_REFIDX_C0047
1401  Int       getNewRefIdx        ( RefPicList e )                { return  m_aiNewRefIdx[e];     }
1402  Void      setNewRefIdx        ( RefPicList e, Int i )         { m_aiNewRefIdx[e]    = i;      }
1403#endif
1404#if INTER_VIEW_VECTOR_SCALING_C0115
1405  Void setIVScalingFlag( Bool val )         { m_bIVScalingFlag = val;     }
1406  Bool getIVScalingFlag()                   { return m_bIVScalingFlag;    }
1407  Void setViewOrderIdx     ( Int i )        { m_iViewOrderIdx     = i;    }   // will be changed to view_id
1408  Int  getViewOrderIdx     ()               { return  m_iViewOrderIdx;    }   // will be changed to view_id
1409#endif
1410
1411#if MERL_VSP_C0152
1412  TComPic*     getRefPicBaseTxt          ()                        { return  m_apcRefPicBaseTxt; }
1413  Void         setRefPicBaseTxt          ( TComPic* RefPic)        { m_apcRefPicBaseTxt = RefPic; }
1414  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
1415  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
1416
1417  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
1418  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
1419#endif
1420
1421protected:
1422  TComPic*  xGetRefPic        (TComList<TComPic*>& rcListPic, UInt uiPOC);
1423  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, UInt uiPOC);
1424  TComPic*  xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId );
1425};// END CLASS DEFINITION TComSlice
1426
1427
1428template <class T> class ParameterSetMap
1429{
1430public:
1431  ParameterSetMap(Int maxId)
1432  :m_maxId (maxId)
1433  {}
1434
1435  ~ParameterSetMap()
1436  {
1437    for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
1438    {
1439      delete (*i).second;
1440    }
1441  }
1442
1443  Void storePS(Int psId, T *ps)
1444  {
1445    assert ( psId < m_maxId );
1446    if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
1447    {
1448      delete m_paramsetMap[psId];
1449    }
1450    m_paramsetMap[psId] = ps; 
1451  }
1452
1453  Void mergePSList(ParameterSetMap<T> &rPsList)
1454  {
1455    for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++)
1456    {
1457      storePS(i->first, i->second);
1458    }
1459    rPsList.m_paramsetMap.clear();
1460  }
1461
1462
1463  T* getPS(Int psId)
1464  {
1465    return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId];
1466  }
1467
1468  T* getFirstPS()
1469  {
1470    return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second;
1471  }
1472
1473#if QC_MVHEVC_B0046
1474  Void clearPSList()
1475  {
1476    m_paramsetMap.clear();
1477  }
1478#endif
1479private:
1480  std::map<Int,T *> m_paramsetMap;
1481  Int               m_maxId;
1482};
1483
1484class ParameterSetManager
1485{
1486public:
1487  ParameterSetManager();
1488  virtual ~ParameterSetManager();
1489#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1490  //! store video parameter set and take ownership of it
1491  Void storeVPS(TComVPS *vps) { m_vpsMap.storePS( vps->getVPSId(), vps); };
1492  //! get pointer to existing video parameter set 
1493  TComVPS* getVPS(Int vpsId)  { return m_vpsMap.getPS(vpsId); };
1494  TComVPS* getFirstVPS()      { return m_vpsMap.getFirstPS(); };
1495#if QC_MVHEVC_B0046
1496  Void     clearVPS()         { m_vpsMap.clearPSList(); };
1497  Void     clearSPS()         { m_spsMap.clearPSList(); };
1498  Void     clearPPS()         { m_ppsMap.clearPSList(); };
1499#endif
1500#endif
1501  //! store sequence parameter set and take ownership of it
1502  Void storeSPS(TComSPS *sps) { m_spsMap.storePS( sps->getSPSId(), sps); };
1503  //! get pointer to existing sequence parameter set 
1504  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
1505  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
1506
1507  //! store picture parameter set and take ownership of it
1508  Void storePPS(TComPPS *pps) { m_ppsMap.storePS( pps->getPPSId(), pps); };
1509  //! get pointer to existing picture parameter set 
1510  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
1511  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
1512
1513  //! store adaptation parameter set and take ownership of it
1514  Void storeAPS(TComAPS *aps) { m_apsMap.storePS( aps->getAPSID(), aps); };
1515  //! getPointer to existing adaptation parameter set 
1516  TComAPS* getAPS(Int apsId)  { return m_apsMap.getPS(apsId); };
1517
1518protected:
1519  ParameterSetMap<TComSPS> m_spsMap; 
1520  ParameterSetMap<TComPPS> m_ppsMap; 
1521  ParameterSetMap<TComAPS> m_apsMap; 
1522#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
1523  ParameterSetMap<TComVPS> m_vpsMap; 
1524#endif
1525};
1526
1527//! \}
1528
1529#endif // __TCOMSLICE__
Note: See TracBrowser for help on using the repository browser.