Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComRdCost.cpp
 Timestamp:
 1 Sep 2013, 22:47:26 (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/Lib/TLibCommon/TComRdCost.cpp
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010201 2, ITU/ISO/IEC6 * Copyright (c) 20102013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 40 40 #include "TComRom.h" 41 41 #include "TComRdCost.h" 42 #if H_3D 42 43 #include "TComDataCU.h" 44 #endif 43 45 44 46 //! \ingroup TLibCommon 45 47 //! \{ 46 48 47 #if SAIT_VSO_EST_A0033 49 #if H_3D_VSO 50 // SAIT_VSO_EST_A0033 48 51 Double TComRdCost::m_dDisparityCoeff = 1.0; 49 52 #endif … … 62 65 63 66 // Calculate RD functions 67 #if H_3D_VSO 68 Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) 69 #else 64 70 Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc ) 71 #endif 65 72 { 66 73 Double dRdCost = 0.0; … … 86 93 } 87 94 88 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE89 dLambda = m_dLambdaScale * dLambda ;90 #endif91 95 if (bFlag) 92 96 { 93 97 // Intra8x8, Intra4x4 Block only... 94 #if LOSSLESS_CODING &&SEQUENCE_LEVEL_LOSSLESS98 #if SEQUENCE_LEVEL_LOSSLESS 95 99 dRdCost = (Double)(uiBits); 96 100 #else … … 107 111 else 108 112 { 109 #if LOSSLESS_CODING &&SEQUENCE_LEVEL_LOSSLESS113 #if SEQUENCE_LEVEL_LOSSLESS 110 114 dRdCost = (Double)(uiBits); 111 115 #else … … 119 123 } 120 124 125 #if H_3D_VSO 126 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc ) 127 #else 121 128 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc ) 129 #endif 122 130 { 123 131 Double dRdCost = 0.0; … … 146 154 { 147 155 // Intra8x8, Intra4x4 Block only... 148 #if LOSSLESS_CODING &&SEQUENCE_LEVEL_LOSSLESS156 #if SEQUENCE_LEVEL_LOSSLESS 149 157 dRdCost = (Double)(uiBits); 150 158 #else … … 161 169 else 162 170 { 163 #if LOSSLESS_CODING &&SEQUENCE_LEVEL_LOSSLESS171 #if SEQUENCE_LEVEL_LOSSLESS 164 172 dRdCost = (Double)(uiBits); 165 173 #else … … 181 189 } 182 190 183 #if H3D_IVMP184 Void185 TComRdCost::setLambdaMVReg( Double dLambda )186 {187 m_uiLambdaMVRegSAD = (UInt)floor( 65536.0 * sqrt( dLambda ) );188 m_uiLambdaMVRegSSE = (UInt)floor( 65536.0 * dLambda );189 }190 #endif191 191 192 192 // Initalize Function Pointer by [eDFunc] … … 235 235 m_afpDistortFunc[27] = TComRdCost::xGetHADs; 236 236 m_afpDistortFunc[28] = TComRdCost::xGetHADs; 237 238 #if SAIT_VSO_EST_A0033 237 238 #if H_3D_VSO 239 // SAIT_VSO_EST_A0033 239 240 m_afpDistortFunc[29] = TComRdCost::xGetVSD; 240 241 m_afpDistortFunc[30] = TComRdCost::xGetVSD4; … … 245 246 m_afpDistortFunc[35] = TComRdCost::xGetVSD16N; 246 247 #endif 247 248 248 #if !FIX203 249 249 m_puiComponentCostOriginP = NULL; … … 256 256 #if !FIX203 257 257 m_iSearchLimit = 0xdeaddead; 258 259 #if HHI_VSO 260 m_apRefPics = NULL; 261 m_paaiShiftLUTs = NULL; 262 m_uiNumberRefPics = 0; 258 #endif 259 #if H_3D_VSO 263 260 m_bUseVSO = false; 264 #if SAIT_VSO_EST_A0033265 m_bUseEstimatedVSD = false;266 #endif267 261 m_uiVSOMode = 0; 268 262 m_fpDistortFuncVSO = NULL; 269 263 m_pcRenModel = NULL; 270 #endif 271 272 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 273 m_dLambdaScale = 1; 274 #endif 264 265 // SAIT_VSO_EST_A0033 266 m_bUseEstimatedVSD = false; 275 267 #endif 276 268 } … … 290 282 291 283 m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ]; 292 m_puiMultiviewRegCostHorOrgP = new UInt[ 4 * iSubPelSearchLimit ];293 m_puiMultiviewRegCostVerOrgP = new UInt[ 4 * iSubPelSearchLimit ];294 295 284 iSubPelSearchLimit *= 2; 296 285 297 286 m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit; 298 299 m_puiMultiviewRegCostHor = m_puiMultiviewRegCostHorOrgP + iSubPelSearchLimit;300 m_puiMultiviewRegCostVer = m_puiMultiviewRegCostVerOrgP + iSubPelSearchLimit;301 302 287 303 288 for( Int n = iSubPelSearchLimit; n < iSubPelSearchLimit; n++) 304 289 { 305 290 m_puiComponentCost[n] = xGetComponentBits( n ); 306 m_puiMultiviewRegCostHor[n] = xGetComponentBits( n ); // first version307 m_puiMultiviewRegCostVer[n] = xGetComponentBits( n ); // first version308 291 } 309 292 } … … 316 299 delete [] m_puiComponentCostOriginP; 317 300 m_puiComponentCostOriginP = NULL; 318 }319 320 if( m_puiMultiviewRegCostHorOrgP )321 {322 delete [] m_puiMultiviewRegCostHorOrgP;323 m_puiMultiviewRegCostHorOrgP = NULL;324 }325 if( m_puiMultiviewRegCostVerOrgP )326 {327 delete [] m_puiMultiviewRegCostVerOrgP;328 m_puiMultiviewRegCostVerOrgP = NULL;329 301 } 330 302 } … … 356 328 // initialize 357 329 rcDistParam.iSubShift = 0; 358 #if HHI_INTERVIEW_SKIP359 rcDistParam.pUsed = 0;360 rcDistParam.iStrideUsed = 0;361 #endif362 330 } 363 331 … … 394 362 // initialize 395 363 rcDistParam.iSubShift = 0; 396 #if HHI_INTERVIEW_SKIP397 rcDistParam.pUsed = 0;398 rcDistParam.iStrideUsed = 0;399 #endif400 364 } 401 365 … … 450 414 // initialize 451 415 rcDistParam.iSubShift = 0; 452 #if HHI_INTERVIEW_SKIP453 rcDistParam.pUsed = 0;454 rcDistParam.iStrideUsed = 0;455 #endif456 416 } 457 417 … … 460 420 TComRdCost::setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard, Bool bUseNSHAD ) 461 421 #else 462 TComRdCost::setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard )422 TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) 463 423 #endif 464 424 { … … 471 431 rcDP.iStep = 1; 472 432 rcDP.iSubShift = 0; 433 rcDP.bitDepth = bitDepth; 473 434 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 474 #if HHI_INTERVIEW_SKIP475 rcDP.pUsed = 0;476 rcDP.iStrideUsed = 0;477 #endif478 435 #if NS_HAD 479 436 rcDP.bUseNSHAD = bUseNSHAD; … … 481 438 } 482 439 483 UInt TComRdCost::calcHAD( Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight )440 UInt TComRdCost::calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ) 484 441 { 485 442 UInt uiSum = 0; … … 523 480 } 524 481 525 return ( uiSum >> g_uiBitIncrement ); 526 } 527 #if HHI_INTERVIEW_SKIP 528 UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piUsed, Int iUsedStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) 529 { 530 DistParam cDtParam; 531 setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); 532 cDtParam.pOrg = piOrg; 533 cDtParam.pCur = piCur; 534 cDtParam.pUsed = piUsed; 535 cDtParam.iStrideOrg = iOrgStride; 536 cDtParam.iStrideCur = iCurStride; 537 cDtParam.iStrideUsed= iUsedStride; 538 #ifdef DCM_RDCOST_TEMP_FIX //Temporary fix since DistParam is lacking a constructor and the variable iStep is not initialized 539 cDtParam.iStep = 1; 540 #endif 541 #ifdef WEIGHT_PRED 542 cDtParam.applyWeight = false; 543 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 544 #endif 545 #if LGE_ILLUCOMP_B0045 546 cDtParam.bUseIC = false; 547 #endif 548 return cDtParam.DistFunc( &cDtParam ); 549 } 550 #endif 482 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth8); 483 484 } 485 486 #if SCU_HS_FAST_DEPTH_INTRA_E0238 487 488 UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth) 489 { 490 Int temp = 0; 491 492 for (Int y = 0; y < height; y++) 493 { 494 for (Int x = 0; x < width; x++) 495 { 496 temp += pi0[ y * stride + x ]; 497 } 498 } 499 500 Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2; 501 502 if ( width == 4 ) 503 { 504 cuDepth = cuMaxLog2Size  2; 505 } 506 507 temp = temp >> (cuMaxLog2SizecuDepth) * 2; 508 509 UInt sum = 0; 510 for (Int y = 0; y < height; y++) 511 { 512 for (Int x = 0; x < width; x++) 513 { 514 sum += (pi0[ y * stride + x ]  temp ) * (pi0[ y * stride + x ]  temp ); 515 } 516 } 517 return (sum >> (cuMaxLog2SizecuDepth)*2); 518 519 } 520 #endif 521 551 522 552 523 #if WEIGHTED_CHROMA_DISTORTION 553 UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bWeighted, DFunc eDFunc)524 UInt TComRdCost::getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText, DFunc eDFunc) 554 525 #else 555 UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc )526 UInt TComRdCost::getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) 556 527 #endif 557 528 { … … 566 537 cDtParam.bApplyWeight = false; 567 538 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 568 539 cDtParam.bitDepth = bitDepth; 540 541 #if H_3D_IC 542 cDtParam.bUseIC = false; 543 #endif 544 #if LGE_INTER_SDC_E0156 545 cDtParam.bUseSDCMRSAD = false; 546 #endif 569 547 #if WEIGHTED_CHROMA_DISTORTION 570 #if LGE_ILLUCOMP_B0045 571 cDtParam.bUseIC = false; 572 #endif 573 if (bWeighted) 574 { 575 return ((int) (m_chromaDistortionWeight * cDtParam.DistFunc( &cDtParam ))); 548 if (eText == TEXT_CHROMA_U) 549 { 550 return ((Int) (m_cbDistortionWeight * cDtParam.DistFunc( &cDtParam ))); 551 } 552 else if (eText == TEXT_CHROMA_V) 553 { 554 return ((Int) (m_crDistortionWeight * cDtParam.DistFunc( &cDtParam ))); 576 555 } 577 556 else … … 583 562 #endif 584 563 } 585 586 587 #if SAIT_VSO_EST_A0033 588 UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) 564 #if H_3D_VSO 565 // SAIT_VSO_EST_A0033 566 UInt TComRdCost::getDistPartVSD( TComDataCU* pcCU, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD, DFunc eDFunc ) 589 567 { 590 568 AOT( ( m_dDisparityCoeff <= 0 )  ( m_dDisparityCoeff > 10 ) ); 569 570 Pel* piVirRec = m_pcVideoRecPicYuv>getLumaAddr(pcCU>getAddr(),pcCU>getZorderIdxInCU()+uiPartOffset); 571 Pel* piVirOrg = m_pcDepthPicYuv >getLumaAddr(pcCU>getAddr(),pcCU>getZorderIdxInCU()+uiPartOffset); 572 Int iVirStride = m_pcVideoRecPicYuv>getStride(); 591 573 592 574 DistParam cDtParam; … … 604 586 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 605 587 606 #if LGE_ILLUCOMP_B0045 607 cDtParam.bUseIC = false; 608 #endif 609 return cDtParam.DistFunc( &cDtParam ); 610 } 611 #endif 588 Dist dist = cDtParam.DistFunc( &cDtParam ); 589 590 if ( m_bUseWVSO ) 591 { 592 Int iDWeight = m_iDWeight * m_iDWeight; 593 Int iVSOWeight = m_iVSDWeight * m_iVSDWeight; 594 Dist distDepth; 595 596 if ( !bHAD ) 597 { 598 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 599 } 600 else 601 { 602 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 603 } 604 605 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 606 } 607 #if H_3D_FIX_UINT_WARNING 608 return (UInt) dist; 609 #else 610 return dist; 611 #endif 612 613 } 614 #endif 615 616 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 617 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ) 618 { 619 UInt SAD = 0; 620 Int shift = DISTORTION_PRECISION_ADJUSTMENT(bitDepth8); 621 for ( Int i=0; i<height; i++ ) 622 { 623 for( Int j=0; j<width; j++ ) 624 { 625 SAD += abs((pelCur[j]  pelOrg[j])) >> shift; 626 } 627 pelCur = pelCur + curStride; 628 pelOrg = pelOrg + orgStride; 629 } 630 return SAD; 631 } 632 #endif 633 634 // ==================================================================================================================== 635 // Distortion functions 636 // ==================================================================================================================== 637 638 //  639 // SAD 640 //  612 641 613 642 UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) … … 617 646 return xGetSADw( pcDtParam ); 618 647 } 619 #if LGE_ILLUCOMP_B0045 620 if(pcDtParam>bUseIC) 648 #if H_3D_IC 649 if( pcDtParam>bUseIC ) 650 { 651 return xGetSADic( pcDtParam ); 652 } 653 #endif 654 #if LGE_INTER_SDC_E0156 655 if( pcDtParam>bUseSDCMRSAD ) 621 656 { 622 657 return xGetSADic( pcDtParam ); … … 629 664 Int iStrideCur = pcDtParam>iStrideCur; 630 665 Int iStrideOrg = pcDtParam>iStrideOrg; 631 666 632 667 UInt uiSum = 0; 633 668 634 669 for( ; iRows != 0; iRows ) 635 670 { … … 641 676 piCur += iStrideCur; 642 677 } 643 644 return ( uiSum >> g_uiBitIncrement);678 679 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 645 680 } 646 681 … … 651 686 return xGetSADw( pcDtParam ); 652 687 } 653 #if LGE_ILLUCOMP_B0045 654 if(pcDtParam>bUseIC) 688 #if H_3D_IC 689 if( pcDtParam>bUseIC ) 690 { 691 return xGetSAD4ic( pcDtParam ); 692 } 693 #endif 694 #if LGE_INTER_SDC_E0156 695 if( pcDtParam>bUseSDCMRSAD ) 655 696 { 656 697 return xGetSAD4ic( pcDtParam ); … … 664 705 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 665 706 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 666 707 667 708 UInt uiSum = 0; 668 709 669 710 for( ; iRows != 0; iRows=iSubStep ) 670 711 { … … 673 714 uiSum += abs( piOrg[2]  piCur[2] ); 674 715 uiSum += abs( piOrg[3]  piCur[3] ); 675 676 piOrg += iStrideOrg; 677 piCur += iStrideCur; 678 } 679 716 717 piOrg += iStrideOrg; 718 piCur += iStrideCur; 719 } 720 680 721 uiSum <<= iSubShift; 681 return ( uiSum >> g_uiBitIncrement);722 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 682 723 } 683 724 … … 688 729 return xGetSADw( pcDtParam ); 689 730 } 690 #if LGE_ILLUCOMP_B0045 691 if(pcDtParam>bUseIC) 731 #if H_3D_IC 732 if( pcDtParam>bUseIC ) 733 { 734 return xGetSAD8ic( pcDtParam ); 735 } 736 #endif 737 #if LGE_INTER_SDC_E0156 738 if( pcDtParam>bUseSDCMRSAD ) 692 739 { 693 740 return xGetSAD8ic( pcDtParam ); … … 701 748 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 702 749 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 703 750 704 751 UInt uiSum = 0; 705 752 706 753 for( ; iRows != 0; iRows=iSubStep ) 707 754 { … … 714 761 uiSum += abs( piOrg[6]  piCur[6] ); 715 762 uiSum += abs( piOrg[7]  piCur[7] ); 716 717 piOrg += iStrideOrg; 718 piCur += iStrideCur; 719 } 720 763 764 piOrg += iStrideOrg; 765 piCur += iStrideCur; 766 } 767 721 768 uiSum <<= iSubShift; 722 return ( uiSum >> g_uiBitIncrement);769 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 723 770 } 724 771 … … 729 776 return xGetSADw( pcDtParam ); 730 777 } 731 #if LGE_ILLUCOMP_B0045 732 if(pcDtParam>bUseIC) 778 #if H_3D_IC 779 if( pcDtParam>bUseIC ) 780 { 781 return xGetSAD16ic( pcDtParam ); 782 } 783 #endif 784 #if LGE_INTER_SDC_E0156 785 if( pcDtParam>bUseSDCMRSAD ) 733 786 { 734 787 return xGetSAD16ic( pcDtParam ); … … 742 795 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 743 796 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 744 797 745 798 UInt uiSum = 0; 746 799 747 800 for( ; iRows != 0; iRows=iSubStep ) 748 801 { … … 763 816 uiSum += abs( piOrg[14]  piCur[14] ); 764 817 uiSum += abs( piOrg[15]  piCur[15] ); 765 766 piOrg += iStrideOrg; 767 piCur += iStrideCur; 768 } 769 818 819 piOrg += iStrideOrg; 820 piCur += iStrideCur; 821 } 822 770 823 uiSum <<= iSubShift; 771 return ( uiSum >> g_uiBitIncrement);824 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 772 825 } 773 826 … … 779 832 return xGetSADw( pcDtParam ); 780 833 } 781 #if LGE_ILLUCOMP_B0045 782 if(pcDtParam>bUseIC) 834 #if H_3D_IC 835 if( pcDtParam>bUseIC ) 836 { 837 return xGetSAD12ic( pcDtParam ); 838 } 839 #endif 840 #if LGE_INTER_SDC_E0156 841 if( pcDtParam>bUseSDCMRSAD ) 783 842 { 784 843 return xGetSAD12ic( pcDtParam ); … … 792 851 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 793 852 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 794 853 795 854 UInt uiSum = 0; 796 855 797 856 for( ; iRows != 0; iRows=iSubStep ) 798 857 { … … 809 868 uiSum += abs( piOrg[10]  piCur[10] ); 810 869 uiSum += abs( piOrg[11]  piCur[11] ); 811 812 piOrg += iStrideOrg; 813 piCur += iStrideCur; 814 } 815 870 871 piOrg += iStrideOrg; 872 piCur += iStrideCur; 873 } 874 816 875 uiSum <<= iSubShift; 817 return ( uiSum >> g_uiBitIncrement);876 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 818 877 } 819 878 #endif … … 821 880 UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 822 881 { 823 #if LGE_ILLUCOMP_B0045 824 if(pcDtParam>bUseIC) 882 #if H_3D_IC 883 if( pcDtParam>bUseIC ) 884 { 885 return xGetSAD16Nic( pcDtParam ); 886 } 887 #endif 888 #if LGE_INTER_SDC_E0156 889 if( pcDtParam>bUseSDCMRSAD ) 825 890 { 826 891 return xGetSAD16Nic( pcDtParam ); … … 835 900 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 836 901 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 837 902 838 903 UInt uiSum = 0; 839 904 840 905 for( ; iRows != 0; iRows=iSubStep ) 841 906 { … … 862 927 piCur += iStrideCur; 863 928 } 864 929 865 930 uiSum <<= iSubShift; 866 return ( uiSum >> g_uiBitIncrement);931 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 867 932 } 868 933 … … 873 938 return xGetSADw( pcDtParam ); 874 939 } 875 #if LGE_ILLUCOMP_B0045 876 if(pcDtParam>bUseIC) 940 #if H_3D_IC 941 if( pcDtParam>bUseIC ) 942 { 943 return xGetSAD32ic( pcDtParam ); 944 } 945 #endif 946 #if LGE_INTER_SDC_E0156 947 if( pcDtParam>bUseSDCMRSAD ) 877 948 { 878 949 return xGetSAD32ic( pcDtParam ); … … 886 957 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 887 958 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 888 959 889 960 UInt uiSum = 0; 890 961 891 962 for( ; iRows != 0; iRows=iSubStep ) 892 963 { … … 923 994 uiSum += abs( piOrg[30]  piCur[30] ); 924 995 uiSum += abs( piOrg[31]  piCur[31] ); 925 926 piOrg += iStrideOrg; 927 piCur += iStrideCur; 928 } 929 996 997 piOrg += iStrideOrg; 998 piCur += iStrideCur; 999 } 1000 930 1001 uiSum <<= iSubShift; 931 return ( uiSum >> g_uiBitIncrement);1002 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 932 1003 } 933 1004 … … 939 1010 return xGetSADw( pcDtParam ); 940 1011 } 941 #if LGE_ILLUCOMP_B0045 942 if(pcDtParam>bUseIC) 1012 #if H_3D_IC 1013 if( pcDtParam>bUseIC ) 1014 { 1015 return xGetSAD24ic( pcDtParam ); 1016 } 1017 #endif 1018 #if LGE_INTER_SDC_E0156 1019 if( pcDtParam>bUseSDCMRSAD ) 943 1020 { 944 1021 return xGetSAD24ic( pcDtParam ); … … 952 1029 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 953 1030 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 954 1031 955 1032 UInt uiSum = 0; 956 1033 957 1034 for( ; iRows != 0; iRows=iSubStep ) 958 1035 { … … 981 1058 uiSum += abs( piOrg[22]  piCur[22] ); 982 1059 uiSum += abs( piOrg[23]  piCur[23] ); 983 984 piOrg += iStrideOrg; 985 piCur += iStrideCur; 986 } 987 1060 1061 piOrg += iStrideOrg; 1062 piCur += iStrideCur; 1063 } 1064 988 1065 uiSum <<= iSubShift; 989 return ( uiSum >> g_uiBitIncrement);1066 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 990 1067 } 991 1068 … … 998 1075 return xGetSADw( pcDtParam ); 999 1076 } 1000 #if LGE_ILLUCOMP_B0045 1001 if(pcDtParam>bUseIC) 1077 #if H_3D_IC 1078 if( pcDtParam>bUseIC ) 1079 { 1080 return xGetSAD64ic( pcDtParam ); 1081 } 1082 #endif 1083 #if LGE_INTER_SDC_E0156 1084 if( pcDtParam>bUseSDCMRSAD ) 1002 1085 { 1003 1086 return xGetSAD64ic( pcDtParam ); … … 1011 1094 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1012 1095 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1013 1096 1014 1097 UInt uiSum = 0; 1015 1098 1016 1099 for( ; iRows != 0; iRows=iSubStep ) 1017 1100 { … … 1080 1163 uiSum += abs( piOrg[62]  piCur[62] ); 1081 1164 uiSum += abs( piOrg[63]  piCur[63] ); 1082 1083 piOrg += iStrideOrg; 1084 piCur += iStrideCur; 1085 } 1086 1165 1166 piOrg += iStrideOrg; 1167 piCur += iStrideCur; 1168 } 1169 1087 1170 uiSum <<= iSubShift; 1088 return ( uiSum >> g_uiBitIncrement);1171 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 1089 1172 } 1090 1173 … … 1096 1179 return xGetSADw( pcDtParam ); 1097 1180 } 1098 #if LGE_ILLUCOMP_B0045 1099 if(pcDtParam>bUseIC) 1181 #if H_3D_IC 1182 if( pcDtParam>bUseIC ) 1183 { 1184 return xGetSAD48ic( pcDtParam ); 1185 } 1186 #endif 1187 #if LGE_INTER_SDC_E0156 1188 if( pcDtParam>bUseSDCMRSAD ) 1100 1189 { 1101 1190 return xGetSAD48ic( pcDtParam ); … … 1109 1198 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1110 1199 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1111 1200 1112 1201 UInt uiSum = 0; 1113 1202 1114 1203 for( ; iRows != 0; iRows=iSubStep ) 1115 1204 { … … 1162 1251 uiSum += abs( piOrg[46]  piCur[46] ); 1163 1252 uiSum += abs( piOrg[47]  piCur[47] ); 1164 1165 piOrg += iStrideOrg; 1166 piCur += iStrideCur; 1167 } 1168 1253 1254 piOrg += iStrideOrg; 1255 piCur += iStrideCur; 1256 } 1257 1169 1258 uiSum <<= iSubShift; 1170 return ( uiSum >> g_uiBitIncrement ); 1171 } 1172 #endif 1173 1174 // ==================================================================================================================== 1175 // Distortion functions 1176 // ==================================================================================================================== 1177 1178 //  1179 // SAD 1180 //  1181 #if LGE_ILLUCOMP_B0045 1259 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 1260 } 1261 #endif 1262 1263 #if H_3D_IC  LGE_INTER_SDC_E0156 1182 1264 UInt TComRdCost::xGetSADic( DistParam* pcDtParam ) 1183 1265 { … … 1192 1274 Int iStrideCur = pcDtParam>iStrideCur; 1193 1275 Int iStrideOrg = pcDtParam>iStrideOrg; 1194 1276 1195 1277 UInt uiSum = 0; 1196 1278 1197 1279 Int iOrigAvg = 0, iCurAvg = 0; 1198 1280 Int iDeltaC; … … 1225 1307 } 1226 1308 1227 return ( uiSum >> g_uiBitIncrement);1309 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1228 1310 } 1229 1311 … … 1241 1323 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1242 1324 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1243 1325 1244 1326 UInt uiSum = 0; 1245 1327 1246 1328 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1247 1329 Int iDeltaC; … … 1280 1362 piCur += iStrideCur; 1281 1363 } 1282 1364 1283 1365 uiSum <<= iSubShift; 1284 return ( uiSum >> g_uiBitIncrement);1366 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1285 1367 } 1286 1368 … … 1298 1380 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1299 1381 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1300 1382 1301 1383 UInt uiSum = 0; 1302 1384 1303 1385 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1304 1386 Int iDeltaC; … … 1349 1431 piCur += iStrideCur; 1350 1432 } 1351 1433 1352 1434 uiSum <<= iSubShift; 1353 return ( uiSum >> g_uiBitIncrement);1435 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1354 1436 } 1355 1437 … … 1367 1449 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1368 1450 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1369 1451 1370 1452 UInt uiSum = 0; 1371 1453 1372 1454 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1373 1455 Int iDeltaC; … … 1442 1524 piCur += iStrideCur; 1443 1525 } 1444 1526 1445 1527 uiSum <<= iSubShift; 1446 return ( uiSum >> g_uiBitIncrement);1528 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1447 1529 } 1448 1530 … … 1461 1543 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1462 1544 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1463 1545 1464 1546 UInt uiSum = 0; 1465 1547 1466 1548 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1467 1549 Int iDeltaC; … … 1524 1606 piCur += iStrideCur; 1525 1607 } 1526 1608 1527 1609 uiSum <<= iSubShift; 1528 return ( uiSum >> g_uiBitIncrement);1610 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1529 1611 } 1530 1612 #endif … … 1540 1622 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1541 1623 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1542 1624 1543 1625 UInt uiSum = 0; 1544 1626 … … 1618 1700 piCur += iStrideCur; 1619 1701 } 1620 1702 1621 1703 uiSum <<= iSubShift; 1622 return ( uiSum >> g_uiBitIncrement);1704 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1623 1705 } 1624 1706 … … 1636 1718 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1637 1719 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1638 1720 1639 1721 UInt uiSum = 0; 1640 1722 1641 1723 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1642 1724 Int iDeltaC; … … 1759 1841 piCur += iStrideCur; 1760 1842 } 1761 1843 1762 1844 uiSum <<= iSubShift; 1763 return ( uiSum >> g_uiBitIncrement);1845 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1764 1846 } 1765 1847 … … 1778 1860 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1779 1861 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1780 1862 1781 1863 UInt uiSum = 0; 1782 1864 1783 1865 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1784 1866 Int iDeltaC; … … 1844 1926 piCur = pcDtParam>pCur; 1845 1927 iRows = pcDtParam>iRows; 1846 1928 1847 1929 iDeltaC = uiRowCnt ? ((iOrigAvg  iCurAvg)/uiRowCnt/24) : 0; 1848 1930 … … 1879 1961 1880 1962 uiSum <<= iSubShift; 1881 return ( uiSum >> g_uiBitIncrement);1963 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 1882 1964 } 1883 1965 #endif … … 1896 1978 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 1897 1979 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 1898 1980 1899 1981 UInt uiSum = 0; 1900 1982 1901 1983 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1902 1984 Int iDeltaC; … … 2115 2197 piCur += iStrideCur; 2116 2198 } 2117 2199 2118 2200 uiSum <<= iSubShift; 2119 return ( uiSum >> g_uiBitIncrement);2201 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 2120 2202 } 2121 2203 … … 2127 2209 return xGetSADw( pcDtParam ); 2128 2210 } 2211 2129 2212 Pel* piOrg = pcDtParam>pOrg; 2130 2213 Pel* piCur = pcDtParam>pCur; … … 2134 2217 Int iStrideCur = pcDtParam>iStrideCur*iSubStep; 2135 2218 Int iStrideOrg = pcDtParam>iStrideOrg*iSubStep; 2136 2219 2137 2220 UInt uiSum = 0; 2138 2221 2139 2222 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 2140 2223 Int iDeltaC; … … 2305 2388 piCur += iStrideCur; 2306 2389 } 2307 2390 2308 2391 uiSum <<= iSubShift; 2309 return ( uiSum >> g_uiBitIncrement);2310 } 2311 #endif 2312 #endif 2313 2392 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 2393 } 2394 #endif 2395 2396 #endif 2314 2397 //  2315 2398 // SSE 2316 2399 //  2317 2400 2318 #if IBDI_DISTORTION2319 2401 UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) 2320 2402 { 2403 if ( pcDtParam>bApplyWeight ) 2404 { 2405 return xGetSSEw( pcDtParam ); 2406 } 2321 2407 Pel* piOrg = pcDtParam>pOrg; 2322 2408 Pel* piCur = pcDtParam>pCur; … … 2325 2411 Int iStrideOrg = pcDtParam>iStrideOrg; 2326 2412 Int iStrideCur = pcDtParam>iStrideCur; 2327 2413 2328 2414 UInt uiSum = 0; 2329 Int iShift = g_uiBitIncrement; 2330 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2331 2415 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2416 2332 2417 Int iTemp; 2333 2418 2334 2419 for( ; iRows != 0; iRows ) 2335 2420 { 2336 2421 for (Int n = 0; n < iCols; n++ ) 2337 2422 { 2338 iTemp = ((piOrg[n ]+iOffset)>>iShift)  ((piCur[n ]+iOffset)>>iShift);2339 uiSum += iTemp * iTemp;2340 } 2341 piOrg += iStrideOrg; 2342 piCur += iStrideCur; 2343 } 2344 2423 iTemp = piOrg[n ]  piCur[n ]; 2424 uiSum += ( iTemp * iTemp ) >> uiShift; 2425 } 2426 piOrg += iStrideOrg; 2427 piCur += iStrideCur; 2428 } 2429 2345 2430 return ( uiSum ); 2346 2431 } … … 2348 2433 UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) 2349 2434 { 2435 if ( pcDtParam>bApplyWeight ) 2436 { 2437 assert( pcDtParam>iCols == 4 ); 2438 return xGetSSEw( pcDtParam ); 2439 } 2350 2440 Pel* piOrg = pcDtParam>pOrg; 2351 2441 Pel* piCur = pcDtParam>pCur; … … 2353 2443 Int iStrideOrg = pcDtParam>iStrideOrg; 2354 2444 Int iStrideCur = pcDtParam>iStrideCur; 2355 2445 2356 2446 UInt uiSum = 0; 2357 Int iShift = g_uiBitIncrement; 2358 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2359 2447 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2448 2360 2449 Int iTemp; 2361 2362 for( ; iRows != 0; iRows ) 2363 { 2364 2365 iTemp = ((piOrg[0]+iOffset)>>iShift)  ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2366 iTemp = ((piOrg[1]+iOffset)>>iShift)  ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2367 iTemp = ((piOrg[2]+iOffset)>>iShift)  ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2368 iTemp = ((piOrg[3]+iOffset)>>iShift)  ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2369 2370 piOrg += iStrideOrg; 2371 piCur += iStrideCur; 2372 } 2373 2374 return ( uiSum ); 2375 } 2376 2377 UInt TComRdCost::xGetSSE8( DistParam* pcDtParam ) 2378 { 2379 Pel* piOrg = pcDtParam>pOrg; 2380 Pel* piCur = pcDtParam>pCur; 2381 Int iRows = pcDtParam>iRows; 2382 Int iStrideOrg = pcDtParam>iStrideOrg; 2383 Int iStrideCur = pcDtParam>iStrideCur; 2384 2385 UInt uiSum = 0; 2386 Int iShift = g_uiBitIncrement; 2387 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2388 2389 Int iTemp; 2390 2391 for( ; iRows != 0; iRows ) 2392 { 2393 iTemp = ((piOrg[0]+iOffset)>>iShift)  ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2394 iTemp = ((piOrg[1]+iOffset)>>iShift)  ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2395 iTemp = ((piOrg[2]+iOffset)>>iShift)  ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2396 iTemp = ((piOrg[3]+iOffset)>>iShift)  ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2397 iTemp = ((piOrg[4]+iOffset)>>iShift)  ((piCur[4]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2398 iTemp = ((piOrg[5]+iOffset)>>iShift)  ((piCur[5]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2399 iTemp = ((piOrg[6]+iOffset)>>iShift)  ((piCur[6]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2400 iTemp = ((piOrg[7]+iOffset)>>iShift)  ((piCur[7]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2401 2402 piOrg += iStrideOrg; 2403 piCur += iStrideCur; 2404 } 2405 2406 return ( uiSum ); 2407 } 2408 2409 UInt TComRdCost::xGetSSE16( DistParam* pcDtParam ) 2410 { 2411 Pel* piOrg = pcDtParam>pOrg; 2412 Pel* piCur = pcDtParam>pCur; 2413 Int iRows = pcDtParam>iRows; 2414 Int iStrideOrg = pcDtParam>iStrideOrg; 2415 Int iStrideCur = pcDtParam>iStrideCur; 2416 2417 UInt uiSum = 0; 2418 Int iShift = g_uiBitIncrement; 2419 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2420 2421 Int iTemp; 2422 2423 for( ; iRows != 0; iRows ) 2424 { 2425 2426 iTemp = ((piOrg[ 0]+iOffset)>>iShift)  ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2427 iTemp = ((piOrg[ 1]+iOffset)>>iShift)  ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2428 iTemp = ((piOrg[ 2]+iOffset)>>iShift)  ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2429 iTemp = ((piOrg[ 3]+iOffset)>>iShift)  ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2430 iTemp = ((piOrg[ 4]+iOffset)>>iShift)  ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2431 iTemp = ((piOrg[ 5]+iOffset)>>iShift)  ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2432 iTemp = ((piOrg[ 6]+iOffset)>>iShift)  ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2433 iTemp = ((piOrg[ 7]+iOffset)>>iShift)  ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2434 iTemp = ((piOrg[ 8]+iOffset)>>iShift)  ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2435 iTemp = ((piOrg[ 9]+iOffset)>>iShift)  ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2436 iTemp = ((piOrg[10]+iOffset)>>iShift)  ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2437 iTemp = ((piOrg[11]+iOffset)>>iShift)  ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2438 iTemp = ((piOrg[12]+iOffset)>>iShift)  ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2439 iTemp = ((piOrg[13]+iOffset)>>iShift)  ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2440 iTemp = ((piOrg[14]+iOffset)>>iShift)  ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2441 iTemp = ((piOrg[15]+iOffset)>>iShift)  ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2442 2443 piOrg += iStrideOrg; 2444 piCur += iStrideCur; 2445 } 2446 2447 return ( uiSum ); 2448 } 2449 2450 UInt TComRdCost::xGetSSE16N( DistParam* pcDtParam ) 2451 { 2452 Pel* piOrg = pcDtParam>pOrg; 2453 Pel* piCur = pcDtParam>pCur; 2454 Int iRows = pcDtParam>iRows; 2455 Int iCols = pcDtParam>iCols; 2456 Int iStrideOrg = pcDtParam>iStrideOrg; 2457 Int iStrideCur = pcDtParam>iStrideCur; 2458 2459 UInt uiSum = 0; 2460 Int iShift = g_uiBitIncrement; 2461 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2462 Int iTemp; 2463 2464 for( ; iRows != 0; iRows ) 2465 { 2466 for (Int n = 0; n < iCols; n+=16 ) 2467 { 2468 2469 iTemp = ((piOrg[n+ 0]+iOffset)>>iShift)  ((piCur[n+ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2470 iTemp = ((piOrg[n+ 1]+iOffset)>>iShift)  ((piCur[n+ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2471 iTemp = ((piOrg[n+ 2]+iOffset)>>iShift)  ((piCur[n+ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2472 iTemp = ((piOrg[n+ 3]+iOffset)>>iShift)  ((piCur[n+ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2473 iTemp = ((piOrg[n+ 4]+iOffset)>>iShift)  ((piCur[n+ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2474 iTemp = ((piOrg[n+ 5]+iOffset)>>iShift)  ((piCur[n+ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2475 iTemp = ((piOrg[n+ 6]+iOffset)>>iShift)  ((piCur[n+ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2476 iTemp = ((piOrg[n+ 7]+iOffset)>>iShift)  ((piCur[n+ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2477 iTemp = ((piOrg[n+ 8]+iOffset)>>iShift)  ((piCur[n+ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2478 iTemp = ((piOrg[n+ 9]+iOffset)>>iShift)  ((piCur[n+ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2479 iTemp = ((piOrg[n+10]+iOffset)>>iShift)  ((piCur[n+10]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2480 iTemp = ((piOrg[n+11]+iOffset)>>iShift)  ((piCur[n+11]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2481 iTemp = ((piOrg[n+12]+iOffset)>>iShift)  ((piCur[n+12]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2482 iTemp = ((piOrg[n+13]+iOffset)>>iShift)  ((piCur[n+13]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2483 iTemp = ((piOrg[n+14]+iOffset)>>iShift)  ((piCur[n+14]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2484 iTemp = ((piOrg[n+15]+iOffset)>>iShift)  ((piCur[n+15]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2485 2486 } 2487 piOrg += iStrideOrg; 2488 piCur += iStrideCur; 2489 } 2490 2491 return ( uiSum ); 2492 } 2493 2494 UInt TComRdCost::xGetSSE32( DistParam* pcDtParam ) 2495 { 2496 Pel* piOrg = pcDtParam>pOrg; 2497 Pel* piCur = pcDtParam>pCur; 2498 Int iRows = pcDtParam>iRows; 2499 Int iStrideOrg = pcDtParam>iStrideOrg; 2500 Int iStrideCur = pcDtParam>iStrideCur; 2501 2502 UInt uiSum = 0; 2503 Int iShift = g_uiBitIncrement; 2504 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2505 Int iTemp; 2506 2507 for( ; iRows != 0; iRows ) 2508 { 2509 2510 iTemp = ((piOrg[ 0]+iOffset)>>iShift)  ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2511 iTemp = ((piOrg[ 1]+iOffset)>>iShift)  ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2512 iTemp = ((piOrg[ 2]+iOffset)>>iShift)  ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2513 iTemp = ((piOrg[ 3]+iOffset)>>iShift)  ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2514 iTemp = ((piOrg[ 4]+iOffset)>>iShift)  ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2515 iTemp = ((piOrg[ 5]+iOffset)>>iShift)  ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2516 iTemp = ((piOrg[ 6]+iOffset)>>iShift)  ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2517 iTemp = ((piOrg[ 7]+iOffset)>>iShift)  ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2518 iTemp = ((piOrg[ 8]+iOffset)>>iShift)  ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2519 iTemp = ((piOrg[ 9]+iOffset)>>iShift)  ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2520 iTemp = ((piOrg[10]+iOffset)>>iShift)  ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2521 iTemp = ((piOrg[11]+iOffset)>>iShift)  ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2522 iTemp = ((piOrg[12]+iOffset)>>iShift)  ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2523 iTemp = ((piOrg[13]+iOffset)>>iShift)  ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2524 iTemp = ((piOrg[14]+iOffset)>>iShift)  ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2525 iTemp = ((piOrg[15]+iOffset)>>iShift)  ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2526 iTemp = ((piOrg[16]+iOffset)>>iShift)  ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2527 iTemp = ((piOrg[17]+iOffset)>>iShift)  ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2528 iTemp = ((piOrg[18]+iOffset)>>iShift)  ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2529 iTemp = ((piOrg[19]+iOffset)>>iShift)  ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2530 iTemp = ((piOrg[20]+iOffset)>>iShift)  ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2531 iTemp = ((piOrg[21]+iOffset)>>iShift)  ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2532 iTemp = ((piOrg[22]+iOffset)>>iShift)  ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2533 iTemp = ((piOrg[23]+iOffset)>>iShift)  ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2534 iTemp = ((piOrg[24]+iOffset)>>iShift)  ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2535 iTemp = ((piOrg[25]+iOffset)>>iShift)  ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2536 iTemp = ((piOrg[26]+iOffset)>>iShift)  ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2537 iTemp = ((piOrg[27]+iOffset)>>iShift)  ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2538 iTemp = ((piOrg[28]+iOffset)>>iShift)  ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2539 iTemp = ((piOrg[29]+iOffset)>>iShift)  ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2540 iTemp = ((piOrg[30]+iOffset)>>iShift)  ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2541 iTemp = ((piOrg[31]+iOffset)>>iShift)  ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2542 2543 piOrg += iStrideOrg; 2544 piCur += iStrideCur; 2545 } 2546 2547 return ( uiSum ); 2548 } 2549 2550 UInt TComRdCost::xGetSSE64( DistParam* pcDtParam ) 2551 { 2552 Pel* piOrg = pcDtParam>pOrg; 2553 Pel* piCur = pcDtParam>pCur; 2554 Int iRows = pcDtParam>iRows; 2555 Int iStrideOrg = pcDtParam>iStrideOrg; 2556 Int iStrideCur = pcDtParam>iStrideCur; 2557 2558 UInt uiSum = 0; 2559 Int iShift = g_uiBitIncrement; 2560 Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement1)):0; 2561 Int iTemp; 2562 2563 for( ; iRows != 0; iRows ) 2564 { 2565 iTemp = ((piOrg[ 0]+iOffset)>>iShift)  ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2566 iTemp = ((piOrg[ 1]+iOffset)>>iShift)  ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2567 iTemp = ((piOrg[ 2]+iOffset)>>iShift)  ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2568 iTemp = ((piOrg[ 3]+iOffset)>>iShift)  ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2569 iTemp = ((piOrg[ 4]+iOffset)>>iShift)  ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2570 iTemp = ((piOrg[ 5]+iOffset)>>iShift)  ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2571 iTemp = ((piOrg[ 6]+iOffset)>>iShift)  ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2572 iTemp = ((piOrg[ 7]+iOffset)>>iShift)  ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2573 iTemp = ((piOrg[ 8]+iOffset)>>iShift)  ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2574 iTemp = ((piOrg[ 9]+iOffset)>>iShift)  ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2575 iTemp = ((piOrg[10]+iOffset)>>iShift)  ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2576 iTemp = ((piOrg[11]+iOffset)>>iShift)  ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2577 iTemp = ((piOrg[12]+iOffset)>>iShift)  ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2578 iTemp = ((piOrg[13]+iOffset)>>iShift)  ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2579 iTemp = ((piOrg[14]+iOffset)>>iShift)  ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2580 iTemp = ((piOrg[15]+iOffset)>>iShift)  ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2581 iTemp = ((piOrg[16]+iOffset)>>iShift)  ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2582 iTemp = ((piOrg[17]+iOffset)>>iShift)  ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2583 iTemp = ((piOrg[18]+iOffset)>>iShift)  ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2584 iTemp = ((piOrg[19]+iOffset)>>iShift)  ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2585 iTemp = ((piOrg[20]+iOffset)>>iShift)  ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2586 iTemp = ((piOrg[21]+iOffset)>>iShift)  ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2587 iTemp = ((piOrg[22]+iOffset)>>iShift)  ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2588 iTemp = ((piOrg[23]+iOffset)>>iShift)  ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2589 iTemp = ((piOrg[24]+iOffset)>>iShift)  ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2590 iTemp = ((piOrg[25]+iOffset)>>iShift)  ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2591 iTemp = ((piOrg[26]+iOffset)>>iShift)  ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2592 iTemp = ((piOrg[27]+iOffset)>>iShift)  ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2593 iTemp = ((piOrg[28]+iOffset)>>iShift)  ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2594 iTemp = ((piOrg[29]+iOffset)>>iShift)  ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2595 iTemp = ((piOrg[30]+iOffset)>>iShift)  ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2596 iTemp = ((piOrg[31]+iOffset)>>iShift)  ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2597 iTemp = ((piOrg[32]+iOffset)>>iShift)  ((piCur[32]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2598 iTemp = ((piOrg[33]+iOffset)>>iShift)  ((piCur[33]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2599 iTemp = ((piOrg[34]+iOffset)>>iShift)  ((piCur[34]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2600 iTemp = ((piOrg[35]+iOffset)>>iShift)  ((piCur[35]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2601 iTemp = ((piOrg[36]+iOffset)>>iShift)  ((piCur[36]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2602 iTemp = ((piOrg[37]+iOffset)>>iShift)  ((piCur[37]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2603 iTemp = ((piOrg[38]+iOffset)>>iShift)  ((piCur[38]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2604 iTemp = ((piOrg[39]+iOffset)>>iShift)  ((piCur[39]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2605 iTemp = ((piOrg[40]+iOffset)>>iShift)  ((piCur[40]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2606 iTemp = ((piOrg[41]+iOffset)>>iShift)  ((piCur[41]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2607 iTemp = ((piOrg[42]+iOffset)>>iShift)  ((piCur[42]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2608 iTemp = ((piOrg[43]+iOffset)>>iShift)  ((piCur[43]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2609 iTemp = ((piOrg[44]+iOffset)>>iShift)  ((piCur[44]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2610 iTemp = ((piOrg[45]+iOffset)>>iShift)  ((piCur[45]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2611 iTemp = ((piOrg[46]+iOffset)>>iShift)  ((piCur[46]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2612 iTemp = ((piOrg[47]+iOffset)>>iShift)  ((piCur[47]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2613 iTemp = ((piOrg[48]+iOffset)>>iShift)  ((piCur[48]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2614 iTemp = ((piOrg[49]+iOffset)>>iShift)  ((piCur[49]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2615 iTemp = ((piOrg[50]+iOffset)>>iShift)  ((piCur[50]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2616 iTemp = ((piOrg[51]+iOffset)>>iShift)  ((piCur[51]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2617 iTemp = ((piOrg[52]+iOffset)>>iShift)  ((piCur[52]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2618 iTemp = ((piOrg[53]+iOffset)>>iShift)  ((piCur[53]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2619 iTemp = ((piOrg[54]+iOffset)>>iShift)  ((piCur[54]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2620 iTemp = ((piOrg[55]+iOffset)>>iShift)  ((piCur[55]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2621 iTemp = ((piOrg[56]+iOffset)>>iShift)  ((piCur[56]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2622 iTemp = ((piOrg[57]+iOffset)>>iShift)  ((piCur[57]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2623 iTemp = ((piOrg[58]+iOffset)>>iShift)  ((piCur[58]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2624 iTemp = ((piOrg[59]+iOffset)>>iShift)  ((piCur[59]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2625 iTemp = ((piOrg[60]+iOffset)>>iShift)  ((piCur[60]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2626 iTemp = ((piOrg[61]+iOffset)>>iShift)  ((piCur[61]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2627 iTemp = ((piOrg[62]+iOffset)>>iShift)  ((piCur[62]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2628 iTemp = ((piOrg[63]+iOffset)>>iShift)  ((piCur[63]+iOffset)>>iShift); uiSum += iTemp * iTemp; 2629 2630 piOrg += iStrideOrg; 2631 piCur += iStrideCur; 2632 } 2633 2634 return ( uiSum ); 2635 } 2636 #else 2637 UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) 2638 { 2639 if ( pcDtParam>bApplyWeight ) 2640 { 2641 return xGetSSEw( pcDtParam ); 2642 } 2643 Pel* piOrg = pcDtParam>pOrg; 2644 Pel* piCur = pcDtParam>pCur; 2645 Int iRows = pcDtParam>iRows; 2646 Int iCols = pcDtParam>iCols; 2647 Int iStrideOrg = pcDtParam>iStrideOrg; 2648 Int iStrideCur = pcDtParam>iStrideCur; 2649 2650 UInt uiSum = 0; 2651 UInt uiShift = g_uiBitIncrement<<1; 2652 2653 Int iTemp; 2654 2655 #if HHI_INTERVIEW_SKIP 2656 if( pcDtParam>pUsed ) 2657 { 2658 Pel* piUsed = pcDtParam>pUsed; 2659 Int iStrideUsed = pcDtParam>iStrideUsed; 2660 for( ; iRows != 0; iRows ) 2661 { 2662 for (Int n = 0; n < iCols; n++ ) 2663 { 2664 if( piUsed[n] ) 2665 { 2666 iTemp = piOrg[n ]  piCur[n ]; 2667 uiSum += ( iTemp * iTemp ) >> uiShift; 2668 } 2669 } 2670 piOrg += iStrideOrg; 2671 piCur += iStrideCur; 2672 piUsed += iStrideUsed; 2673 } 2674 } 2675 else 2676 { 2677 #endif 2678 for( ; iRows != 0; iRows ) 2679 { 2680 for (Int n = 0; n < iCols; n++ ) 2681 { 2682 iTemp = piOrg[n ]  piCur[n ]; 2683 uiSum += ( iTemp * iTemp ) >> uiShift; 2684 } 2685 piOrg += iStrideOrg; 2686 piCur += iStrideCur; 2687 } 2688 #if HHI_INTERVIEW_SKIP 2689 } 2690 #endif 2691 2692 return ( uiSum ); 2693 } 2694 2695 UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) 2696 { 2697 if ( pcDtParam>bApplyWeight ) 2698 { 2699 assert( pcDtParam>iCols == 4 ); 2700 return xGetSSEw( pcDtParam ); 2701 } 2702 Pel* piOrg = pcDtParam>pOrg; 2703 Pel* piCur = pcDtParam>pCur; 2704 Int iRows = pcDtParam>iRows; 2705 Int iStrideOrg = pcDtParam>iStrideOrg; 2706 Int iStrideCur = pcDtParam>iStrideCur; 2707 2708 UInt uiSum = 0; 2709 UInt uiShift = g_uiBitIncrement<<1; 2710 2711 Int iTemp; 2712 2713 #if HHI_INTERVIEW_SKIP 2714 if( pcDtParam>pUsed ) 2715 { 2716 Pel* piUsed = pcDtParam>pUsed; 2717 Int iStrideUsed = pcDtParam>iStrideUsed; 2718 for( ; iRows != 0; iRows ) 2719 { 2720 if( piUsed[0] ) { iTemp = piOrg[0]  piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; } 2721 if( piUsed[1] ) { iTemp = piOrg[1]  piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; } 2722 if( piUsed[2] ) { iTemp = piOrg[2]  piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; } 2723 if( piUsed[3] ) { iTemp = piOrg[3]  piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; } 2724 2725 piOrg += iStrideOrg; 2726 piCur += iStrideCur; 2727 piUsed += iStrideUsed; 2728 } 2729 } 2730 else 2731 { 2732 #endif 2450 2733 2451 for( ; iRows != 0; iRows ) 2734 2452 { … … 2742 2460 piCur += iStrideCur; 2743 2461 } 2744 #if HHI_INTERVIEW_SKIP2745 }2746 #endif2747 2462 2748 2463 return ( uiSum ); … … 2763 2478 2764 2479 UInt uiSum = 0; 2765 UInt uiShift = g_uiBitIncrement<<1;2480 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2766 2481 2767 2482 Int iTemp; 2768 2483 2769 #if HHI_INTERVIEW_SKIP2770 if( pcDtParam>pUsed )2771 {2772 Pel* piUsed = pcDtParam>pUsed;2773 Int iStrideUsed = pcDtParam>iStrideUsed;2774 for( ; iRows != 0; iRows )2775 {2776 if( piUsed[0] ) { iTemp = piOrg[0]  piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; }2777 if( piUsed[1] ) { iTemp = piOrg[1]  piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; }2778 if( piUsed[2] ) { iTemp = piOrg[2]  piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; }2779 if( piUsed[3] ) { iTemp = piOrg[3]  piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; }2780 if( piUsed[4] ) { iTemp = piOrg[4]  piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; }2781 if( piUsed[5] ) { iTemp = piOrg[5]  piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; }2782 if( piUsed[6] ) { iTemp = piOrg[6]  piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; }2783 if( piUsed[7] ) { iTemp = piOrg[7]  piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; }2784 2785 piOrg += iStrideOrg;2786 piCur += iStrideCur;2787 piUsed += iStrideUsed;2788 }2789 }2790 else2791 {2792 #endif2793 2484 for( ; iRows != 0; iRows ) 2794 2485 { … … 2805 2496 piCur += iStrideCur; 2806 2497 } 2807 #if HHI_INTERVIEW_SKIP2808 }2809 #endif2810 2498 2811 2499 return ( uiSum ); … … 2826 2514 2827 2515 UInt uiSum = 0; 2828 UInt uiShift = g_uiBitIncrement<<1;2516 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2829 2517 2830 2518 Int iTemp; 2831 2519 2832 #if HHI_INTERVIEW_SKIP2833 if( pcDtParam>pUsed )2834 {2835 Pel* piUsed = pcDtParam>pUsed;2836 Int iStrideUsed = pcDtParam>iStrideUsed;2837 for( ; iRows != 0; iRows )2838 {2839 if( piUsed[ 0] ) { iTemp = piOrg[ 0]  piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; }2840 if( piUsed[ 1] ) { iTemp = piOrg[ 1]  piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; }2841 if( piUsed[ 2] ) { iTemp = piOrg[ 2]  piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; }2842 if( piUsed[ 3] ) { iTemp = piOrg[ 3]  piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; }2843 if( piUsed[ 4] ) { iTemp = piOrg[ 4]  piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; }2844 if( piUsed[ 5] ) { iTemp = piOrg[ 5]  piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; }2845 if( piUsed[ 6] ) { iTemp = piOrg[ 6]  piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; }2846 if( piUsed[ 7] ) { iTemp = piOrg[ 7]  piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; }2847 if( piUsed[ 8] ) { iTemp = piOrg[ 8]  piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; }2848 if( piUsed[ 9] ) { iTemp = piOrg[ 9]  piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; }2849 if( piUsed[10] ) { iTemp = piOrg[10]  piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; }2850 if( piUsed[11] ) { iTemp = piOrg[11]  piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; }2851 if( piUsed[12] ) { iTemp = piOrg[12]  piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; }2852 if( piUsed[13] ) { iTemp = piOrg[13]  piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; }2853 if( piUsed[14] ) { iTemp = piOrg[14]  piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; }2854 if( piUsed[15] ) { iTemp = piOrg[15]  piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; }2855 2856 piOrg += iStrideOrg;2857 piCur += iStrideCur;2858 piUsed += iStrideUsed;2859 }2860 }2861 else2862 {2863 #endif2864 2520 for( ; iRows != 0; iRows ) 2865 2521 { … … 2885 2541 piCur += iStrideCur; 2886 2542 } 2887 #if HHI_INTERVIEW_SKIP2888 }2889 #endif2890 2543 2891 2544 return ( uiSum ); … … 2906 2559 2907 2560 UInt uiSum = 0; 2908 UInt uiShift = g_uiBitIncrement<<1;2561 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2909 2562 Int iTemp; 2910 2563 2911 #if HHI_INTERVIEW_SKIP2912 if( pcDtParam>pUsed )2913 {2914 Pel* piUsed = pcDtParam>pUsed;2915 Int iStrideUsed = pcDtParam>iStrideUsed;2916 for( ; iRows != 0; iRows )2917 {2918 for (Int n = 0; n < iCols; n+=16 )2919 {2920 if( piUsed[n+ 0] ) { iTemp = piOrg[n+ 0]  piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; }2921 if( piUsed[n+ 1] ) { iTemp = piOrg[n+ 1]  piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; }2922 if( piUsed[n+ 2] ) { iTemp = piOrg[n+ 2]  piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; }2923 if( piUsed[n+ 3] ) { iTemp = piOrg[n+ 3]  piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; }2924 if( piUsed[n+ 4] ) { iTemp = piOrg[n+ 4]  piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; }2925 if( piUsed[n+ 5] ) { iTemp = piOrg[n+ 5]  piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; }2926 if( piUsed[n+ 6] ) { iTemp = piOrg[n+ 6]  piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; }2927 if( piUsed[n+ 7] ) { iTemp = piOrg[n+ 7]  piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; }2928 if( piUsed[n+ 8] ) { iTemp = piOrg[n+ 8]  piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; }2929 if( piUsed[n+ 9] ) { iTemp = piOrg[n+ 9]  piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; }2930 if( piUsed[n+10] ) { iTemp = piOrg[n+10]  piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; }2931 if( piUsed[n+11] ) { iTemp = piOrg[n+11]  piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; }2932 if( piUsed[n+12] ) { iTemp = piOrg[n+12]  piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; }2933 if( piUsed[n+13] ) { iTemp = piOrg[n+13]  piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; }2934 if( piUsed[n+14] ) { iTemp = piOrg[n+14]  piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; }2935 if( piUsed[n+15] ) { iTemp = piOrg[n+15]  piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; }2936 }2937 piOrg += iStrideOrg;2938 piCur += iStrideCur;2939 piUsed += iStrideUsed;2940 }2941 }2942 else2943 {2944 #endif2945 2564 for( ; iRows != 0; iRows ) 2946 2565 { … … 2969 2588 piCur += iStrideCur; 2970 2589 } 2971 #if HHI_INTERVIEW_SKIP2972 }2973 #endif2974 2590 2975 2591 return ( uiSum ); … … 2990 2606 2991 2607 UInt uiSum = 0; 2992 UInt uiShift = g_uiBitIncrement<<1;2608 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 2993 2609 Int iTemp; 2994 2610 2995 #if HHI_INTERVIEW_SKIP2996 if( pcDtParam>pUsed )2997 {2998 Pel* piUsed = pcDtParam>pUsed;2999 Int iStrideUsed = pcDtParam>iStrideUsed;3000 for( ; iRows != 0; iRows )3001 {3002 if( piUsed[ 0] ) { iTemp = piOrg[ 0]  piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; }3003 if( piUsed[ 1] ) { iTemp = piOrg[ 1]  piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; }3004 if( piUsed[ 2] ) { iTemp = piOrg[ 2]  piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; }3005 if( piUsed[ 3] ) { iTemp = piOrg[ 3]  piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; }3006 if( piUsed[ 4] ) { iTemp = piOrg[ 4]  piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; }3007 if( piUsed[ 5] ) { iTemp = piOrg[ 5]  piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; }3008 if( piUsed[ 6] ) { iTemp = piOrg[ 6]  piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; }3009 if( piUsed[ 7] ) { iTemp = piOrg[ 7]  piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; }3010 if( piUsed[ 8] ) { iTemp = piOrg[ 8]  piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; }3011 if( piUsed[ 9] ) { iTemp = piOrg[ 9]  piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; }3012 if( piUsed[10] ) { iTemp = piOrg[10]  piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; }3013 if( piUsed[11] ) { iTemp = piOrg[11]  piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; }3014 if( piUsed[12] ) { iTemp = piOrg[12]  piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; }3015 if( piUsed[13] ) { iTemp = piOrg[13]  piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; }3016 if( piUsed[14] ) { iTemp = piOrg[14]  piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; }3017 if( piUsed[15] ) { iTemp = piOrg[15]  piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; }3018 if( piUsed[16] ) { iTemp = piOrg[16]  piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; }3019 if( piUsed[17] ) { iTemp = piOrg[17]  piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; }3020 if( piUsed[18] ) { iTemp = piOrg[18]  piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; }3021 if( piUsed[19] ) { iTemp = piOrg[19]  piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; }3022 if( piUsed[20] ) { iTemp = piOrg[20]  piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; }3023 if( piUsed[21] ) { iTemp = piOrg[21]  piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; }3024 if( piUsed[22] ) { iTemp = piOrg[22]  piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; }3025 if( piUsed[23] ) { iTemp = piOrg[23]  piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; }3026 if( piUsed[24] ) { iTemp = piOrg[24]  piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; }3027 if( piUsed[25] ) { iTemp = piOrg[25]  piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; }3028 if( piUsed[26] ) { iTemp = piOrg[26]  piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; }3029 if( piUsed[27] ) { iTemp = piOrg[27]  piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; }3030 if( piUsed[28] ) { iTemp = piOrg[28]  piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; }3031 if( piUsed[29] ) { iTemp = piOrg[29]  piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; }3032 if( piUsed[30] ) { iTemp = piOrg[30]  piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; }3033 if( piUsed[31] ) { iTemp = piOrg[31]  piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; }3034 3035 piOrg += iStrideOrg;3036 piCur += iStrideCur;3037 piUsed += iStrideUsed;3038 }3039 }3040 else3041 {3042 #endif3043 2611 for( ; iRows != 0; iRows ) 3044 2612 { … … 3080 2648 piCur += iStrideCur; 3081 2649 } 3082 #if HHI_INTERVIEW_SKIP3083 }3084 #endif3085 2650 3086 2651 return ( uiSum ); … … 3101 2666 3102 2667 UInt uiSum = 0; 3103 UInt uiShift = g_uiBitIncrement<<1;2668 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam>bitDepth8) << 1); 3104 2669 Int iTemp; 3105 2670 3106 #if HHI_INTERVIEW_SKIP3107 if( pcDtParam>pUsed )3108 {3109 Pel* piUsed = pcDtParam>pUsed;3110 Int iStrideUsed = pcDtParam>iStrideUsed;3111 for( ; iRows != 0; iRows )3112 {3113 if( piUsed[ 0] ) { iTemp = piOrg[ 0]  piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; }3114 if( piUsed[ 1] ) { iTemp = piOrg[ 1]  piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; }3115 if( piUsed[ 2] ) { iTemp = piOrg[ 2]  piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; }3116 if( piUsed[ 3] ) { iTemp = piOrg[ 3]  piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; }3117 if( piUsed[ 4] ) { iTemp = piOrg[ 4]  piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; }3118 if( piUsed[ 5] ) { iTemp = piOrg[ 5]  piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; }3119 if( piUsed[ 6] ) { iTemp = piOrg[ 6]  piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; }3120 if( piUsed[ 7] ) { iTemp = piOrg[ 7]  piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; }3121 if( piUsed[ 8] ) { iTemp = piOrg[ 8]  piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; }3122 if( piUsed[ 9] ) { iTemp = piOrg[ 9]  piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; }3123 if( piUsed[10] ) { iTemp = piOrg[10]  piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; }3124 if( piUsed[11] ) { iTemp = piOrg[11]  piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; }3125 if( piUsed[12] ) { iTemp = piOrg[12]  piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; }3126 if( piUsed[13] ) { iTemp = piOrg[13]  piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; }3127 if( piUsed[14] ) { iTemp = piOrg[14]  piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; }3128 if( piUsed[15] ) { iTemp = piOrg[15]  piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; }3129 if( piUsed[16] ) { iTemp = piOrg[16]  piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; }3130 if( piUsed[17] ) { iTemp = piOrg[17]  piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; }3131 if( piUsed[18] ) { iTemp = piOrg[18]  piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; }3132 if( piUsed[19] ) { iTemp = piOrg[19]  piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; }3133 if( piUsed[20] ) { iTemp = piOrg[20]  piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; }3134 if( piUsed[21] ) { iTemp = piOrg[21]  piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; }3135 if( piUsed[22] ) { iTemp = piOrg[22]  piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; }3136 if( piUsed[23] ) { iTemp = piOrg[23]  piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; }3137 if( piUsed[24] ) { iTemp = piOrg[24]  piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; }3138 if( piUsed[25] ) { iTemp = piOrg[25]  piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; }3139 if( piUsed[26] ) { iTemp = piOrg[26]  piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; }3140 if( piUsed[27] ) { iTemp = piOrg[27]  piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; }3141 if( piUsed[28] ) { iTemp = piOrg[28]  piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; }3142 if( piUsed[29] ) { iTemp = piOrg[29]  piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; }3143 if( piUsed[30] ) { iTemp = piOrg[30]  piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; }3144 if( piUsed[31] ) { iTemp = piOrg[31]  piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; }3145 if( piUsed[32] ) { iTemp = piOrg[32]  piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; }3146 if( piUsed[33] ) { iTemp = piOrg[33]  piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; }3147 if( piUsed[34] ) { iTemp = piOrg[34]  piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; }3148 if( piUsed[35] ) { iTemp = piOrg[35]  piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; }3149 if( piUsed[36] ) { iTemp = piOrg[36]  piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; }3150 if( piUsed[37] ) { iTemp = piOrg[37]  piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; }3151 if( piUsed[38] ) { iTemp = piOrg[38]  piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; }3152 if( piUsed[39] ) { iTemp = piOrg[39]  piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; }3153 if( piUsed[40] ) { iTemp = piOrg[40]  piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; }3154 if( piUsed[41] ) { iTemp = piOrg[41]  piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; }3155 if( piUsed[42] ) { iTemp = piOrg[42]  piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; }3156 if( piUsed[43] ) { iTemp = piOrg[43]  piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; }3157 if( piUsed[44] ) { iTemp = piOrg[44]  piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; }3158 if( piUsed[45] ) { iTemp = piOrg[45]  piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; }3159 if( piUsed[46] ) { iTemp = piOrg[46]  piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; }3160 if( piUsed[47] ) { iTemp = piOrg[47]  piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; }3161 if( piUsed[48] ) { iTemp = piOrg[48]  piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; }3162 if( piUsed[49] ) { iTemp = piOrg[49]  piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; }3163 if( piUsed[50] ) { iTemp = piOrg[50]  piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; }3164 if( piUsed[51] ) { iTemp = piOrg[51]  piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; }3165 if( piUsed[52] ) { iTemp = piOrg[52]  piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; }3166 if( piUsed[53] ) { iTemp = piOrg[53]  piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; }3167 if( piUsed[54] ) { iTemp = piOrg[54]  piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; }3168 if( piUsed[55] ) { iTemp = piOrg[55]  piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; }3169 if( piUsed[56] ) { iTemp = piOrg[56]  piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; }3170 if( piUsed[57] ) { iTemp = piOrg[57]  piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; }3171 if( piUsed[58] ) { iTemp = piOrg[58]  piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; }3172 if( piUsed[59] ) { iTemp = piOrg[59]  piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; }3173 if( piUsed[60] ) { iTemp = piOrg[60]  piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; }3174 if( piUsed[61] ) { iTemp = piOrg[61]  piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; }3175 if( piUsed[62] ) { iTemp = piOrg[62]  piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; }3176 if( piUsed[63] ) { iTemp = piOrg[63]  piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; }3177 3178 piOrg += iStrideOrg;3179 piCur += iStrideCur;3180 piUsed += iStrideUsed;3181 }3182 }3183 else3184 {3185 #endif3186 2671 for( ; iRows != 0; iRows ) 3187 2672 { … … 3254 2739 piCur += iStrideCur; 3255 2740 } 3256 #if HHI_INTERVIEW_SKIP3257 }3258 #endif3259 2741 3260 2742 return ( uiSum ); 3261 2743 } 3262 #endif 3263 3264 3265 #if SAIT_VSO_EST_A0033 2744 #if H_3D_VSO 2745 //SAIT_VSO_EST_A0033 3266 2746 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ) 3267 2747 { … … 3269 2749 Int iTemp; 3270 2750 3271 dD = ( (Double) ( dDM >> g_uiBitIncrement ) ) * m_dDisparityCoeff; 3272 3273 iTemp = (Int) ROUND( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ]  (Int) pVirRec[ x1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ]  (Int) pVirRec[ x+1+y*iVirStride ] ) ) ); 2751 dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY  8 ) ) ) * m_dDisparityCoeff; 2752 2753 Double dTemp = ( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ]  (Int) pVirRec[ x1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ]  (Int) pVirRec[ x+1+y*iVirStride ] ) ) ); 2754 iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp)  0.5) : (Int)((dTemp) + 0.5)); 3274 2755 3275 2756 return (UInt) ( (iTemp*iTemp)>>1 ); … … 3289 2770 3290 2771 UInt uiSum = 0; 3291 UInt uiShift = g_uiBitIncrement<<1;2772 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3292 2773 3293 2774 Int dDM; … … 3319 2800 3320 2801 UInt uiSum = 0; 3321 UInt uiShift = g_uiBitIncrement<<1;2802 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3322 2803 3323 2804 Int dDM; … … 3349 2830 3350 2831 UInt uiSum = 0; 3351 UInt uiShift = g_uiBitIncrement<<1;2832 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3352 2833 3353 2834 Int dDM; … … 3379 2860 3380 2861 UInt uiSum = 0; 3381 UInt uiShift = g_uiBitIncrement<<1;2862 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3382 2863 3383 2864 Int dDM; … … 3410 2891 3411 2892 UInt uiSum = 0; 3412 UInt uiShift = g_uiBitIncrement<<1;2893 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3413 2894 3414 2895 Int dDM; … … 3443 2924 3444 2925 UInt uiSum = 0; 3445 UInt uiShift = g_uiBitIncrement<<1;2926 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3446 2927 3447 2928 Int dDM; … … 3473 2954 3474 2955 UInt uiSum = 0; 3475 UInt uiShift = g_uiBitIncrement<<1;2956 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8)<<1; 3476 2957 3477 2958 Int dDM; … … 3981 3462 } 3982 3463 3983 return ( uiSum >> g_uiBitIncrement);3464 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 3984 3465 } 3985 3466 … … 4017 3498 } 4018 3499 4019 return ( uiSum >> g_uiBitIncrement);3500 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 4020 3501 } 4021 3502 … … 4026 3507 return xGetHADsw( pcDtParam ); 4027 3508 } 4028 #if LGE_ILLUCOMP_B0045 4029 if(pcDtParam>bUseIC) 3509 #if H_3D_IC 3510 if( pcDtParam>bUseIC ) 3511 { 3512 return xGetHADsic( pcDtParam ); 3513 } 3514 #endif 3515 #if LGE_INTER_SDC_E0156 3516 if( pcDtParam>bUseSDCMRSAD ) 4030 3517 { 4031 3518 return xGetHADsic( pcDtParam ); … … 4039 3526 Int iStrideOrg = pcDtParam>iStrideOrg; 4040 3527 Int iStep = pcDtParam>iStep; 4041 3528 4042 3529 Int x, y; 4043 3530 4044 3531 UInt uiSum = 0; 4045 3532 4046 3533 #if NS_HAD 4047 3534 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) )  ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam>bUseNSHAD ) ) … … 4096 3583 Int iOffsetOrg = iStrideOrg<<2; 4097 3584 Int iOffsetCur = iStrideCur<<2; 4098 3585 4099 3586 for ( y=0; y<iRows; y+= 4 ) 4100 3587 { … … 4125 3612 assert(false); 4126 3613 } 4127 4128 return ( uiSum >> g_uiBitIncrement);4129 } 4130 4131 #if LGE_ILLUCOMP_B00453614 3615 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam>bitDepth8); 3616 } 3617 3618 #if H_3D_IC  LGE_INTER_SDC_E0156 4132 3619 UInt TComRdCost::xGetHADsic( DistParam* pcDtParam ) 4133 3620 { … … 4143 3630 Int iStrideOrg = pcDtParam>iStrideOrg; 4144 3631 Int iStep = pcDtParam>iStep; 4145 3632 4146 3633 Int x, y; 4147 3634 4148 3635 UInt uiSum = 0; 4149 3636 4150 3637 Int iOrigAvg = 0, iCurAvg = 0; 4151 3638 Int iDeltaC; … … 4230 3717 Int iOffsetOrg = iStrideOrg<<2; 4231 3718 Int iOffsetCur = iStrideCur<<2; 4232 3719 4233 3720 for ( y=0; y<iRows; y+= 4 ) 4234 3721 { … … 4259 3746 assert(false); 4260 3747 } 4261 3748 4262 3749 piOrg = pcDtParam>pOrg; 4263 3750 … … 4271 3758 } 4272 3759 4273 return ( uiSum >> g_uiBitIncrement);4274 } 4275 #endif 4276 4277 #if H HI_VSO3760 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam>bitDepth  8 ) ); 3761 } 3762 #endif 3763 3764 #if H_3D_VSO 4278 3765 Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) 4279 3766 { … … 4287 3774 { 4288 3775 AOT(bSAD); 4289 #if def LGE_VSO_EARLY_SKIP_A00933776 #if H_3D_VSO_EARLY_SKIP 4290 3777 RMDist iDist = m_pcRenModel>getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); 4291 3778 #else … … 4294 3781 4295 3782 RMDist iDistMin = (RMDist) RDO_DIST_MIN; 4296 #if HHI_VSO_DIST_INT4297 3783 iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0; 4298 #endif 4299 4300 iDist = Min( iDist, (RMDist) RDO_DIST_MAX); 4301 iDist = Max( iDist, iDistMin); 3784 3785 iDist = std::min( iDist, (RMDist) RDO_DIST_MAX); 3786 iDist = std::max( iDist, iDistMin); 4302 3787 return (Dist) iDist; 4303 3788 } 4304 3789 4305 3790 4306 Dist TComRdCost::getDist VS( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD, UInt uiPlane)3791 Dist TComRdCost::getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD ) 4307 3792 { 4308 3793 assert( m_bUseVSO ); … … 4313 3798 4314 3799 pcCU>getPosInPic( uiAbsPartIndex, iPosX, iPosY ); 4315 return (this>*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bSAD ); 3800 3801 Dist dist = (this>*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bHAD ); 3802 3803 if ( m_bUseWVSO ) 3804 { 3805 Int iDWeight = m_iDWeight * m_iDWeight; 3806 Int iVSOWeight = m_iVSOWeight * m_iVSOWeight; 3807 Dist distDepth; 3808 3809 if ( !bHAD ) 3810 { 3811 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 3812 } 3813 else 3814 { 3815 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 3816 } 3817 3818 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 3819 } 3820 return dist; 4316 3821 }; 4317 3822 … … 4361 3866 { 4362 3867 // Intra8x8, Intra4x4 Block only... 3868 #if SEQUENCE_LEVEL_LOSSLESS 3869 dRdCost = (Double)(uiBits); 3870 #else 4363 3871 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); 3872 #endif 4364 3873 } 4365 3874 else … … 4372 3881 else 4373 3882 { 3883 #if SEQUENCE_LEVEL_LOSSLESS 3884 dRdCost = (Double)(uiBits); 3885 #else 4374 3886 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); 4375 3887 dRdCost = (Double)(Dist)floor(dRdCost); 3888 #endif 4376 3889 } 4377 3890 } … … 4391 3904 } 4392 3905 4393 #if HHI_VSO_DIST_INT4394 3906 Void TComRdCost::setAllowNegDist( Bool bAllowNegDist ) 4395 3907 { … … 4398 3910 #endif 4399 3911 4400 #endif4401 3912 //! \}
Note: See TracChangeset for help on using the changeset viewer.