Changeset 459 in 3DVCSoftware for branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon
- Timestamp:
- 6 Jun 2013, 11:46:05 (11 years ago)
- Location:
- branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/ContextTables.h
r324 r459 97 97 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 98 98 99 #if H_3D_DIM 100 #define NUM_DEPTH_INTRA_MODE_CTX 8 ///< number of context models for depth intra modes 101 #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (DMM or RBC) 102 #define NUM_DDC_DATA_CTX 2 ///< number of context models for deltaDC data (DMM or RBC) 103 #if H_3D_DIM_DMM 104 #define NUM_DMM1_DATA_CTX 1 ///< number of context models for DMM1 data 105 #define NUM_DMM2_DATA_CTX 1 ///< number of context models for DMM2 data 106 #define NUM_DMM3_DATA_CTX 1 ///< number of context models for DMM3 data 107 #endif 108 #if H_3D_DIM_RBC 109 #define NUM_RBC_DATA_CTX 1 ///< number of context models for RBC data 110 #endif 111 #endif 112 99 113 // ==================================================================================================================== 100 114 // Tables … … 334 348 { 139, 139}, 335 349 }; 350 351 #if H_3D_DIM 352 static const UChar 353 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] = 354 { 355 {0, 0, 64, 0, CNU, 0, CNU, 0}, 356 {0, 64, 0, CNU, 0, CNU, 0, 0}, 357 {64, 0, CNU, 0, CNU, 0, 0, 0} 358 }; 359 static const UChar 360 INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] = 361 { 362 {0 , CNU}, 363 {0 , CNU}, 364 {64, CNU} 365 }; 366 static const UChar 367 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] = 368 { 369 { CNU, CNU }, 370 { CNU, CNU }, 371 { CNU, CNU }, 372 }; 373 #if H_3D_DIM_DMM 374 static const UChar 375 INIT_DMM1_DATA[3][NUM_DMM1_DATA_CTX] = 376 { 377 { CNU }, 378 { CNU }, 379 { CNU }, 380 }; 381 static const UChar 382 INIT_DMM2_DATA[3][NUM_DMM2_DATA_CTX] = 383 { 384 { CNU }, 385 { CNU }, 386 { CNU }, 387 }; 388 static const UChar 389 INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] = 390 { 391 { CNU }, 392 { CNU }, 393 { CNU }, 394 }; 395 #endif 396 #if H_3D_DIM_RBC 397 static const UChar 398 INIT_RBC_DATA[3][NUM_RBC_DATA_CTX] = 399 { 400 { CNU }, 401 { CNU }, 402 { CNU }, 403 }; 404 #endif 405 #endif 336 406 //! \} 337 407 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComDataCU.cpp
r446 r459 109 109 m_apiMVPNum[1] = NULL; 110 110 111 #if H_3D_DIM 112 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 113 { 114 m_dimDeltaDC[i][0] = NULL; 115 m_dimDeltaDC[i][1] = NULL; 116 } 117 #if H_3D_DIM_DMM 118 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 119 { 120 m_dmmWedgeTabIdx[i] = NULL; 121 } 122 m_dmm2DeltaEnd = NULL; 123 m_dmm3IntraTabIdx = NULL; 124 #endif 125 #if H_3D_DIM_RBC 126 m_pucEdgeCode = NULL; 127 m_pucEdgeNumber = NULL; 128 m_pucEdgeStartPos = NULL; 129 m_pbEdgeLeftFirst = NULL; 130 m_pbEdgePartition = NULL; 131 #endif 132 #endif 133 111 134 m_bDecSubCu = false; 112 135 m_sliceStartCU = 0; … … 202 225 m_acCUMvField[1].create( uiNumPartition ); 203 226 227 #if H_3D_DIM 228 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 229 { 230 m_dimDeltaDC[i][0] = (Pel* )xMalloc(Pel, uiNumPartition); 231 m_dimDeltaDC[i][1] = (Pel* )xMalloc(Pel, uiNumPartition); 232 } 233 #if H_3D_DIM_DMM 234 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 235 { 236 m_dmmWedgeTabIdx[i] = (UInt*)xMalloc(UInt, uiNumPartition); 237 } 238 m_dmm2DeltaEnd = (Int* )xMalloc(Int, uiNumPartition); 239 m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); 240 #endif 241 #if H_3D_DIM_RBC 242 m_pucEdgeCode = (UChar*)xMalloc(UChar, uiNumPartition * RBC_MAX_EDGE_NUM_PER_4x4); 243 m_pucEdgeNumber = (UChar*)xMalloc(UChar, uiNumPartition); 244 m_pucEdgeStartPos = (UChar*)xMalloc(UChar, uiNumPartition); 245 m_pbEdgeLeftFirst = (Bool*)xMalloc(Bool, uiNumPartition); 246 m_pbEdgePartition = (Bool*)xMalloc(Bool, uiNumPartition * 16); 247 #endif 248 #endif 204 249 } 205 250 else … … 288 333 m_acCUMvField[1].destroy(); 289 334 335 #if H_3D_DIM 336 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 337 { 338 if ( m_dimDeltaDC[i][0] ) { xFree( m_dimDeltaDC[i][0] ); m_dimDeltaDC[i][0] = NULL; } 339 if ( m_dimDeltaDC[i][1] ) { xFree( m_dimDeltaDC[i][1] ); m_dimDeltaDC[i][1] = NULL; } 340 } 341 #if H_3D_DIM_DMM 342 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 343 { 344 if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; } 345 } 346 if ( m_dmm2DeltaEnd ) { xFree( m_dmm2DeltaEnd ); m_dmm2DeltaEnd = NULL; } 347 if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; } 348 #endif 349 #if H_3D_DIM_RBC 350 if ( m_pbEdgeLeftFirst ) { xFree( m_pbEdgeLeftFirst ); m_pbEdgeLeftFirst = NULL; } 351 if ( m_pucEdgeStartPos ) { xFree( m_pucEdgeStartPos ); m_pucEdgeStartPos = NULL; } 352 if ( m_pucEdgeNumber ) { xFree( m_pucEdgeNumber ); m_pucEdgeNumber = NULL; } 353 if ( m_pucEdgeCode ) { xFree( m_pucEdgeCode ); m_pucEdgeCode = NULL; } 354 if ( m_pbEdgePartition ) { xFree( m_pbEdgePartition ); m_pbEdgePartition = NULL; } 355 #endif 356 #endif 290 357 } 291 358 … … 447 514 memset( m_puhCbf[2] + firstElement, 0, numElements * sizeof( *m_puhCbf[2] ) ); 448 515 memset( m_pbIPCMFlag + firstElement, false, numElements * sizeof( *m_pbIPCMFlag ) ); 516 517 #if H_3D_DIM 518 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 519 { 520 memset( m_dimDeltaDC[i][0] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][0] ) ); 521 memset( m_dimDeltaDC[i][1] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][1] ) ); 522 } 523 #if H_3D_DIM_DMM 524 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 525 { 526 memset( m_dmmWedgeTabIdx[i] + firstElement, 0, numElements * sizeof( *m_dmmWedgeTabIdx[i] ) ); 527 } 528 memset( m_dmm2DeltaEnd + firstElement, 0, numElements * sizeof( *m_dmm2DeltaEnd ) ); 529 memset( m_dmm3IntraTabIdx + firstElement, 0, numElements * sizeof( *m_dmm3IntraTabIdx ) ); 530 #endif 531 #if H_3D_DIM_RBC 532 memset( m_pucEdgeCode + firstElement, 0, numElements * sizeof( *m_pucEdgeCode ) * RBC_MAX_EDGE_NUM_PER_4x4 ); 533 memset( m_pucEdgeNumber + firstElement, 0, numElements * sizeof( *m_pucEdgeNumber ) ); 534 memset( m_pucEdgeStartPos + firstElement, 0, numElements * sizeof( *m_pucEdgeStartPos ) ); 535 memset( m_pbEdgeLeftFirst + firstElement, false, numElements * sizeof( *m_pbEdgeLeftFirst ) ); 536 memset( m_pbEdgePartition + firstElement, false, numElements * sizeof( *m_pbEdgePartition ) * 16 ); 537 #endif 538 #endif 449 539 } 450 540 … … 582 672 m_puhCbf[1][ui] = 0; 583 673 m_puhCbf[2][ui] = 0; 674 675 #if H_3D_DIM 676 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 677 { 678 m_dimDeltaDC[i][0] [ui] = 0; 679 m_dimDeltaDC[i][1] [ui] = 0; 680 } 681 #if H_3D_DIM_DMM 682 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 683 { 684 m_dmmWedgeTabIdx[i] [ui] = 0; 685 } 686 m_dmm2DeltaEnd [ui] = 0; 687 m_dmm3IntraTabIdx [ui] = 0; 688 #endif 689 #endif 584 690 } 585 691 } … … 658 764 memset( m_puhHeight, uhHeight, iSizeInUchar ); 659 765 memset( m_pbIPCMFlag, 0, iSizeInBool ); 766 767 #if H_3D_DIM 768 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 769 { 770 memset( m_dimDeltaDC[i][0], 0, sizeof(Pel ) * m_uiNumPartition ); 771 memset( m_dimDeltaDC[i][1], 0, sizeof(Pel ) * m_uiNumPartition ); 772 } 773 #if H_3D_DIM_DMM 774 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 775 { 776 memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition ); 777 } 778 memset( m_dmm2DeltaEnd , 0, sizeof(Int ) * m_uiNumPartition ); 779 memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition ); 780 #endif 781 #if H_3D_DIM_RBC 782 memset( m_pucEdgeCode , 0, iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 ); 783 memset( m_pucEdgeNumber , 0, iSizeInUchar ); 784 memset( m_pucEdgeStartPos, 0, iSizeInUchar ); 785 memset( m_pbEdgeLeftFirst, 0, iSizeInBool ); 786 memset( m_pbEdgePartition, 0, iSizeInBool * 16 ); 787 #endif 788 #endif 789 660 790 for (UInt ui = 0; ui < m_uiNumPartition; ui++) 661 791 { … … 696 826 m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui]; 697 827 828 #if H_3D_DIM 829 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 830 { 831 m_dimDeltaDC[i][0] [ui] = pcCU->m_dimDeltaDC[i][0] [uiPartOffset+ui]; 832 m_dimDeltaDC[i][1] [ui] = pcCU->m_dimDeltaDC[i][1] [uiPartOffset+ui]; 833 } 834 #if H_3D_DIM_DMM 835 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 836 { 837 m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui]; 838 } 839 m_dmm2DeltaEnd [ui] = pcCU->m_dmm2DeltaEnd [uiPartOffset+ui]; 840 m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui]; 841 #endif 842 #endif 698 843 } 699 844 } … … 815 960 m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V) + uiPart; 816 961 962 #if H_3D_DIM 963 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 964 { 965 m_dimDeltaDC[i][0] = pcCU->getDimDeltaDC( i, 0 ) + uiPart; 966 m_dimDeltaDC[i][1] = pcCU->getDimDeltaDC( i, 1 ) + uiPart; 967 } 968 #if H_3D_DIM_DMM 969 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 970 { 971 m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart; 972 } 973 m_dmm2DeltaEnd = pcCU->getDmm2DeltaEnd() + uiPart; 974 m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart; 975 #endif 976 #if H_3D_DIM_RBC 977 m_pucEdgeCode = pcCU->getEdgeCode( uiPart ); 978 m_pucEdgeNumber = pcCU->getEdgeNumber() + uiPart; 979 m_pucEdgeStartPos = pcCU->getEdgeStartPos() + uiPart; 980 m_pbEdgeLeftFirst = pcCU->getEdgeLeftFirst() + uiPart; 981 m_pbEdgePartition = pcCU->getEdgePartition( uiPart ); 982 #endif 983 #endif 984 817 985 m_puhDepth=pcCU->getDepth() + uiPart; 818 986 m_puhWidth=pcCU->getWidth() + uiPart; … … 942 1110 memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar ); 943 1111 1112 #if H_3D_DIM 1113 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 1114 { 1115 memcpy( m_dimDeltaDC[i][0] + uiOffset, pcCU->getDimDeltaDC( i, 0 ), sizeof(Pel ) * uiNumPartition ); 1116 memcpy( m_dimDeltaDC[i][1] + uiOffset, pcCU->getDimDeltaDC( i, 1 ), sizeof(Pel ) * uiNumPartition ); 1117 } 1118 #if H_3D_DIM_DMM 1119 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1120 { 1121 memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition ); 1122 } 1123 memcpy( m_dmm2DeltaEnd + uiOffset, pcCU->getDmm2DeltaEnd() , sizeof(Int ) * uiNumPartition ); 1124 memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition ); 1125 #endif 1126 #if H_3D_DIM_RBC 1127 memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 ); 1128 memcpy( getEdgeNumber() + uiOffset, pcCU->getEdgeNumber(), iSizeInUchar ); 1129 memcpy( getEdgeStartPos() + uiOffset, pcCU->getEdgeStartPos(), iSizeInUchar ); 1130 memcpy( getEdgeLeftFirst() + uiOffset, pcCU->getEdgeLeftFirst(), iSizeInBool ); 1131 memcpy( getEdgePartition( uiOffset ), pcCU->getEdgePartition(0), iSizeInBool * 16 ); 1132 #endif 1133 #endif 1134 944 1135 memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); 945 1136 memcpy( m_puhWidth + uiOffset, pcCU->getWidth(), iSizeInUchar ); … … 1022 1213 memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar ); 1023 1214 1215 #if H_3D_DIM 1216 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 1217 { 1218 memcpy( rpcCU->getDimDeltaDC( i, 0 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][0], sizeof(Pel ) * m_uiNumPartition ); 1219 memcpy( rpcCU->getDimDeltaDC( i, 1 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][1], sizeof(Pel ) * m_uiNumPartition ); 1220 } 1221 #if H_3D_DIM_DMM 1222 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1223 { 1224 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition ); 1225 } 1226 memcpy( rpcCU->getDmm2DeltaEnd() + m_uiAbsIdxInLCU, m_dmm2DeltaEnd , sizeof(Int ) * m_uiNumPartition ); 1227 memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition ); 1228 #endif 1229 #if H_3D_DIM_RBC 1230 memcpy( rpcCU->getEdgeCode( m_uiAbsIdxInLCU ), m_pucEdgeCode, iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 ); 1231 memcpy( rpcCU->getEdgeNumber() + m_uiAbsIdxInLCU, m_pucEdgeNumber, iSizeInUchar ); 1232 memcpy( rpcCU->getEdgeStartPos() + m_uiAbsIdxInLCU, m_pucEdgeStartPos, iSizeInUchar ); 1233 memcpy( rpcCU->getEdgeLeftFirst() + m_uiAbsIdxInLCU, m_pbEdgeLeftFirst, iSizeInBool ); 1234 memcpy( rpcCU->getEdgePartition( m_uiAbsIdxInLCU ), m_pbEdgePartition, iSizeInBool * 16 ); 1235 #endif 1236 #endif 1237 1024 1238 memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); 1025 1239 memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); … … 1093 1307 memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar ); 1094 1308 1309 #if H_3D_DIM 1310 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1311 { 1312 memcpy( rpcCU->getDimDeltaDC( i, 0 ) + uiPartOffset, m_dimDeltaDC[i][0], sizeof(Pel ) * uiQNumPart ); 1313 memcpy( rpcCU->getDimDeltaDC( i, 1 ) + uiPartOffset, m_dimDeltaDC[i][1], sizeof(Pel ) * uiQNumPart ); 1314 } 1315 #if H_3D_DIM_DMM 1316 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1317 { 1318 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart ); 1319 } 1320 memcpy( rpcCU->getDmm2DeltaEnd() + uiPartOffset, m_dmm2DeltaEnd , sizeof(Int ) * uiQNumPart ); 1321 memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart ); 1322 #endif 1323 #if H_3D_DIM_RBC 1324 memcpy( rpcCU->getEdgeCode( uiPartOffset ), m_pucEdgeCode, iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 ); 1325 memcpy( rpcCU->getEdgeNumber() + uiPartOffset, m_pucEdgeNumber, iSizeInUchar ); 1326 memcpy( rpcCU->getEdgeStartPos() + uiPartOffset, m_pucEdgeStartPos, iSizeInUchar ); 1327 memcpy( rpcCU->getEdgeLeftFirst() + uiPartOffset, m_pbEdgeLeftFirst, iSizeInBool ); 1328 memcpy( rpcCU->getEdgePartition( uiPartOffset ), m_pbEdgePartition, iSizeInBool * 16 ); 1329 #endif 1330 #endif 1331 1095 1332 memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); 1096 1333 memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); … … 1648 1885 1649 1886 iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 1887 #if H_3D_DIM 1888 mapDepthModeToIntraDir( iLeftIntraDir ); 1889 #endif 1650 1890 1651 1891 // Get intra direction of above PU … … 1653 1893 1654 1894 iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 1895 #if H_3D_DIM 1896 mapDepthModeToIntraDir( iAboveIntraDir ); 1897 #endif 1655 1898 1656 1899 uiPredNum = 3; … … 3437 3680 { 3438 3681 uiDirMode = getLumaIntraDir(uiAbsPartIdx); 3682 #if H_3D_DIM 3683 mapDepthModeToIntraDir( uiDirMode ); 3684 #endif 3439 3685 uiScanIdx = SCAN_DIAG; 3440 3686 if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for transform size … … 3454 3700 // get luma mode from upper-left corner of current CU 3455 3701 uiDirMode = getLumaIntraDir((uiAbsPartIdx/numParts)*numParts); 3702 #if H_3D_DIM 3703 mapDepthModeToIntraDir( uiDirMode ); 3704 #endif 3456 3705 } 3457 3706 uiScanIdx = SCAN_DIAG; … … 3845 4094 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 3846 4095 } 4096 #if H_3D_DIM_DMM 4097 Void TComDataCU::setDmmWedgeTabIdxSubParts( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ) 4098 { 4099 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 4100 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; } 4101 } 4102 Void TComDataCU::setDmm2DeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ) 4103 { 4104 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 4105 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm2DeltaEnd[uiAbsPartIdx+ui] = iDelta; } 4106 } 4107 Void TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) 4108 { 4109 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 4110 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; } 4111 } 4112 #endif 4113 #if H_3D_DIM_RBC 4114 Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ) 4115 { 4116 Int iWidth; 4117 Int iHeight; 4118 if( uiDepth == 0 ) 4119 { 4120 iWidth = 64; 4121 iHeight = 64; 4122 } 4123 else if( uiDepth == 1 ) 4124 { 4125 iWidth = 32; 4126 iHeight = 32; 4127 } 4128 else if( uiDepth == 2 ) 4129 { 4130 iWidth = 16; 4131 iHeight = 16; 4132 } 4133 else if( uiDepth == 3 ) 4134 { 4135 iWidth = 8; 4136 iHeight = 8; 4137 } 4138 else // uiDepth == 4 4139 { 4140 iWidth = 4; 4141 iHeight = 4; 4142 } 4143 4144 Int iPtr = 0; 4145 Int iX, iY; 4146 Int iDir = -1; 4147 Int iDiffX = 0, iDiffY = 0; 4148 4149 // 1. Edge Code -> Vert & Horz Edges 4150 Bool* pbEdge = (Bool*) xMalloc( Bool, 4 * iWidth * iHeight ); 4151 4152 for( UInt ui = 0; ui < 4 * iWidth * iHeight; ui++ ) 4153 pbEdge [ ui ] = false; 4154 4155 // Direction : left(0), right(1), top(2), bottom(3), left-top(4), right-top(5), left-bottom(6), right-bottom(7) 4156 // Code : 0deg(0), 45deg(1), -45deg(2), 90deg(3), -90deg(4), 135deg(5), -135deg(6) 4157 const UChar tableDir[8][7] = { { 0, 6, 4, 3, 2, 7, 5 }, 4158 { 1, 5, 7, 2, 3, 4, 6 }, 4159 { 2, 4, 5, 0, 1, 6, 7 }, 4160 { 3, 7, 6, 1, 0, 5, 4 }, 4161 { 4, 0, 2, 6, 5, 3, 1 }, 4162 { 5, 2, 1, 4, 7, 0, 3 }, 4163 { 6, 3, 0, 7, 4, 1, 2 }, 4164 { 7, 1, 3, 5, 6, 2, 0 }}; 4165 4166 UChar ucCode = pucEdgeCode[iPtr++]; 4167 4168 if( !bLeft ) 4169 { 4170 iX = ucStartPos; 4171 iY = 0; 4172 4173 switch(ucCode) 4174 { 4175 case 0: // bottom 4176 iDir = 3; 4177 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4178 break; 4179 case 2: // left-bottom 4180 iDir = 6; 4181 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4182 break; 4183 case 1: // right-bottom 4184 iDir = 7; 4185 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4186 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4187 break; 4188 case 4: // left 4189 iDir = 0; 4190 assert(false); 4191 break; 4192 case 3: // right 4193 iDir = 1; 4194 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4195 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4196 break; 4197 } 4198 } 4199 else 4200 { 4201 iX = 0; 4202 iY = ucStartPos; 4203 4204 switch(ucCode) 4205 { 4206 case 0: // right 4207 iDir = 1; 4208 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4209 break; 4210 case 1: // right-top 4211 iDir = 5; 4212 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4213 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4214 break; 4215 case 2: // right-bottom 4216 iDir = 7; 4217 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4218 break; 4219 case 3: // top 4220 iDir = 2; 4221 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4222 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4223 break; 4224 case 4: // bottom 4225 iDir = 3; 4226 assert(false); 4227 break; 4228 } 4229 } 4230 4231 switch( iDir ) 4232 { 4233 case 0: // left 4234 iDiffX = -1; 4235 iDiffY = 0; 4236 break; 4237 case 1: // right 4238 iDiffX = +1; 4239 iDiffY = 0; 4240 break; 4241 case 2: // top 4242 iDiffX = 0; 4243 iDiffY = -1; 4244 break; 4245 case 3: // bottom 4246 iDiffX = 0; 4247 iDiffY = +1; 4248 break; 4249 case 4: // left-top 4250 iDiffX = -1; 4251 iDiffY = -1; 4252 break; 4253 case 5: // right-top 4254 iDiffX = +1; 4255 iDiffY = -1; 4256 break; 4257 case 6: // left-bottom 4258 iDiffX = -1; 4259 iDiffY = +1; 4260 break; 4261 case 7: // right-bottom 4262 iDiffX = +1; 4263 iDiffY = +1; 4264 break; 4265 } 4266 4267 iX += iDiffX; 4268 iY += iDiffY; 4269 4270 while( iPtr < ucNumEdge ) 4271 { 4272 ucCode = pucEdgeCode[iPtr++]; 4273 4274 Int iNewDir = tableDir[iDir][ucCode]; 4275 4276 switch( iNewDir ) 4277 { 4278 case 0: // left 4279 iDiffX = -1; 4280 iDiffY = 0; 4281 break; 4282 case 1: // right 4283 iDiffX = +1; 4284 iDiffY = 0; 4285 break; 4286 case 2: // top 4287 iDiffX = 0; 4288 iDiffY = -1; 4289 break; 4290 case 3: // bottom 4291 iDiffX = 0; 4292 iDiffY = +1; 4293 break; 4294 case 4: // left-top 4295 iDiffX = -1; 4296 iDiffY = -1; 4297 break; 4298 case 5: // right-top 4299 iDiffX = +1; 4300 iDiffY = -1; 4301 break; 4302 case 6: // left-bottom 4303 iDiffX = -1; 4304 iDiffY = +1; 4305 break; 4306 case 7: // right-bottom 4307 iDiffX = +1; 4308 iDiffY = +1; 4309 break; 4310 } 4311 4312 switch( iDir ) 4313 { 4314 case 0: // left 4315 switch( ucCode ) 4316 { 4317 case 0: 4318 case 2: 4319 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4320 break; 4321 case 1: 4322 case 3: 4323 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4324 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4325 break; 4326 case 4: 4327 case 6: 4328 // no 4329 break; 4330 case 5: 4331 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4332 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4333 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4334 break; 4335 } 4336 break; 4337 case 1: // right 4338 switch( ucCode ) 4339 { 4340 case 0: 4341 case 2: 4342 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4343 break; 4344 case 1: 4345 case 3: 4346 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4347 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4348 break; 4349 case 4: 4350 case 6: 4351 // no 4352 break; 4353 case 5: 4354 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4355 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4356 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4357 break; 4358 } 4359 break; 4360 case 2: // top 4361 switch( ucCode ) 4362 { 4363 case 0: 4364 case 2: 4365 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4366 break; 4367 case 1: 4368 case 3: 4369 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4370 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4371 break; 4372 case 4: 4373 case 6: 4374 // no 4375 break; 4376 case 5: 4377 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4378 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4379 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4380 break; 4381 } 4382 break; 4383 case 3: // bottom 4384 switch( ucCode ) 4385 { 4386 case 0: 4387 case 2: 4388 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4389 break; 4390 case 1: 4391 case 3: 4392 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4393 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4394 break; 4395 case 4: 4396 case 6: 4397 // no 4398 break; 4399 case 5: 4400 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4401 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4402 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4403 break; 4404 } 4405 break; 4406 case 4: // left-top 4407 switch( ucCode ) 4408 { 4409 case 0: 4410 case 1: 4411 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4412 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4413 break; 4414 case 2: 4415 case 4: 4416 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4417 break; 4418 case 3: 4419 case 5: 4420 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4421 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4422 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4423 break; 4424 case 6: 4425 // no 4426 break; 4427 } 4428 break; 4429 case 5: // right-top 4430 switch( ucCode ) 4431 { 4432 case 0: 4433 case 1: 4434 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4435 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4436 break; 4437 case 2: 4438 case 4: 4439 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4440 break; 4441 case 3: 4442 case 5: 4443 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4444 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4445 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4446 break; 4447 case 6: 4448 // no 4449 break; 4450 } 4451 break; 4452 case 6: // left-bottom 4453 switch( ucCode ) 4454 { 4455 case 0: 4456 case 1: 4457 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4458 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4459 break; 4460 case 2: 4461 case 4: 4462 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4463 break; 4464 case 3: 4465 case 5: 4466 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 4467 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4468 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4469 break; 4470 case 6: 4471 // no 4472 break; 4473 } 4474 break; 4475 case 7: // right-bottom 4476 switch( ucCode ) 4477 { 4478 case 0: 4479 case 1: 4480 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4481 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4482 break; 4483 case 2: 4484 case 4: 4485 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4486 break; 4487 case 3: 4488 case 5: 4489 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 4490 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 4491 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 4492 break; 4493 case 6: 4494 // no 4495 break; 4496 } 4497 break; 4498 } 4499 4500 assert( iX >= 0 && iX <= iWidth ); 4501 assert( iY >= 0 && iY <= iHeight ); 4502 4503 iX += iDiffX; 4504 iY += iDiffY; 4505 iDir = iNewDir; 4506 } 4507 4508 // finalize edge chain 4509 if( iX == iWidth-1 ) 4510 { 4511 if( iY == 0 ) 4512 { 4513 if( iDir == 1 ) 4514 { 4515 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4516 } 4517 else if( iDir == 5 ) 4518 { 4519 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4520 } 4521 else 4522 { 4523 assert(false); 4524 } 4525 } 4526 else if( iY == iHeight-1 ) 4527 { 4528 if( iDir == 3 ) 4529 { 4530 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4531 } 4532 else if( iDir == 7 ) 4533 { 4534 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4535 } 4536 else 4537 { 4538 assert(false); 4539 } 4540 } 4541 else 4542 { 4543 if( iDir == 1 ) 4544 { 4545 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4546 } 4547 else if( iDir == 3 ) 4548 { 4549 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4550 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4551 } 4552 else if( iDir == 5 ) 4553 { 4554 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4555 } 4556 else if( iDir == 7 ) 4557 { 4558 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4559 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4560 } 4561 else 4562 { 4563 assert(false); 4564 } 4565 } 4566 } 4567 else if( iX == 0 ) 4568 { 4569 if( iY == 0 ) 4570 { 4571 if( iDir == 2 ) 4572 { 4573 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4574 } 4575 else if( iDir == 4 ) 4576 { 4577 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4578 } 4579 else 4580 { 4581 assert(false); 4582 } 4583 } 4584 else if( iY == iHeight-1 ) 4585 { 4586 if( iDir == 0 ) 4587 { 4588 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4589 } 4590 else if( iDir == 6 ) 4591 { 4592 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4593 } 4594 else 4595 { 4596 assert(false); 4597 } 4598 } 4599 else 4600 { 4601 if( iDir == 0 ) 4602 { 4603 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4604 } 4605 else if( iDir == 2 ) 4606 { 4607 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4608 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4609 } 4610 else if( iDir == 4 ) 4611 { 4612 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4613 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4614 } 4615 else if( iDir == 6 ) 4616 { 4617 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4618 } 4619 else 4620 { 4621 assert(false); 4622 } 4623 } 4624 } 4625 else if( iY == 0 ) 4626 { 4627 if( iDir == 1 ) 4628 { 4629 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4630 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4631 } 4632 else if( iDir == 2 ) 4633 { 4634 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4635 } 4636 else if( iDir == 4 ) 4637 { 4638 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4639 } 4640 else if( iDir == 5 ) 4641 { 4642 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 4643 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 4644 } 4645 else 4646 { 4647 assert(false); 4648 } 4649 } 4650 else if( iY == iHeight-1 ) 4651 { 4652 if( iDir == 0 ) 4653 { 4654 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4655 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4656 } 4657 else if( iDir == 3 ) 4658 { 4659 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4660 } 4661 else if( iDir == 6 ) 4662 { 4663 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 4664 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4665 } 4666 else if( iDir == 7 ) 4667 { 4668 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 4669 } 4670 else 4671 { 4672 assert(false); 4673 } 4674 } 4675 else 4676 { 4677 printf("reconPartiton: wrong termination\n"); 4678 assert(false); 4679 } 4680 4681 // Reconstruct Region from Chain Code 4682 Bool* pbVisit = (Bool*) xMalloc( Bool, iWidth * iHeight ); 4683 Int* piStack = (Int* ) xMalloc( Int, iWidth * iHeight ); 4684 4685 for( UInt ui = 0; ui < iWidth * iHeight; ui++ ) 4686 { 4687 pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next) 4688 pbVisit [ ui ] = false; 4689 } 4690 4691 iPtr = 0; 4692 piStack[iPtr++] = (0 << 8) | (0); 4693 pbRegion[ 0 ] = false; 4694 4695 while(iPtr > 0) 4696 { 4697 Int iTmp = piStack[--iPtr]; 4698 Int iX1, iY1; 4699 iX1 = iTmp & 0xff; 4700 iY1 = (iTmp >> 8) & 0xff; 4701 4702 pbVisit[ iX1 + iY1 * iWidth ] = true; 4703 4704 assert( iX1 >= 0 && iX1 < iWidth ); 4705 assert( iY1 >= 0 && iY1 < iHeight ); 4706 4707 if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] ) 4708 { 4709 piStack[iPtr++] = (iY1 << 8) | (iX1 - 1); 4710 pbRegion[ iX1 - 1 + iY1 * iWidth ] = false; 4711 } 4712 if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] ) 4713 { 4714 piStack[iPtr++] = (iY1 << 8) | (iX1 + 1); 4715 pbRegion[ iX1 + 1 + iY1 * iWidth ] = false; 4716 } 4717 if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] ) 4718 { 4719 piStack[iPtr++] = ((iY1 - 1) << 8) | iX1; 4720 pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false; 4721 } 4722 if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] ) 4723 { 4724 piStack[iPtr++] = ((iY1 + 1) << 8) | iX1; 4725 pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false; 4726 } 4727 } 4728 4729 xFree( pbEdge ); 4730 xFree( pbVisit ); 4731 xFree( piStack ); 4732 } 4733 #endif 3847 4734 #endif 3848 4735 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComDataCU.h
r446 r459 188 188 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 189 189 190 #if H_3D_DIM 191 Pel* m_dimDeltaDC[DIM_NUM_TYPE][2]; 192 #if H_3D_DIM_DMM 193 UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 194 Int* m_dmm2DeltaEnd; 195 UInt* m_dmm3IntraTabIdx; 196 #endif 197 #if H_3D_DIM_RBC 198 UChar* m_pucEdgeCode; ///< array of edge code 199 UChar* m_pucEdgeNumber; ///< total number of edge 200 UChar* m_pucEdgeStartPos; ///< starting point position 201 Bool* m_pbEdgeLeftFirst; ///< true if edge should be checked in left boundary first 202 Bool* m_pbEdgePartition; ///< true if it belongs to region 1, otherwise, region 0 203 #endif 204 #endif 205 190 206 // ------------------------------------------------------------------------------------------------------------------- 191 207 // misc. variables … … 406 422 ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary 407 423 ,Bool bIndependentTileBoundaryEnabled ); 424 425 #if H_3D_DIM 426 Pel* getDimDeltaDC ( UInt dimType, UInt segId ) { return m_dimDeltaDC[dimType][segId]; } 427 Pel getDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx ) { return m_dimDeltaDC[dimType][segId][uiIdx]; } 428 Void setDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val; } 429 #if H_3D_DIM_DMM 430 UInt* getDmmWedgeTabIdx ( UInt dmmType ) { return m_dmmWedgeTabIdx[dmmType]; } 431 UInt getDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx ) { return m_dmmWedgeTabIdx[dmmType][uiIdx]; } 432 Void setDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; } 433 Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ); 434 435 Int* getDmm2DeltaEnd () { return m_dmm2DeltaEnd; } 436 Int getDmm2DeltaEnd ( UInt uiIdx ) { return m_dmm2DeltaEnd[uiIdx]; } 437 Void setDmm2DeltaEnd ( UInt uiIdx, Int iD ) { m_dmm2DeltaEnd[uiIdx] = iD; } 438 Void setDmm2DeltaEndSubParts ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ); 439 440 UInt* getDmm3IntraTabIdx () { return m_dmm3IntraTabIdx; } 441 UInt getDmm3IntraTabIdx ( UInt uiIdx ) { return m_dmm3IntraTabIdx[uiIdx]; } 442 Void setDmm3IntraTabIdx ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh; } 443 Void setDmm3IntraTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); 444 #endif 445 #if H_3D_DIM_RBC 446 UChar* getEdgeCode( UInt uiIdx ) { return &m_pucEdgeCode[uiIdx * RBC_MAX_EDGE_NUM_PER_4x4]; } 447 448 UChar* getEdgeNumber( ) { return m_pucEdgeNumber; } 449 UChar getEdgeNumber( UInt uiIdx ) { return m_pucEdgeNumber[uiIdx]; } 450 Void setEdgeNumber( UInt uiIdx, UChar val ) { m_pucEdgeNumber[uiIdx] = val; } 451 452 UChar* getEdgeStartPos( ) { return m_pucEdgeStartPos; } 453 UChar getEdgeStartPos( UInt uiIdx ) { return m_pucEdgeStartPos[uiIdx]; } 454 Void setEdgeStartPos( UInt uiIdx, UChar val ) { m_pucEdgeStartPos[uiIdx] = val; } 455 456 Bool* getEdgeLeftFirst( ) { return m_pbEdgeLeftFirst; } 457 Bool getEdgeLeftFirst( UInt uiIdx ) { return m_pbEdgeLeftFirst[uiIdx]; } 458 Void setEdgeLeftFirst( UInt uiIdx, Bool val ) { m_pbEdgeLeftFirst[uiIdx] = val; } 459 460 Bool* getEdgePartition( UInt uiIdx ) { return &m_pbEdgePartition[uiIdx * 16]; } 461 462 Void reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ); 463 #endif 464 #endif 465 408 466 // ------------------------------------------------------------------------------------------------------------------- 409 467 // member functions for accessing partition information -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComPrediction.cpp
r446 r459 386 386 } 387 387 388 #if H_3D_DIM 389 Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc ) 390 { 391 assert( iWidth == iHeight ); 392 assert( iWidth >= DIM_MIN_SIZE && iWidth <= DIM_MAX_SIZE ); 393 assert( isDimMode( uiIntraMode ) ); 394 395 UInt dimType = getDimType ( uiIntraMode ); 396 Bool dimDeltaDC = isDimDeltaDC( uiIntraMode ); 397 Bool isDmmMode = (dimType < DMM_NUM_TYPE); 398 Bool isRbcMode = (dimType == RBC_IDX); 399 400 Bool* biSegPattern = NULL; 401 UInt patternStride = 0; 402 403 // get partiton 404 #if H_3D_DIM_DMM 405 TComWedgelet* dmmSegmentation = NULL; 406 if( isDmmMode ) 407 { 408 switch( dimType ) 409 { 410 case( DMM1_IDX ): 411 { 412 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]); 413 } break; 414 case( DMM2_IDX ): 415 { 416 UInt uiTabIdx = 0; 417 if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); } 418 else 419 { 420 uiTabIdx = xPredWedgeFromIntra( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm2DeltaEnd( uiAbsPartIdx ) ); 421 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) ); 422 } 423 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]); 424 } break; 425 case( DMM3_IDX ): 426 { 427 UInt uiTabIdx = 0; 428 if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); } 429 else 430 { 431 uiTabIdx = xPredWedgeFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm3IntraTabIdx( uiAbsPartIdx ) ); 432 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) ); 433 } 434 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]); 435 } break; 436 case( DMM4_IDX ): 437 { 438 dmmSegmentation = new TComWedgelet( iWidth, iHeight ); 439 xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation ); 440 } break; 441 default: assert(0); 442 } 443 assert( dmmSegmentation ); 444 biSegPattern = dmmSegmentation->getPattern(); 445 patternStride = dmmSegmentation->getStride (); 446 } 447 #endif 448 #if H_3D_DIM_RBC 449 if( isRbcMode ) 450 { 451 biSegPattern = pcCU->getEdgePartition( uiAbsPartIdx ); 452 patternStride = iWidth; 453 } 454 #endif 455 456 // get predicted partition values 457 assert( biSegPattern ); 458 Int* piMask = NULL; 459 if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM 460 else piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt ); 461 assert( piMask ); 462 Int maskStride = 2*iWidth + 1; 463 Int* ptrSrc = piMask+maskStride+1; 464 Pel predDC1 = 0; Pel predDC2 = 0; 465 xPredBiSegDCs( ptrSrc, maskStride, biSegPattern, patternStride, predDC1, predDC2 ); 466 467 // set segment values with deltaDC offsets 468 Pel segDC1 = 0; 469 Pel segDC2 = 0; 470 if( dimDeltaDC ) 471 { 472 Pel deltaDC1 = pcCU->getDimDeltaDC( dimType, 0, uiAbsPartIdx ); 473 Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx ); 474 #if H_3D_DIM_DMM 475 if( isDmmMode ) 476 { 477 #if H_3D_DIM_DLT 478 segDC1 = GetIdx2DepthValue( GetDepthValue2Idx( predDC1 ) + deltaDC1 ); 479 segDC2 = GetIdx2DepthValue( GetDepthValue2Idx( predDC2 ) + deltaDC2 ); 480 #else 481 segDC1 = ClipY( predDC1 + deltaDC1 ); 482 segDC2 = ClipY( predDC2 + deltaDC2 ); 483 #endif 484 } 485 #endif 486 #if H_3D_DIM_RBC 487 if( isRbcMode ) 488 { 489 xDeltaDCQuantScaleUp( pcCU, deltaDC1 ); 490 xDeltaDCQuantScaleUp( pcCU, deltaDC2 ); 491 segDC1 = ClipY( predDC1 + deltaDC1 ); 492 segDC2 = ClipY( predDC2 + deltaDC2 ); 493 } 494 #endif 495 } 496 else 497 { 498 segDC1 = predDC1; 499 segDC2 = predDC2; 500 } 501 502 // set prediction signal 503 Pel* pDst = piPred; 504 xAssignBiSegDCs( pDst, uiStride, biSegPattern, patternStride, segDC1, segDC2 ); 505 506 #if H_3D_DIM_DMM 507 if( dimType == DMM4_IDX ) { dmmSegmentation->destroy(); delete dmmSegmentation; } 508 #endif 509 } 510 #endif 511 388 512 /** Function for checking identical motion. 389 513 * \param TComDataCU* pcCU … … 758 882 return; 759 883 } 884 885 #if H_3D_DIM 886 Void TComPrediction::xPredBiSegDCs( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ) 887 { 888 Int refDC1, refDC2; 889 const Int iTR = ( patternStride - 1 ) - srcStride; 890 const Int iTM = ( ( patternStride - 1 ) >> 1 ) - srcStride; 891 const Int iLB = ( patternStride - 1 ) * srcStride - 1; 892 const Int iLM = ( ( patternStride - 1 ) >> 1 ) * srcStride - 1; 893 894 Bool bL = ( biSegPattern[0] != biSegPattern[(patternStride-1)*patternStride] ); 895 Bool bT = ( biSegPattern[0] != biSegPattern[(patternStride-1)] ); 896 897 if( bL == bT ) 898 { 899 refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : 1<<( g_bitDepthY - 1 ); 900 refDC2 = ( ptrSrc[ -1] + ptrSrc[-(Int)srcStride] )>>1; 901 } 902 else 903 { 904 refDC1 = bL ? ptrSrc[iLB] : ptrSrc[iTR]; 905 refDC2 = bL ? ptrSrc[iTM] : ptrSrc[iLM]; 906 } 907 908 predDC1 = biSegPattern[0] ? refDC1 : refDC2; 909 predDC2 = biSegPattern[0] ? refDC2 : refDC1; 910 } 911 912 Void TComPrediction::xAssignBiSegDCs( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ) 913 { 914 if( dstStride == patternStride ) 915 { 916 for( UInt k = 0; k < (patternStride * patternStride); k++ ) 917 { 918 if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; } 919 else { ptrDst[k] = valDC1; } 920 } 921 } 922 else 923 { 924 Pel* piTemp = ptrDst; 925 for( UInt uiY = 0; uiY < patternStride; uiY++ ) 926 { 927 for( UInt uiX = 0; uiX < patternStride; uiX++ ) 928 { 929 if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; } 930 else { piTemp[uiX] = valDC1; } 931 } 932 piTemp += dstStride; 933 biSegPattern += patternStride; 934 } 935 } 936 } 937 938 #if H_3D_DIM_DMM 939 UInt TComPrediction::xPredWedgeFromIntra( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd ) 940 { 941 UInt uiThisBlockSize = uiWidth; 942 943 TComDataCU* pcTempCU; 944 UInt uiTempPartIdx; 945 // 1st: try continue above wedgelet 946 pcTempCU = pcCU->getPUAbove( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx ); 947 if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) ) 948 { 949 UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ); 950 if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType ) 951 { 952 // get offset between current and reference block 953 UInt uiOffsetX = 0, uiOffsetY = 0; 954 xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY ); 955 956 // get reference wedgelet 957 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])]; 958 TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) ); 959 960 // find wedgelet, if direction is suitable for continue wedge 961 if( pcRefWedgelet->checkPredDirAbovePossible( uiThisBlockSize, uiOffsetX ) ) 962 { 963 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye; 964 pcRefWedgelet->getPredDirStartEndAbove( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetX, iDeltaEnd ); 965 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye ); 966 } 967 } 968 } 969 970 // 2nd: try continue left wedglelet 971 pcTempCU = pcCU->getPULeft( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx ); 972 if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) ) 973 { 974 UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ); 975 if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType ) 976 { 977 // get offset between current and reference block 978 UInt uiOffsetX = 0, uiOffsetY = 0; 979 xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY ); 980 981 // get reference wedgelet 982 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])]; 983 TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) ); 984 985 // find wedgelet, if direction is suitable for continue wedge 986 if( pcRefWedgelet->checkPredDirLeftPossible( uiThisBlockSize, uiOffsetY ) ) 987 { 988 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye; 989 pcRefWedgelet->getPredDirStartEndLeft( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetY, iDeltaEnd ); 990 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye ); 991 } 992 } 993 } 994 995 // 3rd: (default) make wedglet from intra dir and max slope point 996 Int iSlopeX = 0, iSlopeY = 0; 997 UInt uiStartPosX = 0, uiStartPosY = 0; 998 if( xGetWedgeIntraDirPredData( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY ) ) 999 { 1000 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye; 1001 xGetWedgeIntraDirStartEnd( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, iDeltaEnd ); 1002 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye ); 1003 } 1004 1005 return 0; 1006 } 1007 1008 UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ) 1009 { 1010 TComPic* pcPicTex = pcCU->getSlice()->getPicLists()->getPic( pcCU->getSlice()->getViewIndex(), false, pcCU->getSlice()->getPOC() ); 1011 assert( pcPicTex != NULL ); 1012 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); 1013 UInt uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1014 Int uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255; 1015 1016 if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) { return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); } 1017 else { return g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])].at(intraTabIdx).getPatternIdx(); } 1018 } 1019 1020 Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ) 1021 { 1022 pcContourWedge->clear(); 1023 1024 // get copy of co-located texture luma block 1025 TComYuv cTempYuv; 1026 cTempYuv.create( uiWidth, uiHeight ); 1027 cTempYuv.clear(); 1028 Pel* piRefBlkY = cTempYuv.getLumaAddr(); 1029 xCopyTextureLumaBlock( pcCU, uiAbsPartIdx, piRefBlkY, uiWidth, uiHeight ); 1030 piRefBlkY = cTempYuv.getLumaAddr(); 1031 1032 // find contour for texture luma block 1033 UInt iDC = 0; 1034 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 1035 { 1036 iDC += piRefBlkY[k]; 1037 } 1038 iDC /= (uiWidth*uiHeight); 1039 piRefBlkY = cTempYuv.getLumaAddr(); 1040 1041 Bool* pabContourPattern = pcContourWedge->getPattern(); 1042 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 1043 { 1044 pabContourPattern[k] = (piRefBlkY[k] > iDC) ? true : false; 1045 } 1046 1047 cTempYuv.destroy(); 1048 } 1049 1050 1051 Void TComPrediction::xCopyTextureLumaBlock( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ) 1052 { 1053 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getPicLists()->getPic( pcCU->getSlice()->getViewIndex(), false, pcCU->getSlice()->getPOC() )->getPicYuvRec(); 1054 assert( pcPicYuvRef != NULL ); 1055 Int iRefStride = pcPicYuvRef->getStride(); 1056 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiAbsPartIdx ); 1057 1058 for ( Int y = 0; y < uiHeight; y++ ) 1059 { 1060 ::memcpy(piDestBlockY, piRefY, sizeof(Pel)*uiWidth); 1061 piDestBlockY += uiWidth; 1062 piRefY += iRefStride; 1063 } 1064 } 1065 1066 Void TComPrediction::xGetBlockOffset( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY ) 1067 { 1068 ruiOffsetX = 0; 1069 ruiOffsetY = 0; 1070 1071 // get offset between current and above/left block 1072 UInt uiThisOriginX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 1073 UInt uiThisOriginY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 1074 1075 UInt uiNumPartInRefCU = pcRefCU->getTotalNumPart(); 1076 UInt uiMaxDepthRefCU = 0; 1077 while( uiNumPartInRefCU > 1 ) 1078 { 1079 uiNumPartInRefCU >>= 2; 1080 uiMaxDepthRefCU++; 1081 } 1082 1083 UInt uiDepthRefPU = (pcRefCU->getDepth(uiRefAbsPartIdx)) + (pcRefCU->getPartitionSize(uiRefAbsPartIdx) == SIZE_2Nx2N ? 0 : 1); 1084 UInt uiShifts = (uiMaxDepthRefCU - uiDepthRefPU)*2; 1085 UInt uiRefBlockOriginPartIdx = (uiRefAbsPartIdx>>uiShifts)<<uiShifts; 1086 1087 UInt uiRefOriginX = pcRefCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ]; 1088 UInt uiRefOriginY = pcRefCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ]; 1089 1090 if( (uiThisOriginX - uiRefOriginX) > 0 ) { ruiOffsetX = (UInt)(uiThisOriginX - uiRefOriginX); } 1091 if( (uiThisOriginY - uiRefOriginY) > 0 ) { ruiOffsetY = (UInt)(uiThisOriginY - uiRefOriginY); } 1092 } 1093 1094 Bool TComPrediction::xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY ) 1095 { 1096 riSlopeX = 0, riSlopeY = 0, ruiStartPosX = 0, ruiStartPosY = 0; 1097 1098 // 1st step: get wedge start point (max. slope) 1099 Int* piSource = pcCU->getPattern()->getAdiOrgBuf( uiBlockSize, uiBlockSize, m_piYuvExt ); 1100 Int iSourceStride = ( uiBlockSize<<1 ) + 1; 1101 1102 UInt uiSlopeMaxAbove = 0, uiPosSlopeMaxAbove = 0; 1103 for( UInt uiPosHor = 0; uiPosHor < (uiBlockSize-1); uiPosHor++ ) 1104 { 1105 if( abs( piSource[uiPosHor+1] - piSource[uiPosHor] ) > uiSlopeMaxAbove ) 1106 { 1107 uiSlopeMaxAbove = abs( piSource[uiPosHor+1] - piSource[uiPosHor] ); 1108 uiPosSlopeMaxAbove = uiPosHor; 1109 } 1110 } 1111 1112 UInt uiSlopeMaxLeft = 0, uiPosSlopeMaxLeft = 0; 1113 for( UInt uiPosVer = 0; uiPosVer < (uiBlockSize-1); uiPosVer++ ) 1114 { 1115 if( abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ) > uiSlopeMaxLeft ) 1116 { 1117 uiSlopeMaxLeft = abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ); 1118 uiPosSlopeMaxLeft = uiPosVer; 1119 } 1120 } 1121 1122 if( uiSlopeMaxAbove == 0 && uiSlopeMaxLeft == 0 ) 1123 { 1124 return false; 1125 } 1126 1127 ruiStartPosX = ( uiSlopeMaxAbove > uiSlopeMaxLeft ) ? uiPosSlopeMaxAbove : 0; 1128 ruiStartPosY = ( uiSlopeMaxLeft >= uiSlopeMaxAbove ) ? uiPosSlopeMaxLeft : 0; 1129 1130 // 2nd step: derive wedge direction 1131 Int uiPreds[3] = {-1, -1, -1}; 1132 Int iMode = -1; 1133 Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 1134 1135 UInt uiDirMode = 0; 1136 if( iMode >= 0 ) { iPredNum = iMode; } 1137 if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; } 1138 if( iPredNum == 2 ) { uiDirMode = uiPreds[1]; } 1139 1140 if( uiDirMode < 2 ) { return false; } // no planar & DC 1141 1142 Bool modeHor = (uiDirMode < 18); 1143 Bool modeVer = !modeHor; 1144 Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0; 1145 Int absAng = abs(intraPredAngle); 1146 Int signAng = intraPredAngle < 0 ? -1 : 1; 1147 Int angTable[9] = {0,2,5,9,13,17,21,26,32}; 1148 absAng = angTable[absAng]; 1149 intraPredAngle = signAng * absAng; 1150 1151 // 3rd step: set slope for direction 1152 if( modeHor ) 1153 { 1154 riSlopeX = ( intraPredAngle > 0 ) ? -32 : 32; 1155 riSlopeY = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle; 1156 } 1157 else if( modeVer ) 1158 { 1159 riSlopeX = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle; 1160 riSlopeY = ( intraPredAngle > 0 ) ? -32 : 32; 1161 } 1162 1163 return true; 1164 } 1165 1166 Void TComPrediction::xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd ) 1167 { 1168 ruhXs = 0; 1169 ruhYs = 0; 1170 ruhXe = 0; 1171 ruhYe = 0; 1172 1173 // scaling of start pos and block size to wedge resolution 1174 UInt uiScaledStartPosX = 0; 1175 UInt uiScaledStartPosY = 0; 1176 UInt uiScaledBlockSize = 0; 1177 WedgeResolution eWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiBlockSize]]; 1178 switch( eWedgeRes ) 1179 { 1180 case( DOUBLE_PEL ): { uiScaledStartPosX = (uiPMSPosX>>1); uiScaledStartPosY = (uiPMSPosY>>1); uiScaledBlockSize = (uiBlockSize>>1); break; } 1181 case( FULL_PEL ): { uiScaledStartPosX = uiPMSPosX; uiScaledStartPosY = uiPMSPosY; uiScaledBlockSize = uiBlockSize; break; } 1182 case( HALF_PEL ): { uiScaledStartPosX = (uiPMSPosX<<1); uiScaledStartPosY = (uiPMSPosY<<1); uiScaledBlockSize = (uiBlockSize<<1); break; } 1183 } 1184 Int iMaxPos = (Int)uiScaledBlockSize - 1; 1185 1186 // case above 1187 if( uiScaledStartPosX > 0 && uiScaledStartPosY == 0 ) 1188 { 1189 ruhXs = (UChar)uiScaledStartPosX; 1190 ruhYs = 0; 1191 1192 if( iDeltaY == 0 ) 1193 { 1194 if( iDeltaX < 0 ) 1195 { 1196 ruhXe = 0; 1197 ruhYe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos ); 1198 return; 1199 } 1200 else 1201 { 1202 ruhXe = (UChar)iMaxPos; 1203 ruhYe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos ); 1204 std::swap( ruhXs, ruhXe ); 1205 std::swap( ruhYs, ruhYe ); 1206 return; 1207 } 1208 } 1209 1210 // regular case 1211 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) ); 1212 1213 if( iVirtualEndX < 0 ) 1214 { 1215 Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) + iDeltaEnd; 1216 if( iYe < (Int)uiScaledBlockSize ) 1217 { 1218 ruhXe = 0; 1219 ruhYe = (UChar)std::max( iYe, 0 ); 1220 return; 1221 } 1222 else 1223 { 1224 ruhXe = (UChar)std::min( (iYe - iMaxPos), iMaxPos ); 1225 ruhYe = (UChar)iMaxPos; 1226 return; 1227 } 1228 } 1229 else if( iVirtualEndX > iMaxPos ) 1230 { 1231 Int iYe = roftoi( (Double)(iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd; 1232 if( iYe < (Int)uiScaledBlockSize ) 1233 { 1234 ruhXe = (UChar)iMaxPos; 1235 ruhYe = (UChar)std::max( iYe, 0 ); 1236 std::swap( ruhXs, ruhXe ); 1237 std::swap( ruhYs, ruhYe ); 1238 return; 1239 } 1240 else 1241 { 1242 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 1243 ruhYe = (UChar)iMaxPos; 1244 return; 1245 } 1246 } 1247 else 1248 { 1249 Int iXe = iVirtualEndX + iDeltaEnd; 1250 if( iXe < 0 ) 1251 { 1252 ruhXe = 0; 1253 ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 ); 1254 return; 1255 } 1256 else if( iXe > iMaxPos ) 1257 { 1258 ruhXe = (UChar)iMaxPos; 1259 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 1260 std::swap( ruhXs, ruhXe ); 1261 std::swap( ruhYs, ruhYe ); 1262 return; 1263 } 1264 else 1265 { 1266 ruhXe = (UChar)iXe; 1267 ruhYe = (UChar)iMaxPos; 1268 return; 1269 } 1270 } 1271 } 1272 1273 // case left 1274 if( uiScaledStartPosY > 0 && uiScaledStartPosX == 0 ) 1275 { 1276 ruhXs = 0; 1277 ruhYs = (UChar)uiScaledStartPosY; 1278 1279 if( iDeltaX == 0 ) 1280 { 1281 if( iDeltaY < 0 ) 1282 { 1283 ruhXe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos ); 1284 ruhYe = 0; 1285 std::swap( ruhXs, ruhXe ); 1286 std::swap( ruhYs, ruhYe ); 1287 return; 1288 } 1289 else 1290 { 1291 ruhXe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos ); 1292 ruhYe = (UChar)iMaxPos; 1293 return; 1294 } 1295 } 1296 1297 // regular case 1298 Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iMaxPos * ((Double)iDeltaY / (Double)iDeltaX) ); 1299 1300 if( iVirtualEndY < 0 ) 1301 { 1302 Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) - iDeltaEnd; 1303 if( iXe < (Int)uiScaledBlockSize ) 1304 { 1305 ruhXe = (UChar)std::max( iXe, 0 ); 1306 ruhYe = 0; 1307 std::swap( ruhXs, ruhXe ); 1308 std::swap( ruhYs, ruhYe ); 1309 return; 1310 } 1311 else 1312 { 1313 ruhXe = (UChar)iMaxPos; 1314 ruhYe = (UChar)std::min( (iXe - iMaxPos), iMaxPos ); 1315 std::swap( ruhXs, ruhXe ); 1316 std::swap( ruhYs, ruhYe ); 1317 return; 1318 } 1319 } 1320 else if( iVirtualEndY > (uiScaledBlockSize-1) ) 1321 { 1322 Int iXe = roftoi( (Double)((Int)(uiScaledBlockSize-1) - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) + iDeltaEnd; 1323 if( iXe < (Int)uiScaledBlockSize ) 1324 { 1325 ruhXe = (UChar)std::max( iXe, 0 ); 1326 ruhYe = (UChar)(uiScaledBlockSize-1); 1327 return; 1328 } 1329 else 1330 { 1331 ruhXe = (UChar)iMaxPos; 1332 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 1333 std::swap( ruhXs, ruhXe ); 1334 std::swap( ruhYs, ruhYe ); 1335 return; 1336 } 1337 } 1338 else 1339 { 1340 Int iYe = iVirtualEndY - iDeltaEnd; 1341 if( iYe < 0 ) 1342 { 1343 ruhXe = (UChar)std::max( (iMaxPos + iYe), 0 ); 1344 ruhYe = 0; 1345 std::swap( ruhXs, ruhXe ); 1346 std::swap( ruhYs, ruhYe ); 1347 return; 1348 } 1349 else if( iYe > iMaxPos ) 1350 { 1351 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 1352 ruhYe = (UChar)iMaxPos; 1353 return; 1354 } 1355 else 1356 { 1357 ruhXe = (UChar)iMaxPos; 1358 ruhYe = (UChar)iYe; 1359 std::swap( ruhXs, ruhXe ); 1360 std::swap( ruhYs, ruhYe ); 1361 return; 1362 } 1363 } 1364 } 1365 1366 // case origin 1367 if( uiScaledStartPosX == 0 && uiScaledStartPosY == 0 ) 1368 { 1369 if( iDeltaX*iDeltaY < 0 ) 1370 { 1371 return; 1372 } 1373 1374 ruhXs = 0; 1375 ruhYs = 0; 1376 1377 if( iDeltaY == 0 ) 1378 { 1379 ruhXe = (UChar)iMaxPos; 1380 ruhYe = 0; 1381 std::swap( ruhXs, ruhXe ); 1382 std::swap( ruhYs, ruhYe ); 1383 return; 1384 } 1385 1386 if( iDeltaX == 0 ) 1387 { 1388 ruhXe = 0; 1389 ruhYe = (UChar)iMaxPos; 1390 return; 1391 } 1392 1393 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) ); 1394 1395 if( iVirtualEndX > iMaxPos ) 1396 { 1397 Int iYe = roftoi( (Double)((Int)iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd; 1398 if( iYe < (Int)uiScaledBlockSize ) 1399 { 1400 ruhXe = (UChar)(uiScaledBlockSize-1); 1401 ruhYe = (UChar)std::max( iYe, 0 ); 1402 std::swap( ruhXs, ruhXe ); 1403 std::swap( ruhYs, ruhYe ); 1404 return; 1405 } 1406 else 1407 { 1408 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 1409 ruhYe = (UChar)(uiScaledBlockSize-1); 1410 return; 1411 } 1412 } 1413 else 1414 { 1415 Int iXe = iVirtualEndX + iDeltaEnd; 1416 if( iXe < 0 ) 1417 { 1418 ruhXe = 0; 1419 ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 ); 1420 return; 1421 } 1422 else if( iXe > iMaxPos ) 1423 { 1424 ruhXe = (UChar)(uiScaledBlockSize-1); 1425 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 1426 std::swap( ruhXs, ruhXe ); 1427 std::swap( ruhYs, ruhYe ); 1428 return; 1429 } 1430 else 1431 { 1432 ruhXe = (UChar)iXe; 1433 ruhYe = (UChar)(uiScaledBlockSize-1); 1434 return; 1435 } 1436 } 1437 } 1438 } 1439 1440 UInt TComPrediction::xGetWedgePatternIdx( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe ) 1441 { 1442 WedgeRefList* pcWedgeRefList = &g_dmmWedgeRefLists[(g_aucConvertToBit[uiBlockSize])]; 1443 for( UInt uiIdx = 0; uiIdx < pcWedgeRefList->size(); uiIdx++ ) 1444 { 1445 TComWedgeRef* pcTestWedgeRef = &(pcWedgeRefList->at(uiIdx)); 1446 if( pcTestWedgeRef->getStartX() == uhXs && pcTestWedgeRef->getStartY() == uhYs && pcTestWedgeRef->getEndX() == uhXe && pcTestWedgeRef->getEndY() == uhYe ) 1447 { 1448 return pcTestWedgeRef->getRefIdx(); 1449 } 1450 } 1451 return 0; 1452 } 1453 #endif 1454 #if H_3D_DIM_RBC 1455 Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC ) 1456 { 1457 Int iSign = rDeltaDC < 0 ? -1 : 1; 1458 UInt uiAbs = abs( rDeltaDC ); 1459 1460 Int iQp = pcCU->getQP(0); 1461 Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) ); 1462 Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) ); 1463 1464 rDeltaDC = iSign * roftoi( uiAbs * dStepSize ); 1465 return; 1466 } 1467 1468 Void TComPrediction::xDeltaDCQuantScaleDown( TComDataCU* pcCU, Pel& rDeltaDC ) 1469 { 1470 Int iSign = rDeltaDC < 0 ? -1 : 1; 1471 UInt uiAbs = abs( rDeltaDC ); 1472 1473 Int iQp = pcCU->getQP(0); 1474 Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) ); 1475 Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) ); 1476 1477 rDeltaDC = iSign * roftoi( uiAbs / dStepSize ); 1478 return; 1479 } 1480 #endif 1481 #endif 760 1482 //! \} -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComPrediction.h
r324 r459 88 88 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); 89 89 90 #if H_3D_DIM 91 // depth intra functions 92 Void xPredBiSegDCs ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ); 93 Void xAssignBiSegDCs ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ); 94 #if H_3D_DIM_DMM 95 UInt xPredWedgeFromIntra ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 ); 96 UInt xPredWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ); 97 Void xPredContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ); 98 99 Void xCopyTextureLumaBlock ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ); 100 101 Void xGetBlockOffset ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY ); 102 Bool xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY ); 103 Void xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd = 0 ); 104 UInt xGetWedgePatternIdx ( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe ); 105 #endif 106 #if H_3D_DIM_RBC 107 Void xDeltaDCQuantScaleUp ( TComDataCU* pcCU, Pel& rDeltaDC ); 108 Void xDeltaDCQuantScaleDown ( TComDataCU* pcCU, Pel& rDeltaDC ); 109 #endif 110 #endif 111 90 112 public: 91 113 TComPrediction(); … … 104 126 Void predIntraChromaAng ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); 105 127 128 #if H_3D_DIM 129 // Depth intra 130 Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false ); 131 #endif 132 106 133 Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); 107 134 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComRom.cpp
r446 r459 82 82 delete[] g_auiSigLastScan[2][i]; 83 83 } 84 85 #if H_3D_DIM_DMM 86 if( !g_dmmWedgeLists.empty() ) 87 { 88 for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ ) { g_dmmWedgeLists[ui].clear(); } 89 g_dmmWedgeLists.clear(); 90 } 91 if( !g_dmmWedgeRefLists.empty() ) 92 { 93 for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ ) { g_dmmWedgeRefLists[ui].clear(); } 94 g_dmmWedgeRefLists.clear(); 95 } 96 97 if( !g_dmmWedgeNodeLists.empty() ) 98 { 99 for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ ) { g_dmmWedgeNodeLists[ui].clear(); } 100 g_dmmWedgeNodeLists.clear(); 101 } 102 #endif 84 103 } 85 104 … … 312 331 313 332 // ==================================================================================================================== 333 // Depth coding modes 334 // ==================================================================================================================== 335 #if H_3D_DIM_DMM 336 const WedgeResolution g_dmmWedgeResolution[6] = 337 { 338 HALF_PEL, // 4x4 339 HALF_PEL, // 8x8 340 FULL_PEL, // 16x16 341 DOUBLE_PEL, // 32x32 342 DOUBLE_PEL, // 64x64 343 DOUBLE_PEL // 128x128 344 }; 345 346 const UChar g_dmm1TabIdxBits[6] = 347 { //2x2 4x4 8x8 16x16 32x32 64x64 348 0, 7, 10, 11, 11, 13 }; 349 const UChar g_dmm3IntraTabIdxBits[6] = 350 { //2x2 4x4 8x8 16x16 32x32 64x64 351 0, 6, 9, 9, 9, 0 }; 352 353 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists; 354 extern std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists; 355 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists; 356 #endif 357 358 // ==================================================================================================================== 314 359 // Misc. 315 360 // ==================================================================================================================== … … 518 563 Int g_eTTable[4] = {0,3,1,2}; 519 564 565 #if H_3D_DIM_DMM 566 std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists; 567 std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists; 568 std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists; 569 std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 570 571 Void initWedgeLists( Bool initRefinements ) 572 { 573 if( !g_dmmWedgeLists.empty() ) return; 574 575 for( UInt ui = g_aucConvertToBit[DIM_MIN_SIZE]; ui < (g_aucConvertToBit[DIM_MAX_SIZE]+1); ui++ ) 576 { 577 UInt uiWedgeBlockSize = ((UInt)DIM_MIN_SIZE)<<ui; 578 std::vector<TComWedgelet> acWedgeList; 579 std::vector<TComWedgeRef> acWedgeRefList; 580 createWedgeList( uiWedgeBlockSize, uiWedgeBlockSize, acWedgeList, acWedgeRefList, g_dmmWedgeResolution[ui] ); 581 g_dmmWedgeLists.push_back( acWedgeList ); 582 g_dmmWedgeRefLists.push_back( acWedgeRefList ); 583 584 // create WedgeNodeList 585 std::vector<TComWedgeNode> acWedgeNodeList; 586 for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ ) 587 { 588 if( acWedgeList[uiPos].getIsCoarse() ) 589 { 590 TComWedgeNode cWedgeNode; 591 cWedgeNode.setPatternIdx( uiPos ); 592 593 if( initRefinements ) 594 { 595 UInt uiRefPos = 0; 596 for( Int iOffS = -1; iOffS <= 1; iOffS++ ) 597 { 598 for( Int iOffE = -1; iOffE <= 1; iOffE++ ) 599 { 600 if( iOffS == 0 && iOffE == 0 ) { continue; } 601 602 Int iSx = (Int)acWedgeList[uiPos].getStartX(); 603 Int iSy = (Int)acWedgeList[uiPos].getStartY(); 604 Int iEx = (Int)acWedgeList[uiPos].getEndX(); 605 Int iEy = (Int)acWedgeList[uiPos].getEndY(); 606 607 switch( acWedgeList[uiPos].getOri() ) 608 { 609 case( 0 ): { iSx += iOffS; iEy += iOffE; } break; 610 case( 1 ): { iSy += iOffS; iEx -= iOffE; } break; 611 case( 2 ): { iSx -= iOffS; iEy -= iOffE; } break; 612 case( 3 ): { iSy -= iOffS; iEx += iOffE; } break; 613 case( 4 ): { iSx += iOffS; iEx += iOffE; } break; 614 case( 5 ): { iSy += iOffS; iEy += iOffE; } break; 615 default: assert( 0 ); 616 } 617 618 for( UInt k = 0; k < acWedgeRefList.size(); k++ ) 619 { 620 if( iSx == (Int)acWedgeRefList[k].getStartX() && 621 iSy == (Int)acWedgeRefList[k].getStartY() && 622 iEx == (Int)acWedgeRefList[k].getEndX() && 623 iEy == (Int)acWedgeRefList[k].getEndY() ) 624 { 625 if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() ) 626 { 627 Bool bNew = true; 628 for( UInt m = 0; m < uiRefPos; m++ ) { if( acWedgeRefList[k].getRefIdx() == cWedgeNode.getRefineIdx( m ) ) { bNew = false; break; } } 629 630 if( bNew ) 631 { 632 cWedgeNode.setRefineIdx( acWedgeRefList[k].getRefIdx(), uiRefPos ); 633 uiRefPos++; 634 break; 635 } 636 } 637 } 638 } 639 } 640 } 641 } 642 acWedgeNodeList.push_back( cWedgeNode ); 643 } 644 } 645 g_dmmWedgeNodeLists.push_back( acWedgeNodeList ); 646 } 647 return; 648 } 649 650 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes ) 651 { 652 assert( uiWidth == uiHeight ); 653 654 UChar uhStartX = 0, uhStartY = 0, uhEndX = 0, uhEndY = 0; 655 Int iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0; 656 657 UInt uiBlockSize = 0; 658 switch( eWedgeRes ) 659 { 660 case( DOUBLE_PEL ): { uiBlockSize = (uiWidth>>1); break; } 661 case( FULL_PEL ): { uiBlockSize = uiWidth; break; } 662 case( HALF_PEL ): { uiBlockSize = (uiWidth<<1); break; } 663 } 664 665 TComWedgelet cTempWedgelet( uiWidth, uiHeight ); 666 for( UInt uiOri = 0; uiOri < 6; uiOri++ ) 667 { 668 // init the edge line parameters for each of the 6 wedgelet types 669 switch( uiOri ) 670 { 671 case( 0 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = +1; iStepStartY = 0; iStepEndX = 0; iStepEndY = +1; break; } 672 case( 1 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = (uiBlockSize-1); uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = -1; iStepEndY = 0; break; } 673 case( 2 ): { uhStartX = (uiBlockSize-1); uhStartY = (uiBlockSize-1); uhEndX = (uiBlockSize-1); uhEndY = (uiBlockSize-1); iStepStartX = -1; iStepStartY = 0; iStepEndX = 0; iStepEndY = -1; break; } 674 case( 3 ): { uhStartX = 0; uhStartY = (uiBlockSize-1); uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = 0; iStepStartY = -1; iStepEndX = +1; iStepEndY = 0; break; } 675 case( 4 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = +1; iStepStartY = 0; iStepEndX = +1; iStepEndY = 0; break; } 676 case( 5 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = 0; iStepEndY = +1; break; } 677 } 678 679 for( Int iK = 0; iK < uiBlockSize; iK++ ) 680 { 681 for( Int iL = 0; iL < uiBlockSize; iL++ ) 682 { 683 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) ); 684 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList ); 685 } 686 } 687 } 688 689 UInt uiThrSz = DMM3_SIMPLIFY_TR; 690 std::vector< std::vector<UInt> > auiWdgListSz; 691 for( Int idxM=2; idxM<=34 ; idxM++) 692 { 693 std::vector<UInt> auiWdgList; 694 for( Int idxW=0; idxW<racWedgeList.size(); idxW++) 695 { 696 UInt uiAbsDiff = abs(idxM-(Int)racWedgeList[idxW].getAng()); 697 if( uiAbsDiff <= uiThrSz ) 698 { 699 auiWdgList.push_back(idxW); 700 } 701 } 702 auiWdgListSz.push_back(auiWdgList); 703 } 704 g_aauiWdgLstM3.push_back(auiWdgListSz); 705 } 706 707 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList ) 708 { 709 Bool bValid = cWedgelet.checkNotPlain(); 710 if( bValid ) 711 { 712 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ ) 713 { 714 if( cWedgelet.checkIdentical( racWedgeList[uiPos].getPattern() ) ) 715 { 716 TComWedgeRef cWedgeRef; 717 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos ); 718 racWedgeRefList.push_back( cWedgeRef ); 719 bValid = false; 720 return; 721 } 722 } 723 } 724 if( bValid ) 725 { 726 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ ) 727 { 728 if( cWedgelet.checkInvIdentical( racWedgeList[uiPos].getPattern() ) ) 729 { 730 TComWedgeRef cWedgeRef; 731 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos ); 732 racWedgeRefList.push_back( cWedgeRef ); 733 bValid = false; 734 return; 735 } 736 } 737 } 738 if( bValid ) 739 { 740 cWedgelet.findClosestAngle(); 741 racWedgeList.push_back( cWedgelet ); 742 TComWedgeRef cWedgeRef; 743 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), (UInt)(racWedgeList.size()-1) ); 744 racWedgeRefList.push_back( cWedgeRef ); 745 } 746 } 747 #endif //H_3D_DIM_DMM 520 748 //! \} -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComRom.h
r324 r459 44 44 #include<iostream> 45 45 46 #if H_3D_DIM 47 #include "TComWedgelet.h" 48 #endif 49 46 50 //! \ingroup TLibCommon 47 51 //! \{ … … 147 151 148 152 extern const UChar g_aucConvertTxtTypeToIdx[4]; 153 154 #if H_3D_DIM 155 // ==================================================================================================================== 156 // Depth coding modes 157 // ==================================================================================================================== 158 __inline Void mapDepthModeToIntraDir( UInt& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; } 159 __inline Void mapDepthModeToIntraDir( Int& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; } 160 161 #if H_3D_DIM_DMM 162 extern const WedgeResolution g_dmmWedgeResolution [6]; 163 extern const UChar g_dmm1TabIdxBits [6]; 164 extern const UChar g_dmm3IntraTabIdxBits[6]; 165 166 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists; 167 extern std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists; 168 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists; 169 extern std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 170 171 Void initWedgeLists( Bool initRefinements = false ); 172 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes ); 173 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList ); 174 #endif 175 #endif 149 176 150 177 // ========================================== -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComSlice.cpp
r446 r459 73 73 , m_pcPPS ( NULL ) 74 74 , m_pcPic ( NULL ) 75 #if H_3D 76 , m_picLists ( NULL ) 77 #endif 75 78 , m_colFromL0Flag ( 1 ) 76 79 , m_colRefIdx ( 0 ) … … 913 916 914 917 m_pcPic = pSrc->m_pcPic; 915 918 #if H_3D 919 m_picLists = pSrc->m_picLists; 920 #endif 916 921 m_colFromL0Flag = pSrc->m_colFromL0Flag; 917 922 m_colRefIdx = pSrc->m_colRefIdx; … … 1474 1479 #if H_3D 1475 1480 m_viewIndex [i] = -1; 1481 m_vpsDepthModesFlag [i] = false; 1476 1482 #endif 1477 1483 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComSlice.h
r446 r459 524 524 #if H_3D 525 525 Int m_viewIndex [MAX_NUM_LAYERS ]; 526 Bool m_vpsDepthModesFlag [MAX_NUM_LAYERS ]; 526 527 #endif 527 528 … … 642 643 Int getDepthId ( Int layerIdInVps ) { return getScalabilityId( layerIdInVps, DEPTH_ID ); } 643 644 Int getLayerIdInNuh( Int viewIndex, Bool depthFlag ); 645 646 Void setVpsDepthModesFlag( Int layerIdInVps, Bool val ) { m_vpsDepthModesFlag[ layerIdInVps ] = val; } 647 Bool getVpsDepthModesFlag( Int layerIdInVps ) { return m_vpsDepthModesFlag[ layerIdInVps ]; } 644 648 #endif 645 649 … … 1424 1428 TComPPS* m_pcPPS; 1425 1429 TComPic* m_pcPic; 1430 #if H_3D 1431 TComPicLists* m_picLists; 1432 #endif 1426 1433 #if ADAPTIVE_QP_SELECTION 1427 1434 TComTrQuant* m_pcTrQuant; … … 1542 1549 Int getNumRefIdx ( RefPicList e ) { return m_aiNumRefIdx[e]; } 1543 1550 TComPic* getPic () { return m_pcPic; } 1551 #if H_3D 1552 TComPicLists* getPicLists () { return m_picLists; } 1553 #endif 1544 1554 TComPic* getRefPic ( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } 1545 1555 Int getRefPOC ( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } … … 1596 1606 Void setNumRefIdx ( RefPicList e, Int i ) { m_aiNumRefIdx[e] = i; } 1597 1607 Void setPic ( TComPic* p ) { m_pcPic = p; } 1608 #if H_3D 1609 Void setPicLists ( TComPicLists* p ) { m_picLists = p; } 1610 #endif 1598 1611 Void setDepth ( Int iDepth ) { m_iDepth = iDepth; } 1599 1612 … … 1756 1769 Int* getInvCodedScale () { return m_aaiCodedScale [1]; } 1757 1770 Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } 1771 1772 Bool getVpsDepthModesFlag () { return getVPS()->getVpsDepthModesFlag( getVPS()->getLayerIdInVps( m_layerId ) ); } 1758 1773 #endif 1759 1774 #endif -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TypeDef.h
r446 r459 78 78 // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 3 79 79 // LGE_WVSO_A0119 80 #define H_3D_DIM 1 // DIM, Depth intra modes, includes: 81 // HHI_DMM_WEDGE_INTRA 82 // HHI_DMM_PRED_TEX 83 // FIX_WEDGE_NOFLOAT_D0036 84 // LGE_EDGE_INTRA_A0070 85 // LGE_DMM3_SIMP_C0044 86 // QC_DC_PREDICTOR_D0183 87 // HHI_DELTADC_DLT_D0035 88 // PKU_QC_DEPTH_INTRA_UNI_D0195 89 // ... [PM: add SDC and DLT related] 80 90 #endif 81 91 … … 91 101 #define H_3D_VSO_RM_ASSERTIONS 0 // Output VSO assertions 92 102 #define H_3D_VSO_SYNTH_DIST_OUT 0 // Output of synthesized view distortion instead of depth distortion in encoder output 103 #endif 104 105 ///// ***** DEPTH INTRA MODES ********* 106 #if H_3D_DIM 107 #define H_3D_DIM_DMM 1 // Depth Modeling Modes 108 #define H_3D_DIM_RBC 1 // Region Boundary Chain mode 109 #define H_3D_DIM_SDC 0 // Simplified Depth Coding method 110 #define H_3D_DIM_DLT 0 // Depth Lookup Table 93 111 #endif 94 112
Note: See TracChangeset for help on using the changeset viewer.