Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2015, ITU/ISO/IEC … … 39 39 #include "SEIread.h" 40 40 #include "TDecSlice.h" 41 #if H_3D 41 #include "TLibCommon/TComChromaFormat.h" 42 #if RExt__DECODER_DEBUG_BIT_STATISTICS 43 #include "TLibCommon/TComCodingStatistics.h" 44 #endif 45 #if NH_MV 42 46 #include "TDecTop.h" 43 47 #endif 48 44 49 //! \ingroup TLibDecoder 45 50 //! \{ 46 51 47 52 #if ENC_DEC_TRACE 48 49 Void xTraceSPSHeader (TComSPS *pSPS) 50 { 51 #if H_MV_ENC_DEC_TRAC 52 if ( g_disableHLSTrace ) 53 { 54 return; 55 } 56 // To avoid mismatches 57 fprintf( g_hTrace, "=========== Sequence Parameter Set LayerId: %d ===========\n", pSPS->getLayerId() ); 58 #else 59 fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() ); 60 #endif 61 } 62 63 Void xTracePPSHeader (TComPPS *pPPS) 64 { 65 #if H_MV_ENC_DEC_TRAC 66 if ( g_disableHLSTrace ) 67 { 68 return; 69 } 70 fprintf( g_hTrace, "=========== Picture Parameter Set LayerId: %d ===========\n", pPPS->getLayerId() ); 71 #else 72 fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() ); 73 #endif 74 } 75 76 Void xTraceSliceHeader (TComSlice *pSlice) 77 { 78 #if H_MV_ENC_DEC_TRAC 79 if ( g_disableHLSTrace ) 80 { 81 return; 82 } 83 #endif 84 fprintf( g_hTrace, "=========== Slice ===========\n"); 85 } 86 87 #endif 88 53 #if !H_MV_ENC_DEC_TRAC 54 Void xTraceVPSHeader () 55 { 56 fprintf( g_hTrace, "=========== Video Parameter Set ===========\n" ); 57 } 58 59 Void xTraceSPSHeader () 60 { 61 fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" ); 62 } 63 64 Void xTracePPSHeader () 65 { 66 fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n"); 67 } 68 #endif 69 #endif 89 70 // ==================================================================================================================== 90 71 // Constructor / destructor / create / destroy … … 97 78 TDecCavlc::~TDecCavlc() 98 79 { 80 99 81 } 100 82 … … 103 85 // ==================================================================================================================== 104 86 105 void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx )87 Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) 106 88 { 107 89 UInt code; … … 117 99 } 118 100 119 if (interRPSPred) 101 if (interRPSPred) 120 102 { 121 103 UInt bit; … … 138 120 for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) 139 121 { 140 READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 122 READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 141 123 Int refIdc = bit; 142 if (refIdc == 0) 124 if (refIdc == 0) 143 125 { 144 126 READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. … … 155 137 k0++; 156 138 } 157 else 139 else 158 140 { 159 141 k1++; 160 142 } 161 143 k++; 162 } 163 rps->setRefIdc(j,refIdc); 164 } 165 rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); 144 } 145 rps->setRefIdc(j,refIdc); 146 } 147 rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); 166 148 rps->setNumberOfPictures(k); 167 149 rps->setNumberOfNegativePictures(k0); … … 199 181 } 200 182 201 #if H_3D 202 Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS ) 183 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 184 { 185 #if ENC_DEC_TRACE 186 #if H_MV_ENC_DEC_TRAC 187 tracePSHeader( "PPS", pcPPS->getLayerId() ); 203 188 #else 204 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 205 #endif 206 { 207 #if ENC_DEC_TRACE 208 xTracePPSHeader (pcPPS); 189 xTracePPSHeader (); 190 #endif 209 191 #endif 210 192 UInt uiCode; … … 215 197 assert(uiCode <= 63); 216 198 pcPPS->setPPSId (uiCode); 217 199 218 200 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 219 201 assert(uiCode <= 15); 220 202 pcPPS->setSPSId (uiCode); 221 203 222 204 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 205 223 206 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 224 207 225 208 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 209 226 210 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 227 211 … … 231 215 assert(uiCode <= 14); 232 216 pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); 233 217 234 218 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); 235 219 assert(uiCode <= 14); 236 220 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 237 221 238 222 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); 239 223 READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); 240 READ_FLAG( uiCode, "transform_skip_enabled_flag" ); 241 pcPPS->setUseTransformSkip ( uiCode ? true : false ); 224 READ_FLAG( uiCode, "transform_skip_enabled_flag" ); 225 pcPPS->setUseTransformSkip ( uiCode ? true : false ); 242 226 243 227 READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); … … 252 236 } 253 237 READ_SVLC( iCode, "pps_cb_qp_offset"); 254 pcPPS->set ChromaCbQpOffset(iCode);255 assert( pcPPS->get ChromaCbQpOffset() >= -12 );256 assert( pcPPS->get ChromaCbQpOffset() <= 12 );238 pcPPS->setQpOffset(COMPONENT_Cb, iCode); 239 assert( pcPPS->getQpOffset(COMPONENT_Cb) >= -12 ); 240 assert( pcPPS->getQpOffset(COMPONENT_Cb) <= 12 ); 257 241 258 242 READ_SVLC( iCode, "pps_cr_qp_offset"); 259 pcPPS->setChromaCrQpOffset(iCode); 260 assert( pcPPS->getChromaCrQpOffset() >= -12 ); 261 assert( pcPPS->getChromaCrQpOffset() <= 12 ); 243 pcPPS->setQpOffset(COMPONENT_Cr, iCode); 244 assert( pcPPS->getQpOffset(COMPONENT_Cr) >= -12 ); 245 assert( pcPPS->getQpOffset(COMPONENT_Cr) <= 12 ); 246 247 assert(MAX_NUM_COMPONENT<=3); 262 248 263 249 READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" ); … … 273 259 READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 ); 274 260 READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 ); 275 261 276 262 if( pcPPS->getTilesEnabledFlag() ) 277 263 { … … 280 266 READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setTileUniformSpacingFlag( uiCode == 1 ); 281 267 282 if( !pcPPS->getTileUniformSpacingFlag()) 283 { 284 std::vector<Int> columnWidth(pcPPS->getNumTileColumnsMinus1()); 285 for(UInt i=0; i<pcPPS->getNumTileColumnsMinus1(); i++) 286 { 287 READ_UVLC( uiCode, "column_width_minus1" ); 288 columnWidth[i] = uiCode+1; 289 } 290 pcPPS->setTileColumnWidth(columnWidth); 291 292 std::vector<Int> rowHeight (pcPPS->getTileNumRowsMinus1()); 293 for(UInt i=0; i<pcPPS->getTileNumRowsMinus1(); i++) 294 { 295 READ_UVLC( uiCode, "row_height_minus1" ); 296 rowHeight[i] = uiCode + 1; 297 } 298 pcPPS->setTileRowHeight(rowHeight); 299 } 300 301 if(pcPPS->getNumTileColumnsMinus1() !=0 || pcPPS->getTileNumRowsMinus1() !=0) 268 const UInt tileColumnsMinus1 = pcPPS->getNumTileColumnsMinus1(); 269 const UInt tileRowsMinus1 = pcPPS->getNumTileRowsMinus1(); 270 271 if ( !pcPPS->getTileUniformSpacingFlag()) 272 { 273 if (tileColumnsMinus1 > 0) 274 { 275 std::vector<Int> columnWidth(tileColumnsMinus1); 276 for(UInt i = 0; i < tileColumnsMinus1; i++) 277 { 278 READ_UVLC( uiCode, "column_width_minus1" ); 279 columnWidth[i] = uiCode+1; 280 } 281 pcPPS->setTileColumnWidth(columnWidth); 282 } 283 284 if (tileRowsMinus1 > 0) 285 { 286 std::vector<Int> rowHeight (tileRowsMinus1); 287 for(UInt i = 0; i < tileRowsMinus1; i++) 288 { 289 READ_UVLC( uiCode, "row_height_minus1" ); 290 rowHeight[i] = uiCode + 1; 291 } 292 pcPPS->setTileRowHeight(rowHeight); 293 } 294 } 295 296 if ((tileColumnsMinus1 + tileRowsMinus1) != 0) 302 297 { 303 298 READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); 304 299 } 305 300 } 306 READ_FLAG( uiCode, " loop_filter_across_slices_enabled_flag" );pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false );301 READ_FLAG( uiCode, "pps_loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); 307 302 READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); 308 303 if(pcPPS->getDeblockingFilterControlPresentFlag()) … … 319 314 if(pcPPS->getScalingListPresentFlag ()) 320 315 { 321 parseScalingList( pcPPS->getScalingList() ); 322 } 316 parseScalingList( &(pcPPS->getScalingList()) ); 317 } 318 323 319 READ_FLAG( uiCode, "lists_modification_present_flag"); 324 320 pcPPS->setListsModificationPresentFlag(uiCode); … … 329 325 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 330 326 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); 331 332 #if H_MV 327 333 328 READ_FLAG( uiCode, "pps_extension_present_flag"); 334 #else335 READ_FLAG( uiCode, "pps_extension_flag");336 #endif337 329 if (uiCode) 338 330 { 339 340 #if H_MV 331 #if NH_MV 341 332 READ_FLAG( uiCode, "pps_range_extensions_flag" ); pcPPS->setPpsRangeExtensionsFlag( uiCode == 1 ); 342 333 READ_FLAG( uiCode, "pps_multilayer_extension_flag" ); pcPPS->setPpsMultilayerExtensionFlag( uiCode == 1 ); 343 #if !H_3D344 READ_CODE( 6, uiCode, "pps_extension_6bits" ); pcPPS->setPpsExtension6bits( uiCode );345 #else346 334 READ_FLAG( uiCode, "pps_3d_extension_flag" ); pcPPS->setPps3dExtensionFlag( uiCode == 1 ); 347 335 READ_CODE( 5, uiCode, "pps_extension_5bits" ); pcPPS->setPpsExtension5bits( uiCode ); 348 #endif349 336 if ( pcPPS->getPpsRangeExtensionsFlag() ) 350 337 { 351 assert(0); 352 } 338 TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); 339 340 if (pcPPS->getUseTransformSkip()) 341 { 342 READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2"); 343 ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2); 344 } 345 346 READ_FLAG( uiCode, "cross_component_prediction_enabled_flag"); 347 ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0); 348 349 READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag"); 350 if (uiCode == 0) 351 { 352 ppsRangeExtension.clearChromaQpOffsetList(); 353 ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0); 354 } 355 else 356 { 357 READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode); 358 UInt tableSizeMinus1 = 0; 359 READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1"); 360 assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE); 361 362 for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) 363 { 364 Int cbOffset; 365 Int crOffset; 366 READ_SVLC(cbOffset, "cb_qp_offset_list[i]"); 367 assert(cbOffset >= -12 && cbOffset <= 12); 368 READ_SVLC(crOffset, "cr_qp_offset_list[i]"); 369 assert(crOffset >= -12 && crOffset <= 12); 370 // table uses +1 for index (see comment inside the function) 371 ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset); 372 } 373 assert(ppsRangeExtension.getChromaQpOffsetListLen() == tableSizeMinus1 + 1); 374 } 375 376 READ_UVLC( uiCode, "log2_sao_offset_scale_luma"); 377 ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode); 378 READ_UVLC( uiCode, "log2_sao_offset_scale_chroma"); 379 ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode); } 353 380 354 381 if ( pcPPS->getPpsMultilayerExtensionFlag() ) 355 382 { 356 parsePPSMultilayerExtension( pcPPS ); 357 } 358 #if !H_3D 359 if ( pcPPS->getPpsExtension6bits() ) 360 { 361 #else 383 parsePpsMultilayerExtension( pcPPS ); 384 } 385 362 386 if ( pcPPS->getPps3dExtensionFlag() ) 363 387 { 364 parsePPSExtension( pcPPS, pcVPS ); 365 } 388 #if NH_3D 389 parsePps3dExtension( pcPPS ); 390 #endif 391 } 392 #if NH_3D 366 393 if ( pcPPS->getPpsExtension5bits() ) 367 { 368 #endif 369 370 #endif 371 394 #else 395 if ( pcPPS->getPpsExtension5bits() || pcPPS->getPps3dExtensionFlag() ) 396 #endif 397 { 372 398 while ( xMoreRbspData() ) 373 399 { 374 400 READ_FLAG( uiCode, "pps_extension_data_flag"); 375 401 } 376 #if H_MV 377 } 378 #endif 379 } 380 } 381 382 383 #if H_3D 384 Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS ) 385 { 386 //Ed.(GT): pcVPS should not be used here. Needs to be fixed. 387 UInt uiCode = 0; 388 TComDLT* pcDLT = new TComDLT; 389 390 READ_FLAG(uiCode, "dlt_present_flag"); 391 pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false ); 392 393 if ( pcDLT->getDltPresentFlag() ) 394 { 395 READ_CODE(6, uiCode, "pps_depth_layers_minus1"); 396 pcDLT->setNumDepthViews( uiCode ); 397 398 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8"); 399 pcDLT->setDepthViewBitDepth( (uiCode+8) ); 400 401 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 402 { 403 if ( i != 0 ) 404 { 405 if( pcVPS->getDepthId( i ) == 1 ) 406 { 407 READ_FLAG(uiCode, "dlt_flag[i]"); 408 pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false); 409 410 if ( pcDLT->getUseDLTFlag( i ) ) 411 { 412 Bool bDltBitMapRepFlag = false; 413 UInt uiMaxDiff = 0xffffffff; 414 UInt uiMinDiff = 0; 415 UInt uiCodeLength = 0; 416 417 READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); 418 419 if( uiCode ) 402 } 403 404 #else 405 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 406 static const char *syntaxStrings[]={ "pps_range_extension_flag", 407 "pps_multilayer_extension_flag", 408 "pps_extension_6bits[0]", 409 "pps_extension_6bits[1]", 410 "pps_extension_6bits[2]", 411 "pps_extension_6bits[3]", 412 "pps_extension_6bits[4]", 413 "pps_extension_6bits[5]" }; 414 #endif 415 416 Bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]; 417 for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) 418 { 419 READ_FLAG( uiCode, syntaxStrings[i] ); 420 pps_extension_flags[i] = uiCode!=0; 421 } 422 423 Bool bSkipTrailingExtensionBits=false; 424 for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. 425 { 426 if (pps_extension_flags[i]) 427 { 428 switch (PPSExtensionFlagIndex(i)) 429 { 430 case PPS_EXT__REXT: 420 431 { 421 assert( pcDLT->getUseDLTFlag( 1 )); 432 TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); 433 assert(!bSkipTrailingExtensionBits); 434 435 if (pcPPS->getUseTransformSkip()) 436 { 437 READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2"); 438 ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2); 422 439 } 423 pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false ); 424 425 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) 440 441 READ_FLAG( uiCode, "cross_component_prediction_enabled_flag"); 442 ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0); 443 444 READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag"); 445 if (uiCode == 0) 426 446 { 427 READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");428 bDltBitMapRepFlag = (uiCode == 1) ? true : false;447 ppsRangeExtension.clearChromaQpOffsetList(); 448 ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0); 429 449 } 430 450 else 431 451 { 432 bDltBitMapRepFlag = false; 452 READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode); 453 UInt tableSizeMinus1 = 0; 454 READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1"); 455 assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE); 456 457 for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) 458 { 459 Int cbOffset; 460 Int crOffset; 461 READ_SVLC(cbOffset, "cb_qp_offset_list[i]"); 462 assert(cbOffset >= -12 && cbOffset <= 12); 463 READ_SVLC(crOffset, "cr_qp_offset_list[i]"); 464 assert(crOffset >= -12 && crOffset <= 12); 465 // table uses +1 for index (see comment inside the function) 466 ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset); 467 } 468 assert(ppsRangeExtension.getChromaQpOffsetListLen() == tableSizeMinus1 + 1); 469 } 470 471 READ_UVLC( uiCode, "log2_sao_offset_scale_luma"); 472 ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode); 473 READ_UVLC( uiCode, "log2_sao_offset_scale_chroma"); 474 ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode); 475 } 476 break; 477 default: 478 bSkipTrailingExtensionBits=true; 479 break; 480 } 481 } 482 } 483 if (bSkipTrailingExtensionBits) 484 { 485 while ( xMoreRbspData() ) 486 { 487 READ_FLAG( uiCode, "pps_extension_data_flag"); 488 } 489 } 490 #endif 491 } 492 xReadRbspTrailingBits(); 493 } 494 495 #if NH_3D 496 Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS ) 497 { 498 #if NH_3D_DLT 499 UInt uiCode = 0; 500 // 501 TComDLT* pcDLT = pcPPS->getDLT(); 502 503 READ_FLAG(uiCode, "dlts_present_flag"); 504 pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false ); 505 506 if ( pcDLT->getDltPresentFlag() ) 507 { 508 READ_CODE(6, uiCode, "pps_depth_layers_minus1"); 509 #if NH_3D_VER141_DEC_COMP_FLAG 510 pcDLT->setNumDepthViews( uiCode ); 511 #else 512 pcDLT->setNumDepthViews( uiCode+1 ); 513 #endif 514 515 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_layers_minus8"); 516 pcDLT->setDepthViewBitDepth( (uiCode+8) ); 517 518 #if NH_3D_DLT_FIX 519 for( Int i = 0; i <= pcDLT->getNumDepthViews()-1; i++ ) 520 #else 521 for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ ) 522 #endif 523 { 524 Int layerId = pcDLT->getDepthIdxToLayerId(i); 525 526 READ_FLAG(uiCode, "dlt_flag[i]"); 527 pcDLT->setUseDLTFlag(layerId, (uiCode == 1) ? true : false); 528 529 if ( pcDLT->getUseDLTFlag( layerId ) ) 530 { 531 Bool bDltBitMapRepFlag = false; 532 UInt uiMaxDiff = MAX_INT; 533 UInt uiMinDiff = 0; 534 UInt uiCodeLength = 0; 535 536 READ_FLAG(uiCode, "dlt_pred_flag[i]"); 537 538 if( uiCode ) 539 { 540 assert( pcDLT->getUseDLTFlag( 1 )); 541 } 542 pcDLT->setInterViewDltPredEnableFlag( layerId, (uiCode == 1) ? true : false ); 543 544 if ( pcDLT->getInterViewDltPredEnableFlag( layerId ) == false ) 545 { 546 READ_FLAG(uiCode, "dlt_val_flags_present_flag[i]"); 547 bDltBitMapRepFlag = (uiCode == 1) ? true : false; 548 } 549 else 550 { 551 bDltBitMapRepFlag = false; 552 } 553 554 UInt uiNumDepthValues = 0; 555 std::vector<Int> aiIdx2DepthValue(256, 0); 556 557 // Bit map 558 if ( bDltBitMapRepFlag ) 559 { 560 for (UInt d=0; d<256; d++) 561 { 562 READ_FLAG(uiCode, "dlt_value_flag[i][j]"); 563 if (uiCode == 1) 564 { 565 aiIdx2DepthValue[uiNumDepthValues] = d; 566 uiNumDepthValues++; 567 } 568 } 569 } 570 // Diff Coding 571 else 572 { 573 READ_CODE(8, uiNumDepthValues, "num_val_delta_dlt"); // num_entry 574 575 { 576 // 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. 577 578 if (uiNumDepthValues > 1) 579 { 580 READ_CODE(8, uiCode, "max_diff"); 581 uiMaxDiff = uiCode; 582 } 583 else 584 { 585 uiMaxDiff = 0; // when there is only one value in DLT 433 586 } 434 587 435 UInt uiNumDepthValues = 0; 436 Int aiIdx2DepthValue[256]; 437 438 // Bit map 439 if ( bDltBitMapRepFlag ) 588 if (uiNumDepthValues > 2) 440 589 { 441 for (UInt d=0; d<256; d++) 590 uiCodeLength = (UInt) gCeilLog2(uiMaxDiff + 1); 591 READ_CODE(uiCodeLength, uiCode, "min_diff_minus1"); 592 uiMinDiff = uiCode + 1; 593 } 594 else 595 { 596 uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT 597 } 598 599 READ_CODE(8, uiCode, "delta_dlt_val0"); // entry0 600 aiIdx2DepthValue[0] = uiCode; 601 602 if (uiMaxDiff == uiMinDiff) 603 { 604 for (UInt d=1; d<uiNumDepthValues; d++) 442 605 { 443 READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]"); 444 if (uiCode == 1) 445 { 446 aiIdx2DepthValue[uiNumDepthValues] = d; 447 uiNumDepthValues++; 448 } 606 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0; 449 607 } 450 608 } 451 // Diff Coding452 609 else 453 610 { 454 READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]"); // num_entry455 611 uiCodeLength = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1); 612 for (UInt d=1; d<uiNumDepthValues; d++) 456 613 { 457 // 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. 458 459 if (uiNumDepthValues > 1) 460 { 461 READ_CODE(8, uiCode, "max_diff[ layerId ]"); 462 uiMaxDiff = uiCode; 463 } 464 else 465 { 466 uiMaxDiff = 0; // when there is only one value in DLT 467 } 468 469 if (uiNumDepthValues > 2) 470 { 471 uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1)); 472 READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]"); 473 uiMinDiff = uiCode + 1; 474 } 475 else 476 { 477 uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT 478 } 479 480 READ_CODE(8, uiCode, "dlt_depth_value0[layerId]"); // entry0 481 aiIdx2DepthValue[0] = uiCode; 482 483 if (uiMaxDiff == uiMinDiff) 484 { 485 for (UInt d=1; d<uiNumDepthValues; d++) 486 { 487 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0; 488 } 489 } 490 else 491 { 492 uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1)); 493 for (UInt d=1; d<uiNumDepthValues; d++) 494 { 495 READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]"); 496 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode; 497 } 498 } 499 614 READ_CODE(uiCodeLength, uiCode, "delta_val_diff_minus_min[k]"); 615 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode; 500 616 } 501 617 } 502 618 503 if( pcDLT->getInterViewDltPredEnableFlag( i ) )504 {505 // interpret decoded values as delta DLT506 AOF( pcVPS->getDepthId( 1 ) == 1 );507 AOF( i > 1 );508 // assumes ref layer id to be 1509 Int* piRefDLT = pcDLT->idx2DepthValue( 1 );510 UInt uiRefNum = pcDLT->getNumDepthValues( 1 );511 pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);512 }513 else514 {515 // store final DLT516 pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);517 }518 519 619 } 520 620 } 521 } 522 } 523 } 524 525 pcPPS->setDLT( pcDLT ); 526 } 527 #endif 621 622 if( pcDLT->getInterViewDltPredEnableFlag( layerId ) ) 623 { 624 // interpret decoded values as delta DLT 625 AOF( layerId > 1 ); 626 // assumes ref layer id to be 1 627 std::vector<Int> viRefDLT = pcDLT->idx2DepthValue( 1 ); 628 UInt uiRefNum = pcDLT->getNumDepthValues( 1 ); 629 pcDLT->setDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues); 630 } 631 else 632 { 633 // store final DLT 634 pcDLT->setDepthLUTs(layerId, aiIdx2DepthValue, uiNumDepthValues); 635 } 636 } 637 } 638 } 639 #endif 640 } 641 #endif 642 528 643 529 644 Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) … … 541 656 { 542 657 READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); 543 READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode);658 READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); 544 659 } 545 660 } … … 552 667 553 668 READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); 554 #if H_MV669 #if NH_MV 555 670 assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() ); 556 671 #endif … … 564 679 READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); 565 680 READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); 566 READ_CODE(8, uiCode, "matrix_coeff icients");pcVUI->setMatrixCoefficients(uiCode);681 READ_CODE(8, uiCode, "matrix_coeffs"); pcVUI->setMatrixCoefficients(uiCode); 567 682 } 568 683 } … … 585 700 { 586 701 Window &defDisp = pcVUI->getDefaultDisplayWindow(); 587 #if H_MV702 #if NH_MV 588 703 defDisp.setScaledFlag( false ); 589 704 READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode ); … … 598 713 #endif 599 714 } 715 600 716 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 601 717 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 609 725 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 610 726 } 611 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 612 if( pcVUI->getHrdParametersPresentFlag() ) 613 { 614 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 615 } 616 } 727 728 READ_FLAG( uiCode, "vui_hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 729 if( pcVUI->getHrdParametersPresentFlag() ) 730 { 731 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 732 } 733 } 734 617 735 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 618 736 if (pcVUI->getBitstreamRestrictionFlag()) … … 621 739 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 622 740 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 623 READ_UVLC( uiCode, "min_spatial_segmentation_idc");pcVUI->setMinSpatialSegmentationIdc(uiCode);741 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 624 742 assert(uiCode < 4096); 625 743 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 626 READ_UVLC( uiCode, "max_bits_per_min cu_denom" );pcVUI->setMaxBitsPerMinCuDenom(uiCode);744 READ_UVLC( uiCode, "max_bits_per_min_cu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); 627 745 READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); 628 746 READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); … … 639 757 if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) 640 758 { 641 READ_FLAG( uiCode, "sub_pic_ cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );759 READ_FLAG( uiCode, "sub_pic_hrd_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); 642 760 if( hrd->getSubPicCpbParamsPresentFlag() ) 643 761 { 644 762 READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); 645 READ_CODE( 5, uiCode, "du_cpb_removal_delay_ length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );763 READ_CODE( 5, uiCode, "du_cpb_removal_delay_increment_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 646 764 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 647 765 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); … … 670 788 hrd->setFixedPicRateWithinCvsFlag( i, true ); 671 789 } 790 672 791 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 673 792 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 793 674 794 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 675 795 { … … 677 797 } 678 798 else 679 { 799 { 680 800 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); 681 801 } 682 802 if (!hrd->getLowDelayHrdFlag( i )) 683 803 { 684 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 685 } 804 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 805 } 806 686 807 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 687 808 { … … 707 828 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 708 829 { 709 #if ENC_DEC_TRACE 710 xTraceSPSHeader (pcSPS); 830 #if ENC_DEC_TRACE 831 #if H_MV_ENC_DEC_TRAC 832 tracePSHeader( "SPS", pcSPS->getLayerId() ); 833 #else 834 xTraceSPSHeader (); 835 #endif 711 836 #endif 712 837 … … 714 839 READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); 715 840 716 #if H_MV841 #if NH_MV 717 842 if ( pcSPS->getLayerId() == 0 ) 718 843 { 719 844 #endif 720 721 722 #if H_MV845 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 846 assert(uiCode <= 6); 847 #if NH_MV 723 848 } 724 849 else … … 731 856 #endif 732 857 733 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" );pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );734 735 736 737 738 739 740 741 #if H_MV858 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 859 if ( pcSPS->getMaxTLayers() == 1 ) 860 { 861 // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 862 assert( uiCode == 1 ); 863 } 864 865 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 866 #if NH_MV 742 867 pcSPS->getPTL()->inferGeneralValues ( true, 0, NULL ); 743 868 pcSPS->getPTL()->inferSubLayerValues( pcSPS->getMaxTLayers() - 1, 0, NULL ); … … 746 871 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 747 872 assert(uiCode <= 15); 748 #if H_MV873 #if NH_MV 749 874 if ( pcSPS->getMultiLayerExtSpsFlag() ) 750 875 { … … 758 883 { 759 884 #endif 760 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 761 assert(uiCode <= 3); 762 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 763 #if !H_3D_DISABLE_CHROMA 764 assert (uiCode == 1); 765 #endif 766 if( uiCode == 3 ) 767 { 768 READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); 769 } 770 771 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 772 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 885 886 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); 887 assert(uiCode <= 3); 888 if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) 889 { 890 READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); 891 } 892 893 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 894 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 773 895 READ_FLAG( uiCode, "conformance_window_flag"); 774 896 if (uiCode != 0) 775 897 { 776 898 Window &conf = pcSPS->getConformanceWindow(); 777 #if H_MV899 #if NH_MV 778 900 // Needs to be scaled later, when ChromaFormatIdc is known. 779 901 conf.setScaledFlag( false ); … … 791 913 } 792 914 793 #if H_MV915 #if NH_MV 794 916 if ( !pcSPS->getMultiLayerExtSpsFlag() ) 795 917 { 796 918 #endif 797 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 798 assert(uiCode <= 6); 799 pcSPS->setBitDepthY( uiCode + 8 ); 800 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 801 802 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 803 assert(uiCode <= 6); 804 pcSPS->setBitDepthC( uiCode + 8 ); 805 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 806 #if H_MV 919 920 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 921 #if O0043_BEST_EFFORT_DECODING 922 pcSPS->setStreamBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); 923 const UInt forceDecodeBitDepth = pcSPS->getForceDecodeBitDepth(); 924 if (forceDecodeBitDepth != 0) 925 { 926 uiCode = forceDecodeBitDepth - 8; 927 } 928 #endif 929 assert(uiCode <= 8); 930 pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); 931 932 #if O0043_BEST_EFFORT_DECODING 933 pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA)-8)) ); 934 #else 935 pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*uiCode) ); 936 #endif 937 938 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 939 #if O0043_BEST_EFFORT_DECODING 940 pcSPS->setStreamBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); 941 if (forceDecodeBitDepth != 0) 942 { 943 uiCode = forceDecodeBitDepth - 8; 944 } 945 #endif 946 assert(uiCode <= 8); 947 pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); 948 #if O0043_BEST_EFFORT_DECODING 949 pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_CHROMA)-8)) ); 950 #else 951 pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*uiCode) ); 952 #endif 953 #if NH_MV 807 954 } 808 955 #endif … … 811 958 assert(uiCode <= 12); 812 959 813 #if H_MV960 #if NH_MV 814 961 if ( !pcSPS->getMultiLayerExtSpsFlag()) 815 962 { 816 963 #endif 817 818 819 820 821 822 823 824 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" );825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 #if H_MV841 } 842 #endif 843 844 READ_UVLC( uiCode, "log2_min_ coding_block_size_minus3" );964 UInt subLayerOrderingInfoPresentFlag; 965 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 966 967 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 968 { 969 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); 970 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 971 READ_UVLC ( uiCode, "sps_max_num_reorder_pics[i]" ); 972 pcSPS->setNumReorderPics(uiCode, i); 973 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); 974 pcSPS->setMaxLatencyIncrease( uiCode, i ); 975 976 if (!subLayerOrderingInfoPresentFlag) 977 { 978 for (i++; i <= pcSPS->getMaxTLayers()-1; i++) 979 { 980 pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); 981 pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); 982 pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); 983 } 984 break; 985 } 986 } 987 #if NH_MV 988 } 989 #endif 990 991 READ_UVLC( uiCode, "log2_min_luma_coding_block_size_minus3" ); 845 992 Int log2MinCUSize = uiCode + 3; 846 993 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 847 READ_UVLC( uiCode, "log2_diff_max_min_ coding_block_size" );994 READ_UVLC( uiCode, "log2_diff_max_min_luma_coding_block_size" ); 848 995 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 849 996 850 997 if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) 851 998 { 852 999 assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); 853 1000 } 854 1001 855 1002 Int maxCUDepthDelta = uiCode; 856 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 1003 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 857 1004 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 858 READ_UVLC( uiCode, "log2_min_ transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );859 860 READ_UVLC( uiCode, "log2_diff_max_min_ transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );1005 READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 1006 1007 READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); 861 1008 pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); 862 1009 … … 865 1012 866 1013 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 867 pcSPS->setMax CUDepth( maxCUDepthDelta + addCuDepth );1014 pcSPS->setMaxTotalCUDepth( maxCUDepthDelta + addCuDepth + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) ); 868 1015 869 1016 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 870 1017 if(pcSPS->getScalingListFlag()) 871 1018 { 872 #if H_MV1019 #if NH_MV 873 1020 if ( pcSPS->getMultiLayerExtSpsFlag() ) 874 1021 { … … 883 1030 { 884 1031 #endif 885 886 887 888 parseScalingList( pcSPS->getScalingList() );889 890 #if H_MV1032 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); 1033 if(pcSPS->getScalingListPresentFlag ()) 1034 { 1035 parseScalingList( &(pcSPS->getScalingList()) ); 1036 } 1037 #if NH_MV 891 1038 } 892 1039 #endif … … 898 1045 if( pcSPS->getUsePCM() ) 899 1046 { 900 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth Luma (1 + uiCode );901 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth Chroma (1 + uiCode );1047 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode ); 1048 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode ); 902 1049 READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); 903 1050 READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); … … 918 1065 } 919 1066 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 920 if (pcSPS->getLongTermRefsPresent()) 921 { 922 READ_UVLC( uiCode, "num_long_term_ref_pic _sps" );1067 if (pcSPS->getLongTermRefsPresent()) 1068 { 1069 READ_UVLC( uiCode, "num_long_term_ref_pics_sps" ); 923 1070 pcSPS->setNumLongTermRefPicSPS(uiCode); 924 1071 for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) … … 941 1088 } 942 1089 943 944 #if H_MV945 1090 READ_FLAG( uiCode, "sps_extension_present_flag"); 1091 #if NH_MV 946 1092 pcSPS->setSpsExtensionPresentFlag( uiCode ); 947 1093 if (pcSPS->getSpsExtensionPresentFlag( ) ) 1094 { 1095 READ_FLAG( uiCode, "sps_range_extensions_flag" ); pcSPS->setSpsRangeExtensionsFlag( uiCode == 1 ); 1096 READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); pcSPS->setSpsMultilayerExtensionFlag( uiCode == 1 ); 1097 READ_FLAG( uiCode , "sps_3d_extension_flag" ); pcSPS->setSps3dExtensionFlag( uiCode == 1 ); 1098 READ_CODE( 5, uiCode, "sps_extension_5bits" ) ; pcSPS->setSpsExtension5bits( uiCode ); 1099 1100 if ( pcSPS->getSpsRangeExtensionsFlag() ) 1101 { 1102 TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension(); 1103 READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0); 1104 READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0); 1105 READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0)); 1106 READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0)); 1107 READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0); 1108 READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0); 1109 READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0); 1110 READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag"); spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0); 1111 READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0); 1112 } 1113 1114 if ( pcSPS->getSpsMultilayerExtensionFlag() ) 1115 { 1116 parseSpsMultilayerExtension( pcSPS ); 1117 } 1118 1119 if ( pcSPS->getSps3dExtensionFlag() ) 1120 { 1121 #if NH_3D 1122 parseSps3dExtension( pcSPS ); 1123 #endif 1124 } 1125 1126 #if NH_3D 1127 if ( pcSPS->getSpsExtension5bits() ) 948 1128 #else 949 READ_FLAG( uiCode, "sps_extension_flag"); 1129 if ( pcSPS->getSpsExtension5bits() || pcSPS->getSps3dExtensionFlag() ) 1130 #endif 1131 { 1132 while ( xMoreRbspData() ) 1133 { 1134 READ_FLAG( uiCode, "sps_extension_data_flag"); 1135 } 1136 } 1137 } 1138 #else 950 1139 if (uiCode) 951 #endif 952 { 953 #if H_MV 954 READ_FLAG( uiCode, "sps_range_extensions_flag" ); pcSPS->setSpsRangeExtensionsFlag( uiCode == 1 ); 955 READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); pcSPS->setSpsMultilayerExtensionFlag( uiCode == 1 ); 956 #if !H_3D 957 READ_CODE( 6, uiCode, "sps_extension_6bits" ); pcSPS->setSpsExtension6bits( uiCode ); 958 #else 959 READ_FLAG( uiCode, "sps_3d_extension_flag" ); pcSPS->setSps3dExtensionFlag( uiCode == 1 ); 960 READ_CODE( 5, uiCode, "sps_extension_5bits" ); pcSPS->setSpsExtension5bits( uiCode ); 961 #endif 962 } 963 964 if ( pcSPS->getSpsRangeExtensionsFlag() ) 965 { 966 assert( 0 ); 967 } 968 969 if ( pcSPS->getSpsMultilayerExtensionFlag() ) 970 { 971 parseSPSExtension( pcSPS ); 972 } 973 974 #if H_3D 975 if ( pcSPS->getSps3dExtensionFlag() ) 976 { 977 parseSPS3dExtension( pcSPS ); 978 } 979 980 if ( pcSPS->getSpsExtension5bits() ) 981 { 982 #else 983 if ( pcSPS->getSpsExtension6bits() ) 984 { 985 #endif 986 987 #endif 988 while ( xMoreRbspData() ) 989 { 990 READ_FLAG( uiCode, "sps_extension_data_flag"); 991 } 992 } 993 } 994 995 #if H_MV 996 Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) 1140 { 1141 1142 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 1143 static const char *syntaxStrings[]={ "sps_range_extension_flag", 1144 "sps_multilayer_extension_flag", 1145 "sps_extension_6bits[0]", 1146 "sps_extension_6bits[1]", 1147 "sps_extension_6bits[2]", 1148 "sps_extension_6bits[3]", 1149 "sps_extension_6bits[4]", 1150 "sps_extension_6bits[5]" }; 1151 #endif 1152 Bool sps_extension_flags[NUM_SPS_EXTENSION_FLAGS]; 1153 1154 for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) 1155 { 1156 READ_FLAG( uiCode, syntaxStrings[i] ); 1157 sps_extension_flags[i] = uiCode!=0; 1158 } 1159 1160 Bool bSkipTrailingExtensionBits=false; 1161 for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. 1162 { 1163 if (sps_extension_flags[i]) 1164 { 1165 switch (SPSExtensionFlagIndex(i)) 1166 { 1167 case SPS_EXT__REXT: 1168 assert(!bSkipTrailingExtensionBits); 1169 { 1170 TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension(); 1171 READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0); 1172 READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0); 1173 READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0)); 1174 READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0)); 1175 READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0); 1176 READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0); 1177 READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0); 1178 READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag"); spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0); 1179 READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0); 1180 } 1181 break; 1182 default: 1183 bSkipTrailingExtensionBits=true; 1184 break; 1185 } 1186 } 1187 } 1188 if (bSkipTrailingExtensionBits) 1189 { 1190 while ( xMoreRbspData() ) 1191 { 1192 READ_FLAG( uiCode, "sps_extension_data_flag"); 1193 } 1194 } 1195 } 1196 #endif 1197 xReadRbspTrailingBits(); 1198 } 1199 1200 #if NH_MV 1201 Void TDecCavlc::parseSpsMultilayerExtension( TComSPS* pcSPS ) 997 1202 { 998 1203 UInt uiCode; 999 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 1000 1001 } 1002 1003 #if H_3D 1004 Void TDecCavlc::parseSPS3dExtension( TComSPS* pcSPS ) 1204 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 1205 } 1206 1207 #if NH_3D 1208 Void TDecCavlc::parseSps3dExtension( TComSPS* pcSPS ) 1005 1209 { 1006 TComSps3dExtension * sps3dExt = pcSPS->getSps3dExtension();1210 TComSps3dExtension sps3dExt; 1007 1211 UInt uiCode; 1008 1212 for( Int d = 0; d <= 1; d++ ) 1009 1213 { 1010 READ_FLAG( uiCode, "iv_mv_pred_flag" ); sps3dExt ->setIvMvPredFlag( d, uiCode == 1 );1011 READ_FLAG( uiCode, "iv_mv_scaling_flag" ); sps3dExt ->setIvMvScalingFlag( d, uiCode == 1 );1214 READ_FLAG( uiCode, "iv_mv_pred_flag" ); sps3dExt.setIvMvPredFlag( d, uiCode == 1 ); 1215 READ_FLAG( uiCode, "iv_mv_scaling_flag" ); sps3dExt.setIvMvScalingFlag( d, uiCode == 1 ); 1012 1216 if( d == 0 ) 1013 1217 { 1014 READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt ->setLog2SubPbSizeMinus3( d, uiCode );1015 READ_FLAG( uiCode, "iv_res_pred_flag" ); sps3dExt ->setIvResPredFlag( d, uiCode == 1 );1016 READ_FLAG( uiCode, "depth_refinement_flag" ); sps3dExt ->setDepthRefinementFlag( d, uiCode == 1 );1017 READ_FLAG( uiCode, "view_synthesis_pred_flag" ); sps3dExt ->setViewSynthesisPredFlag( d, uiCode == 1 );1018 READ_FLAG( uiCode, "depth_based_blk_part_flag" ); sps3dExt ->setDepthBasedBlkPartFlag( d, uiCode == 1 );1218 READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt.setLog2SubPbSizeMinus3( d, uiCode ); 1219 READ_FLAG( uiCode, "iv_res_pred_flag" ); sps3dExt.setIvResPredFlag( d, uiCode == 1 ); 1220 READ_FLAG( uiCode, "depth_refinement_flag" ); sps3dExt.setDepthRefinementFlag( d, uiCode == 1 ); 1221 READ_FLAG( uiCode, "view_synthesis_pred_flag" ); sps3dExt.setViewSynthesisPredFlag( d, uiCode == 1 ); 1222 READ_FLAG( uiCode, "depth_based_blk_part_flag" ); sps3dExt.setDepthBasedBlkPartFlag( d, uiCode == 1 ); 1019 1223 } 1020 1224 else 1021 1225 { 1022 READ_FLAG( uiCode, "mpi_flag" ); sps3dExt->setMpiFlag( d, uiCode == 1 ); 1023 READ_UVLC( uiCode, "log2_mpi_sub_pb_size_minus3" ); sps3dExt->setLog2MpiSubPbSizeMinus3( d, uiCode ); 1024 READ_FLAG( uiCode, "intra_contour_flag" ); sps3dExt->setIntraContourFlag( d, uiCode == 1 ); 1025 READ_FLAG( uiCode, "intra_sdc_wedge_flag" ); sps3dExt->setIntraSdcWedgeFlag( d, uiCode == 1 ); 1026 READ_FLAG( uiCode, "qt_pred_flag" ); sps3dExt->setQtPredFlag( d, uiCode == 1 ); 1027 READ_FLAG( uiCode, "inter_sdc_flag" ); sps3dExt->setInterSdcFlag( d, uiCode == 1 ); 1028 READ_FLAG( uiCode, "intra_skip_flag" ); sps3dExt->setDepthIntraSkipFlag( d, uiCode == 1 ); 1029 } 1030 } 1031 } 1032 #endif 1033 1034 Void TDecCavlc::parsePPSMultilayerExtension(TComPPS* pcPPS) 1226 READ_FLAG( uiCode, "mpi_flag" ); sps3dExt.setMpiFlag( d, uiCode == 1 ); 1227 READ_UVLC( uiCode, "log2_mpi_sub_pb_size_minus3" ); sps3dExt.setLog2MpiSubPbSizeMinus3( d, uiCode ); 1228 READ_FLAG( uiCode, "intra_contour_flag" ); sps3dExt.setIntraContourFlag( d, uiCode == 1 ); 1229 READ_FLAG( uiCode, "intra_sdc_wedge_flag" ); sps3dExt.setIntraSdcWedgeFlag( d, uiCode == 1 ); 1230 READ_FLAG( uiCode, "qt_pred_flag" ); sps3dExt.setQtPredFlag( d, uiCode == 1 ); 1231 READ_FLAG( uiCode, "inter_sdc_flag" ); sps3dExt.setInterSdcFlag( d, uiCode == 1 ); 1232 READ_FLAG( uiCode, "intra_skip_flag" ); sps3dExt.setDepthIntraSkipFlag( d, uiCode == 1 ); 1233 } 1234 } 1235 pcSPS->setSps3dExtension( sps3dExt ); 1236 } 1237 #endif 1238 1239 Void TDecCavlc::parsePpsMultilayerExtension(TComPPS* pcPPS) 1035 1240 { 1036 1241 UInt uiCode = 0; … … 1087 1292 Void TDecCavlc::parseVPS(TComVPS* pcVPS) 1088 1293 { 1294 #if ENC_DEC_TRACE 1295 #if H_MV_ENC_DEC_TRAC 1296 tracePSHeader( "VPS", getDecTop()->getLayerId() ); 1297 #else 1298 xTraceVPSHeader (); 1299 #endif 1300 #endif 1301 1089 1302 UInt uiCode; 1090 1303 1091 1304 READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 1092 #if H_MV1305 #if NH_MV 1093 1306 READ_FLAG( uiCode, "vps_base_layer_internal_flag" ); pcVPS->setVpsBaseLayerInternalFlag( uiCode == 1 ); 1094 1307 READ_FLAG( uiCode, "vps_base_layer_available_flag" ); pcVPS->setVpsBaseLayerAvailableFlag( uiCode == 1 ); 1095 1308 #else 1096 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); 1097 #endif 1098 #if H_MV 1309 READ_FLAG( uiCode, "vps_base_layer_internal_flag" ); assert(uiCode == 1); 1310 READ_FLAG( uiCode, "vps_base_layer_available_flag" ); assert(uiCode == 1); 1311 #endif 1312 #if NH_MV 1099 1313 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayersMinus1( std::min( uiCode, (UInt) ( MAX_NUM_LAYER_IDS-1) ) ); 1100 1314 #else 1101 READ_CODE( 6, uiCode, "vps_ reserved_zero_6bits" ); assert(uiCode == 0);1315 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); 1102 1316 #endif 1103 1317 READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER); 1104 1318 READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); 1105 1319 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 1106 1107 READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); 1320 READ_CODE( 16, uiCode, "vps_reserved_0xffff_16bits" ); assert(uiCode == 0xffff); 1108 1321 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 1109 #if H_MV1322 #if NH_MV 1110 1323 pcVPS->getPTL()->inferGeneralValues ( true, 0, NULL ); 1111 1324 pcVPS->getPTL()->inferSubLayerValues( pcVPS->getMaxTLayers() - 1, 0, NULL ); … … 1115 1328 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 1116 1329 { 1117 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); 1118 READ_UVLC( uiCode, "vps_ num_reorder_pics[i]" );pcVPS->setNumReorderPics( uiCode, i );1330 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 1331 READ_UVLC( uiCode, "vps_max_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 1119 1332 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 1120 1333 … … 1132 1345 1133 1346 assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); 1134 #if H_MV1347 #if NH_MV 1135 1348 assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 ); 1136 1349 READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setVpsMaxLayerId( uiCode ); … … 1142 1355 #else 1143 1356 assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); 1144 READ_CODE( 6, uiCode, "vps_max_ nuh_reserved_zero_layer_id" );pcVPS->setMaxNuhReservedZeroLayerId( uiCode );1145 READ_UVLC( uiCode, "vps_ max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 );1357 READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); 1358 READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); 1146 1359 for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) 1147 1360 { … … 1150 1363 #endif 1151 1364 { 1152 READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); 1153 } 1154 } 1155 #if H_MV1365 READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); 1366 } 1367 } 1368 #if NH_MV 1156 1369 pcVPS->deriveLayerSetLayerIdList(); 1157 1370 #endif 1371 1158 1372 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 1159 1373 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 1167 1381 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 1168 1382 } 1383 1169 1384 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 1170 1385 … … 1175 1390 for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) 1176 1391 { 1177 READ_UVLC( uiCode, "hrd_ op_set_idx" );pcVPS->setHrdOpSetIdx( uiCode, i );1392 READ_UVLC( uiCode, "hrd_layer_set_idx[i]" ); pcVPS->setHrdOpSetIdx( uiCode, i ); 1178 1393 if( i > 0 ) 1179 1394 { 1180 READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i );1395 READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); 1181 1396 } 1182 1397 else … … 1188 1403 } 1189 1404 } 1190 #if H_MV1405 #if NH_MV 1191 1406 READ_FLAG( uiCode, "vps_extension_flag" ); pcVPS->setVpsExtensionFlag( uiCode == 1 ? true : false ); 1192 1407 if ( pcVPS->getVpsExtensionFlag() ) … … 1196 1411 #endif 1197 1412 { 1198 #if H_MV1413 #if NH_MV 1199 1414 m_pcBitstream->readOutTrailingBits(); 1200 1415 parseVPSExtension( pcVPS ); … … 1202 1417 if (uiCode) 1203 1418 { 1204 #if H_3D1419 #if NH_3D 1205 1420 READ_FLAG( uiCode, "vps_3d_extension_flag" ); 1206 1421 if ( uiCode ) … … 1208 1423 m_pcBitstream->readOutTrailingBits(); 1209 1424 pcVPS->createCamPars(pcVPS->getNumViews()); 1210 parseV PS3dExtension( pcVPS );1425 parseVps3dExtension( pcVPS ); 1211 1426 } 1212 1427 READ_FLAG( uiCode, "vps_extension3_flag" ); … … 1219 1434 READ_FLAG( uiCode, "vps_extension_data_flag"); 1220 1435 } 1221 #if H_MV 1222 #if H_3D 1223 } 1224 #endif 1225 } 1226 #endif 1227 } 1228 return; 1229 } 1230 1231 #if H_MV 1436 #if NH_MV 1437 #if NH_3D 1438 } 1439 #endif 1440 } 1441 #endif 1442 } 1443 1444 xReadRbspTrailingBits(); 1445 } 1446 1447 #if NH_MV 1232 1448 Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS ) 1233 1449 { … … 1306 1522 } 1307 1523 1308 #if H_3D1524 #if NH_3D 1309 1525 pcVPS->initViewCompLayer( ); 1310 1526 #endif … … 1441 1657 READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); pcVPS->setVpsNumRepFormatsMinus1( uiCode ); 1442 1658 1659 std::vector<TComRepFormat> repFormats; 1660 repFormats.resize( pcVPS->getVpsNumRepFormatsMinus1() + 1 ); 1443 1661 for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ ) 1444 { 1445 assert( pcVPS->getRepFormat(i) == NULL ); 1446 TComRepFormat* curRepFormat = new TComRepFormat(); 1447 TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL; 1448 parseRepFormat( i, curRepFormat , prevRepFormat); 1449 pcVPS->setRepFormat(i, curRepFormat ); 1450 } 1662 { 1663 TComRepFormat* curRepFormat = &repFormats[i]; 1664 TComRepFormat* prevRepFormat = i > 0 ? &repFormats[ i - 1] : NULL; 1665 parseRepFormat( i, curRepFormat , prevRepFormat); 1666 } 1667 pcVPS->setRepFormat( repFormats ); 1451 1668 1452 1669 if ( pcVPS->getVpsNumRepFormatsMinus1() > 0 ) … … 1514 1731 } 1515 1732 READ_FLAG( uiCode, "vps_vui_present_flag" ); pcVPS->setVpsVuiPresentFlag( uiCode == 1 ); 1733 1734 TComVPSVUI vpsVui; 1516 1735 if( pcVPS->getVpsVuiPresentFlag() ) 1517 1736 { 1518 1737 m_pcBitstream->readOutTrailingBits(); // vps_vui_alignment_bit_equal_to_one 1519 parseVPSVUI( pcVPS );1738 parseVPSVUI( pcVPS, &vpsVui ); 1520 1739 } 1521 1740 else 1522 { 1523 TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );1524 assert( pcVPSVUI);1525 pcVPSVUI->inferVpsVui( false );1526 }1741 { 1742 // inference of syntax elements that differ from default inference (as done in constructor), when VPS VUI is not present 1743 vpsVui.setCrossLayerIrapAlignedFlag( false ); 1744 } 1745 pcVPS->setVPSVUI( vpsVui ); 1527 1746 pcVPS->checkVPSExtensionSyntax(); 1528 1747 } 1529 1748 1530 Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )1749 Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, const TComRepFormat* pcPrevRepFormat ) 1531 1750 { 1532 1751 assert( pcRepFormat ); … … 1552 1771 else 1553 1772 { 1554 pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat , false);1773 pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat ); 1555 1774 } 1556 1775 READ_FLAG( uiCode, "conformance_window_vps_flag" ); pcRepFormat->setConformanceWindowVpsFlag( uiCode == 1 ); … … 1565 1784 1566 1785 1567 Void TDecCavlc::parseVPSVUI( TComVPS* pcVPS)1786 Void TDecCavlc::parseVPSVUI( const TComVPS* pcVPS, TComVPSVUI* vpsVui ) 1568 1787 { 1569 1788 assert( pcVPS ); 1570 1571 TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 1572 1573 assert( pcVPSVUI ); 1789 assert( vpsVui ); 1790 1791 vpsVui->init(pcVPS->getNumAddLayerSets(),pcVPS->getMaxSubLayersMinus1() + 1, pcVPS->getMaxLayersMinus1() + 1 ); 1574 1792 1575 1793 UInt uiCode; 1576 READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); pcVPSVUI->setCrossLayerPicTypeAlignedFlag( uiCode == 1 );1577 if ( ! pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )1794 READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); vpsVui->setCrossLayerPicTypeAlignedFlag( uiCode == 1 ); 1795 if ( !vpsVui->getCrossLayerPicTypeAlignedFlag() ) 1578 1796 { 1579 READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPSVUI->setCrossLayerIrapAlignedFlag( uiCode == 1 );1580 } 1581 if( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) )1582 { 1583 READ_FLAG( uiCode, "all_layers_idr_aligned_flag" ); pcVPSVUI->setAllLayersIdrAlignedFlag( uiCode == 1 );1584 } 1585 READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 );1586 READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 );1587 if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) )1797 READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); vpsVui->setCrossLayerIrapAlignedFlag( uiCode == 1 ); 1798 } 1799 if( vpsVui->getCrossLayerIrapAlignedFlag( ) ) 1800 { 1801 READ_FLAG( uiCode, "all_layers_idr_aligned_flag" ); vpsVui->setAllLayersIdrAlignedFlag( uiCode == 1 ); 1802 } 1803 READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); vpsVui->setBitRatePresentVpsFlag( uiCode == 1 ); 1804 READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); vpsVui->setPicRatePresentVpsFlag( uiCode == 1 ); 1805 if( vpsVui->getBitRatePresentVpsFlag( ) || vpsVui->getPicRatePresentVpsFlag( ) ) 1588 1806 { 1589 1807 for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i < pcVPS->getNumLayerSets(); i++ ) … … 1591 1809 for( Int j = 0; j <= pcVPS->getMaxSubLayersInLayerSetMinus1( i ); j++ ) 1592 1810 { 1593 if( pcVPSVUI->getBitRatePresentVpsFlag( ) )1594 { 1595 READ_FLAG( uiCode, "bit_rate_present_flag" ); pcVPSVUI->setBitRatePresentFlag( i, j, uiCode == 1 );1596 } 1597 if( pcVPSVUI->getPicRatePresentVpsFlag( ) )1598 { 1599 READ_FLAG( uiCode, "pic_rate_present_flag" ); pcVPSVUI->setPicRatePresentFlag( i, j, uiCode == 1 );1600 } 1601 if( pcVPSVUI->getBitRatePresentFlag( i, j ) )1602 { 1603 READ_CODE( 16, uiCode, "avg_bit_rate" ); pcVPSVUI->setAvgBitRate( i, j, uiCode );1604 READ_CODE( 16, uiCode, "max_bit_rate" ); pcVPSVUI->setMaxBitRate( i, j, uiCode );1605 } 1606 if( pcVPSVUI->getPicRatePresentFlag( i, j ) )1607 { 1608 READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); pcVPSVUI->setConstantPicRateIdc( i, j, uiCode );1609 READ_CODE( 16, uiCode, "avg_pic_rate" ); pcVPSVUI->setAvgPicRate( i, j, uiCode );1610 } 1611 } 1612 } 1613 } 1614 1615 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); pcVPSVUI->setVideoSignalInfoIdxPresentFlag( uiCode == 1 );1616 if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )1617 { 1618 READ_CODE( 4, uiCode, "vps_num_video_signal_info_minus1" ); pcVPSVUI->setVpsNumVideoSignalInfoMinus1( uiCode );1811 if( vpsVui->getBitRatePresentVpsFlag( ) ) 1812 { 1813 READ_FLAG( uiCode, "bit_rate_present_flag" ); vpsVui->setBitRatePresentFlag( i, j, uiCode == 1 ); 1814 } 1815 if( vpsVui->getPicRatePresentVpsFlag( ) ) 1816 { 1817 READ_FLAG( uiCode, "pic_rate_present_flag" ); vpsVui->setPicRatePresentFlag( i, j, uiCode == 1 ); 1818 } 1819 if( vpsVui->getBitRatePresentFlag( i, j ) ) 1820 { 1821 READ_CODE( 16, uiCode, "avg_bit_rate" ); vpsVui->setAvgBitRate( i, j, uiCode ); 1822 READ_CODE( 16, uiCode, "max_bit_rate" ); vpsVui->setMaxBitRate( i, j, uiCode ); 1823 } 1824 if( vpsVui->getPicRatePresentFlag( i, j ) ) 1825 { 1826 READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); vpsVui->setConstantPicRateIdc( i, j, uiCode ); 1827 READ_CODE( 16, uiCode, "avg_pic_rate" ); vpsVui->setAvgPicRate( i, j, uiCode ); 1828 } 1829 } 1830 } 1831 } 1832 1833 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vpsVui->setVideoSignalInfoIdxPresentFlag( uiCode == 1 ); 1834 if( vpsVui->getVideoSignalInfoIdxPresentFlag() ) 1835 { 1836 READ_CODE( 4, uiCode, "vps_num_video_signal_info_minus1" ); vpsVui->setVpsNumVideoSignalInfoMinus1( uiCode ); 1619 1837 } 1620 1838 else 1621 1839 { 1622 pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() - pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1 ); 1623 } 1624 1625 for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ ) 1626 { 1627 assert( pcVPSVUI->getVideoSignalInfo( i ) == NULL ); 1628 TComVideoSignalInfo* curVideoSignalInfo = new TComVideoSignalInfo(); 1629 parseVideoSignalInfo( curVideoSignalInfo ); 1630 pcVPSVUI->setVideoSignalInfo(i, curVideoSignalInfo ); 1631 } 1632 1633 if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 ) 1840 vpsVui->setVpsNumVideoSignalInfoMinus1( (pcVPS->getMaxLayersMinus1() - pcVPS->getVpsBaseLayerInternalFlag()) ? 0 : 1 ); 1841 } 1842 1843 std::vector<TComVideoSignalInfo> videoSignalInfos; 1844 videoSignalInfos.resize(vpsVui->getVpsNumVideoSignalInfoMinus1() + 1 ); 1845 1846 for( Int i = 0; i <= vpsVui->getVpsNumVideoSignalInfoMinus1(); i++ ) 1847 { 1848 parseVideoSignalInfo( &videoSignalInfos[i] ); 1849 } 1850 vpsVui->setVideoSignalInfo( videoSignalInfos ); 1851 1852 if( vpsVui->getVideoSignalInfoIdxPresentFlag() && vpsVui->getVpsNumVideoSignalInfoMinus1() > 0 ) 1634 1853 { 1635 1854 for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1636 1855 { 1637 READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); pcVPSVUI->setVpsVideoSignalInfoIdx( i, uiCode );1638 } 1639 } 1640 else if ( ! pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )1856 READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); vpsVui->setVpsVideoSignalInfoIdx( i, uiCode ); 1857 } 1858 } 1859 else if ( !vpsVui->getVideoSignalInfoIdxPresentFlag() ) 1641 1860 { 1642 1861 for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1643 1862 { 1644 pcVPSVUI->setVpsVideoSignalInfoIdx( i, i );1863 vpsVui->setVpsVideoSignalInfoIdx( i, i ); 1645 1864 } 1646 1865 } … … 1649 1868 for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1650 1869 { 1651 pcVPSVUI->setVpsVideoSignalInfoIdx( i, 0 );1652 } 1653 } 1654 1655 READ_FLAG( uiCode, "tiles_not_in_use_flag" ); pcVPSVUI->setTilesNotInUseFlag( uiCode == 1 );1656 if( ! pcVPSVUI->getTilesNotInUseFlag() )1870 vpsVui->setVpsVideoSignalInfoIdx( i, 0 ); 1871 } 1872 } 1873 1874 READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vpsVui->setTilesNotInUseFlag( uiCode == 1 ); 1875 if( !vpsVui->getTilesNotInUseFlag() ) 1657 1876 { 1658 1877 for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1659 1878 { 1660 READ_FLAG( uiCode, "tiles_in_use_flag[i]" ); pcVPSVUI->setTilesInUseFlag( i, uiCode == 1 );1661 if( pcVPSVUI->getTilesInUseFlag( i ) )1662 { 1663 READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[i]" ); pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, uiCode == 1 );1879 READ_FLAG( uiCode, "tiles_in_use_flag[i]" ); vpsVui->setTilesInUseFlag( i, uiCode == 1 ); 1880 if( vpsVui->getTilesInUseFlag( i ) ) 1881 { 1882 READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[i]" ); vpsVui->setLoopFilterNotAcrossTilesFlag( i, uiCode == 1 ); 1664 1883 } 1665 1884 } … … 1669 1888 { 1670 1889 Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getIdDirectRefLayer(pcVPS->getLayerIdInNuh( i ) , j )); 1671 if( pcVPSVUI->getTilesInUseFlag( i ) && pcVPSVUI->getTilesInUseFlag( layerIdx ) )1672 { 1673 READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 );1890 if( vpsVui->getTilesInUseFlag( i ) && vpsVui->getTilesInUseFlag( layerIdx ) ) 1891 { 1892 READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vpsVui->setTileBoundariesAlignedFlag( i, j, uiCode == 1 ); 1674 1893 } 1675 1894 } … … 1677 1896 } 1678 1897 1679 READ_FLAG( uiCode, "wpp_not_in_use_flag" ); pcVPSVUI->setWppNotInUseFlag( uiCode == 1 );1898 READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vpsVui->setWppNotInUseFlag( uiCode == 1 ); 1680 1899 1681 if( ! pcVPSVUI->getWppNotInUseFlag( ))1900 if( !vpsVui->getWppNotInUseFlag( )) 1682 1901 { 1683 1902 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1684 1903 { 1685 READ_FLAG( uiCode, "wpp_in_use_flag[i]" ); pcVPSVUI->setWppInUseFlag( i, uiCode == 1 );1686 } 1687 } 1688 READ_FLAG( uiCode, "single_layer_for_non_irap_flag" ); pcVPSVUI->setSingleLayerForNonIrapFlag( uiCode == 1 );1689 READ_FLAG( uiCode, "higher_layer_irap_skip_flag" ); pcVPSVUI->setHigherLayerIrapSkipFlag( uiCode == 1 );1690 READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 );1691 1692 if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) )1904 READ_FLAG( uiCode, "wpp_in_use_flag[i]" ); vpsVui->setWppInUseFlag( i, uiCode == 1 ); 1905 } 1906 } 1907 READ_FLAG( uiCode, "single_layer_for_non_irap_flag" ); vpsVui->setSingleLayerForNonIrapFlag( uiCode == 1 ); 1908 READ_FLAG( uiCode, "higher_layer_irap_skip_flag" ); vpsVui->setHigherLayerIrapSkipFlag( uiCode == 1 ); 1909 READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vpsVui->setIlpRestrictedRefLayersFlag( uiCode == 1 ); 1910 1911 if( vpsVui->getIlpRestrictedRefLayersFlag( ) ) 1693 1912 { 1694 1913 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) … … 1698 1917 if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getIdDirectRefLayer( pcVPS->getLayerIdInNuh( i ), j ) > 0 ) 1699 1918 { 1700 READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );1701 if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )1919 READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); vpsVui->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); 1920 if( vpsVui->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 ) 1702 1921 { 1703 READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 );1704 if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) )1922 READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); vpsVui->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 ); 1923 if( vpsVui->getCtuBasedOffsetEnabledFlag( i, j ) ) 1705 1924 { 1706 READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, uiCode );1925 READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); vpsVui->setMinHorizontalCtuOffsetPlus1( i, j, uiCode ); 1707 1926 } 1708 1927 } … … 1712 1931 } 1713 1932 1714 READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); pcVPSVUI->setVpsVuiBspHrdPresentFlag( uiCode == 1 );1715 if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )1716 { 1717 assert(pcVPS->getTimingInfo()->getTimingInfoPresentFlag() == 1); 1718 parseVpsVuiBspHrdParameters( pcVPS );1933 READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); vpsVui->setVpsVuiBspHrdPresentFlag( uiCode == 1 ); 1934 if ( vpsVui->getVpsVuiBspHrdPresentFlag( ) ) 1935 { 1936 assert(pcVPS->getTimingInfo()->getTimingInfoPresentFlag() == 1); 1937 parseVpsVuiBspHrdParameters( pcVPS, vpsVui ); 1719 1938 } 1720 1939 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) … … 1722 1941 if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i )) == 0 ) 1723 1942 { 1724 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); pcVPSVUI->setBaseLayerParameterSetCompatibilityFlag( i, uiCode == 1 ); 1725 } 1726 } 1727 } 1728 1729 Void TDecCavlc::parseVpsVuiBspHrdParameters( TComVPS* pcVPS ) 1730 { 1731 assert( pcVPS ); 1732 1733 TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 1734 1735 assert( pcVPSVUI ); 1736 1737 TComVpsVuiBspHrdParameters* vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters(); 1738 assert( vpsVuiBspHrdP == NULL ); 1739 vpsVuiBspHrdP = new TComVpsVuiBspHrdParameters; 1740 pcVPSVUI->setVpsVuiBspHrdParameters( vpsVuiBspHrdP ); 1943 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); vpsVui->setBaseLayerParameterSetCompatibilityFlag( i, uiCode == 1 ); 1944 } 1945 } 1946 } 1947 1948 Void TDecCavlc::parseVpsVuiBspHrdParameters( const TComVPS* pcVPS, TComVPSVUI* vpsVui ) 1949 { 1950 assert( pcVPS ); 1951 assert( vpsVui ); 1952 1953 TComVpsVuiBspHrdParameters vpsVuiBspHrdP; 1954 1741 1955 UInt uiCode; 1742 READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vpsVuiBspHrdP ->setVpsNumAddHrdParams( uiCode );1743 vpsVuiBspHrdP ->createAfterVpsNumAddHrdParams( pcVPS );1744 for( Int i = pcVPS->getNumHrdParameters(); i < pcVPS->getNumHrdParameters() + vpsVuiBspHrdP ->getVpsNumAddHrdParams(); i++ )1956 READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vpsVuiBspHrdP.setVpsNumAddHrdParams( uiCode ); 1957 vpsVuiBspHrdP.createAfterVpsNumAddHrdParams( pcVPS ); 1958 for( Int i = pcVPS->getNumHrdParameters(); i < pcVPS->getNumHrdParameters() + vpsVuiBspHrdP.getVpsNumAddHrdParams(); i++ ) 1745 1959 { 1746 1960 if( i > 0 ) 1747 1961 { 1748 READ_FLAG( uiCode, "cprms_add_present_flag" ); vpsVuiBspHrdP ->setCprmsAddPresentFlag( i, uiCode == 1 );1962 READ_FLAG( uiCode, "cprms_add_present_flag" ); vpsVuiBspHrdP.setCprmsAddPresentFlag( i, uiCode == 1 ); 1749 1963 } 1750 1964 else 1751 1965 { 1752 vpsVuiBspHrdP->setCprmsAddPresentFlag( i, true ); 1753 } 1754 1755 READ_UVLC( uiCode, "num_sub_layer_hrd_minus1" ); vpsVuiBspHrdP->setNumSubLayerHrdMinus1( i, uiCode ); 1756 TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i ); 1757 parseHrdParameters( hrdParameters, vpsVuiBspHrdP->getCprmsAddPresentFlag( i ), vpsVuiBspHrdP->getNumSubLayerHrdMinus1( i ) ); 1758 } 1759 1760 vpsVuiBspHrdP->setNumPartitionsInSchemeMinus1( 0, 0, 0); 1761 vpsVuiBspHrdP->createAfterNumPartitionsInSchemeMinus1( 0, 0 ); 1966 vpsVuiBspHrdP.setCprmsAddPresentFlag( i, true ); 1967 } 1968 1969 READ_UVLC( uiCode, "num_sub_layer_hrd_minus1" ); vpsVuiBspHrdP.setNumSubLayerHrdMinus1( i, uiCode ); 1970 1971 TComHRD hrdParameters; 1972 parseHrdParameters( &hrdParameters, vpsVuiBspHrdP.getCprmsAddPresentFlag( i ), vpsVuiBspHrdP.getNumSubLayerHrdMinus1( i ) ); 1973 vpsVuiBspHrdP.setHrdParametermeters( i, hrdParameters ); 1974 } 1975 1976 vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( 0, 0, 0); 1977 vpsVuiBspHrdP.createAfterNumPartitionsInSchemeMinus1( pcVPS, 0, 0 ); 1762 1978 1763 1979 for( Int h = 0; h < pcVPS->getNumOutputLayerSets(); h++ ) … … 1765 1981 if ( h == 0) 1766 1982 { 1767 vpsVuiBspHrdP ->setNumSignalledPartitioningSchemes( h, 0 );1983 vpsVuiBspHrdP.setNumSignalledPartitioningSchemes( h, 0 ); 1768 1984 } 1769 1985 else 1770 1986 { 1771 READ_UVLC( uiCode, "num_signalled_partitioning_schemes" ); vpsVuiBspHrdP ->setNumSignalledPartitioningSchemes( h, uiCode );1987 READ_UVLC( uiCode, "num_signalled_partitioning_schemes" ); vpsVuiBspHrdP.setNumSignalledPartitioningSchemes( h, uiCode ); 1772 1988 } 1773 vpsVuiBspHrdP ->createAfterNumSignalledPartitioningSchemes(h );1774 1775 for( Int j = 0; j < vpsVuiBspHrdP ->getNumSignalledPartitioningSchemes( h ) + 1; j++ )1989 vpsVuiBspHrdP.createAfterNumSignalledPartitioningSchemes( pcVPS, h ); 1990 1991 for( Int j = 0; j < vpsVuiBspHrdP.getNumSignalledPartitioningSchemes( h ) + 1; j++ ) 1776 1992 { 1777 1993 if ( j == 0 && h == 0 ) 1778 1994 { 1779 vpsVuiBspHrdP ->setNumPartitionsInSchemeMinus1( h, j, uiCode );1995 vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, uiCode ); 1780 1996 } 1781 1997 else if( j == 0 ) 1782 1998 { 1783 vpsVuiBspHrdP ->setNumPartitionsInSchemeMinus1( h, j, pcVPS->getNumLayersInIdList( h ) - 1 );1999 vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, pcVPS->getNumLayersInIdList( h ) - 1 ); 1784 2000 } 1785 2001 else 1786 2002 { 1787 READ_UVLC( uiCode, "num_partitions_in_scheme_minus1" ); vpsVuiBspHrdP ->setNumPartitionsInSchemeMinus1( h, j, uiCode );1788 } 1789 vpsVuiBspHrdP ->createAfterNumPartitionsInSchemeMinus1(h, j );1790 1791 for( Int k = 0; k <= vpsVuiBspHrdP ->getNumPartitionsInSchemeMinus1( h, j ); k++ )2003 READ_UVLC( uiCode, "num_partitions_in_scheme_minus1" ); vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, uiCode ); 2004 } 2005 vpsVuiBspHrdP.createAfterNumPartitionsInSchemeMinus1(pcVPS, h, j ); 2006 2007 for( Int k = 0; k <= vpsVuiBspHrdP.getNumPartitionsInSchemeMinus1( h, j ); k++ ) 1792 2008 { 1793 2009 for( Int r = 0; r < pcVPS->getNumLayersInIdList(pcVPS->olsIdxToLsIdx( h ) ) ; r++ ) … … 1795 2011 if( h == 0 && j == 0 && k == 0 && r == 0 ) 1796 2012 { 1797 vpsVuiBspHrdP ->setLayerIncludedInPartitionFlag( h, j, k, r, true );2013 vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, true ); 1798 2014 } 1799 2015 else if ( h > 0 && j == 0 ) 1800 2016 { 1801 vpsVuiBspHrdP ->setLayerIncludedInPartitionFlag( h, j, k, r, (k == r) );2017 vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, (k == r) ); 1802 2018 } 1803 2019 else 1804 2020 { 1805 READ_FLAG( uiCode, "layer_included_in_partition_flag" ); vpsVuiBspHrdP ->setLayerIncludedInPartitionFlag( h, j, k, r, uiCode == 1 );2021 READ_FLAG( uiCode, "layer_included_in_partition_flag" ); vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, uiCode == 1 ); 1806 2022 } 1807 2023 } … … 1810 2026 if ( h > 0 ) 1811 2027 { 1812 for( Int i = 0; i < vpsVuiBspHrdP ->getNumSignalledPartitioningSchemes( h ) + 1; i++ )2028 for( Int i = 0; i < vpsVuiBspHrdP.getNumSignalledPartitioningSchemes( h ) + 1; i++ ) 1813 2029 { 1814 2030 for( Int t = 0; t <= pcVPS->getMaxSubLayersInLayerSetMinus1( pcVPS->olsIdxToLsIdx( i ) ); t++ ) 1815 2031 { 1816 READ_UVLC( uiCode, "num_bsp_schedules_minus1" ); vpsVuiBspHrdP ->setNumBspSchedulesMinus1( h, i, t, uiCode );1817 vpsVuiBspHrdP ->createAfterNumBspSchedulesMinus1(h, i, t );1818 for( Int j = 0; j <= vpsVuiBspHrdP ->getNumBspSchedulesMinus1( h, i, t ); j++ )2032 READ_UVLC( uiCode, "num_bsp_schedules_minus1" ); vpsVuiBspHrdP.setNumBspSchedulesMinus1( h, i, t, uiCode ); 2033 vpsVuiBspHrdP.createAfterNumBspSchedulesMinus1(pcVPS, h, i, t ); 2034 for( Int j = 0; j <= vpsVuiBspHrdP.getNumBspSchedulesMinus1( h, i, t ); j++ ) 1819 2035 { 1820 for( Int k = 0; k <= vpsVuiBspHrdP ->getNumPartitionsInSchemeMinus1( h, j ); k++ )2036 for( Int k = 0; k <= vpsVuiBspHrdP.getNumPartitionsInSchemeMinus1( h, j ); k++ ) 1821 2037 { 1822 READ_CODE( vpsVuiBspHrdP ->getBspHrdIdxLen( pcVPS ), uiCode, "bsp_hrd_idx" ); vpsVuiBspHrdP->setBspHrdIdx( h, i, t, j, k, uiCode );1823 READ_UVLC( uiCode, "bsp_sched_idx" ); vpsVuiBspHrdP ->setBspSchedIdx( h, i, t, j, k, uiCode );2038 READ_CODE( vpsVuiBspHrdP.getBspHrdIdxLen( pcVPS ), uiCode, "bsp_hrd_idx" ); vpsVuiBspHrdP.setBspHrdIdx( h, i, t, j, k, uiCode ); 2039 READ_UVLC( uiCode, "bsp_sched_idx" ); vpsVuiBspHrdP.setBspSchedIdx( h, i, t, j, k, uiCode ); 1824 2040 } 1825 2041 } … … 1828 2044 } 1829 2045 } 2046 vpsVui->setVpsVuiBspHrdParameters( vpsVuiBspHrdP ); 1830 2047 } 1831 2048 … … 1843 2060 { 1844 2061 UInt uiCode; 1845 TComDpbSize* dpbSize = vps->getDpbSize(); 1846 assert ( dpbSize != 0 ); 2062 TComDpbSize dpbSize; 2063 2064 dpbSize.init( vps->getNumOutputLayerSets(), vps->getVpsMaxLayerId() + 1, vps->getMaxSubLayersMinus1() + 1 ) ; 1847 2065 1848 2066 for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ ) 1849 2067 { 1850 2068 Int currLsIdx = vps->olsIdxToLsIdx( i ); 1851 READ_FLAG( uiCode, "sub_layer_flag_info_present_flag" ); dpbSize ->setSubLayerFlagInfoPresentFlag( i, uiCode == 1 );2069 READ_FLAG( uiCode, "sub_layer_flag_info_present_flag" ); dpbSize.setSubLayerFlagInfoPresentFlag( i, uiCode == 1 ); 1852 2070 for( Int j = 0; j <= vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ ) 1853 2071 { 1854 if( j > 0 && dpbSize ->getSubLayerDpbInfoPresentFlag( i, j ) )1855 { 1856 READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize ->setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 );1857 } 1858 if( dpbSize ->getSubLayerDpbInfoPresentFlag( i, j ) )2072 if( j > 0 && dpbSize.getSubLayerDpbInfoPresentFlag( i, j ) ) 2073 { 2074 READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize.setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 ); 2075 } 2076 if( dpbSize.getSubLayerDpbInfoPresentFlag( i, j ) ) 1859 2077 { 1860 2078 for( Int k = 0; k < vps->getNumLayersInIdList( currLsIdx ); k++ ) … … 1862 2080 if ( vps->getNecessaryLayerFlag( i, k ) && ( vps->getVpsBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(vps->olsIdxToLsIdx(i),k) != 0 ) )) 1863 2081 { 1864 READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize ->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );2082 READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); 1865 2083 } 1866 2084 else … … 1868 2086 if ( vps->getNecessaryLayerFlag( i, k ) && ( j == 0 ) && ( k == 0 )) 1869 2087 { 1870 dpbSize ->setMaxVpsDecPicBufferingMinus1(i ,k, j, 0 );2088 dpbSize.setMaxVpsDecPicBufferingMinus1(i ,k, j, 0 ); 1871 2089 } 1872 2090 } 1873 2091 } 1874 READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize ->setMaxVpsNumReorderPics( i, j, uiCode );1875 READ_UVLC( uiCode, "max_vps_latency_increase_plus1" ); dpbSize ->setMaxVpsLatencyIncreasePlus1( i, j, uiCode );2092 READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize.setMaxVpsNumReorderPics( i, j, uiCode ); 2093 READ_UVLC( uiCode, "max_vps_latency_increase_plus1" ); dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, uiCode ); 1876 2094 } 1877 2095 else … … 1883 2101 if ( vps->getNecessaryLayerFlag(i, k ) ) 1884 2102 { 1885 dpbSize ->setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );2103 dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize.getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) ); 1886 2104 } 1887 2105 } 1888 dpbSize ->setMaxVpsNumReorderPics ( i, j, dpbSize->getMaxVpsNumReorderPics ( i, j - 1 ) );1889 dpbSize ->setMaxVpsLatencyIncreasePlus1( i, j, dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );2106 dpbSize.setMaxVpsNumReorderPics ( i, j, dpbSize.getMaxVpsNumReorderPics ( i, j - 1 ) ); 2107 dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, dpbSize.getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); 1890 2108 } 1891 2109 } 1892 2110 } 1893 2111 } 1894 } 1895 1896 #if H_3D 1897 Void TDecCavlc::parseVPS3dExtension( TComVPS* pcVPS ) 2112 vps->setDpbSize( dpbSize ); 2113 } 2114 2115 #if NH_3D 2116 Void TDecCavlc::parseVps3dExtension( TComVPS* pcVPS ) 1898 2117 { 1899 2118 UInt uiCode; … … 1929 2148 #endif 1930 2149 #endif 1931 #if H_MV 1932 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, Int targetOlsIdx) 1933 #else 1934 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) 1935 #endif 2150 2151 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) 1936 2152 { 1937 2153 UInt uiCode; … … 1939 2155 1940 2156 #if ENC_DEC_TRACE 1941 xTraceSliceHeader(rpcSlice); 2157 #if NH_MV 2158 tracePSHeader( "Slice", pcSlice->getLayerId() ); 2159 #else 2160 xTraceSliceHeader(); 2161 #endif 1942 2162 #endif 1943 2163 TComPPS* pps = NULL; 1944 2164 TComSPS* sps = NULL; 1945 #if H_MV2165 #if NH_MV 1946 2166 TComVPS* vps = NULL; 1947 2167 #endif … … 1949 2169 UInt firstSliceSegmentInPic; 1950 2170 READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); 1951 if( rpcSlice->getRapPicFlag())1952 { 2171 if( pcSlice->getRapPicFlag()) 2172 { 1953 2173 READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already 1954 #if SETTING_NO_OUT_PIC_PRIOR 1955 rpcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); 1956 #else 1957 rpcSlice->setNoOutputPicPrior( false ); 1958 #endif 1959 } 1960 1961 READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); 1962 pps = parameterSetManager->getPrefetchedPPS(uiCode); 2174 pcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); 2175 } 2176 READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); pcSlice->setPPSId(uiCode); 2177 pps = parameterSetManager->getPPS(uiCode); 1963 2178 //!KS: need to add error handling code here, if PPS is not available 1964 2179 assert(pps!=0); 1965 sps = parameterSetManager->get PrefetchedSPS(pps->getSPSId());2180 sps = parameterSetManager->getSPS(pps->getSPSId()); 1966 2181 //!KS: need to add error handling code here, if SPS is not available 1967 2182 assert(sps!=0); 1968 #if H_MV 1969 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 1970 assert( vps != NULL ); 1971 1972 sps->inferRepFormat ( vps , rpcSlice->getLayerId() ); 2183 #if NH_MV 2184 vps = parameterSetManager->getVPS(sps->getVPSId()); 2185 assert( vps != NULL ); 2186 m_decTop->initFromActiveVps( vps ); 2187 Int targetOlsIdx = m_decTop->getTargetOlsIdx(); 2188 2189 // Do inference 2190 sps->inferRepFormat ( vps , pcSlice->getLayerId(), false ); 1973 2191 sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 1974 sps->inferSpsMaxDecPicBufferingMinus1( vps, targetOlsIdx, rpcSlice->getLayerId(), false ); 2192 sps->inferSpsMaxDecPicBufferingMinus1( vps, targetOlsIdx, pcSlice->getLayerId(), false ); 2193 2194 if( sps->getMultiLayerExtSpsFlag() ) 2195 { 2196 sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true ); 2197 } 1975 2198 1976 2199 if ( sps->getVuiParametersPresentFlag() ) 1977 2200 { 1978 sps->getVuiParameters()->inferVideoSignalInfo( vps, rpcSlice->getLayerId() ); 1979 } 1980 rpcSlice->setVPS(vps); 1981 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerId() ) ); 1982 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerId() ) ); 1983 #if H_3D 1984 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerId() ) == 1 ); 1985 #endif 1986 #endif 1987 rpcSlice->setSPS(sps); 1988 rpcSlice->setPPS(pps); 2201 sps->getVuiParameters()->inferVideoSignalInfo( vps, pcSlice->getLayerId() ); 2202 } 2203 2204 2205 pcSlice->setVPS(vps); 2206 pcSlice->setSPS(sps); 2207 pcSlice->setPPS(pps); 2208 2209 pcSlice->setViewId ( vps->getViewId ( pcSlice->getLayerId() ) ); 2210 pcSlice->setViewIndex( vps->getViewIndex( pcSlice->getLayerId() ) ); 2211 #if NH_3D 2212 pcSlice->setIsDepth ( vps->getDepthId ( pcSlice->getLayerId() ) == 1 ); 2213 #endif 2214 #endif 2215 2216 const ChromaFormat chFmt = sps->getChromaFormatIdc(); 2217 const UInt numValidComp=getNumberValidComponents(chFmt); 2218 const Bool bChroma=(chFmt!=CHROMA_400); 2219 1989 2220 if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) 1990 2221 { 1991 READ_FLAG( uiCode, "dependent_slice_segment_flag" ); rpcSlice->setDependentSliceSegmentFlag(uiCode ? true : false);2222 READ_FLAG( uiCode, "dependent_slice_segment_flag" ); pcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); 1992 2223 } 1993 2224 else 1994 2225 { 1995 rpcSlice->setDependentSliceSegmentFlag(false);2226 pcSlice->setDependentSliceSegmentFlag(false); 1996 2227 } 1997 2228 Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); 1998 Int maxParts = (1<<(sps->getMaxCUDepth()<<1));1999 2229 UInt sliceSegmentAddress = 0; 2000 2230 Int bitsSliceSegmentAddress = 0; … … 2009 2239 } 2010 2240 //set uiCode to equal slice start address (or dependent slice start address) 2011 Int startCuAddress = maxParts*sliceSegmentAddress; 2012 rpcSlice->setSliceSegmentCurStartCUAddr( startCuAddress ); 2013 rpcSlice->setSliceSegmentCurEndCUAddr(numCTUs*maxParts); 2014 2015 if (rpcSlice->getDependentSliceSegmentFlag()) 2016 { 2017 rpcSlice->setNextSlice ( false ); 2018 rpcSlice->setNextSliceSegment ( true ); 2019 } 2020 else 2021 { 2022 rpcSlice->setNextSlice ( true ); 2023 rpcSlice->setNextSliceSegment ( false ); 2024 2025 rpcSlice->setSliceCurStartCUAddr(startCuAddress); 2026 rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); 2027 } 2028 2029 #if H_MV 2241 pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. 2242 pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs); // Set end as the last CTU of the picture. 2243 2244 #if NH_MV 2030 2245 UInt slicePicOrderCntLsb = 0; 2031 2246 #endif 2032 2247 2033 if(!rpcSlice->getDependentSliceSegmentFlag()) 2034 { 2035 #if H_MV 2248 2249 if (!pcSlice->getDependentSliceSegmentFlag()) 2250 { 2251 pcSlice->setSliceCurStartCtuTsAddr(sliceSegmentAddress); // this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. 2252 pcSlice->setSliceCurEndCtuTsAddr(numCTUs); 2253 } 2254 2255 if(!pcSlice->getDependentSliceSegmentFlag()) 2256 { 2257 #if NH_MV 2036 2258 Int esb = 0; //Don't use i, otherwise will shadow something below 2037 2259 2038 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )2260 if ( pps->getNumExtraSliceHeaderBits() > esb ) 2039 2261 { 2040 2262 esb++; 2041 READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );2263 READ_FLAG( uiCode, "discardable_flag" ); pcSlice->setDiscardableFlag( uiCode == 1 ); 2042 2264 if ( uiCode == 1 ) 2043 2265 { 2044 assert( rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R &&2045 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R &&2046 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R &&2047 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R &&2048 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R);2049 } 2050 } 2051 2052 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )2266 assert(pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R && 2267 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R && 2268 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R && 2269 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R && 2270 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R); 2271 } 2272 } 2273 2274 if ( pps->getNumExtraSliceHeaderBits() > esb ) 2053 2275 { 2054 2276 esb++; 2055 READ_FLAG( uiCode, "cross_layer_bla_flag" ); rpcSlice->setCrossLayerBlaFlag( uiCode == 1 );2056 } 2057 rpcSlice->checkCrossLayerBlaFlag( );2058 2059 2060 for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)2277 READ_FLAG( uiCode, "cross_layer_bla_flag" ); pcSlice->setCrossLayerBlaFlag( uiCode == 1 ); 2278 } 2279 pcSlice->checkCrossLayerBlaFlag( ); 2280 2281 2282 for (; esb < pps->getNumExtraSliceHeaderBits(); esb++) 2061 2283 #else 2062 for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)2063 #endif 2064 { 2065 READ_FLAG(uiCode, "slice_reserved_ undetermined_flag[]"); // ignored2066 } 2067 2068 READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode);2284 for (Int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) 2285 #endif 2286 { 2287 READ_FLAG(uiCode, "slice_reserved_flag[]"); // ignored 2288 } 2289 2290 READ_UVLC ( uiCode, "slice_type" ); pcSlice->setSliceType((SliceType)uiCode); 2069 2291 if( pps->getOutputFlagPresentFlag() ) 2070 2292 { 2071 READ_FLAG( uiCode, "pic_output_flag" ); rpcSlice->setPicOutputFlag( uiCode ? true : false );2293 READ_FLAG( uiCode, "pic_output_flag" ); pcSlice->setPicOutputFlag( uiCode ? true : false ); 2072 2294 } 2073 2295 else 2074 2296 { 2075 rpcSlice->setPicOutputFlag( true ); 2076 } 2077 // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present 2078 2079 #if H_3D_DISABLE_CHROMA 2080 assert (sps->getChromaFormatIdc() == 1 || rpcSlice->getIsDepth() ); 2081 assert (sps->getChromaFormatIdc() == 0 || !rpcSlice->getIsDepth() ); 2082 #else 2083 assert (sps->getChromaFormatIdc() == 1 ); 2084 #endif 2085 // if( separate_colour_plane_flag == 1 ) 2086 // colour_plane_id u(2) 2087 2088 2089 #if H_MV 2297 pcSlice->setPicOutputFlag( true ); 2298 } 2299 2300 // if (separate_colour_plane_flag == 1) 2301 // read colour_plane_id 2302 // (separate_colour_plane_flag == 1) is not supported in this version of the standard. 2303 2304 #if NH_MV 2090 2305 Int iPOClsb = slicePicOrderCntLsb; // Needed later 2091 if ( ( rpcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( rpcSlice->getLayerIdInVps())) || !rpcSlice->getIdrPicFlag() )2306 if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() ) 2092 2307 { 2093 2308 READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb"); 2094 2309 } 2095 rpcSlice->setSlicePicOrderCntLsb( slicePicOrderCntLsb );2310 pcSlice->setSlicePicOrderCntLsb( slicePicOrderCntLsb ); 2096 2311 2097 2312 Bool picOrderCntMSBZeroFlag = false; 2098 2313 2099 2314 // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered?? 2100 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP );2101 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL );2102 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP );2103 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || rpcSlice->getIdrPicFlag();2315 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ); 2316 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); 2317 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ); 2318 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || pcSlice->getIdrPicFlag(); 2104 2319 2105 2320 // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 && !rpcSlice->getFirstPicInLayerDecodedFlag() ); … … 2109 2324 if ( !picOrderCntMSBZeroFlag ) 2110 2325 { 2111 Int prevPicOrderCnt = rpcSlice->getPrevTid0POC();2326 Int prevPicOrderCnt = prevTid0POC; 2112 2327 Int maxPicOrderCntLsb = 1 << sps->getBitsForPOC(); 2113 2328 Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1); … … 2128 2343 } 2129 2344 2130 rpcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb );2131 if ( rpcSlice->getPocResetFlag() )2132 { 2133 rpcSlice->setPocBeforeReset ( rpcSlice->getPOC() );2134 rpcSlice->setPOC ( 0 );2345 pcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb ); 2346 if ( pcSlice->getPocResetFlag() ) 2347 { 2348 pcSlice->setPocBeforeReset ( pcSlice->getPOC() ); 2349 pcSlice->setPOC ( 0 ); 2135 2350 } 2136 2351 #endif 2137 2352 2138 if( rpcSlice->getIdrPicFlag() ) 2139 { 2140 #if !H_MV 2141 rpcSlice->setPOC(0); 2142 #endif 2143 TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); 2144 rps->setNumberOfNegativePictures(0); 2145 rps->setNumberOfPositivePictures(0); 2146 rps->setNumberOfLongtermPictures(0); 2147 rps->setNumberOfPictures(0); 2148 rpcSlice->setRPS(rps); 2149 #if H_MV 2150 rpcSlice->setEnableTMVPFlag(false); 2353 if( pcSlice->getIdrPicFlag() ) 2354 { 2355 #if !NH_MV 2356 pcSlice->setPOC(0); 2357 #endif 2358 TComReferencePictureSet* rps = pcSlice->getLocalRPS(); 2359 (*rps)=TComReferencePictureSet(); 2360 pcSlice->setRPS(rps); 2361 #if NH_MV 2362 pcSlice->setEnableTMVPFlag(false); 2151 2363 #endif 2152 2364 } 2153 2365 else 2154 2366 { 2155 #if ! H_MV2156 READ_CODE(sps->getBitsForPOC(), uiCode, " pic_order_cnt_lsb");2367 #if !NH_MV 2368 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); 2157 2369 Int iPOClsb = uiCode; 2158 Int iPrevPOC = rpcSlice->getPrevTid0POC();2370 Int iPrevPOC = prevTid0POC; 2159 2371 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 2160 2372 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); … … 2165 2377 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 2166 2378 } 2167 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2379 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2168 2380 { 2169 2381 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; … … 2173 2385 iPOCmsb = iPrevPOCmsb; 2174 2386 } 2175 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP2176 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL2177 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )2387 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2388 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2389 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2178 2390 { 2179 2391 // For BLA picture types, POCmsb is set to 0. 2180 2392 iPOCmsb = 0; 2181 2393 } 2182 rpcSlice->setPOC (iPOCmsb+iPOClsb);2394 pcSlice->setPOC (iPOCmsb+iPOClsb); 2183 2395 #endif 2184 2396 TComReferencePictureSet* rps; 2185 rps = rpcSlice->getLocalRPS(); 2186 rpcSlice->setRPS(rps); 2397 rps = pcSlice->getLocalRPS(); 2398 (*rps)=TComReferencePictureSet(); 2399 2400 pcSlice->setRPS(rps); 2187 2401 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2188 2402 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2189 { 2403 { 2190 2404 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2191 #if H_MV2405 #if NH_MV 2192 2406 if ( !rps->getInterRPSPrediction( ) ) 2193 2407 { // check sum of num_positive_pics and num_negative_pics … … 2195 2409 vps->getVpsExtensionFlag(), 2196 2410 MAX_INT, // To be replaced by MaxDbpSize 2197 rpcSlice->getLayerId(),2411 pcSlice->getLayerId(), 2198 2412 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2199 2413 } 2200 2414 #endif 2415 2201 2416 } 2202 2417 else // use reference to short-term reference picture set in PPS 2203 2418 { 2204 2419 Int numBits = 0; 2205 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets())2420 while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) 2206 2421 { 2207 2422 numBits++; … … 2214 2429 { 2215 2430 uiCode = 0; 2431 2216 2432 } 2217 2433 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); … … 2222 2438 UInt numOfLtrp = 0; 2223 2439 UInt numLtrpInSPS = 0; 2224 if ( rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0)2440 if (sps->getNumLongTermRefPicSPS() > 0) 2225 2441 { 2226 2442 READ_UVLC( uiCode, "num_long_term_sps"); … … 2230 2446 } 2231 2447 Int bitsForLtrpInSPS = 0; 2232 while ( rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS))2448 while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2233 2449 { 2234 2450 bitsForLtrpInSPS++; … … 2237 2453 numOfLtrp += uiCode; 2238 2454 rps->setNumberOfLongtermPictures(numOfLtrp); 2239 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC();2240 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; ;2455 Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); 2456 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; 2241 2457 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2242 2458 { … … 2249 2465 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2250 2466 } 2251 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode);2252 2253 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode);2467 Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode); 2468 2469 pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode); 2254 2470 rps->setUsed(j,usedByCurrFromSPS); 2255 2471 } 2256 2472 else 2257 2473 { 2258 READ_CODE( rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;2474 READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2259 2475 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2260 2476 } 2261 2477 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2262 2478 Bool mSBPresentFlag = uiCode ? true : false; 2263 if(mSBPresentFlag) 2479 if(mSBPresentFlag) 2264 2480 { 2265 2481 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); … … 2276 2492 else 2277 2493 { 2278 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2494 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2279 2495 } 2280 2496 2281 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB2497 Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2282 2498 - iPOClsb + pocLsbLt; 2283 rps->setPOC (j, pocLTCurr); 2284 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr);2285 rps->setCheckLTMSBPresent(j,true); 2499 rps->setPOC (j, pocLTCurr); 2500 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); 2501 rps->setCheckLTMSBPresent(j,true); 2286 2502 } 2287 2503 else 2288 2504 { 2289 2505 rps->setPOC (j, pocLsbLt); 2290 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);2291 rps->setCheckLTMSBPresent(j,false); 2292 2506 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt); 2507 rps->setCheckLTMSBPresent(j,false); 2508 2293 2509 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2294 2510 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) … … 2300 2516 } 2301 2517 offset += rps->getNumberOfLongtermPictures(); 2302 rps->setNumberOfPictures(offset); 2303 } 2304 #if H_MV2518 rps->setNumberOfPictures(offset); 2519 } 2520 #if NH_MV 2305 2521 if ( !rps->getInterRPSPrediction( ) ) 2306 2522 { // check sum of NumPositivePics, NumNegativePics, num_long_term_sps and num_long_term_pics … … 2308 2524 vps->getVpsExtensionFlag(), 2309 2525 MAX_INT, // To be replaced by MaxDbpsize 2310 rpcSlice->getLayerId(),2526 pcSlice->getLayerId(), 2311 2527 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2312 2528 } 2313 2529 #endif 2314 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2315 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2316 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2530 2531 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2532 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2533 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2317 2534 { 2318 2535 // In the case of BLA picture types, rps data is read from slice header but ignored 2319 rps = rpcSlice->getLocalRPS(); 2320 rps->setNumberOfNegativePictures(0); 2321 rps->setNumberOfPositivePictures(0); 2322 rps->setNumberOfLongtermPictures(0); 2323 rps->setNumberOfPictures(0); 2324 rpcSlice->setRPS(rps); 2325 } 2326 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 2327 { 2328 #if H_MV 2536 rps = pcSlice->getLocalRPS(); 2537 (*rps)=TComReferencePictureSet(); 2538 pcSlice->setRPS(rps); 2539 } 2540 if (sps->getTMVPFlagsPresent()) 2541 { 2542 #if NH_MV 2329 2543 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2330 2544 #else 2331 READ_FLAG( uiCode, "slice_temporal_mvp_enable _flag" );2332 #endif 2333 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false );2545 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2546 #endif 2547 pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2334 2548 } 2335 2549 else 2336 2550 { 2337 rpcSlice->setEnableTMVPFlag(false);2338 } 2339 } 2340 #if H_MV2551 pcSlice->setEnableTMVPFlag(false); 2552 } 2553 } 2554 #if NH_MV 2341 2555 Bool interLayerPredLayerIdcPresentFlag = false; 2342 Int layerId = rpcSlice->getLayerId();2343 #if H_3D2344 if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )2556 Int layerId = pcSlice->getLayerId(); 2557 #if NH_3D 2558 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 ) 2345 2559 #else 2346 if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )2560 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) 2347 2561 #endif 2348 2562 { 2349 READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );2350 #if H_3D2351 if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )2563 READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); pcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); 2564 #if NH_3D 2565 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 ) 2352 2566 #else 2353 if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )2567 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) 2354 2568 #endif 2355 2569 { 2356 2570 if( !vps->getMaxOneActiveRefLayerFlag()) 2357 2571 { 2358 READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode );2359 } 2360 #if H_3D2361 if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )2572 READ_CODE( pcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); pcSlice->setNumInterLayerRefPicsMinus1( uiCode ); 2573 } 2574 #if NH_3D 2575 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) ) 2362 2576 #else 2363 if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )2577 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) 2364 2578 #endif 2365 2579 { 2366 2580 interLayerPredLayerIdcPresentFlag = true; 2367 for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ )2581 for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ ) 2368 2582 { 2369 READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( idx, uiCode );2583 READ_CODE( pcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); pcSlice->setInterLayerPredLayerIdc( idx, uiCode ); 2370 2584 } 2371 2585 } … … 2374 2588 if ( !interLayerPredLayerIdcPresentFlag ) 2375 2589 { 2376 for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ )2377 { 2378 rpcSlice->setInterLayerPredLayerIdc( i, rpcSlice->getRefLayerPicIdc( i ) );2379 } 2380 } 2381 #if H_3D2590 for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ ) 2591 { 2592 pcSlice->setInterLayerPredLayerIdc( i, pcSlice->getRefLayerPicIdc( i ) ); 2593 } 2594 } 2595 #if NH_3D 2382 2596 if ( getDecTop()->decProcAnnexI() ) 2383 2597 { 2384 rpcSlice->deriveInCmpPredAndCpAvailFlag();2385 if ( rpcSlice->getInCmpPredAvailFlag() )2386 { 2387 READ_FLAG(uiCode, "in_comp_pred_flag"); rpcSlice->setInCompPredFlag((Bool)uiCode);2388 } 2389 rpcSlice->init3dToolParameters();2598 pcSlice->deriveInCmpPredAndCpAvailFlag( ); 2599 if ( pcSlice->getInCmpPredAvailFlag() ) 2600 { 2601 READ_FLAG(uiCode, "in_comp_pred_flag"); pcSlice->setInCompPredFlag((Bool)uiCode); 2602 } 2603 pcSlice->init3dToolParameters(); 2390 2604 } 2391 2605 #endif … … 2393 2607 if(sps->getUseSAO()) 2394 2608 { 2395 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 2396 #if H_3D_DISABLE_CHROMA 2397 if( rpcSlice->getSPS()->getChromaFormatIdc() != 0 ) 2398 { 2399 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 2400 } 2401 else 2402 { 2403 rpcSlice->setSaoEnabledFlagChroma( false ); 2404 } 2405 #else 2406 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 2407 #endif 2408 } 2409 2410 if (rpcSlice->getIdrPicFlag()) 2411 { 2412 rpcSlice->setEnableTMVPFlag(false); 2413 } 2414 if (!rpcSlice->isIntra()) 2609 READ_FLAG(uiCode, "slice_sao_luma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, (Bool)uiCode); 2610 2611 if (bChroma) 2612 { 2613 READ_FLAG(uiCode, "slice_sao_chroma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, (Bool)uiCode); 2614 } 2615 } 2616 2617 if (pcSlice->getIdrPicFlag()) 2618 { 2619 pcSlice->setEnableTMVPFlag(false); 2620 } 2621 if (!pcSlice->isIntra()) 2415 2622 { 2416 2623 … … 2418 2625 if (uiCode) 2419 2626 { 2420 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 );2421 if ( rpcSlice->isInterB())2422 { 2423 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 );2627 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 2628 if (pcSlice->isInterB()) 2629 { 2630 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 2424 2631 } 2425 2632 else 2426 2633 { 2427 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);2634 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 2428 2635 } 2429 2636 } 2430 2637 else 2431 2638 { 2432 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive());2433 if ( rpcSlice->isInterB())2434 { 2435 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive());2639 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pps->getNumRefIdxL0DefaultActive()); 2640 if (pcSlice->isInterB()) 2641 { 2642 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pps->getNumRefIdxL1DefaultActive()); 2436 2643 } 2437 2644 else 2438 2645 { 2439 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0);2646 pcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 2440 2647 } 2441 2648 } 2442 2649 } 2443 2650 // } 2444 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification();2445 if(! rpcSlice->isIntra())2446 { 2447 if( ! rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 )2651 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 2652 if(!pcSlice->isIntra()) 2653 { 2654 if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 ) 2448 2655 { 2449 2656 refPicListModification->setRefPicListModificationFlagL0( 0 ); … … 2455 2662 2456 2663 if(refPicListModification->getRefPicListModificationFlagL0()) 2457 { 2664 { 2458 2665 uiCode = 0; 2459 2666 Int i = 0; 2460 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList();2667 Int numRpsCurrTempList0 = pcSlice->getNumRpsCurrTempList(); 2461 2668 if ( numRpsCurrTempList0 > 1 ) 2462 2669 { 2463 2670 Int length = 1; 2464 2671 numRpsCurrTempList0 --; 2465 while ( numRpsCurrTempList0 >>= 1) 2672 while ( numRpsCurrTempList0 >>= 1) 2466 2673 { 2467 2674 length ++; 2468 2675 } 2469 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++)2676 for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 2470 2677 { 2471 2678 READ_CODE( length, uiCode, "list_entry_l0" ); … … 2475 2682 else 2476 2683 { 2477 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++)2684 for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 2478 2685 { 2479 2686 refPicListModification->setRefPicSetIdxL0(i, 0 ); … … 2486 2693 refPicListModification->setRefPicListModificationFlagL0(0); 2487 2694 } 2488 if( rpcSlice->isInterB())2489 { 2490 if( ! rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 )2695 if(pcSlice->isInterB()) 2696 { 2697 if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 ) 2491 2698 { 2492 2699 refPicListModification->setRefPicListModificationFlagL1( 0 ); … … 2500 2707 uiCode = 0; 2501 2708 Int i = 0; 2502 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList();2709 Int numRpsCurrTempList1 = pcSlice->getNumRpsCurrTempList(); 2503 2710 if ( numRpsCurrTempList1 > 1 ) 2504 2711 { 2505 2712 Int length = 1; 2506 2713 numRpsCurrTempList1 --; 2507 while ( numRpsCurrTempList1 >>= 1) 2714 while ( numRpsCurrTempList1 >>= 1) 2508 2715 { 2509 2716 length ++; 2510 2717 } 2511 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++)2718 for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 2512 2719 { 2513 2720 READ_CODE( length, uiCode, "list_entry_l1" ); … … 2517 2724 else 2518 2725 { 2519 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++)2726 for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 2520 2727 { 2521 2728 refPicListModification->setRefPicSetIdxL1(i, 0 ); … … 2523 2730 } 2524 2731 } 2525 } 2732 } 2526 2733 else 2527 2734 { 2528 2735 refPicListModification->setRefPicListModificationFlagL1(0); 2529 2736 } 2530 if ( rpcSlice->isInterB())2531 { 2532 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) );2533 } 2534 2535 rpcSlice->setCabacInitFlag( false ); // default2536 if(pps->getCabacInitPresentFlag() && ! rpcSlice->isIntra())2737 if (pcSlice->isInterB()) 2738 { 2739 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); pcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 2740 } 2741 2742 pcSlice->setCabacInitFlag( false ); // default 2743 if(pps->getCabacInitPresentFlag() && !pcSlice->isIntra()) 2537 2744 { 2538 2745 READ_FLAG(uiCode, "cabac_init_flag"); 2539 rpcSlice->setCabacInitFlag( uiCode ? true : false );2540 } 2541 2542 if ( rpcSlice->getEnableTMVPFlag() )2543 { 2544 if ( rpcSlice->getSliceType() == B_SLICE )2746 pcSlice->setCabacInitFlag( uiCode ? true : false ); 2747 } 2748 2749 if ( pcSlice->getEnableTMVPFlag() ) 2750 { 2751 if ( pcSlice->getSliceType() == B_SLICE ) 2545 2752 { 2546 2753 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 2547 rpcSlice->setColFromL0Flag(uiCode);2754 pcSlice->setColFromL0Flag(uiCode); 2548 2755 } 2549 2756 else 2550 2757 { 2551 rpcSlice->setColFromL0Flag( 1 );2552 } 2553 2554 if ( rpcSlice->getSliceType() != I_SLICE &&2555 (( rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)||2556 ( rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1)))2758 pcSlice->setColFromL0Flag( 1 ); 2759 } 2760 2761 if ( pcSlice->getSliceType() != I_SLICE && 2762 ((pcSlice->getColFromL0Flag() == 1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 2763 (pcSlice->getColFromL0Flag() == 0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 2557 2764 { 2558 2765 READ_UVLC( uiCode, "collocated_ref_idx" ); 2559 rpcSlice->setColRefIdx(uiCode);2766 pcSlice->setColRefIdx(uiCode); 2560 2767 } 2561 2768 else 2562 2769 { 2563 rpcSlice->setColRefIdx(0); 2564 } 2565 } 2566 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 2567 { 2568 xParsePredWeightTable(rpcSlice); 2569 rpcSlice->initWpScaling(); 2570 } 2571 #if H_3D_IC 2572 else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) 2573 && !rpcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 2770 pcSlice->setColRefIdx(0); 2771 } 2772 } 2773 if ( (pps->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) ) 2774 { 2775 xParsePredWeightTable(pcSlice, sps); 2776 pcSlice->initWpScaling(sps); 2777 } 2778 2779 #if NH_3D_IC 2780 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) 2781 && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 2574 2782 && getDecTop()->decProcAnnexI() 2575 2783 ) … … 2578 2786 2579 2787 READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" ); 2580 rpcSlice->setApplyIC( uiCodeTmp );2788 pcSlice->setApplyIC( uiCodeTmp ); 2581 2789 2582 2790 if ( uiCodeTmp ) 2583 2791 { 2584 READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" ); 2585 rpcSlice->setIcSkipParseFlag( uiCodeTmp ); 2586 } 2587 } 2588 #endif 2589 if (!rpcSlice->isIntra()) 2792 READ_FLAG ( uiCodeTmp, "slice_ic_disabled_merge_zero_idx_flag" ); 2793 pcSlice->setIcSkipParseFlag( uiCodeTmp ); 2794 } 2795 } 2796 #endif 2797 2798 if (!pcSlice->isIntra()) 2590 2799 { 2591 2800 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 2592 #if H_3D_IV_MERGE2593 rpcSlice->setMaxNumMergeCand(( ( rpcSlice->getMpiFlag() || rpcSlice->getIvMvPredFlag() || rpcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);2801 #if NH_3D_IV_MERGE 2802 pcSlice->setMaxNumMergeCand(( ( pcSlice->getMpiFlag() || pcSlice->getIvMvPredFlag() || pcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode); 2594 2803 #else 2595 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);2804 pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 2596 2805 #endif 2597 2806 } 2598 2807 2599 2808 READ_SVLC( iCode, "slice_qp_delta" ); 2600 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 2601 2602 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 2603 assert( rpcSlice->getSliceQp() <= 51 ); 2604 2605 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 2606 { 2607 READ_SVLC( iCode, "slice_qp_delta_cb" ); 2608 rpcSlice->setSliceQpDeltaCb( iCode ); 2609 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 2610 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 2611 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 2612 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 2613 2614 READ_SVLC( iCode, "slice_qp_delta_cr" ); 2615 rpcSlice->setSliceQpDeltaCr( iCode ); 2616 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 2617 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 2618 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 2619 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 2620 } 2621 2622 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 2623 { 2624 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 2625 { 2626 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 2809 pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 2810 2811 assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) ); 2812 assert( pcSlice->getSliceQp() <= 51 ); 2813 2814 if (pps->getSliceChromaQpFlag()) 2815 { 2816 if (numValidComp>COMPONENT_Cb) 2817 { 2818 READ_SVLC( iCode, "slice_cb_qp_offset" ); 2819 pcSlice->setSliceChromaQpDelta(COMPONENT_Cb, iCode ); 2820 assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) >= -12 ); 2821 assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) <= 12 ); 2822 assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) >= -12 ); 2823 assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) <= 12 ); 2824 } 2825 2826 if (numValidComp>COMPONENT_Cr) 2827 { 2828 READ_SVLC( iCode, "slice_cr_qp_offset" ); 2829 pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, iCode ); 2830 assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) >= -12 ); 2831 assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) <= 12 ); 2832 assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) >= -12 ); 2833 assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) <= 12 ); 2834 } 2835 } 2836 2837 if (pps->getPpsRangeExtension().getChromaQpOffsetListEnabledFlag()) 2838 { 2839 READ_FLAG(uiCode, "cu_chroma_qp_offset_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0); 2840 } 2841 else 2842 { 2843 pcSlice->setUseChromaQpAdj(false); 2844 } 2845 2846 if (pps->getDeblockingFilterControlPresentFlag()) 2847 { 2848 if(pps->getDeblockingFilterOverrideEnabledFlag()) 2849 { 2850 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); pcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 2627 2851 } 2628 2852 else 2629 { 2630 rpcSlice->setDeblockingFilterOverrideFlag(0);2631 } 2632 if( rpcSlice->getDeblockingFilterOverrideFlag())2633 { 2634 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0);2635 if(! rpcSlice->getDeblockingFilterDisable())2636 { 2637 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);2638 assert( rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 &&2639 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6);2640 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode);2641 assert( rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 &&2642 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6);2853 { 2854 pcSlice->setDeblockingFilterOverrideFlag(0); 2855 } 2856 if(pcSlice->getDeblockingFilterOverrideFlag()) 2857 { 2858 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 2859 if(!pcSlice->getDeblockingFilterDisable()) 2860 { 2861 READ_SVLC( iCode, "slice_beta_offset_div2" ); pcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 2862 assert(pcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 2863 pcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 2864 READ_SVLC( iCode, "slice_tc_offset_div2" ); pcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 2865 assert(pcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 2866 pcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 2643 2867 } 2644 2868 } 2645 2869 else 2646 2870 { 2647 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() );2648 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() );2649 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() );2871 pcSlice->setDeblockingFilterDisable ( pps->getPicDisableDeblockingFilterFlag() ); 2872 pcSlice->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() ); 2873 pcSlice->setDeblockingFilterTcOffsetDiv2 ( pps->getDeblockingFilterTcOffsetDiv2() ); 2650 2874 } 2651 2875 } 2652 2876 else 2653 { 2654 rpcSlice->setDeblockingFilterDisable ( false );2655 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );2656 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 );2657 } 2658 2659 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma());2660 Bool isDBFEnabled = (! rpcSlice->getDeblockingFilterDisable());2661 2662 if( rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))2877 { 2878 pcSlice->setDeblockingFilterDisable ( false ); 2879 pcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 2880 pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 2881 } 2882 2883 Bool isSAOEnabled = sps->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); 2884 Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); 2885 2886 if(pps->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 2663 2887 { 2664 2888 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); … … 2666 2890 else 2667 2891 { 2668 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0;2669 } 2670 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false);2671 2672 #if H_3D2892 uiCode = pps->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 2893 } 2894 pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 2895 2896 #if NH_3D 2673 2897 if ( getDecTop()->decProcAnnexI() ) 2674 2898 { 2675 Int voiInVps = vps->getVoiInVps( rpcSlice->getViewIndex() ); 2676 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !rpcSlice->getIsDepth() ) 2899 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 2900 #if NH_3D_FIX_TICKET_101 2901 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 2902 #else 2903 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() ) 2904 #endif 2677 2905 { 2678 2906 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ ) 2679 2907 { 2680 2908 Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m )); 2681 READ_SVLC( iCode, "cp_scale" ); rpcSlice->setCpScale ( jInVps, iCode );2682 READ_SVLC( iCode, "cp_off" ); rpcSlice->setCpOff ( jInVps, iCode );2683 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); rpcSlice->setCpInvScale( jInVps, iCode - rpcSlice->getCpScale ( jInVps ));2684 READ_SVLC( iCode, "cp_inv_off_plus_off" ); rpcSlice->setCpInvOff ( jInVps, iCode - rpcSlice->getCpOff ( jInVps ));2685 } 2686 } 2687 } 2688 #endif 2689 } 2690 2691 UInt *entryPointOffset = NULL; 2692 UInt numEntryPointOffsets, offsetLenMinus1;2909 READ_SVLC( iCode, "cp_scale" ); pcSlice->setCpScale ( jInVps, iCode ); 2910 READ_SVLC( iCode, "cp_off" ); pcSlice->setCpOff ( jInVps, iCode ); 2911 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); pcSlice->setCpInvScale( jInVps, iCode - pcSlice->getCpScale ( jInVps )); 2912 READ_SVLC( iCode, "cp_inv_off_plus_off" ); pcSlice->setCpInvOff ( jInVps, iCode - pcSlice->getCpOff ( jInVps )); 2913 } 2914 } 2915 } 2916 #endif 2917 2918 } 2919 2920 std::vector<UInt> entryPointOffset; 2693 2921 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 2694 2922 { 2695 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 2923 UInt numEntryPointOffsets; 2924 UInt offsetLenMinus1; 2925 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); 2696 2926 if (numEntryPointOffsets>0) 2697 2927 { 2698 2928 READ_UVLC(offsetLenMinus1, "offset_len_minus1"); 2699 } 2700 entryPointOffset = new UInt[numEntryPointOffsets]; 2701 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 2702 { 2703 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 2704 entryPointOffset[ idx ] = uiCode + 1; 2705 } 2706 } 2707 else 2708 { 2709 rpcSlice->setNumEntryPointOffsets ( 0 ); 2710 } 2711 2929 entryPointOffset.resize(numEntryPointOffsets); 2930 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 2931 { 2932 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 2933 entryPointOffset[ idx ] = uiCode + 1; 2934 } 2935 } 2936 } 2712 2937 2713 2938 if(pps->getSliceHeaderExtensionPresentFlag()) 2714 2939 { 2715 #if H_MV2716 READ_UVLC( uiCode, "slice_segment_header_extension_length" ); rpcSlice->setSliceSegmentHeaderExtensionLength( uiCode );2940 #if NH_MV 2941 READ_UVLC( uiCode, "slice_segment_header_extension_length" ); pcSlice->setSliceSegmentHeaderExtensionLength( uiCode ); 2717 2942 UInt posFollSliceSegHeaderExtLen = m_pcBitstream->getNumBitsRead(); 2718 2943 2719 if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() )2720 { 2721 READ_CODE( 2, uiCode, "poc_reset_idc" ); rpcSlice->setPocResetIdc( uiCode );2944 if( pps->getPocResetInfoPresentFlag() ) 2945 { 2946 READ_CODE( 2, uiCode, "poc_reset_idc" ); pcSlice->setPocResetIdc( uiCode ); 2722 2947 } 2723 2948 else 2724 2949 { 2725 rpcSlice->setPocResetIdc( 0 );2726 } 2727 rpcSlice->checkPocResetIdc();2728 2729 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && slicePicOrderCntLsb > 0 )2730 { 2731 assert( rpcSlice->getPocResetIdc() != 2 );2732 } 2733 2734 if( rpcSlice->getPocResetIdc() != 0 )2735 { 2736 READ_CODE( 6, uiCode, "poc_reset_period_id" ); rpcSlice->setPocResetPeriodId( uiCode );2950 pcSlice->setPocResetIdc( 0 ); 2951 } 2952 pcSlice->checkPocResetIdc(); 2953 2954 if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && slicePicOrderCntLsb > 0 ) 2955 { 2956 assert( pcSlice->getPocResetIdc() != 2 ); 2957 } 2958 2959 if( pcSlice->getPocResetIdc() != 0 ) 2960 { 2961 READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); 2737 2962 } 2738 2963 else 2739 2964 { 2740 2965 // TODO Copy poc_reset_period from earlier picture 2741 rpcSlice->setPocResetPeriodId( 0 );2966 pcSlice->setPocResetPeriodId( 0 ); 2742 2967 } 2743 2968 2744 if( rpcSlice->getPocResetIdc() == 3 )2745 { 2746 READ_FLAG( uiCode, "full_poc_reset_flag" ); rpcSlice->setFullPocResetFlag( uiCode == 1 );2747 READ_CODE( rpcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); rpcSlice->setPocLsbVal( uiCode );2969 if( pcSlice->getPocResetIdc() == 3 ) 2970 { 2971 READ_FLAG( uiCode, "full_poc_reset_flag" ); pcSlice->setFullPocResetFlag( uiCode == 1 ); 2972 READ_CODE( pcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); pcSlice->setPocLsbVal( uiCode ); 2748 2973 } 2749 rpcSlice->checkPocLsbVal();2974 pcSlice->checkPocLsbVal(); 2750 2975 2751 2976 // Derive the value of PocMs8bValRequiredFlag 2752 2977 2753 if( ! rpcSlice->getPocMsbValRequiredFlag() && rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() )2754 { 2755 READ_FLAG( uiCode, "poc_msb_val_present_flag" ); rpcSlice->setPocMsbValPresentFlag( uiCode == 1 );2978 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 2979 { 2980 READ_FLAG( uiCode, "poc_msb_val_present_flag" ); pcSlice->setPocMsbValPresentFlag( uiCode == 1 ); 2756 2981 } 2757 2982 else 2758 2983 { 2759 rpcSlice->setPocMsbValPresentFlag( rpcSlice->inferPocMsbValPresentFlag( ) );2984 pcSlice->setPocMsbValPresentFlag( pcSlice->inferPocMsbValPresentFlag( ) ); 2760 2985 } 2761 2986 2762 2987 2763 if( rpcSlice->getPocMsbValPresentFlag() )2764 { 2765 READ_UVLC( uiCode, "poc_msb_val" ); rpcSlice->setPocMsbVal( uiCode );2766 } 2767 2768 while( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) < rpcSlice->getSliceSegmentHeaderExtensionLength() * 8 )2988 if( pcSlice->getPocMsbValPresentFlag() ) 2989 { 2990 READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbVal( uiCode ); 2991 } 2992 2993 while( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) < pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ) 2769 2994 { 2770 2995 READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); 2771 2996 } 2772 assert( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) == rpcSlice->getSliceSegmentHeaderExtensionLength() * 8 );2997 assert( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) == pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ); 2773 2998 } 2774 2999 #else 2775 READ_UVLC( uiCode, "slice_header_extension_length" ); 3000 3001 READ_UVLC(uiCode,"slice_segment_header_extension_length"); 2776 3002 for(Int i=0; i<uiCode; i++) 2777 3003 { 2778 3004 UInt ignore; 2779 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 2780 } 2781 } 2782 #endif 3005 READ_CODE(8,ignore,"slice_segment_header_extension_data_byte"); 3006 } 3007 } 3008 #endif 3009 #if RExt__DECODER_DEBUG_BIT_STATISTICS 3010 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,m_pcBitstream->readByteAlignment(),0); 3011 #else 2783 3012 m_pcBitstream->readByteAlignment(); 3013 #endif 3014 3015 pcSlice->clearSubstreamSizes(); 2784 3016 2785 3017 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 2786 3018 { 2787 3019 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 2788 3020 2789 3021 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 2790 3022 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) … … 2798 3030 Int curEntryPointOffset = 0; 2799 3031 Int prevEntryPointOffset = 0; 2800 for (UInt idx=0; idx< numEntryPointOffsets; idx++)3032 for (UInt idx=0; idx<entryPointOffset.size(); idx++) 2801 3033 { 2802 3034 curEntryPointOffset += entryPointOffset[ idx ]; … … 2805 3037 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 2806 3038 { 2807 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 3039 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 2808 3040 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 2809 3041 { … … 2814 3046 entryPointOffset[ idx ] -= emulationPreventionByteCount; 2815 3047 prevEntryPointOffset = curEntryPointOffset; 2816 } 2817 2818 if ( pps->getTilesEnabledFlag() ) 2819 { 2820 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 2821 2822 UInt prevPos = 0; 2823 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 2824 { 2825 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 2826 prevPos += entryPointOffset[ idx ]; 2827 } 2828 } 2829 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 2830 { 2831 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 2832 rpcSlice->allocSubstreamSizes(numSubstreams); 2833 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 2834 for (Int idx=0; idx<numSubstreams-1; idx++) 2835 { 2836 if ( idx < numEntryPointOffsets ) 2837 { 2838 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 2839 } 2840 else 2841 { 2842 pSubstreamSizes[ idx ] = 0; 2843 } 2844 } 2845 } 2846 2847 if (entryPointOffset) 2848 { 2849 delete [] entryPointOffset; 3048 pcSlice->addSubstreamSize(entryPointOffset [ idx ] ); 2850 3049 } 2851 3050 } … … 2853 3052 return; 2854 3053 } 2855 3054 2856 3055 Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) 2857 3056 { … … 2859 3058 if(profilePresentFlag) 2860 3059 { 2861 parseProfileTier(rpcPTL->getGeneralPTL() );2862 } 2863 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc( uiCode);3060 parseProfileTier(rpcPTL->getGeneralPTL(), false); 3061 } 3062 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(Level::Name(uiCode)); 2864 3063 2865 3064 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 2866 3065 { 2867 #if !H_MV 2868 if(profilePresentFlag) 2869 { 2870 #endif 2871 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); 2872 #if H_MV 2873 // When profilePresentFlag is equal to 0, sub_layer_profile_present_flag[ i ] shall be equal to 0. 2874 assert( profilePresentFlag || !rpcPTL->getSubLayerProfilePresentFlag(i) ); 2875 #else 2876 } 2877 #endif 3066 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); 2878 3067 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); 2879 } 2880 3068 #if NH_MV 3069 // When profilePresentFlag is equal to 0, sub_layer_profile_present_flag[ i ] shall be equal to 0. 3070 assert( profilePresentFlag || !rpcPTL->getSubLayerProfilePresentFlag(i) ); 3071 #endif 3072 } 3073 2881 3074 if (maxNumSubLayersMinus1 > 0) 2882 3075 { … … 2887 3080 } 2888 3081 } 2889 3082 2890 3083 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 2891 3084 { 2892 #if H_MV2893 3085 if( rpcPTL->getSubLayerProfilePresentFlag(i) ) 3086 { 3087 parseProfileTier(rpcPTL->getSubLayerPTL(i), true); 3088 } 3089 if(rpcPTL->getSubLayerLevelPresentFlag(i)) 3090 { 3091 READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(Level::Name(uiCode)); 3092 } 3093 } 3094 } 3095 3096 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 3097 Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl, const Bool bIsSubLayer) 3098 #define PTL_TRACE_TEXT(txt) bIsSubLayer?("sub_layer_" txt) : ("general_" txt) 2894 3099 #else 2895 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 2896 #endif 2897 { 2898 parseProfileTier(rpcPTL->getSubLayerPTL(i)); 2899 } 2900 if(rpcPTL->getSubLayerLevelPresentFlag(i)) 2901 { 2902 READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(uiCode); 2903 } 2904 } 2905 } 2906 2907 Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl) 3100 Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl, const Bool /*bIsSubLayer*/) 3101 #define PTL_TRACE_TEXT(txt) txt 3102 #endif 2908 3103 { 2909 3104 UInt uiCode; 2910 READ_CODE(2 , uiCode, "XXX_profile_space[]");ptl->setProfileSpace(uiCode);2911 READ_FLAG( uiCode, "XXX_tier_flag[]" ); ptl->setTierFlag (uiCode ? 1 : 0);2912 READ_CODE(5 , uiCode, "XXX_profile_idc[]" ); ptl->setProfileIdc (uiCode);3105 READ_CODE(2 , uiCode, PTL_TRACE_TEXT("profile_space" )); ptl->setProfileSpace(uiCode); 3106 READ_FLAG( uiCode, PTL_TRACE_TEXT("tier_flag" )); ptl->setTierFlag (uiCode ? Level::HIGH : Level::MAIN); 3107 READ_CODE(5 , uiCode, PTL_TRACE_TEXT("profile_idc" )); ptl->setProfileIdc (Profile::Name(uiCode)); 2913 3108 for(Int j = 0; j < 32; j++) 2914 3109 { 2915 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 2916 } 2917 READ_FLAG(uiCode, "general_progressive_source_flag"); 2918 ptl->setProgressiveSourceFlag(uiCode ? true : false); 2919 2920 READ_FLAG(uiCode, "general_interlaced_source_flag"); 2921 ptl->setInterlacedSourceFlag(uiCode ? true : false); 2922 2923 READ_FLAG(uiCode, "general_non_packed_constraint_flag"); 2924 ptl->setNonPackedConstraintFlag(uiCode ? true : false); 2925 2926 READ_FLAG(uiCode, "general_frame_only_constraint_flag"); 2927 ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); 2928 2929 #if H_MV 3110 READ_FLAG( uiCode, PTL_TRACE_TEXT("profile_compatibility_flag[][j]" )); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 3111 } 3112 READ_FLAG(uiCode, PTL_TRACE_TEXT("progressive_source_flag" )); ptl->setProgressiveSourceFlag(uiCode ? true : false); 3113 3114 READ_FLAG(uiCode, PTL_TRACE_TEXT("interlaced_source_flag" )); ptl->setInterlacedSourceFlag(uiCode ? true : false); 3115 3116 READ_FLAG(uiCode, PTL_TRACE_TEXT("non_packed_constraint_flag" )); ptl->setNonPackedConstraintFlag(uiCode ? true : false); 3117 3118 READ_FLAG(uiCode, PTL_TRACE_TEXT("frame_only_constraint_flag" )); ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); 3119 #if NH_MV 2930 3120 if( ptl->getV2ConstraintsPresentFlag() ) 2931 3121 { … … 2958 3148 } 2959 3149 #else 2960 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); 2961 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 2962 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 3150 3151 if (ptl->getProfileIdc() == Profile::MAINREXT || ptl->getProfileCompatibilityFlag(Profile::MAINREXT) || 3152 ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT || ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT)) 3153 { 3154 UInt maxBitDepth=16; 3155 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_12bit_constraint_flag" )); if (uiCode) maxBitDepth=12; 3156 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_10bit_constraint_flag" )); if (uiCode) maxBitDepth=10; 3157 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_8bit_constraint_flag" )); if (uiCode) maxBitDepth=8; 3158 ptl->setBitDepthConstraint(maxBitDepth); 3159 ChromaFormat chromaFmtConstraint=CHROMA_444; 3160 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_422chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_422; 3161 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_420chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_420; 3162 READ_FLAG( uiCode, PTL_TRACE_TEXT("max_monochrome_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_400; 3163 ptl->setChromaFormatConstraint(chromaFmtConstraint); 3164 READ_FLAG( uiCode, PTL_TRACE_TEXT("intra_constraint_flag" )); ptl->setIntraConstraintFlag(uiCode != 0); 3165 READ_FLAG( uiCode, PTL_TRACE_TEXT("one_picture_only_constraint_flag")); ptl->setOnePictureOnlyConstraintFlag(uiCode != 0); 3166 READ_FLAG( uiCode, PTL_TRACE_TEXT("lower_bit_rate_constraint_flag" )); ptl->setLowerBitRateConstraintFlag(uiCode != 0); 3167 READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[0..15]" )); 3168 READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[16..31]" )); 3169 READ_CODE(2, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[32..33]" )); 3170 } 3171 else 3172 { 3173 ptl->setBitDepthConstraint((ptl->getProfileIdc() == Profile::MAIN10)?10:8); 3174 ptl->setChromaFormatConstraint(CHROMA_420); 3175 ptl->setIntraConstraintFlag(false); 3176 ptl->setLowerBitRateConstraintFlag(true); 3177 READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[0..15]" )); 3178 READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[16..31]" )); 3179 READ_CODE(11, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[32..42]" )); 3180 } 3181 3182 if ((ptl->getProfileIdc() >= Profile::MAIN && ptl->getProfileIdc() <= Profile::HIGHTHROUGHPUTREXT) || 3183 ptl->getProfileCompatibilityFlag(Profile::MAIN) || 3184 ptl->getProfileCompatibilityFlag(Profile::MAIN10) || 3185 ptl->getProfileCompatibilityFlag(Profile::MAINSTILLPICTURE) || 3186 ptl->getProfileCompatibilityFlag(Profile::MAINREXT) || 3187 ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT) ) 3188 { 3189 READ_FLAG( uiCode, PTL_TRACE_TEXT("inbld_flag" )); assert(uiCode == 0); 3190 } 3191 else 3192 { 3193 READ_FLAG( uiCode, PTL_TRACE_TEXT("reserved_zero_bit" )); 3194 } 3195 #undef PTL_TRACE_TEXT 2963 3196 #endif 2964 3197 } … … 2978 3211 } 2979 3212 3213 Void TDecCavlc::parseRemainingBytes( Bool noTrailingBytesExpected ) 3214 { 3215 if (noTrailingBytesExpected) 3216 { 3217 const UInt numberOfRemainingSubstreamBytes=m_pcBitstream->getNumBitsLeft(); 3218 assert (numberOfRemainingSubstreamBytes == 0); 3219 } 3220 else 3221 { 3222 while (m_pcBitstream->getNumBitsLeft()) 3223 { 3224 UInt trailingNullByte=m_pcBitstream->readByte(); 3225 if (trailingNullByte!=0) 3226 { 3227 printf("Trailing byte should be 0, but has value %02x\n", trailingNullByte); 3228 assert(trailingNullByte==0); 3229 } 3230 } 3231 } 3232 } 3233 3234 #if NH_3D_DIS 3235 Void TDecCavlc::parseDIS( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3236 { 3237 assert(0); 3238 } 3239 #endif 3240 2980 3241 Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2981 3242 { 2982 3243 assert(0); 2983 3244 } 2984 #if H_3D 2985 Void TDecCavlc::parse DIS( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3245 3246 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2986 3247 { 2987 3248 assert(0); 2988 3249 } 2989 #endif 2990 2991 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3250 3251 Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) 2992 3252 { 2993 3253 assert(0); 2994 3254 } 2995 3255 2996 Void TDecCavlc::parse MVPIdx( Int& /*riMVPIdx*/ )3256 Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2997 3257 { 2998 3258 assert(0); 2999 3259 } 3000 3260 3001 Void TDecCavlc::parse SplitFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3261 Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3002 3262 { 3003 3263 assert(0); 3004 3264 } 3005 3265 3006 Void TDecCavlc::parseP artSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3266 Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3007 3267 { 3008 3268 assert(0); 3009 3269 } 3010 3270 3011 Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3012 { 3013 assert(0); 3014 } 3015 3016 /** Parse I_PCM information. 3271 /** Parse I_PCM information. 3017 3272 * \param pcCU pointer to CU 3018 3273 * \param uiAbsPartIdx CU index … … 3020 3275 * \returns Void 3021 3276 * 3022 * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. 3277 * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. 3023 3278 */ 3024 3279 Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) … … 3028 3283 3029 3284 Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3030 { 3285 { 3031 3286 assert(0); 3032 3287 } … … 3052 3307 } 3053 3308 3309 Void TDecCavlc::parseCrossComponentPrediction( class TComTU& /*rTu*/, ComponentID /*compID*/ ) 3310 { 3311 assert(0); 3312 } 3313 3054 3314 Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3055 3315 { 3056 Int qp;3057 3316 Int iDQp; 3058 3317 3318 #if RExt__DECODER_DEBUG_BIT_STATISTICS 3319 READ_SVLC(iDQp, "delta_qp"); 3320 #else 3059 3321 xReadSvlc( iDQp ); 3060 3061 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 3062 qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; 3063 3064 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ; 3065 UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 3322 #endif 3323 3324 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); 3325 const Int qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; 3326 3327 const UInt maxCUDepth = pcCU->getSlice()->getSPS()->getMaxTotalCUDepth(); 3328 const UInt maxCuDQPDepth = pcCU->getSlice()->getPPS()->getMaxCuDQPDepth(); 3329 const UInt doubleDepthDifference = ((maxCUDepth - maxCuDQPDepth)<<1); 3330 const UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>doubleDepthDifference)<<doubleDepthDifference ; 3331 const UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 3066 3332 3067 3333 pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); 3068 3334 } 3069 3335 3070 Void TDecCavlc::parseC oeffNxN( TComDataCU* /*pcCU*/, TCoeff* /*pcCoef*/, UInt /*uiAbsPartIdx*/, UInt /*uiWidth*/, UInt /*uiHeight*/, UInt /*uiDepth*/, TextType /*eTType*/ )3336 Void TDecCavlc::parseChromaQpAdjustment( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3071 3337 { 3072 3338 assert(0); 3073 3339 } 3074 3340 3341 Void TDecCavlc::parseCoeffNxN( TComTU &/*rTu*/, ComponentID /*compID*/ ) 3342 { 3343 assert(0); 3344 } 3345 3075 3346 Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) 3076 3347 { … … 3078 3349 } 3079 3350 3080 Void TDecCavlc::parseQtCbf( TCom DataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, TextType /*eType*/, UInt /*uiTrDepth*/, UInt /*uiDepth*/ )3351 Void TDecCavlc::parseQtCbf( TComTU &/*rTu*/, const ComponentID /*compID*/, const Bool /*lowestLevel*/ ) 3081 3352 { 3082 3353 assert(0); … … 3088 3359 } 3089 3360 3090 Void TDecCavlc::parseTransformSkipFlags (TCom DataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*width*/, UInt /*height*/, UInt /*uiDepth*/, TextType /*eTType*/)3361 Void TDecCavlc::parseTransformSkipFlags (TComTU &/*rTu*/, ComponentID /*component*/) 3091 3362 { 3092 3363 assert(0); … … 3103 3374 } 3104 3375 3105 #if H_3D_ARP3376 #if NH_3D_ARP 3106 3377 Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3107 3378 { … … 3109 3380 } 3110 3381 #endif 3111 #if H_3D_IC3382 #if NH_3D_IC 3112 3383 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3113 3384 { … … 3115 3386 } 3116 3387 #endif 3117 #if H_3D_INTER_SDC3118 Void TDecCavlc::parse DeltaDC( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/)3119 { 3388 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 3389 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3390 { 3120 3391 assert(0); 3121 3392 } 3122 3393 3123 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3124 { 3125 assert(0); 3126 } 3127 3128 #endif 3129 #if H_3D_DBBP 3394 #endif 3395 #if NH_3D_DBBP 3130 3396 Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 3131 3397 { … … 3137 3403 // ==================================================================================================================== 3138 3404 3139 /** parse explicit wp tables 3140 * \param TComSlice* pcSlice 3141 * \returns Void 3142 */ 3143 Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice ) 3144 { 3145 wpScalingParam *wp; 3146 #if H_3D_DISABLE_CHROMA 3147 Bool bChroma = ( pcSlice->getSPS()->getChromaFormatIdc() != 0 ); 3148 #else 3149 Bool bChroma = true; // color always present in HEVC ? 3150 #endif 3151 SliceType eSliceType = pcSlice->getSliceType(); 3152 Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); 3153 UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; 3154 UInt uiTotalSignalledWeightFlags = 0; 3405 //! parse explicit wp tables 3406 Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice, const TComSPS *sps ) 3407 { 3408 WPScalingParam *wp; 3409 const ChromaFormat chFmt = sps->getChromaFormatIdc(); 3410 const Int numValidComp = Int(getNumberValidComponents(chFmt)); 3411 const Bool bChroma = (chFmt!=CHROMA_400); 3412 const SliceType eSliceType = pcSlice->getSliceType(); 3413 const Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); 3414 UInt uiLog2WeightDenomLuma=0, uiLog2WeightDenomChroma=0; 3415 UInt uiTotalSignalledWeightFlags = 0; 3155 3416 3156 3417 Int iDeltaDenom; 3157 3418 // decode delta_luma_log2_weight_denom : 3158 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom3419 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); 3159 3420 assert( uiLog2WeightDenomLuma <= 7 ); 3160 if( bChroma ) 3161 { 3162 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom3421 if( bChroma ) 3422 { 3423 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); 3163 3424 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 3164 3425 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 3165 3426 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 3166 3427 } 3167 else 3168 { 3169 // For some reasons this is also needed to fix a compiler warning when H_3D_DISABLE_CHROMA is equal to 0. 3170 uiLog2WeightDenomChroma = 0; 3171 } 3172 3173 3174 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) 3428 3429 3430 3431 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) // loop over l0 and l1 syntax elements 3175 3432 { 3176 3433 RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3177 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3434 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3178 3435 { 3179 3436 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 3180 3437 3181 wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; 3182 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3183 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3438 wp[COMPONENT_Y].uiLog2WeightDenom = uiLog2WeightDenomLuma; 3439 for(Int j=1; j<numValidComp; j++) 3440 { 3441 wp[j].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3442 } 3184 3443 3185 3444 UInt uiCode; 3186 READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag3187 wp[ 0].bPresentFlag = ( uiCode == 1 );3188 uiTotalSignalledWeightFlags += wp[ 0].bPresentFlag;3189 } 3190 if ( bChroma ) 3445 READ_FLAG( uiCode, iNumRef==0?"luma_weight_l0_flag[i]":"luma_weight_l1_flag[i]" ); 3446 wp[COMPONENT_Y].bPresentFlag = ( uiCode == 1 ); 3447 uiTotalSignalledWeightFlags += wp[COMPONENT_Y].bPresentFlag; 3448 } 3449 if ( bChroma ) 3191 3450 { 3192 3451 UInt uiCode; 3193 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3452 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3194 3453 { 3195 3454 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 3196 READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag 3197 wp[1].bPresentFlag = ( uiCode == 1 ); 3198 wp[2].bPresentFlag = ( uiCode == 1 ); 3199 uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; 3200 } 3201 } 3202 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3455 READ_FLAG( uiCode, iNumRef==0?"chroma_weight_l0_flag[i]":"chroma_weight_l1_flag[i]" ); 3456 for(Int j=1; j<numValidComp; j++) 3457 { 3458 wp[j].bPresentFlag = ( uiCode == 1 ); 3459 } 3460 uiTotalSignalledWeightFlags += 2*wp[COMPONENT_Cb].bPresentFlag; 3461 } 3462 } 3463 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 3203 3464 { 3204 3465 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 3205 if ( wp[ 0].bPresentFlag )3466 if ( wp[COMPONENT_Y].bPresentFlag ) 3206 3467 { 3207 3468 Int iDeltaWeight; 3208 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i]3469 READ_SVLC( iDeltaWeight, iNumRef==0?"delta_luma_weight_l0[i]":"delta_luma_weight_l1[i]" ); 3209 3470 assert( iDeltaWeight >= -128 ); 3210 3471 assert( iDeltaWeight <= 127 ); 3211 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 3212 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 3213 assert( wp[0].iOffset >= -128 ); 3214 assert( wp[0].iOffset <= 127 ); 3215 } 3216 else 3217 { 3218 wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); 3219 wp[0].iOffset = 0; 3220 } 3221 if ( bChroma ) 3222 { 3223 if ( wp[1].bPresentFlag ) 3224 { 3225 for ( Int j=1 ; j<3 ; j++ ) 3472 wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom)); 3473 READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" ); 3474 Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128; 3475 assert( wp[0].iOffset >= -range ); 3476 assert( wp[0].iOffset < range ); 3477 } 3478 else 3479 { 3480 wp[COMPONENT_Y].iWeight = (1 << wp[COMPONENT_Y].uiLog2WeightDenom); 3481 wp[COMPONENT_Y].iOffset = 0; 3482 } 3483 if ( bChroma ) 3484 { 3485 if ( wp[COMPONENT_Cb].bPresentFlag ) 3486 { 3487 Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; 3488 for ( Int j=1 ; j<numValidComp ; j++ ) 3226 3489 { 3227 3490 Int iDeltaWeight; 3228 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j]3491 READ_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" ); 3229 3492 assert( iDeltaWeight >= -128 ); 3230 3493 assert( iDeltaWeight <= 127 ); 3231 wp[j].iWeight = (iDeltaWeight + (1<<wp[ 1].uiLog2WeightDenom));3494 wp[j].iWeight = (iDeltaWeight + (1<<wp[j].uiLog2WeightDenom)); 3232 3495 3233 3496 Int iDeltaChroma; 3234 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j]3235 assert( iDeltaChroma >= - 512);3236 assert( iDeltaChroma < = 511);3237 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );3238 wp[j].iOffset = Clip3(- 128, 127, (iDeltaChroma + pred) );3497 READ_SVLC( iDeltaChroma, iNumRef==0?"delta_chroma_offset_l0[i]":"delta_chroma_offset_l1[i]" ); 3498 assert( iDeltaChroma >= -4*range); 3499 assert( iDeltaChroma < 4*range); 3500 Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 3501 wp[j].iOffset = Clip3(-range, range-1, (iDeltaChroma + pred) ); 3239 3502 } 3240 3503 } 3241 else 3242 { 3243 for ( Int j=1 ; j< 3 ; j++ )3504 else 3505 { 3506 for ( Int j=1 ; j<numValidComp ; j++ ) 3244 3507 { 3245 3508 wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); … … 3250 3513 } 3251 3514 3252 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 3515 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 3253 3516 { 3254 3517 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); … … 3272 3535 for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 3273 3536 { 3274 for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) 3275 { 3276 READ_FLAG( code, "scaling_list_pred_mode_flag"); 3277 scalingListPredModeFlag = (code) ? true : false; 3278 if(!scalingListPredModeFlag) //Copy Mode 3279 { 3280 READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); 3281 scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); 3282 if( sizeId > SCALING_LIST_8x8 ) 3283 { 3284 scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); 3285 } 3286 scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); 3287 3288 } 3289 else //DPCM Mode 3290 { 3291 xDecodeScalingList(scalingList, sizeId, listId); 3537 for(listId = 0; listId < SCALING_LIST_NUM; listId++) 3538 { 3539 if ((sizeId==SCALING_LIST_32x32) && (listId%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) 3540 { 3541 Int *src = scalingList->getScalingListAddress(sizeId, listId); 3542 const Int size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); 3543 const Int *srcNextSmallerSize = scalingList->getScalingListAddress(sizeId-1, listId); 3544 for(Int i=0; i<size; i++) 3545 { 3546 src[i] = srcNextSmallerSize[i]; 3547 } 3548 scalingList->setScalingListDC(sizeId,listId,(sizeId > SCALING_LIST_8x8) ? scalingList->getScalingListDC(sizeId-1, listId) : src[0]); 3549 } 3550 else 3551 { 3552 READ_FLAG( code, "scaling_list_pred_mode_flag"); 3553 scalingListPredModeFlag = (code) ? true : false; 3554 scalingList->setScalingListPredModeFlag(sizeId, listId, scalingListPredModeFlag); 3555 if(!scalingListPredModeFlag) //Copy Mode 3556 { 3557 READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); 3558 3559 if (sizeId==SCALING_LIST_32x32) 3560 { 3561 code*=(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES); // Adjust the decoded code for this size, to cope with the missing 32x32 chroma entries. 3562 } 3563 3564 scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); 3565 if( sizeId > SCALING_LIST_8x8 ) 3566 { 3567 scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); 3568 } 3569 scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); 3570 3571 } 3572 else //DPCM Mode 3573 { 3574 xDecodeScalingList(scalingList, sizeId, listId); 3575 } 3292 3576 } 3293 3577 } … … 3307 3591 Int scalingListDcCoefMinus8 = 0; 3308 3592 Int nextCoef = SCALING_LIST_START_VALUE; 3309 UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32;3593 UInt* scan = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][sizeId==0 ? 2 : 3][sizeId==0 ? 2 : 3]; 3310 3594 Int *dst = scalingList->getScalingListAddress(sizeId, listId); 3311 3595 … … 3326 3610 3327 3611 Bool TDecCavlc::xMoreRbspData() 3328 { 3612 { 3329 3613 Int bitsLeft = m_pcBitstream->getNumBitsLeft(); 3330 3614 … … 3354 3638 } 3355 3639 3640 Void TDecCavlc::parseExplicitRdpcmMode( TComTU& /*rTu*/, ComponentID /*compID*/ ) 3641 { 3642 assert(0); 3643 } 3356 3644 //! \} 3357 3645
Note: See TracChangeset for help on using the changeset viewer.