Changeset 748 in 3DVCSoftware for branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder
- Timestamp:
- 18 Dec 2013, 09:00:24 (11 years ago)
- Location:
- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.cpp
r738 r748 256 256 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 257 257 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 258 259 #if !DLT_DIFF_CODING_IN_PPS 258 260 WRITE_FLAG( 0, "pps_extension_flag" ); 259 } 261 #else 262 WRITE_FLAG( 1, "pps_extension_flag" ); 263 codePPSExtension( pcPPS ); 264 WRITE_FLAG( 0, "pps_extension2_flag" ); 265 #endif 266 } 267 268 #if DLT_DIFF_CODING_IN_PPS 269 Void TEncCavlc::codePPSExtension ( TComPPS* pcPPS ) 270 { 271 // Assuming that all PPS indirectly refer to the same VPS via different SPS 272 // There is no parsing dependency in decoding DLT in PPS. 273 // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. 274 // This is equivalent to the process of 275 // Step 1) decoding DLT tables based on the number of depth layers, and 276 // Step 2) mapping DLT tables to the depth layers 277 // as descripted in the 3D-HEVC WD. 278 TComVPS* pcVPS = pcPPS->getSPS()->getVPS(); 279 280 TComDLT* pcDLT = pcPPS->getDLT(); 281 282 WRITE_FLAG( pcDLT->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" ); 283 284 if ( pcDLT->getDltPresentFlag() ) 285 { 286 WRITE_CODE(pcDLT->getNumDepthViews(), 6, "pps_depth_layers_minus1"); 287 WRITE_CODE((pcDLT->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8"); 288 289 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 290 { 291 if ( i != 0 ) 292 { 293 if ( pcVPS->getDepthId( i ) == 1 ) 294 { 295 WRITE_FLAG( pcDLT->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" ); 296 297 if ( pcDLT->getUseDLTFlag( i ) ) 298 { 299 WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]"); 300 301 // determine whether to use bit-map 302 Bool bDltBitMapRepFlag = false; 303 UInt uiNumBitsNonBitMap = 0; 304 UInt uiNumBitsBitMap = 0; 305 306 UInt uiMaxDiff = 0; 307 UInt uiMinDiff = 0xffffffff; 308 UInt uiLengthMinDiff = 0; 309 UInt uiLengthDltDiffMinusMin = 0; 310 311 UInt* puiDltDiffValues = NULL; 312 313 if ( NULL == (puiDltDiffValues = (UInt *)calloc(pcDLT->getNumDepthValues(i), sizeof(UInt))) ) 314 { 315 exit(-1); 316 } 317 318 for (UInt d = 1; d < pcDLT->getNumDepthValues(i); d++) 319 { 320 puiDltDiffValues[d] = pcDLT->idx2DepthValue(i, d) - pcDLT->idx2DepthValue(i, (d-1)); 321 322 if ( uiMaxDiff < puiDltDiffValues[d] ) 323 { 324 uiMaxDiff = puiDltDiffValues[d]; 325 } 326 327 if ( uiMinDiff > puiDltDiffValues[d] ) 328 { 329 uiMinDiff = puiDltDiffValues[d]; 330 } 331 } 332 333 // counting bits 334 // diff coding branch 335 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ]) 336 337 if ( pcDLT->getNumDepthValues(i) > 1 ) 338 { 339 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ] 340 } 341 342 if ( pcDLT->getNumDepthValues(i) > 2 ) 343 { 344 uiLengthMinDiff = (UInt) ceil(Log2(uiMaxDiff + 1)); 345 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ] 346 } 347 348 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ] 349 350 if (uiMaxDiff > uiMinDiff) 351 { 352 uiLengthDltDiffMinusMin = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1)); 353 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (pcDLT->getNumDepthValues(i) - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ] 354 } 355 356 // bit map branch 357 uiNumBitsBitMap = 256; // uiNumBitsBitMap = 1 << pcDLT->getDepthViewBitDepth(); 358 359 // determine bDltBitMapFlag 360 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true; 361 362 // Actual coding 363 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) 364 { 365 WRITE_FLAG( bDltBitMapRepFlag ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" ); 366 } 367 else 368 { 369 bDltBitMapRepFlag = false; 370 } 371 372 // bit map coding 373 if ( bDltBitMapRepFlag ) 374 { 375 UInt uiDltArrayIndex = 0; 376 for (UInt d=0; d < 256; d++) 377 { 378 if ( d == pcDLT->idx2DepthValue(i, uiDltArrayIndex) ) 379 { 380 WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]"); 381 uiDltArrayIndex++; 382 } 383 else 384 { 385 WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]"); 386 } 387 } 388 } 389 // Diff Coding 390 else 391 { 392 WRITE_CODE(pcDLT->getNumDepthValues(i), 8, "num_depth_values_in_dlt[layerId]"); // num_entry 393 394 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) // Single-view DLT Diff Coding 395 { 396 // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component. 397 if ( pcDLT->getNumDepthValues(i) > 1 ) 398 { 399 WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]"); // max_diff 400 } 401 402 if ( pcDLT->getNumDepthValues(i) > 2 ) 403 { 404 WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]"); // min_diff_minus1 405 } 406 407 WRITE_CODE(pcDLT->idx2DepthValue(i, 0), 8, "dlt_depth_value0[layerId]"); // entry0 408 409 if (uiMaxDiff > uiMinDiff) 410 { 411 for (UInt d=1; d < pcDLT->getNumDepthValues(i); d++) 412 { 413 WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]"); // entry_value_diff_minus_min[ k ] 414 } 415 } 416 } 417 } 418 419 free(puiDltDiffValues); 420 } 421 } 422 } 423 } 424 } 425 } 426 #endif 260 427 261 428 Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS ) … … 1463 1630 //WRITE_FLAG( pcVPS->getLimQtPredFlag ( i ) ? 1 : 0 , "lim_qt_pred_flag[i]" ); 1464 1631 #if H_3D_DIM_DLT 1632 #if !DLT_DIFF_CODING_IN_PPS 1465 1633 if( pcVPS->getVpsDepthModesFlag( i ) ) 1466 1634 { … … 1475 1643 WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" ); 1476 1644 } 1477 } 1645 } 1646 #endif 1478 1647 #endif 1479 1648 #if H_3D_INTER_SDC -
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.h
r738 r748 116 116 #endif 117 117 Void codePPS ( TComPPS* pcPPS ); 118 119 #if DLT_DIFF_CODING_IN_PPS 120 Void codePPSExtension ( TComPPS* pcPPS ); 121 #endif 122 118 123 Void codeSliceHeader ( TComSlice* pcSlice ); 119 124 Void codePTL ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1); -
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCfg.h
r724 r748 330 330 TComVPS m_cVPS; 331 331 #endif 332 333 #if DLT_DIFF_CODING_IN_PPS 334 TComDLT* m_cDLT; 335 #endif 336 332 337 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value 333 338 Int m_activeParameterSetsSEIEnabled; ///< enable active parameter set SEI message … … 441 446 , m_isDepth(false) 442 447 , m_bUseVSO(false) 448 #endif 449 #if DLT_DIFF_CODING_IN_PPS 450 , m_cDLT(NULL) 443 451 #endif 444 452 #endif … … 867 875 TComVPS *getVPS() { return &m_cVPS; } 868 876 #endif 877 878 #if DLT_DIFF_CODING_IN_PPS 879 Void setDLT ( TComDLT *p ) { m_cDLT = p; } 880 TComDLT* getDLT () { return m_cDLT; } 881 #endif 882 869 883 Void setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b; } 870 884 Bool getUseRecalculateQPAccordingToLambda () { return m_recalculateQPAccordingToLambda; } -
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSbac.cpp
r724 r748 632 632 633 633 #if H_3D_DIM_DLT 634 #if DLT_DIFF_CODING_IN_PPS 635 UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 636 #else 634 637 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 638 #endif 635 639 #else 636 640 UInt uiMaxResidualBits = g_bitDepthY; … … 653 657 654 658 #if H_3D_DIM_DLT 655 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 659 #if DLT_DIFF_CODING_IN_PPS 660 UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 661 #else 662 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 663 #endif 656 664 #else 657 665 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); -
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSearch.cpp
r735 r748 1127 1127 { 1128 1128 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 1129 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1129 #if DLT_DIFF_CODING_IN_PPS 1130 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1131 #else 1132 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1133 #endif 1130 1134 { 1131 pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ); 1135 #if DLT_DIFF_CODING_IN_PPS 1136 pResi[ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ); 1137 #else 1138 pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ); 1139 #endif 1132 1140 } 1133 1141 else … … 1202 1210 { 1203 1211 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 1204 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1212 #if DLT_DIFF_CODING_IN_PPS 1213 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1214 #else 1215 if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) ) 1216 #endif 1205 1217 { 1206 pReco [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) ); 1218 #if DLT_DIFF_CODING_IN_PPS 1219 pReco [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) ); 1220 #else 1221 pReco [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) ); 1222 #endif 1207 1223 } 1208 1224 else … … 1935 1951 // get residual (idx) 1936 1952 #if H_3D_DIM_DLT 1953 #if DLT_DIFF_CODING_IN_PPS 1954 Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1955 #else 1937 1956 Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1957 #endif 1938 1958 #else 1939 1959 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment]; … … 1949 1969 { 1950 1970 #if H_3D_DIM_DLT 1971 #if DLT_DIFF_CODING_IN_PPS 1972 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1973 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1974 Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 1975 #else 1951 1976 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1952 1977 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1953 1978 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 1954 1979 #endif 1980 1955 1981 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 1956 1982 #else … … 7346 7372 7347 7373 #if H_3D_DIM_DLT 7374 #if DLT_DIFF_CODING_IN_PPS 7375 rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ); 7376 rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ); 7377 #else 7348 7378 rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ); 7349 7379 rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ); 7380 #endif 7350 7381 #endif 7351 7382 } -
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncTop.cpp
r738 r748 299 299 { 300 300 // initialize SPS 301 #if DLT_DIFF_CODING_IN_PPS 302 // Assuming that all PPS indirectly refer to the same VPS via different SPS 303 m_cSPS.setVPS(m_cVPS); 304 #endif 301 305 xInitSPS(); 302 306 … … 870 874 m_cPPS.setSPSId( getLayerIdInVps() ); 871 875 #endif 876 877 #if DLT_DIFF_CODING_IN_PPS 878 m_cPPS.setDLT( getDLT() ); 879 #endif 880 872 881 m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); 873 882 Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
Note: See TracChangeset for help on using the changeset viewer.