Ignore:
Timestamp:
3 Jun 2013, 20:08:00 (11 years ago)
Author:
seregin
Message:

initial multilayer reference implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r251 r253  
    535535    if (m_layerId > 0)
    536536    {
     537      for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
     538      {
     539        UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
    537540#if VPS_EXTN_DIRECT_REF_LAYERS
    538       TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(m_layerId-1)->getListPic();
    539 #else
    540       TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();
    541 #endif
    542       pcSlice->setBaseColPic (*cListPic, m_layerId );
    543      
     541        TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(refLayerIdc)->getListPic();
     542#else
     543        TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();
     544#endif
     545        pcSlice->setBaseColPic (*cListPic, refLayerIdc );
     546
    544547#if SIMPLIFIED_MV_POS_SCALING
    545548#if SCALED_REF_LAYER_OFFSETS
    546       const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow();
    547 
    548       Int widthBL   = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();
    549       Int heightBL  = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();
    550 
    551       Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    552       Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    553 #else
    554       const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
    555       const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
    556 
    557       Int widthBL   = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    558       Int heightBL  = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    559 
    560       Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    561       Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    562 #endif
    563       g_mvScalingFactor[m_layerId][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    564       g_mvScalingFactor[m_layerId][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
    565 
    566       g_posScalingFactor[m_layerId][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
    567       g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    568 #endif
    569 
    570 #if ZERO_NUM_DIRECT_LAYERS
    571       if( pcSlice->getActiveNumILRRefIdx() )
    572 #endif
    573       {
     549        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow();
     550
     551        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
     552        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     553
     554        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     555        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     556#else
     557        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow();
     558        const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
     559
     560        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     561        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     562
     563        Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     564        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     565#endif
     566        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     567        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     568
     569        g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
     570        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     571#endif
     572
    574573#if SVC_UPSAMPLING
    575         if ( pcPic->isSpatialEnhLayer())
     574        if( pcPic->isSpatialEnhLayer(refLayerIdc))
    576575        {
    577576#if SCALED_REF_LAYER_OFFSETS
    578           m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() );
    579 #else
    580           m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() );
     577          m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() );
     578#else
     579          m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
    581580#endif
    582581        }
    583582        else
    584583        {
    585           pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() );
    586         }
    587         pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() );
     584          pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );
     585        }
     586        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
    588587#endif
    589588      }
     
    595594    {
    596595#if IDR_ALIGNMENT
    597       if( pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    598       {
    599         pcSlice->setNalUnitType(pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType());
     596      TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(0)->getListPic();
     597      TComPic* picLayer0 = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() );
     598      if( picLayer0->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || picLayer0->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     599      {
     600        pcSlice->setNalUnitType(picLayer0->getSlice(0)->getNalUnitType());
    600601      }
    601602      else
Note: See TracChangeset for help on using the changeset viewer.