source: 3DVCSoftware/trunk/source/Lib/TLibEncoder/TEncGOP.h @ 638

Last change on this file since 638 was 622, checked in by tech, 11 years ago

Merged 8.0-dev0@621 (MV-HEVC 5 HLS).

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