source: 3DVCSoftware/tags/0.2/source/Lib/TLibDecoder/TDecTop.h

Last change on this file was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 6.9 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-2011, 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 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
35
36/** \file     TDecTop.h
37    \brief    decoder class (header)
38*/
39
40#ifndef __TDECTOP__
41#define __TDECTOP__
42
43#include "../TLibCommon/CommonDef.h"
44#include "../TLibCommon/TComList.h"
45#include "../TLibCommon/TComPicYuv.h"
46#include "../TLibCommon/TComPic.h"
47#include "../TLibCommon/TComTrQuant.h"
48#include "../TLibCommon/TComDepthMapGenerator.h"
49#include "../TLibCommon/TComResidualGenerator.h"
50#include "../TLibCommon/SEI.h"
51
52#include "TDecGop.h"
53#include "TDecEntropy.h"
54#include "TDecSbac.h"
55#include "TDecCAVLC.h"
56
57// ====================================================================================================================
58// Class definition
59// ====================================================================================================================
60
61class TAppDecTop ;
62
63
64class CamParsCollector
65{
66public:
67  CamParsCollector  ();
68  ~CamParsCollector ();
69
70  Void  init        ( FILE* pCodedScaleOffsetFile );
71  Void  uninit      ();
72  Void  setSlice    ( TComSlice* pcSlice );
73
74private:
75  Bool  xIsComplete ();
76  Void  xOutput     ( Int iPOC );
77
78private:
79  Bool    m_bInitialized;
80  FILE*   m_pCodedScaleOffsetFile;
81
82  Int**   m_aaiCodedOffset;
83  Int**   m_aaiCodedScale;
84  Int*    m_aiViewOrderIndex;
85  Int*    m_aiViewReceived;
86  UInt    m_uiCamParsCodedPrecision;
87  Bool    m_bCamParsVaryOverTime;
88  Int     m_iLastViewId;
89  Int     m_iLastPOC;
90  UInt    m_uiMaxViewId;
91};
92
93
94/// decoder class
95class TDecTop
96{
97private:
98  Int                     m_iGopSize;
99  Bool                    m_bGopSizeSet;
100  int                     m_iMaxRefPicNum;
101
102#if DCM_DECODING_REFRESH
103  Bool                    m_bRefreshPending;    ///< refresh pending flag
104  UInt                    m_uiPOCCDR;           ///< temporal reference of the CDR picture
105#if DCM_SKIP_DECODING_FRAMES
106  UInt                    m_uiPOCRA;            ///< temporal reference of the random access point
107#endif
108#endif
109
110  UInt                    m_uiValidPS;
111  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
112  TComSPS                 m_cSPS;
113  TComPPS                 m_cPPS;
114  TComSlice*              m_apcSlicePilot;
115
116  SEImessages *m_SEIs; ///< "all" SEI messages.  If not NULL, we own the object.
117
118  // functional classes
119  TComPrediction          m_cPrediction;
120  TComTrQuant             m_cTrQuant;
121  TDecGop                 m_cGopDecoder;
122  TDecSlice               m_cSliceDecoder;
123  TDecCu                  m_cCuDecoder;
124  TDecEntropy             m_cEntropyDecoder;
125  TDecCavlc               m_cCavlcDecoder;
126  TDecSbac                m_cSbacDecoder;
127  TDecBinCABAC            m_cBinCABAC;
128  TComLoopFilter          m_cLoopFilter;
129  TComAdaptiveLoopFilter  m_cAdaptiveLoopFilter;
130#if MTK_SAO
131  TComSampleAdaptiveOffset m_cSAO;
132#endif
133#if DEPTH_MAP_GENERATION
134  TComDepthMapGenerator   m_cDepthMapGenerator;
135#endif
136#if HHI_INTER_VIEW_RESIDUAL_PRED
137  TComResidualGenerator   m_cResidualGenerator;
138#endif
139
140  Bool                    m_bIsDepth;
141  Int                     m_iViewIdx;
142  TAppDecTop*             m_pcTAppDecTop;
143  CamParsCollector*       m_pcCamParsCollector;
144
145#if DCM_SKIP_DECODING_FRAMES
146  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
147#endif
148  TComPic*                m_pcPic;
149  UInt                    m_uiSliceIdx;
150  UInt                    m_uiLastSliceIdx;
151  UInt                    m_uiPrevPOC;
152  Bool                    m_bFirstSliceInPicture;
153  Bool                    m_bFirstSliceInSequence;
154
155public:
156  TDecTop();
157  virtual ~TDecTop();
158
159  Void  create  ();
160  Void  destroy ();
161
162  void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); }
163
164  Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true );
165#if DCM_SKIP_DECODING_FRAMES
166  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay);
167#else
168  Void  decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS );
169#endif
170
171  TComSPS *getSPS() { return (m_uiValidPS & 1) ? &m_cSPS : NULL; }
172
173  Void  deletePicBuffer();
174
175  Void  deleteExtraPicBuffers( Int iPoc );
176#if AMVP_BUFFERCOMPRESS
177  Void  compressMotion       ( Int iPoc );
178#endif
179
180  Void setViewIdx(Int i)                                        { m_iViewIdx = i ;}
181  Int  getViewIdx()                                                             { return m_iViewIdx ; }
182
183  Void setToDepth(Bool b)         { m_bIsDepth = b ;}
184  Bool getIsDepth()               { return m_bIsDepth ;}
185
186  Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
187
188  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
189  TAppDecTop*             getDecTop           ( ){ return  m_pcTAppDecTop ;};
190
191  Void                    setSPS                (TComSPS cSPS );
192
193  UInt                    getCodedPictureBufferSize() { return m_cSPS.getCodedPictureBufferSize() ; }
194
195  Void executeDeblockAndAlf(Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
196
197protected:
198  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
199
200};// END CLASS DEFINITION TDecTop
201
202
203#endif // __TDECTOP__
204
Note: See TracBrowser for help on using the repository browser.