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

Last change on this file since 1481 was 25, checked in by qualcomm, 12 years ago

L0336: motion field mapping of inter-layer reference picture from Qualcomm, cjianle@…

File size: 8.0 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     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_iGopSize;
68  Bool                    m_bGopSizeSet;
69  Int                     m_iMaxRefPicNum;
70 
71  Bool                    m_bRefreshPending;    ///< refresh pending flag
72  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
73  Bool                    m_prevRAPisBLA;      ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT 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#if SVC_EXTENSION
78  static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
79#else
80  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
81#endif
82
83#if REF_IDX_MFM
84  TComSPS*               m_pcSPS;
85  Bool                   m_bMFMEnabledFlag;
86#endif
87
88  TComSlice*              m_apcSlicePilot;
89 
90  SEImessages *m_SEIs; ///< "all" SEI messages.  If not NULL, we own the object.
91
92  // functional classes
93  TComPrediction          m_cPrediction;
94  TComTrQuant             m_cTrQuant;
95  TDecGop                 m_cGopDecoder;
96  TDecSlice               m_cSliceDecoder;
97  TDecCu                  m_cCuDecoder;
98  TDecEntropy             m_cEntropyDecoder;
99  TDecCavlc               m_cCavlcDecoder;
100  TDecSbac                m_cSbacDecoder;
101  TDecBinCABAC            m_cBinCABAC;
102  SEIReader               m_seiReader;
103  TComLoopFilter          m_cLoopFilter;
104#if !REMOVE_ALF
105  TComAdaptiveLoopFilter  m_cAdaptiveLoopFilter;
106#endif
107  TComSampleAdaptiveOffset m_cSAO;
108
109  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
110  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
111  TComPic*                m_pcPic;
112  UInt                    m_uiSliceIdx;
113#if !SVC_EXTENSION
114  Int                     m_prevPOC;
115#endif
116  Bool                    m_bFirstSliceInPicture;
117#if !SVC_EXTENSION
118  Bool                    m_bFirstSliceInSequence;
119#endif
120
121#if SVC_EXTENSION
122  static UInt             m_prevPOC;        // POC of the previous slice
123  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
124  static Bool             m_bFirstSliceInSequence;
125  UInt                    m_layerId;     
126  UInt                    m_numLayer;
127  TDecTop**               m_ppcTDecTop;
128#if AVC_BASE
129  FILE*                   m_pBLReconFile;
130  Int                     m_iBLSourceWidth;
131  Int                     m_iBLSourceHeight;
132#endif
133#endif
134#if REF_IDX_FRAMEWORK
135  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
136#endif
137
138public:
139  TDecTop();
140  virtual ~TDecTop();
141 
142  Void  create  ();
143  Void  destroy ();
144
145  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
146
147  Void  init();
148#if SVC_EXTENSION
149  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
150#else
151  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
152#endif
153 
154  Void  deletePicBuffer();
155
156  Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
157
158#if SVC_EXTENSION
159  UInt      getLayerId            () { return m_layerId;              }
160  Void      setLayerId            (UInt layer) { m_layerId = layer; }
161  UInt      getNumLayer           () { return m_numLayer;             }
162  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
163  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
164  Void                setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
165  TDecTop*            getLayerDec(UInt layer)   { return m_ppcTDecTop[layer]; }
166#if AVC_BASE
167  Void      setBLReconFile( FILE* pFile ) { m_pBLReconFile = pFile; }
168  FILE*     getBLReconFile() { return m_pBLReconFile; }
169  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
170  Int       getBLWidth() { return  m_iBLSourceWidth; }
171  Int       getBLHeight() { return  m_iBLSourceHeight; }
172#endif
173#endif
174#if REF_IDX_FRAMEWORK
175  Void      xInitILRP(TComSPS *pcSPS);
176  Void      setILRPic(TComPic *pcPic);
177#endif
178#if REF_IDX_MFM
179  TComSPS*  getSPS()                       {return m_pcSPS;}
180  Void      setMFMEnabledFlag(Bool flag)   {m_bMFMEnabledFlag = flag;}
181  Bool      getMFMEnabledFlag()            {return m_bMFMEnabledFlag;}
182#endif
183
184protected:
185  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
186  Void  xUpdateGopSize    (TComSlice* pcSlice);
187  Void  xCreateLostPicture (Int iLostPOC);
188
189#if !REMOVE_APS
190  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
191#endif
192  Void      xActivateParameterSets();
193#if SVC_EXTENSION
194  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
195#else
196  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
197#endif
198  Void      xDecodeVPS();
199  Void      xDecodeSPS();
200  Void      xDecodePPS();
201#if !REMOVE_APS
202  Void      xDecodeAPS();
203#endif
204  Void      xDecodeSEI( TComInputBitstream* bs );
205
206#if !REMOVE_APS
207  Void      allocAPS (TComAPS* pAPS); //!< memory allocation for APS
208#endif
209};// END CLASS DEFINITION TDecTop
210
211
212//! \}
213
214#endif // __TDECTOP__
215
Note: See TracBrowser for help on using the repository browser.