Changeset 332 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComYuv.cpp
 Timestamp:
 21 Apr 2013, 19:13:11 (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/Lib/TLibCommon/TComYuv.cpp
r296 r332 392 392 } 393 393 394 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138395 Void396 TComYuv::add(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )397 {398 addLuma (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth, iHeight, bSubtract );399 addChroma (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract );400 }401 #else402 394 Void 403 395 TComYuv::add( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) … … 406 398 addChroma ( pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract ); 407 399 } 408 #endif 409 410 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 411 Void 412 TComYuv::getPUXYOffset(PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset) 413 { 414 switch(uhPartitionSize) 415 { 416 case SIZE_2NxN: 417 iXOffset = iWidth; iYOffset = iHeight >> 1; break; 418 case SIZE_2NxnU: 419 iXOffset = iWidth; iYOffset = iHeight >> 2; break; 420 case SIZE_2NxnD: 421 iXOffset = iWidth; iYOffset = (iHeight >> 1) + (iHeight >> 2); break; 422 case SIZE_Nx2N: 423 iXOffset = iWidth >> 1; iYOffset = iHeight; break; 424 case SIZE_nLx2N: 425 iXOffset = iWidth >> 2; iYOffset = iHeight; break; 426 case SIZE_nRx2N: 427 iXOffset = (iWidth >> 1) + (iWidth >> 2); iYOffset = iHeight; break; 428 case SIZE_NxN: 429 iXOffset = iWidth >> 1; iYOffset = iHeight >> 1; break; 430 default: 431 assert(uhPartitionSize == SIZE_2Nx2N); 432 iXOffset = iWidth; iYOffset = iHeight; break; 433 } 434 } 435 #endif 436 437 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 438 Void 439 TComYuv::addLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 440 #else 400 401 441 402 Void 442 403 TComYuv::addLuma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 443 #endif444 404 { 445 405 Int iScale = ( bSubtract ? 1 : 1 ); … … 449 409 Pel* pDstSamples = getLumaAddr(); 450 410 451 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138452 Int iXOffset, iYOffset;453 454 getPUXYOffset(uhPartitionSize, iWidth, iHeight, iXOffset, iYOffset);455 456 for( Int iY = 0; iY < iYOffset; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )457 {458 if(iPUResiPredShift[0] >= 0)459 {460 for( Int iX = 0; iX < iXOffset; iX++ )461 {462 pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[0]);463 }464 }465 466 if(iPUResiPredShift[1] >= 0)467 {468 for( Int iX = iXOffset; iX < iWidth; iX++ )469 {470 pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[1]);471 }472 }473 }474 475 for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )476 {477 if(iPUResiPredShift[2] >= 0)478 {479 for( Int iX = 0; iX < iXOffset; iX++ )480 {481 pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[2]);482 }483 }484 485 if(iPUResiPredShift[3] >= 0)486 {487 for( Int iX = iXOffset; iX < iWidth; iX++ )488 {489 pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[3]);490 }491 }492 }493 #else494 411 for( Int iY = 0; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride ) 495 412 { … … 499 416 } 500 417 } 501 #endif 502 } 503 504 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 505 Void 506 TComYuv::addChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 507 #else 418 } 419 508 420 Void 509 421 TComYuv::addChroma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 510 #endif511 422 { 512 423 Int iScale = ( bSubtract ? 1 : 1 ); … … 518 429 Pel* pDstSamplesCr = getCrAddr(); 519 430 520 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138521 Int iXOffset, iYOffset;522 523 getPUXYOffset(uhPartitionSize, iWidth, iHeight, iXOffset, iYOffset);524 525 for( Int iY = 0; iY < iYOffset; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,526 pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride )527 {528 if(iPUResiPredShift[0] >= 0)529 {530 for( Int iX = 0; iX < iXOffset; iX++ )531 {532 pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[0]);533 pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[0]);534 }535 }536 537 if(iPUResiPredShift[1] >= 0)538 {539 for( Int iX = iXOffset; iX < iWidth; iX++ )540 {541 pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[1]);542 pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[1]);543 }544 }545 }546 547 for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,548 pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride )549 {550 if(iPUResiPredShift[2] >= 0)551 {552 for( Int iX = 0; iX < iXOffset; iX++ )553 {554 pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[2]);555 pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[2]);556 }557 }558 559 if(iPUResiPredShift[3] >= 0)560 {561 for( Int iX = iXOffset; iX < iWidth; iX++ )562 {563 pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[3]);564 pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[3]);565 }566 }567 }568 #else569 431 for( Int iY = 0; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride, 570 432 pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride ) … … 576 438 } 577 439 } 578 #endif579 440 } 580 441 … … 676 537 } 677 538 678 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138679 Void TComYuv::subtract(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )680 {681 subtractLuma (iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize );682 subtractChroma(iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 );683 }684 #else685 539 Void TComYuv::subtract( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 686 540 { … … 688 542 subtractChroma( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 ); 689 543 } 690 #endif 691 692 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 693 Void TComYuv::subtractLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 694 #else 544 695 545 Void TComYuv::subtractLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 696 #endif697 546 { 698 547 Int x, y; … … 706 555 Int iDstStride = getStride(); 707 556 708 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 709 Int iXOffset, iYOffset; 710 711 getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset); 712 713 #if FIX_LG_RESTRICTEDRESPRED_M24766 714 for ( y = 0; y < iYOffset; y++ ) 715 { 716 if(iPUResiPredShift[0] >= 0) 717 { 718 for ( x = 0; x < iXOffset; x++ ) 719 { 720 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[0]); 721 } 722 } 723 724 if(iPUResiPredShift[1] >= 0) 725 { 726 for ( x = iXOffset; x < uiPartSize; x++ ) 727 { 728 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[1]); 729 } 557 for ( y = uiPartSize1; y >= 0; y ) 558 { 559 for ( x = uiPartSize1; x >= 0; x ) 560 { 561 pDst[x] = pSrc0[x]  pSrc1[x]; 730 562 } 731 563 pSrc0 += iSrc0Stride; … … 733 565 pDst += iDstStride; 734 566 } 735 736 for ( y = iYOffset; y < uiPartSize; y++ ) 737 { 738 if(iPUResiPredShift[2] >= 0) 739 { 740 for ( x = 0; x < iXOffset; x++ ) 741 { 742 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[2]); 743 } 744 } 745 746 if(iPUResiPredShift[3] >= 0) 747 { 748 for ( x = iXOffset; x < uiPartSize; x++ ) 749 { 750 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[3]); 751 } 752 } 753 pSrc0 += iSrc0Stride; 754 pSrc1 += iSrc1Stride; 755 pDst += iDstStride; 756 } 757 #else 758 for ( y = uiPartSize1; y >= iYOffset; y ) 759 { 760 if(iPUResiPredShift[3] >= 0) 761 { 762 for ( x = uiPartSize1; x >= iXOffset; x ) 763 { 764 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[3]); 765 } 766 } 767 768 if(iPUResiPredShift[2] >= 0) 769 { 770 for ( x = iXOffset1; x >= 0; x ) 771 { 772 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[2]); 773 } 774 } 775 pSrc0 += iSrc0Stride; 776 pSrc1 += iSrc1Stride; 777 pDst += iDstStride; 778 } 779 780 for ( y = iYOffset1; y >= 0; y ) 781 { 782 if(iPUResiPredShift[1] >= 0) 783 { 784 for ( x = uiPartSize1; x >= iXOffset; x ) 785 { 786 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[3]); 787 } 788 } 789 790 if(iPUResiPredShift[0] >= 0) 791 { 792 for ( x = iXOffset1; x >= 0; x ) 793 { 794 pDst[x] = pSrc0[x]  (pSrc1[x] >> iPUResiPredShift[2]); 795 } 796 } 797 pSrc0 += iSrc0Stride; 798 pSrc1 += iSrc1Stride; 799 pDst += iDstStride; 800 } 801 #endif 802 #else 803 for ( y = uiPartSize1; y >= 0; y ) 804 { 805 for ( x = uiPartSize1; x >= 0; x ) 806 { 807 pDst[x] = pSrc0[x]  pSrc1[x]; 808 } 809 pSrc0 += iSrc0Stride; 810 pSrc1 += iSrc1Stride; 811 pDst += iDstStride; 812 } 813 #endif 814 } 815 816 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 817 Void TComYuv::subtractChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 818 #else 567 } 568 819 569 Void TComYuv::subtractChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 820 #endif821 570 { 822 571 Int x, y; … … 832 581 Int iSrc1Stride = pcYuvSrc1>getCStride(); 833 582 Int iDstStride = getCStride(); 834 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 835 Int iXOffset, iYOffset; 836 837 getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset); 838 839 #if FIX_LG_RESTRICTEDRESPRED_M24766 840 for ( y = 0; y < iYOffset; y++ ) 841 { 842 if(iPUResiPredShift[0] >= 0) 843 { 844 for ( x = 0; x < iXOffset; x++ ) 845 { 846 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[0]); 847 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[0]); 848 } 849 } 850 851 if(iPUResiPredShift[1] >= 0) 852 { 853 for ( x = iXOffset; x < uiPartSize; x++ ) 854 { 855 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[1]); 856 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[1]); 857 } 583 for ( y = uiPartSize1; y >= 0; y ) 584 { 585 for ( x = uiPartSize1; x >= 0; x ) 586 { 587 pDstU[x] = pSrcU0[x]  pSrcU1[x]; 588 pDstV[x] = pSrcV0[x]  pSrcV1[x]; 858 589 } 859 590 pSrcU0 += iSrc0Stride; … … 864 595 pDstV += iDstStride; 865 596 } 866 867 for ( y = iYOffset; y < uiPartSize; y++ )868 {869 if(iPUResiPredShift[2] >= 0)870 {871 for ( x = 0; x < iXOffset; x++ )872 {873 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[2]);874 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[2]);875 }876 }877 878 if(iPUResiPredShift[3] >= 0)879 {880 for ( x = iXOffset; x < uiPartSize; x++ )881 {882 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[3]);883 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[3]);884 }885 }886 pSrcU0 += iSrc0Stride;887 pSrcU1 += iSrc1Stride;888 pSrcV0 += iSrc0Stride;889 pSrcV1 += iSrc1Stride;890 pDstU += iDstStride;891 pDstV += iDstStride;892 }893 #else894 for ( y = uiPartSize1; y >= iYOffset; y )895 {896 if(iPUResiPredShift[3] >= 0)897 {898 for ( x = uiPartSize1; x >= iXOffset; x )899 {900 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[3]);901 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[3]);902 }903 }904 905 if(iPUResiPredShift[2] >= 0)906 {907 for ( x = iXOffset1; x >= 0; x )908 {909 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[2]);910 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[2]);911 }912 }913 pSrcU0 += iSrc0Stride;914 pSrcU1 += iSrc1Stride;915 pSrcV0 += iSrc0Stride;916 pSrcV1 += iSrc1Stride;917 pDstU += iDstStride;918 pDstV += iDstStride;919 }920 921 for ( y = iYOffset1; y >= 0; y )922 {923 if(iPUResiPredShift[1] >= 0)924 {925 for ( x = uiPartSize1; x >= iXOffset; x )926 {927 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[1]);928 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[1]);929 }930 }931 932 if(iPUResiPredShift[0] >= 0)933 {934 for ( x = iXOffset1; x >= 0; x )935 {936 pDstU[x] = pSrcU0[x]  (pSrcU1[x]>>iPUResiPredShift[0]);937 pDstV[x] = pSrcV0[x]  (pSrcV1[x]>>iPUResiPredShift[0]);938 }939 }940 pSrcU0 += iSrc0Stride;941 pSrcU1 += iSrc1Stride;942 pSrcV0 += iSrc0Stride;943 pSrcV1 += iSrc1Stride;944 pDstU += iDstStride;945 pDstV += iDstStride;946 }947 #endif948 #else949 for ( y = uiPartSize1; y >= 0; y )950 {951 for ( x = uiPartSize1; x >= 0; x )952 {953 pDstU[x] = pSrcU0[x]  pSrcU1[x];954 pDstV[x] = pSrcV0[x]  pSrcV1[x];955 }956 pSrcU0 += iSrc0Stride;957 pSrcU1 += iSrc1Stride;958 pSrcV0 += iSrc0Stride;959 pSrcV1 += iSrc1Stride;960 pDstU += iDstStride;961 pDstV += iDstStride;962 }963 #endif964 597 } 965 598
Note: See TracChangeset for help on using the changeset viewer.