Changeset 177 in 3DVCSoftware for branches/HTM-4.1-dev2-RWTH/source/Lib
- Timestamp:
- 10 Nov 2012, 19:05:41 (12 years ago)
- Location:
- branches/HTM-4.1-dev2-RWTH/source/Lib
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/ContextTables.h
r156 r177 163 163 #endif 164 164 165 #if RWTH_SDC_DLT_B0036 166 #define SDC_NUM_FLAG_CTX 3 167 #define SDC_NUM_RESIDUAL_FLAG_CTX 1 168 #define SDC_NUM_SIGN_FLAG_CTX 1 169 #define SDC_NUM_RESIDUAL_CTX 10 170 171 #define SDC_NUM_PRED_MODE_CTX 5 172 #endif 173 165 174 // ==================================================================================================================== 166 175 // Tables … … 1328 1337 #endif 1329 1338 1339 #if RWTH_SDC_DLT_B0036 1340 static const Short INIT_SDC_FLAG[3][SDC_NUM_FLAG_CTX][2] = 1341 { 1342 { 1343 { 0, 64 }, { 0, 64 }, { 0, 64 } 1344 }, 1345 { 1346 { 0, 64 }, { 0, 64 }, { 0, 64 } 1347 }, 1348 { 1349 { 0, 64 }, { 0, 64 }, { 0, 64 } 1350 } 1351 }; 1352 1353 static const Short INIT_SDC_RESIDUAL_FLAG[3][3*SDC_NUM_RESIDUAL_FLAG_CTX][2] = 1354 { 1355 { 1356 { -5, 35 }, 1357 { -0, 56 }, 1358 { -0, 56 } 1359 1360 }, 1361 { 1362 { -5, 35 }, 1363 { -0, 56 }, 1364 { -0, 56 } 1365 }, 1366 { 1367 { -5, 35 }, 1368 { -0, 56 }, 1369 { -0, 56 } 1370 } 1371 }; 1372 1373 static const Short INIT_SDC_SIGN_FLAG[3][3*SDC_NUM_SIGN_FLAG_CTX][2] = 1374 { 1375 { 1376 { -1, 56 }, 1377 { -4, 55 }, 1378 { -4, 55 } 1379 }, 1380 { 1381 { -1, 56 }, 1382 { -4, 55 }, 1383 { -4, 55 } 1384 }, 1385 { 1386 { -1, 56 }, 1387 { -4, 55 }, 1388 { -4, 55 } 1389 } 1390 }; 1391 1392 static const Short INIT_SDC_RESIDUAL[3][3*SDC_NUM_RESIDUAL_CTX][2] = 1393 { 1394 { 1395 { -1, 64 }, { 2, 64 }, { 6, 67 }, { 8, 61 }, { 7, 47 }, { 10, 33 }, { 12, 14 }, { 33, -13 }, { 12, 14 }, { 33, -13 }, 1396 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 }, 1397 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 } 1398 }, 1399 { 1400 { -1, 64 }, { 2, 64 }, { 6, 67 }, { 8, 61 }, { 7, 47 }, { 10, 33 }, { 12, 14 }, { 33, -13 }, { 12, 14 }, { 33, -13 }, 1401 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 }, 1402 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 } 1403 }, 1404 { 1405 { -1, 64 }, { 2, 64 }, { 6, 67 }, { 8, 61 }, { 7, 47 }, { 10, 33 }, { 12, 14 }, { 33, -13 }, { 12, 14 }, { 33, -13 }, 1406 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 }, 1407 { 2, 66 }, { -0, 63 }, { 1, 64 }, { 6, 65 }, { 7, 59 }, { 12, 50 }, { 14, 27 }, { -0, -17 }, { 14, 27 }, { -0, -17 } 1408 } 1409 }; 1410 1411 static const Short INIT_SDC_PRED_MODE[3][3*SDC_NUM_PRED_MODE_CTX][2] = 1412 { 1413 { 1414 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1415 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1416 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 } 1417 }, 1418 { 1419 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1420 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1421 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 } 1422 }, 1423 { 1424 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1425 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 }, 1426 { 9, 85 }, { -4, 60 }, { 4, 70 }, { 4, 70 }, { 4, 70 } 1427 } 1428 }; 1429 #endif 1430 1330 1431 //! \} 1331 1432 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComDataCU.cpp
r161 r177 158 158 #endif 159 159 #endif 160 #if RWTH_SDC_DLT_B0036 161 m_pbSDCFlag = NULL; 162 m_apSegmentDCOffset[0] = NULL; 163 m_apSegmentDCOffset[1] = NULL; 164 #endif 160 165 #if OL_DEPTHLIMIT_A0044 161 166 //add a variable to store the partition information … … 208 213 memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) ); 209 214 m_pePredMode = new Char[ uiNumPartition ]; 215 216 #if RWTH_SDC_DLT_B0036 217 m_pbSDCFlag = (Bool* )xMalloc(Bool, uiNumPartition); 218 m_apSegmentDCOffset[0] = (Pel*)xMalloc(Pel, uiNumPartition); 219 m_apSegmentDCOffset[1] = (Pel*)xMalloc(Pel, uiNumPartition); 220 #endif 210 221 211 222 m_puiAlfCtrlFlag = new Bool[ uiNumPartition ]; … … 355 366 #endif 356 367 if ( m_pePredMode ) { delete[] m_pePredMode; m_pePredMode = NULL; } 368 #if RWTH_SDC_DLT_B0036 369 if ( m_pbSDCFlag ) { xFree(m_pbSDCFlag); m_pbSDCFlag = NULL; } 370 if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]); m_apSegmentDCOffset[0] = NULL; } 371 if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]); m_apSegmentDCOffset[1] = NULL; } 372 #endif 357 373 if ( m_puhCbf[0] ) { xFree(m_puhCbf[0]); m_puhCbf[0] = NULL; } 358 374 if ( m_puhCbf[1] ) { xFree(m_puhCbf[1]); m_puhCbf[1] = NULL; } … … 546 562 m_piTextureModeDepth[ui] = pcFrom->getTextureModeDepth(ui); 547 563 #endif 564 #if RWTH_SDC_DLT_B0036 565 m_pbSDCFlag[ui] = pcFrom->getSDCFlag(ui); 566 #endif 548 567 m_puhWidth [ui] = pcFrom->getWidth(ui); 549 568 m_puhHeight [ui] = pcFrom->getHeight(ui); … … 581 600 memset( m_piTextureModeDepth+ firstElement,-1, numElements * sizeof( *m_piTextureModeDepth ) ); 582 601 #endif 602 #if RWTH_SDC_DLT_B0036 603 memset( m_pbSDCFlag + firstElement, 0, numElements * sizeof( *m_pbSDCFlag ) ); 604 memset( m_apSegmentDCOffset[0] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[0] ) ); 605 memset( m_apSegmentDCOffset[1] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[1] ) ); 606 #endif 583 607 memset( m_puhTrIdx + firstElement, 0, numElements * sizeof( *m_puhTrIdx ) ); 584 608 memset( m_nsqtPartIdx + firstElement, 0, numElements * sizeof( *m_nsqtPartIdx) ); … … 810 834 m_piContourPredTexDeltaDC2[ui] = 0; 811 835 #endif 836 #if RWTH_SDC_DLT_B0036 837 m_pbSDCFlag[ui] = false; 838 m_apSegmentDCOffset[0][ui] = 0; 839 m_apSegmentDCOffset[1][ui] = 0; 840 #endif 812 841 } 813 842 } … … 922 951 memset( m_piContourPredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); 923 952 memset( m_piContourPredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); 924 #endif 953 #endif 954 #if RWTH_SDC_DLT_B0036 955 memset( m_pbSDCFlag, 0, sizeof(Bool) * m_uiNumPartition ); 956 memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition); 957 memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition); 958 #endif 925 959 926 960 UChar uhWidth = g_uiMaxCUWidth >> uiDepth; … … 993 1027 m_pbResPredFlag [ui] = pcCU->m_pbResPredFlag [ uiPartOffset + ui ]; 994 1028 #endif 1029 #if RWTH_SDC_DLT_B0036 1030 m_pbSDCFlag [ui] = pcCU->m_pbSDCFlag [ uiPartOffset + ui ]; 1031 m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0][ uiPartOffset + ui ]; 1032 m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1][ uiPartOffset + ui ]; 1033 #endif 995 1034 } 996 1035 } … … 1202 1241 } 1203 1242 #endif 1243 #if RWTH_SDC_DLT_B0036 1244 m_pbSDCFlag = pcCU->getSDCFlag() + uiPart; 1245 m_apSegmentDCOffset[0] = pcCU->getSDCSegmentDCOffset(0) + uiPart; 1246 m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart; 1247 #endif 1204 1248 } 1205 1249 … … 1384 1428 memcpy( m_piTextureModeDepth + uiOffset, pcCU->getTextureModeDepth(), sizeof( Int ) * uiNumPartition ); 1385 1429 #endif 1430 #if RWTH_SDC_DLT_B0036 1431 memcpy( m_pbSDCFlag + uiOffset, pcCU->getSDCFlag(), iSizeInBool ); 1432 memcpy( m_apSegmentDCOffset[0] + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition); 1433 memcpy( m_apSegmentDCOffset[1] + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition); 1434 #endif 1386 1435 } 1387 1436 … … 1505 1554 memcpy( rpcCU->getTextureModeDepth() + m_uiAbsIdxInLCU, m_piTextureModeDepth, sizeof( Int ) * m_uiNumPartition ); 1506 1555 #endif 1556 #if RWTH_SDC_DLT_B0036 1557 memcpy( rpcCU->getSDCFlag() + m_uiAbsIdxInLCU, m_pbSDCFlag, iSizeInBool ); 1558 memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition); 1559 memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition); 1560 #endif 1507 1561 } 1508 1562 … … 1626 1680 #if HHI_MPI 1627 1681 memcpy( rpcCU->getTextureModeDepth() + uiPartOffset, m_piTextureModeDepth, sizeof( Int ) * uiQNumPart ); 1682 #endif 1683 #if RWTH_SDC_DLT_B0036 1684 memcpy( rpcCU->getSDCFlag() + uiPartOffset, m_pbSDCFlag, iSizeInBool ); 1685 memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart); 1686 memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart); 1628 1687 #endif 1629 1688 } … … 2955 3014 setSubPart( bMergeFlag, m_pbMergeFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2956 3015 } 3016 3017 #if RWTH_SDC_DLT_B0036 3018 Void TComDataCU::setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 3019 { 3020 setSubPart( bSDCFlag, m_pbSDCFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 3021 } 3022 3023 UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx ) 3024 { 3025 TComDataCU* pcTempCU; 3026 UInt uiTempPartIdx; 3027 UInt uiCtx = 0; 3028 3029 // left PU 3030 pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, false ); 3031 uiCtx = ( pcTempCU ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0; 3032 3033 // above PU 3034 pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, false ); 3035 uiCtx += ( pcTempCU ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0; 3036 3037 return uiCtx; 3038 } 3039 3040 Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx ) 3041 { 3042 if( !getSlice()->getSPS()->isDepth() || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) 3043 return false; 3044 3045 UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 3046 3047 if(!isIntra(uiAbsPartIdx)) 3048 return false; 3049 3050 for(UInt ui=0; ui<RWTH_SDC_NUM_PRED_MODES; ui++) 3051 { 3052 if( g_auiSDCPredModes[ui] == uiLumaPredMode ) 3053 return true; 3054 } 3055 // else 3056 return false; 3057 } 3058 #endif 2957 3059 2958 3060 Void TComDataCU::setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComDataCU.h
r152 r177 274 274 Int* m_piContourPredTexDeltaDC2; 275 275 #endif 276 277 #if RWTH_SDC_DLT_B0036 278 Bool* m_pbSDCFlag; 279 Pel* m_apSegmentDCOffset[2]; 280 #endif 276 281 277 282 protected: … … 823 828 #endif 824 829 #endif 830 831 #if RWTH_SDC_DLT_B0036 832 Bool* getSDCFlag () { return m_pbSDCFlag; } 833 Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } 834 Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 835 836 UInt getCtxSDCFlag ( UInt uiAbsPartIdx ); 837 838 Bool getSDCAvailable ( UInt uiAbsPartIdx ); 839 840 Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } 841 Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } 842 Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } 843 #endif 825 844 }; 826 845 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComRom.cpp
r158 r177 305 305 }; 306 306 307 #if RWTH_SDC_DLT_B0036 308 UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, DMM_WEDGE_PREDDIR_IDX, PLANAR_IDX }; 309 #endif 307 310 308 311 Int g_quantScales[6] = -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComRom.h
r158 r177 198 198 #endif 199 199 200 #if RWTH_SDC_DLT_B0036 201 #define RWTH_SDC_NUM_PRED_MODES 4 202 extern UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES]; 203 #endif 204 200 205 Void initWedgeLists(); 201 206 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes ); -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComSlice.cpp
r156 r177 1557 1557 1558 1558 ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) ); 1559 1560 #if RWTH_SDC_DLT_B0036 1561 m_bUseDLT = false; 1562 1563 m_uiBitsPerDepthValue = g_uiBitDepth; 1564 m_uiNumDepthmapValues = 0; 1565 m_uiDepthValue2Idx = NULL; 1566 m_uiIdx2DepthValue = NULL; 1567 #endif 1559 1568 } 1560 1569 … … 1572 1581 } 1573 1582 } 1583 1584 #if RWTH_SDC_DLT_B0036 1585 Void TComSPS::setDepthLUTs(UInt* uidx2DepthValue, UInt uiNumDepthValues) 1586 { 1587 UInt uiMaxDepthValue = g_uiIBDI_MAX; 1588 1589 // allocate some memory 1590 if( m_uiNumDepthmapValues == 0 ) 1591 { 1592 m_uiNumDepthmapValues = uiMaxDepthValue+1; 1593 m_uiBitsPerDepthValue = (UInt)ceil(log2f(m_uiNumDepthmapValues)); 1594 1595 m_uiDepthValue2Idx = (UInt*) xMalloc(UInt, m_uiNumDepthmapValues); 1596 m_uiIdx2DepthValue = (UInt*) xMalloc(UInt, m_uiNumDepthmapValues); 1597 1598 //default mapping 1599 for (Int i=0; i<m_uiNumDepthmapValues; i++) 1600 { 1601 m_uiDepthValue2Idx[i] = i; 1602 m_uiIdx2DepthValue[i] = i; 1603 } 1604 } 1605 1606 if( uidx2DepthValue == NULL || uiNumDepthValues == 0 ) // default mapping only 1607 return; 1608 1609 // copy idx2DepthValue to internal array 1610 memcpy(m_uiIdx2DepthValue, uidx2DepthValue, uiNumDepthValues*sizeof(UInt)); 1611 1612 for(Int p=0; p<=uiMaxDepthValue; p++) 1613 { 1614 Int iIdxDown = 0; 1615 Int iIdxUp = uiNumDepthValues-1; 1616 Bool bFound = false; 1617 1618 // iterate over indices to find lower closest depth 1619 Int i = 1; 1620 while(!bFound && i<uiNumDepthValues) 1621 { 1622 if( m_uiIdx2DepthValue[i] > p ) 1623 { 1624 iIdxDown = i-1; 1625 bFound = true; 1626 } 1627 1628 i++; 1629 } 1630 // iterate over indices to find upper closest depth 1631 i = uiNumDepthValues-2; 1632 bFound = false; 1633 while(!bFound && i>=0) 1634 { 1635 if( m_uiIdx2DepthValue[i] < p ) 1636 { 1637 iIdxUp = i+1; 1638 bFound = true; 1639 } 1640 1641 i--; 1642 } 1643 1644 // assert monotony 1645 assert(iIdxDown<=iIdxUp); 1646 1647 // assign closer depth value/idx 1648 if( abs(p-(Int)m_uiIdx2DepthValue[iIdxDown]) < abs(p-(Int)m_uiIdx2DepthValue[iIdxUp]) ) 1649 { 1650 m_uiDepthValue2Idx[p] = iIdxDown; 1651 } 1652 else 1653 { 1654 m_uiDepthValue2Idx[p] = iIdxUp; 1655 } 1656 1657 } 1658 1659 // update globals 1660 m_uiNumDepthmapValues = uiNumDepthValues; 1661 m_uiBitsPerDepthValue = (UInt)ceil(Log2(m_uiNumDepthmapValues)); 1662 } 1663 #endif 1574 1664 1575 1665 TComPPS::TComPPS() -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TComSlice.h
r152 r177 323 323 Bool m_bUseMVI; 324 324 #endif 325 326 #if RWTH_SDC_DLT_B0036 327 Bool m_bUseDLT; 328 329 UInt m_uiBitsPerDepthValue; 330 UInt m_uiNumDepthmapValues; 331 UInt* m_uiDepthValue2Idx; 332 UInt* m_uiIdx2DepthValue; 333 #endif 325 334 326 335 Bool m_bLFCrossTileBoundaryFlag; … … 547 556 Bool getUseMVI () {return m_bUseMVI;} 548 557 #endif 558 559 #if RWTH_SDC_DLT_B0036 560 Bool getUseDLT () { return m_bUseDLT; } 561 Void setUseDLT ( Bool b ) { m_bUseDLT = b; } 562 563 UInt getBitsPerDepthValue() { return m_bUseDLT?m_uiBitsPerDepthValue:g_uiBitDepth; } 564 UInt getNumDepthValues() { return m_bUseDLT?m_uiNumDepthmapValues:g_uiIBDI_MAX; } 565 UInt depthValue2idx(Pel uiValue) { return m_bUseDLT?m_uiDepthValue2Idx[uiValue]:uiValue; } 566 Pel idx2DepthValue(UInt uiIdx) { return m_bUseDLT?m_uiIdx2DepthValue[uiIdx]:uiIdx; } 567 Void setDepthLUTs (UInt* uidx2DepthValue = NULL, UInt uiNumDepthValues = 0); 568 #endif 549 569 550 570 UInt getMaxTLayers() { return m_uiMaxTLayers; } -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibCommon/TypeDef.h
r161 r177 134 134 #endif 135 135 136 #define RWTH_SDC_DLT_B0036 1 // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table 137 #if RWTH_SDC_DLT_B0036 138 #define Log2( n ) ( log((double)n) / log(2.0) ) 139 #endif 140 136 141 #define HHI_MPI 1 // motion parameter inheritance from texture picture for depth map coding 137 142 #define HHI_MPI_MERGE_POS 0 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp
r152 r177 1674 1674 } 1675 1675 #endif 1676 1677 READ_FLAG( uiCode, "base_view_flag" ); 1676 1677 #if RWTH_SDC_DLT_B0036 1678 if( bIsDepth ) 1679 { 1680 READ_FLAG( uiCode, "use_dlt_flag" ); 1681 pcSPS->setUseDLT( uiCode ); 1682 if( pcSPS->getUseDLT() ) 1683 { 1684 // decode mapping 1685 UInt uiNumDepthValues; 1686 // parse number of values in DLT 1687 xReadUvlc( uiNumDepthValues ); 1688 1689 // parse actual DLT values 1690 UInt* auiIdx2DepthValue = (UInt*) calloc(uiNumDepthValues, sizeof(UInt)); 1691 for(UInt d=0; d<uiNumDepthValues; d++) 1692 { 1693 xReadUvlc( uiCode ); 1694 auiIdx2DepthValue[d] = uiCode; 1695 } 1696 1697 pcSPS->setDepthLUTs(auiIdx2DepthValue, uiNumDepthValues); 1698 1699 // clean memory 1700 free(auiIdx2DepthValue); 1701 } 1702 else 1703 pcSPS->setDepthLUTs(); 1704 } 1705 #endif 1706 1707 READ_FLAG( uiCode, "base_view_flag" ); 1678 1708 if( uiCode ) 1679 1709 { // baseview SPS -> set standard values … … 2827 2857 #endif 2828 2858 2859 #if RWTH_SDC_DLT_B0036 2860 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2861 { 2862 assert(0); 2863 } 2864 Void TDecCavlc::parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2865 { 2866 assert(0); 2867 } 2868 Void TDecCavlc::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) 2869 { 2870 assert(0); 2871 } 2872 #endif 2873 2829 2874 // ==================================================================================================================== 2830 2875 // Protected member functions -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecCAVLC.h
r152 r177 178 178 Void parseDFFlag ( UInt& ruiVal, const Char *pSymbolName ); 179 179 Void parseDFSvlc ( Int& riVal, const Char *pSymbolName ); 180 #if RWTH_SDC_DLT_B0036 181 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 182 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 183 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 184 #endif 180 185 protected: 181 186 #if DBL_CONTROL -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecCu.cpp
r156 r177 37 37 38 38 #include "TDecCu.h" 39 40 #if RWTH_SDC_DLT_B0036 41 #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val)) 42 #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val)) 43 #endif 39 44 40 45 //! \ingroup TLibDecoder … … 608 613 break; 609 614 case MODE_INTRA: 615 #if RWTH_SDC_DLT_B0036 616 if( m_ppcCU[uiDepth]->getSDCFlag(0) ) 617 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); 618 else 619 #endif 610 620 xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); 611 621 break; … … 951 961 952 962 } 963 964 #if RWTH_SDC_DLT_B0036 965 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 966 { 967 UInt uiWidth = pcCU->getWidth ( 0 ); 968 UInt uiHeight = pcCU->getHeight ( 0 ); 969 970 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 971 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; 972 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; 973 974 UInt uiStride = pcRecoYuv->getStride (); 975 Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 976 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 977 Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 978 979 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 980 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 981 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 982 983 UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); 984 985 AOF( uiWidth == uiHeight ); 986 AOF( uiAbsPartIdx == 0 ); 987 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 988 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 989 990 //===== init availability pattern ===== 991 Bool bAboveAvail = false; 992 Bool bLeftAvail = false; 993 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 994 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); 995 996 //===== get prediction signal ===== 997 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 998 if( uiLumaPredMode >= NUM_INTRA_MODE ) 999 { 1000 m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); 1001 } 1002 else 1003 { 1004 #endif 1005 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 1006 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1007 } 1008 #endif 1009 1010 // number of segments depends on prediction mode 1011 UInt uiNumSegments = 1; 1012 Bool* pbMask = NULL; 1013 UInt uiMaskStride = 0; 1014 1015 //if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) 1016 if( 0 ) 1017 { 1018 Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); 1019 1020 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 1021 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1022 1023 uiNumSegments = 2; 1024 pbMask = pcWedgelet->getPattern(); 1025 uiMaskStride = pcWedgelet->getStride(); 1026 } 1027 1028 // get DC prediction for each segment 1029 Pel apDCPredValues[2]; 1030 xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); 1031 1032 // reconstruct residual based on mask + DC residuals 1033 Pel apDCResiValues[2]; 1034 Pel apDCRecoValues[2]; 1035 for( UInt ui = 0; ui < uiNumSegments; ui++ ) 1036 { 1037 Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); 1038 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); 1039 Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); 1040 1041 apDCRecoValues[ui] = pRecoValue; 1042 apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; 1043 } 1044 1045 //===== reconstruction ===== 1046 Bool*pMask = pbMask; 1047 Pel* pPred = piPred; 1048 Pel* pResi = piResi; 1049 Pel* pReco = piReco; 1050 Pel* pRecIPred = piRecIPred; 1051 1052 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1053 { 1054 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1055 { 1056 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1057 assert( ucSegment < uiNumSegments ); 1058 1059 Pel pPredVal= apDCPredValues[ucSegment]; 1060 Pel pResiDC = apDCResiValues[ucSegment]; 1061 1062 pReco [ uiX ] = Clip( pPredVal + pResiDC ); 1063 pRecIPred[ uiX ] = pReco[ uiX ]; 1064 } 1065 pPred += uiStride; 1066 pResi += uiStride; 1067 pReco += uiStride; 1068 pRecIPred += uiRecIPredStride; 1069 pMask += uiMaskStride; 1070 } 1071 1072 // clear UV 1073 UInt uiStrideC = pcPredYuv->getCStride(); 1074 Pel *pRecCb = pcPredYuv->getCbAddr(); 1075 Pel *pRecCr = pcPredYuv->getCrAddr(); 1076 1077 for (Int y=0; y<uiHeight/2; y++) 1078 { 1079 for (Int x=0; x<uiWidth/2; x++) 1080 { 1081 pRecCb[x] = (Pel)(128<<g_uiBitIncrement); 1082 pRecCr[x] = (Pel)(128<<g_uiBitIncrement); 1083 } 1084 1085 pRecCb += uiStrideC; 1086 pRecCr += uiStrideC; 1087 } 1088 } 1089 #endif 953 1090 954 1091 /** Function for deriving recontructed PU/CU Luma sample with QTree structure … … 1216 1353 #endif 1217 1354 1355 #if RWTH_SDC_DLT_B0036 1356 Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) 1357 { 1358 Int iSumDepth[uiNumSegments]; 1359 memset(iSumDepth, 0, sizeof(Int)*uiNumSegments); 1360 Int iSumPix[uiNumSegments]; 1361 memset(iSumPix, 0, sizeof(Int)*uiNumSegments); 1362 1363 for (Int y=0; y<uiSize; y++) 1364 { 1365 for (Int x=0; x<uiSize; x++) 1366 { 1367 UChar ucSegment = pMask?(UChar)pMask[x]:0; 1368 assert( ucSegment < uiNumSegments ); 1369 1370 iSumDepth[ucSegment] += pOrig[x]; 1371 iSumPix[ucSegment] += 1; 1372 } 1373 1374 pOrig += uiStride; 1375 pMask += uiMaskStride; 1376 } 1377 1378 // compute mean for each segment 1379 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) 1380 { 1381 if( iSumPix[ucSeg] > 0 ) 1382 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; 1383 else 1384 rpSegMeans[ucSeg] = 0; // this happens for zero-segments 1385 } 1386 } 1387 #endif 1388 1218 1389 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecCu.h
r56 r177 121 121 Void xFillPCMBuffer (TComDataCU* pCU, UInt absPartIdx, UInt depth); 122 122 #endif 123 #if RWTH_SDC_DLT_B0036 124 Void xAnalyzeSegmentsSDC ( Pel* pOrig, 125 UInt uiStride, 126 UInt uiSize, 127 Pel* rpSegMeans, 128 UInt uiNumSegments, 129 Bool* pMask, 130 UInt uiMaskStride ); 131 132 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 133 #endif 123 134 }; 124 135 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecEntropy.cpp
r152 r177 147 147 { 148 148 m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); 149 150 #if RWTH_SDC_DLT_B0036 151 // if B-Slice, code SDC flag later 152 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->isDepth() ) 153 { 154 // decode SDC flag 155 decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth); 156 } 157 #endif 149 158 } 150 159 151 160 Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 152 161 { 162 #if RWTH_SDC_DLT_B0036 163 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) 164 { 165 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 166 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); 167 return; 168 } 169 #endif 170 153 171 m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); 172 173 #if RWTH_SDC_DLT_B0036 174 if( pcCU->getSlice()->isInterB() && pcCU->getSlice()->getSPS()->isDepth() && pcCU->isIntra(uiAbsPartIdx) ) 175 { 176 // decode SDC flag 177 decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth); 178 179 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 180 { 181 // part size is also known for SDC intra 182 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 183 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); 184 } 185 } 186 #endif 154 187 } 155 188 156 189 Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) 157 190 { 191 #if RWTH_SDC_DLT_B0036 192 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 193 { 194 decodeSDCPredMode(pcCU, uiAbsPartIdx, uiDepth); 195 return; 196 } 197 #endif 198 158 199 PartSize eMode = pcCU->getPartitionSize( uiAbsPartIdx ); 159 200 … … 196 237 return; 197 238 } 239 240 #if RWTH_SDC_DLT_B0036 241 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 242 { 243 return; 244 } 245 #endif 198 246 199 247 m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); … … 912 960 #endif 913 961 962 #if RWTH_SDC_DLT_B0036 963 if( pcCU->getSDCAvailable(uiAbsPartIdx) && pcCU->getSDCFlag( uiAbsPartIdx ) ) 964 { 965 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 966 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 967 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 968 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 969 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 970 971 decodeSDCResidualData(pcCU, uiAbsPartIdx, uiDepth); 972 return; 973 } 974 #endif 975 914 976 if( pcCU->isIntra(uiAbsPartIdx) ) 915 977 { … … 954 1016 } 955 1017 1018 #if RWTH_SDC_DLT_B0036 1019 Void TDecEntropy::decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1020 { 1021 assert( pcCU->getSlice()->getSPS()->isDepth() ); 1022 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 1023 1024 m_pcEntropyDecoderIf->parseSDCPredMode(pcCU, uiAbsPartIdx, uiDepth ); 1025 } 1026 1027 Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1028 { 1029 assert( pcCU->getSlice()->getSPS()->isDepth() ); 1030 1031 m_pcEntropyDecoderIf->parseSDCFlag(pcCU, uiAbsPartIdx, uiDepth ); 1032 } 1033 1034 Void TDecEntropy::decodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1035 { 1036 assert( pcCU->getSlice()->getSPS()->isDepth() ); 1037 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 1038 1039 // number of segments depends on prediction mode for INTRA 1040 UInt uiNumSegments = 2; 1041 UInt uiLumaPredMode = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1042 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && (uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX) ) 1043 uiNumSegments = 1; 1044 1045 // decode residual data for each segment 1046 for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) 1047 m_pcEntropyDecoderIf->parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); 1048 } 1049 #endif 1050 956 1051 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecEntropy.h
r152 r177 142 142 virtual Void updateContextTables( SliceType eSliceType, Int iQp ) = 0; 143 143 144 #if RWTH_SDC_DLT_B0036 145 virtual Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 146 virtual Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 147 virtual Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0; 148 #endif 149 144 150 virtual ~TDecEntropyIf() {} 145 151 }; … … 256 262 Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); } 257 263 #endif 264 265 #if RWTH_SDC_DLT_B0036 266 Void decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 267 Void decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 268 Void decodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 269 #endif 258 270 259 271 };// END CLASS DEFINITION TDecEntropy -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecSbac.cpp
r152 r177 38 38 #include "TDecSbac.h" 39 39 40 #if RWTH_SDC_DLT_B0036 41 #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues()) 42 #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue()) 43 #endif 44 40 45 //! \ingroup TLibDecoder 41 46 //! \{ … … 106 111 , m_cEdgeIntraDeltaDCSCModel ( 1, 1, NUM_EDGE_INTRA_DELTA_DC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 107 112 #endif 113 #endif 114 #if RWTH_SDC_DLT_B0036 115 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 116 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 117 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 119 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 108 120 #endif 109 121 { … … 206 218 m_cDmmDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_DATA ); 207 219 #endif 220 #if RWTH_SDC_DLT_B0036 221 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG ); 222 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 223 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 224 m_cSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG ); 225 m_cSDCPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE ); 226 #endif 208 227 209 228 // new structure … … 285 304 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 286 305 #endif 306 #if RWTH_SDC_DLT_B0036 307 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 308 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 309 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 310 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 311 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 312 #endif 287 313 288 314 m_pcTDecBinIf->start(); … … 2486 2512 } 2487 2513 #endif 2514 2515 #if RWTH_SDC_DLT_B0036 2516 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2517 { 2518 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2519 2520 UInt uiSymbol = 0; 2521 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2522 m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2523 2524 if( uiSymbol == 1 ) 2525 { 2526 pcCU->setPartSizeSubParts(SIZE_2Nx2N, uiAbsPartIdx, uiDepth); 2527 2528 pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth); 2529 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); 2530 pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); 2531 } 2532 } 2533 2534 Void TDecSbac::parseSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2535 { 2536 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2537 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 2538 2539 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2540 2541 UInt uiCtx = 0; 2542 2543 UInt uiMPModeIdx = 0; 2544 2545 for(Int i=0; i<RWTH_SDC_NUM_PRED_MODES-1; i++) 2546 { 2547 UInt uiIsMostProb = 0; 2548 m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2549 2550 if ( uiIsMostProb == 1 ) 2551 break; 2552 2553 // else: get next most probable pred mode 2554 uiMPModeIdx = (uiMPModeIdx+1)%RWTH_SDC_NUM_PRED_MODES; 2555 } 2556 2557 Int intraPredMode = g_auiSDCPredModes[uiMPModeIdx]; 2558 2559 #if HHI_DMM_WEDGE_INTRA 2560 if( intraPredMode == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 2561 if( intraPredMode == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 2562 #endif 2563 2564 pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth); 2565 } 2566 2567 Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 2568 { 2569 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2570 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2571 assert( uiSegment < 2 ); 2572 2573 UInt uiResidual = 0; 2574 UInt uiBit = 0; 2575 UInt uiAbsIdx = 0; 2576 UInt uiSign = 0; 2577 Int iIdx = 0; 2578 2579 UInt uiMaxResidualBits = GetBitsPerDepthValue(); 2580 assert( uiMaxResidualBits <= g_uiBitDepth ); 2581 2582 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); 2583 2584 if (uiResidual) 2585 { 2586 // decode residual sign bit 2587 m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); 2588 2589 // decode residual magnitude 2590 for (Int i=0; i<uiMaxResidualBits; i++) 2591 { 2592 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); 2593 uiAbsIdx |= uiBit << i; 2594 } 2595 2596 uiAbsIdx += 1; 2597 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; 2598 } 2599 2600 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); 2601 } 2602 #endif 2488 2603 2489 2604 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibDecoder/TDecSbac.h
r152 r177 126 126 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam); 127 127 #endif 128 129 #if RWTH_SDC_DLT_B0036 130 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 131 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 132 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 133 #endif 128 134 private: 129 135 Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ); … … 269 275 #endif 270 276 #endif 277 278 #if RWTH_SDC_DLT_B0036 279 ContextModel3DBuffer m_cSDCFlagSCModel; 280 281 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 282 ContextModel3DBuffer m_cSDCResidualSignFlagSCModel; 283 ContextModel3DBuffer m_cSDCResidualSCModel; 284 285 ContextModel3DBuffer m_cSDCPredModeSCModel; 286 #endif 271 287 }; 272 288 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp
r152 r177 644 644 } 645 645 #endif 646 647 #if RWTH_SDC_DLT_B0036 648 if( bIsDepth ) 649 { 650 WRITE_FLAG( pcSPS->getUseDLT() ? 1 : 0, "use_dlt_flag" ); 651 if( pcSPS->getUseDLT() ) 652 { 653 // code mapping 654 xWriteUvlc ( pcSPS->getNumDepthValues() ); 655 for(UInt i=0; i<pcSPS->getNumDepthValues(); i++) 656 { 657 xWriteUvlc( pcSPS->idx2DepthValue(i) ); 658 } 659 } 660 } 661 #endif 646 662 647 663 if( pcSPS->getViewId() || pcSPS->isDepth() ) … … 2066 2082 return true; 2067 2083 } 2084 2085 #if RWTH_SDC_DLT_B0036 2086 Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2087 { 2088 assert(0); 2089 } 2090 2091 Void TEncCavlc::codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) 2092 { 2093 assert(0); 2094 } 2095 2096 Void TEncCavlc::codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2097 { 2098 assert(0); 2099 } 2100 #endif 2068 2101 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncCavlc.h
r152 r177 223 223 Void codeDFFlag ( UInt uiCode, const Char *pSymbolName ); 224 224 Void codeDFSvlc ( Int iCode, const Char *pSymbolName ); 225 226 #if RWTH_SDC_DLT_B0036 227 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 228 Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 229 Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 230 #endif 225 231 226 232 }; -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncCfg.h
r152 r177 250 250 Bool m_bUseMVI; 251 251 #endif 252 #if RWTH_SDC_DLT_B0036 253 Bool m_bUseDLT; 254 Bool m_bUseSDC; 255 #endif 252 256 253 257 Int* m_aidQP; … … 690 694 #if HHI_MPI 691 695 Void setUseMVI ( Bool bVal ) {m_bUseMVI = bVal;} 696 #endif 697 #if RWTH_SDC_DLT_B0036 698 Void setUseDLT ( Bool b ) { m_bUseDLT = b; } 699 Void setUseSDC ( Bool b ) { m_bUseSDC = b; } 692 700 #endif 693 701 Void setUseSAO ( Bool bVal ) {m_bUseSAO = bVal;} … … 830 838 Bool getUseDMM() { return m_bUseDMM; } 831 839 #endif 840 841 #if RWTH_SDC_DLT_B0036 842 Bool getUseDLT() { return m_bUseDLT; } 843 Bool getUseSDC() { return m_bUseSDC; } 844 #endif 832 845 833 846 #if OL_DEPTHLIMIT_A0044 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncCu.cpp
r161 r177 2308 2308 // do MC 2309 2309 #if HHI_INTERVIEW_SKIP 2310 if ( (uiNoResidual == 0) || bSkipRes ){ 2311 #else 2312 if ( uiNoResidual == 0 ){ 2313 #endif 2310 if ( (uiNoResidual == 0) || bSkipRes ) 2311 #else 2312 if ( uiNoResidual == 0 ) 2313 #endif 2314 { 2314 2315 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 2315 2316 // save pred adress … … 2541 2542 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() ); 2542 2543 2544 #if RWTH_SDC_DLT_B0036 2545 if( !rpcTempCU->getSDCFlag( 0 ) ) 2546 #endif 2543 2547 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 2544 2548 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncEntropy.cpp
r152 r177 905 905 #endif 906 906 907 #if !RWTH_SDC_DLT_B0036 907 908 if ( pcCU->getSlice()->isIntra() ) 908 909 { 909 910 return; 910 911 } 912 #endif 911 913 912 914 m_pcEntropyCoderIf->codePredMode( pcCU, uiAbsPartIdx ); 915 916 #if RWTH_SDC_DLT_B0036 917 // if B-Slice, code SDC flag later 918 if( !pcCU->getSlice()->isInterB() && pcCU->getSlice()->getSPS()->isDepth() && pcCU->isIntra(uiAbsPartIdx) ) 919 { 920 // encode SDC flag 921 encodeSDCFlag(pcCU, uiAbsPartIdx, bRD); 922 } 923 #endif 913 924 } 914 925 … … 955 966 } 956 967 #endif 968 #if RWTH_SDC_DLT_B0036 969 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) 970 { 971 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 972 return; 973 } 974 #endif 975 957 976 m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth ); 977 978 #if RWTH_SDC_DLT_B0036 979 // code SDC flag now! 980 if( pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->isDepth() ) 981 { 982 // encode SDC flag 983 encodeSDCFlag(pcCU, uiAbsPartIdx, bRD); 984 985 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 986 { 987 // part size is also known for SDC intra 988 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 989 } 990 } 991 #endif 958 992 } 959 993 … … 972 1006 return; 973 1007 } 1008 1009 #if RWTH_SDC_DLT_B0036 1010 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 1011 { 1012 return; 1013 } 1014 #endif 974 1015 975 1016 if( bRD ) … … 1307 1348 } 1308 1349 1350 #if RWTH_SDC_DLT_B0036 1351 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 1352 { 1353 encodeSDCPredMode(pcCU, uiAbsPartIdx, bRD); 1354 return; 1355 } 1356 #endif 1357 1309 1358 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 1310 1359 … … 1636 1685 UInt uiLumaTrMode, uiChromaTrMode; 1637 1686 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode ); 1687 1688 #if RWTH_SDC_DLT_B0036 1689 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 1690 { 1691 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 1692 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 1693 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 1694 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 1695 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 1696 1697 encodeSDCResidualData(pcCU, uiAbsPartIdx); 1698 return; 1699 } 1700 #endif 1638 1701 1639 1702 if( pcCU->isIntra(uiAbsPartIdx) ) … … 2009 2072 } 2010 2073 2074 #if RWTH_SDC_DLT_B0036 2075 Void TEncEntropy::encodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 2076 { 2077 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2078 2079 if( bRD ) 2080 uiAbsPartIdx = 0; 2081 2082 m_pcEntropyCoderIf->codeSDCPredMode(pcCU, uiAbsPartIdx); 2083 } 2084 2085 Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 2086 { 2087 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2088 2089 if( bRD ) 2090 uiAbsPartIdx = 0; 2091 2092 m_pcEntropyCoderIf->codeSDCFlag(pcCU, uiAbsPartIdx); 2093 } 2094 2095 Void TEncEntropy::encodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 2096 { 2097 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2098 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 2099 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 2100 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 2101 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 2102 2103 if( bRD ) 2104 uiAbsPartIdx = 0; 2105 2106 // number of segments depends on prediction mode for INTRA 2107 UInt uiNumSegments = 2; 2108 UInt uiLumaPredMode = pcCU->getLumaIntraDir( uiAbsPartIdx ); 2109 if( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX ) 2110 uiNumSegments = 1; 2111 2112 // encode residual data for each segment 2113 for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) 2114 m_pcEntropyCoderIf->codeSDCResidualData(pcCU, uiAbsPartIdx, uiSeg); 2115 } 2116 #endif 2117 2011 2118 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncEntropy.h
r152 r177 128 128 virtual Void codePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 129 129 130 #if RWTH_SDC_DLT_B0036 131 virtual Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 132 virtual Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0; 133 virtual Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 134 #endif 135 130 136 #if BURST_IPCM 131 137 virtual Void codeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag) = 0; … … 302 308 Void encodeScalingList ( TComScalingList* scalingList ); 303 309 Void encodeDFParams (TComAPS* pcAPS); 310 311 #if RWTH_SDC_DLT_B0036 312 Void encodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 313 Void encodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 314 Void encodeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 315 #endif 304 316 305 317 private: -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp
r156 r177 42 42 #include <algorithm> 43 43 44 #if RWTH_SDC_DLT_B0036 45 #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues()) 46 #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue()) 47 #endif 48 44 49 //! \ingroup TLibEncoder 45 50 //! \{ … … 114 119 , m_cEdgeIntraDeltaDCSCModel ( 1, 1, NUM_EDGE_INTRA_DELTA_DC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 115 120 #endif 121 #endif 122 #if RWTH_SDC_DLT_B0036 123 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 124 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 125 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 126 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 127 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 116 128 #endif 117 129 { … … 199 211 #endif 200 212 #endif 213 #if RWTH_SDC_DLT_B0036 214 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 215 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 216 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 217 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 218 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 219 #endif 201 220 202 221 // new structure … … 353 372 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 354 373 #endif 374 #if RWTH_SDC_DLT_B0036 375 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 376 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 377 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 378 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 379 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 380 #endif 355 381 356 382 m_pcBinIf->start(); … … 750 776 Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 751 777 { 778 #if RWTH_SDC_DLT_B0036 779 if ( pcCU->getSlice()->isIntra() ) 780 { 781 assert( pcCU->isIntra(uiAbsPartIdx) ); 782 return; 783 } 784 #endif 785 752 786 // get context function is here 753 787 Int iPredMode = pcCU->getPredictionMode( uiAbsPartIdx ); … … 2678 2712 } 2679 2713 #endif 2714 2715 #if RWTH_SDC_DLT_B0036 2716 Void TEncSbac::codeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2717 { 2718 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2719 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 2720 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2721 2722 UInt uiPredMode = pcCU->getLumaIntraDir(uiAbsPartIdx); 2723 UInt uiCtx = 0; 2724 2725 UInt uiMPModeIdx = 0; 2726 2727 for(Int i=0; i<RWTH_SDC_NUM_PRED_MODES-1; i++) 2728 { 2729 UInt uiBit = (uiPredMode == g_auiSDCPredModes[uiMPModeIdx]) ? 1 : 0; 2730 m_pcBinIf->encodeBin( uiBit, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2731 2732 // if mode is most probable mode, we are done here 2733 if ( uiBit == 1 ) 2734 break; 2735 2736 // else: get next most probable pred mode 2737 uiMPModeIdx = (uiMPModeIdx+1)%RWTH_SDC_NUM_PRED_MODES; 2738 } 2739 2740 #if HHI_DMM_WEDGE_INTRA 2741 if( uiPredMode == DMM_WEDGE_FULL_IDX ) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 2742 if( uiPredMode == DMM_WEDGE_PREDDIR_IDX ) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 2743 #endif 2744 2745 AOF(uiPredMode == g_auiSDCPredModes[uiMPModeIdx]); 2746 } 2747 2748 Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2749 { 2750 // get context function is here 2751 UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0; 2752 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2753 m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2754 2755 } 2756 2757 Void TEncSbac::codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) 2758 { 2759 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2760 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 2761 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2762 assert( uiSegment < 2 ); 2763 2764 Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 2765 2766 UInt uiResidual = segmentDCOffset == 0 ? 0 : 1; 2767 UInt uiSign = segmentDCOffset < 0 ? 1 : 0; 2768 UInt uiAbsIdx = abs(segmentDCOffset); 2769 UInt uiBit = 0; 2770 2771 UInt uiMaxResidualBits = GetBitsPerDepthValue(); 2772 assert( uiMaxResidualBits <= g_uiBitDepth ); 2773 2774 // residual flag 2775 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection 2776 2777 if (uiResidual) 2778 { 2779 // encode sign bit of residual 2780 m_pcBinIf->encodeBin( uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection 2781 2782 assert(uiAbsIdx < GetNumDepthValues()); 2783 2784 // encode residual magnitude 2785 uiAbsIdx -= 1; 2786 for (Int i=0; i<uiMaxResidualBits; i++) 2787 { 2788 uiBit = (uiAbsIdx & (1<<i))>>i; 2789 2790 m_pcBinIf->encodeBin( uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); //TODO depthmap: more sophisticated context selection 2791 } 2792 2793 } 2794 } 2795 #endif 2680 2796 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncSbac.h
r152 r177 145 145 #endif 146 146 Void codeScalingList ( TComScalingList* scalingList ){ assert (0); return;}; 147 148 #if RWTH_SDC_DLT_B0036 149 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 150 Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 151 Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 152 #endif 147 153 148 154 private: … … 322 328 #endif 323 329 #endif 330 331 #if RWTH_SDC_DLT_B0036 332 ContextModel3DBuffer m_cSDCFlagSCModel; 333 334 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 335 ContextModel3DBuffer m_cSDCResidualSignFlagSCModel; 336 ContextModel3DBuffer m_cSDCResidualSCModel; 337 338 ContextModel3DBuffer m_cSDCPredModeSCModel; 339 #endif 324 340 }; 325 341 -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp
r158 r177 42 42 #include <math.h> 43 43 44 #if RWTH_SDC_DLT_B0036 45 #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val)) 46 #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val)) 47 #endif 48 44 49 //! \ingroup TLibEncoder 45 50 //! \{ … … 195 200 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + 1; 196 201 for( Int iNum = 0; iNum < iNumAMVPCands+1; iNum++) 197 {198 202 for( Int iIdx = 0; iIdx < iNumAMVPCands; iIdx++) 199 203 #else 200 204 for( Int iNum = 0; iNum < AMVP_MAX_NUM_CANDS+1; iNum++) 201 {202 205 for( Int iIdx = 0; iIdx < AMVP_MAX_NUM_CANDS; iIdx++) 203 206 #endif … … 208 211 m_auiMVPIdxCost[iIdx][iNum] = MAX_INT; 209 212 } 210 }211 213 212 214 initTempBuff(); … … 1599 1601 } 1600 1602 1603 #if RWTH_SDC_DLT_B0036 1604 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ) 1605 { 1606 UInt uiLumaPredMode = pcCU ->getLumaIntraDir( uiAbsPartIdx ); 1607 UInt uiWidth = pcCU ->getWidth ( 0 ); 1608 UInt uiHeight = pcCU ->getHeight ( 0 ); 1609 UInt uiStride = pcOrgYuv ->getStride (); 1610 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 1611 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1612 Pel* piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1613 1614 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1615 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1616 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1617 1618 AOF( uiWidth == uiHeight ); 1619 AOF( uiAbsPartIdx == 0 ); 1620 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 1621 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 1622 1623 //===== init availability pattern ===== 1624 Bool bAboveAvail = false; 1625 Bool bLeftAvail = false; 1626 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 1627 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1628 1629 //===== get prediction signal ===== 1630 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1631 if( uiLumaPredMode >= NUM_INTRA_MODE ) 1632 { 1633 predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, true ); 1634 } 1635 else 1636 { 1637 #endif 1638 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 1639 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1640 } 1641 #endif 1642 1643 // number of segments depends on prediction mode 1644 UInt uiNumSegments = 1; 1645 Bool* pbMask = NULL; 1646 UInt uiMaskStride = 0; 1647 1648 //if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) 1649 if( 0 ) 1650 { 1651 Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); 1652 1653 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 1654 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1655 1656 uiNumSegments = 2; 1657 pbMask = pcWedgelet->getPattern(); 1658 uiMaskStride = pcWedgelet->getStride(); 1659 } 1660 1661 // get DC prediction for each segment 1662 Pel apDCPredValues[2]; 1663 xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride ); 1664 1665 // get original DC for each segment 1666 Pel apDCOrigValues[2]; 1667 xAnalyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride ); 1668 1669 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1670 { 1671 // remap reconstructed value to valid depth values 1672 Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment]; 1673 1674 // get residual (idx) 1675 Pel pResidualIdx = GetDepthValue2Idx( pDCRec ) - GetDepthValue2Idx( apDCPredValues[uiSegment] ); 1676 1677 // save SDC DC offset 1678 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx); 1679 } 1680 1681 // reconstruct residual based on mask + DC residuals 1682 Pel apDCResiValues[2]; 1683 Pel apDCRecoValues[2]; 1684 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1685 { 1686 Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[uiSegment] ); 1687 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1688 Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); 1689 1690 apDCRecoValues[uiSegment] = pRecoValue; 1691 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 1692 } 1693 1694 //===== reconstruction ===== 1695 Bool* pMask = pbMask; 1696 Pel* pPred = piPred; 1697 Pel* pReco = piReco; 1698 Pel* pRecIPred = piRecIPred; 1699 1700 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1701 { 1702 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1703 { 1704 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1705 assert( ucSegment < uiNumSegments ); 1706 1707 Pel pPredVal= apDCPredValues[ucSegment]; 1708 Pel pResiDC = apDCResiValues[ucSegment]; 1709 1710 pReco [ uiX ] = Clip( pPredVal + pResiDC ); 1711 pRecIPred[ uiX ] = pReco[ uiX ]; 1712 } 1713 pPred += uiStride; 1714 pReco += uiStride; 1715 pRecIPred += uiRecIPredStride; 1716 pMask += uiMaskStride; 1717 } 1718 1719 // clear UV 1720 UInt uiStrideC = pcPredYuv->getCStride(); 1721 Pel *pRecCb = pcPredYuv->getCbAddr(); 1722 Pel *pRecCr = pcPredYuv->getCrAddr(); 1723 1724 for (Int y=0; y<uiHeight/2; y++) 1725 { 1726 for (Int x=0; x<uiWidth/2; x++) 1727 { 1728 pRecCb[x] = (Pel)(128<<g_uiBitIncrement); 1729 pRecCr[x] = (Pel)(128<<g_uiBitIncrement); 1730 } 1731 1732 pRecCb += uiStrideC; 1733 pRecCr += uiStrideC; 1734 } 1735 1736 //===== determine distortion ===== 1737 #if HHI_VSO 1738 if ( m_pcRdCost->getUseVSO() ) 1739 { 1740 ruiDist = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 ); 1741 } 1742 else 1743 #endif 1744 { 1745 ruiDist = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1746 } 1747 1748 //----- determine rate and r-d cost ----- 1749 m_pcEntropyCoder->resetBits(); 1750 1751 // encode reduced intra header 1752 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 1753 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 1754 1755 // encode pred direction + residual data 1756 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 1757 1758 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 1759 1760 #if HHI_VSO 1761 if ( m_pcRdCost->getUseLambdaScaleVSO()) 1762 { 1763 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 1764 } 1765 else 1766 #endif 1767 { 1768 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 1769 } 1770 } 1771 #endif 1601 1772 1602 1773 Void … … 2107 2278 UInt uiBestPUDistC = 0; 2108 2279 Double dBestPUCost = MAX_DOUBLE; 2280 #if RWTH_SDC_DLT_B0036 2281 Bool bBestUseSDC = false; 2282 Pel apBestDCOffsets[2] = {0,0}; 2283 #endif 2109 2284 for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ ) 2110 2285 { … … 2127 2302 continue; 2128 2303 } 2304 #endif 2305 2306 #if RWTH_SDC_DLT_B0036 2307 UInt uiUseSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getPartitionSize(uiPartOffset) == SIZE_2Nx2N )?1:0; 2308 2309 for( UInt uiSDC=0; uiSDC<=uiUseSDC; uiSDC++ ) 2310 { 2311 for( UInt uiRes = 0; uiRes<=uiUseSDC; uiRes++ ) 2312 { 2129 2313 #endif 2130 2314 … … 2150 2334 } 2151 2335 #endif 2152 2336 #if RWTH_SDC_DLT_B0036 2337 // last check: if not available for current intra prediction mode, don't try 2338 if( uiSDC == 1 && !pcCU->getSDCAvailable(uiPartOffset) ) 2339 continue; 2340 2341 pcCU->setSDCFlagSubParts( uiSDC == 1, uiPartOffset, 0, uiDepth + uiInitTrDepth ); 2342 2343 if(uiSDC == 1) 2344 { 2345 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 2346 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 2347 2348 // start encoding with SDC 2349 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (uiRes==1)); 2350 } 2351 else 2352 { 2353 #endif 2153 2354 #if HHI_RQT_INTRA_SPEEDUP 2154 2355 #if LG_ZEROINTRADEPTHRESI_M26039 … … 2159 2360 #else 2160 2361 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost ); 2362 #endif 2363 #if RWTH_SDC_DLT_B0036 2364 } 2161 2365 #endif 2162 2366 … … 2172 2376 uiBestPUDistC = uiPUDistC; 2173 2377 dBestPUCost = dPUCost; 2378 2379 #if RWTH_SDC_DLT_B0036 2380 if( uiSDC == 1 ) 2381 { 2382 bBestUseSDC = true; 2383 2384 // copy reconstruction 2385 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 2386 2387 // copy DC values 2388 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 2389 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 2390 } 2391 else 2392 { 2393 bBestUseSDC = false; 2394 #endif 2395 2396 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 2397 2398 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 2399 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2400 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2401 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2402 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2403 #if RWTH_SDC_DLT_B0036 2404 } 2405 #endif 2406 } 2407 #if HHI_RQT_INTRA_SPEEDUP_MOD 2408 else if( dPUCost < dSecondBestPUCost ) 2409 { 2410 uiSecondBestMode = uiOrgMode; 2411 dSecondBestPUCost = dPUCost; 2412 } 2413 #endif 2414 #if LG_ZEROINTRADEPTHRESI_M26039 2415 } 2416 #endif 2417 #if RWTH_SDC_DLT_B0036 2418 } // SDC residual loop 2419 } // SDC loop 2420 #endif 2421 } // Mode loop 2422 2423 #if HHI_RQT_INTRA_SPEEDUP 2424 #if HHI_RQT_INTRA_SPEEDUP_MOD 2425 for( UInt ui =0; ui < 2; ++ui ) 2426 #endif 2427 { 2428 #if HHI_RQT_INTRA_SPEEDUP_MOD 2429 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode; 2430 if( uiOrgMode == MAX_UINT ) 2431 { 2432 break; 2433 } 2434 #else 2435 UInt uiOrgMode = uiBestPUMode; 2436 #endif 2437 2438 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 2439 2440 // set context models 2441 if( m_bUseSBACRD ) 2442 { 2443 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 2444 } 2445 2446 // determine residual for partition 2447 Dist uiPUDistY = 0; 2448 Dist uiPUDistC = 0; 2449 Double dPUCost = 0.0; 2450 2451 #if HHI_VSO 2452 // reset Model 2453 if( m_pcRdCost->getUseRenModel() ) 2454 { 2455 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 2456 } 2457 #endif 2458 2459 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 2460 2461 // check r-d cost 2462 if( dPUCost < dBestPUCost ) 2463 { 2464 uiBestPUMode = uiOrgMode; 2465 uiBestPUDistY = uiPUDistY; 2466 uiBestPUDistC = uiPUDistC; 2467 dBestPUCost = dPUCost; 2468 #if RWTH_SDC_DLT_B0036 2469 bBestUseSDC = false; 2470 #endif 2174 2471 2175 2472 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); … … 2182 2479 2183 2480 } 2184 #if HHI_RQT_INTRA_SPEEDUP_MOD2185 else if( dPUCost < dSecondBestPUCost )2186 {2187 uiSecondBestMode = uiOrgMode;2188 dSecondBestPUCost = dPUCost;2189 }2190 #endif2191 #if LG_ZEROINTRADEPTHRESI_M260392192 }2193 #endif2194 } // Mode loop2195 2196 #if HHI_RQT_INTRA_SPEEDUP2197 #if HHI_RQT_INTRA_SPEEDUP_MOD2198 for( UInt ui =0; ui < 2; ++ui )2199 #endif2200 {2201 #if HHI_RQT_INTRA_SPEEDUP_MOD2202 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode;2203 if( uiOrgMode == MAX_UINT )2204 {2205 break;2206 }2207 #else2208 UInt uiOrgMode = uiBestPUMode;2209 #endif2210 2211 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );2212 2213 // set context models2214 if( m_bUseSBACRD )2215 {2216 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2217 }2218 2219 // determine residual for partition2220 Dist uiPUDistY = 0;2221 Dist uiPUDistC = 0;2222 Double dPUCost = 0.0;2223 2224 #if HHI_VSO2225 // reset Model2226 if( m_pcRdCost->getUseRenModel() )2227 {2228 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );2229 }2230 #endif2231 2232 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );2233 2234 // check r-d cost2235 if( dPUCost < dBestPUCost )2236 {2237 uiBestPUMode = uiOrgMode;2238 uiBestPUDistY = uiPUDistY;2239 uiBestPUDistC = uiPUDistC;2240 dBestPUCost = dPUCost;2241 2242 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );2243 2244 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );2245 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );2246 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2247 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2248 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2249 2250 }2251 2481 } // Mode loop 2252 2482 #endif … … 2255 2485 uiOverallDistY += uiBestPUDistY; 2256 2486 uiOverallDistC += uiBestPUDistC; 2487 2488 #if RWTH_SDC_DLT_B0036 2489 if( bBestUseSDC ) 2490 { 2491 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 2492 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 2493 2494 //=== copy best DC segment values back to CU ==== 2495 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset); 2496 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset); 2497 } 2498 else 2499 { 2500 #endif 2257 2501 2258 2502 //--- update transform index and cbf --- … … 2262 2506 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) ); 2263 2507 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) ); 2508 #if RWTH_SDC_DLT_B0036 2509 } 2510 #endif 2264 2511 2265 2512 //--- set reconstruction for next intra prediction blocks --- … … 2332 2579 //=== update PU data ==== 2333 2580 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 2581 #if RWTH_SDC_DLT_B0036 2582 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, 0, uiDepth + uiInitTrDepth ); 2583 #endif 2334 2584 pcCU->copyToPic ( uiDepth, uiPU, uiInitTrDepth ); 2335 2585 } // PU loop … … 7817 8067 #endif 7818 8068 #endif 8069 8070 #if RWTH_SDC_DLT_B0036 8071 Void TEncSearch::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) 8072 { 8073 Int iSumDepth[uiNumSegments]; 8074 memset(iSumDepth, 0, sizeof(Int)*uiNumSegments); 8075 Int iSumPix[uiNumSegments]; 8076 memset(iSumPix, 0, sizeof(Int)*uiNumSegments); 8077 8078 for (Int y=0; y<uiSize; y++) 8079 { 8080 for (Int x=0; x<uiSize; x++) 8081 { 8082 UChar ucSegment = pMask?(UChar)pMask[x]:0; 8083 assert( ucSegment < uiNumSegments ); 8084 8085 iSumDepth[ucSegment] += pOrig[x]; 8086 iSumPix[ucSegment] += 1; 8087 } 8088 8089 pOrig += uiStride; 8090 pMask += uiMaskStride; 8091 } 8092 8093 // compute mean for each segment 8094 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) 8095 { 8096 if( iSumPix[ucSeg] > 0 ) 8097 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; 8098 else 8099 rpSegMeans[ucSeg] = 0; // this happens for zero-segments 8100 } 8101 } 8102 #endif 7819 8103 7820 8104 //! \} -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncSearch.h
r158 r177 307 307 UInt uiAbsPartIdx, 308 308 TComYuv* pcRecoYuv ); 309 310 #if RWTH_SDC_DLT_B0036 311 Void xAnalyzeSegmentsSDC ( Pel* pOrig, 312 UInt uiStride, 313 UInt uiSize, 314 Pel* rpSegMeans, 315 UInt uiNumSegments, 316 Bool* pMask, 317 UInt uiMaskStride ); 318 319 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ); 320 #endif 309 321 310 322 // ------------------------------------------------------------------------------------------------------------------- -
branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncTop.cpp
r121 r177 648 648 #endif 649 649 650 #if RWTH_SDC_DLT_B0036 651 m_cSPS.setUseDLT ( m_bUseDLT ); 652 #endif 653 650 654 m_cSPS.setQuadtreeTULog2MaxSize( m_uiQuadtreeTULog2MaxSize ); 651 655 m_cSPS.setQuadtreeTULog2MinSize( m_uiQuadtreeTULog2MinSize );
Note: See TracChangeset for help on using the changeset viewer.