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

Last change on this file since 757 was 38, checked in by seregin, 12 years ago

AVC_SYNTAX: initial porting of the AVC metadata file reading

File size: 8.3 KB
RevLine 
[2]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
[28]82
83#if REF_IDX_MFM
84  TComSPS*               m_pcSPS;
85  Bool                   m_bMFMEnabledFlag;
86#endif
87
[2]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
[38]129  fstream*                m_pBLReconFile;
[2]130  Int                     m_iBLSourceWidth;
131  Int                     m_iBLSourceHeight;
132#endif
133#endif
[38]134#if AVC_SYNTAX || SYNTAX_OUTPUT
135  fstream*               m_pBLSyntaxFile;
136#endif
[2]137#if REF_IDX_FRAMEWORK
138  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
139#endif
140
141public:
142  TDecTop();
143  virtual ~TDecTop();
144 
145  Void  create  ();
146  Void  destroy ();
147
148  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
149
150  Void  init();
151#if SVC_EXTENSION
152  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
153#else
154  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
155#endif
156 
157  Void  deletePicBuffer();
158
159  Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
160
161#if SVC_EXTENSION
162  UInt      getLayerId            () { return m_layerId;              }
163  Void      setLayerId            (UInt layer) { m_layerId = layer; }
164  UInt      getNumLayer           () { return m_numLayer;             }
165  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
166  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
167  Void                setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
168  TDecTop*            getLayerDec(UInt layer)   { return m_ppcTDecTop[layer]; }
169#if AVC_BASE
[38]170  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
171  fstream*  getBLReconFile() { return m_pBLReconFile; }
[2]172  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
173  Int       getBLWidth() { return  m_iBLSourceWidth; }
174  Int       getBLHeight() { return  m_iBLSourceHeight; }
175#endif
176#endif
[38]177#if AVC_SYNTAX || SYNTAX_OUTPUT
178  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
179  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
180#endif
[2]181#if REF_IDX_FRAMEWORK
182  Void      xInitILRP(TComSPS *pcSPS);
183  Void      setILRPic(TComPic *pcPic);
184#endif
[28]185#if REF_IDX_MFM
186  TComSPS*  getSPS()                       {return m_pcSPS;}
187  Void      setMFMEnabledFlag(Bool flag)   {m_bMFMEnabledFlag = flag;}
188  Bool      getMFMEnabledFlag()            {return m_bMFMEnabledFlag;}
189#endif
190
[2]191protected:
192  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
193  Void  xUpdateGopSize    (TComSlice* pcSlice);
194  Void  xCreateLostPicture (Int iLostPOC);
195
196#if !REMOVE_APS
197  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
198#endif
199  Void      xActivateParameterSets();
200#if SVC_EXTENSION
201  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
202#else
203  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
204#endif
205  Void      xDecodeVPS();
206  Void      xDecodeSPS();
207  Void      xDecodePPS();
208#if !REMOVE_APS
209  Void      xDecodeAPS();
210#endif
211  Void      xDecodeSEI( TComInputBitstream* bs );
212
213#if !REMOVE_APS
214  Void      allocAPS (TComAPS* pAPS); //!< memory allocation for APS
215#endif
216};// END CLASS DEFINITION TDecTop
217
218
219//! \}
220
221#endif // __TDECTOP__
222
Note: See TracBrowser for help on using the repository browser.