Changeset 1270 in 3DVCSoftware for branches/HTM14.1updatedev3/source/Lib/TLibCommon/TComYuv.cpp
 Timestamp:
 13 Jul 2015, 15:22:02 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/HTM14.1updatedev3/source/Lib/TLibCommon/TComYuv.cpp
r1200 r1270 487 487 } 488 488 489 #if H_3D_ARP490 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )491 { 492 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip );493 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );494 } 495 496 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )489 #if NH_3D_ARP 490 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths ) 491 { 492 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip , clipBitDepths); 493 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip , clipBitDepths); 494 } 495 496 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths ) 497 497 { 498 498 Int x, y; 499 499 500 Pel* pSrc0 = pcYuvSrc0>getLumaAddr( uiAbsPartIdx ); 501 Pel* pSrc1 = pcYuvSrc1>getLumaAddr( uiAbsPartIdx ); 502 Pel* pDst = getLumaAddr( uiAbsPartIdx ); 503 504 UInt iSrc0Stride = pcYuvSrc0>getStride(); 505 UInt iSrc1Stride = pcYuvSrc1>getStride(); 506 UInt iDstStride = getStride(); 507 Int iIFshift = IF_INTERNAL_PREC  g_bitDepthY; 500 Pel* pSrc0 = pcYuvSrc0>getAddr( COMPONENT_Y, uiAbsPartIdx ); 501 Pel* pSrc1 = pcYuvSrc1>getAddr( COMPONENT_Y, uiAbsPartIdx ); 502 Pel* pDst = getAddr( COMPONENT_Y, uiAbsPartIdx ); 503 504 UInt iSrc0Stride = pcYuvSrc0>getStride(COMPONENT_Y); 505 UInt iSrc1Stride = pcYuvSrc1>getStride(COMPONENT_Y); 506 UInt iDstStride = getStride(COMPONENT_Y); 507 const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_LUMA]; 508 Int iIFshift = IF_INTERNAL_PREC  clipbd; 508 509 Int iOffSet = ( 1 << ( iIFshift  1 ) ) + IF_INTERNAL_OFFS; 509 510 for ( y = uiHeight1; y >= 0; y ) … … 514 515 if( bClip ) 515 516 { 516 pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift);517 pDst[x] = Pel(ClipBD<Int>(Int( ( pDst[x] + iOffSet ) >> iIFshift ), clipbd)); 517 518 } 518 519 } … … 523 524 } 524 525 525 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )526 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths ) 526 527 { 527 528 Int x, y; 528 529 529 Pel* pSrcU0 = pcYuvSrc0>getCbAddr( uiAbsPartIdx ); 530 Pel* pSrcU1 = pcYuvSrc1>getCbAddr( uiAbsPartIdx ); 531 Pel* pSrcV0 = pcYuvSrc0>getCrAddr( uiAbsPartIdx ); 532 Pel* pSrcV1 = pcYuvSrc1>getCrAddr( uiAbsPartIdx ); 533 Pel* pDstU = getCbAddr( uiAbsPartIdx ); 534 Pel* pDstV = getCrAddr( uiAbsPartIdx ); 535 536 UInt iSrc0Stride = pcYuvSrc0>getCStride(); 537 UInt iSrc1Stride = pcYuvSrc1>getCStride(); 538 UInt iDstStride = getCStride(); 539 540 Int iIFshift = IF_INTERNAL_PREC  g_bitDepthC; 530 Pel* pSrcU0 = pcYuvSrc0>getAddr( COMPONENT_Cb, uiAbsPartIdx ); 531 Pel* pSrcU1 = pcYuvSrc1>getAddr( COMPONENT_Cb, uiAbsPartIdx ); 532 Pel* pSrcV0 = pcYuvSrc0>getAddr( COMPONENT_Cr, uiAbsPartIdx ); 533 Pel* pSrcV1 = pcYuvSrc1>getAddr( COMPONENT_Cr, uiAbsPartIdx ); 534 Pel* pDstU = getAddr( COMPONENT_Cb, uiAbsPartIdx ); 535 Pel* pDstV = getAddr( COMPONENT_Cr, uiAbsPartIdx ); 536 537 UInt iSrc0StrideCb = pcYuvSrc0>getStride(COMPONENT_Cb); 538 UInt iSrc1StrideCb = pcYuvSrc1>getStride(COMPONENT_Cb); 539 UInt iDstStrideCb = getStride(COMPONENT_Cb); 540 541 UInt iSrc0StrideCr = pcYuvSrc0>getStride(COMPONENT_Cr); 542 UInt iSrc1StrideCr = pcYuvSrc1>getStride(COMPONENT_Cr); 543 UInt iDstStrideCr = getStride(COMPONENT_Cr); 544 545 const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_CHROMA]; 546 Int iIFshift = IF_INTERNAL_PREC  clipbd; 541 547 Int iOffSet = ( 1 << ( iIFshift  1 ) ) + IF_INTERNAL_OFFS; 542 548 … … 549 555 if( bClip ) 550 556 { 551 pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift ); 552 pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift ); 553 } 554 } 555 557 pDstU[x] = Pel(ClipBD<Int>( Int( ( pDstU[x] + iOffSet ) >> iIFshift ), clipbd)); 558 pDstV[x] = Pel(ClipBD<Int>( Int( ( pDstV[x] + iOffSet ) >> iIFshift ), clipbd)); 559 } 560 } 561 562 pSrcU0 += iSrc0StrideCb; 563 pSrcU1 += iSrc1StrideCb; 564 pSrcV0 += iSrc0StrideCr; 565 pSrcV1 += iSrc1StrideCr; 566 pDstU += iDstStrideCb; 567 pDstV += iDstStrideCr; 568 } 569 } 570 571 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) 572 { 573 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight ); 574 575 if (uiWidth > 8 && pcYuvSrc1>getNumberValidComponents() > 1) 576 { 577 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 ); 578 } 579 } 580 581 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) 582 { 583 Int x, y; 584 585 Pel* pSrc0 = pcYuvSrc0>getAddr(COMPONENT_Y, uiAbsPartIdx ); 586 Pel* pSrc1 = pcYuvSrc1>getAddr(COMPONENT_Y, uiAbsPartIdx ); 587 Pel* pDst = getAddr (COMPONENT_Y, uiAbsPartIdx ); 588 589 Int iSrc0Stride = pcYuvSrc0>getStride(COMPONENT_Y); 590 Int iSrc1Stride = pcYuvSrc1>getStride(COMPONENT_Y); 591 Int iDstStride = getStride(COMPONENT_Y); 592 for ( y = uiHeight1; y >= 0; y ) 593 { 594 for ( x = uiWidth1; x >= 0; x ) 595 { 596 pDst[x] = pSrc0[x]  pSrc1[x]; 597 } 598 pSrc0 += iSrc0Stride; 599 pSrc1 += iSrc1Stride; 600 pDst += iDstStride; 601 } 602 } 603 604 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) 605 { 606 Int x, y; 607 608 Pel* pSrcU0 = pcYuvSrc0>getAddr(COMPONENT_Cb, uiAbsPartIdx ); 609 Pel* pSrcU1 = pcYuvSrc1>getAddr(COMPONENT_Cb, uiAbsPartIdx ); 610 Pel* pSrcV0 = pcYuvSrc0>getAddr(COMPONENT_Cr, uiAbsPartIdx ); 611 Pel* pSrcV1 = pcYuvSrc1>getAddr(COMPONENT_Cr, uiAbsPartIdx ); 612 Pel* pDstU = getAddr(COMPONENT_Cb, uiAbsPartIdx ); 613 Pel* pDstV = getAddr(COMPONENT_Cr, uiAbsPartIdx ); 614 615 Int iSrc0Stride = pcYuvSrc0>getStride(COMPONENT_Cb); 616 Int iSrc1Stride = pcYuvSrc1>getStride(COMPONENT_Cb); 617 Int iDstStride = getStride( COMPONENT_Cb ); 618 for ( y = uiHeight1; y >= 0; y ) 619 { 620 for ( x = uiWidth1; x >= 0; x ) 621 { 622 pDstU[x] = pSrcU0[x]  pSrcU1[x]; 623 pDstV[x] = pSrcV0[x]  pSrcV1[x]; 624 } 556 625 pSrcU0 += iSrc0Stride; 557 626 pSrcU1 += iSrc1Stride; … … 563 632 } 564 633 565 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )566 {567 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight );568 569 if (uiWidth > 8)570 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );571 }572 573 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )574 {575 Int x, y;576 577 Pel* pSrc0 = pcYuvSrc0>getLumaAddr( uiAbsPartIdx );578 Pel* pSrc1 = pcYuvSrc1>getLumaAddr( uiAbsPartIdx );579 Pel* pDst = getLumaAddr( uiAbsPartIdx );580 581 Int iSrc0Stride = pcYuvSrc0>getStride();582 Int iSrc1Stride = pcYuvSrc1>getStride();583 Int iDstStride = getStride();584 for ( y = uiHeight1; y >= 0; y )585 {586 for ( x = uiWidth1; x >= 0; x )587 {588 pDst[x] = pSrc0[x]  pSrc1[x];589 }590 pSrc0 += iSrc0Stride;591 pSrc1 += iSrc1Stride;592 pDst += iDstStride;593 }594 }595 596 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )597 {598 Int x, y;599 600 Pel* pSrcU0 = pcYuvSrc0>getCbAddr( uiAbsPartIdx );601 Pel* pSrcU1 = pcYuvSrc1>getCbAddr( uiAbsPartIdx );602 Pel* pSrcV0 = pcYuvSrc0>getCrAddr( uiAbsPartIdx );603 Pel* pSrcV1 = pcYuvSrc1>getCrAddr( uiAbsPartIdx );604 Pel* pDstU = getCbAddr( uiAbsPartIdx );605 Pel* pDstV = getCrAddr( uiAbsPartIdx );606 607 Int iSrc0Stride = pcYuvSrc0>getCStride();608 Int iSrc1Stride = pcYuvSrc1>getCStride();609 Int iDstStride = getCStride();610 for ( y = uiHeight1; y >= 0; y )611 {612 for ( x = uiWidth1; x >= 0; x )613 {614 pDstU[x] = pSrcU0[x]  pSrcU1[x];615 pDstV[x] = pSrcV0[x]  pSrcV1[x];616 }617 pSrcU0 += iSrc0Stride;618 pSrcU1 += iSrc1Stride;619 pSrcV0 += iSrc0Stride;620 pSrcV1 += iSrc1Stride;621 pDstU += iDstStride;622 pDstV += iDstStride;623 }624 }625 626 634 Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 627 635 { 628 636 multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW ); 629 637 630 if (uiWidth > 8) 638 if ( uiWidth > 8 && getNumberValidComponents() > 1 ) 639 { 631 640 multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW ); 641 } 632 642 } 633 643 … … 641 651 Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 642 652 { 643 Pel* pDst = get LumaAddr(uiAbsPartIdx );644 Int iDstStride = getStride( );653 Pel* pDst = getAddr(COMPONENT_Y, uiAbsPartIdx ); 654 Int iDstStride = getStride(COMPONENT_Y); 645 655 for ( Int y = uiHeight1; y >= 0; y ) 646 656 { … … 652 662 Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 653 663 { 654 Pel* pDstU = get CbAddr(uiAbsPartIdx );655 Pel* pDstV = get CrAddr(uiAbsPartIdx );656 657 Int iDstStride = get CStride();664 Pel* pDstU = getAddr( COMPONENT_Cb, uiAbsPartIdx ); 665 Pel* pDstV = getAddr( COMPONENT_Cr, uiAbsPartIdx ); 666 667 Int iDstStride = getStride( COMPONENT_Cb ); 658 668 for ( Int y = uiHeight1; y >= 0; y ) 659 669 {
Note: See TracChangeset for help on using the changeset viewer.