Changeset 468 in 3DVCSoftware
- Timestamp:
- 16 Jun 2013, 05:33:39 (11 years ago)
- Location:
- branches/HTM-DEV-0.3-dev2a/source
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2a/source/App/TAppEncoder/TAppEncCfg.cpp
r464 r468 508 508 ("AdvMultiviewResPred", m_uiUseAdvResPred, (UInt)1, "Usage of Advanced Residual Prediction" ) 509 509 #endif 510 510 #if H_3D_IC 511 ("IlluCompEnable", m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation") 512 #endif 511 513 // Coding tools 512 514 ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") … … 2289 2291 printf(" ARP:%d ", m_uiUseAdvResPred ); 2290 2292 #endif 2293 #if H_3D_IC 2294 printf( "IlluCompEnable: %d %d ", m_abUseIC[0] ? 1 : 0, m_abUseIC[1] ? 1 : 0 ); 2295 #endif 2291 2296 printf("\n\n"); 2292 2297 -
branches/HTM-DEV-0.3-dev2a/source/App/TAppEncoder/TAppEncCfg.h
r464 r468 243 243 UInt m_uiARPStepNum; 244 244 #endif 245 245 #if H_3D_IC 246 vector<Bool> m_abUseIC; ///< flag for using illumination compensation for inter-view prediction 247 #endif 246 248 Bool m_useFastDecisionForMerge; ///< flag for using Fast Decision Merge RD-Cost 247 249 Bool m_bUseCbfFastMode; ///< flag for using Cbf Fast PU Mode Decision -
branches/HTM-DEV-0.3-dev2a/source/App/TAppEncoder/TAppEncTop.cpp
r465 r468 178 178 m_cTEncTop.setUseAdvRP ( ( isDepth || 0==layer ) ? 0 : m_uiUseAdvResPred ); 179 179 m_cTEncTop.setARPStepNum ( ( isDepth || 0==layer ) ? 1 : H_3D_ARP_WFNR ); 180 #endif 181 #if H_3D_IC 182 m_cTEncTop.setUseIC ( vps.getViewIndex( layer ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] ); 180 183 #endif 181 184 #endif // H_3D -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/ContextTables.h
r464 r468 100 100 #endif 101 101 102 #if H_3D_IC 103 #define NUM_IC_FLAG_CTX 3 ///< number of context models for illumination compensation flag 104 #endif 105 102 106 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 103 107 … … 349 353 }; 350 354 #endif 355 356 #if H_3D_IC 357 static const UChar 358 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 359 { 360 { CNU, CNU, CNU, }, 361 { 197, 185, 201, }, 362 { 197, 185, 201, }, 363 }; 364 #endif 365 351 366 //! \} 352 367 -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComDataCU.cpp
r464 r468 119 119 m_puhARPW = NULL; 120 120 #endif 121 122 #if H_3D_IC 123 m_pbICFlag = NULL; 124 #endif 121 125 } 122 126 … … 214 218 #if H_3D_ARP 215 219 m_puhARPW = new UChar[ uiNumPartition]; 220 #endif 221 #if H_3D_IC 222 m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition); 216 223 #endif 217 224 } … … 304 311 if ( m_puhARPW ) { delete[] m_puhARPW; m_puhARPW = NULL; } 305 312 #endif 306 313 #if H_3D_IC 314 if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } 315 #endif 307 316 m_acCUMvField[0].destroy(); 308 317 m_acCUMvField[1].destroy(); … … 437 446 m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; 438 447 m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; 448 #if H_3D_IC 449 m_pbICFlag[ui] = pcFrom->m_pbICFlag[ui]; 450 #endif 439 451 } 440 452 … … 472 484 #if H_3D_ARP 473 485 memset( m_puhARPW + firstElement, 0, numElements * sizeof( UChar ) ); 486 #endif 487 #if H_3D_IC 488 memset( m_pbICFlag + firstElement, false, numElements * sizeof( *m_pbICFlag ) ); 474 489 #endif 475 490 } … … 611 626 m_puhARPW[ui] = 0; 612 627 #endif 628 #if H_3D_IC 629 m_pbICFlag[ui] = false; 630 #endif 613 631 } 614 632 } … … 692 710 memset( m_puhHeight, uhHeight, iSizeInUchar ); 693 711 memset( m_pbIPCMFlag, 0, iSizeInBool ); 712 #if H_3D_IC 713 memset( m_pbICFlag, 0, iSizeInBool ); 714 #endif 694 715 for (UInt ui = 0; ui < m_uiNumPartition; ui++) 695 716 { … … 733 754 m_puhARPW [ui] = pcCU->getARPW( uiPartOffset+ui ); 734 755 #endif 756 #if H_3D_IC 757 m_pbICFlag[ui] = pcCU->m_pbICFlag[uiPartOffset+ui]; 758 #endif 735 759 } 736 760 } … … 846 870 m_puhARPW = pcCU->getARPW() + uiPart; 847 871 #endif 872 #if H_3D_IC 873 m_pbICFlag = pcCU->getICFlag() + uiPart; 874 #endif 848 875 849 876 m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; … … 973 1000 #if H_3D_NBDV 974 1001 } 1002 #endif 1003 #if H_3D_IC 1004 m_pbICFlag = pcCU->getICFlag() + uiAbsPartIdx; 975 1005 #endif 976 1006 } … … 1058 1088 memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar ); 1059 1089 #endif 1090 #if H_3D_IC 1091 memcpy( m_pbICFlag + uiOffset, pcCU->getICFlag(), iSizeInBool ); 1092 #endif 1060 1093 } 1061 1094 … … 1136 1169 #if H_3D_ARP 1137 1170 memcpy( rpcCU->getARPW() + m_uiAbsIdxInLCU, m_puhARPW, iSizeInUchar ); 1171 #endif 1172 #if H_3D_IC 1173 memcpy( rpcCU->getICFlag() + m_uiAbsIdxInLCU, m_pbICFlag, iSizeInBool ); 1138 1174 #endif 1139 1175 } … … 1213 1249 memcpy( rpcCU->getARPW() + uiPartOffset, m_puhARPW, iSizeInUchar ); 1214 1250 #endif 1251 #if H_3D_IC 1252 memcpy( rpcCU->getICFlag() + uiPartOffset, m_pbICFlag, iSizeInBool ); 1253 #endif 1215 1254 } 1216 1255 … … 1872 1911 #endif 1873 1912 1913 #if H_3D_IC 1914 UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx ) 1915 { 1916 UInt uiCtx = 0; 1917 1918 return uiCtx; 1919 } 1920 #endif 1921 1874 1922 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 1875 1923 { … … 2170 2218 } 2171 2219 2220 #if H_3D_IC 2221 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) 2222 { 2223 UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; 2224 UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0; 2225 2226 switch ( m_pePartSize[uiTmpAbsPartIdx] ) 2227 { 2228 case SIZE_2NxN: 2229 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1; 2230 break; 2231 case SIZE_Nx2N: 2232 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2; 2233 break; 2234 case SIZE_NxN: 2235 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx; 2236 break; 2237 case SIZE_2NxnU: 2238 riWidth = getWidth( uiTmpAbsPartIdx ); 2239 riHeight = ( uiPartIdx == 0 ) ? getHeight( uiTmpAbsPartIdx ) >> 2 : ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ); 2240 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3; 2241 break; 2242 case SIZE_2NxnD: 2243 riWidth = getWidth( uiTmpAbsPartIdx ); 2244 riHeight = ( uiPartIdx == 0 ) ? ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ) : getHeight( uiTmpAbsPartIdx ) >> 2; 2245 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3); 2246 break; 2247 case SIZE_nLx2N: 2248 riWidth = ( uiPartIdx == 0 ) ? getWidth( uiTmpAbsPartIdx ) >> 2 : ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ); 2249 riHeight = getHeight( uiTmpAbsPartIdx ); 2250 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4; 2251 break; 2252 case SIZE_nRx2N: 2253 riWidth = ( uiPartIdx == 0 ) ? ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ) : getWidth( uiTmpAbsPartIdx ) >> 2; 2254 riHeight = getHeight( uiTmpAbsPartIdx ); 2255 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4); 2256 break; 2257 default: 2258 assert ( m_pePartSize[uiTmpAbsPartIdx] == SIZE_2Nx2N ); 2259 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = 0; 2260 break; 2261 } 2262 } 2263 #else 2172 2264 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) 2173 2265 { … … 2209 2301 } 2210 2302 } 2303 #endif 2211 2304 2212 2305 … … 3111 3204 { 3112 3205 Int iMvShift = 2; 3206 #if H_3D_IC 3207 if( getSlice()->getIsDepth() ) 3208 iMvShift = 0; 3209 #endif 3113 3210 Int iOffset = 8; 3114 3211 Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift; … … 4317 4414 } 4318 4415 #endif 4416 4417 #if H_3D_IC 4418 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 4419 { 4420 memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); 4421 } 4422 4423 Bool TComDataCU::isICFlagRequired( UInt uiAbsPartIdx ) 4424 { 4425 UInt uiPartAddr; 4426 UInt iNumbPart; 4427 4428 if( !( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 4429 { 4430 return false; 4431 } 4432 4433 if( getSlice()->getIcSkipParseFlag() ) 4434 { 4435 if( getMergeFlag( uiAbsPartIdx ) && getMergeIndex( uiAbsPartIdx ) == 0 ) 4436 { 4437 return false; 4438 } 4439 } 4440 4441 if( getMergeFlag( uiAbsPartIdx ) ) 4442 { 4443 return true; 4444 } 4445 4446 4447 Int iWidth, iHeight; 4448 4449 iNumbPart = ( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ? 1 : ( getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ) ); 4450 4451 for(UInt i = 0; i < iNumbPart; i++) 4452 { 4453 getPartIndexAndSize( i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true ); 4454 uiPartAddr += uiAbsPartIdx; 4455 4456 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 4457 { 4458 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 4459 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 4460 4461 if( ( getInterDir( uiPartAddr ) & ( uiRefIdx+1 ) ) && iBestRefIdx >= 0 && getSlice()->getViewIndex() != getSlice()->getRefPic( eRefList, iBestRefIdx )->getViewIndex() ) 4462 { 4463 return true; 4464 } 4465 } 4466 } 4467 4468 return false; 4469 } 4470 #endif 4319 4471 //! \} -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComDataCU.h
r464 r468 197 197 UChar* m_puhARPW; 198 198 #endif 199 #if H_3D_IC 200 Bool* m_pbICFlag; ///< array of IC flags 201 #endif 199 202 // ------------------------------------------------------------------------------------------------------------------- 200 203 // misc. variables … … 453 456 Double getARPWFactor ( UInt uiIdx ); 454 457 #endif 458 #if H_3D_IC 459 Bool* getICFlag () { return m_pbICFlag; } 460 Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } 461 Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } 462 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 463 Bool isICFlagRequired ( UInt uiAbsPartIdx ); 464 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); 465 #else 455 466 // ------------------------------------------------------------------------------------------------------------------- 456 467 // member functions for accessing partition information … … 458 469 459 470 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); 471 #endif 460 472 UChar getNumPartInter (); 461 473 Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); … … 561 573 UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); 562 574 #endif 563 575 #if H_3D_IC 576 UInt getCtxICFlag ( UInt uiAbsPartIdx ); 577 #endif 564 578 UInt getSliceStartCU ( UInt pos ) { return m_sliceStartCU[pos-m_uiAbsIdxInLCU]; } 565 579 UInt getSliceSegmentStartCU ( UInt pos ) { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU]; } -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComPattern.h
r324 r468 99 99 TComPatternParam m_cPatternCb; 100 100 TComPatternParam m_cPatternCr; 101 101 #if H_3D_IC 102 Bool m_bICFlag; 103 #endif 102 104 static const UChar m_aucIntraFilter[5]; 103 105 … … 109 111 Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } 110 112 Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } 113 114 #if H_3D_IC 115 Bool getICFlag() { return m_bICFlag; } 116 Void setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; } 117 #endif 111 118 112 119 // access functions of ADI buffers -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComPrediction.cpp
r464 r468 122 122 } 123 123 } 124 #if H_3D_IC 125 for( Int i = 1; i < 64; i++ ) 126 { 127 m_uiaShift[i-1] = ( (1 << 15) + i/2 ) / i; 128 } 129 #endif 124 130 } 125 131 … … 505 511 { 506 512 #endif 513 #if H_3D_IC 514 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ); 515 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 516 #if H_3D_ARP 517 , false 518 #endif 519 , bICFlag ); 520 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 521 #if H_3D_ARP 522 , false 523 #endif 524 , bICFlag ); 525 #else 507 526 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 508 527 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 528 #endif 509 529 #if H_3D_ARP 510 530 } … … 671 691 , Bool filterType 672 692 #endif 693 #if H_3D_IC 694 , Bool bICFlag 695 #endif 673 696 ) 674 697 { … … 683 706 Int yFrac = mv->getVer() & 0x3; 684 707 708 #if H_3D_IC 709 if( cu->getSlice()->getIsDepth() ) 710 { 711 refOffset = mv->getHor() + mv->getVer() * refStride; 712 ref = refPic->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refOffset; 713 xFrac = 0; 714 yFrac = 0; 715 } 716 #endif 717 685 718 if ( yFrac == 0 ) 686 719 { … … 718 751 ); 719 752 } 753 754 #if H_3D_IC 755 if( bICFlag ) 756 { 757 Int a, b, iShift, i, j; 758 759 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_LUMA ); 760 761 for ( i = 0; i < height; i++ ) 762 { 763 for ( j = 0; j < width; j++ ) 764 { 765 if( bi ) 766 { 767 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY; 768 dst[j] = ( ( a*dst[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1 << iIFshift ) - IF_INTERNAL_OFFS; 769 } 770 else 771 dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b ); 772 } 773 dst += dstStride; 774 } 775 } 776 #endif 720 777 } 721 778 … … 735 792 #if H_3D_ARP 736 793 , Bool filterType 737 #endif 794 #endif 795 #if H_3D_IC 796 , Bool bICFlag 797 #endif 738 798 ) 739 799 { … … 811 871 ); 812 872 } 873 874 #if H_3D_IC 875 if( bICFlag ) 876 { 877 Int a, b, iShift, i, j; 878 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_U ); // Cb 879 for ( i = 0; i < cxHeight; i++ ) 880 { 881 for ( j = 0; j < cxWidth; j++ ) 882 { 883 if( bi ) 884 { 885 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC; 886 dstCb[j] = ( ( a*dstCb[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS; 887 } 888 else 889 dstCb[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b ); 890 } 891 dstCb += dstStride; 892 } 893 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_V ); // Cr 894 for ( i = 0; i < cxHeight; i++ ) 895 { 896 for ( j = 0; j < cxWidth; j++ ) 897 { 898 if( bi ) 899 { 900 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC; 901 dstCr[j] = ( ( a*dstCr[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS; 902 } 903 else 904 dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b ); 905 } 906 dstCr += dstStride; 907 } 908 } 909 #endif 813 910 } 814 911 … … 930 1027 return; 931 1028 } 1029 1030 #if H_3D_IC 1031 /** Function for deriving the position of first non-zero binary bit of a value 1032 * \param x input value 1033 * 1034 * This function derives the position of first non-zero binary bit of a value 1035 */ 1036 Int GetMSB( UInt x ) 1037 { 1038 Int iMSB = 0, bits = ( sizeof( Int ) << 3 ), y = 1; 1039 1040 while( x > 1 ) 1041 { 1042 bits >>= 1; 1043 y = x >> bits; 1044 1045 if( y ) 1046 { 1047 x = y; 1048 iMSB += bits; 1049 } 1050 } 1051 1052 iMSB+=y; 1053 1054 return iMSB; 1055 } 1056 1057 /** Function for counting leading number of zeros/ones 1058 * \param x input value 1059 \ This function counts leading number of zeros for positive numbers and 1060 \ leading number of ones for negative numbers. This can be implemented in 1061 \ single instructure cycle on many processors. 1062 */ 1063 1064 Short CountLeadingZerosOnes (Short x) 1065 { 1066 Short clz; 1067 Short i; 1068 1069 if(x == 0) 1070 { 1071 clz = 0; 1072 } 1073 else 1074 { 1075 if (x == -1) 1076 { 1077 clz = 15; 1078 } 1079 else 1080 { 1081 if(x < 0) 1082 { 1083 x = ~x; 1084 } 1085 clz = 15; 1086 for(i = 0;i < 15;++i) 1087 { 1088 if(x) 1089 { 1090 clz --; 1091 } 1092 x = x >> 1; 1093 } 1094 } 1095 } 1096 return clz; 1097 } 1098 1099 /** Function for deriving LM illumination compensation. 1100 */ 1101 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType ) 1102 { 1103 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 1104 Pel *pRec = NULL, *pRef = NULL; 1105 UInt uiWidth, uiHeight, uiTmpPartIdx; 1106 Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride(); 1107 Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride(); 1108 Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset, iHor, iVer; 1109 1110 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1111 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1112 iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 ); 1113 iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 ); 1114 iRefX = iCUPelX + iHor; 1115 iRefY = iCUPelY + iVer; 1116 if( eType != TEXT_LUMA ) 1117 { 1118 iHor = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getHor() + 1 ) >> 1 ) : ( ( pMv->getHor() + 4 ) >> 3 ); 1119 iVer = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getVer() + 1 ) >> 1 ) : ( ( pMv->getVer() + 4 ) >> 3 ); 1120 } 1121 uiWidth = ( eType == TEXT_LUMA ) ? pcCU->getWidth( 0 ) : ( pcCU->getWidth( 0 ) >> 1 ); 1122 uiHeight = ( eType == TEXT_LUMA ) ? pcCU->getHeight( 0 ) : ( pcCU->getHeight( 0 ) >> 1 ); 1123 1124 Int i, j, iCountShift = 0; 1125 1126 // LLS parameters estimation --> 1127 1128 Int x = 0, y = 0, xx = 0, xy = 0; 1129 1130 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 ) 1131 { 1132 iRefOffset = iHor + iVer * iRefStride - iRefStride; 1133 if( eType == TEXT_LUMA ) 1134 { 1135 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1136 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1137 } 1138 else if( eType == TEXT_CHROMA_U ) 1139 { 1140 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1141 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1142 } 1143 else 1144 { 1145 assert( eType == TEXT_CHROMA_V ); 1146 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1147 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1148 } 1149 1150 for( j = 0; j < uiWidth; j++ ) 1151 { 1152 x += pRef[j]; 1153 y += pRec[j]; 1154 xx += pRef[j] * pRef[j]; 1155 xy += pRef[j] * pRec[j]; 1156 } 1157 iCountShift += g_aucConvertToBit[ uiWidth ] + 2; 1158 } 1159 1160 1161 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelX > 0 && iRefX > 0 ) 1162 { 1163 iRefOffset = iHor + iVer * iRefStride - 1; 1164 if( eType == TEXT_LUMA ) 1165 { 1166 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1167 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1168 } 1169 else if( eType == TEXT_CHROMA_U ) 1170 { 1171 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1172 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1173 } 1174 else 1175 { 1176 assert( eType == TEXT_CHROMA_V ); 1177 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1178 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1179 } 1180 1181 for( i = 0; i < uiHeight; i++ ) 1182 { 1183 x += pRef[0]; 1184 y += pRec[0]; 1185 xx += pRef[0] * pRef[0]; 1186 xy += pRef[0] * pRec[0]; 1187 1188 pRef += iRefStride; 1189 pRec += iRecStride; 1190 } 1191 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 ); 1192 } 1193 1194 Int iTempShift = ( ( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC ) + g_aucConvertToBit[ uiWidth ] + 3 - 15; 1195 1196 if( iTempShift > 0 ) 1197 { 1198 x = ( x + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1199 y = ( y + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1200 xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1201 xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1202 iCountShift -= iTempShift; 1203 } 1204 1205 iShift = 13; 1206 1207 if( iCountShift == 0 ) 1208 { 1209 a = 1; 1210 b = 0; 1211 iShift = 0; 1212 } 1213 else 1214 { 1215 Int a1 = ( xy << iCountShift ) - y * x; 1216 Int a2 = ( xx << iCountShift ) - x * x; 1217 1218 { 1219 const Int iShiftA2 = 6; 1220 const Int iShiftA1 = 15; 1221 const Int iAccuracyShift = 15; 1222 1223 Int iScaleShiftA2 = 0; 1224 Int iScaleShiftA1 = 0; 1225 Int a1s = a1; 1226 Int a2s = a2; 1227 1228 iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1; 1229 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 1230 1231 if( iScaleShiftA1 < 0 ) 1232 { 1233 iScaleShiftA1 = 0; 1234 } 1235 1236 if( iScaleShiftA2 < 0 ) 1237 { 1238 iScaleShiftA2 = 0; 1239 } 1240 1241 Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1; 1242 1243 a2s = a2 >> iScaleShiftA2; 1244 1245 a1s = a1 >> iScaleShiftA1; 1246 1247 if (a2s >= 1) 1248 { 1249 a = a1s * m_uiaShift[ a2s - 1]; 1250 } 1251 else 1252 { 1253 a = 0; 1254 } 1255 1256 if( iScaleShiftA < 0 ) 1257 { 1258 a = a << -iScaleShiftA; 1259 } 1260 else 1261 { 1262 a = a >> iScaleShiftA; 1263 } 1264 1265 a = Clip3( -( 1 << 15 ), ( 1 << 15 ) - 1, a ); 1266 1267 Int minA = -(1 << (6)); 1268 Int maxA = (1 << 6) - 1; 1269 if( a <= maxA && a >= minA ) 1270 { 1271 // do nothing 1272 } 1273 else 1274 { 1275 Short n = CountLeadingZerosOnes( a ); 1276 a = a >> (9-n); 1277 iShift -= (9-n); 1278 } 1279 1280 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 1281 } 1282 } 1283 } 1284 #endif 932 1285 //! \} -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComPrediction.h
r464 r468 75 75 Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample 76 76 Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array 77 77 #if H_3D_IC 78 UInt m_uiaShift[ 63 ]; // Table for multiplication to substitue of division operation 79 #endif 78 80 Void xPredIntraAng (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); 79 81 Void xPredIntraPlanar ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); … … 89 91 , Bool filterType = false 90 92 #endif 93 #if H_3D_IC 94 , Bool bICFlag = false 95 #endif 91 96 ); 92 97 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi … … 94 99 , Bool filterType = false 95 100 #endif 101 #if H_3D_IC 102 , Bool bICFlag = false 103 #endif 96 104 ); 97 105 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 98 106 99 107 Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); 100 108 #if H_3D_IC 109 Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType ); 110 #endif 101 111 Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); 102 112 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComRdCost.cpp
r446 r468 502 502 cDtParam.bitDepth = bitDepth; 503 503 504 #if H_3D_IC 505 cDtParam.bUseIC = false; 506 #endif 507 504 508 #if WEIGHTED_CHROMA_DISTORTION 505 509 if (eText == TEXT_CHROMA_U) … … 599 603 return xGetSADw( pcDtParam ); 600 604 } 605 606 #if H_3D_IC 607 if( pcDtParam->bUseIC ) 608 { 609 return xGetSADic( pcDtParam ); 610 } 611 #endif 612 601 613 Pel* piOrg = pcDtParam->pOrg; 602 614 Pel* piCur = pcDtParam->pCur; … … 627 639 return xGetSADw( pcDtParam ); 628 640 } 641 642 #if H_3D_IC 643 if( pcDtParam->bUseIC ) 644 { 645 return xGetSAD4ic( pcDtParam ); 646 } 647 #endif 648 629 649 Pel* piOrg = pcDtParam->pOrg; 630 650 Pel* piCur = pcDtParam->pCur; … … 658 678 return xGetSADw( pcDtParam ); 659 679 } 680 681 #if H_3D_IC 682 if( pcDtParam->bUseIC ) 683 { 684 return xGetSAD8ic( pcDtParam ); 685 } 686 #endif 687 660 688 Pel* piOrg = pcDtParam->pOrg; 661 689 Pel* piCur = pcDtParam->pCur; … … 693 721 return xGetSADw( pcDtParam ); 694 722 } 723 724 #if H_3D_IC 725 if( pcDtParam->bUseIC ) 726 { 727 return xGetSAD16ic( pcDtParam ); 728 } 729 #endif 730 695 731 Pel* piOrg = pcDtParam->pOrg; 696 732 Pel* piCur = pcDtParam->pCur; … … 737 773 return xGetSADw( pcDtParam ); 738 774 } 775 776 #if H_3D_IC 777 if( pcDtParam->bUseIC ) 778 { 779 return xGetSAD12ic( pcDtParam ); 780 } 781 #endif 782 739 783 Pel* piOrg = pcDtParam->pOrg; 740 784 Pel* piCur = pcDtParam->pCur; … … 773 817 UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 774 818 { 819 #if H_3D_IC 820 if( pcDtParam->bUseIC ) 821 { 822 return xGetSAD16Nic( pcDtParam ); 823 } 824 #endif 825 775 826 Pel* piOrg = pcDtParam->pOrg; 776 827 Pel* piCur = pcDtParam->pCur; … … 819 870 return xGetSADw( pcDtParam ); 820 871 } 872 873 #if H_3D_IC 874 if( pcDtParam->bUseIC ) 875 { 876 return xGetSAD32ic( pcDtParam ); 877 } 878 #endif 879 821 880 Pel* piOrg = pcDtParam->pOrg; 822 881 Pel* piCur = pcDtParam->pCur; … … 879 938 return xGetSADw( pcDtParam ); 880 939 } 940 941 #if H_3D_IC 942 if( pcDtParam->bUseIC ) 943 { 944 return xGetSAD24ic( pcDtParam ); 945 } 946 #endif 947 881 948 Pel* piOrg = pcDtParam->pOrg; 882 949 Pel* piCur = pcDtParam->pCur; … … 932 999 return xGetSADw( pcDtParam ); 933 1000 } 1001 1002 #if H_3D_IC 1003 if( pcDtParam->bUseIC ) 1004 { 1005 return xGetSAD64ic( pcDtParam ); 1006 } 1007 #endif 1008 934 1009 Pel* piOrg = pcDtParam->pOrg; 935 1010 Pel* piCur = pcDtParam->pCur; … … 1024 1099 return xGetSADw( pcDtParam ); 1025 1100 } 1101 1102 #if H_3D_IC 1103 if( pcDtParam->bUseIC ) 1104 { 1105 return xGetSAD48ic( pcDtParam ); 1106 } 1107 #endif 1108 1026 1109 Pel* piOrg = pcDtParam->pOrg; 1027 1110 Pel* piCur = pcDtParam->pCur; … … 1094 1177 #endif 1095 1178 1179 #if H_3D_IC 1180 UInt TComRdCost::xGetSADic( DistParam* pcDtParam ) 1181 { 1182 if ( pcDtParam->bApplyWeight ) 1183 { 1184 return xGetSADw( pcDtParam ); 1185 } 1186 Pel* piOrg = pcDtParam->pOrg; 1187 Pel* piCur = pcDtParam->pCur; 1188 Int iRows = pcDtParam->iRows; 1189 Int iCols = pcDtParam->iCols; 1190 Int iStrideCur = pcDtParam->iStrideCur; 1191 Int iStrideOrg = pcDtParam->iStrideOrg; 1192 1193 UInt uiSum = 0; 1194 1195 Int iOrigAvg = 0, iCurAvg = 0; 1196 Int iDeltaC; 1197 1198 for( ; iRows != 0; iRows-- ) 1199 { 1200 for (Int n = 0; n < iCols; n++ ) 1201 { 1202 iOrigAvg += piOrg[n]; 1203 iCurAvg += piCur[n]; 1204 } 1205 piOrg += iStrideOrg; 1206 piCur += iStrideCur; 1207 } 1208 1209 piOrg = pcDtParam->pOrg; 1210 piCur = pcDtParam->pCur; 1211 iRows = pcDtParam->iRows; 1212 1213 iDeltaC = (iOrigAvg - iCurAvg)/iCols/iRows; 1214 1215 for( ; iRows != 0; iRows-- ) 1216 { 1217 for (Int n = 0; n < iCols; n++ ) 1218 { 1219 uiSum += abs( piOrg[n] - piCur[n] - iDeltaC ); 1220 } 1221 piOrg += iStrideOrg; 1222 piCur += iStrideCur; 1223 } 1224 1225 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1226 } 1227 1228 UInt TComRdCost::xGetSAD4ic( DistParam* pcDtParam ) 1229 { 1230 if ( pcDtParam->bApplyWeight ) 1231 { 1232 return xGetSADw( pcDtParam ); 1233 } 1234 Pel* piOrg = pcDtParam->pOrg; 1235 Pel* piCur = pcDtParam->pCur; 1236 Int iRows = pcDtParam->iRows; 1237 Int iSubShift = pcDtParam->iSubShift; 1238 Int iSubStep = ( 1 << iSubShift ); 1239 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1240 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1241 1242 UInt uiSum = 0; 1243 1244 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1245 Int iDeltaC; 1246 1247 for( ; iRows != 0; iRows-=iSubStep ) 1248 { 1249 iOrigAvg += piOrg[0]; 1250 iOrigAvg += piOrg[1]; 1251 iOrigAvg += piOrg[2]; 1252 iOrigAvg += piOrg[3]; 1253 1254 iCurAvg += piCur[0]; 1255 iCurAvg += piCur[1]; 1256 iCurAvg += piCur[2]; 1257 iCurAvg += piCur[3]; 1258 1259 piOrg += iStrideOrg; 1260 piCur += iStrideCur; 1261 uiRowCnt++; 1262 } 1263 1264 piOrg = pcDtParam->pOrg; 1265 piCur = pcDtParam->pCur; 1266 iRows = pcDtParam->iRows; 1267 1268 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/4) : 0; 1269 1270 for( ; iRows != 0; iRows-=iSubStep ) 1271 { 1272 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1273 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1274 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1275 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1276 1277 piOrg += iStrideOrg; 1278 piCur += iStrideCur; 1279 } 1280 1281 uiSum <<= iSubShift; 1282 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1283 } 1284 1285 UInt TComRdCost::xGetSAD8ic( DistParam* pcDtParam ) 1286 { 1287 if ( pcDtParam->bApplyWeight ) 1288 { 1289 return xGetSADw( pcDtParam ); 1290 } 1291 Pel* piOrg = pcDtParam->pOrg; 1292 Pel* piCur = pcDtParam->pCur; 1293 Int iRows = pcDtParam->iRows; 1294 Int iSubShift = pcDtParam->iSubShift; 1295 Int iSubStep = ( 1 << iSubShift ); 1296 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1297 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1298 1299 UInt uiSum = 0; 1300 1301 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1302 Int iDeltaC; 1303 1304 for( ; iRows != 0; iRows-=iSubStep ) 1305 { 1306 iOrigAvg += piOrg[0]; 1307 iOrigAvg += piOrg[1]; 1308 iOrigAvg += piOrg[2]; 1309 iOrigAvg += piOrg[3]; 1310 iOrigAvg += piOrg[4]; 1311 iOrigAvg += piOrg[5]; 1312 iOrigAvg += piOrg[6]; 1313 iOrigAvg += piOrg[7]; 1314 1315 iCurAvg += piCur[0]; 1316 iCurAvg += piCur[1]; 1317 iCurAvg += piCur[2]; 1318 iCurAvg += piCur[3]; 1319 iCurAvg += piCur[4]; 1320 iCurAvg += piCur[5]; 1321 iCurAvg += piCur[6]; 1322 iCurAvg += piCur[7]; 1323 1324 piOrg += iStrideOrg; 1325 piCur += iStrideCur; 1326 uiRowCnt++; 1327 } 1328 1329 piOrg = pcDtParam->pOrg; 1330 piCur = pcDtParam->pCur; 1331 iRows = pcDtParam->iRows; 1332 1333 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/8) : 0; 1334 1335 for( ; iRows != 0; iRows-=iSubStep ) 1336 { 1337 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1338 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1339 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1340 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1341 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1342 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1343 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1344 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1345 1346 piOrg += iStrideOrg; 1347 piCur += iStrideCur; 1348 } 1349 1350 uiSum <<= iSubShift; 1351 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1352 } 1353 1354 UInt TComRdCost::xGetSAD16ic( DistParam* pcDtParam ) 1355 { 1356 if ( pcDtParam->bApplyWeight ) 1357 { 1358 return xGetSADw( pcDtParam ); 1359 } 1360 Pel* piOrg = pcDtParam->pOrg; 1361 Pel* piCur = pcDtParam->pCur; 1362 Int iRows = pcDtParam->iRows; 1363 Int iSubShift = pcDtParam->iSubShift; 1364 Int iSubStep = ( 1 << iSubShift ); 1365 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1366 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1367 1368 UInt uiSum = 0; 1369 1370 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1371 Int iDeltaC; 1372 1373 for( ; iRows != 0; iRows-=iSubStep ) 1374 { 1375 iOrigAvg += piOrg[0]; 1376 iOrigAvg += piOrg[1]; 1377 iOrigAvg += piOrg[2]; 1378 iOrigAvg += piOrg[3]; 1379 iOrigAvg += piOrg[4]; 1380 iOrigAvg += piOrg[5]; 1381 iOrigAvg += piOrg[6]; 1382 iOrigAvg += piOrg[7]; 1383 iOrigAvg += piOrg[8]; 1384 iOrigAvg += piOrg[9]; 1385 iOrigAvg += piOrg[10]; 1386 iOrigAvg += piOrg[11]; 1387 iOrigAvg += piOrg[12]; 1388 iOrigAvg += piOrg[13]; 1389 iOrigAvg += piOrg[14]; 1390 iOrigAvg += piOrg[15]; 1391 1392 iCurAvg += piCur[0]; 1393 iCurAvg += piCur[1]; 1394 iCurAvg += piCur[2]; 1395 iCurAvg += piCur[3]; 1396 iCurAvg += piCur[4]; 1397 iCurAvg += piCur[5]; 1398 iCurAvg += piCur[6]; 1399 iCurAvg += piCur[7]; 1400 iCurAvg += piCur[8]; 1401 iCurAvg += piCur[9]; 1402 iCurAvg += piCur[10]; 1403 iCurAvg += piCur[11]; 1404 iCurAvg += piCur[12]; 1405 iCurAvg += piCur[13]; 1406 iCurAvg += piCur[14]; 1407 iCurAvg += piCur[15]; 1408 1409 piOrg += iStrideOrg; 1410 piCur += iStrideCur; 1411 uiRowCnt++; 1412 } 1413 1414 piOrg = pcDtParam->pOrg; 1415 piCur = pcDtParam->pCur; 1416 iRows = pcDtParam->iRows; 1417 1418 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/16) : 0; 1419 1420 for( ; iRows != 0; iRows-=iSubStep ) 1421 { 1422 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1423 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1424 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1425 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1426 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1427 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1428 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1429 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1430 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1431 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1432 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1433 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1434 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1435 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1436 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1437 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1438 1439 piOrg += iStrideOrg; 1440 piCur += iStrideCur; 1441 } 1442 1443 uiSum <<= iSubShift; 1444 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1445 } 1446 1447 #if AMP_SAD 1448 UInt TComRdCost::xGetSAD12ic( DistParam* pcDtParam ) 1449 { 1450 if ( pcDtParam->bApplyWeight ) 1451 { 1452 return xGetSADw( pcDtParam ); 1453 } 1454 Pel* piOrg = pcDtParam->pOrg; 1455 Pel* piCur = pcDtParam->pCur; 1456 Int iRows = pcDtParam->iRows; 1457 Int iSubShift = pcDtParam->iSubShift; 1458 Int iSubStep = ( 1 << iSubShift ); 1459 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1460 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1461 1462 UInt uiSum = 0; 1463 1464 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1465 Int iDeltaC; 1466 1467 for( ; iRows != 0; iRows-=iSubStep ) 1468 { 1469 iOrigAvg += piOrg[0]; 1470 iOrigAvg += piOrg[1]; 1471 iOrigAvg += piOrg[2]; 1472 iOrigAvg += piOrg[3]; 1473 iOrigAvg += piOrg[4]; 1474 iOrigAvg += piOrg[5]; 1475 iOrigAvg += piOrg[6]; 1476 iOrigAvg += piOrg[7]; 1477 iOrigAvg += piOrg[8]; 1478 iOrigAvg += piOrg[9]; 1479 iOrigAvg += piOrg[10]; 1480 iOrigAvg += piOrg[11]; 1481 1482 iCurAvg += piCur[0]; 1483 iCurAvg += piCur[1]; 1484 iCurAvg += piCur[2]; 1485 iCurAvg += piCur[3]; 1486 iCurAvg += piCur[4]; 1487 iCurAvg += piCur[5]; 1488 iCurAvg += piCur[6]; 1489 iCurAvg += piCur[7]; 1490 iCurAvg += piCur[8]; 1491 iCurAvg += piCur[9]; 1492 iCurAvg += piCur[10]; 1493 iCurAvg += piCur[11]; 1494 1495 piOrg += iStrideOrg; 1496 piCur += iStrideCur; 1497 uiRowCnt++; 1498 } 1499 1500 piOrg = pcDtParam->pOrg; 1501 piCur = pcDtParam->pCur; 1502 iRows = pcDtParam->iRows; 1503 1504 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/12) : 0; 1505 1506 for( ; iRows != 0; iRows-=iSubStep ) 1507 { 1508 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1509 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1510 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1511 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1512 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1513 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1514 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1515 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1516 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1517 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1518 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1519 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1520 1521 piOrg += iStrideOrg; 1522 piCur += iStrideCur; 1523 } 1524 1525 uiSum <<= iSubShift; 1526 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1527 } 1528 #endif 1529 1530 UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam ) 1531 { 1532 Pel* piOrg = pcDtParam->pOrg; 1533 Pel* piCur = pcDtParam->pCur; 1534 Int iRows = pcDtParam->iRows; 1535 Int iCols = pcDtParam->iCols; 1536 Int iSubShift = pcDtParam->iSubShift; 1537 Int iSubStep = ( 1 << iSubShift ); 1538 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1539 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1540 1541 UInt uiSum = 0; 1542 1543 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0, uiColCnt = (iCols-1)/16 + 1; 1544 Int iDeltaC; 1545 1546 for( ; iRows != 0; iRows-=iSubStep ) 1547 { 1548 for (Int n = 0; n < iCols; n+=16 ) 1549 { 1550 iOrigAvg += piOrg[n + 0]; 1551 iOrigAvg += piOrg[n + 1]; 1552 iOrigAvg += piOrg[n + 2]; 1553 iOrigAvg += piOrg[n + 3]; 1554 iOrigAvg += piOrg[n + 4]; 1555 iOrigAvg += piOrg[n + 5]; 1556 iOrigAvg += piOrg[n + 6]; 1557 iOrigAvg += piOrg[n + 7]; 1558 iOrigAvg += piOrg[n + 8]; 1559 iOrigAvg += piOrg[n + 9]; 1560 iOrigAvg += piOrg[n + 10]; 1561 iOrigAvg += piOrg[n + 11]; 1562 iOrigAvg += piOrg[n + 12]; 1563 iOrigAvg += piOrg[n + 13]; 1564 iOrigAvg += piOrg[n + 14]; 1565 iOrigAvg += piOrg[n + 15]; 1566 1567 iCurAvg += piCur[n + 0]; 1568 iCurAvg += piCur[n + 1]; 1569 iCurAvg += piCur[n + 2]; 1570 iCurAvg += piCur[n + 3]; 1571 iCurAvg += piCur[n + 4]; 1572 iCurAvg += piCur[n + 5]; 1573 iCurAvg += piCur[n + 6]; 1574 iCurAvg += piCur[n + 7]; 1575 iCurAvg += piCur[n + 8]; 1576 iCurAvg += piCur[n + 9]; 1577 iCurAvg += piCur[n + 10]; 1578 iCurAvg += piCur[n + 11]; 1579 iCurAvg += piCur[n + 12]; 1580 iCurAvg += piCur[n + 13]; 1581 iCurAvg += piCur[n + 14]; 1582 iCurAvg += piCur[n + 15]; 1583 } 1584 piOrg += iStrideOrg; 1585 piCur += iStrideCur; 1586 uiRowCnt++; 1587 } 1588 piOrg = pcDtParam->pOrg; 1589 piCur = pcDtParam->pCur; 1590 iRows = pcDtParam->iRows; 1591 1592 iDeltaC = (uiRowCnt && uiColCnt) ? ((iOrigAvg - iCurAvg)/uiRowCnt/uiColCnt/16) : 0; 1593 1594 for( ; iRows != 0; iRows-=iSubStep ) 1595 { 1596 for (Int n = 0; n < iCols; n+=16 ) 1597 { 1598 uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] - iDeltaC ); 1599 uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] - iDeltaC ); 1600 uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] - iDeltaC ); 1601 uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] - iDeltaC ); 1602 uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] - iDeltaC ); 1603 uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] - iDeltaC ); 1604 uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] - iDeltaC ); 1605 uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] - iDeltaC ); 1606 uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] - iDeltaC ); 1607 uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] - iDeltaC ); 1608 uiSum += abs( piOrg[n+10] - piCur[n+10] - iDeltaC ); 1609 uiSum += abs( piOrg[n+11] - piCur[n+11] - iDeltaC ); 1610 uiSum += abs( piOrg[n+12] - piCur[n+12] - iDeltaC ); 1611 uiSum += abs( piOrg[n+13] - piCur[n+13] - iDeltaC ); 1612 uiSum += abs( piOrg[n+14] - piCur[n+14] - iDeltaC ); 1613 uiSum += abs( piOrg[n+15] - piCur[n+15] - iDeltaC ); 1614 } 1615 piOrg += iStrideOrg; 1616 piCur += iStrideCur; 1617 } 1618 1619 uiSum <<= iSubShift; 1620 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1621 } 1622 1623 UInt TComRdCost::xGetSAD32ic( DistParam* pcDtParam ) 1624 { 1625 if ( pcDtParam->bApplyWeight ) 1626 { 1627 return xGetSADw( pcDtParam ); 1628 } 1629 Pel* piOrg = pcDtParam->pOrg; 1630 Pel* piCur = pcDtParam->pCur; 1631 Int iRows = pcDtParam->iRows; 1632 Int iSubShift = pcDtParam->iSubShift; 1633 Int iSubStep = ( 1 << iSubShift ); 1634 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1635 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1636 1637 UInt uiSum = 0; 1638 1639 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1640 Int iDeltaC; 1641 1642 for( ; iRows != 0; iRows-=iSubStep ) 1643 { 1644 iOrigAvg += piOrg[0]; 1645 iOrigAvg += piOrg[1]; 1646 iOrigAvg += piOrg[2]; 1647 iOrigAvg += piOrg[3]; 1648 iOrigAvg += piOrg[4]; 1649 iOrigAvg += piOrg[5]; 1650 iOrigAvg += piOrg[6]; 1651 iOrigAvg += piOrg[7]; 1652 iOrigAvg += piOrg[8]; 1653 iOrigAvg += piOrg[9]; 1654 iOrigAvg += piOrg[10]; 1655 iOrigAvg += piOrg[11]; 1656 iOrigAvg += piOrg[12]; 1657 iOrigAvg += piOrg[13]; 1658 iOrigAvg += piOrg[14]; 1659 iOrigAvg += piOrg[15]; 1660 iOrigAvg += piOrg[16]; 1661 iOrigAvg += piOrg[17]; 1662 iOrigAvg += piOrg[18]; 1663 iOrigAvg += piOrg[19]; 1664 iOrigAvg += piOrg[20]; 1665 iOrigAvg += piOrg[21]; 1666 iOrigAvg += piOrg[22]; 1667 iOrigAvg += piOrg[23]; 1668 iOrigAvg += piOrg[24]; 1669 iOrigAvg += piOrg[25]; 1670 iOrigAvg += piOrg[26]; 1671 iOrigAvg += piOrg[27]; 1672 iOrigAvg += piOrg[28]; 1673 iOrigAvg += piOrg[29]; 1674 iOrigAvg += piOrg[30]; 1675 iOrigAvg += piOrg[31]; 1676 1677 iCurAvg += piCur[0]; 1678 iCurAvg += piCur[1]; 1679 iCurAvg += piCur[2]; 1680 iCurAvg += piCur[3]; 1681 iCurAvg += piCur[4]; 1682 iCurAvg += piCur[5]; 1683 iCurAvg += piCur[6]; 1684 iCurAvg += piCur[7]; 1685 iCurAvg += piCur[8]; 1686 iCurAvg += piCur[9]; 1687 iCurAvg += piCur[10]; 1688 iCurAvg += piCur[11]; 1689 iCurAvg += piCur[12]; 1690 iCurAvg += piCur[13]; 1691 iCurAvg += piCur[14]; 1692 iCurAvg += piCur[15]; 1693 iCurAvg += piCur[16]; 1694 iCurAvg += piCur[17]; 1695 iCurAvg += piCur[18]; 1696 iCurAvg += piCur[19]; 1697 iCurAvg += piCur[20]; 1698 iCurAvg += piCur[21]; 1699 iCurAvg += piCur[22]; 1700 iCurAvg += piCur[23]; 1701 iCurAvg += piCur[24]; 1702 iCurAvg += piCur[25]; 1703 iCurAvg += piCur[26]; 1704 iCurAvg += piCur[27]; 1705 iCurAvg += piCur[28]; 1706 iCurAvg += piCur[29]; 1707 iCurAvg += piCur[30]; 1708 iCurAvg += piCur[31]; 1709 1710 piOrg += iStrideOrg; 1711 piCur += iStrideCur; 1712 uiRowCnt++; 1713 } 1714 1715 piOrg = pcDtParam->pOrg; 1716 piCur = pcDtParam->pCur; 1717 iRows = pcDtParam->iRows; 1718 1719 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/32) : 0; 1720 1721 for( ; iRows != 0; iRows-=iSubStep ) 1722 { 1723 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1724 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1725 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1726 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1727 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1728 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1729 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1730 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1731 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1732 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1733 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1734 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1735 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1736 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1737 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1738 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1739 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 1740 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 1741 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 1742 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 1743 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 1744 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 1745 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 1746 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 1747 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 1748 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 1749 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 1750 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 1751 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 1752 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 1753 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 1754 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 1755 1756 piOrg += iStrideOrg; 1757 piCur += iStrideCur; 1758 } 1759 1760 uiSum <<= iSubShift; 1761 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1762 } 1763 1764 #if AMP_SAD 1765 UInt TComRdCost::xGetSAD24ic( DistParam* pcDtParam ) 1766 { 1767 if ( pcDtParam->bApplyWeight ) 1768 { 1769 return xGetSADw( pcDtParam ); 1770 } 1771 Pel* piOrg = pcDtParam->pOrg; 1772 Pel* piCur = pcDtParam->pCur; 1773 Int iRows = pcDtParam->iRows; 1774 Int iSubShift = pcDtParam->iSubShift; 1775 Int iSubStep = ( 1 << iSubShift ); 1776 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1777 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1778 1779 UInt uiSum = 0; 1780 1781 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1782 Int iDeltaC; 1783 1784 for( ; iRows != 0; iRows-=iSubStep ) 1785 { 1786 iOrigAvg += piOrg[0]; 1787 iOrigAvg += piOrg[1]; 1788 iOrigAvg += piOrg[2]; 1789 iOrigAvg += piOrg[3]; 1790 iOrigAvg += piOrg[4]; 1791 iOrigAvg += piOrg[5]; 1792 iOrigAvg += piOrg[6]; 1793 iOrigAvg += piOrg[7]; 1794 iOrigAvg += piOrg[8]; 1795 iOrigAvg += piOrg[9]; 1796 iOrigAvg += piOrg[10]; 1797 iOrigAvg += piOrg[11]; 1798 iOrigAvg += piOrg[12]; 1799 iOrigAvg += piOrg[13]; 1800 iOrigAvg += piOrg[14]; 1801 iOrigAvg += piOrg[15]; 1802 iOrigAvg += piOrg[16]; 1803 iOrigAvg += piOrg[17]; 1804 iOrigAvg += piOrg[18]; 1805 iOrigAvg += piOrg[19]; 1806 iOrigAvg += piOrg[20]; 1807 iOrigAvg += piOrg[21]; 1808 iOrigAvg += piOrg[22]; 1809 iOrigAvg += piOrg[23]; 1810 1811 iCurAvg += piCur[0]; 1812 iCurAvg += piCur[1]; 1813 iCurAvg += piCur[2]; 1814 iCurAvg += piCur[3]; 1815 iCurAvg += piCur[4]; 1816 iCurAvg += piCur[5]; 1817 iCurAvg += piCur[6]; 1818 iCurAvg += piCur[7]; 1819 iCurAvg += piCur[8]; 1820 iCurAvg += piCur[9]; 1821 iCurAvg += piCur[10]; 1822 iCurAvg += piCur[11]; 1823 iCurAvg += piCur[12]; 1824 iCurAvg += piCur[13]; 1825 iCurAvg += piCur[14]; 1826 iCurAvg += piCur[15]; 1827 iCurAvg += piCur[16]; 1828 iCurAvg += piCur[17]; 1829 iCurAvg += piCur[18]; 1830 iCurAvg += piCur[19]; 1831 iCurAvg += piCur[20]; 1832 iCurAvg += piCur[21]; 1833 iCurAvg += piCur[22]; 1834 iCurAvg += piCur[23]; 1835 1836 piOrg += iStrideOrg; 1837 piCur += iStrideCur; 1838 uiRowCnt++; 1839 } 1840 1841 piOrg = pcDtParam->pOrg; 1842 piCur = pcDtParam->pCur; 1843 iRows = pcDtParam->iRows; 1844 1845 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/24) : 0; 1846 1847 for( ; iRows != 0; iRows-=iSubStep ) 1848 { 1849 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1850 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1851 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1852 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1853 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1854 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1855 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1856 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1857 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1858 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1859 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1860 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1861 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1862 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1863 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1864 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1865 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 1866 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 1867 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 1868 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 1869 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 1870 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 1871 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 1872 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 1873 1874 piOrg += iStrideOrg; 1875 piCur += iStrideCur; 1876 } 1877 1878 uiSum <<= iSubShift; 1879 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 1880 } 1881 #endif 1882 1883 UInt TComRdCost::xGetSAD64ic( DistParam* pcDtParam ) 1884 { 1885 if ( pcDtParam->bApplyWeight ) 1886 { 1887 return xGetSADw( pcDtParam ); 1888 } 1889 Pel* piOrg = pcDtParam->pOrg; 1890 Pel* piCur = pcDtParam->pCur; 1891 Int iRows = pcDtParam->iRows; 1892 Int iSubShift = pcDtParam->iSubShift; 1893 Int iSubStep = ( 1 << iSubShift ); 1894 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1895 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1896 1897 UInt uiSum = 0; 1898 1899 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1900 Int iDeltaC; 1901 1902 for( ; iRows != 0; iRows-=iSubStep ) 1903 { 1904 iOrigAvg += piOrg[0] ; 1905 iOrigAvg += piOrg[1] ; 1906 iOrigAvg += piOrg[2] ; 1907 iOrigAvg += piOrg[3] ; 1908 iOrigAvg += piOrg[4] ; 1909 iOrigAvg += piOrg[5] ; 1910 iOrigAvg += piOrg[6] ; 1911 iOrigAvg += piOrg[7] ; 1912 iOrigAvg += piOrg[8] ; 1913 iOrigAvg += piOrg[9] ; 1914 iOrigAvg += piOrg[10] ; 1915 iOrigAvg += piOrg[11] ; 1916 iOrigAvg += piOrg[12] ; 1917 iOrigAvg += piOrg[13] ; 1918 iOrigAvg += piOrg[14] ; 1919 iOrigAvg += piOrg[15] ; 1920 iOrigAvg += piOrg[16] ; 1921 iOrigAvg += piOrg[17] ; 1922 iOrigAvg += piOrg[18] ; 1923 iOrigAvg += piOrg[19] ; 1924 iOrigAvg += piOrg[20] ; 1925 iOrigAvg += piOrg[21] ; 1926 iOrigAvg += piOrg[22] ; 1927 iOrigAvg += piOrg[23] ; 1928 iOrigAvg += piOrg[24] ; 1929 iOrigAvg += piOrg[25] ; 1930 iOrigAvg += piOrg[26] ; 1931 iOrigAvg += piOrg[27] ; 1932 iOrigAvg += piOrg[28] ; 1933 iOrigAvg += piOrg[29] ; 1934 iOrigAvg += piOrg[30] ; 1935 iOrigAvg += piOrg[31] ; 1936 iOrigAvg += piOrg[32] ; 1937 iOrigAvg += piOrg[33] ; 1938 iOrigAvg += piOrg[34] ; 1939 iOrigAvg += piOrg[35] ; 1940 iOrigAvg += piOrg[36] ; 1941 iOrigAvg += piOrg[37] ; 1942 iOrigAvg += piOrg[38] ; 1943 iOrigAvg += piOrg[39] ; 1944 iOrigAvg += piOrg[40] ; 1945 iOrigAvg += piOrg[41] ; 1946 iOrigAvg += piOrg[42] ; 1947 iOrigAvg += piOrg[43] ; 1948 iOrigAvg += piOrg[44] ; 1949 iOrigAvg += piOrg[45] ; 1950 iOrigAvg += piOrg[46] ; 1951 iOrigAvg += piOrg[47] ; 1952 iOrigAvg += piOrg[48] ; 1953 iOrigAvg += piOrg[49] ; 1954 iOrigAvg += piOrg[50] ; 1955 iOrigAvg += piOrg[51] ; 1956 iOrigAvg += piOrg[52] ; 1957 iOrigAvg += piOrg[53] ; 1958 iOrigAvg += piOrg[54] ; 1959 iOrigAvg += piOrg[55] ; 1960 iOrigAvg += piOrg[56] ; 1961 iOrigAvg += piOrg[57] ; 1962 iOrigAvg += piOrg[58] ; 1963 iOrigAvg += piOrg[59] ; 1964 iOrigAvg += piOrg[60] ; 1965 iOrigAvg += piOrg[61] ; 1966 iOrigAvg += piOrg[62] ; 1967 iOrigAvg += piOrg[63] ; 1968 1969 iCurAvg += piCur[0] ; 1970 iCurAvg += piCur[1] ; 1971 iCurAvg += piCur[2] ; 1972 iCurAvg += piCur[3] ; 1973 iCurAvg += piCur[4] ; 1974 iCurAvg += piCur[5] ; 1975 iCurAvg += piCur[6] ; 1976 iCurAvg += piCur[7] ; 1977 iCurAvg += piCur[8] ; 1978 iCurAvg += piCur[9] ; 1979 iCurAvg += piCur[10] ; 1980 iCurAvg += piCur[11] ; 1981 iCurAvg += piCur[12] ; 1982 iCurAvg += piCur[13] ; 1983 iCurAvg += piCur[14] ; 1984 iCurAvg += piCur[15] ; 1985 iCurAvg += piCur[16] ; 1986 iCurAvg += piCur[17] ; 1987 iCurAvg += piCur[18] ; 1988 iCurAvg += piCur[19] ; 1989 iCurAvg += piCur[20] ; 1990 iCurAvg += piCur[21] ; 1991 iCurAvg += piCur[22] ; 1992 iCurAvg += piCur[23] ; 1993 iCurAvg += piCur[24] ; 1994 iCurAvg += piCur[25] ; 1995 iCurAvg += piCur[26] ; 1996 iCurAvg += piCur[27] ; 1997 iCurAvg += piCur[28] ; 1998 iCurAvg += piCur[29] ; 1999 iCurAvg += piCur[30] ; 2000 iCurAvg += piCur[31] ; 2001 iCurAvg += piCur[32] ; 2002 iCurAvg += piCur[33] ; 2003 iCurAvg += piCur[34] ; 2004 iCurAvg += piCur[35] ; 2005 iCurAvg += piCur[36] ; 2006 iCurAvg += piCur[37] ; 2007 iCurAvg += piCur[38] ; 2008 iCurAvg += piCur[39] ; 2009 iCurAvg += piCur[40] ; 2010 iCurAvg += piCur[41] ; 2011 iCurAvg += piCur[42] ; 2012 iCurAvg += piCur[43] ; 2013 iCurAvg += piCur[44] ; 2014 iCurAvg += piCur[45] ; 2015 iCurAvg += piCur[46] ; 2016 iCurAvg += piCur[47] ; 2017 iCurAvg += piCur[48] ; 2018 iCurAvg += piCur[49] ; 2019 iCurAvg += piCur[50] ; 2020 iCurAvg += piCur[51] ; 2021 iCurAvg += piCur[52] ; 2022 iCurAvg += piCur[53] ; 2023 iCurAvg += piCur[54] ; 2024 iCurAvg += piCur[55] ; 2025 iCurAvg += piCur[56] ; 2026 iCurAvg += piCur[57] ; 2027 iCurAvg += piCur[58] ; 2028 iCurAvg += piCur[59] ; 2029 iCurAvg += piCur[60] ; 2030 iCurAvg += piCur[61] ; 2031 iCurAvg += piCur[62] ; 2032 iCurAvg += piCur[63] ; 2033 2034 piOrg += iStrideOrg; 2035 piCur += iStrideCur; 2036 uiRowCnt++; 2037 } 2038 2039 piOrg = pcDtParam->pOrg; 2040 piCur = pcDtParam->pCur; 2041 iRows = pcDtParam->iRows; 2042 2043 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/64) : 0; 2044 2045 for( ; iRows != 0; iRows-=iSubStep ) 2046 { 2047 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 2048 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 2049 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 2050 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 2051 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 2052 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 2053 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 2054 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 2055 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 2056 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 2057 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 2058 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 2059 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 2060 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 2061 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 2062 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 2063 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 2064 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 2065 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 2066 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 2067 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 2068 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 2069 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 2070 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 2071 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 2072 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 2073 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 2074 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 2075 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 2076 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 2077 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 2078 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 2079 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); 2080 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); 2081 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); 2082 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); 2083 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); 2084 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); 2085 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); 2086 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); 2087 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); 2088 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); 2089 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); 2090 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); 2091 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); 2092 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); 2093 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); 2094 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); 2095 uiSum += abs( piOrg[48] - piCur[48] - iDeltaC ); 2096 uiSum += abs( piOrg[49] - piCur[49] - iDeltaC ); 2097 uiSum += abs( piOrg[50] - piCur[50] - iDeltaC ); 2098 uiSum += abs( piOrg[51] - piCur[51] - iDeltaC ); 2099 uiSum += abs( piOrg[52] - piCur[52] - iDeltaC ); 2100 uiSum += abs( piOrg[53] - piCur[53] - iDeltaC ); 2101 uiSum += abs( piOrg[54] - piCur[54] - iDeltaC ); 2102 uiSum += abs( piOrg[55] - piCur[55] - iDeltaC ); 2103 uiSum += abs( piOrg[56] - piCur[56] - iDeltaC ); 2104 uiSum += abs( piOrg[57] - piCur[57] - iDeltaC ); 2105 uiSum += abs( piOrg[58] - piCur[58] - iDeltaC ); 2106 uiSum += abs( piOrg[59] - piCur[59] - iDeltaC ); 2107 uiSum += abs( piOrg[60] - piCur[60] - iDeltaC ); 2108 uiSum += abs( piOrg[61] - piCur[61] - iDeltaC ); 2109 uiSum += abs( piOrg[62] - piCur[62] - iDeltaC ); 2110 uiSum += abs( piOrg[63] - piCur[63] - iDeltaC ); 2111 2112 piOrg += iStrideOrg; 2113 piCur += iStrideCur; 2114 } 2115 2116 uiSum <<= iSubShift; 2117 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 2118 } 2119 2120 #if AMP_SAD 2121 UInt TComRdCost::xGetSAD48ic( DistParam* pcDtParam ) 2122 { 2123 if ( pcDtParam->bApplyWeight ) 2124 { 2125 return xGetSADw( pcDtParam ); 2126 } 2127 2128 Pel* piOrg = pcDtParam->pOrg; 2129 Pel* piCur = pcDtParam->pCur; 2130 Int iRows = pcDtParam->iRows; 2131 Int iSubShift = pcDtParam->iSubShift; 2132 Int iSubStep = ( 1 << iSubShift ); 2133 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 2134 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 2135 2136 UInt uiSum = 0; 2137 2138 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 2139 Int iDeltaC; 2140 2141 for( ; iRows != 0; iRows-=iSubStep ) 2142 { 2143 iOrigAvg += piOrg[0] ; 2144 iOrigAvg += piOrg[1] ; 2145 iOrigAvg += piOrg[2] ; 2146 iOrigAvg += piOrg[3] ; 2147 iOrigAvg += piOrg[4] ; 2148 iOrigAvg += piOrg[5] ; 2149 iOrigAvg += piOrg[6] ; 2150 iOrigAvg += piOrg[7] ; 2151 iOrigAvg += piOrg[8] ; 2152 iOrigAvg += piOrg[9] ; 2153 iOrigAvg += piOrg[10] ; 2154 iOrigAvg += piOrg[11] ; 2155 iOrigAvg += piOrg[12] ; 2156 iOrigAvg += piOrg[13] ; 2157 iOrigAvg += piOrg[14] ; 2158 iOrigAvg += piOrg[15] ; 2159 iOrigAvg += piOrg[16] ; 2160 iOrigAvg += piOrg[17] ; 2161 iOrigAvg += piOrg[18] ; 2162 iOrigAvg += piOrg[19] ; 2163 iOrigAvg += piOrg[20] ; 2164 iOrigAvg += piOrg[21] ; 2165 iOrigAvg += piOrg[22] ; 2166 iOrigAvg += piOrg[23] ; 2167 iOrigAvg += piOrg[24] ; 2168 iOrigAvg += piOrg[25] ; 2169 iOrigAvg += piOrg[26] ; 2170 iOrigAvg += piOrg[27] ; 2171 iOrigAvg += piOrg[28] ; 2172 iOrigAvg += piOrg[29] ; 2173 iOrigAvg += piOrg[30] ; 2174 iOrigAvg += piOrg[31] ; 2175 iOrigAvg += piOrg[32] ; 2176 iOrigAvg += piOrg[33] ; 2177 iOrigAvg += piOrg[34] ; 2178 iOrigAvg += piOrg[35] ; 2179 iOrigAvg += piOrg[36] ; 2180 iOrigAvg += piOrg[37] ; 2181 iOrigAvg += piOrg[38] ; 2182 iOrigAvg += piOrg[39] ; 2183 iOrigAvg += piOrg[40] ; 2184 iOrigAvg += piOrg[41] ; 2185 iOrigAvg += piOrg[42] ; 2186 iOrigAvg += piOrg[43] ; 2187 iOrigAvg += piOrg[44] ; 2188 iOrigAvg += piOrg[45] ; 2189 iOrigAvg += piOrg[46] ; 2190 iOrigAvg += piOrg[47] ; 2191 2192 iCurAvg += piCur[0] ; 2193 iCurAvg += piCur[1] ; 2194 iCurAvg += piCur[2] ; 2195 iCurAvg += piCur[3] ; 2196 iCurAvg += piCur[4] ; 2197 iCurAvg += piCur[5] ; 2198 iCurAvg += piCur[6] ; 2199 iCurAvg += piCur[7] ; 2200 iCurAvg += piCur[8] ; 2201 iCurAvg += piCur[9] ; 2202 iCurAvg += piCur[10] ; 2203 iCurAvg += piCur[11] ; 2204 iCurAvg += piCur[12] ; 2205 iCurAvg += piCur[13] ; 2206 iCurAvg += piCur[14] ; 2207 iCurAvg += piCur[15] ; 2208 iCurAvg += piCur[16] ; 2209 iCurAvg += piCur[17] ; 2210 iCurAvg += piCur[18] ; 2211 iCurAvg += piCur[19] ; 2212 iCurAvg += piCur[20] ; 2213 iCurAvg += piCur[21] ; 2214 iCurAvg += piCur[22] ; 2215 iCurAvg += piCur[23] ; 2216 iCurAvg += piCur[24] ; 2217 iCurAvg += piCur[25] ; 2218 iCurAvg += piCur[26] ; 2219 iCurAvg += piCur[27] ; 2220 iCurAvg += piCur[28] ; 2221 iCurAvg += piCur[29] ; 2222 iCurAvg += piCur[30] ; 2223 iCurAvg += piCur[31] ; 2224 iCurAvg += piCur[32] ; 2225 iCurAvg += piCur[33] ; 2226 iCurAvg += piCur[34] ; 2227 iCurAvg += piCur[35] ; 2228 iCurAvg += piCur[36] ; 2229 iCurAvg += piCur[37] ; 2230 iCurAvg += piCur[38] ; 2231 iCurAvg += piCur[39] ; 2232 iCurAvg += piCur[40] ; 2233 iCurAvg += piCur[41] ; 2234 iCurAvg += piCur[42] ; 2235 iCurAvg += piCur[43] ; 2236 iCurAvg += piCur[44] ; 2237 iCurAvg += piCur[45] ; 2238 iCurAvg += piCur[46] ; 2239 iCurAvg += piCur[47] ; 2240 2241 piOrg += iStrideOrg; 2242 piCur += iStrideCur; 2243 uiRowCnt++; 2244 } 2245 2246 piOrg = pcDtParam->pOrg; 2247 piCur = pcDtParam->pCur; 2248 iRows = pcDtParam->iRows; 2249 2250 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/48) : 0; 2251 2252 for( ; iRows != 0; iRows-=iSubStep ) 2253 { 2254 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 2255 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 2256 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 2257 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 2258 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 2259 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 2260 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 2261 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 2262 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 2263 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 2264 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 2265 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 2266 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 2267 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 2268 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 2269 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 2270 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 2271 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 2272 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 2273 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 2274 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 2275 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 2276 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 2277 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 2278 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 2279 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 2280 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 2281 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 2282 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 2283 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 2284 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 2285 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 2286 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); 2287 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); 2288 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); 2289 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); 2290 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); 2291 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); 2292 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); 2293 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); 2294 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); 2295 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); 2296 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); 2297 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); 2298 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); 2299 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); 2300 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); 2301 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); 2302 2303 piOrg += iStrideOrg; 2304 piCur += iStrideCur; 2305 } 2306 2307 uiSum <<= iSubShift; 2308 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 2309 } 2310 #endif 2311 2312 #endif 1096 2313 // -------------------------------------------------------------------------------------------------------------------- 1097 2314 // SSE … … 2206 3423 return xGetHADsw( pcDtParam ); 2207 3424 } 3425 3426 #if H_3D_IC 3427 if( pcDtParam->bUseIC ) 3428 { 3429 return xGetHADsic( pcDtParam ); 3430 } 3431 #endif 3432 2208 3433 Pel* piOrg = pcDtParam->pOrg; 2209 3434 Pel* piCur = pcDtParam->pCur; … … 2302 3527 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 2303 3528 } 3529 3530 #if H_3D_IC 3531 UInt TComRdCost::xGetHADsic( DistParam* pcDtParam ) 3532 { 3533 if ( pcDtParam->bApplyWeight ) 3534 { 3535 return xGetHADsw( pcDtParam ); 3536 } 3537 Pel* piOrg = pcDtParam->pOrg; 3538 Pel* piCur = pcDtParam->pCur; 3539 Int iRows = pcDtParam->iRows; 3540 Int iCols = pcDtParam->iCols; 3541 Int iStrideCur = pcDtParam->iStrideCur; 3542 Int iStrideOrg = pcDtParam->iStrideOrg; 3543 Int iStep = pcDtParam->iStep; 3544 3545 Int x, y; 3546 3547 UInt uiSum = 0; 3548 3549 Int iOrigAvg = 0, iCurAvg = 0; 3550 Int iDeltaC; 3551 3552 for ( y=0; y<iRows; y++ ) 3553 { 3554 for ( x=0; x<iCols; x++ ) 3555 { 3556 iOrigAvg += piOrg[x]; 3557 iCurAvg += piCur[x]; 3558 } 3559 piOrg += iStrideOrg; 3560 piCur += iStrideCur; 3561 } 3562 3563 piOrg = pcDtParam->pOrg; 3564 piCur = pcDtParam->pCur; 3565 3566 iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols; 3567 3568 for ( y=0; y<iRows; y++ ) 3569 { 3570 for ( x=0; x<iCols; x++ ) 3571 { 3572 piOrg[x] -= iDeltaC; 3573 } 3574 piOrg += iStrideOrg; 3575 } 3576 3577 piOrg = pcDtParam->pOrg; 3578 3579 #if NS_HAD 3580 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) 3581 #else 3582 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 3583 #endif 3584 { 3585 Int iOffsetOrg = iStrideOrg<<3; 3586 Int iOffsetCur = iStrideCur<<3; 3587 for ( y=0; y<iRows; y+= 8 ) 3588 { 3589 for ( x=0; x<iCols; x+= 8 ) 3590 { 3591 uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3592 } 3593 piOrg += iOffsetOrg; 3594 piCur += iOffsetCur; 3595 } 3596 } 3597 #if NS_HAD 3598 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 3599 { 3600 Int iOffsetOrg = iStrideOrg<<2; 3601 Int iOffsetCur = iStrideCur<<2; 3602 for ( y=0; y<iRows; y+= 4 ) 3603 { 3604 for ( x=0; x<iCols; x+= 16 ) 3605 { 3606 uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3607 } 3608 piOrg += iOffsetOrg; 3609 piCur += iOffsetCur; 3610 } 3611 } 3612 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 3613 { 3614 Int iOffsetOrg = iStrideOrg<<4; 3615 Int iOffsetCur = iStrideCur<<4; 3616 for ( y=0; y<iRows; y+= 16 ) 3617 { 3618 for ( x=0; x<iCols; x+= 4 ) 3619 { 3620 uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3621 } 3622 piOrg += iOffsetOrg; 3623 piCur += iOffsetCur; 3624 } 3625 } 3626 #endif 3627 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 3628 { 3629 Int iOffsetOrg = iStrideOrg<<2; 3630 Int iOffsetCur = iStrideCur<<2; 3631 3632 for ( y=0; y<iRows; y+= 4 ) 3633 { 3634 for ( x=0; x<iCols; x+= 4 ) 3635 { 3636 uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3637 } 3638 piOrg += iOffsetOrg; 3639 piCur += iOffsetCur; 3640 } 3641 } 3642 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) 3643 { 3644 Int iOffsetOrg = iStrideOrg<<1; 3645 Int iOffsetCur = iStrideCur<<1; 3646 for ( y=0; y<iRows; y+=2 ) 3647 { 3648 for ( x=0; x<iCols; x+=2 ) 3649 { 3650 uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3651 } 3652 piOrg += iOffsetOrg; 3653 piCur += iOffsetCur; 3654 } 3655 } 3656 else 3657 { 3658 assert(false); 3659 } 3660 3661 piOrg = pcDtParam->pOrg; 3662 3663 for ( y=0; y<iRows; y++ ) 3664 { 3665 for ( x=0; x<iCols; x++ ) 3666 { 3667 piOrg[x] += iDeltaC; 3668 } 3669 piOrg += iStrideOrg; 3670 } 3671 3672 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 3673 } 3674 #endif 3675 2304 3676 #if H_3D_VSO 2305 3677 Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComRdCost.h
r446 r468 91 91 Int iStrideVir; 92 92 #endif 93 #if H_3D_IC 94 Bool bUseIC; 95 #endif 93 96 Int iRows; 94 97 Int iCols; … … 268 271 static UInt xGetSSE64 ( DistParam* pcDtParam ); 269 272 static UInt xGetSSE16N ( DistParam* pcDtParam ); 270 273 #if H_3D_IC 274 static UInt xGetSADic ( DistParam* pcDtParam ); 275 static UInt xGetSAD4ic ( DistParam* pcDtParam ); 276 static UInt xGetSAD8ic ( DistParam* pcDtParam ); 277 static UInt xGetSAD16ic ( DistParam* pcDtParam ); 278 static UInt xGetSAD32ic ( DistParam* pcDtParam ); 279 static UInt xGetSAD64ic ( DistParam* pcDtParam ); 280 static UInt xGetSAD16Nic ( DistParam* pcDtParam ); 281 #endif 271 282 static UInt xGetSAD ( DistParam* pcDtParam ); 272 283 static UInt xGetSAD4 ( DistParam* pcDtParam ); … … 288 299 289 300 #if AMP_SAD 301 #if H_3D_IC 302 static UInt xGetSAD12ic ( DistParam* pcDtParam ); 303 static UInt xGetSAD24ic ( DistParam* pcDtParam ); 304 static UInt xGetSAD48ic ( DistParam* pcDtParam ); 305 #endif 290 306 static UInt xGetSAD12 ( DistParam* pcDtParam ); 291 307 static UInt xGetSAD24 ( DistParam* pcDtParam ); … … 294 310 #endif 295 311 312 #if H_3D_IC 313 static UInt xGetHADsic ( DistParam* pcDtParam ); 314 #endif 296 315 static UInt xGetHADs4 ( DistParam* pcDtParam ); 297 316 static UInt xGetHADs8 ( DistParam* pcDtParam ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComSlice.cpp
r464 r468 114 114 , m_isDepth (false) 115 115 #endif 116 #if H_3D_IC 117 , m_bApplyIC ( false ) 118 , m_icSkipParseFlag ( false ) 119 #endif 116 120 #endif 117 121 { … … 966 970 m_enableTMVPFlag = pSrc->m_enableTMVPFlag; 967 971 m_maxNumMergeCand = pSrc->m_maxNumMergeCand; 972 #if H_3D_IC 973 m_bApplyIC = pSrc->m_bApplyIC; 974 m_icSkipParseFlag = pSrc->m_icSkipParseFlag; 975 #endif 968 976 } 969 977 … … 2300 2308 #endif 2301 2309 #endif 2310 2311 #if H_3D_IC 2312 Void TComSlice::xSetApplyIC() 2313 { 2314 Int iMaxPelValue = ( 1 << g_bitDepthY ); 2315 Int *aiRefOrgHist; 2316 Int *aiCurrHist; 2317 aiRefOrgHist = new Int; 2318 aiCurrHist = new Int; 2319 aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 2320 aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); 2321 memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 2322 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 2323 // Reference Idx Number 2324 Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); 2325 TComPic* pcCurrPic = NULL; 2326 TComPic* pcRefPic = NULL; 2327 TComPicYuv* pcCurrPicYuv = NULL; 2328 TComPicYuv* pcRefPicYuvOrg = NULL; 2329 pcCurrPic = getPic(); 2330 pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 2331 Int iWidth = pcCurrPicYuv->getWidth(); 2332 Int iHeight = pcCurrPicYuv->getHeight(); 2333 2334 2335 // Get InterView Reference picture 2336 // !!!!! Assume only one Interview Reference Picture in L0 2337 for ( Int i = 0; i < iNumRefIdx; i++ ) 2338 { 2339 pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 2340 if ( pcRefPic != NULL ) 2341 { 2342 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 2343 { 2344 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 2345 } 2346 } 2347 } 2348 2349 if ( pcRefPicYuvOrg != NULL ) 2350 { 2351 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 2352 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 2353 Int iCurrStride = pcCurrPicYuv->getStride(); 2354 Int iRefStride = pcRefPicYuvOrg->getStride(); 2355 Int iSumOrgSAD = 0; 2356 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 2357 2358 // Histogram building - luminance 2359 for ( Int y = 0; y < iHeight; y++ ) 2360 { 2361 for ( Int x = 0; x < iWidth; x++ ) 2362 { 2363 aiCurrHist[pCurrY[x]]++; 2364 aiRefOrgHist[pRefOrgY[x]]++; 2365 } 2366 pCurrY += iCurrStride; 2367 pRefOrgY += iRefStride; 2368 } 2369 // Histogram SAD 2370 for ( Int i = 0; i < iMaxPelValue; i++ ) 2371 { 2372 iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); 2373 } 2374 // Setting 2375 if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) 2376 { 2377 m_bApplyIC = true; 2378 } 2379 else 2380 { 2381 m_bApplyIC = false; 2382 } 2383 } 2384 2385 xFree( aiCurrHist ); 2386 xFree( aiRefOrgHist ); 2387 aiCurrHist = NULL; 2388 aiRefOrgHist = NULL; 2389 } 2390 #endif 2391 2302 2392 /** get scaling matrix from RefMatrixID 2303 2393 * \param sizeId size index -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TComSlice.h
r464 r468 1502 1502 #endif 1503 1503 #endif 1504 #if H_3D_IC 1505 Bool m_bApplyIC; 1506 Bool m_icSkipParseFlag; 1507 #endif 1508 1504 1509 public: 1505 1510 TComSlice(); … … 1582 1587 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;} 1583 1588 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;} 1589 #endif 1590 #if H_3D_IC 1591 Void setApplyIC( Bool b ) { m_bApplyIC = b; } 1592 Bool getApplyIC() { return m_bApplyIC; } 1593 Void xSetApplyIC(); 1594 Void setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; } 1595 Bool getIcSkipParseFlag() { return m_icSkipParseFlag; } 1584 1596 #endif 1585 1597 Void setReferenced(Bool b) { m_bRefenced = b; } -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibCommon/TypeDef.h
r465 r468 92 92 #define H_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D0177 93 93 #define H_3D_FIX 1 // Temporary for minor fixes 94 #define H_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060 95 // Unifying rounding offset, for IC part, JCT3V-D0135 96 // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC 94 97 #endif 95 98 -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecCAVLC.cpp
r464 r468 1428 1428 rpcSlice->initWpScaling(); 1429 1429 } 1430 #if H_3D_IC 1431 else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) ) 1432 { 1433 UInt uiCodeTmp = 0; 1434 1435 READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" ); 1436 rpcSlice->setApplyIC( uiCodeTmp ); 1437 1438 if ( uiCodeTmp ) 1439 { 1440 READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" ); 1441 rpcSlice->setIcSkipParseFlag( uiCodeTmp ); 1442 } 1443 } 1444 #endif 1430 1445 if (!rpcSlice->isIntra()) 1431 1446 { … … 1884 1899 #endif 1885 1900 1901 #if H_3D_IC 1902 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1903 { 1904 assert(0); 1905 } 1906 #endif 1907 1886 1908 // ==================================================================================================================== 1887 1909 // Protected member functions -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecCAVLC.h
r464 r468 102 102 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 103 103 #endif 104 #if H_3D_IC 105 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 106 #endif 104 107 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 105 108 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecCu.cpp
r464 r468 347 347 } 348 348 } 349 #if H_3D_IC 350 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 351 #endif 349 352 #if H_3D_ARP 350 353 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); … … 373 376 // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) 374 377 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); 378 #if H_3D_IC 379 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 380 #endif 375 381 #if H_3D_ARP 376 382 m_pcEntropyDecoder->decodeARPW ( pcCU , uiAbsPartIdx , uiDepth ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecEntropy.cpp
r464 r468 106 106 #endif 107 107 108 #if H_3D_IC 109 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 110 { 111 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 112 113 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) ) 114 { 115 return; 116 } 117 118 if( !pcCU->getSlice()->getApplyIC() ) 119 return; 120 121 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 122 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 123 } 124 #endif 125 108 126 Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 109 127 { -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecEntropy.h
r464 r468 88 88 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 89 89 #endif 90 #if H_3D_IC 91 virtual Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 92 #endif 90 93 virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 91 94 virtual Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 160 163 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 161 164 #endif 165 #if H_3D_IC 166 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 167 #endif 162 168 163 169 Void decodeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecSbac.cpp
r464 r468 57 57 , m_cCUPUARPW ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) 58 58 #endif 59 #if H_3D_IC 60 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 61 #endif 59 62 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 60 63 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 119 122 m_cCUPUARPW.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); 120 123 #endif 124 #if H_3D_IC 125 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); 126 #endif 121 127 m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); 122 128 m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); … … 166 172 #if H_3D_ARP 167 173 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 174 #endif 175 #if H_3D_IC 176 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 168 177 #endif 169 178 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); … … 1582 1591 } 1583 1592 #endif 1593 1594 #if H_3D_IC 1595 /** parse illumination compensation flag 1596 * \param pcCU 1597 * \param uiAbsPartIdx 1598 * \param uiDepth 1599 * \returns Void 1600 */ 1601 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1602 { 1603 UInt uiSymbol = 0; 1604 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); 1605 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 1606 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 1607 DTRACE_CABAC_T( "\tICFlag" ); 1608 DTRACE_CABAC_T( "\tuiCtxIC: "); 1609 DTRACE_CABAC_V( uiCtxIC ); 1610 DTRACE_CABAC_T( "\tuiSymbol: "); 1611 DTRACE_CABAC_V( uiSymbol ); 1612 DTRACE_CABAC_T( "\n"); 1613 1614 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 1615 } 1616 #endif 1617 1584 1618 //! \} -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibDecoder/TDecSbac.h
r464 r468 111 111 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 112 112 #endif 113 #if H_3D_IC 114 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 115 #endif 113 116 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 114 117 Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 151 154 ContextModel3DBuffer m_cCUPUARPW; 152 155 #endif 156 #if H_3D_IC 157 ContextModel3DBuffer m_cCUICFlagSCModel; 158 #endif 153 159 ContextModel3DBuffer m_cCUPartSizeSCModel; 154 160 ContextModel3DBuffer m_cCUPredModeSCModel; -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncCavlc.cpp
r464 r468 1086 1086 xCodePredWeightTable( pcSlice ); 1087 1087 } 1088 #if H_3D_IC 1089 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) ) 1090 { 1091 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" ); 1092 if( pcSlice->getApplyIC() ) 1093 { 1094 WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "ic_skip_mergeidx0" ); 1095 } 1096 } 1097 #endif 1088 1098 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS); 1089 1099 if (!pcSlice->isIntra()) … … 1371 1381 #endif 1372 1382 1383 #if H_3D_IC 1384 Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1385 { 1386 assert(0); 1387 } 1388 #endif 1389 1373 1390 Void TEncCavlc::codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ) 1374 1391 { -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncCavlc.h
r464 r468 117 117 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 118 118 #endif 119 #if H_3D_IC 120 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 121 #endif 119 122 120 123 Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncCfg.h
r464 r468 399 399 UInt m_uiARPStepNum; 400 400 #endif 401 402 #if H_3D_IC 403 Bool m_bUseIC; 404 #endif 401 405 #endif 402 406 … … 481 485 #endif 482 486 487 #if H_3D_IC 488 Void setUseIC ( Bool bVal ) { m_bUseIC = bVal; } 489 Bool getUseIC () { return m_bUseIC; } 490 #endif 483 491 //======== Transform ============= 484 492 Void setQuadtreeTULog2MaxSize ( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncCu.cpp
r465 r468 457 457 } 458 458 #endif 459 459 #if H_3D_IC 460 Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ); 461 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC(); 462 #endif 460 463 // If slice start or slice end is within this cu... 461 464 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); … … 513 516 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 514 517 { 518 #if H_3D_IC 519 for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ ) 520 { 521 Bool bICFlag = uiICId ? true : false; 522 #endif 515 523 // 2Nx2N 516 524 if(m_pcEncCfg->getUseEarlySkipDetection()) 517 525 { 526 #if H_3D_IC 527 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 528 #endif 518 529 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N 519 530 } 520 531 // SKIP 532 #if H_3D_IC 533 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 534 #endif 521 535 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 522 536 rpcTempCU->initEstData( uiDepth, iQP ); … … 538 552 if ( !bEarlySkip ) 539 553 { 554 #if H_3D_IC 555 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 556 #endif 540 557 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP ); 541 558 if(m_pcEncCfg->getUseCbfFastMode()) … … 545 562 } 546 563 } 564 #if H_3D_IC 565 } 566 #endif 547 567 } 548 568 … … 1245 1265 { 1246 1266 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx ); 1267 #if H_3D_IC 1268 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 1269 #endif 1247 1270 #if H_3D_ARP 1248 1271 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); … … 1269 1292 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1270 1293 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1294 #if H_3D_IC 1295 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 1296 #endif 1271 1297 #if H_3D_ARP 1272 1298 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); … … 1299 1325 } 1300 1326 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1301 1327 #if H_3D_IC 1328 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1329 #endif 1302 1330 #if H_3D_VSO // M1 //nececcary here? 1303 1331 if( m_pcRdCost->getUseRenModel() ) … … 1348 1376 { 1349 1377 { 1378 #if H_3D_IC 1379 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) 1380 { 1381 if( bICFlag && uiMergeCand == 0 ) 1382 { 1383 continue; 1384 } 1385 } 1386 #endif 1350 1387 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1351 1388 { … … 1357 1394 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth ); 1358 1395 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1396 #if H_3D_IC 1397 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1398 #endif 1359 1399 #if H_3D_ARP 1360 1400 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncEntropy.cpp
r464 r468 157 157 } 158 158 159 #if H_3D_IC 160 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 161 { 162 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) ) 163 { 164 return; 165 } 166 167 if( !pcCU->getSlice()->getApplyIC() ) 168 return; 169 170 if( bRD ) 171 { 172 uiAbsPartIdx = 0; 173 } 174 175 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 176 m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx ); 177 } 178 #endif 179 159 180 #if H_3D_ARP 160 181 Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncEntropy.h
r464 r468 90 90 #if H_3D_ARP 91 91 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 92 #endif 93 #if H_3D_IC 94 virtual Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 92 95 #endif 93 96 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 175 178 Void encodeARPW ( TComDataCU* pcCU, UInt uiAbspartIdx ); 176 179 #endif 180 #if H_3D_IC 181 Void encodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 182 #endif 177 183 Void encodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 178 184 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncSbac.cpp
r464 r468 63 63 , m_cCUPUARPW ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) 64 64 #endif 65 #if H_3D_IC 66 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 67 #endif 65 68 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 69 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 116 119 #if H_3D_ARP 117 120 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 121 #endif 122 #if H_3D_IC 123 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 118 124 #endif 119 125 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); … … 171 177 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 172 178 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); 179 #if H_3D_IC 180 curCost += m_cCUICFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_IC_FLAG ); 181 #endif 173 182 curCost += m_cCUPartSizeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PART_SIZE ); 174 183 curCost += m_cCUAMPSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_CU_AMP_POS ); … … 222 231 #if H_3D_ARP 223 232 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 233 #endif 234 #if H_3D_IC 235 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 224 236 #endif 225 237 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); … … 616 628 #endif 617 629 630 #if H_3D_IC 631 /** code Illumination Compensation flag 632 * \param pcCU 633 * \param uiAbsPartIdx 634 * \returns Void 635 */ 636 Void TEncSbac::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 637 { 638 // get context function is here 639 UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0; 640 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ) ; 641 m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 642 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 643 DTRACE_CABAC_T( "\tICFlag" ); 644 DTRACE_CABAC_T( "\tuiCtxIC: "); 645 DTRACE_CABAC_V( uiCtxIC ); 646 DTRACE_CABAC_T( "\tuiSymbol: "); 647 DTRACE_CABAC_V( uiSymbol ); 648 DTRACE_CABAC_T( "\n"); 649 } 650 #endif 651 652 618 653 Void TEncSbac::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 619 654 { -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncSbac.h
r464 r468 137 137 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 138 138 #endif 139 #if H_3D_IC 140 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 141 #endif 139 142 Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 140 143 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); … … 186 189 #if H_3D_ARP 187 190 ContextModel3DBuffer m_cCUPUARPW; 191 #endif 192 #if H_3D_IC 193 ContextModel3DBuffer m_cCUICFlagSCModel; 188 194 #endif 189 195 ContextModel3DBuffer m_cCUPartSizeSCModel; -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncSearch.cpp
r464 r468 317 317 318 318 piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 319 319 #if H_3D_IC 320 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 321 #endif 320 322 //-- jclee for using the SAD function pointer 321 323 m_pcRdCost->setDistParam( pcPatternKey, piRefSrch, rcStruct.iYStride, m_cDistParam ); … … 744 746 745 747 setDistParamComp(0); // Y component 746 748 #if H_3D_IC 749 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 750 #endif 747 751 m_cDistParam.pCur = piRefPos; 748 752 m_cDistParam.bitDepth = g_bitDepthY; … … 3147 3151 #else 3148 3152 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 3153 #endif 3154 #if H_3D_IC 3155 cDistParam.bUseIC = false; 3149 3156 #endif 3150 3157 ruiErr = cDistParam.DistFunc( &cDistParam ); … … 4235 4242 pcCU->clipMv( cMvCand ); 4236 4243 4244 #if H_3D_IC 4245 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() ); 4246 #endif 4247 4237 4248 // prediction pattern 4238 4249 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) … … 4242 4253 else 4243 4254 { 4244 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false ); 4255 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false 4256 #if H_3D_IC 4257 , bICFlag 4258 #endif 4259 ); 4245 4260 } 4246 4261 … … 4295 4310 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4296 4311 4312 #if H_3D_IC 4313 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getViewIndex() ); 4314 pcPatternKey->setICFlag( bICFlag ); 4315 #endif 4316 4297 4317 if ( bBi ) 4298 4318 { … … 4327 4347 4328 4348 m_pcRdCost->setPredictor ( *pcMvPred ); 4349 #if H_3D_IC 4350 if( pcCU->getSlice()->getIsDepth() ) 4351 m_pcRdCost->setCostScale ( 0 ); 4352 else 4353 #endif 4329 4354 m_pcRdCost->setCostScale ( 2 ); 4330 4355 … … 4342 4367 4343 4368 m_pcRdCost->getMotionCost( 1, 0 ); 4369 #if H_3D_IC 4370 if( ! pcCU->getSlice()->getIsDepth() ) 4371 { 4372 #endif 4344 4373 m_pcRdCost->setCostScale ( 1 ); 4345 4374 … … 4356 4385 rcMv += (cMvHalf <<= 1); 4357 4386 rcMv += cMvQter; 4387 #if H_3D_IC 4388 } 4389 #endif 4358 4390 4359 4391 UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() ); 4360 4392 #if H_3D_IC 4393 if( pcCU->getSlice()->getIsDepth() ) 4394 ruiCost += m_pcRdCost->getCost( uiMvBits ); 4395 #endif 4361 4396 ruiBits += uiMvBits; 4362 4397 ruiCost = (UInt)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) ); … … 4367 4402 { 4368 4403 Int iMvShift = 2; 4404 #if H_3D_IC 4405 if( pcCU->getSlice()->getIsDepth() ) 4406 iMvShift = 0; 4407 #endif 4369 4408 TComMv cTmpMvPred = cMvPred; 4370 4409 pcCU->clipMv( cTmpMvPred ); … … 4418 4457 4419 4458 setDistParamComp(0); 4420 4459 #if H_3D_IC 4460 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 4461 #endif 4421 4462 m_cDistParam.bitDepth = g_bitDepthY; 4422 4463 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); … … 4469 4510 UInt uiSearchRange = m_iSearchRange; 4470 4511 pcCU->clipMv( rcMv ); 4512 #if H_3D_IC 4513 if( ! pcCU->getSlice()->getIsDepth() ) 4514 #endif 4471 4515 rcMv >>= 2; 4472 4516 // init TZSearchStruct … … 4486 4530 TComMv cMv = m_acMvPredictors[index]; 4487 4531 pcCU->clipMv( cMv ); 4532 #if H_3D_IC 4533 if( ! pcCU->getSlice()->getIsDepth() ) 4534 #endif 4488 4535 cMv >>= 2; 4489 4536 xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 ); … … 4741 4788 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 4742 4789 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true ); 4790 #if H_3D_IC 4791 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 4792 #endif 4743 4793 #if H_3D_ARP 4744 4794 m_pcEntropyCoder->encodeARPW( pcCU, 0 ); … … 6152 6202 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 6153 6203 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true); 6204 #if H_3D_IC 6205 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 6206 #endif 6154 6207 #if H_3D_ARP 6155 6208 m_pcEntropyCoder->encodeARPW( pcCU, 0 ); … … 6168 6221 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 6169 6222 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 6223 #if H_3D_IC 6224 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 6225 #endif 6170 6226 #if H_3D_ARP 6171 6227 m_pcEntropyCoder->encodeARPW( pcCU , 0 ); -
branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncSlice.cpp
r446 r468 189 189 rpcSlice->setPicOutputFlag( true ); 190 190 rpcSlice->setPOC( pocCurr ); 191 191 #if H_3D_IC 192 rpcSlice->setApplyIC( false ); 193 #endif 192 194 // depth computation based on GOP size 193 195 Int depth; … … 933 935 Int iNumSubstreams = 1; 934 936 UInt uiTilesAcross = 0; 935 937 #if H_3D_IC 938 if ( pcEncTop->getViewIndex() && pcEncTop->getUseIC() ) // DCP of ViewID 0 is not available 939 { 940 pcSlice ->xSetApplyIC(); 941 if ( pcSlice->getApplyIC() ) 942 { 943 pcSlice->setIcSkipParseFlag( pcSlice->getPOC() % m_pcCfg->getIntraPeriod() != 0 ); 944 } 945 } 946 #endif 936 947 if( m_pcCfg->getUseSBACRD() ) 937 948 {
Note: See TracChangeset for help on using the changeset viewer.