1 | |
---|
2 | |
---|
3 | /** \file TEncSlice.h |
---|
4 | \brief slice encoder class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TENCSLICE__ |
---|
8 | #define __TENCSLICE__ |
---|
9 | |
---|
10 | // Include files |
---|
11 | #include "../TLibCommon/CommonDef.h" |
---|
12 | #include "../TLibCommon/TComList.h" |
---|
13 | #include "../TLibCommon/TComPic.h" |
---|
14 | #include "../TLibCommon/TComPicYuv.h" |
---|
15 | #include "TEncCu.h" |
---|
16 | #ifdef WEIGHT_PRED |
---|
17 | #include "WeightPredAnalysis.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | class TEncTop; |
---|
21 | class TEncPic; |
---|
22 | |
---|
23 | // ==================================================================================================================== |
---|
24 | // Class definition |
---|
25 | // ==================================================================================================================== |
---|
26 | |
---|
27 | /// slice encoder class |
---|
28 | class TEncSlice |
---|
29 | #ifdef WEIGHT_PRED |
---|
30 | : public WeightPredAnalysis |
---|
31 | #endif |
---|
32 | { |
---|
33 | private: |
---|
34 | // encoder configuration |
---|
35 | TEncCfg* m_pcCfg; ///< encoder configuration class |
---|
36 | |
---|
37 | // pictures |
---|
38 | TComList<TComPic*>* m_pcListPic; ///< list of pictures |
---|
39 | TComPicYuv* m_apcPicYuvPred; ///< prediction picture buffer |
---|
40 | TComPicYuv* m_apcPicYuvResi; ///< residual picture buffer |
---|
41 | |
---|
42 | // processing units |
---|
43 | TEncPic* m_pcPicEncoder; ///< Pic encoder |
---|
44 | TEncCu* m_pcCuEncoder; ///< CU encoder |
---|
45 | |
---|
46 | // encoder search |
---|
47 | TEncSearch* m_pcPredSearch; ///< encoder search class |
---|
48 | |
---|
49 | // coding tools |
---|
50 | TEncEntropy* m_pcEntropyCoder; ///< entropy encoder |
---|
51 | TEncCavlc* m_pcCavlcCoder; ///< CAVLC encoder |
---|
52 | TEncSbac* m_pcSbacCoder; ///< SBAC encoder |
---|
53 | TEncBinCABAC* m_pcBinCABAC; ///< Bin encoder CABAC |
---|
54 | TComTrQuant* m_pcTrQuant; ///< transform & quantization |
---|
55 | |
---|
56 | // RD optimization |
---|
57 | TComBitCounter* m_pcBitCounter; ///< bit counter |
---|
58 | TComRdCost* m_pcRdCost; ///< RD cost computation |
---|
59 | TEncSbac*** m_pppcRDSbacCoder; ///< storage for SBAC-based RD optimization |
---|
60 | TEncSbac* m_pcRDGoOnSbacCoder; ///< go-on SBAC encoder |
---|
61 | UInt64 m_uiPicTotalBits; ///< total bits for the picture |
---|
62 | UInt64 m_uiPicDist; ///< total distortion for the picture |
---|
63 | Double m_dPicRdCost; ///< picture-level RD cost |
---|
64 | Double* m_pdRdPicLambda; ///< array of lambda candidates |
---|
65 | Double* m_pdRdPicQp; ///< array of picture QP candidates (double-type for lambda) |
---|
66 | Int* m_piRdPicQp; ///< array of picture QP candidates (int-type) |
---|
67 | |
---|
68 | UInt m_uiSliceIdx; |
---|
69 | public: |
---|
70 | TEncSlice(); |
---|
71 | virtual ~TEncSlice(); |
---|
72 | |
---|
73 | Void create ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ); |
---|
74 | Void destroy (); |
---|
75 | Void init ( TEncTop* pcEncTop ); |
---|
76 | |
---|
77 | /// preparation of slice encoding (reference marking, QP and lambda) |
---|
78 | Void initEncSlice ( TComPic* pcPic, TComSlice*& rpcSlice ); |
---|
79 | |
---|
80 | // compress and encode slice |
---|
81 | Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. |
---|
82 | Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice |
---|
83 | Void encodeSlice ( TComPic*& rpcPic, TComBitstream*& rpcBitstream ); ///< entropy coding of slice |
---|
84 | |
---|
85 | // misc. functions |
---|
86 | Void setSearchRange ( TComSlice* pcSlice ); ///< set ME range adaptively |
---|
87 | UInt64 getTotalBits () { return m_uiPicTotalBits; } |
---|
88 | |
---|
89 | TEncCu* getCUEncoder() { return m_pcCuEncoder; } ///< CU encoder |
---|
90 | Void xDetermineStartAndBoundingCUAddr ( UInt& uiStartCUAddr, UInt& uiBoundingCUAddr, TComPic*& rpcPic, Bool bEncodeSlice ); |
---|
91 | UInt getSliceIdx() { return m_uiSliceIdx; } |
---|
92 | Void setSliceIdx(UInt i) { m_uiSliceIdx = i; } |
---|
93 | }; |
---|
94 | |
---|
95 | |
---|
96 | #endif // __TENCSLICE__ |
---|
97 | |
---|