HEVC Test Model (HM)  HM-16.3
TEncGOP.h
Go to the documentation of this file.
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-2015, 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 
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"
49 #include "TLibCommon/AccessUnit.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 
63 
64 class TEncTop;
65 
66 // ====================================================================================================================
67 // Class definition
68 // ====================================================================================================================
69 
70 class TEncGOP
71 {
72 private:
73  // Data
83 #if ALLOW_RECOVERY_POINT_AS_RAP
85 #endif
86 
87  // Access channel
92 
98 
100 
101  //--Adaptive Loop filter
104  // indicate sequence first
106 
107  // clean decoding refresh
112 
113  std::vector<Int> m_vRVM_RP;
124 public:
125  TEncGOP();
126  virtual ~TEncGOP();
127 
128  Void create ();
129  Void destroy ();
130 
131  Void init ( TEncTop* pcTEncTop );
132  Void compressGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec,
133  std::list<AccessUnit>& accessUnitsInGOP, Bool isField, Bool isTff, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
134  Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream* pcBitstreamRedirect);
135 
136 
137  Int getGOPSize() { return m_iGopSize; }
138 
140 
141  Void printOutSummary ( UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE );
142  Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist );
143 
145  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr, Bool isField );
147 
148 protected:
150 
151 protected:
152 
153  Void xInitGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Bool isField );
154  Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, Bool isField );
155 
156  Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
157  Void xCalculateInterlacedAddPSNR( TComPic* pcPicOrgFirstField, TComPic* pcPicOrgSecondField,
158  TComPicYuv* pcPicRecFirstField, TComPicYuv* pcPicRecSecondField,
159  const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
160 
162 
164 
172  SEIChromaSamplingFilterHint* xCreateSEIChromaSamplingFilterHint(Bool bChromaLocInfoPresent, Int iHorFilterIndex, Int iVerFilterIdc);
173 
174  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, const TComSPS *sps, const TComPPS *pps);
175  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
177  {
178  m_activeParameterSetSEIPresentInAU = false;
179  m_bufferingPeriodSEIPresentInAU = false;
180  m_pictureTimingSEIPresentInAU = false;
181  }
183  {
184  m_nestedBufferingPeriodSEIPresentInAU = false;
185  m_nestedPictureTimingSEIPresentInAU = false;
186  }
187  Void applyDeblockingFilterMetric( TComPic* pcPic, UInt uiNumSlices );
188 };// END CLASS DEFINITION TEncGOP
189 
191 
192 #endif // __TENCGOP__
193 
Void xCalculateAddPSNR(TComPic *pcPic, TComPicYuv *pcPicD, const AccessUnit &, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE)
Definition: TEncGOP.cpp:2199
entropy encoder class (header)
TEncSlice * m_pcSliceEncoder
Definition: TEncGOP.h:90
Int m_iNumPicCoded
Definition: TEncGOP.h:81
TEncBinCABAC * m_pcBinCABAC
Definition: TEncGOP.h:96
Void xResetNonNestedSEIPresentFlags()
Definition: TEncGOP.h:176
picture YUV buffer class
Definition: TComPicYuv.h:55
Void xAttachSliceDataToNalUnit(OutputNALUnit &rNalu, TComOutputBitstream *pcBitstreamRedirect)
Definition: TEncGOP.cpp:2526
NalUnitType getNalUnitType(Int pocCurr, Int lastIdr, Bool isField)
Definition: TEncGOP.cpp:2422
encoder analyzer class (header)
deblocking filter (header)
Bool m_ltRefPicUsedByCurrPicFlag[33]
Definition: TEncGOP.h:78
TEncTop * m_pcEncTop
Definition: TEncGOP.h:88
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
Bool m_nestedBufferingPeriodSEIPresentInAU
Definition: TEncGOP.h:122
void Void
Definition: TypeDef.h:285
Void preLoopFilterPicAll(TComPic *pcPic, UInt64 &ruiDist)
Definition: TEncGOP.cpp:2055
Void xResetNestedSEIPresentFlags()
Definition: TEncGOP.h:182
SEIChromaSamplingFilterHint * xCreateSEIChromaSamplingFilterHint(Bool bChromaLocInfoPresent, Int iHorFilterIndex, Int iVerFilterIdc)
Definition: TEncGOP.cpp:353
estimation part of sample adaptive offset class (header)
Void xCalculateInterlacedAddPSNR(TComPic *pcPicOrgFirstField, TComPic *pcPicOrgSecondField, TComPicYuv *pcPicRecFirstField, TComPicYuv *pcPicRecSecondField, const AccessUnit &accessUnit, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE)
Definition: TEncGOP.cpp:2328
SEIDisplayOrientation * xCreateSEIDisplayOrientation()
Definition: TEncGOP.cpp:193
Int m_iLastRecoveryPicPOC
Definition: TEncGOP.h:84
CAVLC encoder class.
Definition: TEncCavlc.h:61
unsigned int UInt
Definition: TypeDef.h:297
Bool m_bLongtermTestPictureHasBeenCoded
Definition: TEncGOP.h:74
Int m_pocCRA
Definition: TEncGOP.h:109
Int getGOPSize()
Definition: TEncGOP.h:137
deblocking filter class
Bool m_nestedPictureTimingSEIPresentInAU
Definition: TEncGOP.h:123
TComList< TComPic * > * m_pcListPic
Definition: TEncGOP.h:91
Bool m_activeParameterSetSEIPresentInAU
Definition: TEncGOP.h:119
TEncGOP()
Definition: TEncGOP.cpp:76
picture class (header)
SEIFramePacking * xCreateSEIFramePacking()
Definition: TEncGOP.cpp:159
SEIToneMappingInfo * xCreateSEIToneMappingInfo()
Definition: TEncGOP.cpp:202
TComLoopFilter * m_pcLoopFilter
Definition: TEncGOP.h:97
Bool m_bSeqFirst
Definition: TEncGOP.h:105
TEncCavlc * m_pcCavlcCoder
Definition: TEncGOP.h:94
UInt m_numLongTermRefPicSPS
Definition: TEncGOP.h:76
NalUnitType m_associatedIRAPType
Definition: TEncGOP.h:110
Void xGetBuffer(TComList< TComPic * > &rcListPic, TComList< TComPicYuv * > &rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic *&rpcPic, TComPicYuv *&rpcPicYuvRecOut, Int pocCurr, Bool isField)
Definition: TEncGOP.cpp:2090
slice encoder class
Definition: TEncSlice.h:61
Void destroy()
Definition: TEncGOP.cpp:123
Void create()
Definition: TEncGOP.cpp:117
general list class (header)
SEIActiveParameterSets * xCreateSEIActiveParameterSets(const TComSPS *sps)
Definition: TEncGOP.cpp:147
UInt m_tl0Idx
Definition: TEncGOP.h:117
bool Bool
Definition: TypeDef.h:286
TEncRateCtrl * getRateCtrl()
Definition: TEncGOP.h:149
Void printOutSummary(UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE)
Definition: TEncGOP.cpp:2002
PPS class.
Definition: TComSlice.h:977
TComList< TComPic * > * getListPic()
Definition: TEncGOP.h:139
entropy encoder class
Definition: TEncEntropy.h:121
slice encoder class (header)
Int xGetFirstSeiLocation(AccessUnit &accessUnit)
Definition: TEncGOP.cpp:2651
Int m_iLastIDR
Definition: TEncGOP.h:79
UInt m_cpbRemovalDelay
Definition: TEncGOP.h:116
UInt m_ltRefPicPocLsbSps[33]
Definition: TEncGOP.h:77
Access Unit class (header)
TEncCfg * m_pcCfg
Definition: TEncGOP.h:89
UInt64 xFindDistortionFrame(TComPicYuv *pcPic0, TComPicYuv *pcPic1)
Definition: TEncGOP.cpp:2134
virtual ~TEncGOP()
Definition: TEncGOP.cpp:111
#define MAX_NUM_LONG_TERM_REF_PICS
Definition: TypeDef.h:215
Void arrangeLongtermPicturesInRPS(TComSlice *, TComList< TComPic * > &)
Definition: TEncGOP.cpp:2544
Void init(TEncTop *pcTEncTop)
Definition: TEncGOP.cpp:127
Int m_iGopSize
Definition: TEncGOP.h:80
UInt m_lastBPSEI
Definition: TEncGOP.h:114
SEIWriter m_seiWriter
Definition: TEncGOP.h:99
InputColourSpaceConversion
Definition: TypeDef.h:376
unsigned long long UInt64
Definition: TypeDef.h:318
Context-adaptive entropy encoder class (header)
Void xCreateLeadingSEIMessages(AccessUnit &accessUnit, const TComSPS *sps, const TComPPS *pps)
Definition: TEncGOP.cpp:406
std::vector< Int > m_vRVM_RP
Definition: TEncGOP.h:113
Bool m_bRefreshPending
Definition: TEncGOP.h:108
Bool m_bLongtermTestPictureHasBeenCoded2
Definition: TEncGOP.h:75
SEIKneeFunctionInfo * xCreateSEIKneeFunctionInfo()
Definition: TEncGOP.cpp:323
int Int
Definition: TypeDef.h:296
TEncSlice * getSliceEncoder()
Definition: TEncGOP.h:144
encoder class
Definition: TEncTop.h:68
Rate control manager class.
Void compressGOP(Int iPOCLast, Int iNumPicRcvd, TComList< TComPic * > &rcListPic, TComList< TComPicYuv * > &rcListPicYuvRec, std::list< AccessUnit > &accessUnitsInGOP, Bool isField, Bool isTff, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE)
Definition: TEncGOP.cpp:528
SEITempMotionConstrainedTileSets * xCreateSEITempMotionConstrainedTileSets(const TComPPS *pps)
Definition: TEncGOP.cpp:291
Double xCalculateRVM()
Definition: TEncGOP.cpp:2474
NalUnitType
Definition: CommonDef.h:218
CAVLC encoder class (header)
encoder configuration class
Definition: TEncCfg.h:99
UInt m_totalCoded
Definition: TEncGOP.h:115
SBAC encoder class.
Definition: TEncSbac.h:66
double Double
Definition: TypeDef.h:298
TEncEntropy * m_pcEntropyCoder
Definition: TEncGOP.h:93
Void applyDeblockingFilterMetric(TComPic *pcPic, UInt uiNumSlices)
Definition: TEncGOP.cpp:2666
TEncRateCtrl * m_pcRateCtrl
Definition: TEncGOP.h:103
Bool m_bufferingPeriodSEIPresentInAU
Definition: TEncGOP.h:120
slice header class
Definition: TComSlice.h:1198
Class for counting bits (header)
TEncSampleAdaptiveOffset * m_pcSAO
Definition: TEncGOP.h:102
Bool m_bFirst
Definition: TEncGOP.h:82
Bool m_pictureTimingSEIPresentInAU
Definition: TEncGOP.h:121
Void xInitGOP(Int iPOCLast, Int iNumPicRcvd, TComList< TComPic * > &rcListPic, TComList< TComPicYuv * > &rcListPicYuvRecOut, Bool isField)
Definition: TEncGOP.cpp:2072
TEncSbac * m_pcSbacCoder
Definition: TEncGOP.h:95
SEISegmentedRectFramePacking * xCreateSEISegmentedRectFramePacking()
Definition: TEncGOP.cpp:184
SPS class.
Definition: TComSlice.h:722
Int m_associatedIRAPPOC
Definition: TEncGOP.h:111
UInt m_rapIdx
Definition: TEncGOP.h:118