Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPrediction.cpp
- Timestamp:
- 20 Feb 2013, 22:07:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r210 r296 54 54 { 55 55 m_piYuvExt = NULL; 56 #if MERL_VSP_C0152 57 m_pDepth = (Int*) malloc(64*64*sizeof(Int)); // TODO: Use a smart way to determine the size of the array 58 if (m_pDepth == NULL) 59 { 60 printf("ERROR: UKTGHU, No memory allocated.\n"); 61 } 62 #endif 56 63 } 57 64 … … 59 66 { 60 67 68 #if MERL_VSP_C0152 69 if (m_pDepth != NULL) 70 { 71 free(m_pDepth); 72 } 73 #endif 61 74 delete[] m_piYuvExt; 62 75 … … 190 203 191 204 // Map the mode index to main prediction direction and angle 192 #if LOGI_INTRA_NAME_3MPM193 205 assert( dirMode > 0 ); //no planar 194 206 Bool modeDC = dirMode < 2; … … 196 208 Bool modeVer = !modeDC && !modeHor; 197 209 Int intraPredAngle = modeVer ? (Int)dirMode - VER_IDX : modeHor ? -((Int)dirMode - HOR_IDX) : 0; 198 #else199 Bool modeDC = dirMode == 0;200 Bool modeVer = !modeDC && (dirMode < 18);201 Bool modeHor = !modeDC && !modeVer;202 Int intraPredAngle = modeVer ? dirMode - 9 : modeHor ? dirMode - 25 : 0;203 #endif204 210 Int absAng = abs(intraPredAngle); 205 211 Int signAng = intraPredAngle < 0 ? -1 : 1; … … 284 290 for (k=0;k<blkSize;k++) 285 291 { 286 #if REMOVE_DIV_OPERATION287 292 pDst[k*dstStride] = Clip ( pDst[k*dstStride] + (( refSide[k+1] - refSide[0] ) >> 1) ); 288 #else289 pDst[k*dstStride] = Clip ( pDst[k*dstStride] + ( refSide[k+1] - refSide[0] ) / 2 );290 #endif291 293 } 292 294 } … … 363 365 else 364 366 { 365 #if LOGI_INTRA_NAME_3MPM366 367 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, true ); 367 #else368 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, true );369 #endif370 368 371 369 if( (uiDirMode == DC_IDX ) && bAbove && bLeft ) … … 392 390 { 393 391 // Create the prediction 394 #if LOGI_INTRA_NAME_3MPM395 392 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, false ); 396 #else397 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, false );398 #endif399 393 } 400 394 } … … 605 599 606 600 #if DEPTH_MAP_GENERATION 601 #if MERL_VSP_C0152 602 Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY ) 603 #else 607 604 Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY ) 605 #endif 606 #else 607 #if MERL_VSP_C0152 608 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx ) 608 609 #else 609 610 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) 611 #endif 610 612 #endif 611 613 { … … 635 637 { 636 638 #if DEPTH_MAP_GENERATION 639 #if MERL_VSP_C0152 640 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 641 #else 637 642 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 643 #endif 644 #else 645 #if MERL_VSP_C0152 646 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 638 647 #else 639 648 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 640 649 #endif 650 #endif 641 651 } 642 652 else 643 653 { 644 654 #if DEPTH_MAP_GENERATION 655 #if MERL_VSP_C0152 656 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 657 #else 645 658 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 659 #endif 660 #else 661 #if MERL_VSP_C0152 662 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 646 663 #else 647 664 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 665 #endif 648 666 #endif 649 667 } … … 666 684 { 667 685 #if DEPTH_MAP_GENERATION 686 #if MERL_VSP_C0152 687 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 688 #else 668 689 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 690 #endif 691 #else 692 #if MERL_VSP_C0152 693 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 669 694 #else 670 695 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 671 696 #endif 697 #endif 672 698 } 673 699 else 674 700 { 675 701 #if DEPTH_MAP_GENERATION 702 #if MERL_VSP_C0152 703 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 704 #else 676 705 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 706 #endif 707 #else 708 #if MERL_VSP_C0152 709 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 677 710 #else 678 711 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 712 #endif 679 713 #endif 680 714 } … … 704 738 { 705 739 #if DEPTH_MAP_GENERATION 740 #if MERL_VSP_C0152 741 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 742 #else 706 743 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 744 #endif 745 #else 746 #if MERL_VSP_C0152 747 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 707 748 #else 708 749 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 709 #endif 710 } 711 else 712 { 750 #endif 751 #endif 752 } 753 else 754 { 713 755 #if DEPTH_MAP_GENERATION 756 #if MERL_VSP_C0152 757 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 758 #else 714 759 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 760 #endif 761 #else 762 #if MERL_VSP_C0152 763 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 715 764 #else 716 765 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 717 #endif 766 #endif 767 #endif 718 768 } 719 769 #if DEPTH_MAP_GENERATION 770 #if MERL_VSP_C0152 771 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 772 #else 720 773 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 774 #endif 775 #else 776 #if MERL_VSP_C0152 777 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 721 778 #else 722 779 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 723 #endif 780 #endif 781 #endif 724 782 #if LGE_ILLUCOMP_B0045 725 783 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr)) 726 784 #else 727 if ( pcCU->getSlice()->getPPS()->getUseWP())785 if( pcCU->getSlice()->getPPS()->getUseWP()) 728 786 #endif 729 787 { … … 736 794 { 737 795 #if DEPTH_MAP_GENERATION 796 #if MERL_VSP_C0152 797 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 798 #else 738 799 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 800 #endif 801 #else 802 #if MERL_VSP_C0152 803 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 739 804 #else 740 805 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 806 #endif 807 #endif 808 } 809 else 810 { 811 #if DEPTH_MAP_GENERATION 812 #if MERL_VSP_C0152 813 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 814 #else 815 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 816 #endif 817 #else 818 #if MERL_VSP_C0152 819 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 820 #else 821 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 741 822 #endif 742 } 743 else 744 { 823 #endif 824 } 825 } 826 } 827 return; 828 } 829 830 #if MTK_MDIVRP_C0138 831 Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred) 832 { 833 Int iWidth; 834 Int iHeight; 835 UInt uiPartAddr; 836 837 pcCU->getPartIndexAndSize( 0, uiPartAddr, iWidth, iHeight ); 838 839 Bool bResAvail = false; 840 841 bResAvail = pcCU->getResidualSamples( 0, true, pcYuvResPred ); 842 843 assert (bResAvail); 844 845 pcYuvPred->add(pcYuvResPred, iWidth, iHeight); 846 } 847 #endif 848 745 849 #if DEPTH_MAP_GENERATION 746 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 747 #else 748 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 749 #endif 750 } 751 } 752 } 753 return; 754 } 755 756 757 758 #if DEPTH_MAP_GENERATION 850 #if MERL_VSP_C0152 851 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi ) 852 #else 759 853 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi ) 854 #endif 855 #else 856 #if MERL_VSP_C0152 857 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi ) 760 858 #else 761 859 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi ) 762 860 #endif 763 { 861 #endif 862 { 863 #if MERL_VSP_C0152 864 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 865 Int vspIdx = pcCU->getVSPIndex(uiPartAddr); 866 if (vspIdx != 0) 867 { 868 if (iRefIdx >= 0) 869 { 870 printf("vspIdx = %d, iRefIdx = %d\n", vspIdx, iRefIdx); 871 } 872 assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID); 873 } 874 else 875 { 876 assert (iRefIdx >= 0); 877 } 878 #else 764 879 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); assert (iRefIdx >= 0); 765 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 880 #endif 881 882 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 766 883 pcCU->clipMv(cMv); 767 884 … … 784 901 if( pcCU->getSlice()->getSPS()->isDepth() ) 785 902 { 786 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 787 UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0; 903 #if MERL_VSP_C0152 904 if (vspIdx != 0) 905 { // depth, vsp 906 // get depth estimator here 907 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); 908 TComPicYuv* pcBaseViewDepthPicYuv = NULL; 909 if (vspIdx < 4) // spatial 910 { 911 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 912 } 913 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 914 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 915 Int* pShiftLUT; 916 Int iShiftPrec; 917 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec); 918 //using disparity to find the depth block of the base view as the depth block estimator of the current block 919 //using depth block estimator and base view texture to get Backward warping 920 xPredInterLumaBlkFromDM ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 921 xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 922 } 923 else 924 { 925 #endif 926 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 927 UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0; 928 #if LGE_ILLUCOMP_DEPTH_C0046 929 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 930 #endif 788 931 #if DEPTH_MAP_GENERATION 789 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset ); 790 #else 791 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset ); 792 #endif 932 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset 933 #if LGE_ILLUCOMP_DEPTH_C0046 934 , bICFlag 935 #endif 936 ); 937 #else 938 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset ); 939 #endif 940 #if MERL_VSP_C0152 941 } 942 #endif// MERL_VSP_C0152 //else 793 943 } 794 944 else 795 945 { 796 946 #endif 947 #if MERL_VSP_C0152 948 if ( vspIdx != 0 ) 949 { // texture, vsp 950 TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPicBaseTxt(); 951 TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 952 TComPicYuv* pcBaseViewDepthPicYuv = NULL; 953 if (vspIdx < 4) // spatial 954 { 955 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); 956 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 957 } 958 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 959 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 960 Int* pShiftLUT; 961 Int iShiftPrec; 962 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec); 963 964 //using disparity to find the depth block of the base view as the depth block estimator of the current block 965 //using depth block estimator and base view texture to get Backward warping 966 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 967 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 968 } 969 else//texture not VSP 970 { 971 #endif //MERL_VSP_C0152 797 972 #if LGE_ILLUCOMP_B0045 798 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 799 800 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag); 801 #else 802 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 803 #endif 973 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 974 975 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag); 976 #else 977 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 978 #endif 979 #if MERL_VSP_C0152 980 } //texture not VSP 981 #endif 804 982 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 805 983 } 984 #endif 985 986 #if MERL_VSP_C0152 987 if ( vspIdx == 0 )//Not VSP 988 { 806 989 #endif 807 990 #if LGE_ILLUCOMP_B0045 … … 812 995 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 813 996 #endif 997 #if MERL_VSP_C0152 998 } 999 #endif 814 1000 } 815 1001 816 1002 817 1003 #if DEPTH_MAP_GENERATION 1004 #if MERL_VSP_C0152 1005 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 1006 #else 818 1007 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 1008 #endif 1009 #else 1010 #if MERL_VSP_C0152 1011 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ) 819 1012 #else 820 1013 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ) 1014 #endif 821 1015 #endif 822 1016 { … … 829 1023 iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 830 1024 1025 #if MERL_VSP_C0152 1026 if(!pcCU->getVSPIndex(uiPartAddr)) 1027 { 1028 if ( iRefIdx[iRefList] < 0 ) 1029 { 1030 continue; 1031 } 1032 } 1033 else 1034 { 1035 if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID 1036 { 1037 continue; 1038 } 1039 } 1040 #else 831 1041 if ( iRefIdx[iRefList] < 0 ) 832 1042 { 833 1043 continue; 834 1044 } 1045 #endif 835 1046 836 1047 assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) ); … … 840 1051 { 841 1052 #if DEPTH_MAP_GENERATION 1053 #if MERL_VSP_C0152 1054 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1055 #else 842 1056 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1057 #endif 1058 #else 1059 #if MERL_VSP_C0152 1060 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 843 1061 #else 844 1062 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 845 1063 #endif 1064 #endif 846 1065 } 847 1066 else … … 850 1069 { 851 1070 #if DEPTH_MAP_GENERATION 1071 #if MERL_VSP_C0152 1072 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1073 #else 852 1074 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1075 #endif 1076 #else 1077 #if MERL_VSP_C0152 1078 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 853 1079 #else 854 1080 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 855 1081 #endif 1082 #endif 856 1083 } 857 1084 else 858 1085 { 859 1086 #if DEPTH_MAP_GENERATION 1087 #if MERL_VSP_C0152 1088 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 1089 #else 860 1090 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 1091 #endif 1092 #else 1093 #if MERL_VSP_C0152 1094 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false ); 861 1095 #else 862 1096 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false ); 863 1097 #endif 1098 #endif 864 1099 } 865 1100 } … … 868 1103 if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() ) 869 1104 { 1105 #if MERL_VSP_C0152 1106 if(pcCU->getVSPIndex(uiPartAddr)) 1107 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1108 else 1109 #endif 870 1110 xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 871 1111 } … … 879 1119 else 880 1120 { 1121 #if MERL_VSP_C0152 1122 if(pcCU->getVSPIndex(uiPartAddr)) 1123 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1124 else 1125 #endif 1126 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1127 } 1128 #else 881 1129 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 882 } 883 #else 884 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 885 #endif 886 } 887 } 1130 #endif 1131 } 1132 } 1133 1134 888 1135 889 1136 Void 890 1137 #if DEPTH_MAP_GENERATION 891 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ) 1138 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 1139 #if LGE_ILLUCOMP_DEPTH_C0046 1140 , Bool bICFlag 1141 #endif 1142 ) 892 1143 #else 893 1144 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ) … … 941 1192 } 942 1193 } 1194 1195 #if LGE_ILLUCOMP_DEPTH_C0046 1196 if(bICFlag) 1197 { 1198 Int a, b, iShift; 1199 TComMv tTmpMV(pcMv->getHor()<<2, pcMv->getVer()<<2); 1200 1201 piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 1202 piDstY = rpcYuv->getLumaAddr( uiPartAddr ); 1203 1204 xGetLLSICPrediction(pcCU, &tTmpMV, pcPicYuvRef, a, b, iShift); 1205 1206 for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride ) 1207 { 1208 for( Int x = 0; x < iWidth; x++ ) 1209 { 1210 if(uiOffset) 1211 { 1212 Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 1213 piDstY[ x ] = ( (a*piDstY[ x ]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS; 1214 } 1215 else 1216 piDstY[ x ] = Clip( ( (a*piDstY[ x ]) >> iShift ) + b ); 1217 } 1218 } 1219 } 1220 #endif 943 1221 } 944 1222 … … 1119 1397 } 1120 1398 1399 #if MERL_VSP_C0152 1400 // Input: 1401 // refPic: Ref picture. Full picture, with padding 1402 // posX, posY: PU position, texture 1403 // size_x, size_y: PU size 1404 // partAddr: z-order index 1405 // mv: disparity vector. derived from neighboring blocks 1406 // 1407 // Output: dstPic, PU predictor 64x64 1408 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1409 , TComYuv *&dstPic ) 1410 { 1411 Int widthLuma; 1412 Int heightLuma; 1413 1414 if (isDepth) 1415 { 1416 widthLuma = pPicBaseDepth->getWidth(); 1417 heightLuma = pPicBaseDepth->getHeight(); 1418 } 1419 else 1420 { 1421 widthLuma = refPic->getWidth(); 1422 heightLuma = refPic->getHeight(); 1423 } 1424 1425 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1426 Int widthDepth = pPicBaseDepth->getWidth(); 1427 Int heightDepth = pPicBaseDepth->getHeight(); 1428 #endif 1429 1430 Int nTxtPerDepthX = widthLuma / ( pPicBaseDepth->getWidth() ); // texture pixel # per depth pixel 1431 Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() ); 1432 1433 Int refStride = refPic->getStride(); 1434 Int dstStride = dstPic->getStride(); 1435 Int depStride = pPicBaseDepth->getStride(); 1436 1437 Int depthPosX = Clip3(0, widthLuma - size_x - 1, (posX/nTxtPerDepthX) + (mv->getHor()>>2)); 1438 Int depthPosY = Clip3(0, heightLuma- size_y - 1, (posY/nTxtPerDepthY) + (mv->getVer()>>2)); 1439 1440 Pel *ref = refPic->getLumaAddr() + posX + posY * refStride; 1441 Pel *dst = dstPic->getLumaAddr(partAddr); 1442 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; 1443 1444 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1445 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1446 Int dW = size_x>>1; 1447 Int dH = size_y>>1; 1448 #endif 1449 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1450 Int dW = size_x>>2; 1451 Int dH = size_y>>2; 1452 #endif 1453 { 1454 Pel* depthi = depth; 1455 for (Int j = 0; j < dH; j++) 1456 { 1457 for (Int i = 0; i < dW; i++) 1458 { 1459 Pel* depthTmp; 1460 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1461 if (depthPosX + (i<<1) < widthDepth) 1462 depthTmp = depthi + (i << 1); 1463 else 1464 depthTmp = depthi + (widthDepth - depthPosX - 1); 1465 #endif 1466 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1467 if (depthPosX + (i<<2) < widthDepth) 1468 depthTmp = depthi + (i << 2); 1469 else 1470 depthTmp = depthi + (widthDepth - depthPosX - 1); 1471 #endif 1472 Int maxV = 0; 1473 for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++) 1474 { 1475 Int iX = 0; 1476 for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++) 1477 { 1478 if (maxV < depthTmp[iX]) 1479 maxV = depthTmp[iX]; 1480 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1481 if (depthPosX + (i<<1) + blocki < widthDepth - 1) 1482 #else // MERL_VSP_BLOCKSIZE_C0152 == 4 1483 if (depthPosX + (i<<2) + blocki < widthDepth - 1) 1484 #endif 1485 iX++; 1486 } 1487 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1488 if (depthPosY + (j<<1) + blockj < heightDepth - 1) 1489 #else // MERL_VSP_BLOCKSIZE_C0152 == 4 1490 if (depthPosY + (j<<2) + blockj < heightDepth - 1) 1491 #endif 1492 depthTmp += depStride; 1493 } 1494 m_pDepth[i+j*dW] = maxV; 1495 } // end of i < dW 1496 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1497 if (depthPosY + ((j+1)<<1) < heightDepth) 1498 depthi += (depStride << 1); 1499 else 1500 depthi = depth + (heightDepth-depthPosY-1)*depStride; 1501 #endif 1502 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1503 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 1504 depthi += (depStride << 2); 1505 else 1506 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 1507 #endif 1508 } 1509 } 1510 #endif 1511 1512 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1513 Int yDepth = 0; 1514 #endif 1515 for ( Int yTxt = 0; yTxt < size_y; yTxt += nTxtPerDepthY ) 1516 { 1517 for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth++ ) 1518 { 1519 Pel rep_depth = 0; // to store the depth value used for warping 1520 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1521 rep_depth = depth[xDepth]; 1522 #endif 1523 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1524 rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1525 #endif 1526 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1527 rep_depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW]; 1528 #endif 1529 1530 assert( rep_depth >= 0 && rep_depth <= 255 ); 1531 Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec; 1532 Int refOffset = xTxt + (disparity >> 2); 1533 Int xFrac = disparity & 0x3; 1534 Int absX = posX + refOffset; 1535 1536 if (xFrac == 0) 1537 absX = Clip3(0, widthLuma-1, absX); 1538 else 1539 absX = Clip3(4, widthLuma-5, absX); 1540 1541 refOffset = absX - posX; 1542 1543 assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 ); 1544 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true ); 1545 } 1546 ref += refStride*nTxtPerDepthY; 1547 dst += dstStride*nTxtPerDepthY; 1548 depth += depStride; 1549 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1550 yDepth++; 1551 #endif 1552 } 1553 } 1554 1555 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1556 , TComYuv *&dstPic ) 1557 { 1558 Int refStride = refPic->getCStride(); 1559 Int dstStride = dstPic->getCStride(); 1560 Int depStride = pPicBaseDepth->getStride(); 1561 1562 Int widthChroma, heightChroma; 1563 if( isDepth) 1564 { 1565 widthChroma = pPicBaseDepth->getWidth()>>1; 1566 heightChroma = pPicBaseDepth->getHeight()>>1; 1567 } 1568 else 1569 { 1570 widthChroma = refPic->getWidth()>>1; 1571 heightChroma = refPic->getHeight()>>1; 1572 } 1573 1574 // Below is only for Texture chroma component 1575 1576 Int widthDepth = pPicBaseDepth->getWidth(); 1577 Int heightDepth = pPicBaseDepth->getHeight(); 1578 1579 Int nTxtPerDepthX, nTxtPerDepthY; // Number of texture samples per one depth sample 1580 Int nDepthPerTxtX, nDepthPerTxtY; // Number of depth samples per one texture sample 1581 1582 Int depthPosX; // Starting position in depth image 1583 Int depthPosY; 1584 1585 if ( widthChroma > widthDepth ) 1586 { 1587 nTxtPerDepthX = widthChroma / widthDepth; 1588 nDepthPerTxtX = 1; 1589 depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2); //mv denotes the disparity for VSP 1590 } 1591 else 1592 { 1593 nTxtPerDepthX = 1; 1594 nDepthPerTxtX = widthDepth / widthChroma; 1595 depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2); //mv denotes the disparity for VSP 1596 } 1597 depthPosX = Clip3(0, widthDepth - (size_x<<1) - 1, depthPosX); 1598 1599 if ( heightChroma > heightDepth ) 1600 { 1601 nTxtPerDepthY = heightChroma / heightDepth; 1602 nDepthPerTxtY = 1; 1603 depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2); //mv denotes the disparity for VSP 1604 } 1605 else 1606 { 1607 nTxtPerDepthY = 1; 1608 nDepthPerTxtY = heightDepth / heightChroma; 1609 depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2); //mv denotes the disparity for VSP 1610 } 1611 depthPosY = Clip3(0, heightDepth - (size_y<<1) - 1, depthPosY); 1612 1613 Pel *refCb = refPic->getCbAddr() + posX + posY * refStride; 1614 Pel *refCr = refPic->getCrAddr() + posX + posY * refStride; 1615 Pel *dstCb = dstPic->getCbAddr(partAddr); 1616 Pel *dstCr = dstPic->getCrAddr(partAddr); 1617 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; // move the pointer to the current depth pixel position 1618 1619 Int refStrideBlock = refStride * nTxtPerDepthY; 1620 Int dstStrideBlock = dstStride * nTxtPerDepthY; 1621 Int depStrideBlock = depStride * nDepthPerTxtY; 1622 1623 if (isDepth) 1624 { 1625 // DT: Since the call for this function is redundant, .. 1626 for (Int y = 0; y < size_y; y++) 1627 { 1628 for (Int x = 0; x < size_x; x++) 1629 { 1630 dstCb[x] = 128; 1631 dstCr[x] = 128; 1632 } 1633 dstCb += dstStride; 1634 dstCr += dstStride; 1635 } 1636 return; 1637 } 1638 1639 if ( widthChroma > widthDepth ) // We assume 1640 { 1641 assert( heightChroma > heightDepth ); 1642 printf("This branch should never been reached.\n"); 1643 exit(0); 1644 } 1645 else 1646 { 1647 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1648 Int dW = size_x; 1649 Int dH = size_y; 1650 Int sW = 2; // search window size 1651 Int sH = 2; 1652 #endif 1653 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1654 Int dW = size_x; 1655 Int dH = size_y; 1656 Int sW = 2; // search window size 1657 Int sH = 2; 1658 #endif 1659 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1660 Int dW = size_x>>1; 1661 Int dH = size_y>>1; 1662 Int sW = 4; // search window size 1663 Int sH = 4; 1664 #endif 1665 1666 { 1667 Pel* depthi = depth; 1668 for (Int j = 0; j < dH; j++) 1669 { 1670 for (Int i = 0; i < dW; i++) 1671 { 1672 Pel* depthTmp; 1673 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1674 depthTmp = depthi + (i << 1); 1675 #endif 1676 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1677 if (depthPosX + (i<<1) < widthDepth) 1678 depthTmp = depthi + (i << 1); 1679 else 1680 depthTmp = depthi + (widthDepth - depthPosX - 1); 1681 #endif 1682 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1683 if (depthPosX + (i<<2) < widthDepth) 1684 depthTmp = depthi + (i << 2); 1685 else 1686 depthTmp = depthi + (widthDepth - depthPosX - 1); 1687 #endif 1688 Int maxV = 0; 1689 for (Int blockj = 0; blockj < sH; blockj++) 1690 { 1691 Int iX = 0; 1692 for (Int blocki = 0; blocki < sW; blocki++) 1693 { 1694 if (maxV < depthTmp[iX]) 1695 maxV = depthTmp[iX]; 1696 if (depthPosX + i*sW + blocki < widthDepth - 1) 1697 iX++; 1698 } 1699 if (depthPosY + j*sH + blockj < heightDepth - 1) 1700 depthTmp += depStride; 1701 } 1702 m_pDepth[i+j*dW] = maxV; 1703 } // end of i < dW 1704 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1705 if (depthPosY + ((j+1)<<1) < heightDepth) 1706 depthi += (depStride << 1); 1707 else 1708 depthi = depth + (heightDepth-1)*depStride; 1709 #endif 1710 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1711 if (depthPosY + ((j+1)<<1) < heightDepth) 1712 depthi += (depStride << 1); 1713 else 1714 depthi = depth + (heightDepth-depthPosY-1)*depStride; 1715 #endif 1716 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1717 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 1718 depthi += (depStride << 2); 1719 else 1720 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 1721 #endif 1722 } 1723 } 1724 1725 1726 // (size_x, size_y) is Chroma block size 1727 for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY ) 1728 { 1729 for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX ) 1730 { 1731 Pel rep_depth = 0; // to store the depth value used for warping 1732 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1733 rep_depth = m_pDepth[(xTxt) + (yTxt)*dW]; 1734 #endif 1735 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1736 rep_depth = m_pDepth[(xTxt) + (yTxt)*dW]; 1737 #endif 1738 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1739 rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1740 #endif 1741 1742 // calculate the offset in the reference picture 1743 Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec; 1744 Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image 1745 Int xFrac = disparity & 0x7; 1746 Int absX = posX + refOffset; 1747 1748 if (xFrac == 0) 1749 absX = Clip3(0, widthChroma-1, absX); 1750 else 1751 absX = Clip3(4, widthChroma-5, absX); 1752 1753 refOffset = absX - posX; 1754 1755 assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 ); 1756 assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 ); 1757 m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 1758 m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 1759 } 1760 refCb += refStrideBlock; 1761 refCr += refStrideBlock; 1762 dstCb += dstStrideBlock; 1763 dstCr += dstStrideBlock; 1764 depth += depStrideBlock; 1765 } 1766 } 1767 } 1768 1769 #endif // MERL_VSP_C0152 1770 1121 1771 #if DEPTH_MAP_GENERATION 1122 1772 Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY ) … … 1704 2354 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1705 2355 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2356 #if FIX_LGE_ILLUCOMP_B0045 2357 iRefX = iCUPelX + (pMv->getHor() >> 2); 2358 iRefY = iCUPelY + (pMv->getVer() >> 2); 2359 #else 1706 2360 iRefX = iCUPelX + (pMv->getHor() >> 3); 1707 2361 iRefY = iCUPelY + (pMv->getVer() >> 3); 2362 #endif 1708 2363 uiWidth = pcCU->getWidth(0) >> 1; 1709 2364 uiHeight = pcCU->getHeight(0) >> 1; … … 1919 2574 UInt uiWedgeStride = pcWedgelet->getStride(); 1920 2575 2576 #if HS_REFERENCE_SUBSAMPLE_C0154 2577 Int subSamplePix; 2578 if ( pcWedgelet->getWidth() == 32 ) 2579 { 2580 subSamplePix = 2; 2581 } 2582 else 2583 { 2584 subSamplePix = 1; 2585 } 2586 #endif 2587 1921 2588 if( bAbove ) 1922 2589 { 2590 #if HS_REFERENCE_SUBSAMPLE_C0154 2591 for( Int k = 0; k < pcWedgelet->getWidth(); k+=subSamplePix ) 2592 #else 1923 2593 for( Int k = 0; k < pcWedgelet->getWidth(); k++ ) 2594 #endif 1924 2595 { 1925 2596 if( true == pabWedgePattern[k] ) … … 1937 2608 if( bLeft ) 1938 2609 { 2610 #if HS_REFERENCE_SUBSAMPLE_C0154 2611 for( Int k = 0; k < pcWedgelet->getHeight(); k+=subSamplePix ) 2612 #else 1939 2613 for( Int k = 0; k < pcWedgelet->getHeight(); k++ ) 2614 #endif 1940 2615 { 1941 2616 if( true == pabWedgePattern[k*uiWedgeStride] ) … … 2116 2791 } 2117 2792 2793 #if LGE_DMM3_SIMP_C0044 2794 /** 2795 - fetch best Wedgelet pattern at decoder 2796 */ 2797 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt IntraTabIdx) 2798 { 2799 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2800 2801 UInt uiBestTabIdx = 0; 2802 TComPic* pcPicTex = pcCU->getSlice()->getTexturePic(); 2803 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); 2804 UInt uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 2805 Int uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255; 2806 2807 std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]]; 2808 2809 if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) 2810 { 2811 std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[uiColTexIntraDir-2]; 2812 uiBestTabIdx = pauiWdgLst->at(IntraTabIdx); 2813 } 2814 else 2815 { 2816 WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])]; 2817 uiBestTabIdx = pacWedgeNodeList->at(IntraTabIdx).getPatternIdx(); 2818 } 2819 2820 return uiBestTabIdx; 2821 } 2822 #endif 2823 2824 #if LGE_DMM3_SIMP_C0044 2825 /** 2826 - calculate best Wedgelet pattern at encoder 2827 */ 2828 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Pel* piOrigi, UInt uiStride, UInt & ruiIntraTabIdx) 2829 #else 2118 2830 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight ) 2831 #endif 2119 2832 { 2120 2833 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); … … 2144 2857 Int iDC2 = 0; 2145 2858 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2146 2147 #if HHIQC_DMMFASTSEARCH_B0039 2859 #if LGE_DMM3_SIMP_C0044 2860 ruiIntraTabIdx = 0; 2861 #endif 2148 2862 TComPic* pcPicTex = pcCU->getSlice()->getTexturePic(); 2149 2863 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); … … 2158 2872 { 2159 2873 UInt uiIdx = pauiWdgLst->at(uiIdxW); 2874 #if LGE_DMM3_SIMP_C0044 2875 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piOrigi, uiWidth, iDC1, iDC2 ); 2876 #else 2160 2877 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth, iDC1, iDC2 ); 2878 #endif 2161 2879 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2162 2880 2881 #if LGE_DMM3_SIMP_C0044 2882 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD ); 2883 #else 2163 2884 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2885 #endif 2164 2886 2165 2887 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) … … 2167 2889 uiBestDist = uiActDist; 2168 2890 uiBestTabIdx = uiIdx; 2891 #if LGE_DMM3_SIMP_C0044 2892 ruiIntraTabIdx = uiIdxW; 2893 #endif 2169 2894 } 2170 2895 } … … 2177 2902 for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ ) 2178 2903 { 2904 #if LGE_DMM3_SIMP_C0044 2905 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piOrigi, uiWidth, iDC1, iDC2 ); 2906 #else 2179 2907 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRefBlkY, uiWidth, iDC1, iDC2 ); 2908 #endif 2180 2909 assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred, uiPredStride, iDC1, iDC2 ); 2181 2910 2911 #if LGE_DMM3_SIMP_C0044 2912 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD ); 2913 #else 2182 2914 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2915 #endif 2183 2916 2184 2917 if( uiActDist < uiBestNodeDist || uiBestNodeDist == MAX_UINT ) … … 2186 2919 uiBestNodeDist = uiActDist; 2187 2920 uiBestNodeId = uiNodeId; 2188 } 2189 } 2190 2921 #if LGE_DMM3_SIMP_C0044 2922 ruiIntraTabIdx = uiNodeId; 2923 #endif 2924 } 2925 } 2926 #if LGE_DMM3_SIMP_C0044 2927 uiBestTabIdx = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx(); 2928 #else 2191 2929 // refinement 2192 2930 uiBestDist = uiBestNodeDist; … … 2208 2946 } 2209 2947 } 2210 } 2211 #else 2212 for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ ) 2213 { 2214 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth, iDC1, iDC2 ); 2215 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2216 2217 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2218 2219 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) 2220 { 2221 uiBestDist = uiActDist; 2222 uiBestTabIdx = uiIdx; 2223 } 2224 } 2225 #endif 2948 #endif 2949 } 2226 2950 2227 2951 cPredYuv.destroy(); … … 2262 2986 { 2263 2987 // decoder: get and store wedge pattern in CU 2988 // decoder: get and store wedge pattern in CU 2989 #if LGE_DMM3_SIMP_C0044 2990 UInt uiIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx ( uiAbsPartIdx ); 2991 uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight, uiIntraTabIdx ); 2992 #else 2264 2993 uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight ); 2994 #endif 2265 2995 2266 2996 UInt uiDepth = (pcCU->getDepth(0)) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1); … … 2277 3007 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2278 3008 3009 #if HHI_DMM_DELTADC_Q1_C0034 3010 #else 2279 3011 if( bDelta ) 2280 3012 { … … 2282 3014 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2283 3015 } 3016 #endif 2284 3017 2285 3018 // assign wedge pred DCs to prediction … … 2302 3035 getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2303 3036 3037 #if HHI_DMM_DELTADC_Q1_C0034 3038 #else 2304 3039 if( bDelta ) 2305 3040 { … … 2307 3042 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2308 3043 } 3044 #endif 2309 3045 2310 3046 // assign wedge pred DCs to prediction … … 2315 3051 delete pcContourWedge; 2316 3052 } 2317 #endif 3053 #endif // HHI_DMM_PRED_TEX 2318 3054 2319 3055 #if HHI_DMM_WEDGE_INTRA … … 2483 3219 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2484 3220 3221 #if HHI_DMM_DELTADC_Q1_C0034 3222 #else 2485 3223 if( bDelta ) 2486 3224 { … … 2488 3226 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2489 3227 } 3228 #endif 2490 3229 2491 3230 // assign wedge pred DCs to prediction … … 2524 3263 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2525 3264 3265 #if HHI_DMM_DELTADC_Q1_C0034 3266 #else 2526 3267 if( bDelta ) 2527 3268 { … … 2529 3270 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2530 3271 } 3272 #endif 2531 3273 2532 3274 // assign wedge pred DCs to prediction … … 2613 3355 2614 3356 // 2nd step: derive wedge direction 2615 #if LOGI_INTRA_NAME_3MPM2616 3357 Int uiPreds[3] = {-1, -1, -1}; 2617 #else2618 Int uiPreds[2] = {-1, -1};2619 #endif2620 3358 Int iMode = -1; 2621 3359 Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 2622 3360 2623 3361 UInt uiDirMode = 0; 2624 #if LOGI_INTRA_NAME_3MPM2625 3362 if( iMode >= 0 ) { iPredNum = iMode; } 2626 3363 if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; } … … 2632 3369 Bool modeVer = !modeHor; 2633 3370 Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0; 2634 #else2635 if( iPredNum == 1 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[0]]; }2636 if( iPredNum == 2 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[1]]; }2637 2638 if( uiDirMode == 0 ) { return false; } // no DC2639 2640 Bool modeVer = (uiDirMode < 18);2641 Bool modeHor = !modeVer;2642 Int intraPredAngle = modeVer ? uiDirMode - 9 : modeHor ? uiDirMode - 25 : 0;2643 #endif2644 3371 Int absAng = abs(intraPredAngle); 2645 3372 Int signAng = intraPredAngle < 0 ? -1 : 1; … … 2960 3687 Int* ptrSrc = pcTComPattern->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); 2961 3688 Int sw = ( iWidth<<1 ) + 1; 2962 #if !LOGI_INTRA_NAME_3MPM2963 uiDirMode = g_aucAngIntraModeOrder[ uiDirMode ];2964 #endif2965 3689 xPredIntraAngDepth( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode ); 2966 3690 }
Note: See TracChangeset for help on using the changeset viewer.