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

Last change on this file since 963 was 953, checked in by qualcomm, 10 years ago

Fixes for conformance testing and non-output layers.

  • Value of PicOutputFlag of non-output layers was not being computed correctly. Fixed under MACRO FIX_NON_OUTPUT_LAYER
  • Some fixes for conformance testing under macro FIX_CONF_MODE.

From: Adarsh K. Ramasubramonian <aramasub@…>

  • Property svn:eol-style set to native
File size: 14.7 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"
[713]47#if Q0048_CGS_3D_ASYMLUT
48#include "TLibCommon/TCom3DAsymLUT.h"
49#endif
[313]50
51#include "TDecGop.h"
52#include "TDecEntropy.h"
53#include "TDecSbac.h"
54#include "TDecCAVLC.h"
55#include "SEIread.h"
56
57struct InputNALUnit;
58
59//! \ingroup TLibDecoder
60//! \{
61
62// ====================================================================================================================
63// Class definition
64// ====================================================================================================================
65
66/// decoder class
67class TDecTop
68{
69private:
70  Int                     m_iMaxRefPicNum;
71 
[442]72  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
[313]73  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
74  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
75
76  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
77  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
78  TComSlice*              m_apcSlicePilot;
[442]79
[313]80  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
81
82  // functional classes
83  TComPrediction          m_cPrediction;
[713]84#if Q0048_CGS_3D_ASYMLUT
85  TCom3DAsymLUT           m_c3DAsymLUTPPS;
86  TComPicYuv*             m_pColorMappedPic;
87#endif
[313]88  TComTrQuant             m_cTrQuant;
89  TDecGop                 m_cGopDecoder;
90  TDecSlice               m_cSliceDecoder;
91  TDecCu                  m_cCuDecoder;
92  TDecEntropy             m_cEntropyDecoder;
93  TDecCavlc               m_cCavlcDecoder;
94  TDecSbac                m_cSbacDecoder;
95  TDecBinCABAC            m_cBinCABAC;
96  SEIReader               m_seiReader;
97  TComLoopFilter          m_cLoopFilter;
98  TComSampleAdaptiveOffset m_cSAO;
99
100  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
101  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
102  TComPic*                m_pcPic;
103  UInt                    m_uiSliceIdx;
104#if !SVC_EXTENSION
105  Int                     m_prevPOC;
106#endif
107  Bool                    m_bFirstSliceInPicture;
108#if !SVC_EXTENSION
109  Bool                    m_bFirstSliceInSequence;
110#endif
[442]111  Bool                    m_prevSliceSkipped;
112  Int                     m_skippedPOC;
[713]113#if SETTING_NO_OUT_PIC_PRIOR 
114  Bool                    m_bFirstSliceInBitstream;
115  Int                     m_lastPOCNoOutputPriorPics;
116  Bool                    m_isNoOutputPriorPics;
117  Bool                    m_craNoRaslOutputFlag;    //value of variable NoRaslOutputFlag of the last CRA pic
118#endif
[815]119#if Q0177_EOS_CHECKS
120  Bool                    m_isLastNALWasEos;
121#endif
[313]122#if SVC_EXTENSION
123  static UInt             m_prevPOC;        // POC of the previous slice
124  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
125  static Bool             m_bFirstSliceInSequence;
126  UInt                    m_layerId;     
127  UInt                    m_numLayer;
128  TDecTop**               m_ppcTDecTop;
[903]129#if P0297_VPS_POC_LSB_ALIGNED_FLAG
130  Bool                    m_pocResettingFlag;
131  Bool                    m_pocDecrementedInDPBFlag;
132#endif
[313]133#if AVC_BASE
134  fstream*                m_pBLReconFile;
[713]135#if !REPN_FORMAT_IN_VPS
[313]136  Int                     m_iBLSourceWidth;
[713]137  Int                     m_iBLSourceHeight;
[313]138#endif
[713]139#endif
[588]140#if VPS_EXTN_DIRECT_REF_LAYERS
[313]141  Int                     m_numDirectRefLayers;
142  Int                     m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
143  Int                     m_numSamplePredRefLayers;
144  Int                     m_samplePredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
145  Int                     m_numMotionPredRefLayers;
146  Int                     m_motionPredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
147  Bool                    m_samplePredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
148  Bool                    m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
149#endif
[442]150  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
[313]151#endif
[540]152#if OUTPUT_LAYER_SET_INDEX
153  CommonDecoderParams*    m_commonDecoderParams;
154#endif
[713]155#if NO_CLRAS_OUTPUT_FLAG 
[540]156  Bool                    m_noClrasOutputFlag;
157  Bool                    m_layerInitializedFlag;
158  Bool                    m_firstPicInLayerDecodedFlag;
159#endif
[815]160#if POC_RESET_IDC_DECODER
161  Int                     m_parseIdc;
162  Int                     m_lastPocPeriodId;
163  Int                     m_prevPicOrderCnt;
164#endif
[588]165#if RESOLUTION_BASED_DPB
[713]166  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
167                                           // When new VPS is activated, this should be re-initialized to -1
[588]168#endif
[924]169#if CONFORMANCE_BITSTREAM_MODE
170  Bool m_confModeFlag;
171  std::vector<TComPic>   m_confListPic;         //  Dynamic buffer for storing pictures for conformance purposes
172#endif
[953]173#if FIX_NON_OUTPUT_LAYER
174  Bool m_isOutputLayerFlag;
175#endif
[313]176public:
[851]177#if POC_RESET_RESTRICTIONS
178  static Bool                    m_checkPocRestrictionsForCurrAu;
179  static Int                     m_pocResetIdcOrCurrAu;
180  static Bool                    m_baseLayerIdrFlag;
181  static Bool                    m_baseLayerPicPresentFlag;
182  static Bool                    m_baseLayerIrapFlag;
183  static Bool                    m_nonBaseIdrPresentFlag;
184  static Int                     m_nonBaseIdrType;
185  static Bool                    m_picNonIdrWithRadlPresentFlag;
186  static Bool                    m_picNonIdrNoLpPresentFlag;
187#endif
[854]188#if POC_RESET_VALUE_RESTRICTION
189  static Int                     m_crossLayerPocResetPeriodId;
190  static Int                     m_crossLayerPocResetIdc;
191#endif
[851]192
[313]193  TDecTop();
194  virtual ~TDecTop();
195 
196  Void  create  ();
197  Void  destroy ();
198
199  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
[856]200#if Q0074_COLOUR_REMAPPING_SEI
201  void setColourRemappingInfoSEIEnabled(Bool enabled)  { m_cGopDecoder.setColourRemappingInfoSEIEnabled(enabled); }
202#endif
[313]203
204  Void  init();
205#if SVC_EXTENSION
206  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
207#else
208  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
209#endif
210 
211  Void  deletePicBuffer();
212
[713]213 
214  TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
215
216
[313]217  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
[713]218#if SETTING_NO_OUT_PIC_PRIOR 
219  Void  checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic);
220  Bool  getNoOutputPriorPicsFlag ()         { return m_isNoOutputPriorPics; }
221  Void  setNoOutputPriorPicsFlag (Bool val) { m_isNoOutputPriorPics = val; }
222#endif
223
[313]224#if SVC_EXTENSION
[442]225#if EARLY_REF_PIC_MARKING
226  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
227#endif
[815]228#if POC_RESET_IDC_DECODER
229  Int getParseIdc() { return m_parseIdc;}
230  Void        setParseIdc(Int x) { m_parseIdc = x;}
231  Void        markAllPicsAsNoCurrAu();
232
233  Int   getLastPocPeriodId() { return m_lastPocPeriodId; }
234  Void  setLastPocPeriodId(Int x)    { m_lastPocPeriodId = x; }
235
236  Int   getPrevPicOrderCnt() { return m_prevPicOrderCnt; }
237  Void  setPrevPicOrderCnt(Int const x) { m_prevPicOrderCnt = x; }
238#endif
[313]239  UInt      getLayerId            () { return m_layerId;              }
240  Void      setLayerId            (UInt layer) { m_layerId = layer; }
241  UInt      getNumLayer           () { return m_numLayer;             }
242  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
243  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
244  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
245  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
246#if VPS_EXTN_DIRECT_REF_LAYERS
247  TDecTop*  getRefLayerDec(UInt refLayerIdc);
248  Int       getNumDirectRefLayers           ()                              { return m_numDirectRefLayers;      }
249  Void      setNumDirectRefLayers           (Int num)                       { m_numDirectRefLayers = num;       }
250
251  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
252  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
253
254  Int       getNumSamplePredRefLayers       ()                              { return m_numSamplePredRefLayers;  }
255  Void      setNumSamplePredRefLayers       (Int num)                       { m_numSamplePredRefLayers = num;   }
256
257  Int       getSamplePredRefLayerId         (Int i)                         { return m_samplePredRefLayerId[i];       }
258  Void      setSamplePredRefLayerId         (Int i, Int refLayerId)         { m_samplePredRefLayerId[i] = refLayerId; }
259
260  Int       getNumMotionPredRefLayers       ()                              { return m_numMotionPredRefLayers;  }
261  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
262
263  Int       getMotionPredRefLayerId         (Int i)                         { return m_motionPredRefLayerId[i];       }
264  Void      setMotionPredRefLayerId         (Int i, Int refLayerId)         { m_motionPredRefLayerId[i] = refLayerId; }
265
266  Bool      getSamplePredEnabledFlag        (Int i)                         { return m_samplePredEnabledFlag[i];  }
267  Void      setSamplePredEnabledFlag        (Int i,Bool flag)               { m_samplePredEnabledFlag[i] = flag;  }
268
269  Bool      getMotionPredEnabledFlag        (Int i)                         { return m_motionPredEnabledFlag[i];  }
270  Void      setMotionPredEnabledFlag        (Int i,Bool flag)               { m_motionPredEnabledFlag[i] = flag;  }
271
272  TDecTop*  getSamplePredRefLayerDec        ( UInt layerId );
273  TDecTop*  getMotionPredRefLayerDec        ( UInt layerId );
274
275  Void      setRefLayerParams( TComVPS* vps );
276#endif
277#if AVC_BASE
278  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
279  fstream*  getBLReconFile() { return m_pBLReconFile; }
[713]280#if !REPN_FORMAT_IN_VPS
[313]281  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
282  Int       getBLWidth() { return  m_iBLSourceWidth; }
283  Int       getBLHeight() { return  m_iBLSourceHeight; }
284#endif
[713]285#endif
[442]286#if REPN_FORMAT_IN_VPS
287  Void      xInitILRP(TComSlice *slice);
288#else
289  Void      xInitILRP(TComSPS *pcSPS);
[313]290#endif
[595]291#if OUTPUT_LAYER_SET_INDEX
292  CommonDecoderParams*    getCommonDecoderParams() { return m_commonDecoderParams; }
293  Void                    setCommonDecoderParams(CommonDecoderParams* x) { m_commonDecoderParams = x; }
294  Void      checkValueOfTargetOutputLayerSetIdx(TComVPS *vps);
[442]295#endif
[595]296#if SCALINGLIST_INFERRING
297  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
298#endif
299#if RESOLUTION_BASED_DPB
300  Void setSubDpbIdx(Int idx)    { m_subDpbIdx = idx; }
301  Int  getSubDpbIdx()           { return m_subDpbIdx; }
302  Void assignSubDpbs(TComVPS *vps);
303#endif
[924]304#if CONFORMANCE_BITSTREAM_MODE
305  std::vector<TComPic>* getConfListPic() {return &m_confListPic; }
306  // std::string const getDecodedYuvLayerFileName(Int layerId) { return m_decodedYuvLayerFileName[layerId]; }
307#endif
[595]308#endif //SVC_EXTENSION
[820]309
[313]310protected:
311  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
312  Void  xCreateLostPicture (Int iLostPOC);
313
314  Void      xActivateParameterSets();
315#if SVC_EXTENSION
[442]316#if POC_RESET_FLAG
317  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
318#else
[313]319  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
[442]320#endif
[313]321#else
322  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
323#endif
324  Void      xDecodeVPS();
325  Void      xDecodeSPS();
[713]326  Void      xDecodePPS(
327#if Q0048_CGS_3D_ASYMLUT
328    TCom3DAsymLUT * pc3DAsymLUT
329#endif
330    );
[313]331  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
332
[540]333#if NO_CLRAS_OUTPUT_FLAG
334  Int  getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
335  Void setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
336  Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
337  Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
338  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
339  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
340#endif
[713]341#if Q0048_CGS_3D_ASYMLUT
342  Void initAsymLut(TComSlice *pcSlice);
[644]343#endif
[851]344#if POC_RESET_RESTRICTIONS
345  Void resetPocRestrictionCheckParameters();
346#endif
[924]347  public:
348#if CONFORMANCE_BITSTREAM_MODE
349  Bool const getConfModeFlag() { return m_confModeFlag; }
350  Void setConfModeFlag(Bool x) { m_confModeFlag = x; }
351#endif
[313]352};// END CLASS DEFINITION TDecTop
353
354
[851]355
[313]356//! \}
357
358#endif // __TDECTOP__
359
Note: See TracBrowser for help on using the repository browser.