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 TEncPic.h |
---|
37 | \brief GOP encoder class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TEncPic__ |
---|
41 | #define __TEncPic__ |
---|
42 | |
---|
43 | #include <stdlib.h> |
---|
44 | |
---|
45 | #include "../TLibCommon/TComList.h" |
---|
46 | #include "../TLibCommon/TComPic.h" |
---|
47 | #include "../TLibCommon/TComBitStream.h" |
---|
48 | #include "../TLibCommon/TComBitCounter.h" |
---|
49 | #include "../TLibCommon/TComLoopFilter.h" |
---|
50 | #include "../TLibCommon/TComDepthMapGenerator.h" |
---|
51 | #include "../TLibCommon/TComResidualGenerator.h" |
---|
52 | #include "TEncAdaptiveLoopFilter.h" |
---|
53 | #include "TEncSlice.h" |
---|
54 | #include "TEncEntropy.h" |
---|
55 | #include "TEncCavlc.h" |
---|
56 | #include "TEncSbac.h" |
---|
57 | |
---|
58 | #include "TEncAnalyze.h" |
---|
59 | |
---|
60 | #ifdef WEIGHT_PRED |
---|
61 | #include "WeightPredAnalysis.h" |
---|
62 | #endif |
---|
63 | |
---|
64 | #if RVM_VCEGAM10 |
---|
65 | #include <vector> |
---|
66 | #endif |
---|
67 | |
---|
68 | class TEncTop; |
---|
69 | |
---|
70 | // ==================================================================================================================== |
---|
71 | // Class definition |
---|
72 | // ==================================================================================================================== |
---|
73 | |
---|
74 | /// GOP encoder class |
---|
75 | class TEncPic |
---|
76 | { |
---|
77 | private: |
---|
78 | // Data |
---|
79 | Int m_iHrchDepth; |
---|
80 | |
---|
81 | // Access channel |
---|
82 | TEncTop* m_pcEncTop; |
---|
83 | TEncCfg* m_pcCfg; |
---|
84 | TEncSlice* m_pcSliceEncoder; |
---|
85 | TComList<TComPic*>* m_pcListPic; |
---|
86 | |
---|
87 | TEncEntropy* m_pcEntropyCoder; |
---|
88 | TEncCavlc* m_pcCavlcCoder; |
---|
89 | TEncSbac* m_pcSbacCoder; |
---|
90 | TEncBinCABAC* m_pcBinCABAC; |
---|
91 | TComLoopFilter* m_pcLoopFilter; |
---|
92 | #if DEPTH_MAP_GENERATION |
---|
93 | TComDepthMapGenerator* m_pcDepthMapGenerator; |
---|
94 | #endif |
---|
95 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
96 | TComResidualGenerator* m_pcResidualGenerator; |
---|
97 | #endif |
---|
98 | |
---|
99 | // Adaptive Loop filter |
---|
100 | TEncAdaptiveLoopFilter* m_pcAdaptiveLoopFilter; |
---|
101 | //--Adaptive Loop filter |
---|
102 | #if MTK_SAO |
---|
103 | TEncSampleAdaptiveOffset* m_pcSAO; |
---|
104 | #endif |
---|
105 | TComBitCounter* m_pcBitCounter; |
---|
106 | |
---|
107 | TComRdCost* m_pcRdCost; ///< RD cost computation |
---|
108 | |
---|
109 | #if DCM_DECODING_REFRESH |
---|
110 | // clean decoding refresh |
---|
111 | Bool m_bRefreshPending; |
---|
112 | UInt m_uiPOCCDR; |
---|
113 | #endif |
---|
114 | UInt* m_uiStoredStartCUAddrForEncodingSlice; |
---|
115 | UInt* m_uiStoredStartCUAddrForEncodingEntropySlice; |
---|
116 | |
---|
117 | // #if MTK_NONCROSS_INLOOP_FILTER |
---|
118 | // UInt m_uiILSliceCount; |
---|
119 | // UInt* m_puiILSliceStartLCU; |
---|
120 | // UInt* m_puiILSliceEndLCU; |
---|
121 | // #endif |
---|
122 | |
---|
123 | #if RVM_VCEGAM10 |
---|
124 | std::vector<Int> m_vRVM_RP; |
---|
125 | #endif |
---|
126 | |
---|
127 | public: |
---|
128 | TEncPic(); |
---|
129 | virtual ~TEncPic(); |
---|
130 | |
---|
131 | Void create ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight ); |
---|
132 | Void destroy (); |
---|
133 | |
---|
134 | Void init ( TEncTop* pcTEncTop ); |
---|
135 | Void compressPic( TComBitstream* pcBitstreamOut, TComPicYuv cPicOrg, TComPic* pcPic, TComPicYuv* pcPicYuvRecOut, |
---|
136 | TComPic* pcOrgRefList[2][MAX_REF_PIC_NUM], Bool& rbSeqFirst, TComList<TComPic*>& rcListPic ); |
---|
137 | TComList<TComPic*>* getListPic() { return m_pcListPic; } |
---|
138 | |
---|
139 | Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); |
---|
140 | |
---|
141 | |
---|
142 | protected: |
---|
143 | #if DCM_DECODING_REFRESH |
---|
144 | NalUnitType getNalUnitType( UInt uiPOCCurr ); |
---|
145 | #endif |
---|
146 | |
---|
147 | Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, UInt uiBits, Double dEncTime ); |
---|
148 | |
---|
149 | UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); |
---|
150 | |
---|
151 | #if RVM_VCEGAM10 |
---|
152 | Double xCalculateRVM(); |
---|
153 | #endif |
---|
154 | };// END CLASS DEFINITION TEncPic |
---|
155 | |
---|
156 | |
---|
157 | #endif // __TEncPic__ |
---|
158 | |
---|