Changeset 253 in SHVCSoftware for branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder
- Timestamp:
- 3 Jun 2013, 20:08:00 (12 years ago)
- Location:
- branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncCu.cpp
r191 r253 458 458 if (rpcBestCU->getLayerId() > 0) 459 459 { 460 if (rpcBestCU->getSlice()->getBaseColPic()->getSlice(0)->getSliceType() == I_SLICE) 460 // the right reference layerIdc should be specified, currently it is set to 0 461 if (rpcBestCU->getSlice()->getBaseColPic(0)->getSlice(0)->getSliceType() == I_SLICE) 461 462 { 462 463 testInter = false; -
branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r251 r253 535 535 if (m_layerId > 0) 536 536 { 537 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 538 { 539 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 537 540 #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 544 547 #if SIMPLIFIED_MV_POS_SCALING 545 548 #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 574 573 #if SVC_UPSAMPLING 575 if ( pcPic->isSpatialEnhLayer())574 if( pcPic->isSpatialEnhLayer(refLayerIdc)) 576 575 { 577 576 #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() ); 581 580 #endif 582 581 } 583 582 else 584 583 { 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) ); 588 587 #endif 589 588 } … … 595 594 { 596 595 #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()); 600 601 } 601 602 else -
branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncTop.cpp
r250 r253 507 507 if(m_layerId > 0) 508 508 { 509 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 510 { 511 const Window scalEL = getSPS()->getScaledRefLayerWindow(); 512 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 513 509 514 #if VPS_EXTN_DIRECT_REF_LAYERS 510 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId - 1 ); 511 #else 512 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 513 #endif 514 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 515 { 516 pcEPic->setSpatialEnhLayerFlag( true ); 517 518 //only for scalable extension 519 assert( m_cVPS.getScalabilityMask(1) == true ); 515 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); 516 #else 517 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 518 #endif 519 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 520 { 521 pcEPic->setSpatialEnhLayerFlag( i, true ); 522 523 //only for scalable extension 524 assert( m_cVPS.getScalabilityMask(1) == true ); 525 } 520 526 } 521 527 } … … 538 544 if(m_layerId > 0) 539 545 { 546 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 547 { 548 const Window scalEL = getSPS()->getScaledRefLayerWindow(); 549 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 550 540 551 #if VPS_EXTN_DIRECT_REF_LAYERS 541 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId - 1 ); 542 #else 543 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 544 #endif 545 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 546 { 547 rpcPic->setSpatialEnhLayerFlag( true ); 548 549 //only for scalable extension 550 assert( m_cVPS.getScalabilityMask(1) == true ); 552 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); 553 #else 554 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 555 #endif 556 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 557 { 558 rpcPic->setSpatialEnhLayerFlag( i, true ); 559 560 //only for scalable extension 561 assert( m_cVPS.getScalabilityMask(1) == true ); 562 } 551 563 } 552 564 } … … 1235 1247 if (m_cIlpPic[0] == NULL) 1236 1248 { 1237 for (Int j=0; j <1/*MAX_NUM_REF*/; j++)1249 for (Int j=0; j < MAX_LAYERS /*MAX_NUM_REF*/; j++) 1238 1250 { 1239 1251 m_cIlpPic[j] = new TComPic; … … 1254 1266 Void TEncTop::setILRPic(TComPic *pcPic) 1255 1267 { 1256 if(m_cIlpPic[0]) 1257 { 1258 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 1259 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 1260 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 1261 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 1262 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); 1268 for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ ) 1269 { 1270 Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i); 1271 1272 if(m_cIlpPic[refLayerIdc]) 1273 { 1274 m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec()); 1275 m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC()); 1276 m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId 1277 m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false); 1278 m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); 1279 } 1263 1280 } 1264 1281 }
Note: See TracChangeset for help on using the changeset viewer.