Changeset 56 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComWedgelet.cpp
 Timestamp:
 11 May 2012, 21:20:17 (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/Lib/TLibCommon/TComWedgelet.cpp
r5 r56 43 43 #include <memory.h> 44 44 45 using namespace std; 46 45 47 46 48 TComWedgelet::TComWedgelet( UInt uiWidth, UInt uiHeight ) : m_uhXs ( 0 ), … … 116 118 } 117 119 118 Bool TComWedgelet::check NotIdentical( Bool* pbRefPattern )120 Bool TComWedgelet::checkIdentical( Bool* pbRefPattern ) 119 121 { 120 122 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) … … 122 124 if( m_pbPattern[k] != pbRefPattern[k] ) 123 125 { 124 return true;125 } 126 } 127 return false;128 } 129 130 Bool TComWedgelet::check NotInvIdentical( Bool* pbRefPattern )126 return false; 127 } 128 } 129 return true; 130 } 131 132 Bool TComWedgelet::checkInvIdentical( Bool* pbRefPattern ) 131 133 { 132 134 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) … … 134 136 if( m_pbPattern[k] == pbRefPattern[k] ) 135 137 { 136 return true;137 } 138 } 139 return false;138 return false; 139 } 140 } 141 return true; 140 142 } 141 143 … … 241 243 ruhXe = 0; 242 244 ruhYe = 0; 243 UInt uiContDOri;244 245 245 246 // get start/end of reference (=this) wedgelet … … 258 259 case( HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; } 259 260 } 261 Int iContDMaxPos = (Int)uiContDStartEndMax  1; 260 262 261 263 // swap if start/end if line orientation is not from top to bottom … … 288 290 if( iXe < 0 ) 289 291 { 290 uiContDOri = 0;291 292 ruhXe = 0; 292 ruhYe = (UChar)Min( Max( ((uiContDStartEndMax1) + iXe), 0 ), (uiContDStartEndMax1) ); 293 294 return; 295 } 296 else if( iXe > (uiContDStartEndMax1) ) 297 { 298 uiContDOri = 1; 299 ruhXe = (UChar)(uiContDStartEndMax1); 300 ruhYe = (UChar)Min( Max( ((uiContDStartEndMax1)  (iXe  (uiContDStartEndMax1))), 0 ), (uiContDStartEndMax1) ); 293 ruhYe = (UChar)min( max( (iContDMaxPos + iXe), 0 ), iContDMaxPos ); 294 295 return; 296 } 297 else if( iXe > iContDMaxPos ) 298 { 299 ruhXe = (UChar)iContDMaxPos; 300 ruhYe = (UChar)min( max( (iContDMaxPos  (iXe  iContDMaxPos)), 0 ), iContDMaxPos ); 301 301 302 302 std::swap( ruhXs, ruhXe ); … … 306 306 else 307 307 { 308 uiContDOri = 4;309 308 ruhXe = (UChar)iXe; 310 ruhYe = (UChar) (uiContDStartEndMax1);309 ruhYe = (UChar)iContDMaxPos; 311 310 312 311 return; … … 321 320 case( 2 ): 322 321 { 323 uiContDOri = 0;324 322 ruhXs = (UChar)(iAlignedRefEndX1); 325 323 ruhYs = 0; 326 324 ruhXe = 0; 327 ruhYe = (UChar) Min( Max( iDeltaEnd, 0 ), (uiContDStartEndMax1));325 ruhYe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos ); 328 326 329 327 return; … … 331 329 case( 3 ): 332 330 { 333 uiContDOri = 1;334 331 ruhXs = (UChar)(iAlignedRefEndX+1); 335 332 ruhYs = 0; 336 ruhXe = (UChar) (uiContDStartEndMax1);337 ruhYe = (UChar) Min( Max( iDeltaEnd, 0 ), (uiContDStartEndMax1));333 ruhXe = (UChar)iContDMaxPos; 334 ruhYe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos ); 338 335 339 336 std::swap( ruhXs, ruhXe ); … … 355 352 356 353 // calc end point and determine orientation 357 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double) (uiContDStartEndMax1)* ((Double)iA_DeltaX / (Double)iA_DeltaY) );354 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iContDMaxPos * ((Double)iA_DeltaX / (Double)iA_DeltaY) ); 358 355 359 356 if( iVirtualEndX < 0 ) … … 362 359 if( iYe < (Int)uiContDStartEndMax ) 363 360 { 364 uiContDOri = 0;365 361 ruhXe = 0; 366 ruhYe = (UChar) Max( iYe, 0 );362 ruhYe = (UChar)max( iYe, 0 ); 367 363 368 364 return; … … 370 366 else 371 367 { 372 uiContDOri = 4; 373 ruhXe = (UChar)Min( (iYe  (uiContDStartEndMax1)), (uiContDStartEndMax1) ); 374 ruhYe = (UChar)(uiContDStartEndMax1); 375 376 return; 377 } 378 } 379 else if( iVirtualEndX > (uiContDStartEndMax1) ) 380 { 381 Int iYe = roftoi( (Double)((Int)(uiContDStartEndMax1)  (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) )  iDeltaEnd; 368 ruhXe = (UChar)min( (iYe  iContDMaxPos), iContDMaxPos ); 369 ruhYe = (UChar)iContDMaxPos; 370 371 return; 372 } 373 } 374 else if( iVirtualEndX > iContDMaxPos ) 375 { 376 Int iYe = roftoi( (Double)(iContDMaxPos  (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) )  iDeltaEnd; 382 377 if( iYe < (Int)uiContDStartEndMax ) 383 378 { 384 uiContDOri = 1; 385 ruhXe = (UChar)(uiContDStartEndMax1); 386 ruhYe = (UChar)Max( iYe, 0 ); 379 ruhXe = (UChar)iContDMaxPos; 380 ruhYe = (UChar)max( iYe, 0 ); 387 381 388 382 std::swap( ruhXs, ruhXe ); … … 392 386 else 393 387 { 394 uiContDOri = 4; 395 ruhXe = (UChar)Max( ((uiContDStartEndMax1)  (iYe  (uiContDStartEndMax1))), 0 ); 396 ruhYe = (UChar)(uiContDStartEndMax1); 388 ruhXe = (UChar)max( (iContDMaxPos  (iYe  iContDMaxPos)), 0 ); 389 ruhYe = (UChar)iContDMaxPos; 397 390 398 391 return; … … 404 397 if( iXe < 0 ) 405 398 { 406 uiContDOri = 0;407 399 ruhXe = 0; 408 ruhYe = (UChar)Max( ((uiContDStartEndMax1) + iXe), 0 ); 409 410 return; 411 } 412 else if( iXe > (uiContDStartEndMax1) ) 413 { 414 uiContDOri = 1; 415 ruhXe = (UChar)(uiContDStartEndMax1); 416 ruhYe = (UChar)Max( ((uiContDStartEndMax1)  (iXe  (uiContDStartEndMax1))), 0 ); 400 ruhYe = (UChar)max( (iContDMaxPos + iXe), 0 ); 401 402 return; 403 } 404 else if( iXe > iContDMaxPos ) 405 { 406 ruhXe = (UChar)iContDMaxPos; 407 ruhYe = (UChar)max( (iContDMaxPos  (iXe  iContDMaxPos)), 0 ); 417 408 418 409 std::swap( ruhXs, ruhXe ); … … 422 413 else 423 414 { 424 uiContDOri = 4;425 415 ruhXe = (UChar)iXe; 426 ruhYe = (UChar) (uiContDStartEndMax1);416 ruhYe = (UChar)iContDMaxPos; 427 417 428 418 return; … … 437 427 ruhXe = 0; 438 428 ruhYe = 0; 439 UInt uiContDOri;440 429 441 430 // get start/end of reference (=this) wedgelet … … 454 443 case( HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; } 455 444 } 445 Int iContDMaxPos = (Int)uiContDStartEndMax  1; 456 446 457 447 // swap if start/end if line orientation is not from left to right … … 482 472 if( iYe < 0 ) 483 473 { 484 uiContDOri = 0; 485 ruhXe = (UChar)Min( Max( ((uiContDStartEndMax1) + iYe), 0 ), (uiContDStartEndMax1) ); 474 ruhXe = (UChar)min( max( (iContDMaxPos + iYe), 0 ), iContDMaxPos ); 486 475 ruhYe = 0; 487 476 … … 490 479 return; 491 480 } 492 else if( iYe > (uiContDStartEndMax1) ) 493 { 494 uiContDOri = 3; 495 ruhXe = (UChar)Min( Max( ((uiContDStartEndMax1)  (iYe  (uiContDStartEndMax1))), 0 ), (uiContDStartEndMax1) ); 496 ruhYe = (UChar)(uiContDStartEndMax1); 481 else if( iYe > iContDMaxPos ) 482 { 483 ruhXe = (UChar)min( max( (iContDMaxPos  (iYe  iContDMaxPos)), 0 ), iContDMaxPos ); 484 ruhYe = (UChar)iContDMaxPos; 497 485 498 486 return; … … 500 488 else 501 489 { 502 uiContDOri = 5; 503 ruhXe = (UChar)(uiContDStartEndMax1); 490 ruhXe = (UChar)iContDMaxPos; 504 491 ruhYe = (UChar)iYe; 505 492 … … 517 504 case( 1 ): 518 505 { 519 uiContDOri = 3;520 506 ruhXs = 0; 521 507 ruhYs = (UChar)(iAlignedRefEndY+1); 522 ruhXe = (UChar) Min( Max( iDeltaEnd, 0 ), (uiContDStartEndMax1));523 ruhYe = (UChar) (uiContDStartEndMax1);508 ruhXe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos ); 509 ruhYe = (UChar)iContDMaxPos; 524 510 525 511 return; … … 527 513 case( 2 ): 528 514 { 529 uiContDOri = 0;530 515 ruhXs = 0; 531 516 ruhYs = (UChar)(iAlignedRefEndY1); 532 ruhXe = (UChar) Min( Max( iDeltaEnd, 0 ), (uiContDStartEndMax1));517 ruhXe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos ); 533 518 ruhYe = 0; 534 519 … … 551 536 552 537 // calc end point and determine orientation 553 Int iVirtualEndY = (Int)ruhYs + roftoi( (Double) (uiContDStartEndMax1)* ((Double)iL_DeltaY / (Double)iL_DeltaX) );538 Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iContDMaxPos * ((Double)iL_DeltaY / (Double)iL_DeltaX) ); 554 539 555 540 if( iVirtualEndY < 0 ) … … 558 543 if( iXe < (Int)uiContDStartEndMax ) 559 544 { 560 uiContDOri = 0; 561 ruhXe = (UChar)Max( iXe, 0 ); 545 ruhXe = (UChar)max( iXe, 0 ); 562 546 ruhYe = 0; 563 547 … … 568 552 else 569 553 { 570 uiContDOri = 5; 571 ruhXe = (UChar)(uiContDStartEndMax1); 572 ruhYe = (UChar)Min( (iXe  (uiContDStartEndMax1)), (uiContDStartEndMax1) ); 554 ruhXe = (UChar)iContDMaxPos; 555 ruhYe = (UChar)min( (iXe  iContDMaxPos), iContDMaxPos ); 573 556 574 557 std::swap( ruhXs, ruhXe ); … … 577 560 } 578 561 } 579 else if( iVirtualEndY > (uiContDStartEndMax1))580 { 581 Int iXe = roftoi( (Double)( (Int)(uiContDStartEndMax1) (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) + iDeltaEnd;562 else if( iVirtualEndY > iContDMaxPos ) 563 { 564 Int iXe = roftoi( (Double)(iContDMaxPos  (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) + iDeltaEnd; 582 565 if( iXe < (Int)uiContDStartEndMax ) 583 566 { 584 uiContDOri = 3; 585 ruhXe = (UChar)Max( iXe, 0 ); 586 ruhYe = (UChar)(uiContDStartEndMax1); 567 ruhXe = (UChar)max( iXe, 0 ); 568 ruhYe = (UChar)iContDMaxPos; 587 569 588 570 return; … … 590 572 else 591 573 { 592 uiContDOri = 5; 593 ruhXe = (UChar)(uiContDStartEndMax1); 594 ruhYe = (UChar)Max( ((uiContDStartEndMax1)  (iXe  (uiContDStartEndMax1))), 0 ); 574 ruhXe = (UChar)iContDMaxPos; 575 ruhYe = (UChar)max( (iContDMaxPos  (iXe  iContDMaxPos)), 0 ); 595 576 596 577 std::swap( ruhXs, ruhXe ); … … 604 585 if( iYe < 0 ) 605 586 { 606 uiContDOri = 0; 607 ruhXe = (UChar)Max( ((uiContDStartEndMax1) + iYe), 0 ); 587 ruhXe = (UChar)max( (iContDMaxPos + iYe), 0 ); 608 588 ruhYe = 0; 609 589 … … 612 592 return; 613 593 } 614 else if( iYe > (uiContDStartEndMax1) ) 615 { 616 uiContDOri = 3; 617 ruhXe = (UChar)Max( ((uiContDStartEndMax1)  (iYe  (uiContDStartEndMax1))), 0 ); 618 ruhYe = (UChar)(uiContDStartEndMax1); 594 else if( iYe > iContDMaxPos ) 595 { 596 ruhXe = (UChar)max( (iContDMaxPos  (iYe  iContDMaxPos)), 0 ); 597 ruhYe = (UChar)iContDMaxPos; 619 598 620 599 return; … … 622 601 else 623 602 { 624 uiContDOri = 5; 625 ruhXe = (UChar)(uiContDStartEndMax1); 603 ruhXe = (UChar)iContDMaxPos; 626 604 ruhYe = (UChar)iYe; 627 605 … … 666 644 case( 2 ): { for( UInt iX = uiTempBlockSize1; iX > uhXs; iX ) { UInt iY = uiTempBlockSize1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY; } } } break; 667 645 case( 3 ): { for( UInt iY = uiTempBlockSize1; iY > uhYs; iY ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break; 668 case( 4 ): { for( UInt iY = 0; 669 case( 5 ): { for( UInt iX = 0; 646 case( 4 ): { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break; 647 case( 5 ): { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } } break; 670 648 } 671 649 … … 754 732 } 755 733 } 734 735 #if HHI_DMM_PRED_TEX 736 TComWedgeDist::TComWedgeDist() 737 { 738 init(); 739 } 740 741 TComWedgeDist::~TComWedgeDist() 742 { 743 } 744 745 Void TComWedgeDist::init() 746 { 747 m_afpDistortFunc[0] = TComWedgeDist::xGetSAD4; 748 m_afpDistortFunc[1] = TComWedgeDist::xGetSAD8; 749 m_afpDistortFunc[2] = TComWedgeDist::xGetSAD16; 750 m_afpDistortFunc[3] = TComWedgeDist::xGetSAD32; 751 752 m_afpDistortFunc[4] = TComWedgeDist::xGetSSE4; 753 m_afpDistortFunc[5] = TComWedgeDist::xGetSSE8; 754 m_afpDistortFunc[6] = TComWedgeDist::xGetSSE16; 755 m_afpDistortFunc[7] = TComWedgeDist::xGetSSE32; 756 } 757 758 UInt TComWedgeDist::xGetSAD4( WedgeDistParam* pcDtParam ) 759 { 760 Pel* piOrg = pcDtParam>pOrg; 761 Pel* piCur = pcDtParam>pCur; 762 Int iRows = pcDtParam>iRows; 763 Int iSubShift = pcDtParam>iSubShift; 764 Int iSubStep = ( 1 << iSubShift ); 765 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 766 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 767 768 UInt uiSum = 0; 769 770 for( ; iRows != 0; iRows=iSubStep ) 771 { 772 uiSum += abs( piOrg[0]  piCur[0] ); 773 uiSum += abs( piOrg[1]  piCur[1] ); 774 uiSum += abs( piOrg[2]  piCur[2] ); 775 uiSum += abs( piOrg[3]  piCur[3] ); 776 777 piOrg += iStrideOrg; 778 piCur += iStrideCur; 779 } 780 781 uiSum <<= iSubShift; 782 return ( uiSum >> g_uiBitIncrement ); 783 } 784 785 UInt TComWedgeDist::xGetSAD8( WedgeDistParam* pcDtParam ) 786 { 787 Pel* piOrg = pcDtParam>pOrg; 788 Pel* piCur = pcDtParam>pCur; 789 Int iRows = pcDtParam>iRows; 790 Int iSubShift = pcDtParam>iSubShift; 791 Int iSubStep = ( 1 << iSubShift ); 792 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 793 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 794 795 UInt uiSum = 0; 796 797 for( ; iRows != 0; iRows=iSubStep ) 798 { 799 uiSum += abs( piOrg[0]  piCur[0] ); 800 uiSum += abs( piOrg[1]  piCur[1] ); 801 uiSum += abs( piOrg[2]  piCur[2] ); 802 uiSum += abs( piOrg[3]  piCur[3] ); 803 uiSum += abs( piOrg[4]  piCur[4] ); 804 uiSum += abs( piOrg[5]  piCur[5] ); 805 uiSum += abs( piOrg[6]  piCur[6] ); 806 uiSum += abs( piOrg[7]  piCur[7] ); 807 808 piOrg += iStrideOrg; 809 piCur += iStrideCur; 810 } 811 812 uiSum <<= iSubShift; 813 return ( uiSum >> g_uiBitIncrement ); 814 } 815 816 UInt TComWedgeDist::xGetSAD16( WedgeDistParam* pcDtParam ) 817 { 818 Pel* piOrg = pcDtParam>pOrg; 819 Pel* piCur = pcDtParam>pCur; 820 Int iRows = pcDtParam>iRows; 821 Int iSubShift = pcDtParam>iSubShift; 822 Int iSubStep = ( 1 << iSubShift ); 823 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 824 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 825 826 UInt uiSum = 0; 827 828 for( ; iRows != 0; iRows=iSubStep ) 829 { 830 uiSum += abs( piOrg[0]  piCur[0] ); 831 uiSum += abs( piOrg[1]  piCur[1] ); 832 uiSum += abs( piOrg[2]  piCur[2] ); 833 uiSum += abs( piOrg[3]  piCur[3] ); 834 uiSum += abs( piOrg[4]  piCur[4] ); 835 uiSum += abs( piOrg[5]  piCur[5] ); 836 uiSum += abs( piOrg[6]  piCur[6] ); 837 uiSum += abs( piOrg[7]  piCur[7] ); 838 uiSum += abs( piOrg[8]  piCur[8] ); 839 uiSum += abs( piOrg[9]  piCur[9] ); 840 uiSum += abs( piOrg[10]  piCur[10] ); 841 uiSum += abs( piOrg[11]  piCur[11] ); 842 uiSum += abs( piOrg[12]  piCur[12] ); 843 uiSum += abs( piOrg[13]  piCur[13] ); 844 uiSum += abs( piOrg[14]  piCur[14] ); 845 uiSum += abs( piOrg[15]  piCur[15] ); 846 847 piOrg += iStrideOrg; 848 piCur += iStrideCur; 849 } 850 851 uiSum <<= iSubShift; 852 return ( uiSum >> g_uiBitIncrement ); 853 } 854 855 UInt TComWedgeDist::xGetSAD32( WedgeDistParam* pcDtParam ) 856 { 857 Pel* piOrg = pcDtParam>pOrg; 858 Pel* piCur = pcDtParam>pCur; 859 Int iRows = pcDtParam>iRows; 860 Int iSubShift = pcDtParam>iSubShift; 861 Int iSubStep = ( 1 << iSubShift ); 862 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 863 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 864 865 UInt uiSum = 0; 866 867 for( ; iRows != 0; iRows=iSubStep ) 868 { 869 uiSum += abs( piOrg[0]  piCur[0] ); 870 uiSum += abs( piOrg[1]  piCur[1] ); 871 uiSum += abs( piOrg[2]  piCur[2] ); 872 uiSum += abs( piOrg[3]  piCur[3] ); 873 uiSum += abs( piOrg[4]  piCur[4] ); 874 uiSum += abs( piOrg[5]  piCur[5] ); 875 uiSum += abs( piOrg[6]  piCur[6] ); 876 uiSum += abs( piOrg[7]  piCur[7] ); 877 uiSum += abs( piOrg[8]  piCur[8] ); 878 uiSum += abs( piOrg[9]  piCur[9] ); 879 uiSum += abs( piOrg[10]  piCur[10] ); 880 uiSum += abs( piOrg[11]  piCur[11] ); 881 uiSum += abs( piOrg[12]  piCur[12] ); 882 uiSum += abs( piOrg[13]  piCur[13] ); 883 uiSum += abs( piOrg[14]  piCur[14] ); 884 uiSum += abs( piOrg[15]  piCur[15] ); 885 uiSum += abs( piOrg[16]  piCur[16] ); 886 uiSum += abs( piOrg[17]  piCur[17] ); 887 uiSum += abs( piOrg[18]  piCur[18] ); 888 uiSum += abs( piOrg[19]  piCur[19] ); 889 uiSum += abs( piOrg[20]  piCur[20] ); 890 uiSum += abs( piOrg[21]  piCur[21] ); 891 uiSum += abs( piOrg[22]  piCur[22] ); 892 uiSum += abs( piOrg[23]  piCur[23] ); 893 uiSum += abs( piOrg[24]  piCur[24] ); 894 uiSum += abs( piOrg[25]  piCur[25] ); 895 uiSum += abs( piOrg[26]  piCur[26] ); 896 uiSum += abs( piOrg[27]  piCur[27] ); 897 uiSum += abs( piOrg[28]  piCur[28] ); 898 uiSum += abs( piOrg[29]  piCur[29] ); 899 uiSum += abs( piOrg[30]  piCur[30] ); 900 uiSum += abs( piOrg[31]  piCur[31] ); 901 902 piOrg += iStrideOrg; 903 piCur += iStrideCur; 904 } 905 906 uiSum <<= iSubShift; 907 return ( uiSum >> g_uiBitIncrement ); 908 } 909 910 UInt TComWedgeDist::xGetSSE4( WedgeDistParam* pcDtParam ) 911 { 912 Pel* piOrg = pcDtParam>pOrg; 913 Pel* piCur = pcDtParam>pCur; 914 Int iRows = pcDtParam>iRows; 915 Int iStrideOrg = pcDtParam>iStrideOrg; 916 Int iStrideCur = pcDtParam>iStrideCur; 917 918 UInt uiSum = 0; 919 UInt uiShift = g_uiBitIncrement<<1; 920 921 Int iTemp; 922 923 for( ; iRows != 0; iRows ) 924 { 925 926 iTemp = piOrg[0]  piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; 927 iTemp = piOrg[1]  piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; 928 iTemp = piOrg[2]  piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; 929 iTemp = piOrg[3]  piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; 930 931 piOrg += iStrideOrg; 932 piCur += iStrideCur; 933 } 934 935 return ( uiSum ); 936 } 937 938 UInt TComWedgeDist::xGetSSE8( WedgeDistParam* pcDtParam ) 939 { 940 Pel* piOrg = pcDtParam>pOrg; 941 Pel* piCur = pcDtParam>pCur; 942 Int iRows = pcDtParam>iRows; 943 Int iStrideOrg = pcDtParam>iStrideOrg; 944 Int iStrideCur = pcDtParam>iStrideCur; 945 946 UInt uiSum = 0; 947 UInt uiShift = g_uiBitIncrement<<1; 948 949 Int iTemp; 950 951 for( ; iRows != 0; iRows ) 952 { 953 iTemp = piOrg[0]  piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; 954 iTemp = piOrg[1]  piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; 955 iTemp = piOrg[2]  piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; 956 iTemp = piOrg[3]  piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; 957 iTemp = piOrg[4]  piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; 958 iTemp = piOrg[5]  piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; 959 iTemp = piOrg[6]  piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; 960 iTemp = piOrg[7]  piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; 961 962 piOrg += iStrideOrg; 963 piCur += iStrideCur; 964 } 965 966 return ( uiSum ); 967 } 968 969 UInt TComWedgeDist::xGetSSE16( WedgeDistParam* pcDtParam ) 970 { 971 Pel* piOrg = pcDtParam>pOrg; 972 Pel* piCur = pcDtParam>pCur; 973 Int iRows = pcDtParam>iRows; 974 Int iStrideOrg = pcDtParam>iStrideOrg; 975 Int iStrideCur = pcDtParam>iStrideCur; 976 977 UInt uiSum = 0; 978 UInt uiShift = g_uiBitIncrement<<1; 979 980 Int iTemp; 981 982 for( ; iRows != 0; iRows ) 983 { 984 985 iTemp = piOrg[ 0]  piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; 986 iTemp = piOrg[ 1]  piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; 987 iTemp = piOrg[ 2]  piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; 988 iTemp = piOrg[ 3]  piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; 989 iTemp = piOrg[ 4]  piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; 990 iTemp = piOrg[ 5]  piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; 991 iTemp = piOrg[ 6]  piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; 992 iTemp = piOrg[ 7]  piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; 993 iTemp = piOrg[ 8]  piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; 994 iTemp = piOrg[ 9]  piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; 995 iTemp = piOrg[10]  piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; 996 iTemp = piOrg[11]  piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; 997 iTemp = piOrg[12]  piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; 998 iTemp = piOrg[13]  piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; 999 iTemp = piOrg[14]  piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; 1000 iTemp = piOrg[15]  piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; 1001 1002 piOrg += iStrideOrg; 1003 piCur += iStrideCur; 1004 } 1005 1006 return ( uiSum ); 1007 } 1008 1009 UInt TComWedgeDist::xGetSSE32( WedgeDistParam* pcDtParam ) 1010 { 1011 Pel* piOrg = pcDtParam>pOrg; 1012 Pel* piCur = pcDtParam>pCur; 1013 Int iRows = pcDtParam>iRows; 1014 Int iStrideOrg = pcDtParam>iStrideOrg; 1015 Int iStrideCur = pcDtParam>iStrideCur; 1016 1017 UInt uiSum = 0; 1018 UInt uiShift = g_uiBitIncrement<<1; 1019 Int iTemp; 1020 1021 for( ; iRows != 0; iRows ) 1022 { 1023 1024 iTemp = piOrg[ 0]  piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; 1025 iTemp = piOrg[ 1]  piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; 1026 iTemp = piOrg[ 2]  piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; 1027 iTemp = piOrg[ 3]  piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; 1028 iTemp = piOrg[ 4]  piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; 1029 iTemp = piOrg[ 5]  piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; 1030 iTemp = piOrg[ 6]  piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; 1031 iTemp = piOrg[ 7]  piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; 1032 iTemp = piOrg[ 8]  piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; 1033 iTemp = piOrg[ 9]  piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; 1034 iTemp = piOrg[10]  piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; 1035 iTemp = piOrg[11]  piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; 1036 iTemp = piOrg[12]  piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; 1037 iTemp = piOrg[13]  piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; 1038 iTemp = piOrg[14]  piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; 1039 iTemp = piOrg[15]  piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; 1040 iTemp = piOrg[16]  piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; 1041 iTemp = piOrg[17]  piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; 1042 iTemp = piOrg[18]  piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; 1043 iTemp = piOrg[19]  piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; 1044 iTemp = piOrg[20]  piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; 1045 iTemp = piOrg[21]  piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; 1046 iTemp = piOrg[22]  piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; 1047 iTemp = piOrg[23]  piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; 1048 iTemp = piOrg[24]  piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; 1049 iTemp = piOrg[25]  piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; 1050 iTemp = piOrg[26]  piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; 1051 iTemp = piOrg[27]  piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; 1052 iTemp = piOrg[28]  piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; 1053 iTemp = piOrg[29]  piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; 1054 iTemp = piOrg[30]  piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; 1055 iTemp = piOrg[31]  piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; 1056 1057 piOrg += iStrideOrg; 1058 piCur += iStrideCur; 1059 } 1060 1061 return ( uiSum ); 1062 } 1063 1064 Void TComWedgeDist::setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, WedgeDist eWDist, WedgeDistParam& rcDistParam ) 1065 { 1066 // set Block Width / Height 1067 rcDistParam.iCols = uiBlkWidth; 1068 rcDistParam.iRows = uiBlkHeight; 1069 rcDistParam.DistFunc = m_afpDistortFunc[eWDist + g_aucConvertToBit[ rcDistParam.iCols ] ]; 1070 1071 // initialize 1072 rcDistParam.iSubShift = 0; 1073 } 1074 1075 UInt TComWedgeDist::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, WedgeDist eWDist ) 1076 { 1077 WedgeDistParam cDtParam; 1078 setDistParam( uiBlkWidth, uiBlkHeight, eWDist, cDtParam ); 1079 cDtParam.pOrg = piOrg; 1080 cDtParam.pCur = piCur; 1081 cDtParam.iStrideOrg = iOrgStride; 1082 cDtParam.iStrideCur = iCurStride; 1083 cDtParam.iStep = 1; 1084 1085 return cDtParam.DistFunc( &cDtParam ); 1086 } 1087 #endif
Note: See TracChangeset for help on using the changeset viewer.