HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TEncSlice.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-2017, 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 __TENCSLICE__
39 #define __TENCSLICE__
40 
41 // Include files
42 #include "TLibCommon/CommonDef.h"
43 #include "TLibCommon/TComList.h"
44 #include "TLibCommon/TComPic.h"
45 #include "TLibCommon/TComPicYuv.h"
46 #include "TEncCu.h"
47 #include "WeightPredAnalysis.h"
48 #include "TEncRateCtrl.h"
49 
52 
53 class TEncTop;
54 class TEncGOP;
55 
56 // ====================================================================================================================
57 // Class definition
58 // ====================================================================================================================
59 
61 class TEncSlice
62  : public WeightPredAnalysis
63 {
64 private:
65  // encoder configuration
67 
68  // pictures
72 
73  // processing units
76 
77  // encoder search
79 
80  // coding tools
85 
86  // RD optimization
93  std::vector<Double> m_vdRdPicLambda;
94  std::vector<Double> m_vdRdPicQp;
95  std::vector<Int> m_viRdPicQp;
102 
103  Double calculateLambda( const TComSlice* pSlice, const Int GOPid, const Int depth, const Double refQP, const Double dQP, Int &iQP );
104  Void setUpLambda(TComSlice* slice, const Double dLambda, Int iQP);
105  Void calculateBoundingCtuTsAddrForSlice(UInt &startCtuTSAddrSlice, UInt &boundingCtuTSAddrSlice, Bool &haveReachedTileBoundary, TComPic* pcPic, const Int sliceMode, const Int sliceArgument);
106 
107 public:
108  TEncSlice();
109  virtual ~TEncSlice();
110 
111  Void create ( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
112  Void destroy ();
113  Void init ( TEncTop* pcEncTop );
114 
116  Void initEncSlice ( TComPic* pcPic, const Int pocLast, const Int pocCurr,
117  const Int iGOPid, TComSlice*& rpcSlice, const Bool isField );
118  Void resetQP ( TComPic* pic, Int sliceQP, Double lambda );
119  Void setGopID( Int iGopID ) { m_gopID = iGopID; }
120  Int getGopID() const { return m_gopID; }
121  Void updateLambda(TComSlice* pSlice, Double dQP);
122 
123  // compress and encode slice
124  Void precompressSlice ( TComPic* pcPic );
125  Void compressSlice ( TComPic* pcPic, const Bool bCompressEntireSlice, const Bool bFastDeltaQP );
126  Void calCostSliceI ( TComPic* pcPic );
127  Void encodeSlice ( TComPic* pcPic, TComOutputBitstream* pcSubstreams, UInt &numBinsCoded );
128 
129  // misc. functions
130  Void setSearchRange ( TComSlice* pcSlice );
131 
133  Void xDetermineStartAndBoundingCtuTsAddr ( UInt& startCtuTsAddr, UInt& boundingCtuTsAddr, TComPic* pcPic );
136 
138 
139 private:
141 };
142 
144 
145 #endif // __TENCSLICE__
Void encodeSlice(TComPic *pcPic, TComOutputBitstream *pcSubstreams, UInt &numBinsCoded)
Definition: TEncSlice.cpp:985
SliceType
supported slice type
Definition: TypeDef.h:283
picture YUV buffer class
Definition: TComPicYuv.h:55
TEncGOP * m_pcGOPEncoder
GOP encoder.
Definition: TEncSlice.h:74
Void setUpLambda(TComSlice *slice, const Double dLambda, Int iQP)
Definition: TEncSlice.cpp:113
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
Defines version information, constants and small in-line functions.
TEncSbac * m_pcRDGoOnSbacCoder
go-on SBAC encoder
Definition: TEncSlice.h:89
void Void
Definition: TypeDef.h:203
Void init(TEncTop *pcEncTop)
Definition: TEncSlice.cpp:79
UInt64 m_uiPicTotalBits
total bits for the picture
Definition: TEncSlice.h:90
Coding Unit (CU) encoder class (header)
TEncCu * getCUEncoder()
CU encoder.
Definition: TEncSlice.h:132
TEncSbac *** m_pppcRDSbacCoder
storage for SBAC-based RD optimization
Definition: TEncSlice.h:88
unsigned int UInt
Definition: TypeDef.h:212
Int getGopID() const
Definition: TEncSlice.h:120
Void initEncSlice(TComPic *pcPic, const Int pocLast, const Int pocCurr, const Int iGOPid, TComSlice *&rpcSlice, const Bool isField)
preparation of slice encoding (reference marking, QP and lambda)
Definition: TEncSlice.cpp:159
SliceType m_encCABACTableIdx
Definition: TEncSlice.h:100
encoder search class
Definition: TEncSearch.h:68
picture class (header)
Double calculateLambda(const TComSlice *pSlice, const Int GOPid, const Int depth, const Double refQP, const Double dQP, Int &iQP)
Definition: TEncSlice.cpp:433
TEncCu * m_pcCuEncoder
CU encoder.
Definition: TEncSlice.h:75
TEncSbac * m_pcSbacCoder
SBAC encoder.
Definition: TEncSlice.h:82
TEncSearch * m_pcPredSearch
encoder search class
Definition: TEncSlice.h:78
TEncBinCABAC * m_pcBinCABAC
Bin encoder CABAC.
Definition: TEncSlice.h:83
UInt getSliceIdx()
Definition: TEncSlice.h:134
Void precompressSlice(TComPic *pcPic)
precompress slice for multi-loop slice-level QP opt.
Definition: TEncSlice.cpp:572
Void calCostSliceI(TComPic *pcPic)
Definition: TEncSlice.cpp:663
Void create(Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth)
Definition: TEncSlice.cpp:59
UInt m_uiSliceIdx
Definition: TEncSlice.h:97
Void calculateBoundingCtuTsAddrForSlice(UInt &startCtuTSAddrSlice, UInt &boundingCtuTSAddrSlice, Bool &haveReachedTileBoundary, TComPic *pcPic, const Int sliceMode, const Int sliceArgument)
Definition: TEncSlice.cpp:1173
slice encoder class
Definition: TEncSlice.h:61
std::vector< Int > m_viRdPicQp
array of picture QP candidates (Int-type)
Definition: TEncSlice.h:95
general list class (header)
bool Bool
Definition: TypeDef.h:204
TComRdCost * m_pcRdCost
RD cost computation.
Definition: TEncSlice.h:87
UInt64 m_uiPicDist
total distortion for the picture
Definition: TEncSlice.h:91
RD cost computation class.
Definition: TComRdCost.h:111
entropy encoder class
Definition: TEncEntropy.h:116
TEncEntropy * m_pcEntropyCoder
entropy encoder
Definition: TEncSlice.h:81
TComPicYuv m_picYuvPred
prediction picture buffer
Definition: TEncSlice.h:70
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:292
Void updateLambda(TComSlice *pSlice, Double dQP)
Definition: TEncSlice.cpp:104
unsigned char UChar
Definition: TypeDef.h:208
Void setSliceIdx(UInt i)
Definition: TEncSlice.h:135
virtual ~TEncSlice()
Definition: TEncSlice.cpp:54
TEncSbac m_lastSliceSegmentEndContextState
context storage for state at the end of the previous slice-segment (used for dependent slices only)...
Definition: TEncSlice.h:98
std::vector< Double > m_vdRdPicQp
array of picture QP candidates (double-type for lambda)
Definition: TEncSlice.h:94
Void setGopID(Int iGopID)
Definition: TEncSlice.h:119
picture YUV buffer class (header)
unsigned long long UInt64
Definition: TypeDef.h:233
SliceType getEncCABACTableIdx() const
Definition: TEncSlice.h:137
weighted prediction encoder class
transform and quantization class
Definition: TComTrQuant.h:98
Void setSearchRange(TComSlice *pcSlice)
set ME range adaptively
Definition: TEncSlice.cpp:546
Int m_gopID
Definition: TEncSlice.h:101
TComTrQuant * m_pcTrQuant
transform &amp; quantization
Definition: TEncSlice.h:84
Void destroy()
Definition: TEncSlice.cpp:68
int Int
Definition: TypeDef.h:211
encoder class
Definition: TEncTop.h:68
Rate control manager class.
TEncCfg * m_pcCfg
encoder configuration class
Definition: TEncSlice.h:66
CU encoder class.
Definition: TEncCu.h:65
Void xDetermineStartAndBoundingCtuTsAddr(UInt &startCtuTsAddr, UInt &boundingCtuTsAddr, TComPic *pcPic)
Definition: TEncSlice.cpp:1266
Void resetQP(TComPic *pic, Int sliceQP, Double lambda)
Definition: TEncSlice.cpp:529
Double m_dPicRdCost
picture-level RD cost
Definition: TEncSlice.h:92
encoder configuration class
Definition: TEncCfg.h:111
SBAC encoder class.
Definition: TEncSbac.h:66
double Double
Definition: TypeDef.h:213
std::vector< Double > m_vdRdPicLambda
array of lambda candidates
Definition: TEncSlice.h:93
Void compressSlice(TComPic *pcPic, const Bool bCompressEntireSlice, const Bool bFastDeltaQP)
analysis stage of slice
Definition: TEncSlice.cpp:698
slice header class
Definition: TComSlice.h:1225
TEncRateCtrl * m_pcRateCtrl
Rate control manager.
Definition: TEncSlice.h:96
TComPicYuv m_picYuvResi
residual picture buffer
Definition: TEncSlice.h:71
TEncSbac m_entropyCodingSyncContextState
context storate for state of contexts at the wavefront/WPP/entropy-coding-sync second CTU of tile-row...
Definition: TEncSlice.h:99
TComList< TComPic * > * m_pcListPic
list of pictures
Definition: TEncSlice.h:69
Double xGetQPValueAccordingToLambda(Double lambda)
Definition: TEncSlice.cpp:1297