source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.h @ 479

Last change on this file since 479 was 479, checked in by tech, 11 years ago
  • changed IV-MERGE HLS to match Test Model 4 spec
  • incorporated iv-refpic list to TComSlice
  • removed TComDepthMapGenerator
  • Property svn:eol-style set to native
File size: 8.8 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     TEncGOP.h
35    \brief    GOP encoder class (header)
36*/
37
38#ifndef __TENCGOP__
39#define __TENCGOP__
40
41#include <list>
42
43#include <stdlib.h>
44
45#include "TLibCommon/TComList.h"
46#include "TLibCommon/TComPic.h"
47#include "TLibCommon/TComBitCounter.h"
48#include "TLibCommon/TComLoopFilter.h"
49#include "TLibCommon/AccessUnit.h"
50#include "TEncSampleAdaptiveOffset.h"
51#include "TEncSlice.h"
52#include "TEncEntropy.h"
53#include "TEncCavlc.h"
54#include "TEncSbac.h"
55#include "SEIwrite.h"
56
57#include "TEncAnalyze.h"
58#include "TEncRateCtrl.h"
59#include <vector>
60
61//! \ingroup TLibEncoder
62//! \{
63
64class TEncTop;
65
66// ====================================================================================================================
67// Class definition
68// ====================================================================================================================
69
70/// GOP encoder class
71class TEncGOP
72{
73private:
74  //  Data
75  Bool                    m_bLongtermTestPictureHasBeenCoded;
76  Bool                    m_bLongtermTestPictureHasBeenCoded2;
77  UInt            m_numLongTermRefPicSPS;
78  UInt            m_ltRefPicPocLsbSps[33];
79  Bool            m_ltRefPicUsedByCurrPicFlag[33];
80  Int                     m_iLastIDR;
81  Int                     m_iGopSize;
82  Int                     m_iNumPicCoded;
83  Bool                    m_bFirst;
84 
85  //  Access channel
86  TEncTop*                m_pcEncTop;
87  TEncCfg*                m_pcCfg;
88  TEncSlice*              m_pcSliceEncoder;
89  TComList<TComPic*>*     m_pcListPic;
90 
91  TEncEntropy*            m_pcEntropyCoder;
92  TEncCavlc*              m_pcCavlcCoder;
93  TEncSbac*               m_pcSbacCoder;
94  TEncBinCABAC*           m_pcBinCABAC;
95  TComLoopFilter*         m_pcLoopFilter;
96
97  SEIWriter               m_seiWriter;
98 
99#if H_MV
100  TComPicLists*           m_ivPicLists;
101  std::vector<TComPic*>   m_refPicSetInterLayer; 
102
103  Int                     m_pocLastCoded;
104  Int                     m_layerId; 
105  Int                     m_viewId;
106#if H_3D
107  Int                     m_viewIndex; 
108  Bool                    m_isDepth;
109#endif
110#endif
111  //--Adaptive Loop filter
112  TEncSampleAdaptiveOffset*  m_pcSAO;
113  TComBitCounter*         m_pcBitCounter;
114  TEncRateCtrl*           m_pcRateCtrl;
115  // indicate sequence first
116  Bool                    m_bSeqFirst;
117 
118  // clean decoding refresh
119  Bool                    m_bRefreshPending;
120  Int                     m_pocCRA;
121  std::vector<Int>        m_storedStartCUAddrForEncodingSlice;
122  std::vector<Int>        m_storedStartCUAddrForEncodingSliceSegment;
123
124  std::vector<Int> m_vRVM_RP;
125  UInt                    m_lastBPSEI;
126  UInt                    m_totalCoded;
127  UInt                    m_cpbRemovalDelay;
128  UInt                    m_tl0Idx;
129  UInt                    m_rapIdx;
130#if L0045_NON_NESTED_SEI_RESTRICTIONS
131  Bool                    m_activeParameterSetSEIPresentInAU;
132  Bool                    m_bufferingPeriodSEIPresentInAU;
133  Bool                    m_pictureTimingSEIPresentInAU;
134#if K0180_SCALABLE_NESTING_SEI
135  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
136  Bool                    m_nestedPictureTimingSEIPresentInAU;
137#endif
138#endif
139public:
140  TEncGOP();
141  virtual ~TEncGOP();
142 
143  Void  create      ();
144  Void  destroy     ();
145 
146  Void  init        ( TEncTop* pcTEncTop );
147#if H_MV
148  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
149  Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid );
150#else
151  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
152#endif
153  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
154
155#if H_MV
156  Int       getPocLastCoded  ()                 { return m_pocLastCoded; } 
157  Int       getLayerId       ()                 { return m_layerId;    } 
158  Int       getViewId        ()                 { return m_viewId;    }
159#if H_3D
160  Int       getViewIndex     ()                 { return m_viewIndex;    }
161  Bool      getIsDepth       ()                 { return m_isDepth; }
162#endif
163#endif
164
165  Int   getGOPSize()          { return  m_iGopSize;  }
166 
167  TComList<TComPic*>*   getListPic()      { return m_pcListPic; }
168
169#if !H_MV
170  Void  printOutSummary      ( UInt uiNumAllPicCoded );
171#endif
172#if H_3D_VSO
173  Void  preLoopFilterPicAll  ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits );
174#else
175  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
176#endif
177 
178  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
179  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
180  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
181protected:
182  TEncRateCtrl* getRateCtrl()       { return m_pcRateCtrl;  }
183
184protected:
185  Void  xInitGOP          ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut );
186  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr );
187 
188  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
189#if H_3D_VSO
190  Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
191#else 
192  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
193#endif
194
195  Double xCalculateRVM();
196
197  SEIActiveParameterSets* xCreateSEIActiveParameterSets (TComSPS *sps);
198  SEIFramePacking*        xCreateSEIFramePacking();
199  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
200
201#if J0149_TONE_MAPPING_SEI
202  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
203#endif
204
205  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
206#if L0045_NON_NESTED_SEI_RESTRICTIONS
207  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
208  Void xResetNonNestedSEIPresentFlags()
209  {
210    m_activeParameterSetSEIPresentInAU = false;
211    m_bufferingPeriodSEIPresentInAU    = false;
212    m_pictureTimingSEIPresentInAU      = false;
213  }
214#if K0180_SCALABLE_NESTING_SEI
215  Void xResetNestedSEIPresentFlags()
216  {
217    m_nestedBufferingPeriodSEIPresentInAU    = false;
218    m_nestedPictureTimingSEIPresentInAU      = false;
219  }
220#endif
221#endif
222#if H_MV
223   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
224#endif
225#if L0386_DB_METRIC
226  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
227#endif
228};// END CLASS DEFINITION TEncGOP
229
230// ====================================================================================================================
231// Enumeration
232// ====================================================================================================================
233enum PROCESSING_STATE
234{
235  EXECUTE_INLOOPFILTER,
236  ENCODE_SLICE
237};
238
239enum SCALING_LIST_PARAMETER
240{
241  SCALING_LIST_OFF,
242  SCALING_LIST_DEFAULT,
243  SCALING_LIST_FILE_READ
244};
245
246//! \}
247
248#endif // __TENCGOP__
249
Note: See TracBrowser for help on using the repository browser.