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

Last change on this file since 360 was 296, checked in by tech, 12 years ago

Reintegrated branch 5.1-dev0 rev. 295.

  • Property svn:eol-style set to native
File size: 9.5 KB
RevLine 
[5]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
[56]4 * granted under this license. 
[5]5 *
[56]6 * Copyright (c) 2010-2012, ITU/ISO/IEC
[5]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.
[56]17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
[5]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 */
[2]33
34/** \file     TDecTop.h
35    \brief    decoder class (header)
36*/
37
38#ifndef __TDECTOP__
39#define __TDECTOP__
40
[56]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"
[2]48
49#include "TDecGop.h"
50#include "TDecEntropy.h"
51#include "TDecSbac.h"
52#include "TDecCAVLC.h"
53
[56]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
[2]61// ====================================================================================================================
62// Class definition
63// ====================================================================================================================
64
[56]65class TAppDecTop;
[2]66
67class CamParsCollector
68{
69public:
70  CamParsCollector  ();
71  ~CamParsCollector ();
72
73  Void  init        ( FILE* pCodedScaleOffsetFile );
74  Void  uninit      ();
75  Void  setSlice    ( TComSlice* pcSlice );
76
[57]77  Bool  isInitialized() const { return m_bInitialized; }
78
[296]79#if MERL_VSP_C0152
80  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
81#endif
[2]82private:
83  Bool  xIsComplete ();
84  Void  xOutput     ( Int iPOC );
85
86private:
87  Bool    m_bInitialized;
88  FILE*   m_pCodedScaleOffsetFile;
89
90  Int**   m_aaiCodedOffset;
91  Int**   m_aaiCodedScale;
92  Int*    m_aiViewOrderIndex;
[210]93#if QC_MVHEVC_B0046
94  Int*    m_aiViewId;
95#endif
[2]96  Int*    m_aiViewReceived;
97  UInt    m_uiCamParsCodedPrecision;
98  Bool    m_bCamParsVaryOverTime;
99  Int     m_iLastViewId;
100  Int     m_iLastPOC;
101  UInt    m_uiMaxViewId;
[296]102
103#if MERL_VSP_C0152
104  UInt    m_uiBitDepthForLUT;
105  UInt    m_iLog2Precision;
106  UInt    m_uiInputBitDepth;
107  // look-up tables
108  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
109  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
110  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
111  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
112  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
113  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
114  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
115#endif
116
[2]117};
118
[296]119#if MERL_VSP_C0152
120template <class T>
121Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
122{
123  if( rpt )
124  {
125    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
126    {
127      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
128      {
129        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
130        {
131          delete[] rpt[ uiK ][ uiL ][ uiM ];
132        }
133        delete[] rpt[ uiK ][ uiL ];
134      }
135      delete[] rpt[ uiK ];
136    }
137    delete[] rpt;
138  }
139  rpt = NULL;
140};
141
142
143template <class T>
144Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
145{
146  if( rpt )
147  {
148    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
149    {
150      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
151      {
152        delete[] rpt[ uiK ][ uiL ];
153      }
154      delete[] rpt[ uiK ];
155    }
156    delete[] rpt;
157  }
158  rpt = NULL;
159};
160
161
162template <class T>
163Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
164{
165  if( rpt )
166  {
167    for( UInt uiK = 0; uiK < uiSize; uiK++ )
168    {
169      delete[] rpt[ uiK ];
170    }
171    delete[] rpt;
172  }
173  rpt = NULL;
174};
175
176#endif
177
[2]178/// decoder class
179class TDecTop
180{
181private:
182  Int                     m_iGopSize;
183  Bool                    m_bGopSizeSet;
184  int                     m_iMaxRefPicNum;
[56]185 
[2]186  Bool                    m_bRefreshPending;    ///< refresh pending flag
[56]187  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
188  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
[2]189
190  UInt                    m_uiValidPS;
191  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
[56]192  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
193  TComRPSList             m_RPSList;
[2]194  TComSlice*              m_apcSlicePilot;
[56]195 
[2]196  SEImessages *m_SEIs; ///< "all" SEI messages.  If not NULL, we own the object.
197
198  // functional classes
199  TComPrediction          m_cPrediction;
200  TComTrQuant             m_cTrQuant;
201  TDecGop                 m_cGopDecoder;
202  TDecSlice               m_cSliceDecoder;
203  TDecCu                  m_cCuDecoder;
204  TDecEntropy             m_cEntropyDecoder;
205  TDecCavlc               m_cCavlcDecoder;
206  TDecSbac                m_cSbacDecoder;
207  TDecBinCABAC            m_cBinCABAC;
208  TComLoopFilter          m_cLoopFilter;
209  TComAdaptiveLoopFilter  m_cAdaptiveLoopFilter;
210  TComSampleAdaptiveOffset m_cSAO;
[56]211
[5]212#if DEPTH_MAP_GENERATION
[2]213  TComDepthMapGenerator   m_cDepthMapGenerator;
[5]214#endif
[296]215#if H3D_IVRP
[2]216  TComResidualGenerator   m_cResidualGenerator;
[5]217#endif
[2]218
219  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
220  TComPic*                m_pcPic;
221  UInt                    m_uiSliceIdx;
222  UInt                    m_uiLastSliceIdx;
[56]223  Int                     m_prevPOC;
[2]224  Bool                    m_bFirstSliceInPicture;
225  Bool                    m_bFirstSliceInSequence;
226
[56]227  Int                     m_viewId;
228  Bool                    m_isDepth;
229  TAppDecTop*             m_tAppDecTop;
[57]230  CamParsCollector*       m_pcCamParsCollector;
[56]231  NalUnitType             m_nalUnitTypeBaseView; 
232
[2]233public:
234  TDecTop();
235  virtual ~TDecTop();
[56]236 
[2]237  Void  create  ();
238  Void  destroy ();
239
240  void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); }
[56]241 
242  Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance );
243  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
244 
245  Void  deletePicBuffer();
[210]246#if QC_MVHEVC_B0046
247  Void      xCopySPS( TComSPS* pSPSV0);
248  Void      xCopyPPS( TComPPS* pPPSV0);
249  Void      xCopyVPS( TComVPS* pVPSV0);
250#endif
[296]251#if H3D_IVRP
[56]252  Void      deleteExtraPicBuffers   ( Int iPoc );
[42]253#endif
[56]254  Void  compressMotion       ( Int iPoc );
[5]255
[56]256  Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
[5]257
[100]258  Void setViewId(Int viewId)      { m_viewId = viewId;}
259  Int  getViewId()                { return m_viewId  ;}
[56]260  Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; }
[2]261
[21]262#if DEPTH_MAP_GENERATION
263  TComDepthMapGenerator*  getDepthMapGenerator  () { return &m_cDepthMapGenerator; }
264#endif
[2]265
[57]266  Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
267
[56]268  TComList<TComPic*>* getListPic()                              { return &m_cListPic; }
269  Void                setTAppDecTop( TAppDecTop* pcTAppDecTop ) { m_tAppDecTop = pcTAppDecTop; }
270  TAppDecTop*         getTAppDecTop()                           { return  m_tAppDecTop; }
271  NalUnitType         getNalUnitTypeBaseView()                  { return m_nalUnitTypeBaseView; }
[210]272#if QC_MVHEVC_B0046
273  bool                m_bFirstNal; //used to copy SPS, PPS, VPS
274  ParameterSetManagerDecoder* xGetParaSetDec ()        {return  &m_parameterSetManagerDecoder;}
275#endif
[296]276
[2]277protected:
278  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
[56]279  Void  xUpdateGopSize    (TComSlice* pcSlice);
280  Void  xCreateLostPicture (Int iLostPOC);
[5]281
[56]282  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
283  Void      xActivateParameterSets();
284  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
[210]285#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
[100]286  Void      xDecodeVPS();
[77]287#endif
[56]288  Void      xDecodeSPS();
289  Void      xDecodePPS();
290  Void      xDecodeAPS();
291  Void      xDecodeSEI();
292
293  Void      allocAPS (TComAPS* pAPS); //!< memory allocation for APS
[2]294};// END CLASS DEFINITION TDecTop
295
296
[56]297//! \}
298
[2]299#endif // __TDECTOP__
300
Note: See TracBrowser for help on using the repository browser.