source: 3DVCSoftware/branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.cpp @ 193

Last change on this file since 193 was 193, checked in by mitsubishi-htm, 12 years ago

A second release, as planned

  • Migrate to HTM 4.1
  • Move VSP related switches to cfg file instead of #define in the source code
  • A few bug fixes
  • For VC project files, only VC9 file is updated

TODO

  • Migrate to HTM 5.0, to be used as anchor for CE1 toward Geneva meeting
  • Property svn:eol-style set to native
File size: 19.8 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-2012, ITU/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 ITU/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/** \file     TComPic.cpp
35    \brief    picture class
36*/
37
38#include "TComPic.h"
39#include "SEI.h"
40
41//! \ingroup TLibCommon
42//! \{
43
44// ====================================================================================================================
45// Constructor / destructor / create / destroy
46// ====================================================================================================================
47
48TComPic::TComPic()
49{
50  m_uiTLayer          = 0;
51
52  m_apcPicSym         = NULL;
53  m_apcPicYuv[0]      = NULL;
54  m_apcPicYuv[1]      = NULL;
55#if VSP_N
56  m_apcPicYuvAvail     = NULL;
57  m_apcPicYuvSynth     = NULL;
58#endif
59#if DEPTH_MAP_GENERATION
60  m_pcPredDepthMap    = NULL;
61#if PDM_REMOVE_DEPENDENCE
62  m_pcPredDepthMap_temp    = NULL;
63#endif
64#endif
65#if HHI_INTER_VIEW_MOTION_PRED
66  m_pcOrgDepthMap     = NULL;
67#endif
68#if HHI_INTER_VIEW_RESIDUAL_PRED
69  m_pcResidual        = NULL;
70#endif
71  m_pcPicYuvPred      = NULL;
72  m_pcPicYuvResi      = NULL;
73  m_bIsLongTerm       = false;
74  m_bReconstructed    = false;
75  m_usedForTMVP       = true;
76  m_bNeededForOutput  = false;
77  m_pSliceSUMap       = NULL;
78  m_uiCurrSliceIdx    = 0; 
79#if HHI_INTERVIEW_SKIP
80  m_pcUsedPelsMap     = NULL;
81#endif
82#if SONY_COLPIC_AVAILABILITY
83  m_iViewOrderIdx     = 0;
84#endif
85  m_aaiCodedScale     = 0;
86  m_aaiCodedOffset    = 0;
87}
88
89TComPic::~TComPic()
90{
91}
92
93Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual )
94{
95  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
96  if (!bIsVirtual)
97  {
98    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
99  }
100  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
101 
102  /* there are no SEI messages associated with this picture initially */
103  m_SEIs = NULL;
104  m_bUsedByCurr = false;
105  return;
106}
107
108Void TComPic::destroy()
109{
110  if (m_apcPicSym)
111  {
112    m_apcPicSym->destroy();
113    delete m_apcPicSym;
114    m_apcPicSym = NULL;
115  }
116 
117  if (m_apcPicYuv[0])
118  {
119    m_apcPicYuv[0]->destroy();
120    delete m_apcPicYuv[0];
121    m_apcPicYuv[0]  = NULL;
122  }
123 
124  if (m_apcPicYuv[1])
125  {
126    m_apcPicYuv[1]->destroy();
127    delete m_apcPicYuv[1];
128    m_apcPicYuv[1]  = NULL;
129  }
130#if HHI_INTERVIEW_SKIP
131  if( m_pcUsedPelsMap )
132  {
133    m_pcUsedPelsMap->destroy();
134    delete m_pcUsedPelsMap;
135    m_pcUsedPelsMap = NULL;
136  }
137#endif
138#if DEPTH_MAP_GENERATION
139  if( m_pcPredDepthMap )
140  {
141    m_pcPredDepthMap->destroy();
142    delete m_pcPredDepthMap;
143    m_pcPredDepthMap = NULL;
144  }
145#if PDM_REMOVE_DEPENDENCE
146  if( m_pcPredDepthMap_temp )         //  estimated depth map
147  {
148    m_pcPredDepthMap_temp->destroy();
149    delete m_pcPredDepthMap_temp;
150    m_pcPredDepthMap_temp = NULL;
151  }                     
152#endif
153#endif
154#if HHI_INTER_VIEW_MOTION_PRED
155  if( m_pcOrgDepthMap )
156  {
157    m_pcOrgDepthMap->destroy();
158    delete m_pcOrgDepthMap;
159    m_pcOrgDepthMap = NULL;
160  }
161#endif
162#if HHI_INTER_VIEW_RESIDUAL_PRED
163  if( m_pcResidual )
164  {
165    m_pcResidual->destroy();
166    delete m_pcResidual;
167    m_pcResidual = NULL;
168  }
169#endif
170  delete m_SEIs;
171}
172
173Void TComPic::compressMotion()
174{
175  TComPicSym* pPicSym = getPicSym(); 
176  for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getFrameHeightInCU()*pPicSym->getFrameWidthInCU(); uiCUAddr++ )
177  {
178    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
179    pcCU->compressMV(); 
180  } 
181}
182
183#if DEPTH_MAP_GENERATION
184Void
185TComPic::addPrdDepthMapBuffer( UInt uiSubSampExpX, UInt uiSubSampExpY )
186{
187  AOT( m_pcPredDepthMap );
188  AOF( m_apcPicYuv[1]   );
189  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
190  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
191  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
192  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
193  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
194  m_pcPredDepthMap    = new TComPicYuv;
195  m_pcPredDepthMap    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
196#if PDM_REMOVE_DEPENDENCE
197  m_pcPredDepthMap_temp    = new TComPicYuv;
198  m_pcPredDepthMap_temp    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
199#endif
200}
201#endif
202
203#if HHI_INTER_VIEW_MOTION_PRED
204Void
205TComPic::addOrgDepthMapBuffer()
206{
207  AOT( m_pcOrgDepthMap );
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_pcOrgDepthMap     = new TComPicYuv;
215  m_pcOrgDepthMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
216}
217#endif
218
219#if HHI_INTER_VIEW_RESIDUAL_PRED
220Void
221TComPic::addResidualBuffer()
222{
223  AOT( m_pcResidual   );
224  AOF( m_apcPicYuv[1] );
225  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
226  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
227  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
228  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
229  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
230  m_pcResidual        = new TComPicYuv;
231  m_pcResidual        ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
232}
233#endif
234
235#if DEPTH_MAP_GENERATION
236Void
237TComPic::removePrdDepthMapBuffer()
238{
239  if( m_pcPredDepthMap )
240  {
241    m_pcPredDepthMap->destroy();
242    delete m_pcPredDepthMap;
243    m_pcPredDepthMap = NULL;
244  }
245#if PDM_REMOVE_DEPENDENCE
246  if(m_pcPredDepthMap_temp)
247  {
248    m_pcPredDepthMap_temp->destroy();
249    delete m_pcPredDepthMap_temp;
250    m_pcPredDepthMap_temp = NULL;
251  }
252#endif
253}
254#endif
255
256#if HHI_INTER_VIEW_MOTION_PRED
257Void
258TComPic::removeOrgDepthMapBuffer()
259{
260  if( m_pcOrgDepthMap )
261  {
262    m_pcOrgDepthMap->destroy();
263    delete m_pcOrgDepthMap;
264    m_pcOrgDepthMap = NULL;
265  }
266}
267#endif
268
269#if HHI_INTER_VIEW_RESIDUAL_PRED
270Void
271TComPic::removeResidualBuffer()
272{
273  if( m_pcResidual )
274  {
275    m_pcResidual->destroy();
276    delete m_pcResidual;
277    m_pcResidual = NULL;
278  }
279}
280#endif
281
282/** Create non-deblocked filter information
283 * \param pSliceStartAddress array for storing slice start addresses
284 * \param numSlices number of slices in picture
285 * \param sliceGranularityDepth slice granularity
286 * \param bNDBFilterCrossSliceBoundary cross-slice-boundary in-loop filtering; true for "cross".
287 * \param numTiles number of tiles in picture
288 * \param bNDBFilterCrossTileBoundary cross-tile-boundary in-loop filtering; true for "cross".
289 */
290Void TComPic::createNonDBFilterInfo(UInt* pSliceStartAddress, Int numSlices, Int sliceGranularityDepth
291                                    ,Bool bNDBFilterCrossSliceBoundary
292                                    ,Int numTiles
293                                    ,Bool bNDBFilterCrossTileBoundary)
294{
295  UInt maxNumSUInLCU = getNumPartInCU();
296  UInt numLCUInPic   = getNumCUsInFrame();
297  UInt picWidth      = getSlice(0)->getSPS()->getPicWidthInLumaSamples();
298  UInt picHeight     = getSlice(0)->getSPS()->getPicHeightInLumaSamples();
299  Int  numLCUsInPicWidth = getFrameWidthInCU();
300  Int  numLCUsInPicHeight= getFrameHeightInCU();
301  UInt maxNumSUInLCUWidth = getNumPartInWidth();
302  UInt maxNumSUInLCUHeight= getNumPartInHeight();
303
304  m_bIndependentSliceBoundaryForNDBFilter = (bNDBFilterCrossSliceBoundary)?(false):((numSlices > 1)?(true):(false)) ;
305  m_sliceGranularityForNDBFilter = sliceGranularityDepth;
306  m_bIndependentTileBoundaryForNDBFilter  = (bNDBFilterCrossTileBoundary)?(false) :((numTiles > 1)?(true):(false));
307
308  m_pbValidSlice = new Bool[numSlices];
309  for(Int s=0; s< numSlices; s++)
310  {
311    m_pbValidSlice[s] = true;
312  }
313#if !LCU_SYNTAX_ALF
314  if( pSliceStartAddress == NULL || (numSlices == 1 && numTiles == 1) )
315  {
316    return;
317  }
318#endif
319  m_pSliceSUMap = new Int[maxNumSUInLCU * numLCUInPic];
320
321  //initialization
322  for(UInt i=0; i< (maxNumSUInLCU * numLCUInPic); i++ )
323  {
324    m_pSliceSUMap[i] = -1;
325  }
326  for( UInt CUAddr = 0; CUAddr < numLCUInPic ; CUAddr++ )
327  {
328    TComDataCU* pcCU = getCU( CUAddr );
329    pcCU->setSliceSUMap(m_pSliceSUMap + (CUAddr* maxNumSUInLCU)); 
330    pcCU->getNDBFilterBlocks()->clear();
331  }
332  m_vSliceCUDataLink.clear();
333
334  m_vSliceCUDataLink.resize(numSlices);
335
336  UInt startAddr, endAddr, firstCUInStartLCU, startLCU, endLCU, lastCUInEndLCU, uiAddr;
337  UInt LPelX, TPelY, LCUX, LCUY;
338  UInt currSU;
339  UInt startSU, endSU;
340
341  for(Int s=0; s< numSlices; s++)
342  {
343    //1st step: decide the real start address
344    startAddr = pSliceStartAddress[s];
345    endAddr   = pSliceStartAddress[s+1] -1;
346
347    startLCU            = startAddr / maxNumSUInLCU;
348    firstCUInStartLCU   = startAddr % maxNumSUInLCU;
349
350    endLCU              = endAddr   / maxNumSUInLCU;
351    lastCUInEndLCU      = endAddr   % maxNumSUInLCU;   
352
353    uiAddr = m_apcPicSym->getCUOrderMap(startLCU);
354
355    LCUX      = getCU(uiAddr)->getCUPelX();
356    LCUY      = getCU(uiAddr)->getCUPelY();
357    LPelX     = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[firstCUInStartLCU] ];
358    TPelY     = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[firstCUInStartLCU] ];
359    currSU    = firstCUInStartLCU;
360
361    Bool bMoveToNextLCU = false;
362    Bool bSliceInOneLCU = (startLCU == endLCU);
363
364    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
365    {
366      currSU ++;
367
368      if(bSliceInOneLCU)
369      {
370        if(currSU > lastCUInEndLCU)
371        {
372          m_pbValidSlice[s] = false;
373          break;
374        }
375      }
376
377      if(currSU >= maxNumSUInLCU )
378      {
379        bMoveToNextLCU = true;
380        break;
381      }
382
383      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
384      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
385
386    }
387
388
389    if(!m_pbValidSlice[s])
390    {
391      continue;
392    }
393
394    if(currSU != firstCUInStartLCU)
395    {
396      if(!bMoveToNextLCU)
397      {
398        firstCUInStartLCU = currSU;
399      }
400      else
401      {
402        startLCU++;
403        firstCUInStartLCU = 0;
404        assert( startLCU < getNumCUsInFrame());
405      }
406      assert(startLCU*maxNumSUInLCU + firstCUInStartLCU < endAddr);
407    }
408
409
410    //2nd step: assign NonDBFilterInfo to each processing block
411    for(UInt i= startLCU; i <= endLCU; i++)
412    {
413      startSU = (i == startLCU)?(firstCUInStartLCU):(0);
414      endSU   = (i == endLCU  )?(lastCUInEndLCU   ):(maxNumSUInLCU -1);
415
416      uiAddr = m_apcPicSym->getCUOrderMap(i);
417      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
418
419      TComDataCU* pcCU = getCU(uiAddr);
420      m_vSliceCUDataLink[s].push_back(pcCU);
421
422      createNonDBFilterInfoLCU(iTileID, s, pcCU, startSU, endSU, m_sliceGranularityForNDBFilter, picWidth, picHeight);
423    }
424  }
425
426  //step 3: border availability
427  for(Int s=0; s< numSlices; s++)
428  {
429    if(!m_pbValidSlice[s])
430    {
431      continue;
432    }
433
434    for(Int i=0; i< m_vSliceCUDataLink[s].size(); i++)
435    {
436      TComDataCU* pcCU = m_vSliceCUDataLink[s][i];
437      uiAddr = pcCU->getAddr();
438
439      if(pcCU->getPic()==0)
440      {
441        continue;
442      }
443      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
444      Bool bTopTileBoundary = false, bDownTileBoundary= false, bLeftTileBoundary= false, bRightTileBoundary= false;
445
446      if(m_bIndependentTileBoundaryForNDBFilter)
447      {
448        //left
449        if( uiAddr % numLCUsInPicWidth != 0)
450        {
451          bLeftTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr -1) != iTileID )?true:false;
452        }
453        //right
454        if( (uiAddr % numLCUsInPicWidth) != (numLCUsInPicWidth -1) )
455        {
456          bRightTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr +1) != iTileID)?true:false;
457        }
458        //top
459        if( uiAddr >= numLCUsInPicWidth)
460        {
461          bTopTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr - numLCUsInPicWidth) !=  iTileID )?true:false;
462        }
463        //down
464        if( uiAddr + numLCUsInPicWidth < numLCUInPic )
465        {
466          bDownTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr + numLCUsInPicWidth) != iTileID)?true:false;
467        }
468
469      }
470
471      pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth, numLCUsInPicHeight, maxNumSUInLCUWidth, maxNumSUInLCUHeight,picWidth, picHeight
472        ,m_bIndependentSliceBoundaryForNDBFilter
473        ,bTopTileBoundary, bDownTileBoundary, bLeftTileBoundary, bRightTileBoundary
474        ,m_bIndependentTileBoundaryForNDBFilter);
475
476    }
477
478  }
479
480  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
481  {
482    m_pNDBFilterYuvTmp = new TComPicYuv();
483    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
484  }
485}
486
487#if HHI_INTERVIEW_SKIP
488Void TComPic::addUsedPelsMapBuffer()
489{
490  AOT( m_pcUsedPelsMap );
491  AOF( m_apcPicYuv[1]  );
492  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
493  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
494  UInt  uiMaxCuWidth  = m_apcPicSym->getMaxCUWidth();
495  UInt  uiMaxCuHeight = m_apcPicSym->getMaxCUHeight();
496  UInt  uiMaxCuDepth  = m_apcPicSym->getMaxCUDepth ();
497  m_pcUsedPelsMap     = new TComPicYuv;
498  m_pcUsedPelsMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
499
500}
501Void
502TComPic::removeUsedPelsMapBuffer()
503{
504  if( m_pcUsedPelsMap )
505  {
506    m_pcUsedPelsMap->destroy();
507    delete m_pcUsedPelsMap;
508    m_pcUsedPelsMap = NULL;
509  }
510}
511#endif
512
513/** Create non-deblocked filter information for LCU
514 * \param tileID tile index
515 * \param sliceID slice index
516 * \param pcCU CU data pointer
517 * \param startSU start SU index in LCU
518 * \param endSU end SU index in LCU
519 * \param sliceGranularyDepth slice granularity
520 * \param picWidth picture width
521 * \param picHeight picture height
522 */
523Void TComPic::createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight)
524{
525  UInt LCUX          = pcCU->getCUPelX();
526  UInt LCUY          = pcCU->getCUPelY();
527  Int* pCUSliceMap    = pcCU->getSliceSUMap();
528  UInt maxNumSUInLCU = getNumPartInCU();
529  UInt maxNumSUInSGU = maxNumSUInLCU >> (sliceGranularyDepth << 1);
530  UInt maxNumSUInLCUWidth = getNumPartInWidth();
531  UInt LPelX, TPelY;
532  UInt currSU;
533
534
535  //get the number of valid NBFilterBLock
536  currSU   = startSU;
537  while(currSU <= endSU)
538  {
539    LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
540    TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
541
542    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
543    {
544      currSU += maxNumSUInSGU;
545      if(currSU >= maxNumSUInLCU || currSU > endSU)
546      {
547        break;
548      }
549      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
550      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
551    }
552
553    if(currSU >= maxNumSUInLCU || currSU > endSU)
554    {
555      break;
556    }
557
558    NDBFBlockInfo NDBFBlock;
559
560    NDBFBlock.tileID  = tileID;
561    NDBFBlock.sliceID = sliceID;
562    NDBFBlock.posY    = TPelY;
563    NDBFBlock.posX    = LPelX;
564    NDBFBlock.startSU = currSU;
565
566    UInt uiLastValidSU  = currSU;
567    UInt uiIdx, uiLPelX_su, uiTPelY_su;
568    for(uiIdx = currSU; uiIdx < currSU + maxNumSUInSGU; uiIdx++)
569    {
570      if(uiIdx > endSU)
571      {
572        break;       
573      }
574      uiLPelX_su   = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
575      uiTPelY_su   = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
576      if( !(uiLPelX_su < picWidth ) || !( uiTPelY_su < picHeight ))
577      {
578        continue;
579      }
580      pCUSliceMap[uiIdx] = sliceID;
581      uiLastValidSU = uiIdx;
582    }
583    NDBFBlock.endSU = uiLastValidSU;
584
585    UInt rTLSU = g_auiZscanToRaster[ NDBFBlock.startSU ];
586    UInt rBRSU = g_auiZscanToRaster[ NDBFBlock.endSU   ];
587    NDBFBlock.widthSU  = (rBRSU % maxNumSUInLCUWidth) - (rTLSU % maxNumSUInLCUWidth)+ 1;
588    NDBFBlock.heightSU = (UInt)(rBRSU / maxNumSUInLCUWidth) - (UInt)(rTLSU / maxNumSUInLCUWidth)+ 1;
589    NDBFBlock.width    = NDBFBlock.widthSU  * getMinCUWidth();
590    NDBFBlock.height   = NDBFBlock.heightSU * getMinCUHeight();
591
592    pcCU->getNDBFilterBlocks()->push_back(NDBFBlock);
593
594    currSU += maxNumSUInSGU;
595  }
596
597}
598
599/** destroy non-deblocked filter information for LCU
600 */
601Void TComPic::destroyNonDBFilterInfo()
602{
603  if(m_pbValidSlice != NULL)
604  {
605    delete[] m_pbValidSlice;
606    m_pbValidSlice = NULL;
607  }
608
609  if(m_pSliceSUMap != NULL)
610  {
611    delete[] m_pSliceSUMap;
612    m_pSliceSUMap = NULL;
613  }
614  for( UInt CUAddr = 0; CUAddr < getNumCUsInFrame() ; CUAddr++ )
615  {
616    TComDataCU* pcCU = getCU( CUAddr );
617    pcCU->getNDBFilterBlocks()->clear();
618  }
619
620  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
621  {
622    m_pNDBFilterYuvTmp->destroy();
623    delete m_pNDBFilterYuvTmp;
624    m_pNDBFilterYuvTmp = NULL;
625  }
626
627}
628
629#if VSP_N
630Void TComPic::checkSynthesisAvailability( /*TComDataCU*& rpcCU, */UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied )
631{ 
632  rpbCUSynthesied[0] = true;
633  rpbCUSynthesied[1] = true;
634  rpbCUSynthesied[2] = true;
635  rpbCUSynthesied[3] = true;
636
637  if (!getPicYuvAvail())
638  {
639    rpbCUSynthesied[0] = false;
640    rpbCUSynthesied[1] = false;
641    rpbCUSynthesied[2] = false;
642    rpbCUSynthesied[3] = false;
643    return;   
644  }
645 
646  Int x, y;
647  Pel* pAvail  = getPicYuvAvail()->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
648  Int CUHeight = g_uiMaxCUHeight >> uiPartDepth; //rpcCU->getHeight(uiAbsZorderIdx);
649  Int CUWidth  = g_uiMaxCUWidth  >> uiPartDepth; //rpcCU->getWidth(uiAbsZorderIdx);
650 
651  Int  iStride  = getPicYuvAvail()->getStride();
652  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- )
653  {
654    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
655    {
656      rpbCUSynthesied[0] &= (pAvail[x] != 0);
657    }
658    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
659    {
660      rpbCUSynthesied[1] &= (pAvail[x] != 0);
661    }
662    pAvail += iStride;
663  }
664  //for ( y = CUHeight - 1; y >= ((CUHeight) >> 1); y-- )
665  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- ) //Owieczka
666  {
667    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
668    {
669      rpbCUSynthesied[2] &= (pAvail[x] != 0);
670    }
671    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
672    {
673      rpbCUSynthesied[3] &= (pAvail[x] != 0);
674    }
675    pAvail += iStride;
676  }
677
678  //rpbCUSynthesied[0] = !rpbCUSynthesied[0];
679  //rpbCUSynthesied[1] = !rpbCUSynthesied[1];
680  //rpbCUSynthesied[2] = !rpbCUSynthesied[2];
681  //rpbCUSynthesied[3] = !rpbCUSynthesied[3];
682}
683#endif
684
685//! \}
Note: See TracBrowser for help on using the repository browser.