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

Last change on this file since 992 was 964, checked in by tech, 11 years ago
  • Merged 11.0-dev0@963. (Update to HM 14.0 + MV-HEVC Draft 8 HLS)
  • Added coding results.
  • Changed version number.
  • Property svn:eol-style set to native
File size: 9.5 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 *
[872]6* Copyright (c) 2010-2014, 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"
[655]59#if KWU_RC_MADPRED_E0227
60#include "../App/TAppEncoder/TAppEncTop.h"
61#endif
[2]62#include <vector>
63
[56]64//! \ingroup TLibEncoder
65//! \{
66
[2]67class TEncTop;
68
69// ====================================================================================================================
70// Class definition
71// ====================================================================================================================
72
73/// GOP encoder class
[56]74class TEncGOP
[2]75{
76private:
77  //  Data
[56]78  Bool                    m_bLongtermTestPictureHasBeenCoded;
79  Bool                    m_bLongtermTestPictureHasBeenCoded2;
[608]80  UInt            m_numLongTermRefPicSPS;
81  UInt            m_ltRefPicPocLsbSps[33];
82  Bool            m_ltRefPicUsedByCurrPicFlag[33];
[56]83  Int                     m_iLastIDR;
84  Int                     m_iGopSize;
85  Int                     m_iNumPicCoded;
86  Bool                    m_bFirst;
[964]87#if ALLOW_RECOVERY_POINT_AS_RAP
88  Int                     m_iLastRecoveryPicPOC;
89#endif
[2]90 
91  //  Access channel
92  TEncTop*                m_pcEncTop;
93  TEncCfg*                m_pcCfg;
94  TEncSlice*              m_pcSliceEncoder;
95  TComList<TComPic*>*     m_pcListPic;
96 
97  TEncEntropy*            m_pcEntropyCoder;
98  TEncCavlc*              m_pcCavlcCoder;
99  TEncSbac*               m_pcSbacCoder;
100  TEncBinCABAC*           m_pcBinCABAC;
101  TComLoopFilter*         m_pcLoopFilter;
[608]102
103  SEIWriter               m_seiWriter;
[56]104 
[608]105#if H_MV
106  TComPicLists*           m_ivPicLists;
[622]107  std::vector<TComPic*>   m_refPicSetInterLayer0; 
108  std::vector<TComPic*>   m_refPicSetInterLayer1; 
[608]109
110  Int                     m_pocLastCoded;
111  Int                     m_layerId; 
112  Int                     m_viewId;
113#if H_3D
114  Int                     m_viewIndex; 
115  Bool                    m_isDepth;
[5]116#endif
117#endif
[2]118  //--Adaptive Loop filter
119  TEncSampleAdaptiveOffset*  m_pcSAO;
120  TComBitCounter*         m_pcBitCounter;
[608]121  TEncRateCtrl*           m_pcRateCtrl;
[56]122  // indicate sequence first
123  Bool                    m_bSeqFirst;
[2]124 
125  // clean decoding refresh
126  Bool                    m_bRefreshPending;
[56]127  Int                     m_pocCRA;
[608]128  std::vector<Int>        m_storedStartCUAddrForEncodingSlice;
129  std::vector<Int>        m_storedStartCUAddrForEncodingSliceSegment;
[872]130#if FIX1172
131  NalUnitType             m_associatedIRAPType;
132  Int                     m_associatedIRAPPOC;
133#endif
[2]134
135  std::vector<Int> m_vRVM_RP;
[608]136  UInt                    m_lastBPSEI;
137  UInt                    m_totalCoded;
138  UInt                    m_cpbRemovalDelay;
139  UInt                    m_tl0Idx;
140  UInt                    m_rapIdx;
141  Bool                    m_activeParameterSetSEIPresentInAU;
142  Bool                    m_bufferingPeriodSEIPresentInAU;
143  Bool                    m_pictureTimingSEIPresentInAU;
144  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
145  Bool                    m_nestedPictureTimingSEIPresentInAU;
[2]146public:
[56]147  TEncGOP();
148  virtual ~TEncGOP();
[2]149 
[608]150  Void  create      ();
[2]151  Void  destroy     ();
152 
153  Void  init        ( TEncTop* pcTEncTop );
[608]154#if H_MV
[56]155  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
[655]156  Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid, Bool isField, Bool isTff  );
[608]157#else
[655]158  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Bool isField, Bool isTff  );
[608]159#endif
160  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
[56]161
[608]162#if H_MV
163  Int       getPocLastCoded  ()                 { return m_pocLastCoded; } 
164  Int       getLayerId       ()                 { return m_layerId;    } 
165  Int       getViewId        ()                 { return m_viewId;    }
166#if H_3D
167  Int       getViewIndex     ()                 { return m_viewIndex;    }
168  Bool      getIsDepth       ()                 { return m_isDepth; }
169#endif
170#endif
171
[56]172  Int   getGOPSize()          { return  m_iGopSize;  }
173 
[2]174  TComList<TComPic*>*   getListPic()      { return m_pcListPic; }
[608]175
176#if !H_MV
[655]177  Void  printOutSummary      ( UInt uiNumAllPicCoded , bool isField);
[608]178#endif
179#if H_3D_VSO
180  Void  preLoopFilterPicAll  ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits );
181#else
[2]182  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
[608]183#endif
[655]184
185#if KWU_RC_MADPRED_E0227
186  TEncTop* getEncTop() { return m_pcEncTop; }
187#endif
188
[56]189  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
[872]190  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr, Bool isField );
[608]191  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
[2]192protected:
[608]193  TEncRateCtrl* getRateCtrl()       { return m_pcRateCtrl;  }
[2]194
[56]195protected:
[872]196
[655]197  Void xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField );
[56]198  Void  xInitGOP          ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut );
[655]199  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, bool isField );
[2]200 
[56]201  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
[655]202  Void  xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime );
203
[608]204#if H_3D_VSO
205  Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
206#else 
[2]207  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
[608]208#endif
[2]209
210  Double xCalculateRVM();
211
[608]212  SEIActiveParameterSets* xCreateSEIActiveParameterSets (TComSPS *sps);
213  SEIFramePacking*        xCreateSEIFramePacking();
214  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
215
216  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
[884]217#if H_MV
[872]218  SEISubBitstreamProperty *xCreateSEISubBitstreamProperty( TComSPS *sps);
219#endif
[608]220
221  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
222  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
223  Void xResetNonNestedSEIPresentFlags()
224  {
225    m_activeParameterSetSEIPresentInAU = false;
226    m_bufferingPeriodSEIPresentInAU    = false;
227    m_pictureTimingSEIPresentInAU      = false;
228  }
229  Void xResetNestedSEIPresentFlags()
230  {
231    m_nestedBufferingPeriodSEIPresentInAU    = false;
232    m_nestedPictureTimingSEIPresentInAU      = false;
233  }
234#if H_MV
[622]235   Void  xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid );
[608]236#endif
237  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
[56]238};// END CLASS DEFINITION TEncGOP
[2]239
[56]240// ====================================================================================================================
241// Enumeration
242// ====================================================================================================================
243enum PROCESSING_STATE
244{
245  EXECUTE_INLOOPFILTER,
246  ENCODE_SLICE
247};
[2]248
[56]249enum SCALING_LIST_PARAMETER
250{
251  SCALING_LIST_OFF,
252  SCALING_LIST_DEFAULT,
253  SCALING_LIST_FILE_READ
254};
255
256//! \}
257
258#endif // __TENCGOP__
259
Note: See TracBrowser for help on using the repository browser.