source: 3DVCSoftware/trunk/source/Lib/TLibDecoder/TDecTop.h @ 56

Last change on this file since 56 was 56, checked in by hschwarz, 13 years ago

updated trunk (move to HM6.1)

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