source: SHVCSoftware/branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.h @ 1439

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

update to HM-13.0

  • Property svn:eol-style set to native
File size: 11.9 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 *
[593]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;
[313]106
107#if SVC_EXTENSION
108  static UInt             m_prevPOC;        // POC of the previous slice
109  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
110  static Bool             m_bFirstSliceInSequence;
111  UInt                    m_layerId;     
112  UInt                    m_numLayer;
113  TDecTop**               m_ppcTDecTop;
114#if AVC_BASE
115  fstream*                m_pBLReconFile;
116  Int                     m_iBLSourceWidth;
[442]117  Int                     m_iBLSourceHeight; 
[313]118#endif
[560]119#if VPS_EXTN_DIRECT_REF_LAYERS
[313]120  Int                     m_numDirectRefLayers;
121  Int                     m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
122  Int                     m_numSamplePredRefLayers;
123  Int                     m_samplePredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
124  Int                     m_numMotionPredRefLayers;
125  Int                     m_motionPredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
126  Bool                    m_samplePredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
127  Bool                    m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
128#endif
[442]129  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
[313]130#endif
[540]131#if OUTPUT_LAYER_SET_INDEX
132  CommonDecoderParams*    m_commonDecoderParams;
133#endif
[313]134#if AVC_SYNTAX || SYNTAX_OUTPUT
135  fstream*               m_pBLSyntaxFile;
136#endif
137
[540]138#if NO_CLRAS_OUTPUT_FLAG
139  Bool                    m_noClrasOutputFlag;
140  Bool                    m_layerInitializedFlag;
141  Bool                    m_firstPicInLayerDecodedFlag;
142  Bool                    m_noOutputOfPriorPicsFlags;
143
144  Bool                   m_bRefreshPending;
145#endif
[582]146#if RESOLUTION_BASED_DPB
147  Int                    m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
148                                          // When new VPS is activated, this should be re-initialized to -1
149#endif
[313]150public:
151  TDecTop();
152  virtual ~TDecTop();
153 
154  Void  create  ();
155  Void  destroy ();
156
157  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
158
159  Void  init();
160#if SVC_EXTENSION
161  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
162#else
163  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
164#endif
165 
166  Void  deletePicBuffer();
167
168  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
169#if SVC_EXTENSION
[442]170#if EARLY_REF_PIC_MARKING
171  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
172#endif
[313]173  UInt      getLayerId            () { return m_layerId;              }
174  Void      setLayerId            (UInt layer) { m_layerId = layer; }
175  UInt      getNumLayer           () { return m_numLayer;             }
176  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
177  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
178  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
179  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
180#if VPS_EXTN_DIRECT_REF_LAYERS
181  TDecTop*  getRefLayerDec(UInt refLayerIdc);
182  Int       getNumDirectRefLayers           ()                              { return m_numDirectRefLayers;      }
183  Void      setNumDirectRefLayers           (Int num)                       { m_numDirectRefLayers = num;       }
184
185  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
186  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
187
188  Int       getNumSamplePredRefLayers       ()                              { return m_numSamplePredRefLayers;  }
189  Void      setNumSamplePredRefLayers       (Int num)                       { m_numSamplePredRefLayers = num;   }
190
191  Int       getSamplePredRefLayerId         (Int i)                         { return m_samplePredRefLayerId[i];       }
192  Void      setSamplePredRefLayerId         (Int i, Int refLayerId)         { m_samplePredRefLayerId[i] = refLayerId; }
193
194  Int       getNumMotionPredRefLayers       ()                              { return m_numMotionPredRefLayers;  }
195  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
196
197  Int       getMotionPredRefLayerId         (Int i)                         { return m_motionPredRefLayerId[i];       }
198  Void      setMotionPredRefLayerId         (Int i, Int refLayerId)         { m_motionPredRefLayerId[i] = refLayerId; }
199
200  Bool      getSamplePredEnabledFlag        (Int i)                         { return m_samplePredEnabledFlag[i];  }
201  Void      setSamplePredEnabledFlag        (Int i,Bool flag)               { m_samplePredEnabledFlag[i] = flag;  }
202
203  Bool      getMotionPredEnabledFlag        (Int i)                         { return m_motionPredEnabledFlag[i];  }
204  Void      setMotionPredEnabledFlag        (Int i,Bool flag)               { m_motionPredEnabledFlag[i] = flag;  }
205
206  TDecTop*  getSamplePredRefLayerDec        ( UInt layerId );
207  TDecTop*  getMotionPredRefLayerDec        ( UInt layerId );
208
209  Void      setRefLayerParams( TComVPS* vps );
210#endif
211#if AVC_BASE
212  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
213  fstream*  getBLReconFile() { return m_pBLReconFile; }
214  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
215  Int       getBLWidth() { return  m_iBLSourceWidth; }
216  Int       getBLHeight() { return  m_iBLSourceHeight; }
217#endif
[442]218#if REPN_FORMAT_IN_VPS
219  Void      xInitILRP(TComSlice *slice);
220#else
221  Void      xInitILRP(TComSPS *pcSPS);
[313]222#endif
[593]223#if OUTPUT_LAYER_SET_INDEX
224  CommonDecoderParams*    getCommonDecoderParams() { return m_commonDecoderParams; }
225  Void                    setCommonDecoderParams(CommonDecoderParams* x) { m_commonDecoderParams = x; }
226  Void      checkValueOfTargetOutputLayerSetIdx(TComVPS *vps);
[442]227#endif
[593]228#if SCALINGLIST_INFERRING
229  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
230#endif
231#if RESOLUTION_BASED_DPB
232  Void setSubDpbIdx(Int idx)    { m_subDpbIdx = idx; }
233  Int  getSubDpbIdx()           { return m_subDpbIdx; }
234  Void assignSubDpbs(TComVPS *vps);
235#endif
236#endif //SVC_EXTENSION
[313]237#if AVC_SYNTAX || SYNTAX_OUTPUT
238  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
239  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
240#endif
241
242protected:
243  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
244  Void  xCreateLostPicture (Int iLostPOC);
245
246  Void      xActivateParameterSets();
247#if SVC_EXTENSION
[442]248#if POC_RESET_FLAG
249  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
250#else
[313]251  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
[442]252#endif
[313]253#else
254  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
255#endif
256  Void      xDecodeVPS();
257  Void      xDecodeSPS();
258  Void      xDecodePPS();
259  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
260
[540]261#if NO_CLRAS_OUTPUT_FLAG
262  Int  getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
263  Void setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
264  Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
265  Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
266  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
267  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
268  Int  getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
269  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
270#endif
[313]271};// END CLASS DEFINITION TDecTop
272
273
274//! \}
275
276#endif // __TDECTOP__
277
Note: See TracBrowser for help on using the repository browser.