source: 3DVCSoftware/branches/HTM-4.0-Nokia/source/Lib/TLibDecoder/TDecTop.h @ 139

Last change on this file since 139 was 139, checked in by nokia, 12 years ago

3DV-HTM v4.0: FCO

  • Property svn:eol-style set to native
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/TComDepthMapGenerator.h"
47#include "TLibCommon/SEI.h"
48
49#include "TDecGop.h"
50#include "TDecEntropy.h"
51#include "TDecSbac.h"
52#include "TDecCAVLC.h"
53
54struct InputNALUnit;
55
56//! \ingroup TLibDecoder
57//! \{
58
59#define APS_RESERVED_BUFFER_SIZE 2 //!< must be equal to or larger than 2 to handle bitstream parsing
60
61// ====================================================================================================================
62// Class definition
63// ====================================================================================================================
64
65class TAppDecTop;
66
67class CamParsCollector
68{
69public:
70  CamParsCollector  ();
71  ~CamParsCollector ();
72
73  Void  init        ( FILE* pCodedScaleOffsetFile );
74  Void  uninit      ();
75  Void  setSlice    ( TComSlice* pcSlice );
76
77  Bool  isInitialized() const { return m_bInitialized; }
78
79private:
80  Bool  xIsComplete ();
81  Void  xOutput     ( Int iPOC );
82
83private:
84  Bool    m_bInitialized;
85  FILE*   m_pCodedScaleOffsetFile;
86
87  Int**   m_aaiCodedOffset;
88  Int**   m_aaiCodedScale;
89  Int*    m_aiViewOrderIndex;
90  Int*    m_aiViewReceived;
91  UInt    m_uiCamParsCodedPrecision;
92  Bool    m_bCamParsVaryOverTime;
93  Int     m_iLastViewId;
94  Int     m_iLastPOC;
95  UInt    m_uiMaxViewId;
96};
97
98/// decoder class
99class TDecTop
100{
101private:
102  Int                     m_iGopSize;
103  Bool                    m_bGopSizeSet;
104  int                     m_iMaxRefPicNum;
105 
106  Bool                    m_bRefreshPending;    ///< refresh pending flag
107  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
108  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
109
110  UInt                    m_uiValidPS;
111  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
112  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
113
114
115  TComRPSList             m_RPSList;
116  TComSlice*              m_apcSlicePilot;
117
118  SEImessages *m_SEIs; ///< "all" SEI messages.  If not NULL, we own the object.
119
120#if SONY_COLPIC_AVAILABILITY
121  Int                     m_iViewOrderIdx;
122#endif
123
124  // functional classes
125  TComPrediction          m_cPrediction;
126  TComTrQuant             m_cTrQuant;
127  TDecGop                 m_cGopDecoder;
128  TDecSlice               m_cSliceDecoder;
129  TDecCu                  m_cCuDecoder;
130  TDecEntropy             m_cEntropyDecoder;
131  TDecCavlc               m_cCavlcDecoder;
132  TDecSbac                m_cSbacDecoder;
133  TDecBinCABAC            m_cBinCABAC;
134  TComLoopFilter          m_cLoopFilter;
135  TComAdaptiveLoopFilter  m_cAdaptiveLoopFilter;
136  TComSampleAdaptiveOffset m_cSAO;
137
138#if DEPTH_MAP_GENERATION
139  TComDepthMapGenerator   m_cDepthMapGenerator;
140#endif
141#if HHI_INTER_VIEW_RESIDUAL_PRED
142  TComResidualGenerator   m_cResidualGenerator;
143#endif
144
145  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
146  TComPic*                m_pcPic;
147  UInt                    m_uiSliceIdx;
148  UInt                    m_uiLastSliceIdx;
149  Int                     m_prevPOC;
150  Bool                    m_bFirstSliceInPicture;
151  Bool                    m_bFirstSliceInSequence;
152
153  Int                     m_viewId;
154  Bool                    m_isDepth;
155  TAppDecTop*             m_tAppDecTop;
156  CamParsCollector*       m_pcCamParsCollector;
157  NalUnitType             m_nalUnitTypeBaseView; 
158
159public:
160  TDecTop();
161  virtual ~TDecTop();
162 
163  Void  create  ();
164  Void  destroy ();
165
166  void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); }
167 
168  Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance );
169  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay
170  );
171 
172  Void  deletePicBuffer();
173
174#if HHI_INTER_VIEW_RESIDUAL_PRED
175  Void      deleteExtraPicBuffers   ( Int iPoc );
176#endif
177  Void  compressMotion       ( Int iPoc );
178
179  Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
180
181  Void setViewId(Int viewId)      { m_viewId = viewId;}
182  Int  getViewId()                { return m_viewId  ;}
183  Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; }
184
185#if SONY_COLPIC_AVAILABILITY
186  Void setViewOrderIdx(Int i)     { m_iViewOrderIdx = i ;}
187  Int  getViewOrderIdx()          { return m_iViewOrderIdx ; }
188#endif
189
190#if DEPTH_MAP_GENERATION
191  TComDepthMapGenerator*  getDepthMapGenerator  () { return &m_cDepthMapGenerator; }
192#endif
193
194  Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
195
196  TComList<TComPic*>* getListPic()                              { return &m_cListPic; }
197  Void                setTAppDecTop( TAppDecTop* pcTAppDecTop ) { m_tAppDecTop = pcTAppDecTop; }
198  TAppDecTop*         getTAppDecTop()                           { return  m_tAppDecTop; }
199  NalUnitType         getNalUnitTypeBaseView()                  { return m_nalUnitTypeBaseView; }
200
201protected:
202  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
203  Void  xUpdateGopSize    (TComSlice* pcSlice);
204  Void  xCreateLostPicture (Int iLostPOC);
205
206  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
207  Void      xActivateParameterSets();
208#if SKIPFRAME_BUGFIX
209  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay
210    );
211#else
212  Bool      xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay,
213    );
214#endif
215#if VIDYO_VPS_INTEGRATION
216  Void      xDecodeVPS();
217#endif
218  Void      xDecodeSPS();
219  Void      xDecodePPS();
220  Void      xDecodeAPS();
221  Void      xDecodeSEI();
222
223  Void      allocAPS (TComAPS* pAPS); //!< memory allocation for APS
224};// END CLASS DEFINITION TDecTop
225
226
227//! \}
228
229#endif // __TDECTOP__
230
Note: See TracBrowser for help on using the repository browser.