Changeset 466 in SHVCSoftware for branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRdCost.cpp
- Timestamp:
- 13 Nov 2013, 23:25:47 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRdCost.cpp
r313 r466 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 61 61 Double dRdCost = 0.0; 62 62 Double dLambda = 0.0; 63 63 64 64 switch ( eDFunc ) 65 65 { … … 80 80 break; 81 81 } 82 82 83 83 if (bFlag) 84 84 { … … 107 107 } 108 108 } 109 109 110 110 return dRdCost; 111 111 } … … 115 115 Double dRdCost = 0.0; 116 116 Double dLambda = 0.0; 117 117 118 118 switch ( eDFunc ) 119 119 { … … 134 134 break; 135 135 } 136 136 137 137 if (bFlag) 138 138 { … … 161 161 } 162 162 } 163 163 164 164 return dRdCost; 165 165 } … … 178 178 { 179 179 m_afpDistortFunc[0] = NULL; // for DF_DEFAULT 180 180 181 181 m_afpDistortFunc[1] = TComRdCost::xGetSSE; 182 182 m_afpDistortFunc[2] = TComRdCost::xGetSSE4; … … 186 186 m_afpDistortFunc[6] = TComRdCost::xGetSSE64; 187 187 m_afpDistortFunc[7] = TComRdCost::xGetSSE16N; 188 188 189 189 m_afpDistortFunc[8] = TComRdCost::xGetSAD; 190 190 m_afpDistortFunc[9] = TComRdCost::xGetSAD4; … … 194 194 m_afpDistortFunc[13] = TComRdCost::xGetSAD64; 195 195 m_afpDistortFunc[14] = TComRdCost::xGetSAD16N; 196 196 197 197 m_afpDistortFunc[15] = TComRdCost::xGetSAD; 198 198 m_afpDistortFunc[16] = TComRdCost::xGetSAD4; … … 202 202 m_afpDistortFunc[20] = TComRdCost::xGetSAD64; 203 203 m_afpDistortFunc[21] = TComRdCost::xGetSAD16N; 204 204 205 205 #if AMP_SAD 206 206 m_afpDistortFunc[43] = TComRdCost::xGetSAD12; … … 219 219 m_afpDistortFunc[27] = TComRdCost::xGetHADs; 220 220 m_afpDistortFunc[28] = TComRdCost::xGetHADs; 221 221 222 222 #if !FIX203 223 223 m_puiComponentCostOriginP = NULL; … … 239 239 iSubPelSearchLimit += 4; 240 240 iSubPelSearchLimit *= 8; 241 241 242 242 if( m_iSearchLimit != iSubPelSearchLimit ) 243 243 { 244 244 xUninit(); 245 245 246 246 m_iSearchLimit = iSubPelSearchLimit; 247 247 248 248 m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ]; 249 249 iSubPelSearchLimit *= 2; 250 250 251 251 m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit; 252 252 253 253 for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++) 254 254 { … … 272 272 UInt uiLength = 1; 273 273 UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); 274 274 275 275 assert ( uiTemp ); 276 276 277 277 while ( 1 != uiTemp ) 278 278 { … … 280 280 uiLength += 2; 281 281 } 282 282 283 283 return uiLength; 284 284 } … … 290 290 rcDistParam.iRows = uiBlkHeight; 291 291 rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 292 292 293 293 // initialize 294 294 rcDistParam.iSubShift = 0; … … 301 301 rcDistParam.pOrg = pcPatternKey->getROIY(); 302 302 rcDistParam.pCur = piRefY; 303 303 304 304 rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride(); 305 305 rcDistParam.iStrideCur = iRefStride; 306 306 307 307 // set Block Width / Height 308 308 rcDistParam.iCols = pcPatternKey->getROIYWidth(); 309 309 rcDistParam.iRows = pcPatternKey->getROIYHeight(); 310 310 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 311 311 312 312 #if AMP_SAD 313 313 if (rcDistParam.iCols == 12) … … 336 336 #endif 337 337 { 338 #if O0194_WEIGHTED_PREDICTION_CGS 339 // Bug fix: The correct bit depth has not been used for weighted cost calculation 340 rcDistParam.bitDepth = g_bitDepthY; 341 #endif 338 342 // set Original & Curr Pointer / Stride 339 343 rcDistParam.pOrg = pcPatternKey->getROIY(); 340 344 rcDistParam.pCur = piRefY; 341 345 342 346 rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride(); 343 347 rcDistParam.iStrideCur = iRefStride * iStep; 344 348 345 349 // set Step for interpolated buffer 346 350 rcDistParam.iStep = iStep; 347 351 348 352 // set Block Width / Height 349 353 rcDistParam.iCols = pcPatternKey->getROIYWidth(); … … 352 356 rcDistParam.bUseNSHAD = bUseNSHAD; 353 357 #endif 354 358 355 359 // set distortion function 356 360 if ( !bHADME ) … … 376 380 rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 377 381 } 378 382 379 383 // initialize 380 384 rcDistParam.iSubShift = 0; … … 407 411 UInt uiSum = 0; 408 412 Int x, y; 409 413 410 414 if ( ( (iWidth % 8) == 0 ) && ( (iHeight % 8) == 0 ) ) 411 415 { … … 444 448 } 445 449 } 446 450 447 451 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8); 448 452 … … 523 527 Int iStrideCur = pcDtParam->iStrideCur; 524 528 Int iStrideOrg = pcDtParam->iStrideOrg; 525 526 UInt uiSum = 0; 527 529 530 UInt uiSum = 0; 531 528 532 for( ; iRows != 0; iRows-- ) 529 533 { … … 535 539 piCur += iStrideCur; 536 540 } 537 541 538 542 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 539 543 } … … 541 545 UInt TComRdCost::xGetSAD4( DistParam* pcDtParam ) 542 546 { 543 if ( pcDtParam->bApplyWeight ) 547 if ( pcDtParam->bApplyWeight ) 544 548 { 545 549 return xGetSADw( pcDtParam ); … … 552 556 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 553 557 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 554 555 UInt uiSum = 0; 556 558 559 UInt uiSum = 0; 560 557 561 for( ; iRows != 0; iRows-=iSubStep ) 558 562 { … … 561 565 uiSum += abs( piOrg[2] - piCur[2] ); 562 566 uiSum += abs( piOrg[3] - piCur[3] ); 563 564 piOrg += iStrideOrg; 565 piCur += iStrideCur; 566 } 567 567 568 piOrg += iStrideOrg; 569 piCur += iStrideCur; 570 } 571 568 572 uiSum <<= iSubShift; 569 573 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 583 587 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 584 588 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 585 586 UInt uiSum = 0; 587 589 590 UInt uiSum = 0; 591 588 592 for( ; iRows != 0; iRows-=iSubStep ) 589 593 { … … 596 600 uiSum += abs( piOrg[6] - piCur[6] ); 597 601 uiSum += abs( piOrg[7] - piCur[7] ); 598 599 piOrg += iStrideOrg; 600 piCur += iStrideCur; 601 } 602 602 603 piOrg += iStrideOrg; 604 piCur += iStrideCur; 605 } 606 603 607 uiSum <<= iSubShift; 604 608 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 618 622 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 619 623 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 620 621 UInt uiSum = 0; 622 624 625 UInt uiSum = 0; 626 623 627 for( ; iRows != 0; iRows-=iSubStep ) 624 628 { … … 639 643 uiSum += abs( piOrg[14] - piCur[14] ); 640 644 uiSum += abs( piOrg[15] - piCur[15] ); 641 642 piOrg += iStrideOrg; 643 piCur += iStrideCur; 644 } 645 645 646 piOrg += iStrideOrg; 647 piCur += iStrideCur; 648 } 649 646 650 uiSum <<= iSubShift; 647 651 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 662 666 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 663 667 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 664 665 UInt uiSum = 0; 666 668 669 UInt uiSum = 0; 670 667 671 for( ; iRows != 0; iRows-=iSubStep ) 668 672 { … … 679 683 uiSum += abs( piOrg[10] - piCur[10] ); 680 684 uiSum += abs( piOrg[11] - piCur[11] ); 681 682 piOrg += iStrideOrg; 683 piCur += iStrideCur; 684 } 685 685 686 piOrg += iStrideOrg; 687 piCur += iStrideCur; 688 } 689 686 690 uiSum <<= iSubShift; 687 691 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 699 703 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 700 704 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 701 702 UInt uiSum = 0; 703 705 706 UInt uiSum = 0; 707 704 708 for( ; iRows != 0; iRows-=iSubStep ) 705 709 { … … 726 730 piCur += iStrideCur; 727 731 } 728 732 729 733 uiSum <<= iSubShift; 730 734 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 744 748 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 745 749 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 746 747 UInt uiSum = 0; 748 750 751 UInt uiSum = 0; 752 749 753 for( ; iRows != 0; iRows-=iSubStep ) 750 754 { … … 781 785 uiSum += abs( piOrg[30] - piCur[30] ); 782 786 uiSum += abs( piOrg[31] - piCur[31] ); 783 784 piOrg += iStrideOrg; 785 piCur += iStrideCur; 786 } 787 787 788 piOrg += iStrideOrg; 789 piCur += iStrideCur; 790 } 791 788 792 uiSum <<= iSubShift; 789 793 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 804 808 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 805 809 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 806 807 UInt uiSum = 0; 808 810 811 UInt uiSum = 0; 812 809 813 for( ; iRows != 0; iRows-=iSubStep ) 810 814 { … … 833 837 uiSum += abs( piOrg[22] - piCur[22] ); 834 838 uiSum += abs( piOrg[23] - piCur[23] ); 835 836 piOrg += iStrideOrg; 837 piCur += iStrideCur; 838 } 839 839 840 piOrg += iStrideOrg; 841 piCur += iStrideCur; 842 } 843 840 844 uiSum <<= iSubShift; 841 845 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 857 861 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 858 862 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 859 860 UInt uiSum = 0; 861 863 864 UInt uiSum = 0; 865 862 866 for( ; iRows != 0; iRows-=iSubStep ) 863 867 { … … 926 930 uiSum += abs( piOrg[62] - piCur[62] ); 927 931 uiSum += abs( piOrg[63] - piCur[63] ); 928 929 piOrg += iStrideOrg; 930 piCur += iStrideCur; 931 } 932 932 933 piOrg += iStrideOrg; 934 piCur += iStrideCur; 935 } 936 933 937 uiSum <<= iSubShift; 934 938 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 949 953 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 950 954 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 951 952 UInt uiSum = 0; 953 955 956 UInt uiSum = 0; 957 954 958 for( ; iRows != 0; iRows-=iSubStep ) 955 959 { … … 1002 1006 uiSum += abs( piOrg[46] - piCur[46] ); 1003 1007 uiSum += abs( piOrg[47] - piCur[47] ); 1004 1005 piOrg += iStrideOrg; 1006 piCur += iStrideCur; 1007 } 1008 1008 1009 piOrg += iStrideOrg; 1010 piCur += iStrideCur; 1011 } 1012 1009 1013 uiSum <<= iSubShift; 1010 1014 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); … … 1028 1032 Int iStrideOrg = pcDtParam->iStrideOrg; 1029 1033 Int iStrideCur = pcDtParam->iStrideCur; 1030 1034 1031 1035 UInt uiSum = 0; 1032 1036 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1033 1037 1034 1038 Int iTemp; 1035 1039 1036 1040 for( ; iRows != 0; iRows-- ) 1037 1041 { … … 1044 1048 piCur += iStrideCur; 1045 1049 } 1046 1050 1047 1051 return ( uiSum ); 1048 1052 } … … 1060 1064 Int iStrideOrg = pcDtParam->iStrideOrg; 1061 1065 Int iStrideCur = pcDtParam->iStrideCur; 1062 1066 1063 1067 UInt uiSum = 0; 1064 1068 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1065 1069 1066 1070 Int iTemp; 1067 1071 1068 1072 for( ; iRows != 0; iRows-- ) 1069 1073 { 1070 1074 1071 1075 iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; 1072 1076 iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; 1073 1077 iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; 1074 1078 iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; 1075 1076 piOrg += iStrideOrg; 1077 piCur += iStrideCur; 1078 } 1079 1079 1080 piOrg += iStrideOrg; 1081 piCur += iStrideCur; 1082 } 1083 1080 1084 return ( uiSum ); 1081 1085 } … … 1093 1097 Int iStrideOrg = pcDtParam->iStrideOrg; 1094 1098 Int iStrideCur = pcDtParam->iStrideCur; 1095 1099 1096 1100 UInt uiSum = 0; 1097 1101 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1098 1102 1099 1103 Int iTemp; 1100 1104 1101 1105 for( ; iRows != 0; iRows-- ) 1102 1106 { … … 1109 1113 iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; 1110 1114 iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; 1111 1112 piOrg += iStrideOrg; 1113 piCur += iStrideCur; 1114 } 1115 1115 1116 piOrg += iStrideOrg; 1117 piCur += iStrideCur; 1118 } 1119 1116 1120 return ( uiSum ); 1117 1121 } … … 1129 1133 Int iStrideOrg = pcDtParam->iStrideOrg; 1130 1134 Int iStrideCur = pcDtParam->iStrideCur; 1131 1135 1132 1136 UInt uiSum = 0; 1133 1137 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1134 1138 1135 1139 Int iTemp; 1136 1140 1137 1141 for( ; iRows != 0; iRows-- ) 1138 1142 { 1139 1143 1140 1144 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; 1141 1145 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; … … 1154 1158 iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; 1155 1159 iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; 1156 1157 piOrg += iStrideOrg; 1158 piCur += iStrideCur; 1159 } 1160 1160 1161 piOrg += iStrideOrg; 1162 piCur += iStrideCur; 1163 } 1164 1161 1165 return ( uiSum ); 1162 1166 } … … 1174 1178 Int iStrideOrg = pcDtParam->iStrideOrg; 1175 1179 Int iStrideCur = pcDtParam->iStrideCur; 1176 1180 1177 1181 UInt uiSum = 0; 1178 1182 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1179 1183 Int iTemp; 1180 1184 1181 1185 for( ; iRows != 0; iRows-- ) 1182 1186 { 1183 1187 for (Int n = 0; n < iCols; n+=16 ) 1184 1188 { 1185 1189 1186 1190 iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; 1187 1191 iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; … … 1200 1204 iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; 1201 1205 iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; 1202 1203 } 1204 piOrg += iStrideOrg; 1205 piCur += iStrideCur; 1206 } 1207 1206 1207 } 1208 piOrg += iStrideOrg; 1209 piCur += iStrideCur; 1210 } 1211 1208 1212 return ( uiSum ); 1209 1213 } … … 1221 1225 Int iStrideOrg = pcDtParam->iStrideOrg; 1222 1226 Int iStrideCur = pcDtParam->iStrideCur; 1223 1227 1224 1228 UInt uiSum = 0; 1225 1229 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1226 1230 Int iTemp; 1227 1231 1228 1232 for( ; iRows != 0; iRows-- ) 1229 1233 { 1230 1234 1231 1235 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; 1232 1236 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; … … 1261 1265 iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; 1262 1266 iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; 1263 1264 piOrg += iStrideOrg; 1265 piCur += iStrideCur; 1266 } 1267 1267 1268 piOrg += iStrideOrg; 1269 piCur += iStrideCur; 1270 } 1271 1268 1272 return ( uiSum ); 1269 1273 } … … 1281 1285 Int iStrideOrg = pcDtParam->iStrideOrg; 1282 1286 Int iStrideCur = pcDtParam->iStrideCur; 1283 1287 1284 1288 UInt uiSum = 0; 1285 1289 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1286 1290 Int iTemp; 1287 1291 1288 1292 for( ; iRows != 0; iRows-- ) 1289 1293 { … … 1352 1356 iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; 1353 1357 iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; 1354 1355 piOrg += iStrideOrg; 1356 piCur += iStrideCur; 1357 } 1358 1358 1359 piOrg += iStrideOrg; 1360 piCur += iStrideCur; 1361 } 1362 1359 1363 return ( uiSum ); 1360 1364 } … … 1376 1380 m[2] = diff[0] - diff[2]; 1377 1381 m[3] = diff[1] - diff[3]; 1378 1382 1379 1383 satd += abs(m[0] + m[1]); 1380 1384 satd += abs(m[0] - m[1]); 1381 1385 satd += abs(m[2] + m[3]); 1382 1386 satd += abs(m[2] - m[3]); 1383 1387 1384 1388 return satd; 1385 1389 } … … 1388 1392 { 1389 1393 Int k, satd = 0, diff[16], m[16], d[16]; 1390 1394 1391 1395 assert( iStep == 1 ); 1392 1396 for( k = 0; k < 16; k+=4 ) … … 1396 1400 diff[k+2] = piOrg[2] - piCur[2]; 1397 1401 diff[k+3] = piOrg[3] - piCur[3]; 1398 1399 piCur += iStrideCur; 1400 piOrg += iStrideOrg; 1401 } 1402 1402 1403 piCur += iStrideCur; 1404 piOrg += iStrideOrg; 1405 } 1406 1403 1407 /*===== hadamard transform =====*/ 1404 1408 m[ 0] = diff[ 0] + diff[12]; … … 1418 1422 m[14] = diff[ 2] - diff[14]; 1419 1423 m[15] = diff[ 3] - diff[15]; 1420 1424 1421 1425 d[ 0] = m[ 0] + m[ 4]; 1422 1426 d[ 1] = m[ 1] + m[ 5]; … … 1435 1439 d[14] = m[14] - m[10]; 1436 1440 d[15] = m[15] - m[11]; 1437 1441 1438 1442 m[ 0] = d[ 0] + d[ 3]; 1439 1443 m[ 1] = d[ 1] + d[ 2]; … … 1452 1456 m[14] = d[13] - d[14]; 1453 1457 m[15] = d[12] - d[15]; 1454 1458 1455 1459 d[ 0] = m[ 0] + m[ 1]; 1456 1460 d[ 1] = m[ 0] - m[ 1]; … … 1469 1473 d[14] = m[14] + m[15]; 1470 1474 d[15] = m[15] - m[14]; 1471 1475 1472 1476 for (k=0; k<16; ++k) 1473 1477 { … … 1475 1479 } 1476 1480 satd = ((satd+1)>>1); 1477 1481 1478 1482 return satd; 1479 1483 } … … 1494 1498 diff[k+6] = piOrg[6] - piCur[6]; 1495 1499 diff[k+7] = piOrg[7] - piCur[7]; 1496 1497 piCur += iStrideCur; 1498 piOrg += iStrideOrg; 1499 } 1500 1500 1501 piCur += iStrideCur; 1502 piOrg += iStrideOrg; 1503 } 1504 1501 1505 //horizontal 1502 1506 for (j=0; j < 8; j++) … … 1511 1515 m2[j][6] = diff[jj+2] - diff[jj+6]; 1512 1516 m2[j][7] = diff[jj+3] - diff[jj+7]; 1513 1517 1514 1518 m1[j][0] = m2[j][0] + m2[j][2]; 1515 1519 m1[j][1] = m2[j][1] + m2[j][3]; … … 1520 1524 m1[j][6] = m2[j][4] - m2[j][6]; 1521 1525 m1[j][7] = m2[j][5] - m2[j][7]; 1522 1526 1523 1527 m2[j][0] = m1[j][0] + m1[j][1]; 1524 1528 m2[j][1] = m1[j][0] - m1[j][1]; … … 1530 1534 m2[j][7] = m1[j][6] - m1[j][7]; 1531 1535 } 1532 1536 1533 1537 //vertical 1534 1538 for (i=0; i < 8; i++) … … 1542 1546 m3[6][i] = m2[2][i] - m2[6][i]; 1543 1547 m3[7][i] = m2[3][i] - m2[7][i]; 1544 1548 1545 1549 m1[0][i] = m3[0][i] + m3[2][i]; 1546 1550 m1[1][i] = m3[1][i] + m3[3][i]; … … 1551 1555 m1[6][i] = m3[4][i] - m3[6][i]; 1552 1556 m1[7][i] = m3[5][i] - m3[7][i]; 1553 1557 1554 1558 m2[0][i] = m1[0][i] + m1[1][i]; 1555 1559 m2[1][i] = m1[0][i] - m1[1][i]; … … 1561 1565 m2[7][i] = m1[6][i] - m1[7][i]; 1562 1566 } 1563 1567 1564 1568 for (i = 0; i < 8; i++) 1565 1569 { … … 1569 1573 } 1570 1574 } 1571 1575 1572 1576 sad=((sad+2)>>2); 1573 1577 1574 1578 return sad; 1575 1579 } … … 1681 1685 //vertical 1682 1686 for (i=0; i < 16; i++) 1683 { 1687 { 1684 1688 m2[0][i] = m1[0][i] + m1[2][i]; 1685 1689 m2[1][i] = m1[1][i] + m1[3][i]; … … 1838 1842 Int iOffsetOrg = iStrideOrg<<2; 1839 1843 Int iOffsetCur = iStrideCur<<2; 1840 1841 UInt uiSum = 0; 1842 1844 1845 UInt uiSum = 0; 1846 1843 1847 for ( y=0; y<iRows; y+= 4 ) 1844 1848 { … … 1847 1851 piCur += iOffsetCur; 1848 1852 } 1849 1853 1850 1854 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1851 1855 } … … 1864 1868 Int iStep = pcDtParam->iStep; 1865 1869 Int y; 1866 1867 UInt uiSum = 0; 1868 1870 1871 UInt uiSum = 0; 1872 1869 1873 if ( iRows == 4 ) 1870 1874 { … … 1883 1887 } 1884 1888 } 1885 1889 1886 1890 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1887 1891 } … … 1900 1904 Int iStrideOrg = pcDtParam->iStrideOrg; 1901 1905 Int iStep = pcDtParam->iStep; 1902 1906 1903 1907 Int x, y; 1904 1905 UInt uiSum = 0; 1906 1908 1909 UInt uiSum = 0; 1910 1907 1911 #if NS_HAD 1908 1912 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) … … 1924 1928 } 1925 1929 #if NS_HAD 1926 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 1930 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 1927 1931 { 1928 1932 Int iOffsetOrg = iStrideOrg<<2; … … 1938 1942 } 1939 1943 } 1940 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 1944 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 1941 1945 { 1942 1946 Int iOffsetOrg = iStrideOrg<<4; … … 1957 1961 Int iOffsetOrg = iStrideOrg<<2; 1958 1962 Int iOffsetCur = iStrideCur<<2; 1959 1963 1960 1964 for ( y=0; y<iRows; y+= 4 ) 1961 1965 { … … 1986 1990 assert(false); 1987 1991 } 1988 1992 1989 1993 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1990 1994 }
Note: See TracChangeset for help on using the changeset viewer.