Changeset 467 in 3DVCSoftware for branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon
- Timestamp:
- 14 Jun 2013, 17:12:18 (11 years ago)
- Location:
- branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/ContextTables.h
r459 r467 111 111 #endif 112 112 113 #if H_3D_DIM_SDC 114 #define SDC_NUM_RESIDUAL_FLAG_CTX 1 115 #define SDC_NUM_RESIDUAL_CTX 1 116 #endif 113 117 // ==================================================================================================================== 114 118 // Tables … … 403 407 }; 404 408 #endif 409 #if H_3D_DIM_SDC 410 static const UChar 411 INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] = 412 { 413 { CNU }, 414 { CNU }, 415 { CNU }, 416 }; 417 static const UChar 418 INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] = 419 { 420 { 155 }, 421 { 155 }, 422 { 155 }, 423 }; 424 #endif 405 425 #endif 406 426 //! \} -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComDataCU.cpp
r459 r467 130 130 m_pbEdgePartition = NULL; 131 131 #endif 132 #if H_3D_DIM_SDC 133 m_pbSDCFlag = NULL; 134 m_apSegmentDCOffset[0] = NULL; 135 m_apSegmentDCOffset[1] = NULL; 136 #endif 132 137 #endif 133 138 … … 245 250 m_pbEdgeLeftFirst = (Bool*)xMalloc(Bool, uiNumPartition); 246 251 m_pbEdgePartition = (Bool*)xMalloc(Bool, uiNumPartition * 16); 252 #endif 253 #if H_3D_DIM_SDC 254 m_pbSDCFlag = (Bool*)xMalloc(Bool, uiNumPartition); 255 m_apSegmentDCOffset[0] = (Pel*)xMalloc(Pel, uiNumPartition); 256 m_apSegmentDCOffset[1] = (Pel*)xMalloc(Pel, uiNumPartition); 247 257 #endif 248 258 #endif … … 353 363 if ( m_pucEdgeCode ) { xFree( m_pucEdgeCode ); m_pucEdgeCode = NULL; } 354 364 if ( m_pbEdgePartition ) { xFree( m_pbEdgePartition ); m_pbEdgePartition = NULL; } 365 #endif 366 #if H_3D_DIM_SDC 367 if ( m_pbSDCFlag ) { xFree(m_pbSDCFlag); m_pbSDCFlag = NULL; } 368 if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]); m_apSegmentDCOffset[0] = NULL; } 369 if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]); m_apSegmentDCOffset[1] = NULL; } 355 370 #endif 356 371 #endif … … 481 496 m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; 482 497 m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; 498 #if H_3D_DIM_SDC 499 m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui]; 500 #endif 483 501 } 484 502 … … 535 553 memset( m_pbEdgeLeftFirst + firstElement, false, numElements * sizeof( *m_pbEdgeLeftFirst ) ); 536 554 memset( m_pbEdgePartition + firstElement, false, numElements * sizeof( *m_pbEdgePartition ) * 16 ); 555 #endif 556 #if H_3D_DIM_SDC 557 memset( m_pbSDCFlag + firstElement, 0, numElements * sizeof( *m_pbSDCFlag ) ); 558 memset( m_apSegmentDCOffset[0] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[0] ) ); 559 memset( m_apSegmentDCOffset[1] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[1] ) ); 537 560 #endif 538 561 #endif … … 687 710 m_dmm3IntraTabIdx [ui] = 0; 688 711 #endif 712 #if H_3D_DIM_SDC 713 m_pbSDCFlag [ui] = false; 714 m_apSegmentDCOffset[0][ui] = 0; 715 m_apSegmentDCOffset[1][ui] = 0; 716 #endif 689 717 #endif 690 718 } … … 785 813 memset( m_pbEdgeLeftFirst, 0, iSizeInBool ); 786 814 memset( m_pbEdgePartition, 0, iSizeInBool * 16 ); 815 #endif 816 #if H_3D_DIM_SDC 817 memset( m_pbSDCFlag, 0, sizeof(Bool) * m_uiNumPartition ); 818 memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition ); 819 memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition ); 787 820 #endif 788 821 #endif … … 840 873 m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui]; 841 874 #endif 875 #if H_3D_DIM_SDC 876 m_pbSDCFlag [ui] = pcCU->m_pbSDCFlag [ uiPartOffset + ui ]; 877 m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ]; 878 m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ]; 879 #endif 842 880 #endif 843 881 } … … 980 1018 m_pbEdgeLeftFirst = pcCU->getEdgeLeftFirst() + uiPart; 981 1019 m_pbEdgePartition = pcCU->getEdgePartition( uiPart ); 1020 #endif 1021 #if H_3D_DIM_SDC 1022 m_pbSDCFlag = pcCU->getSDCFlag() + uiPart; 1023 m_apSegmentDCOffset[0] = pcCU->getSDCSegmentDCOffset(0) + uiPart; 1024 m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart; 982 1025 #endif 983 1026 #endif … … 1131 1174 memcpy( getEdgePartition( uiOffset ), pcCU->getEdgePartition(0), iSizeInBool * 16 ); 1132 1175 #endif 1176 #if H_3D_DIM_SDC 1177 memcpy( m_pbSDCFlag + uiOffset, pcCU->getSDCFlag(), iSizeInBool ); 1178 memcpy( m_apSegmentDCOffset[0] + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition); 1179 memcpy( m_apSegmentDCOffset[1] + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition); 1180 #endif 1133 1181 #endif 1134 1182 … … 1233 1281 memcpy( rpcCU->getEdgeLeftFirst() + m_uiAbsIdxInLCU, m_pbEdgeLeftFirst, iSizeInBool ); 1234 1282 memcpy( rpcCU->getEdgePartition( m_uiAbsIdxInLCU ), m_pbEdgePartition, iSizeInBool * 16 ); 1283 #endif 1284 #if H_3D_DIM_SDC 1285 memcpy( rpcCU->getSDCFlag() + m_uiAbsIdxInLCU, m_pbSDCFlag, iSizeInBool ); 1286 memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition); 1287 memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition); 1235 1288 #endif 1236 1289 #endif … … 1328 1381 memcpy( rpcCU->getEdgePartition( uiPartOffset ), m_pbEdgePartition, iSizeInBool * 16 ); 1329 1382 #endif 1383 #if H_3D_DIM_SDC 1384 memcpy( rpcCU->getSDCFlag() + uiPartOffset, m_pbSDCFlag, iSizeInBool ); 1385 memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart); 1386 memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart); 1387 #endif 1330 1388 #endif 1331 1389 … … 2226 2284 } 2227 2285 } 2286 2287 #if H_3D_DIM_SDC 2288 Void TComDataCU::setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ) 2289 { 2290 assert( sizeof( *m_pbSDCFlag) == 1 ); 2291 memset( m_pbSDCFlag + uiAbsPartIdx, bSDCFlag, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); 2292 } 2293 2294 Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx ) 2295 { 2296 // check general CU information 2297 if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) 2298 return false; 2299 2300 // check prediction mode 2301 UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 2302 if( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) ) 2303 return true; 2304 2305 // else 2306 return false; 2307 } 2308 #endif 2228 2309 2229 2310 Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComDataCU.h
r459 r467 202 202 Bool* m_pbEdgePartition; ///< true if it belongs to region 1, otherwise, region 0 203 203 #endif 204 #if H_3D_DIM_SDC 205 Bool* m_pbSDCFlag; 206 Pel* m_apSegmentDCOffset[2]; 207 #endif 204 208 #endif 205 209 … … 461 465 462 466 Void reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ); 467 #endif 468 #if H_3D_DIM_SDC 469 Bool* getSDCFlag () { return m_pbSDCFlag; } 470 Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } 471 Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); 472 473 Bool getSDCAvailable ( UInt uiAbsPartIdx ); 474 475 Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } 476 Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } 477 Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } 463 478 #endif 464 479 #endif -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComPrediction.cpp
r459 r467 476 476 { 477 477 #if H_3D_DIM_DLT 478 segDC1 = GetIdx2DepthValue( GetDepthValue2Idx(predDC1 ) + deltaDC1 );479 segDC2 = GetIdx2DepthValue( GetDepthValue2Idx(predDC2 ) + deltaDC2 );478 segDC1 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 ); 479 segDC2 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 ); 480 480 #else 481 481 segDC1 = ClipY( predDC1 + deltaDC1 ); … … 1479 1479 } 1480 1480 #endif 1481 #if H_3D_DIM_SDC 1482 Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) 1483 { 1484 Int iSumDepth[2]; 1485 memset(iSumDepth, 0, sizeof(Int)*2); 1486 Int iSumPix[2]; 1487 memset(iSumPix, 0, sizeof(Int)*2); 1488 1489 Int subSamplePix; 1490 if ( uiSize == 64 || uiSize == 32 ) 1491 { 1492 subSamplePix = 2; 1493 } 1494 else 1495 { 1496 subSamplePix = 1; 1497 } 1498 for (Int y=0; y<uiSize; y+=subSamplePix) 1499 { 1500 for (Int x=0; x<uiSize; x+=subSamplePix) 1501 { 1502 UChar ucSegment = pMask?(UChar)pMask[x]:0; 1503 assert( ucSegment < uiNumSegments ); 1504 1505 iSumDepth[ucSegment] += pOrig[x]; 1506 iSumPix[ucSegment] += 1; 1507 } 1508 1509 pOrig += uiStride*subSamplePix; 1510 pMask += uiMaskStride*subSamplePix; 1511 } 1512 1513 // compute mean for each segment 1514 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) 1515 { 1516 if( iSumPix[ucSeg] > 0 ) 1517 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; 1518 else 1519 rpSegMeans[ucSeg] = 0; // this happens for zero-segments 1520 } 1521 } 1522 #endif // H_3D_DIM_SDC 1481 1523 #endif 1482 1524 //! \} -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComPrediction.h
r459 r467 128 128 #if H_3D_DIM 129 129 // Depth intra 130 Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false ); 130 Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false ); 131 #if H_3D_DIM_SDC 132 Void analyzeSegmentsSDC ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ); 133 #endif 131 134 #endif 132 135 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComSlice.cpp
r459 r467 1480 1480 m_viewIndex [i] = -1; 1481 1481 m_vpsDepthModesFlag [i] = false; 1482 #if H_3D_DIM_DLT 1483 m_bUseDLTFlag [i] = false; 1484 1485 // allocate some memory and initialize with default mapping 1486 m_iNumDepthmapValues[i] = ((1 << g_bitDepthY)-1)+1; 1487 m_iBitsPerDepthValue[i] = (Int)ceil(Log2(m_iNumDepthmapValues[i])); 1488 1489 m_iDepthValue2Idx[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); 1490 m_iIdx2DepthValue[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); 1491 1492 //default mapping 1493 for (Int d=0; d<m_iNumDepthmapValues[i]; d++) 1494 { 1495 m_iDepthValue2Idx[i][d] = d; 1496 m_iIdx2DepthValue[i][d] = d; 1497 } 1498 #endif 1482 1499 #endif 1483 1500 … … 1502 1519 if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; 1503 1520 } 1521 1522 #if H_3D_DIM_DLT 1523 Void TComVPS::setDepthLUTs(Int layerIdInVps, Int* idx2DepthValue, Int iNumDepthValues) 1524 { 1525 if( idx2DepthValue == NULL || iNumDepthValues == 0 ) // default mapping only 1526 return; 1527 1528 // copy idx2DepthValue to internal array 1529 memcpy(m_iIdx2DepthValue[layerIdInVps], idx2DepthValue, iNumDepthValues*sizeof(UInt)); 1530 1531 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1); 1532 for(Int p=0; p<=uiMaxDepthValue; p++) 1533 { 1534 Int iIdxDown = 0; 1535 Int iIdxUp = iNumDepthValues-1; 1536 Bool bFound = false; 1537 1538 // iterate over indices to find lower closest depth 1539 Int i = 1; 1540 while(!bFound && i<iNumDepthValues) 1541 { 1542 if( m_iIdx2DepthValue[layerIdInVps][i] > p ) 1543 { 1544 iIdxDown = i-1; 1545 bFound = true; 1546 } 1547 1548 i++; 1549 } 1550 // iterate over indices to find upper closest depth 1551 i = iNumDepthValues-2; 1552 bFound = false; 1553 while(!bFound && i>=0) 1554 { 1555 if( m_iIdx2DepthValue[layerIdInVps][i] < p ) 1556 { 1557 iIdxUp = i+1; 1558 bFound = true; 1559 } 1560 1561 i--; 1562 } 1563 1564 // assert monotony 1565 assert(iIdxDown<=iIdxUp); 1566 1567 // assign closer depth value/idx 1568 if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) ) 1569 { 1570 m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown; 1571 } 1572 else 1573 { 1574 m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp; 1575 } 1576 1577 } 1578 1579 // update DLT variables 1580 m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues; 1581 m_iBitsPerDepthValue[layerIdInVps] = (Int)ceil(Log2(m_iNumDepthmapValues[layerIdInVps])); 1582 } 1583 #endif 1504 1584 1505 1585 #if H_MV -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TComSlice.h
r459 r467 525 525 Int m_viewIndex [MAX_NUM_LAYERS ]; 526 526 Bool m_vpsDepthModesFlag [MAX_NUM_LAYERS ]; 527 #if H_3D_DIM_DLT 528 Bool m_bUseDLTFlag [MAX_NUM_LAYERS ]; 529 530 Int m_iBitsPerDepthValue [MAX_NUM_LAYERS ]; 531 Int m_iNumDepthmapValues [MAX_NUM_LAYERS ]; 532 Int* m_iDepthValue2Idx [MAX_NUM_LAYERS ]; 533 Int* m_iIdx2DepthValue [MAX_NUM_LAYERS ]; 534 #endif 527 535 #endif 528 536 … … 646 654 Void setVpsDepthModesFlag( Int layerIdInVps, Bool val ) { m_vpsDepthModesFlag[ layerIdInVps ] = val; } 647 655 Bool getVpsDepthModesFlag( Int layerIdInVps ) { return m_vpsDepthModesFlag[ layerIdInVps ]; } 656 #if H_3D_DIM_DLT 657 Bool getUseDLTFlag ( Int layerIdInVps ) { return m_bUseDLTFlag[ layerIdInVps ]; } 658 Void setUseDLTFlag ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ] = b; } 659 660 Int getBitsPerDepthValue( Int layerIdInVps ) { return getUseDLTFlag(layerIdInVps)?m_iBitsPerDepthValue[layerIdInVps]:g_bitDepthY; } 661 Int getNumDepthValues( Int layerIdInVps ) { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); } 662 Int depthValue2idx( Int layerIdInVps, Pel value ) { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; } 663 Pel idx2DepthValue( Int layerIdInVps, UInt uiIdx ) { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][uiIdx]:uiIdx; } 664 Void setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 ); 665 #endif 648 666 #endif 649 667 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibCommon/TypeDef.h
r460 r467 87 87 // HHI_DELTADC_DLT_D0035 88 88 // PKU_QC_DEPTH_INTRA_UNI_D0195 89 // ... [PM: add SDC and DLT related]89 // RWTH_SDC_DLT_B0036 90 90 #endif 91 91 … … 107 107 #define H_3D_DIM_DMM 1 // Depth Modeling Modes 108 108 #define H_3D_DIM_RBC 1 // Region Boundary Chain mode 109 #define H_3D_DIM_SDC 0// Simplified Depth Coding method110 #define H_3D_DIM_DLT 0// Depth Lookup Table109 #define H_3D_DIM_SDC 1 // Simplified Depth Coding method 110 #define H_3D_DIM_DLT 1 // Depth Lookup Table 111 111 #define H_3D_DIM_ENC 1 // Depth Intra encoder optimizations, includes: 112 112 // HHI_DEPTH_INTRA_SEARCH_RAU_C0160 113 113 // LG_ZEROINTRADEPTHRESI_A0087 114 #if H_3D_DIM_DLT || H_3D_DIM_SDC 115 #define Log2( n ) ( log((double)n) / log(2.0) ) 116 #endif 114 117 #endif 115 118
Note: See TracChangeset for help on using the changeset viewer.