Changeset 467 in 3DVCSoftware for branches/HTM-DEV-0.3-dev1/source
- Timestamp:
- 14 Jun 2013, 17:12:18 (11 years ago)
- Location:
- branches/HTM-DEV-0.3-dev1/source
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev1/source/App/TAppEncoder/TAppEncTop.cpp
r459 r467 123 123 { 124 124 vps.setVpsDepthModesFlag( layer, ((vps.getDepthId( layer ) != 0) && (m_useDMM || m_useRBC || m_useSDC || m_useDLT)) ? true : false ); 125 #if H_3D_DIM_DLT 126 vps.setUseDLTFlag( layer , ((vps.getDepthId( layer ) != 0) && m_useDLT) ? true : false ); 127 if( vps.getUseDLTFlag( layer ) ) 128 { 129 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod, 24), &vps); 130 } 131 #endif 125 132 } 126 133 … … 986 993 } 987 994 995 #if H_3D_DIM_DLT 996 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps) 997 { 998 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; 999 // allocate original YUV buffer 1000 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1001 1002 TVideoIOYuv* depthVideoFile = new TVideoIOYuv; 1003 1004 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1); 1005 1006 Bool abValidDepths[256]; 1007 1008 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode 1009 1010 // initialize boolean array 1011 for(Int p=0; p<=uiMaxDepthValue; p++) 1012 abValidDepths[p] = false; 1013 1014 Int iHeight = pcDepthPicYuvOrg->getHeight(); 1015 Int iWidth = pcDepthPicYuvOrg->getWidth(); 1016 Int iStride = pcDepthPicYuvOrg->getStride(); 1017 1018 Pel* pInDM = pcDepthPicYuvOrg->getLumaAddr(); 1019 1020 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ ) 1021 { 1022 depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad ); 1023 1024 // check all pixel values 1025 for (Int i=0; i<iHeight; i++) 1026 { 1027 Int rowOffset = i*iStride; 1028 1029 for (Int j=0; j<iWidth; j++) 1030 { 1031 Pel depthValue = pInDM[rowOffset+j]; 1032 abValidDepths[depthValue] = true; 1033 } 1034 } 1035 } 1036 1037 depthVideoFile->close(); 1038 1039 pcDepthPicYuvOrg->destroy(); 1040 delete pcDepthPicYuvOrg; 1041 1042 // convert boolean array to idx2Depth LUT 1043 Int* aiIdx2DepthValue = (Int*) calloc(uiMaxDepthValue, sizeof(Int)); 1044 Int iNumDepthValues = 0; 1045 for(Int p=0; p<=uiMaxDepthValue; p++) 1046 { 1047 if( abValidDepths[p] == true) 1048 { 1049 aiIdx2DepthValue[iNumDepthValues++] = p; 1050 } 1051 } 1052 1053 if( uiNumFrames == 0 || (Int)ceil(Log2(iNumDepthValues)) == (Int)ceil(Log2(((1 << g_bitDepthY)-1))) ) 1054 { 1055 // don't use DLT 1056 vps->setUseDLTFlag(layer, false); 1057 } 1058 1059 // assign LUT 1060 if( vps->getUseDLTFlag(layer) ) 1061 vps->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues); 1062 1063 // free temporary memory 1064 free(aiIdx2DepthValue); 1065 } 1066 #endif 1067 988 1068 #if H_MV 989 1069 Void TAppEncTop::xSetDimensionIdAndLength( TComVPS& vps ) -
branches/HTM-DEV-0.3-dev1/source/App/TAppEncoder/TAppEncTop.h
r446 r467 121 121 Int xGetMax( std::vector<Int>& vec); 122 122 #endif 123 124 #if H_3D_DIM_DLT 125 Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps); 126 #endif 123 127 public: 124 128 TAppEncTop(); -
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 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp
r459 r467 961 961 { 962 962 READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false ); 963 964 #if H_3D_DIM_DLT 965 if( pcVPS->getVpsDepthModesFlag( i ) ) 966 { 967 READ_FLAG( uiCode, "use_dlt_flag[i]" ); 968 pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false ); 969 if( pcVPS->getUseDLTFlag( i ) ) 970 { 971 // decode mapping 972 UInt uiNumDepthValues; 973 // parse number of values in DLT 974 READ_UVLC(uiNumDepthValues, "num_dlt_depth_values[i]"); 975 976 // parse actual DLT values 977 Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int)); 978 for(Int d=0; d<uiNumDepthValues; d++) 979 { 980 READ_UVLC(uiCode, "dlt_depth_value[i][d]"); 981 aiIdx2DepthValue[d] = (Int)uiCode; 982 } 983 984 pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); 985 986 // clean memory 987 free(aiIdx2DepthValue); 988 } 989 else 990 pcVPS->setDepthLUTs(i); 991 } 992 else 993 pcVPS->setDepthLUTs(i); 994 #endif 963 995 } 964 996 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCu.cpp
r459 r467 399 399 break; 400 400 case MODE_INTRA: 401 #if H_3D_DIM_SDC 402 if( m_ppcCU[uiDepth]->getSDCFlag(0) ) 403 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); 404 else 405 #endif 401 406 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 402 407 break; … … 634 639 635 640 } 641 642 #if H_3D_DIM_SDC 643 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 644 { 645 UInt uiWidth = pcCU->getWidth ( 0 ); 646 UInt uiHeight = pcCU->getHeight ( 0 ); 647 648 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 649 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; 650 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; 651 652 UInt uiStride = pcRecoYuv->getStride (); 653 Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 654 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 655 Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 656 657 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 658 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 659 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 660 661 UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); 662 663 AOF( uiWidth == uiHeight ); 664 AOF( uiAbsPartIdx == 0 ); 665 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 666 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 667 668 //===== init availability pattern ===== 669 Bool bAboveAvail = false; 670 Bool bLeftAvail = false; 671 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 672 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); 673 674 //===== get prediction signal ===== 675 #if H_3D_DIM 676 if( isDimMode( uiLumaPredMode ) ) 677 { 678 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); 679 } 680 else 681 { 682 #endif 683 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 684 #if H_3D_DIM 685 } 686 #endif 687 688 // number of segments depends on prediction mode 689 UInt uiNumSegments = 1; 690 Bool* pbMask = NULL; 691 UInt uiMaskStride = 0; 692 693 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 694 { 695 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 696 697 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 698 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 699 700 uiNumSegments = 2; 701 pbMask = pcWedgelet->getPattern(); 702 uiMaskStride = pcWedgelet->getStride(); 703 } 704 705 // get DC prediction for each segment 706 Pel apDCPredValues[2]; 707 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); 708 709 // reconstruct residual based on mask + DC residuals 710 Pel apDCResiValues[2]; 711 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 712 { 713 #if H_3D_DIM_DLT 714 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 715 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 716 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 717 718 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 719 #else 720 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 721 #endif 722 } 723 724 //===== reconstruction ===== 725 Bool*pMask = pbMask; 726 Pel* pPred = piPred; 727 Pel* pResi = piResi; 728 Pel* pReco = piReco; 729 Pel* pRecIPred = piRecIPred; 730 731 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 732 { 733 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 734 { 735 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 736 assert( ucSegment < uiNumSegments ); 737 738 Pel pResiDC = apDCResiValues[ucSegment]; 739 740 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 741 pRecIPred[ uiX ] = pReco[ uiX ]; 742 } 743 pPred += uiStride; 744 pResi += uiStride; 745 pReco += uiStride; 746 pRecIPred += uiRecIPredStride; 747 pMask += uiMaskStride; 748 } 749 750 // clear UV 751 UInt uiStrideC = pcPredYuv->getCStride(); 752 Pel *pRecCb = pcPredYuv->getCbAddr(); 753 Pel *pRecCr = pcPredYuv->getCrAddr(); 754 755 for (Int y=0; y<uiHeight/2; y++) 756 { 757 for (Int x=0; x<uiWidth/2; x++) 758 { 759 pRecCb[x] = 128; 760 pRecCr[x] = 128; 761 } 762 763 pRecCb += uiStrideC; 764 pRecCr += uiStrideC; 765 } 766 } 767 #endif 636 768 637 769 /** Function for deriving recontructed PU/CU Luma sample with QTree structure -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCu.h
r324 r467 115 115 Void setdQPFlag ( Bool b ) { m_bDecodeDQP = b; } 116 116 Void xFillPCMBuffer (TComDataCU* pCU, UInt depth); 117 #if H_3D_DIM_SDC 118 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 119 #endif 117 120 }; 118 121 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecEntropy.cpp
r324 r467 107 107 { 108 108 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 109 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 109 #if H_3D_DIM_SDC 110 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 111 #endif 112 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 110 113 } 111 114 else // if it is Inter mode, encode motion vector and reference index … … 129 132 return; 130 133 } 134 #if H_3D_DIM_SDC 135 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 136 { 137 return; 138 } 139 #endif 131 140 132 141 m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); … … 535 544 UInt uiChromaOffset = uiLumaOffset>>2; 536 545 546 #if H_3D_DIM_SDC 547 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 548 { 549 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 550 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 551 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 552 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 553 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 554 return; 555 } 556 #endif 557 537 558 if( pcCU->isIntra(uiAbsPartIdx) ) 538 559 { -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecSbac.cpp
r459 r467 89 89 , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 90 90 #endif 91 #if H_3D_DIM_SDC 92 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 94 #endif 91 95 #endif 92 96 { … … 162 166 #if H_3D_DIM_RBC 163 167 m_cRbcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RBC_DATA ); 168 #endif 169 #if H_3D_DIM_SDC 170 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 171 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 164 172 #endif 165 173 #endif … … 222 230 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 223 231 #endif 232 #if H_3D_DIM_SDC 233 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 234 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 235 #endif 224 236 #endif 225 237 m_pcTDecBinIf->start(); … … 505 517 } 506 518 #endif 519 #if H_3D_DIM_SDC 520 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 521 { 522 assert( pcCU->getSlice()->getIsDepth() ); 523 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 524 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 525 assert( uiSegment < 2 ); 526 527 UInt uiResidual = 0; 528 UInt uiBit = 0; 529 UInt uiAbsIdx = 0; 530 UInt uiSign = 0; 531 Int iIdx = 0; 532 533 #if H_3D_DIM_DLT 534 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 535 #else 536 UInt uiMaxResidualBits = g_bitDepthY; 537 #endif 538 assert( uiMaxResidualBits <= g_bitDepthY ); 539 540 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 541 542 if (uiResidual) 543 { 544 // decode residual sign bit 545 m_pcTDecBinIf->decodeBinEP(uiSign); 546 547 // decode residual magnitude 548 // prefix part 549 UInt uiCount = 0; 550 #if H_3D_DIM_DLT 551 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 552 #else 553 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); 554 #endif 555 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 556 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 557 { 558 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 559 if ( uiBit == 0 ) 560 break; 561 else 562 uiCount++; 563 } 564 // suffix part 565 if ( uiCount == uiPrefixThreshold ) 566 { 567 for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ ) 568 { 569 m_pcTDecBinIf->decodeBinEP( uiBit ); 570 uiAbsIdx |= uiBit << ui; 571 } 572 uiAbsIdx += uiCount; 573 } 574 else 575 uiAbsIdx = uiCount; 576 577 uiAbsIdx += 1; 578 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; 579 } 580 581 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); 582 } 583 #endif 507 584 #endif 508 585 … … 962 1039 963 1040 #if H_3D_DIM_SDC 964 if( pcCU->getSDC Available(absPartIdx) && pcCU->getSDCFlag(absPartIdx) ) // sdcFlag965 { 966 //assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN);967 //pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);968 //pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth);969 970 //UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2;971 //for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++)972 //{973 // parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg);974 //}1041 if( pcCU->getSDCFlag(absPartIdx) ) 1042 { 1043 assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); 1044 pcCU->setTrIdxSubParts(0, absPartIdx, depth); 1045 pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth); 1046 1047 UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; 1048 for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1049 { 1050 xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg); 1051 } 975 1052 } 976 1053 else 977 1054 { 978 1055 #endif 979 if( dimType < DIM_NUM_TYPE )980 {981 UInt symbol;982 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );983 if( symbol )984 {985 dir += symbol;986 for( UInt segment = 0; segment < 2; segment++ )987 {988 Pel valDeltaDC = 0;989 xParseDimDeltaDC( valDeltaDC, dimType );990 pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );991 }992 }993 }1056 if( dimType < DIM_NUM_TYPE ) 1057 { 1058 UInt symbol; 1059 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); 1060 if( symbol ) 1061 { 1062 dir += symbol; 1063 for( UInt segment = 0; segment < 2; segment++ ) 1064 { 1065 Pel valDeltaDC = 0; 1066 xParseDimDeltaDC( valDeltaDC, dimType ); 1067 pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC ); 1068 } 1069 } 1070 } 994 1071 #if H_3D_DIM_SDC 995 1072 } … … 1088 1165 pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); 1089 1166 #if H_3D_DIM_SDC 1090 pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, 0,depth );1167 pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, depth ); 1091 1168 #endif 1092 1169 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecSbac.h
r459 r467 108 108 Void xParseRbcEdge ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 109 109 #endif 110 #if H_3D_DIM_SDC 111 Void xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 112 #endif 110 113 #endif 111 114 private: … … 201 204 ContextModel3DBuffer m_cRbcDataSCModel; 202 205 #endif 206 #if H_3D_DIM_SDC 207 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 208 ContextModel3DBuffer m_cSDCResidualSCModel; 209 #endif 203 210 #endif 204 211 }; -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp
r459 r467 752 752 { 753 753 WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ), "vps_depth_modes_flag[i]" ); 754 755 #if H_3D_DIM_DLT 756 if( pcVPS->getVpsDepthModesFlag( i ) ) 757 { 758 WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "use_dlt_flag[i]" ); 759 if( pcVPS->getUseDLTFlag( i ) ) 760 { 761 // code mapping 762 WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_dlt_depth_values[i]"); 763 for(Int d=0; d<pcVPS->getNumDepthValues(i); d++) 764 { 765 WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" ); 766 } 767 } 768 } 769 #endif 754 770 } 755 771 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncCu.cpp
r460 r467 1487 1487 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() ); 1488 1488 1489 #if H_3D_DIM_SDC 1490 if( !rpcTempCU->getSDCFlag( 0 ) ) 1491 #endif 1489 1492 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 1490 1493 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncEntropy.cpp
r446 r467 217 217 return; 218 218 } 219 #if H_3D_DIM_SDC 220 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 221 { 222 return; 223 } 224 #endif 219 225 220 226 if( bRD ) … … 427 433 { 428 434 encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx,true ); 435 #if H_3D_DIM_SDC 436 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 437 #endif 429 438 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 430 439 } … … 592 601 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 593 602 UInt uiChromaOffset = uiLumaOffset>>2; 594 603 604 #if H_3D_DIM_SDC 605 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 606 { 607 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 608 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 609 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 610 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 611 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 612 return; 613 } 614 #endif 615 595 616 if( pcCU->isIntra(uiAbsPartIdx) ) 596 617 { -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSbac.cpp
r459 r467 95 95 , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 96 96 #endif 97 #if H_3D_DIM_SDC 98 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 99 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 100 #endif 97 101 #endif 98 102 { … … 159 163 #if H_3D_DIM_RBC 160 164 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 165 #endif 166 #if H_3D_DIM_SDC 167 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 168 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 161 169 #endif 162 170 #endif … … 293 301 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 294 302 #endif 303 #if H_3D_DIM_SDC 304 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 305 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 306 #endif 295 307 #endif 296 308 m_pcBinIf->start(); … … 557 569 if( uiReorderSymbol != 6 ) 558 570 m_pcBinIf->encodeBin( 0, m_cRbcDataSCModel.get( 0, 0, 0 ) ); 571 } 572 } 573 #endif 574 #if H_3D_DIM_SDC 575 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) 576 { 577 assert( pcCU->getSlice()->getIsDepth() ); 578 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 579 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 580 assert( uiSegment < 2 ); 581 582 Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 583 584 UInt uiResidual = segmentDCOffset == 0 ? 0 : 1; 585 UInt uiSign = segmentDCOffset < 0 ? 1 : 0; 586 UInt uiAbsIdx = abs(segmentDCOffset); 587 588 #if H_3D_DIM_DLT 589 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 590 #else 591 UInt uiMaxResidualBits = g_bitDepthY; 592 #endif 593 assert( uiMaxResidualBits <= g_bitDepthY ); 594 595 // residual flag 596 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 597 598 if (uiResidual) 599 { 600 // encode sign bit of residual 601 m_pcBinIf->encodeBinEP( uiSign ); 602 603 #if H_3D_DIM_DLT 604 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 605 #else 606 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); 607 #endif 608 assert(uiAbsIdx <= uiNumDepthValues); 609 610 // encode residual magnitude 611 uiAbsIdx -= 1; 612 // prefix part 613 if ( uiAbsIdx == 0 ) 614 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 615 else 616 { 617 UInt l = uiAbsIdx; 618 UInt k = 0; 619 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 620 while ( l > 0 && k < uiPrefixThreshold ) 621 { 622 m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) ); 623 l--; 624 k++; 625 } 626 if ( uiAbsIdx < uiPrefixThreshold ) 627 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 628 // suffix part 629 else 630 { 631 uiAbsIdx -= uiPrefixThreshold; 632 UInt uiSuffixLength = ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); 633 UInt uiBitInfo = 0; 634 for ( Int i = 0; i < uiSuffixLength; i++) 635 { 636 uiBitInfo = ( uiAbsIdx & ( 1 << i ) ) >> i; 637 m_pcBinIf->encodeBinEP( uiBitInfo); 638 } 639 } 640 } 641 559 642 } 560 643 } … … 695 778 Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 696 779 { 780 #if H_3D_DIM_SDC 781 if ( pcCU->getSlice()->isIntra() ) 782 { 783 assert( pcCU->isIntra(uiAbsPartIdx) ); 784 return; 785 } 786 #endif 787 697 788 // get context function is here 698 789 Int iPredMode = pcCU->getPredictionMode( uiAbsPartIdx ); … … 916 1007 917 1008 #if H_3D_DIM 918 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx , Bool sdcRD)1009 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx ) 919 1010 { 920 1011 codeIntraDepthMode( pcCU, absPartIdx ); … … 953 1044 if( pcCU->getSDCFlag( absPartIdx ) ) 954 1045 { 955 // assert(pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N); 956 // UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; 957 // if(!bSdcRD) 958 // { 959 // for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 960 // { 961 // codeSDCResidualData(pcCU, uiAbsPartIdx, uiSeg); 962 // } 963 // } 1046 assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); 1047 UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; 1048 for(UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1049 { 1050 xCodeSDCResidualData(pcCU, absPartIdx, uiSeg); 1051 } 964 1052 } 965 1053 else … … 1010 1098 #if H_3D_DIM_SDC 1011 1099 if( pcCU->getSDCFlag( absPartIdx ) ) 1012 { 1013 // switch( dir ) 1014 // { 1015 // case PLANAR_IDX: codeIdx = 0; break; 1016 // case DC_IDX: codeIdx = 6; break; 1017 // case (2*DMM1_IDX+DIM_OFFSET): codeIdx = 2; break; 1018 // default: break; 1019 // } 1100 { 1101 switch( dir ) 1102 { 1103 case PLANAR_IDX: codeIdx = 0; break; 1104 case DC_IDX: codeIdx = 6; break; 1105 default: codeIdx = 2; break; 1106 } 1020 1107 } 1021 1108 #endif -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSbac.h
r459 r467 127 127 Void xCodeRbcEdge ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 128 128 #endif 129 #if H_3D_DIM_SDC 130 Void xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 131 #endif 129 132 #endif 130 133 … … 165 168 166 169 #if H_3D_DIM 167 Void codeIntraDepth ( TComDataCU* pcCU, UInt absPartIdx , Bool sdcRD = false);170 Void codeIntraDepth ( TComDataCU* pcCU, UInt absPartIdx ); 168 171 Void codeIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx ); 169 172 #endif … … 241 244 ContextModel3DBuffer m_cRbcDataSCModel; 242 245 #endif 246 #if H_3D_DIM_SDC 247 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 248 ContextModel3DBuffer m_cSDCResidualSCModel; 249 #endif 243 250 #endif 244 251 }; -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSearch.cpp
r466 r467 1838 1838 } 1839 1839 1840 #if H_3D_DIM_SDC 1841 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ) 1842 { 1843 UInt uiLumaPredMode = pcCU ->getLumaIntraDir( uiAbsPartIdx ); 1844 UInt uiWidth = pcCU ->getWidth ( 0 ); 1845 UInt uiHeight = pcCU ->getHeight ( 0 ); 1846 UInt uiStride = pcOrgYuv ->getStride (); 1847 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 1848 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1849 Pel* piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1850 1851 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1852 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1853 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1854 1855 AOF( uiWidth == uiHeight ); 1856 AOF( uiAbsPartIdx == 0 ); 1857 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 1858 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 1859 AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) ); 1860 AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || uiWidth < 64 ); 1861 1862 //===== init availability pattern ===== 1863 Bool bAboveAvail = false; 1864 Bool bLeftAvail = false; 1865 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 1866 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1867 1868 //===== get prediction signal ===== 1869 #if H_3D_DIM 1870 if( isDimMode( uiLumaPredMode ) ) 1871 { 1872 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true ); 1873 } 1874 else 1875 { 1876 #endif 1877 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1878 #if H_3D_DIM 1879 } 1880 #endif 1881 1882 // number of segments depends on prediction mode 1883 UInt uiNumSegments = 1; 1884 Bool* pbMask = NULL; 1885 UInt uiMaskStride = 0; 1886 1887 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 1888 { 1889 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 1890 1891 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 1892 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1893 1894 uiNumSegments = 2; 1895 pbMask = pcWedgelet->getPattern(); 1896 uiMaskStride = pcWedgelet->getStride(); 1897 } 1898 1899 // get DC prediction for each segment 1900 Pel apDCPredValues[2]; 1901 analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride ); 1902 1903 // get original DC for each segment 1904 Pel apDCOrigValues[2]; 1905 analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride ); 1906 1907 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1908 { 1909 // remap reconstructed value to valid depth values 1910 Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment]; 1911 1912 // get residual (idx) 1913 #if H_3D_DIM_DLT 1914 Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1915 #else 1916 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment]; 1917 #endif 1918 1919 // save SDC DC offset 1920 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx); 1921 } 1922 1923 // reconstruct residual based on mask + DC residuals 1924 Pel apDCResiValues[2]; 1925 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1926 { 1927 #if H_3D_DIM_DLT 1928 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1929 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1930 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 1931 1932 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 1933 #else 1934 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1935 #endif 1936 } 1937 1938 //===== reconstruction ===== 1939 Bool* pMask = pbMask; 1940 Pel* pPred = piPred; 1941 Pel* pReco = piReco; 1942 Pel* pRecIPred = piRecIPred; 1943 1944 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1945 { 1946 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1947 { 1948 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1949 assert( ucSegment < uiNumSegments ); 1950 1951 Pel pResiDC = apDCResiValues[ucSegment]; 1952 1953 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 1954 pRecIPred[ uiX ] = pReco[ uiX ]; 1955 } 1956 pPred += uiStride; 1957 pReco += uiStride; 1958 pRecIPred += uiRecIPredStride; 1959 pMask += uiMaskStride; 1960 } 1961 1962 // clear UV 1963 UInt uiStrideC = pcPredYuv->getCStride(); 1964 Pel *pRecCb = pcPredYuv->getCbAddr(); 1965 Pel *pRecCr = pcPredYuv->getCrAddr(); 1966 1967 for (Int y=0; y<uiHeight/2; y++) 1968 { 1969 for (Int x=0; x<uiWidth/2; x++) 1970 { 1971 pRecCb[x] = 128; 1972 pRecCr[x] = 128; 1973 } 1974 1975 pRecCb += uiStrideC; 1976 pRecCr += uiStrideC; 1977 } 1978 1979 //===== determine distortion ===== 1980 #if H_3D_VSO 1981 if( m_pcRdCost->getUseVSO() ) 1982 { 1983 if( m_pcRdCost->getUseEstimatedVSD() ) 1984 { 1985 ruiDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1986 } 1987 else 1988 { 1989 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1990 } 1991 } 1992 else 1993 #endif 1994 { 1995 ruiDist = m_pcRdCost->getDistPart( g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1996 } 1997 1998 //----- determine rate and r-d cost ----- 1999 m_pcEntropyCoder->resetBits(); 2000 2001 // encode reduced intra header 2002 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 2003 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 2004 2005 // encode pred direction + residual data 2006 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 2007 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 2008 2009 #if HHI_VSO 2010 if ( m_pcRdCost->getUseLambdaScaleVSO()) 2011 { 2012 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 2013 } 2014 else 2015 #endif 2016 { 2017 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 2018 } 2019 } 2020 #endif 1840 2021 1841 2022 Void … … 2766 2947 UInt uiBestPUDistC = 0; 2767 2948 Double dBestPUCost = MAX_DOUBLE; 2949 #if H_3D_DIM_SDC 2950 Bool bBestUseSDC = false; 2951 Pel apBestDCOffsets[2] = {0,0}; 2952 #endif 2768 2953 for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ ) 2769 2954 { 2770 #if H_3D_DIM_ENC2771 for( UInt testZeroResi = 0; testZeroResi <= ((pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP()) ? 1 : 0 ); testZeroResi++ )2772 {2773 #endif2774 2955 // set luma prediction mode 2775 2956 UInt uiOrgMode = uiRdModeList[uiMode]; … … 2777 2958 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 2778 2959 2960 #if H_3D_DIM_SDC 2961 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) ); 2962 2963 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ ) 2964 { 2965 pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth ); 2966 #endif 2967 2968 #if H_3D_DIM_ENC || H_3D_DIM_SDC 2969 Bool bTestZeroResi = false; 2970 #if H_3D_DIM_ENC 2971 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP(); 2972 #endif 2973 #if H_3D_DIM_SDC 2974 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset); 2975 #endif 2976 #endif 2977 2978 #if H_3D_DIM_ENC || H_3D_DIM_SDC 2979 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ ) 2980 { 2981 #endif 2779 2982 // set context models 2780 2983 if( m_bUseSBACRD ) … … 2797 3000 } 2798 3001 #endif 3002 #if H_3D_DIM_SDC 3003 if( pcCU->getSDCFlag(uiPartOffset) ) 3004 { 3005 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3006 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3007 3008 // start encoding with SDC 3009 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (testZeroResi!=0)); 3010 } 3011 else 3012 { 3013 #endif 2799 3014 #if HHI_RQT_INTRA_SPEEDUP 2800 3015 #if H_3D_DIM_ENC … … 2810 3025 #endif 2811 3026 #endif 3027 #if H_3D_DIM_SDC 3028 } 3029 #endif 2812 3030 2813 3031 // check r-d cost … … 2822 3040 uiBestPUDistC = uiPUDistC; 2823 3041 dBestPUCost = dPUCost; 3042 3043 #if H_3D_DIM_SDC 3044 if( pcCU->getSDCFlag(uiPartOffset) ) 3045 { 3046 bBestUseSDC = true; 3047 3048 // copy reconstruction 3049 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3050 3051 // copy DC values 3052 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3053 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3054 } 3055 else 3056 { 3057 bBestUseSDC = false; 3058 #endif 3059 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3060 3061 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3062 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3063 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3064 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3065 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3066 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3067 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3068 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3069 #if H_3D_DIM_SDC 3070 } 3071 #endif 3072 } 3073 #if HHI_RQT_INTRA_SPEEDUP_MOD 3074 else if( dPUCost < dSecondBestPUCost ) 3075 { 3076 uiSecondBestMode = uiOrgMode; 3077 dSecondBestPUCost = dPUCost; 3078 } 3079 #endif 3080 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3081 } 3082 #endif 3083 #if H_3D_DIM_SDC 3084 } // SDC loop 3085 #endif 3086 } // Mode loop 3087 3088 #if HHI_RQT_INTRA_SPEEDUP 3089 #if HHI_RQT_INTRA_SPEEDUP_MOD 3090 for( UInt ui =0; ui < 2; ++ui ) 3091 #endif 3092 { 3093 #if HHI_RQT_INTRA_SPEEDUP_MOD 3094 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode; 3095 if( uiOrgMode == MAX_UINT ) 3096 { 3097 break; 3098 } 3099 #else 3100 UInt uiOrgMode = uiBestPUMode; 3101 #endif 3102 3103 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3104 #if H_3D_DIM_SDC 3105 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth); 3106 #endif 3107 3108 // set context models 3109 if( m_bUseSBACRD ) 3110 { 3111 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3112 } 3113 3114 // determine residual for partition 3115 #if H_3D_VSO 3116 Dist uiPUDistY = 0; 3117 #else 3118 UInt uiPUDistY = 0; 3119 #endif 3120 UInt uiPUDistC = 0; 3121 Double dPUCost = 0.0; 3122 3123 #if H_3D_VSO // M37 3124 // reset Model 3125 if( m_pcRdCost->getUseRenModel() ) 3126 { 3127 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 3128 } 3129 #endif 3130 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 3131 3132 // check r-d cost 3133 if( dPUCost < dBestPUCost ) 3134 { 3135 uiBestPUMode = uiOrgMode; 3136 uiBestPUDistY = uiPUDistY; 3137 uiBestPUDistC = uiPUDistC; 3138 dBestPUCost = dPUCost; 3139 #if H_3D_DIM_SDC 3140 bBestUseSDC = false; 3141 #endif 2824 3142 2825 3143 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); … … 2834 3152 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2835 3153 } 2836 #if HHI_RQT_INTRA_SPEEDUP_MOD2837 else if( dPUCost < dSecondBestPUCost )2838 {2839 uiSecondBestMode = uiOrgMode;2840 dSecondBestPUCost = dPUCost;2841 }2842 #endif2843 #if H_3D_DIM_ENC2844 }2845 #endif2846 } // Mode loop2847 2848 #if HHI_RQT_INTRA_SPEEDUP2849 #if HHI_RQT_INTRA_SPEEDUP_MOD2850 for( UInt ui =0; ui < 2; ++ui )2851 #endif2852 {2853 #if HHI_RQT_INTRA_SPEEDUP_MOD2854 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode;2855 if( uiOrgMode == MAX_UINT )2856 {2857 break;2858 }2859 #else2860 UInt uiOrgMode = uiBestPUMode;2861 #endif2862 2863 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );2864 2865 // set context models2866 if( m_bUseSBACRD )2867 {2868 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2869 }2870 2871 // determine residual for partition2872 #if H_3D_VSO2873 Dist uiPUDistY = 0;2874 #else2875 UInt uiPUDistY = 0;2876 #endif2877 UInt uiPUDistC = 0;2878 Double dPUCost = 0.0;2879 2880 #if H_3D_VSO // M372881 // reset Model2882 if( m_pcRdCost->getUseRenModel() )2883 {2884 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );2885 }2886 #endif2887 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );2888 2889 // check r-d cost2890 if( dPUCost < dBestPUCost )2891 {2892 uiBestPUMode = uiOrgMode;2893 uiBestPUDistY = uiPUDistY;2894 uiBestPUDistC = uiPUDistC;2895 dBestPUCost = dPUCost;2896 2897 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );2898 2899 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );2900 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );2901 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2902 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2903 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2904 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2905 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2906 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2907 }2908 3154 } // Mode loop 2909 3155 #endif … … 2912 3158 uiOverallDistY += uiBestPUDistY; 2913 3159 uiOverallDistC += uiBestPUDistC; 3160 3161 #if H_3D_DIM_SDC 3162 if( bBestUseSDC ) 3163 { 3164 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3165 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3166 3167 //=== copy best DC segment values back to CU ==== 3168 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset); 3169 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset); 3170 } 3171 else 3172 { 3173 #endif 2914 3174 2915 3175 //--- update transform index and cbf --- … … 2922 3182 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) ); 2923 3183 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) ); 3184 #if H_3D_DIM_SDC 3185 } 3186 #endif 2924 3187 //--- set reconstruction for next intra prediction blocks --- 2925 3188 if( uiPU != uiNumPU - 1 ) … … 2989 3252 //=== update PU data ==== 2990 3253 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3254 #if H_3D_DIM_SDC 3255 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth ); 3256 #endif 2991 3257 pcCU->copyToPic ( uiDepth, uiPU, uiInitTrDepth ); 2992 3258 } // PU loop … … 6729 6995 6730 6996 #if H_3D_DIM_DLT 6731 rDeltaDC1 = (Int)GetDepthValue2Idx( ClipY(predDC1 + rDeltaDC1) ) - (Int)GetDepthValue2Idx(predDC1 );6732 rDeltaDC2 = (Int)GetDepthValue2Idx( ClipY(predDC2 + rDeltaDC2) ) - (Int)GetDepthValue2Idx(predDC2 );6997 rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ); 6998 rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ); 6733 6999 #endif 6734 7000 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSearch.h
r460 r467 352 352 Bool xConstructChainCode ( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight ); 353 353 #endif 354 #if H_3D_DIM_SDC 355 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ); 356 #endif 354 357 #endif 355 358
Note: See TracChangeset for help on using the changeset viewer.