Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPic.cpp


Ignore:
Timestamp:
1 Sep 2013, 22:47:26 (11 years ago)
Author:
tech
Message:

Merged DEV-2.0-dev0@604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r332 r608  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2012, ITU/ISO/IEC
     6 * Copyright (c) 2010-2013, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4747
    4848TComPic::TComPic()
    49 {
    50   m_uiTLayer          = 0;
    51 
    52   m_apcPicSym         = NULL;
     49: m_uiTLayer                              (0)
     50, m_bUsedByCurr                           (false)
     51, m_bIsLongTerm                           (false)
     52, m_bIsUsedAsLongTerm                     (false)
     53, m_apcPicSym                             (NULL)
     54, m_pcPicYuvPred                          (NULL)
     55, m_pcPicYuvResi                          (NULL)
     56, m_bReconstructed                        (false)
     57, m_bNeededForOutput                      (false)
     58, m_uiCurrSliceIdx                        (0)
     59, m_pSliceSUMap                           (NULL)
     60, m_pbValidSlice                          (NULL)
     61, m_sliceGranularityForNDBFilter          (0)
     62, m_bIndependentSliceBoundaryForNDBFilter (false)
     63, m_bIndependentTileBoundaryForNDBFilter  (false)
     64, m_pNDBFilterYuvTmp                      (NULL)
     65, m_bCheckLTMSB                           (false)
     66#if H_MV
     67, m_layerId                               (0)
     68, m_viewId                                (0)
     69#if H_3D
     70, m_viewIndex                             (0)
     71, m_isDepth                               (false)
     72, m_aaiCodedScale                         (0)
     73, m_aaiCodedOffset                        (0)
     74#endif
     75#endif
     76{
    5377  m_apcPicYuv[0]      = NULL;
    5478  m_apcPicYuv[1]      = NULL;
    55 #if DEPTH_MAP_GENERATION
    56   m_pcPredDepthMap    = NULL;
    57 #if PDM_REMOVE_DEPENDENCE
    58   m_pcPredDepthMap_temp    = NULL;
    59 #endif
    60 #endif
    61 #if FCO_DVP_REFINE_C0132_C0170
    62   m_bDepthCoded       = false;
    63   m_pcRecDepthMap     = NULL;
    64 #endif
    65 #if H3D_IVMP
    66   m_pcOrgDepthMap     = NULL;
    67 #endif
    68 #if H3D_IVRP
    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 INTER_VIEW_VECTOR_SCALING_C0115
    83   m_iViewOrderIdx     = 0;    // will be changed to view_id
    84 #endif
    85   m_aaiCodedScale     = 0;
    86   m_aaiCodedOffset    = 0;
    87 #if H3D_QTL
     79#if H_3D_QTLPC
    8880  m_bReduceBitsQTL    = 0;
    8981#endif
    90 #if H3D_NBDV
    91   m_bRapCheck = false;
    92   m_eRapRefList = REF_PIC_LIST_0;
    93   m_uiRapRefIdx = 0;
    94 #endif
    95 
     82#if H_3D_NBDV
     83  m_iNumDdvCandPics   = 0;
     84  m_eRapRefList       = REF_PIC_LIST_0;
     85  m_uiRapRefIdx       = 0;
     86#endif
    9687}
    9788
     
    10091}
    10192
    102 Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual )
     93Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     94                      Int *numReorderPics, Bool bIsVirtual)
     95
    10396{
    10497  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
     
    109102  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
    110103 
    111   /* there are no SEI messages associated with this picture initially */
    112   m_SEIs = NULL;
     104  // there are no SEI messages associated with this picture initially
     105  if (m_SEIs.size() > 0)
     106  {
     107    deleteSEIs (m_SEIs);
     108  }
    113109  m_bUsedByCurr = false;
     110
     111  /* store conformance window parameters with picture */
     112  m_conformanceWindow = conformanceWindow;
     113 
     114  /* store display window parameters with picture */
     115  m_defaultDisplayWindow = defaultDisplayWindow;
     116
     117  /* store number of reorder pics with picture */
     118  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
     119
    114120  return;
    115121}
     
    137143    m_apcPicYuv[1]  = NULL;
    138144  }
    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
    147 #if DEPTH_MAP_GENERATION
    148   if( m_pcPredDepthMap )
    149   {
    150     m_pcPredDepthMap->destroy();
    151     delete m_pcPredDepthMap;
    152     m_pcPredDepthMap = NULL;
    153   }
    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   }                     
    161 #endif
    162 #endif
    163 #if H3D_IVMP
    164   if( m_pcOrgDepthMap )
    165   {
    166     m_pcOrgDepthMap->destroy();
    167     delete m_pcOrgDepthMap;
    168     m_pcOrgDepthMap = NULL;
    169   }
    170 #endif
    171 #if H3D_IVRP
    172   if( m_pcResidual )
    173   {
    174     m_pcResidual->destroy();
    175     delete m_pcResidual;
    176     m_pcResidual = NULL;
    177   }
    178 #endif
    179   delete m_SEIs;
    180 }
    181 
     145 
     146  deleteSEIs(m_SEIs);
     147}
     148#if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     149Void TComPic::compressMotion(int scale)
     150#else
    182151Void TComPic::compressMotion()
     152#endif
    183153{
    184154  TComPicSym* pPicSym = getPicSym();
     
    186156  {
    187157    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
     158#if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     159    pcCU->compressMV(scale);
     160#else
    188161    pcCU->compressMV();
     162#endif
    189163  }
    190164}
    191 
    192 #if DEPTH_MAP_GENERATION
    193 Void
    194 TComPic::addPrdDepthMapBuffer( UInt uiSubSampExpX, UInt uiSubSampExpY )
    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;
    204   m_pcPredDepthMap    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
    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
    209 }
    210 #endif
    211 
    212 #if H3D_IVMP
    213 Void
    214 TComPic::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 }
    226 #endif
    227 
    228 #if H3D_IVRP
    229 Void
    230 TComPic::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 }
    242 #endif
    243 
    244 #if DEPTH_MAP_GENERATION
    245 Void
    246 TComPic::removePrdDepthMapBuffer()
    247 {
    248   if( m_pcPredDepthMap )
    249   {
    250     m_pcPredDepthMap->destroy();
    251     delete m_pcPredDepthMap;
    252     m_pcPredDepthMap = NULL;
    253   }
    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
    262 }
    263 #endif
    264 
    265 #if H3D_IVMP
    266 Void
    267 TComPic::removeOrgDepthMapBuffer()
    268 {
    269   if( m_pcOrgDepthMap )
    270   {
    271     m_pcOrgDepthMap->destroy();
    272     delete m_pcOrgDepthMap;
    273     m_pcOrgDepthMap = NULL;
    274   }
    275 }
    276 #endif
    277 
    278 #if H3D_IVRP
    279 Void
    280 TComPic::removeResidualBuffer()
    281 {
    282   if( m_pcResidual )
    283   {
    284     m_pcResidual->destroy();
    285     delete m_pcResidual;
    286     m_pcResidual = NULL;
    287   }
    288 }
    289 #endif
    290165
    291166/** Create non-deblocked filter information
     
    297172 * \param bNDBFilterCrossTileBoundary cross-tile-boundary in-loop filtering; true for "cross".
    298173 */
    299 Void TComPic::createNonDBFilterInfo(UInt* pSliceStartAddress, Int numSlices, Int sliceGranularityDepth
    300                                     ,Bool bNDBFilterCrossSliceBoundary
     174Void TComPic::createNonDBFilterInfo(std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
     175                                    ,std::vector<Bool>* LFCrossSliceBoundary
    301176                                    ,Int numTiles
    302177                                    ,Bool bNDBFilterCrossTileBoundary)
     
    310185  UInt maxNumSUInLCUWidth = getNumPartInWidth();
    311186  UInt maxNumSUInLCUHeight= getNumPartInHeight();
    312 
    313   m_bIndependentSliceBoundaryForNDBFilter = (bNDBFilterCrossSliceBoundary)?(false):((numSlices > 1)?(true):(false)) ;
     187  Int  numSlices = (Int) sliceStartAddress.size() - 1;
     188  m_bIndependentSliceBoundaryForNDBFilter = false;
     189  if(numSlices > 1)
     190  {
     191    for(Int s=0; s< numSlices; s++)
     192    {
     193      if((*LFCrossSliceBoundary)[s] == false)
     194      {
     195        m_bIndependentSliceBoundaryForNDBFilter = true;
     196      }
     197    }
     198  }
    314199  m_sliceGranularityForNDBFilter = sliceGranularityDepth;
    315200  m_bIndependentTileBoundaryForNDBFilter  = (bNDBFilterCrossTileBoundary)?(false) :((numTiles > 1)?(true):(false));
     
    345230  {
    346231    //1st step: decide the real start address
    347     startAddr = pSliceStartAddress[s];
    348     endAddr   = pSliceStartAddress[s+1] -1;
     232    startAddr = sliceStartAddress[s];
     233    endAddr   = sliceStartAddress[s+1] -1;
    349234
    350235    startLCU            = startAddr / maxNumSUInLCU;
     
    473358
    474359      pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth, numLCUsInPicHeight, maxNumSUInLCUWidth, maxNumSUInLCUHeight,picWidth, picHeight
    475         ,m_bIndependentSliceBoundaryForNDBFilter
     360        , *LFCrossSliceBoundary
    476361        ,bTopTileBoundary, bDownTileBoundary, bLeftTileBoundary, bRightTileBoundary
    477362        ,m_bIndependentTileBoundaryForNDBFilter);
     
    486371    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
    487372  }
    488 }
    489 #if H3D_NBDV
    490 Bool 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);
    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
    523       bRAP = (currSlice->getRefPic(eRefPicList, lpRef)->getCurrSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV? 1:0);
    524 #endif
    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
    560 
    561 #if HHI_INTERVIEW_SKIP
    562 Void 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 }
    575 Void
    576 TComPic::removeUsedPelsMapBuffer()
    577 {
    578   if( m_pcUsedPelsMap )
    579   {
    580     m_pcUsedPelsMap->destroy();
    581     delete m_pcUsedPelsMap;
    582     m_pcUsedPelsMap = NULL;
    583   }
    584 }
    585 #endif
     373
     374}
    586375
    587376/** Create non-deblocked filter information for LCU
     
    700489
    701490}
    702 
    703 
     491#if H_MV
     492Void TComPic::print( Bool legend )
     493{
     494  if ( legend )
     495    std::cout  << "LId"        << "\t" << "POC"   << "\t" << "Rec"          << "\t" << "Ref"                       << "\t" << "LT"            << std::endl;
     496  else
     497    std::cout  << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << std::endl;
     498}
     499
     500TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc )
     501{
     502  TComPic* pcPic = NULL;
     503  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++)
     504  {   
     505    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++)
     506    {
     507      TComPic* currPic = (*itP);
     508      if ( ( currPic->getPOC() == poc ) && ( currPic->getLayerId() == layerIdInNuh ) )
     509      {
     510        pcPic = currPic ;     
     511      }
     512    }
     513  }
     514  return pcPic;
     515}
     516
     517#if H_3D
     518TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )
     519{
     520  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
     521}
     522
     523Void TComPicLists::print()
     524{
     525  Bool first = true;     
     526  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++)
     527  {   
     528    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++)
     529    {
     530      if ( first )
     531      {
     532        (*itP)->print( true );       
     533        first = false;
     534      }
     535      (*itP)->print( false );       
     536    }
     537  }
     538}
     539
     540TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag )
     541{
     542  TComPic*    pcPic = getPic( layerIdInNuh, poc );
     543  TComPicYuv* pcPicYuv = NULL;
     544
     545  if (pcPic != NULL)
     546  {
     547    if( reconFlag )
     548    {
     549      if ( pcPic->getReconMark() )
     550      {
     551        pcPicYuv = pcPic->getPicYuvRec();
     552      }
     553    }
     554    else
     555    {
     556      pcPicYuv = pcPic->getPicYuvOrg();
     557    }
     558  };
     559
     560  return pcPicYuv;
     561}
     562
     563TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
     564
     565  Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag );
     566  return getPicYuv( layerIdInNuh, poc, recon );
     567}
     568#if H_3D_ARP
     569TComList<TComPic*>* TComPicLists::getPicList( Int layerIdInNuh )
     570{
     571  TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin();
     572  Int iLayer = 0;
     573
     574  assert( layerIdInNuh < m_lists.size() );
     575
     576  while( iLayer != layerIdInNuh )
     577  {
     578    itL++;
     579    iLayer++;
     580  }
     581
     582  return *itL;
     583}
     584#endif
     585#endif // H_3D
     586#endif // H_MV
     587
     588#if H_3D_NBDV
     589Int TComPic::getDisCandRefPictures( Int iColPOC )
     590{
     591  UInt       uiTempLayerCurr = 7;
     592  TComSlice* currSlice       = getSlice(getCurrSliceIdx());
     593  UInt       numDdvCandPics  = 0;
     594
     595  if ( !currSlice->getEnableTMVPFlag() )
     596    return numDdvCandPics;
     597
     598  numDdvCandPics += 1;
     599
     600  UInt pocCurr = currSlice->getPOC();
     601  UInt pocDiff = 255;
     602
     603  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
     604  {
     605    UInt x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
     606
     607    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     608    {
     609      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex()
     610        && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) && numDdvCandPics!=2)
     611      {
     612        TComSlice* refSlice    = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());
     613        Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP())? 1: 0;
     614        UInt       uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer();
     615       
     616        if( bRAP )
     617        {
     618          this->setRapRefIdx(i);
     619          this->setRapRefList((RefPicList)x);
     620          numDdvCandPics = 2;
     621
     622          return numDdvCandPics;
     623        }
     624        else if (uiTempLayerCurr > uiTempLayer)
     625        {
     626           uiTempLayerCurr = uiTempLayer;
     627        }
     628      }
     629    }
     630  }
     631
     632  UInt z   = -1; // GT: Added to make code compile needs to be checked!
     633  UInt idx = 0;
     634 
     635  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
     636  {
     637    UInt x = lpNr? currSlice->getColFromL0Flag() : 1-currSlice->getColFromL0Flag();
     638   
     639    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     640    {
     641      Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();
     642      Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr): (pocCurr - iTempPoc);
     643     
     644      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() &&  (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC)
     645        && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
     646      {
     647        pocDiff = iTempDiff;
     648        z       = x;
     649        idx     = i;
     650      }
     651    }
     652  }
     653
     654  if( pocDiff < 255 )
     655  {
     656    this->setRapRefIdx(idx);
     657    this->setRapRefList((RefPicList) z );
     658    numDdvCandPics = 2;
     659  }
     660
     661  return numDdvCandPics;
     662}
     663#endif
     664#if MTK_NBDV_TN_FIX_E0172
     665Void TComPic::checkTemporalIVRef()
     666{
     667  TComSlice* currSlice = getSlice(getCurrSliceIdx());
     668  const Int numCandPics = this->getNumDdvCandPics();
     669  for(Int curCandPic = 0; curCandPic < numCandPics; curCandPic++)
     670  {
     671    RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
     672    Int        curCandPicRefIdx = 0;
     673    if( curCandPic == 0 )
     674    {
     675      eCurRefPicList   = RefPicList(currSlice->isInterB() ? 1-currSlice->getColFromL0Flag() : 0);
     676      curCandPicRefIdx = currSlice->getColRefIdx();
     677    }
     678    else                 
     679    {
     680      eCurRefPicList   = this->getRapRefList();
     681      curCandPicRefIdx = this->getRapRefIdx();
     682    }
     683    TComPic* pcCandColPic = currSlice->getRefPic( eCurRefPicList, curCandPicRefIdx);
     684    TComSlice* pcCandColSlice = pcCandColPic->getSlice(0);// currently only support single slice
     685
     686    if(!pcCandColSlice->isIntra())
     687    {
     688      for( Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2: 1); iColRefDir ++ )
     689      {
     690        for( Int iColRefIdx =0; iColRefIdx < pcCandColSlice->getNumRefIdx(( RefPicList )iColRefDir ); iColRefIdx++)
     691        {
     692          m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;
     693          Int iColViewIdx    = pcCandColSlice->getViewIndex();
     694          Int iColRefViewIdx = pcCandColSlice->getRefPic( ( RefPicList )iColRefDir, iColRefIdx)->getViewIndex();
     695          if(iColViewIdx == iColRefViewIdx)
     696            continue;
     697
     698          for(Int iCurrRefDir = 0;(iCurrRefDir < (currSlice->isInterB() ? 2: 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false ); iCurrRefDir++)
     699          {
     700            for( Int iCurrRefIdx =0; iCurrRefIdx < currSlice->getNumRefIdx(( RefPicList )iCurrRefDir ); iCurrRefIdx++)
     701            {
     702              if( currSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx )->getViewIndex() == iColRefViewIdx )
     703              { 
     704                m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = true;
     705                break;
     706              }
     707            }
     708          }
     709        }
     710      }
     711    }
     712  }
     713}
     714Bool TComPic::isTempIVRefValid(Int currCandPic, Int iColRefDir, Int iColRefIdx)
     715{
     716  return m_abTIVRINCurrRL[currCandPic][iColRefDir][iColRefIdx];
     717}
     718#endif
     719#if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
     720Void TComPic::checkTextureRef(  )
     721{
     722  TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
     723  TComPic* pcTextPic = pcCurrSlice->getTexturePic();
     724  TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
     725
     726  for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )
     727  {
     728    for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)
     729    {
     730      Int iTextRefPOC    = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);
     731      Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();
     732      m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
     733      Int iCurrRefDir = iTextRefDir;
     734      for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)
     735      {
     736        if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
     737          pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )
     738        { 
     739          m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;
     740        }
     741      }
     742    }
     743
     744  }
     745}
     746
     747Int TComPic::isTextRefValid(Int iTextRefDir, Int iTextRefIdx)
     748{
     749  return m_aiTexToDepRef[iTextRefDir][iTextRefIdx];
     750}
     751#endif
    704752//! \}
Note: See TracChangeset for help on using the changeset viewer.