source: 3DVCSoftware/branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.h @ 520

Last change on this file since 520 was 446, checked in by tech, 12 years ago

Added missing parts.

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