source: 3DVCSoftware/branches/HTM-DEV-2.0-dev3-Samsung/source/Lib/TLibDecoder/TDecTop.h @ 1310

Last change on this file since 1310 was 542, checked in by tech, 11 years ago

Further removal of unused macros.

  • Property svn:eol-style set to native
File size: 9.6 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-2013, 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#if H_MV
64class TAppDecTop;
65#endif
66#if H_3D
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  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
79
80private:
81  Bool  xIsComplete ();
82  Void  xOutput     ( Int iPOC );
83
84private:
85  Bool    m_bInitialized;
86  FILE*   m_pCodedScaleOffsetFile;
87
88  Int**   m_aaiCodedOffset;
89  Int**   m_aaiCodedScale;
90  Int*    m_aiViewId; 
91
92  Bool*   m_bViewReceived;
93  UInt    m_uiCamParsCodedPrecision;
94  Bool    m_bCamParsVaryOverTime;
95  Int     m_iLastViewIndex;
96  Int     m_iLastPOC;
97  UInt    m_uiMaxViewIndex;
98
99
100  UInt    m_uiBitDepthForLUT;
101  UInt    m_iLog2Precision;
102  UInt    m_uiInputBitDepth;
103
104  // look-up tables
105  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
106  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
107  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
108  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
109  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
110  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
111  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
112
113};
114
115template <class T>
116Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
117{
118  if( rpt )
119  {
120    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
121    {
122      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
123      {
124        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
125        {
126          delete[] rpt[ uiK ][ uiL ][ uiM ];
127        }
128        delete[] rpt[ uiK ][ uiL ];
129      }
130      delete[] rpt[ uiK ];
131    }
132    delete[] rpt;
133  }
134  rpt = NULL;
135};
136
137
138template <class T>
139Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
140{
141  if( rpt )
142  {
143    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
144    {
145      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
146      {
147        delete[] rpt[ uiK ][ uiL ];
148      }
149      delete[] rpt[ uiK ];
150    }
151    delete[] rpt;
152  }
153  rpt = NULL;
154};
155
156
157template <class T>
158Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
159{
160  if( rpt )
161  {
162    for( UInt uiK = 0; uiK < uiSize; uiK++ )
163    {
164      delete[] rpt[ uiK ];
165    }
166    delete[] rpt;
167  }
168  rpt = NULL;
169};
170
171#endif //H_3D
172/// decoder class
173class TDecTop
174{
175private:
176  Int                     m_iMaxRefPicNum;
177 
178  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
179  Bool                    m_prevRAPisBLA;      ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture
180  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
181
182  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
183#if H_MV
184  static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
185#else
186  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
187#endif
188  TComSlice*              m_apcSlicePilot;
189 
190  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
191
192  // functional classes
193  TComPrediction          m_cPrediction;
194  TComTrQuant             m_cTrQuant;
195  TDecGop                 m_cGopDecoder;
196  TDecSlice               m_cSliceDecoder;
197  TDecCu                  m_cCuDecoder;
198  TDecEntropy             m_cEntropyDecoder;
199  TDecCavlc               m_cCavlcDecoder;
200  TDecSbac                m_cSbacDecoder;
201  TDecBinCABAC            m_cBinCABAC;
202  SEIReader               m_seiReader;
203  TComLoopFilter          m_cLoopFilter;
204  TComSampleAdaptiveOffset m_cSAO;
205
206  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
207  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
208  TComPic*                m_pcPic;
209  UInt                    m_uiSliceIdx;
210  Int                     m_prevPOC;
211  Bool                    m_bFirstSliceInPicture;
212  Bool                    m_bFirstSliceInSequence;
213#if H_MV
214  // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 
215  Int                     m_layerId;
216  Int                     m_viewId;
217  TComPicLists*           m_ivPicLists;
218  std::vector<TComPic*>   m_refPicSetInterLayer; 
219#if H_3D
220  Int                     m_viewIndex; 
221  Bool                    m_isDepth;
222  CamParsCollector*       m_pcCamParsCollector;
223#endif
224#endif
225
226public:
227  TDecTop();
228  virtual ~TDecTop();
229 
230  Void  create  ();
231  Void  destroy ();
232
233  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
234
235  Void  init();
236#if H_MV 
237  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
238#else 
239  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
240#endif
241 
242  Void  deletePicBuffer();
243
244#if H_MV
245  Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic,  std::vector<Int>& targetDecLayerIdSet); 
246#else
247  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
248#endif
249 
250#if H_MV   
251  TComPic*                getPic                ( Int poc );
252  TComList<TComPic*>*     getListPic            ()               { return &m_cListPic;  } 
253  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
254 
255  Int                     getCurrPoc            ()               { return m_apcSlicePilot->getPOC(); }
256  Void                    setLayerId            ( Int layer)     { m_layerId = layer;   }
257  Int                     getLayerId            ()               { return m_layerId;    }
258  Void                    setViewId             ( Int viewId  )  { m_viewId  = viewId;  }
259  Int                     getViewId             ()               { return m_viewId;     } 
260#if H_3D   
261  Void                    setViewIndex          ( Int viewIndex  )  { m_viewIndex  = viewIndex;  }
262  Int                     getViewIndex          ()               { return m_viewIndex;     } 
263  Void                    setIsDepth            ( Bool isDepth ) { m_isDepth = isDepth; }
264  Bool                    getIsDepth            ()               { return m_isDepth;    }
265  Void                    setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
266#endif
267#endif
268protected:
269  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
270  Void  xCreateLostPicture (Int iLostPOC);
271
272  Void      xActivateParameterSets();
273#if H_MV 
274  TComPic*  xGetPic( Int layerId, Int poc ); 
275  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 
276#else
277  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
278#endif
279  Void      xDecodeVPS();
280  Void      xDecodeSPS();
281  Void      xDecodePPS();
282  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
283
284};// END CLASS DEFINITION TDecTop
285
286
287//! \}
288
289#endif // __TDECTOP__
290
Note: See TracBrowser for help on using the repository browser.