1 | |
---|
2 | |
---|
3 | /** \file TComPic.cpp |
---|
4 | \brief picture class |
---|
5 | */ |
---|
6 | |
---|
7 | #include "TComPic.h" |
---|
8 | #include "SEI.h" |
---|
9 | |
---|
10 | // ==================================================================================================================== |
---|
11 | // Constructor / destructor / create / destroy |
---|
12 | // ==================================================================================================================== |
---|
13 | |
---|
14 | TComPic::TComPic() |
---|
15 | { |
---|
16 | m_apcPicSym = NULL; |
---|
17 | m_apcPicYuv[0] = NULL; |
---|
18 | m_apcPicYuv[1] = NULL; |
---|
19 | m_pcPredDepthMap = NULL; |
---|
20 | m_pcOrgDepthMap = NULL; |
---|
21 | m_pcResidual = NULL; |
---|
22 | m_pcPicYuvPred = NULL; |
---|
23 | m_pcPicYuvResi = NULL; |
---|
24 | m_pcUsedPelsMap = NULL; |
---|
25 | |
---|
26 | #if PARALLEL_MERGED_DEBLK |
---|
27 | m_pcPicYuvDeblkBuf = NULL; |
---|
28 | #endif |
---|
29 | |
---|
30 | m_bReconstructed = false; |
---|
31 | |
---|
32 | m_aiNumRefIdx[0] = 0; |
---|
33 | m_aiNumRefIdx[1] = 0; |
---|
34 | |
---|
35 | m_iViewIdx = 0; |
---|
36 | m_aaiCodedScale = 0; |
---|
37 | m_aaiCodedOffset = 0; |
---|
38 | } |
---|
39 | |
---|
40 | TComPic::~TComPic() |
---|
41 | { |
---|
42 | } |
---|
43 | |
---|
44 | Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth ) |
---|
45 | { |
---|
46 | m_apcPicSym = new TComPicSym; m_apcPicSym ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth ); |
---|
47 | m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth ); |
---|
48 | |
---|
49 | /* there are no SEI messages associated with this picture initially */ |
---|
50 | m_SEIs = NULL; |
---|
51 | |
---|
52 | return; |
---|
53 | } |
---|
54 | |
---|
55 | Void TComPic::destroy() |
---|
56 | { |
---|
57 | if (m_apcPicSym) |
---|
58 | { |
---|
59 | m_apcPicSym->destroy(); |
---|
60 | delete m_apcPicSym; |
---|
61 | m_apcPicSym = NULL; |
---|
62 | } |
---|
63 | |
---|
64 | if (m_apcPicYuv[0]) |
---|
65 | { |
---|
66 | m_apcPicYuv[0]->destroy(); |
---|
67 | delete m_apcPicYuv[0]; |
---|
68 | m_apcPicYuv[0] = NULL; |
---|
69 | } |
---|
70 | |
---|
71 | if (m_apcPicYuv[1]) |
---|
72 | { |
---|
73 | m_apcPicYuv[1]->destroy(); |
---|
74 | delete m_apcPicYuv[1]; |
---|
75 | m_apcPicYuv[1] = NULL; |
---|
76 | } |
---|
77 | |
---|
78 | if( m_pcPredDepthMap ) |
---|
79 | { |
---|
80 | m_pcPredDepthMap->destroy(); |
---|
81 | delete m_pcPredDepthMap; |
---|
82 | m_pcPredDepthMap = NULL; |
---|
83 | } |
---|
84 | |
---|
85 | if( m_pcOrgDepthMap ) |
---|
86 | { |
---|
87 | m_pcOrgDepthMap->destroy(); |
---|
88 | delete m_pcOrgDepthMap; |
---|
89 | m_pcOrgDepthMap = NULL; |
---|
90 | } |
---|
91 | |
---|
92 | if( m_pcResidual ) |
---|
93 | { |
---|
94 | m_pcResidual->destroy(); |
---|
95 | delete m_pcResidual; |
---|
96 | m_pcResidual = NULL; |
---|
97 | } |
---|
98 | |
---|
99 | if( m_pcUsedPelsMap ) |
---|
100 | { |
---|
101 | m_pcUsedPelsMap->destroy(); |
---|
102 | delete m_pcUsedPelsMap; |
---|
103 | m_pcUsedPelsMap = NULL; |
---|
104 | } |
---|
105 | |
---|
106 | #if PARALLEL_MERGED_DEBLK |
---|
107 | if (m_pcPicYuvDeblkBuf) |
---|
108 | { |
---|
109 | m_pcPicYuvDeblkBuf->destroy(); |
---|
110 | delete m_pcPicYuvDeblkBuf; |
---|
111 | m_pcPicYuvDeblkBuf = NULL; |
---|
112 | } |
---|
113 | #endif |
---|
114 | |
---|
115 | delete m_SEIs; |
---|
116 | } |
---|
117 | |
---|
118 | #if AMVP_BUFFERCOMPRESS |
---|
119 | Void TComPic::compressMotion() |
---|
120 | { |
---|
121 | TComPicSym* pPicSym = getPicSym(); |
---|
122 | for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getFrameHeightInCU()*pPicSym->getFrameWidthInCU(); uiCUAddr++ ) |
---|
123 | { |
---|
124 | TComDataCU* pcCU = pPicSym->getCU(uiCUAddr); |
---|
125 | pcCU->compressMV(); |
---|
126 | } |
---|
127 | } |
---|
128 | #endif |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | Void |
---|
133 | TComPic::addOriginalBuffer() |
---|
134 | { |
---|
135 | AOT( m_apcPicYuv[0] ); |
---|
136 | AOF( m_apcPicYuv[1] ); |
---|
137 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
138 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
139 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
140 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
141 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
142 | m_apcPicYuv[0] = new TComPicYuv; |
---|
143 | m_apcPicYuv[0] ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
144 | } |
---|
145 | |
---|
146 | #if PARALLEL_MERGED_DEBLK |
---|
147 | Void |
---|
148 | TComPic::addDeblockBuffer() |
---|
149 | { |
---|
150 | AOT( m_pcPicYuvDeblkBuf ); |
---|
151 | AOF( m_apcPicYuv[1] ); |
---|
152 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
153 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
154 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
155 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
156 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
157 | m_pcPicYuvDeblkBuf = new TComPicYuv; |
---|
158 | m_pcPicYuvDeblkBuf ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
159 | } |
---|
160 | #endif |
---|
161 | |
---|
162 | Void |
---|
163 | TComPic::addPrdDepthMapBuffer() |
---|
164 | { |
---|
165 | AOT( m_pcPredDepthMap ); |
---|
166 | AOF( m_apcPicYuv[1] ); |
---|
167 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
168 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
169 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
170 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
171 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
172 | m_pcPredDepthMap = new TComPicYuv; |
---|
173 | m_pcPredDepthMap ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
174 | } |
---|
175 | |
---|
176 | Void |
---|
177 | TComPic::addOrgDepthMapBuffer() |
---|
178 | { |
---|
179 | AOT( m_pcOrgDepthMap ); |
---|
180 | AOF( m_apcPicYuv[1] ); |
---|
181 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
182 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
183 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
184 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
185 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
186 | m_pcOrgDepthMap = new TComPicYuv; |
---|
187 | m_pcOrgDepthMap ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
188 | } |
---|
189 | |
---|
190 | Void |
---|
191 | TComPic::addResidualBuffer() |
---|
192 | { |
---|
193 | AOT( m_pcResidual ); |
---|
194 | AOF( m_apcPicYuv[1] ); |
---|
195 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
196 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
197 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
198 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
199 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
200 | m_pcResidual = new TComPicYuv; |
---|
201 | m_pcResidual ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
202 | } |
---|
203 | |
---|
204 | Void |
---|
205 | TComPic::addUsedPelsMapBuffer() |
---|
206 | { |
---|
207 | AOT( m_pcUsedPelsMap ); |
---|
208 | AOF( m_apcPicYuv[1] ); |
---|
209 | Int iWidth = m_apcPicYuv[1]->getWidth (); |
---|
210 | Int iHeight = m_apcPicYuv[1]->getHeight (); |
---|
211 | UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); |
---|
212 | UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); |
---|
213 | UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); |
---|
214 | m_pcUsedPelsMap = new TComPicYuv; |
---|
215 | m_pcUsedPelsMap ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
---|
216 | } |
---|
217 | |
---|
218 | Void |
---|
219 | TComPic::removeOriginalBuffer() |
---|
220 | { |
---|
221 | if( m_apcPicYuv[0] ) |
---|
222 | { |
---|
223 | m_apcPicYuv[0]->destroy(); |
---|
224 | delete m_apcPicYuv[0]; |
---|
225 | m_apcPicYuv[0] = NULL; |
---|
226 | } |
---|
227 | } |
---|
228 | |
---|
229 | #if PARALLEL_MERGED_DEBLK |
---|
230 | Void |
---|
231 | TComPic::removeDeblockBuffer() |
---|
232 | { |
---|
233 | if( m_pcPicYuvDeblkBuf ) |
---|
234 | { |
---|
235 | m_pcPicYuvDeblkBuf->destroy(); |
---|
236 | delete m_pcPicYuvDeblkBuf; |
---|
237 | m_pcPicYuvDeblkBuf = NULL; |
---|
238 | } |
---|
239 | } |
---|
240 | #endif |
---|
241 | |
---|
242 | Void |
---|
243 | TComPic::removePrdDepthMapBuffer() |
---|
244 | { |
---|
245 | if( m_pcPredDepthMap ) |
---|
246 | { |
---|
247 | m_pcPredDepthMap->destroy(); |
---|
248 | delete m_pcPredDepthMap; |
---|
249 | m_pcPredDepthMap = NULL; |
---|
250 | } |
---|
251 | } |
---|
252 | |
---|
253 | Void |
---|
254 | TComPic::removeOrgDepthMapBuffer() |
---|
255 | { |
---|
256 | if( m_pcOrgDepthMap ) |
---|
257 | { |
---|
258 | m_pcOrgDepthMap->destroy(); |
---|
259 | delete m_pcOrgDepthMap; |
---|
260 | m_pcOrgDepthMap = NULL; |
---|
261 | } |
---|
262 | } |
---|
263 | |
---|
264 | Void |
---|
265 | TComPic::removeResidualBuffer() |
---|
266 | { |
---|
267 | if( m_pcResidual ) |
---|
268 | { |
---|
269 | m_pcResidual->destroy(); |
---|
270 | delete m_pcResidual; |
---|
271 | m_pcResidual = NULL; |
---|
272 | } |
---|
273 | } |
---|
274 | |
---|
275 | Void |
---|
276 | TComPic::removeUsedPelsMapBuffer() |
---|
277 | { |
---|
278 | if( m_pcUsedPelsMap ) |
---|
279 | { |
---|
280 | m_pcUsedPelsMap->destroy(); |
---|
281 | delete m_pcUsedPelsMap; |
---|
282 | m_pcUsedPelsMap = NULL; |
---|
283 | } |
---|
284 | } |
---|
285 | |
---|