source: 3DVCSoftware/branches/HTM-6.0-Mediatek/source/Lib/TLibCommon/TComPic.cpp @ 304

Last change on this file since 304 was 303, checked in by mediatek-htm, 12 years ago

Added FCO_FIX, FCO_FIX_SPS_CHANGE, and FCO_DVP_REFINE_C0132_C0170 macros to support FCO.
The new macros are default disabled in CTC.

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