Changeset 62 in 3DVCSoftware for branches/HTM-3.0-LG/source/Lib/TLibCommon/TComYuv.cpp
- Timestamp:
- 18 May 2012, 09:38:25 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-3.0-LG/source/Lib/TLibCommon/TComYuv.cpp
r56 r62 392 392 } 393 393 394 394 #if LG_RESTRICTEDRESPRED_M24766 395 Void 396 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 #else 395 402 Void 396 403 TComYuv::add( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) … … 399 406 addChroma ( pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract ); 400 407 } 401 408 #endif 409 410 #if LG_RESTRICTEDRESPRED_M24766 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 438 Void 439 TComYuv::addLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 440 #else 402 441 Void 403 442 TComYuv::addLuma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 443 #endif 404 444 { 405 445 Int iScale = ( bSubtract ? -1 : 1 ); … … 408 448 Pel* pAddSamples = pcYuvAdd->getLumaAddr(); 409 449 Pel* pDstSamples = getLumaAddr(); 450 451 #if LG_RESTRICTEDRESPRED_M24766 452 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 #else 410 494 for( Int iY = 0; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride ) 411 495 { … … 415 499 } 416 500 } 417 } 418 501 #endif 502 } 503 504 #if LG_RESTRICTEDRESPRED_M24766 505 Void 506 TComYuv::addChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 507 #else 419 508 Void 420 509 TComYuv::addChroma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) 510 #endif 421 511 { 422 512 Int iScale = ( bSubtract ? -1 : 1 ); … … 427 517 Pel* pDstSamplesCb = getCbAddr(); 428 518 Pel* pDstSamplesCr = getCrAddr(); 519 520 #if LG_RESTRICTEDRESPRED_M24766 521 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 #else 429 569 for( Int iY = 0; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride, 430 570 pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride ) … … 436 576 } 437 577 } 578 #endif 438 579 } 439 580 … … 535 676 } 536 677 678 #if LG_RESTRICTEDRESPRED_M24766 679 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 #else 537 685 Void TComYuv::subtract( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 538 686 { 539 subtractLuma ( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize ); 540 subtractChroma( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 ); 541 } 542 687 subtractLuma ( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize ); 688 subtractChroma( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 ); 689 } 690 #endif 691 692 #if LG_RESTRICTEDRESPRED_M24766 693 Void TComYuv::subtractLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 694 #else 543 695 Void TComYuv::subtractLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 696 #endif 544 697 { 545 698 Int x, y; … … 552 705 Int iSrc1Stride = pcYuvSrc1->getStride(); 553 706 Int iDstStride = getStride(); 707 708 #if LG_RESTRICTEDRESPRED_M24766 709 Int iXOffset, iYOffset; 710 711 getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset); 712 713 for ( y = uiPartSize-1; y >= iYOffset; y-- ) 714 { 715 if(iPUResiPredShift[3] >= 0) 716 { 717 for ( x = uiPartSize-1; x >= iXOffset; x-- ) 718 { 719 pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]); 720 } 721 } 722 723 if(iPUResiPredShift[2] >= 0) 724 { 725 for ( x = iXOffset-1; x >= 0; x-- ) 726 { 727 pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]); 728 } 729 } 730 pSrc0 += iSrc0Stride; 731 pSrc1 += iSrc1Stride; 732 pDst += iDstStride; 733 } 734 735 for ( y = iYOffset-1; y >= 0; y-- ) 736 { 737 if(iPUResiPredShift[1] >= 0) 738 { 739 for ( x = uiPartSize-1; x >= iXOffset; x-- ) 740 { 741 pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]); 742 } 743 } 744 745 if(iPUResiPredShift[0] >= 0) 746 { 747 for ( x = iXOffset-1; x >= 0; x-- ) 748 { 749 pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]); 750 } 751 } 752 pSrc0 += iSrc0Stride; 753 pSrc1 += iSrc1Stride; 754 pDst += iDstStride; 755 } 756 757 #else 554 758 for ( y = uiPartSize-1; y >= 0; y-- ) 555 759 { … … 562 766 pDst += iDstStride; 563 767 } 564 } 565 768 #endif 769 } 770 771 #if LG_RESTRICTEDRESPRED_M24766 772 Void TComYuv::subtractChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 773 #else 566 774 Void TComYuv::subtractChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 775 #endif 567 776 { 568 777 Int x, y; … … 578 787 Int iSrc1Stride = pcYuvSrc1->getCStride(); 579 788 Int iDstStride = getCStride(); 789 #if LG_RESTRICTEDRESPRED_M24766 790 Int iXOffset, iYOffset; 791 792 getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset); 793 794 for ( y = uiPartSize-1; y >= iYOffset; y-- ) 795 { 796 if(iPUResiPredShift[3] >= 0) 797 { 798 for ( x = uiPartSize-1; x >= iXOffset; x-- ) 799 { 800 pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]); 801 pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]); 802 } 803 } 804 805 if(iPUResiPredShift[2] >= 0) 806 { 807 for ( x = iXOffset-1; x >= 0; x-- ) 808 { 809 pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]); 810 pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]); 811 } 812 } 813 pSrcU0 += iSrc0Stride; 814 pSrcU1 += iSrc1Stride; 815 pSrcV0 += iSrc0Stride; 816 pSrcV1 += iSrc1Stride; 817 pDstU += iDstStride; 818 pDstV += iDstStride; 819 } 820 821 for ( y = iYOffset-1; y >= 0; y-- ) 822 { 823 if(iPUResiPredShift[1] >= 0) 824 { 825 for ( x = uiPartSize-1; x >= iXOffset; x-- ) 826 { 827 pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]); 828 pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]); 829 } 830 } 831 832 if(iPUResiPredShift[0] >= 0) 833 { 834 for ( x = iXOffset-1; x >= 0; x-- ) 835 { 836 pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]); 837 pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]); 838 } 839 } 840 pSrcU0 += iSrc0Stride; 841 pSrcU1 += iSrc1Stride; 842 pSrcV0 += iSrc0Stride; 843 pSrcV1 += iSrc1Stride; 844 pDstU += iDstStride; 845 pDstV += iDstStride; 846 } 847 #else 580 848 for ( y = uiPartSize-1; y >= 0; y-- ) 581 849 { … … 592 860 pDstV += iDstStride; 593 861 } 862 #endif 594 863 } 595 864
Note: See TracChangeset for help on using the changeset viewer.