source: SHVCSoftware/branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h @ 652

Last change on this file since 652 was 652, checked in by seregin, 11 years ago

update to HM-14.0

  • Property svn:eol-style set to native
File size: 12.2 KB
RevLine 
[313]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 *
[595]6 * Copyright (c) 2010-2014, ITU/ISO/IEC
[313]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     TDecTop.h
35    \brief    decoder class (header)
36*/
37
38#ifndef __TDECTOP__
39#define __TDECTOP__
40
41#include "TLibCommon/CommonDef.h"
42#include "TLibCommon/TComList.h"
43#include "TLibCommon/TComPicYuv.h"
44#include "TLibCommon/TComPic.h"
45#include "TLibCommon/TComTrQuant.h"
46#include "TLibCommon/SEI.h"
47
48#include "TDecGop.h"
49#include "TDecEntropy.h"
50#include "TDecSbac.h"
51#include "TDecCAVLC.h"
52#include "SEIread.h"
53
54struct InputNALUnit;
55
56//! \ingroup TLibDecoder
57//! \{
58
59// ====================================================================================================================
60// Class definition
61// ====================================================================================================================
62
63/// decoder class
64class TDecTop
65{
66private:
67  Int                     m_iMaxRefPicNum;
68 
[442]69  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
[313]70  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
71  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
72
73  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
74  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
75  TComSlice*              m_apcSlicePilot;
[442]76
[313]77  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
78
79  // functional classes
80  TComPrediction          m_cPrediction;
81  TComTrQuant             m_cTrQuant;
82  TDecGop                 m_cGopDecoder;
83  TDecSlice               m_cSliceDecoder;
84  TDecCu                  m_cCuDecoder;
85  TDecEntropy             m_cEntropyDecoder;
86  TDecCavlc               m_cCavlcDecoder;
87  TDecSbac                m_cSbacDecoder;
88  TDecBinCABAC            m_cBinCABAC;
89  SEIReader               m_seiReader;
90  TComLoopFilter          m_cLoopFilter;
91  TComSampleAdaptiveOffset m_cSAO;
92
93  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
94  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
95  TComPic*                m_pcPic;
96  UInt                    m_uiSliceIdx;
97#if !SVC_EXTENSION
98  Int                     m_prevPOC;
99#endif
100  Bool                    m_bFirstSliceInPicture;
101#if !SVC_EXTENSION
102  Bool                    m_bFirstSliceInSequence;
103#endif
[442]104  Bool                    m_prevSliceSkipped;
105  Int                     m_skippedPOC;
[652]106#if SETTING_NO_OUT_PIC_PRIOR 
107  Bool                    m_bFirstSliceInBitstream;
108  Int                     m_lastPOCNoOutputPriorPics;
109  Bool                    m_isNoOutputPriorPics;
110  Bool                    m_craNoRaslOutputFlag;    //value of variable NoRaslOutputFlag of the last CRA pic
111#endif
[313]112
113#if SVC_EXTENSION
114  static UInt             m_prevPOC;        // POC of the previous slice
115  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
116  static Bool             m_bFirstSliceInSequence;
117  UInt                    m_layerId;     
118  UInt                    m_numLayer;
119  TDecTop**               m_ppcTDecTop;
120#if AVC_BASE
121  fstream*                m_pBLReconFile;
122  Int                     m_iBLSourceWidth;
[442]123  Int                     m_iBLSourceHeight; 
[313]124#endif
[588]125#if VPS_EXTN_DIRECT_REF_LAYERS
[313]126  Int                     m_numDirectRefLayers;
127  Int                     m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
128  Int                     m_numSamplePredRefLayers;
129  Int                     m_samplePredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
130  Int                     m_numMotionPredRefLayers;
131  Int                     m_motionPredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
132  Bool                    m_samplePredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
133  Bool                    m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
134#endif
[442]135  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
[313]136#endif
[540]137#if OUTPUT_LAYER_SET_INDEX
138  CommonDecoderParams*    m_commonDecoderParams;
139#endif
[313]140#if AVC_SYNTAX || SYNTAX_OUTPUT
141  fstream*               m_pBLSyntaxFile;
142#endif
143
[652]144#if NO_CLRAS_OUTPUT_FLAG 
[540]145  Bool                    m_layerInitializedFlag;
146  Bool                    m_firstPicInLayerDecodedFlag;
[652]147  Bool                    m_bRefreshPending;
[540]148#endif
[588]149#if RESOLUTION_BASED_DPB
[652]150  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
151                                           // When new VPS is activated, this should be re-initialized to -1
[588]152#endif
[313]153public:
154  TDecTop();
155  virtual ~TDecTop();
156 
157  Void  create  ();
158  Void  destroy ();
159
160  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
161
162  Void  init();
163#if SVC_EXTENSION
164  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
165#else
166  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
167#endif
168 
169  Void  deletePicBuffer();
170
[652]171 
172  TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
173
174
[313]175  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
[652]176#if SETTING_NO_OUT_PIC_PRIOR 
177  Void  checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic);
178  Bool  getNoOutputPriorPicsFlag ()         { return m_isNoOutputPriorPics; }
179  Void  setNoOutputPriorPicsFlag (Bool val) { m_isNoOutputPriorPics = val; }
180#endif
181
[313]182#if SVC_EXTENSION
[442]183#if EARLY_REF_PIC_MARKING
184  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
185#endif
[313]186  UInt      getLayerId            () { return m_layerId;              }
187  Void      setLayerId            (UInt layer) { m_layerId = layer; }
188  UInt      getNumLayer           () { return m_numLayer;             }
189  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
190  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
191  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
192  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
193#if VPS_EXTN_DIRECT_REF_LAYERS
194  TDecTop*  getRefLayerDec(UInt refLayerIdc);
195  Int       getNumDirectRefLayers           ()                              { return m_numDirectRefLayers;      }
196  Void      setNumDirectRefLayers           (Int num)                       { m_numDirectRefLayers = num;       }
197
198  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
199  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
200
201  Int       getNumSamplePredRefLayers       ()                              { return m_numSamplePredRefLayers;  }
202  Void      setNumSamplePredRefLayers       (Int num)                       { m_numSamplePredRefLayers = num;   }
203
204  Int       getSamplePredRefLayerId         (Int i)                         { return m_samplePredRefLayerId[i];       }
205  Void      setSamplePredRefLayerId         (Int i, Int refLayerId)         { m_samplePredRefLayerId[i] = refLayerId; }
206
207  Int       getNumMotionPredRefLayers       ()                              { return m_numMotionPredRefLayers;  }
208  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
209
210  Int       getMotionPredRefLayerId         (Int i)                         { return m_motionPredRefLayerId[i];       }
211  Void      setMotionPredRefLayerId         (Int i, Int refLayerId)         { m_motionPredRefLayerId[i] = refLayerId; }
212
213  Bool      getSamplePredEnabledFlag        (Int i)                         { return m_samplePredEnabledFlag[i];  }
214  Void      setSamplePredEnabledFlag        (Int i,Bool flag)               { m_samplePredEnabledFlag[i] = flag;  }
215
216  Bool      getMotionPredEnabledFlag        (Int i)                         { return m_motionPredEnabledFlag[i];  }
217  Void      setMotionPredEnabledFlag        (Int i,Bool flag)               { m_motionPredEnabledFlag[i] = flag;  }
218
219  TDecTop*  getSamplePredRefLayerDec        ( UInt layerId );
220  TDecTop*  getMotionPredRefLayerDec        ( UInt layerId );
221
222  Void      setRefLayerParams( TComVPS* vps );
223#endif
224#if AVC_BASE
225  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
226  fstream*  getBLReconFile() { return m_pBLReconFile; }
227  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
228  Int       getBLWidth() { return  m_iBLSourceWidth; }
229  Int       getBLHeight() { return  m_iBLSourceHeight; }
230#endif
[442]231#if REPN_FORMAT_IN_VPS
232  Void      xInitILRP(TComSlice *slice);
233#else
234  Void      xInitILRP(TComSPS *pcSPS);
[313]235#endif
[595]236#if OUTPUT_LAYER_SET_INDEX
237  CommonDecoderParams*    getCommonDecoderParams() { return m_commonDecoderParams; }
238  Void                    setCommonDecoderParams(CommonDecoderParams* x) { m_commonDecoderParams = x; }
239  Void      checkValueOfTargetOutputLayerSetIdx(TComVPS *vps);
[442]240#endif
[595]241#if SCALINGLIST_INFERRING
242  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
243#endif
244#if RESOLUTION_BASED_DPB
245  Void setSubDpbIdx(Int idx)    { m_subDpbIdx = idx; }
246  Int  getSubDpbIdx()           { return m_subDpbIdx; }
247  Void assignSubDpbs(TComVPS *vps);
248#endif
249#endif //SVC_EXTENSION
[313]250#if AVC_SYNTAX || SYNTAX_OUTPUT
251  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
252  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
253#endif
254protected:
255  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
256  Void  xCreateLostPicture (Int iLostPOC);
257
258  Void      xActivateParameterSets();
259#if SVC_EXTENSION
[442]260#if POC_RESET_FLAG
261  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
262#else
[313]263  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
[442]264#endif
[313]265#else
266  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
267#endif
268  Void      xDecodeVPS();
269  Void      xDecodeSPS();
270  Void      xDecodePPS();
271  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
272
[540]273#if NO_CLRAS_OUTPUT_FLAG
[652]274  Int  getNoClrasOutputFlag()                { return m_craNoRaslOutputFlag;}
275  Void setNoClrasOutputFlag(Bool x)          { m_craNoRaslOutputFlag = x;   }
[540]276  Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
277  Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
278  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
279  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
280#endif
[313]281};// END CLASS DEFINITION TDecTop
282
283
284//! \}
285
286#endif // __TDECTOP__
287
Note: See TracBrowser for help on using the repository browser.