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-2011, 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 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 | |
---|
34 | |
---|
35 | |
---|
36 | /** \file TEncCU.h |
---|
37 | \brief CU encoder class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TENCCU__ |
---|
41 | #define __TENCCU__ |
---|
42 | |
---|
43 | // Include files |
---|
44 | #include "../TLibCommon/CommonDef.h" |
---|
45 | #include "../TLibCommon/TComYuv.h" |
---|
46 | #include "../TLibCommon/TComPrediction.h" |
---|
47 | #include "../TLibCommon/TComTrQuant.h" |
---|
48 | #include "../TLibCommon/TComBitCounter.h" |
---|
49 | #include "../TLibCommon/TComDataCU.h" |
---|
50 | |
---|
51 | #include "TEncEntropy.h" |
---|
52 | #include "TEncSearch.h" |
---|
53 | |
---|
54 | class TEncTop; |
---|
55 | class TEncSbac; |
---|
56 | class TEncCavlc; |
---|
57 | class TEncSlice; |
---|
58 | |
---|
59 | // ==================================================================================================================== |
---|
60 | // Class definition |
---|
61 | // ==================================================================================================================== |
---|
62 | |
---|
63 | /// CU encoder class |
---|
64 | class TEncCu |
---|
65 | { |
---|
66 | private: |
---|
67 | |
---|
68 | TComDataCU** m_ppcBestCU; ///< Best CUs in each depth |
---|
69 | TComDataCU** m_ppcTempCU; ///< Temporary CUs in each depth |
---|
70 | UChar m_uhTotalDepth; |
---|
71 | |
---|
72 | TComYuv** m_ppcPredYuvBest; ///< Best Prediction Yuv for each depth |
---|
73 | TComYuv** m_ppcResiYuvBest; ///< Best Residual Yuv for each depth |
---|
74 | TComYuv** m_ppcRecoYuvBest; ///< Best Reconstruction Yuv for each depth |
---|
75 | TComYuv** m_ppcPredYuvTemp; ///< Temporary Prediction Yuv for each depth |
---|
76 | TComYuv** m_ppcResiYuvTemp; ///< Temporary Residual Yuv for each depth |
---|
77 | TComYuv** m_ppcRecoYuvTemp; ///< Temporary Reconstruction Yuv for each depth |
---|
78 | TComYuv** m_ppcOrigYuv; ///< Original Yuv for each depth |
---|
79 | TComYuv** m_ppcResPredTmp; ///< Temporary residual prediction for each depth |
---|
80 | #if POZNAN_AVAIL_MAP |
---|
81 | TComYuv** m_ppcAvailYuv; ///< Avaiability map for each depth |
---|
82 | #endif |
---|
83 | #if POZNAN_SYNTH_VIEW |
---|
84 | TComYuv** m_ppcSynthYuv; ///< Synthetized Yuv for each depth |
---|
85 | #endif |
---|
86 | |
---|
87 | // Data : encoder control |
---|
88 | Int m_iQp; ///< Last QP |
---|
89 | |
---|
90 | // Access channel |
---|
91 | TEncCfg* m_pcEncCfg; |
---|
92 | TEncTop* m_pcEncTop; |
---|
93 | TComPrediction* m_pcPrediction; |
---|
94 | TEncSearch* m_pcPredSearch; |
---|
95 | TComTrQuant* m_pcTrQuant; |
---|
96 | TComBitCounter* m_pcBitCounter; |
---|
97 | TComRdCost* m_pcRdCost; |
---|
98 | |
---|
99 | TEncEntropy* m_pcEntropyCoder; |
---|
100 | TEncCavlc* m_pcCavlcCoder; |
---|
101 | TEncSbac* m_pcSbacCoder; |
---|
102 | TEncBinCABAC* m_pcBinCABAC; |
---|
103 | |
---|
104 | // SBAC RD |
---|
105 | TEncSbac*** m_pppcRDSbacCoder; |
---|
106 | TEncSbac* m_pcRDGoOnSbacCoder; |
---|
107 | Bool m_bUseSBACRD; |
---|
108 | |
---|
109 | #if HHI_MPI |
---|
110 | UChar *m_puhDepthSaved; |
---|
111 | UChar *m_puhWidthSaved; |
---|
112 | UChar *m_puhHeightSaved; |
---|
113 | #endif |
---|
114 | |
---|
115 | public: |
---|
116 | /// copy parameters from encoder class |
---|
117 | Void init ( TEncTop* pcEncTop ); |
---|
118 | |
---|
119 | /// create internal buffers |
---|
120 | Void create ( UChar uhTotalDepth, UInt iMaxWidth, UInt iMaxHeight ); |
---|
121 | |
---|
122 | /// destroy internal buffers |
---|
123 | Void destroy (); |
---|
124 | |
---|
125 | /// CU analysis function |
---|
126 | Void compressCU ( TComDataCU*& rpcCU ); |
---|
127 | |
---|
128 | /// CU encoding function |
---|
129 | Void encodeCU ( TComDataCU* pcCU, Bool bForceTerminate = false ); |
---|
130 | |
---|
131 | /// set QP value |
---|
132 | Void setQpLast ( Int iQp ) { m_iQp = iQp; } |
---|
133 | |
---|
134 | protected: |
---|
135 | Void xCompressCU ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth ); |
---|
136 | Void xEncodeCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
137 | |
---|
138 | Void xCheckRDCostAMVPSkip( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); |
---|
139 | |
---|
140 | #if HHI_INTERVIEW_SKIP |
---|
141 | Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ; |
---|
142 | #else |
---|
143 | Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); |
---|
144 | #endif |
---|
145 | |
---|
146 | Void xCheckRDCostSkip ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bBSkipRes ); |
---|
147 | #if HHI_INTERVIEW_SKIP |
---|
148 | Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ; |
---|
149 | #else |
---|
150 | Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); |
---|
151 | #endif |
---|
152 | Void xCheckRDCostIntra ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); |
---|
153 | Void xCheckBestMode ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhDepth ); |
---|
154 | |
---|
155 | Void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); |
---|
156 | Void xCopyYuv2Pic ( TComPic* rpcPic, UInt uiCUAddr, UInt uiAbsZorderIdx, UInt uiDepth ); |
---|
157 | Void xCopyYuv2Tmp ( UInt uhPartUnitIdx, UInt uiDepth ); |
---|
158 | Void xAddMVISignallingBits( TComDataCU* pcCU ); |
---|
159 | #if HHI_MPI |
---|
160 | Void xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall ); |
---|
161 | Void xSaveDepthWidthHeight( TComDataCU* pcCU ); |
---|
162 | Void xRestoreDepthWidthHeight( TComDataCU* pcCU ); |
---|
163 | #endif |
---|
164 | |
---|
165 | #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA |
---|
166 | Void xSaveDBMPData(TComDataCU* pcCU) { pcCU->getSlice()->getMP()->saveDBMPData(pcCU);} |
---|
167 | #endif |
---|
168 | }; |
---|
169 | |
---|
170 | |
---|
171 | #endif // __TENCMB__ |
---|
172 | |
---|