source: SHVCSoftware/branches/0.1.1-bugfix/source/Lib/TLibDecoder/TDecTop.h @ 1606

Last change on this file since 1606 was 2, checked in by seregin, 12 years ago

Initial import by Vadim Seregin <vseregin@…>

File size: 7.7 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  TComSlice*              m_apcSlicePilot;
83 
84  SEImessages *m_SEIs; ///< "all" SEI messages.  If not NULL, we own the object.
85
86  // functional classes
87  TComPrediction          m_cPrediction;
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#if !REMOVE_ALF
99  TComAdaptiveLoopFilter  m_cAdaptiveLoopFilter;
100#endif
101  TComSampleAdaptiveOffset m_cSAO;
102
103  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
104  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
105  TComPic*                m_pcPic;
106  UInt                    m_uiSliceIdx;
107#if !SVC_EXTENSION
108  Int                     m_prevPOC;
109#endif
110  Bool                    m_bFirstSliceInPicture;
111#if !SVC_EXTENSION
112  Bool                    m_bFirstSliceInSequence;
113#endif
114
115#if SVC_EXTENSION
116  static UInt             m_prevPOC;        // POC of the previous slice
117  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
118  static Bool             m_bFirstSliceInSequence;
119  UInt                    m_layerId;     
120  UInt                    m_numLayer;
121  TDecTop**               m_ppcTDecTop;
122#if AVC_BASE
123  FILE*                   m_pBLReconFile;
124  Int                     m_iBLSourceWidth;
125  Int                     m_iBLSourceHeight;
126#endif
127#endif
128#if REF_IDX_FRAMEWORK
129  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
130#endif
131
132public:
133  TDecTop();
134  virtual ~TDecTop();
135 
136  Void  create  ();
137  Void  destroy ();
138
139  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
140
141  Void  init();
142#if SVC_EXTENSION
143  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
144#else
145  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
146#endif
147 
148  Void  deletePicBuffer();
149
150  Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
151
152#if SVC_EXTENSION
153  UInt      getLayerId            () { return m_layerId;              }
154  Void      setLayerId            (UInt layer) { m_layerId = layer; }
155  UInt      getNumLayer           () { return m_numLayer;             }
156  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
157  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
158  Void                setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
159  TDecTop*            getLayerDec(UInt layer)   { return m_ppcTDecTop[layer]; }
160#if AVC_BASE
161  Void      setBLReconFile( FILE* pFile ) { m_pBLReconFile = pFile; }
162  FILE*     getBLReconFile() { return m_pBLReconFile; }
163  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
164  Int       getBLWidth() { return  m_iBLSourceWidth; }
165  Int       getBLHeight() { return  m_iBLSourceHeight; }
166#endif
167#endif
168#if REF_IDX_FRAMEWORK
169  Void      xInitILRP(TComSPS *pcSPS);
170  Void      setILRPic(TComPic *pcPic);
171#endif
172protected:
173  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
174  Void  xUpdateGopSize    (TComSlice* pcSlice);
175  Void  xCreateLostPicture (Int iLostPOC);
176
177#if !REMOVE_APS
178  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
179#endif
180  Void      xActivateParameterSets();
181#if SVC_EXTENSION
182  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
183#else
184  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
185#endif
186  Void      xDecodeVPS();
187  Void      xDecodeSPS();
188  Void      xDecodePPS();
189#if !REMOVE_APS
190  Void      xDecodeAPS();
191#endif
192  Void      xDecodeSEI( TComInputBitstream* bs );
193
194#if !REMOVE_APS
195  Void      allocAPS (TComAPS* pAPS); //!< memory allocation for APS
196#endif
197};// END CLASS DEFINITION TDecTop
198
199
200//! \}
201
202#endif // __TDECTOP__
203
Note: See TracBrowser for help on using the repository browser.