Changeset 175 in SHVCSoftware for branches/SHM-2.0-dev/source/Lib
- Timestamp:
- 9 May 2013, 22:48:02 (12 years ago)
- Location:
- branches/SHM-2.0-dev/source/Lib
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComDataCU.cpp
r150 r175 4200 4200 4201 4201 #if SIMPLIFIED_MV_POS_SCALING 4202 #if SCALED_REF_LAYER_OFFSETS 4203 Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset(); 4204 Int topStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset(); 4205 Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16; 4206 Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16; 4207 #else 4202 4208 Int iBX = (uiPelX*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16; 4203 4209 Int iBY = (uiPelY*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16; 4210 #endif 4204 4211 #else 4205 4212 Int iBX = (uiPelX*widthBL + widthEL/2)/widthEL; … … 4207 4214 #endif 4208 4215 4216 #if SCALED_REF_LAYER_OFFSETS 4217 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() || 4218 iBX < 0 || iBY < 0 ) 4219 #else 4209 4220 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight()) 4221 #endif 4210 4222 { 4211 4223 return NULL; -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPrediction.cpp
r134 r175 773 773 774 774 #if SVC_UPSAMPLING 775 #if SCALED_REF_LAYER_OFFSETS 776 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window) 777 { 778 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic, window); 779 } 780 #else 775 781 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic) 776 782 { 777 783 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic); 778 784 } 785 #endif 779 786 #endif 780 787 //! \} -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPrediction.h
r125 r175 122 122 123 123 #if SVC_UPSAMPLING 124 #if SCALED_REF_LAYER_OFFSETS 125 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 126 #else 124 127 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 128 #endif 125 129 #endif 126 130 }; -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.h
r174 r175 1020 1020 #if REF_IDX_MFM 1021 1021 Bool m_bMFMEnabledFlag; 1022 #endif 1023 #if SCALED_REF_LAYER_OFFSETS 1024 Window m_scaledRefLayerWindow; 1022 1025 #endif 1023 1026 public: … … 1160 1163 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 1161 1164 #endif 1165 #if SCALED_REF_LAYER_OFFSETS 1166 Window& getScaledRefLayerWindow( ) { return m_scaledRefLayerWindow; } 1167 #endif 1162 1168 }; 1163 1169 -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r166 r175 128 128 } 129 129 130 #if SCALED_REF_LAYER_OFFSETS 131 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ) 132 #else 130 133 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ) 134 #endif 131 135 { 132 136 assert ( NTAPS_US_LUMA == 8 ); … … 136 140 137 141 //========== Y component upsampling =========== 142 #if SCALED_REF_LAYER_OFFSETS 143 const Window &scalEL = window; 144 145 Int widthBL = pcBasePic->getWidth (); 146 Int heightBL = pcBasePic->getHeight(); 147 Int strideBL = pcBasePic->getStride(); 148 149 Int widthEL = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 150 Int heightEL = pcUsPic->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 151 Int strideEL = pcUsPic->getStride(); 152 #else 138 153 const Window &confBL = pcBasePic->getConformanceWindow(); 139 154 const Window &confEL = pcUsPic->getConformanceWindow(); … … 146 161 Int heightEL = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 147 162 Int strideEL = pcUsPic->getStride(); 148 163 #endif 149 164 Pel* piTempBufY = pcTempPic->getLumaAddr(); 150 165 Pel* piSrcBufY = pcBasePic->getLumaAddr(); … … 329 344 const Double sFactor12 = sFactor * 12; 330 345 #endif 331 332 346 #if ILP_DECODED_PICTURE 333 347 widthBL = pcBasePic->getWidth (); … … 337 351 heightEL = pcUsPic->getHeight(); 338 352 #endif 353 #if SCALED_REF_LAYER_OFFSETS 354 Int leftStartL = scalEL.getWindowLeftOffset(); 355 Int rightEndL = pcUsPic->getWidth() - scalEL.getWindowRightOffset(); 356 Int topStartL = scalEL.getWindowTopOffset(); 357 Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset(); 358 #endif 339 359 340 360 //========== horizontal upsampling =========== 341 361 for( i = 0; i < widthEL; i++ ) 342 362 { 363 #if SCALED_REF_LAYER_OFFSETS 364 Int x = Clip3( leftStartL, rightEndL - 1, i ); 365 #endif 343 366 #if PHASE_DERIVATION_IN_INTEGER 367 #if SCALED_REF_LAYER_OFFSETS 368 refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX; 369 #else 344 370 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 371 #endif 345 372 phase = refPos16 & 15; 346 373 refPos = refPos16 >> 4; … … 374 401 Int iOffset = 1 << (nShift - 1); 375 402 403 #if SCALED_REF_LAYER_OFFSETS 404 for( j = 0; j < pcTempPic->getHeight(); j++ ) 405 #else 376 406 for( j = 0; j < heightEL; j++ ) 377 { 407 #endif 408 { 409 #if SCALED_REF_LAYER_OFFSETS 410 Int y = Clip3(topStartL, bottomEndL - 1, j); 411 #endif 378 412 #if PHASE_DERIVATION_IN_INTEGER 413 #if SCALED_REF_LAYER_OFFSETS 414 refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY; 415 #else 379 416 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 417 #endif 380 418 phase = refPos16 & 15; 381 419 refPos = refPos16 >> 4; … … 390 428 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL; 391 429 piDstY = piDstBufY + j * strideEL; 392 430 #if SCALED_REF_LAYER_OFFSETS 431 for( i = 0; i < pcTempPic->getWidth(); i++ ) 432 #else 393 433 for( i = 0; i < widthEL; i++ ) 434 #endif 394 435 { 395 436 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift)); 437 #if SCALED_REF_LAYER_OFFSETS 438 // Only increase the x position of reference upsample picture when within the window 439 // "-2" to ensure that pointer doesn't go beyond the boundeary rightEndL-1 440 if( (i >= leftStartL) && (i <= rightEndL-2) ) 441 { 442 piSrcY++; 443 } 444 #else 396 445 piSrcY++; 446 #endif 397 447 piDstY++; 398 448 } … … 400 450 401 451 #if ILP_DECODED_PICTURE 452 #if SCALED_REF_LAYER_OFFSETS 453 widthBL = pcBasePic->getWidth (); 454 heightBL = pcBasePic->getHeight(); 455 456 widthEL = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 457 heightEL = pcUsPic->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 458 #else 402 459 widthBL = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 403 460 heightBL = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); … … 406 463 heightEL = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 407 464 #endif 465 #endif 408 466 409 467 //========== UV component upsampling =========== … … 417 475 strideBL = pcBasePic->getCStride(); 418 476 strideEL = pcUsPic->getCStride(); 477 #if SCALED_REF_LAYER_OFFSETS 478 Int leftStartC = scalEL.getWindowLeftOffset() >> 1; 479 Int rightEndC = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1); 480 Int topStartC = scalEL.getWindowTopOffset() >> 1; 481 Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1); 482 #endif 419 483 420 484 #if PHASE_DERIVATION_IN_INTEGER … … 449 513 for( i = 0; i < widthEL; i++ ) 450 514 { 515 #if SCALED_REF_LAYER_OFFSETS 516 Int x = Clip3(leftStartC, rightEndC - 1, i); 517 #endif 451 518 #if PHASE_DERIVATION_IN_INTEGER 519 #if SCALED_REF_LAYER_OFFSETS 520 refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX; 521 #else 452 522 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 523 #endif 453 524 phase = refPos16 & 15; 454 525 refPos = refPos16 >> 4; … … 484 555 pcTempPic->setHeight(heightEL << 1); 485 556 486 for( j = 0; j < heightEL; j++ ) 487 { 557 #if SCALED_REF_LAYER_OFFSETS 558 for( j = 0; j < pcTempPic->getHeight() >> 1; j++ ) 559 #else 560 for( j = 0; j < heightEL; j++ ) 561 #endif 562 { 563 #if SCALED_REF_LAYER_OFFSETS 564 Int y = Clip3(topStartC, bottomEndC - 1, j); 565 #endif 488 566 #if PHASE_DERIVATION_IN_INTEGER 567 #if SCALED_REF_LAYER_OFFSETS 568 refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY; 569 #else 489 570 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 571 #endif 490 572 phase = refPos16 & 15; 491 573 refPos = refPos16 >> 4; … … 512 594 piDstV = piDstBufV + j*strideEL; 513 595 596 #if SCALED_REF_LAYER_OFFSETS 597 for( i = 0; i < pcTempPic->getWidth() >> 1; i++ ) 598 #else 514 599 for( i = 0; i < widthEL; i++ ) 600 #endif 515 601 { 516 602 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift)); 517 603 *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift)); 518 604 605 #if SCALED_REF_LAYER_OFFSETS 606 // Only increase the x position of reference upsample picture when within the window 607 // "-2" to ensure that pointer doesn't go beyond the boundeary rightEndC-1 608 if( (i >= leftStartC) && (i <= rightEndC-2) ) 609 { 610 piSrcU++; 611 piSrcV++; 612 } 613 #else 519 614 piSrcU++; 520 615 piSrcV++; 616 #endif 521 617 piDstU++; 522 618 piDstV++; -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.h
r2 r175 52 52 ~TComUpsampleFilter(void); 53 53 54 #if SCALED_REF_LAYER_OFFSETS 55 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 56 #else 54 57 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 58 #endif 55 59 }; 56 60 -
branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h
r174 r175 44 44 45 45 #if SVC_EXTENSION 46 #define SCALED_REF_LAYER_OFFSETS 1 ///< M0309: Signal scaled reference layer offsets in SPS 46 47 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle 47 48 -
branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r174 r175 712 712 } 713 713 714 #if SCALED_REF_LAYER_OFFSETS 715 if( pcSPS->getLayerId() > 0 ) 716 { 717 Int iCode; 718 Window& scaledWindow = pcSPS->getScaledRefLayerWindow(); 719 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 720 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 721 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 722 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 723 } 724 #endif 725 714 726 READ_FLAG( uiCode, "sps_extension_flag"); 715 727 if (uiCode) -
branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp
r174 r175 836 836 if ( pcPic->isSpatialEnhLayer()) 837 837 { 838 #if SCALED_REF_LAYER_OFFSETS 839 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 840 #else 838 841 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 842 #endif 839 843 } 840 844 else … … 948 952 if (m_layerId > 0) 949 953 { 954 #if SCALED_REF_LAYER_OFFSETS 955 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(); 956 957 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 958 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 959 960 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 961 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 962 #else 950 963 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 951 964 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); … … 956 969 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 957 970 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 958 971 #endif 959 972 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 960 973 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); -
branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r174 r175 553 553 codeVUI(pcSPS->getVuiParameters(), pcSPS); 554 554 } 555 #if SCALED_REF_LAYER_OFFSETS 556 if( pcSPS->getLayerId() > 0 ) 557 { 558 Window scaledWindow = pcSPS->getScaledRefLayerWindow(); 559 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 560 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 561 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 562 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 563 } 564 #endif 555 565 556 566 WRITE_FLAG( 0, "sps_extension_flag" ); -
branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r174 r175 690 690 #if SVC_UPSAMPLING 691 691 if ( pcPic->isSpatialEnhLayer()) 692 { 692 { 693 #if SCALED_REF_LAYER_OFFSETS 694 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 695 #else 693 696 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 697 #endif 694 698 } 695 699 else … … 976 980 if (m_layerId > 0) 977 981 { 982 #if SCALED_REF_LAYER_OFFSETS 983 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(); 984 985 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 986 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 987 988 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 989 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 990 #else 978 991 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 979 992 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); … … 984 997 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 985 998 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 986 999 #endif 987 1000 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 988 1001 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); -
branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
r164 r175 576 576 m_cSPS.setMFMEnabledFlag(m_bMFMEnabledFlag); 577 577 #endif 578 #if SCALED_REF_LAYER_OFFSETS 579 m_cSPS.getScaledRefLayerWindow() = m_scaledRefLayerWindow; 580 #endif 578 581 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); 579 582 profileTierLevel.setLevelIdc(m_level); -
branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.h
r134 r175 139 139 Bool m_bMFMEnabledFlag; 140 140 #endif 141 #if SCALED_REF_LAYER_OFFSETS 142 Window m_scaledRefLayerWindow; 143 #endif 141 144 protected: 142 145 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 203 206 Void setNumPicRcvd ( Int num ) { m_iNumPicRcvd = num; } 204 207 #endif 208 #if SCALED_REF_LAYER_OFFSETS 209 Window& getScaledRefLayerWindow() { return m_scaledRefLayerWindow; } 210 #endif 205 211 206 212 // -------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.