Changeset 1072 in 3DVCSoftware for branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComYuv.cpp
- Timestamp:
- 13 Oct 2014, 16:44:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComYuv.cpp
r1039 r1072 647 647 } 648 648 } 649 #if H_3D650 Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )651 {652 Int x, y;653 654 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx);655 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx);656 Pel* pDst = getLumaAddr( uiTrUnitIdx);657 658 UInt iSrc0Stride = pcYuvSrc0->getStride();659 UInt iSrc1Stride = pcYuvSrc1->getStride();660 UInt iDstStride = getStride();661 for ( y = uiPartSize-1; y >= 0; y-- )662 {663 for ( x = uiPartSize-1; x >= 0; x-- )664 {665 pDst[x] = ClipY( pSrc0[x] + pSrc1[x] );666 }667 pSrc0 += iSrc0Stride;668 pSrc1 += iSrc1Stride;669 pDst += iDstStride;670 }671 }672 673 #if H_3D_ARP674 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )675 {676 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip );677 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );678 }679 680 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )681 {682 Int x, y;683 684 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );685 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );686 Pel* pDst = getLumaAddr( uiAbsPartIdx );687 688 UInt iSrc0Stride = pcYuvSrc0->getStride();689 UInt iSrc1Stride = pcYuvSrc1->getStride();690 UInt iDstStride = getStride();691 #if QC_I0129_ARP_FIX692 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;693 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;694 #endif695 for ( y = uiHeight-1; y >= 0; y-- )696 {697 for ( x = uiWidth-1; x >= 0; x-- )698 {699 pDst[x] = pSrc0[x] + pSrc1[x];700 if( bClip )701 {702 #if QC_I0129_ARP_FIX703 pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift );704 #else705 pDst[x] = ClipY( pDst[x] );706 #endif707 }708 }709 pSrc0 += iSrc0Stride;710 pSrc1 += iSrc1Stride;711 pDst += iDstStride;712 }713 }714 715 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )716 {717 Int x, y;718 719 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );720 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );721 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );722 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );723 Pel* pDstU = getCbAddr( uiAbsPartIdx );724 Pel* pDstV = getCrAddr( uiAbsPartIdx );725 726 UInt iSrc0Stride = pcYuvSrc0->getCStride();727 UInt iSrc1Stride = pcYuvSrc1->getCStride();728 UInt iDstStride = getCStride();729 #if QC_I0129_ARP_FIX730 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;731 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;732 #endif733 for ( y = uiHeight-1; y >= 0; y-- )734 {735 for ( x = uiWidth-1; x >= 0; x-- )736 {737 pDstU[x] = pSrcU0[x] + pSrcU1[x];738 pDstV[x] = pSrcV0[x] + pSrcV1[x];739 if( bClip )740 {741 #if QC_I0129_ARP_FIX742 pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift );743 pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift );744 #else745 pDstU[x] = ClipC( pDstU[x] );746 pDstV[x] = ClipC( pDstV[x] );747 #endif748 }749 }750 751 pSrcU0 += iSrc0Stride;752 pSrcU1 += iSrc1Stride;753 pSrcV0 += iSrc0Stride;754 pSrcV1 += iSrc1Stride;755 pDstU += iDstStride;756 pDstV += iDstStride;757 }758 }759 760 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )761 {762 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight );763 #if SHARP_ARP_CHROMA_I0104764 if (uiWidth > 8)765 #endif766 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );767 }768 769 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )770 {771 Int x, y;772 773 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );774 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );775 Pel* pDst = getLumaAddr( uiAbsPartIdx );776 777 Int iSrc0Stride = pcYuvSrc0->getStride();778 Int iSrc1Stride = pcYuvSrc1->getStride();779 Int iDstStride = getStride();780 for ( y = uiHeight-1; y >= 0; y-- )781 {782 for ( x = uiWidth-1; x >= 0; x-- )783 {784 pDst[x] = pSrc0[x] - pSrc1[x];785 }786 pSrc0 += iSrc0Stride;787 pSrc1 += iSrc1Stride;788 pDst += iDstStride;789 }790 }791 792 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )793 {794 Int x, y;795 796 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );797 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );798 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );799 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );800 Pel* pDstU = getCbAddr( uiAbsPartIdx );801 Pel* pDstV = getCrAddr( uiAbsPartIdx );802 803 Int iSrc0Stride = pcYuvSrc0->getCStride();804 Int iSrc1Stride = pcYuvSrc1->getCStride();805 Int iDstStride = getCStride();806 for ( y = uiHeight-1; y >= 0; y-- )807 {808 for ( x = uiWidth-1; x >= 0; x-- )809 {810 pDstU[x] = pSrcU0[x] - pSrcU1[x];811 pDstV[x] = pSrcV0[x] - pSrcV1[x];812 }813 pSrcU0 += iSrc0Stride;814 pSrcU1 += iSrc1Stride;815 pSrcV0 += iSrc0Stride;816 pSrcV1 += iSrc1Stride;817 pDstU += iDstStride;818 pDstV += iDstStride;819 }820 }821 822 Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )823 {824 multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );825 #if SHARP_ARP_CHROMA_I0104826 if (uiWidth > 8)827 #endif828 multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );829 }830 831 Void TComYuv::xxMultiplyLine( Pel* pSrcDst , UInt uiWidth , UChar dW )832 {833 assert( dW == 2 );834 for( UInt x = 0 ; x < uiWidth ; x++ )835 pSrcDst[x] = pSrcDst[x] >> 1;836 }837 838 Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )839 {840 Pel* pDst = getLumaAddr( uiAbsPartIdx );841 Int iDstStride = getStride();842 for ( Int y = uiHeight-1; y >= 0; y-- )843 {844 xxMultiplyLine( pDst , uiWidth , dW );845 pDst += iDstStride;846 }847 }848 849 Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )850 {851 Pel* pDstU = getCbAddr( uiAbsPartIdx );852 Pel* pDstV = getCrAddr( uiAbsPartIdx );853 854 Int iDstStride = getCStride();855 for ( Int y = uiHeight-1; y >= 0; y-- )856 {857 xxMultiplyLine( pDstU , uiWidth , dW );858 xxMultiplyLine( pDstV , uiWidth , dW );859 pDstU += iDstStride;860 pDstV += iDstStride;861 }862 }863 #endif864 #endif865 649 866 650 //! \}
Note: See TracChangeset for help on using the changeset viewer.