Changeset 748 in 3DVCSoftware for branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 18 Dec 2013, 09:00:24 (11 years ago)
- File:
-
- 1 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
Note: See TracChangeset for help on using the changeset viewer.