source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComPic.cpp @ 5

Last change on this file since 5 was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 9.0 KB
Line 
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     TComPic.cpp
37    \brief    picture class
38*/
39
40#include "TComPic.h"
41#include "SEI.h"
42
43// ====================================================================================================================
44// Constructor / destructor / create / destroy
45// ====================================================================================================================
46
47TComPic::TComPic()
48{
49  m_apcPicSym         = NULL;
50  m_apcPicYuv[0]      = NULL;
51  m_apcPicYuv[1]      = NULL;
52#if DEPTH_MAP_GENERATION
53  m_pcPredDepthMap    = NULL;
54#endif
55#if HHI_INTER_VIEW_MOTION_PRED
56  m_pcOrgDepthMap     = NULL;
57#endif
58#if HHI_INTER_VIEW_RESIDUAL_PRED
59  m_pcResidual        = NULL;
60#endif
61  m_pcPicYuvPred      = NULL;
62  m_pcPicYuvResi      = NULL;
63#if HHI_INTERVIEW_SKIP
64  m_pcUsedPelsMap     = NULL;
65#endif
66 
67#if PARALLEL_MERGED_DEBLK
68  m_pcPicYuvDeblkBuf     = NULL;
69#endif
70
71  m_bReconstructed    = false;
72
73  m_aiNumRefIdx[0]    = 0;
74  m_aiNumRefIdx[1]    = 0;
75
76  m_iViewIdx          = 0;
77  m_aaiCodedScale     = 0;
78  m_aaiCodedOffset    = 0;
79}
80
81TComPic::~TComPic()
82{
83}
84
85Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth )
86{
87  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
88  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
89
90  /* there are no SEI messages associated with this picture initially */
91  m_SEIs = NULL;
92
93  return;
94}
95
96Void TComPic::destroy()
97{
98  if (m_apcPicSym)
99  {
100    m_apcPicSym->destroy();
101    delete m_apcPicSym;
102    m_apcPicSym = NULL;
103  }
104 
105  if (m_apcPicYuv[0])
106  {
107    m_apcPicYuv[0]->destroy();
108    delete m_apcPicYuv[0];
109    m_apcPicYuv[0]  = NULL;
110  }
111 
112  if (m_apcPicYuv[1])
113  {
114    m_apcPicYuv[1]->destroy();
115    delete m_apcPicYuv[1];
116    m_apcPicYuv[1]  = NULL;
117  }
118 
119#if DEPTH_MAP_GENERATION
120  if( m_pcPredDepthMap )
121  {
122    m_pcPredDepthMap->destroy();
123    delete m_pcPredDepthMap;
124    m_pcPredDepthMap = NULL;
125  }
126#endif
127
128#if HHI_INTER_VIEW_MOTION_PRED
129  if( m_pcOrgDepthMap )
130  {
131    m_pcOrgDepthMap->destroy();
132    delete m_pcOrgDepthMap;
133    m_pcOrgDepthMap = NULL;
134  }
135#endif
136
137#if HHI_INTER_VIEW_RESIDUAL_PRED
138  if( m_pcResidual )
139  {
140    m_pcResidual->destroy();
141    delete m_pcResidual;
142    m_pcResidual = NULL;
143  }
144#endif
145
146#if HHI_INTERVIEW_SKIP
147  if( m_pcUsedPelsMap )
148  {
149    m_pcUsedPelsMap->destroy();
150    delete m_pcUsedPelsMap;
151    m_pcUsedPelsMap = NULL;
152  }
153#endif
154
155#if PARALLEL_MERGED_DEBLK
156  if (m_pcPicYuvDeblkBuf)
157  {
158    m_pcPicYuvDeblkBuf->destroy();
159    delete m_pcPicYuvDeblkBuf;
160    m_pcPicYuvDeblkBuf  = NULL;
161  }
162#endif
163
164  delete m_SEIs;
165}
166
167#if AMVP_BUFFERCOMPRESS
168Void TComPic::compressMotion()
169{
170  TComPicSym* pPicSym = getPicSym(); 
171  for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getFrameHeightInCU()*pPicSym->getFrameWidthInCU(); uiCUAddr++ )
172  {
173    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
174    pcCU->compressMV(); 
175  } 
176}
177#endif
178
179
180
181Void
182TComPic::addOriginalBuffer()
183{
184  AOT( m_apcPicYuv[0] );
185  AOF( m_apcPicYuv[1] );
186  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
187  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
188  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
189  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
190  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
191  m_apcPicYuv[0]      = new TComPicYuv;
192  m_apcPicYuv[0]      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
193}
194
195#if PARALLEL_MERGED_DEBLK
196Void
197TComPic::addDeblockBuffer()
198{
199  AOT( m_pcPicYuvDeblkBuf );
200  AOF( m_apcPicYuv[1]     );
201  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
202  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
203  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
204  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
205  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
206  m_pcPicYuvDeblkBuf  = new TComPicYuv;
207  m_pcPicYuvDeblkBuf  ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
208}
209#endif
210
211#if DEPTH_MAP_GENERATION
212Void
213TComPic::addPrdDepthMapBuffer()
214{
215  AOT( m_pcPredDepthMap );
216  AOF( m_apcPicYuv[1]   );
217  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
218  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
219  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
220  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
221  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
222  m_pcPredDepthMap    = new TComPicYuv;
223  m_pcPredDepthMap    ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
224}
225#endif
226
227#if HHI_INTER_VIEW_MOTION_PRED
228Void
229TComPic::addOrgDepthMapBuffer()
230{
231  AOT( m_pcOrgDepthMap );
232  AOF( m_apcPicYuv[1]  );
233  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
234  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
235  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
236  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
237  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
238  m_pcOrgDepthMap     = new TComPicYuv;
239  m_pcOrgDepthMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
240}
241#endif
242
243#if HHI_INTER_VIEW_RESIDUAL_PRED
244Void
245TComPic::addResidualBuffer()
246{
247  AOT( m_pcResidual   );
248  AOF( m_apcPicYuv[1] );
249  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
250  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
251  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
252  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
253  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
254  m_pcResidual        = new TComPicYuv;
255  m_pcResidual        ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
256}
257#endif
258
259#if HHI_INTERVIEW_SKIP
260Void
261TComPic::addUsedPelsMapBuffer()
262{
263  AOT( m_pcUsedPelsMap );
264  AOF( m_apcPicYuv[1]  );
265  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
266  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
267  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
268  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
269  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
270  m_pcUsedPelsMap     = new TComPicYuv;
271  m_pcUsedPelsMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
272}
273#endif
274
275Void
276TComPic::removeOriginalBuffer()
277{
278  if( m_apcPicYuv[0] )
279  {
280    m_apcPicYuv[0]->destroy();
281    delete m_apcPicYuv[0];
282    m_apcPicYuv[0]  = NULL;
283  }
284}
285
286#if PARALLEL_MERGED_DEBLK
287Void
288TComPic::removeDeblockBuffer()
289{
290  if( m_pcPicYuvDeblkBuf )
291  {
292    m_pcPicYuvDeblkBuf->destroy();
293    delete m_pcPicYuvDeblkBuf;
294    m_pcPicYuvDeblkBuf  = NULL;
295  }
296}
297#endif
298
299#if DEPTH_MAP_GENERATION
300Void
301TComPic::removePrdDepthMapBuffer()
302{
303  if( m_pcPredDepthMap )
304  {
305    m_pcPredDepthMap->destroy();
306    delete m_pcPredDepthMap;
307    m_pcPredDepthMap = NULL;
308  }
309}
310#endif
311
312#if HHI_INTER_VIEW_MOTION_PRED
313Void
314TComPic::removeOrgDepthMapBuffer()
315{
316  if( m_pcOrgDepthMap )
317  {
318    m_pcOrgDepthMap->destroy();
319    delete m_pcOrgDepthMap;
320    m_pcOrgDepthMap = NULL;
321  }
322}
323#endif
324
325#if HHI_INTER_VIEW_RESIDUAL_PRED
326Void
327TComPic::removeResidualBuffer()
328{
329  if( m_pcResidual )
330  {
331    m_pcResidual->destroy();
332    delete m_pcResidual;
333    m_pcResidual = NULL;
334  }
335}
336#endif
337
338#if HHI_INTERVIEW_SKIP
339Void
340TComPic::removeUsedPelsMapBuffer()
341{
342  if( m_pcUsedPelsMap )
343  {
344    m_pcUsedPelsMap->destroy();
345    delete m_pcUsedPelsMap;
346    m_pcUsedPelsMap = NULL;
347  }
348}
349#endif
350
Note: See TracBrowser for help on using the repository browser.