Changeset 622 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
- Timestamp:
- 11 Sep 2013, 14:40:25 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r608 r622 330 330 } 331 331 } 332 #if H_MV5 333 #if H_MV 334 if ( pcPPS->getLayerId() > 0 ) 335 { 336 READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 ); 337 } 338 339 if( pcPPS->getPpsInferScalingListFlag( ) ) 340 { 341 READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode ); 342 } 343 else 344 { 345 #endif 346 #endif 332 347 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); 333 348 if(pcPPS->getScalingListPresentFlag ()) … … 335 350 parseScalingList( pcPPS->getScalingList() ); 336 351 } 352 #if H_MV5 353 #if H_MV 354 } 355 #endif 356 #endif 337 357 338 358 READ_FLAG( uiCode, "lists_modification_present_flag"); … … 410 430 { 411 431 Window &defDisp = pcVUI->getDefaultDisplayWindow(); 432 #if !H_MV5 412 433 READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 413 434 READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 414 435 READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 415 436 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 437 #else 438 #if H_MV 439 defDisp.setScaledFlag( false ); 440 READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode ); 441 READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode ); 442 READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode ); 443 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode ); 444 #else 445 READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 446 READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 447 READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 448 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 449 #endif 450 #endif 416 451 } 417 452 TimingInfo *timingInfo = pcVUI->getTimingInfo(); … … 436 471 { 437 472 READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); 473 #if !H_MV5 438 474 #if H_MV 439 475 if ( pcSPS->getLayerId() > 0 ) … … 441 477 READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 ); 442 478 } 479 #endif 443 480 #endif 444 481 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); … … 560 597 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 561 598 assert(uiCode <= 15); 599 #if H_MV5 600 #if H_MV 601 if ( pcSPS->getLayerId() > 0 ) 602 { 603 READ_FLAG( uiCode, "update_rep_format_flag" ); pcSPS->setUpdateRepFormatFlag( uiCode == 1 ); 604 } 562 605 606 if ( pcSPS->getUpdateRepFormatFlag() ) 607 { 608 #endif 609 #endif 563 610 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 564 611 assert(uiCode <= 3); … … 572 619 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 573 620 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 621 #if H_MV5 622 #if H_MV 623 } 624 #endif 625 #endif 574 626 READ_FLAG( uiCode, "conformance_window_flag"); 575 627 if (uiCode != 0) 576 628 { 577 629 Window &conf = pcSPS->getConformanceWindow(); 630 #if H_MV5 631 #if H_MV 632 // Needs to be scaled later, when ChromaFormatIdc is known. 633 conf.setScaledFlag( false ); 634 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); 635 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); 636 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); 637 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); 638 #else 578 639 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 579 640 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 580 641 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 581 642 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 582 } 583 643 #endif 644 #else 645 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 646 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 647 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 648 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 649 #endif 650 } 651 652 #if H_MV5 653 #if H_MV 654 if ( pcSPS->getUpdateRepFormatFlag() ) 655 { 656 #endif 657 #endif 584 658 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 585 659 assert(uiCode <= 6); … … 591 665 pcSPS->setBitDepthC( uiCode + 8 ); 592 666 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 667 #if H_MV5 668 #if H_MV 669 } 670 #endif 671 #endif 593 672 594 673 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); … … 613 692 pcSPS->setNumReorderPics(uiCode, i); 614 693 #if H_MV 694 #if H_MV5 695 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); 696 #else 615 697 READ_UVLC ( uiCode, "sps_max_latency_increase[i]"); 698 #endif 616 699 #else 617 READ_UVLC ( uiCode, "sps_max_latency_increase ");700 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1"); 618 701 #endif 619 702 pcSPS->setMaxLatencyIncrease( uiCode, i ); … … 653 736 if(pcSPS->getScalingListFlag()) 654 737 { 738 #if H_MV5 739 #if H_MV 740 if ( pcSPS->getLayerId() > 0 ) 741 { 742 READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setSpsInferScalingListFlag( uiCode == 1 ); 743 } 744 745 if ( pcSPS->getSpsInferScalingListFlag() ) 746 { 747 READ_CODE( 6, uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setSpsScalingListRefLayerId( uiCode ); 748 } 749 else 750 { 751 #endif 752 #endif 655 753 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); 656 754 if(pcSPS->getScalingListPresentFlag ()) … … 658 756 parseScalingList( pcSPS->getScalingList() ); 659 757 } 758 #if H_MV5 759 #if H_MV 760 } 761 #endif 762 #endif 660 763 } 661 764 READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); … … 711 814 if (uiCode) 712 815 { 816 #if !H_MV5 713 817 #if !H_MV 714 818 while ( xMoreRbspData() ) … … 789 893 } 790 894 } 895 #else 896 #if H_MV 897 parseSPSExtension( pcSPS ); 898 READ_FLAG( uiCode, "sps_extension2_flag"); 899 if ( uiCode ) 900 { 901 #if H_3D 902 parseSPSExtension2( pcSPS, viewIndex, depthFlag ); 903 READ_FLAG( uiCode, "sps_extension3_flag"); 904 if ( uiCode ) 905 { 906 #endif 907 #endif 908 while ( xMoreRbspData() ) 909 { 910 READ_FLAG( uiCode, "sps_extension_data_flag"); 911 } 912 #if H_MV 913 #if H_3D 914 } 915 #endif 916 } 917 #endif 918 } 919 } 920 #endif 921 #if H_MV5 922 Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) 923 { 924 UInt uiCode; 925 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 926 READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" ); 927 } 928 929 #if H_3D 930 Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 931 { 932 UInt uiCode; 933 #if H_3D_QTLPC 934 //GT: This has to go to VPS 935 if( depthFlag ) 936 { 937 READ_FLAG( uiCode, "use_qtl_flag" ); 938 pcSPS->setUseQTL( uiCode ); 939 READ_FLAG( uiCode, "use_pc_flag" ); 940 pcSPS->setUsePC( uiCode ); 941 } 942 #endif 943 944 UInt uiCamParPrecision = 0; 945 Bool bCamParSlice = false; 946 if ( !depthFlag ) 947 { 948 READ_UVLC( uiCamParPrecision, "cp_precision" ); 949 READ_FLAG( uiCode, "cp_in_slice_header_flag" ); bCamParSlice = ( uiCode == 1 ); 950 if( !bCamParSlice ) 951 { 952 for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ ) 953 { 954 Int iCode; 955 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode; 956 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode; 957 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ]; 958 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ]; 959 } 960 } 961 } 962 pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 963 } 964 #endif 965 #endif 791 966 792 967 Void TDecCavlc::parseVPS(TComVPS* pcVPS) … … 797 972 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); 798 973 #if H_MV 974 #if H_MV5 975 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayersMinus1( uiCode ); 976 #else 799 977 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); 978 #endif 800 979 #else 801 980 READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); … … 882 1061 if (uiCode) 883 1062 { 1063 #if !H_MV5 884 1064 #if H_MV 885 1065 m_pcBitstream->readOutTrailingBits(); … … 1099 1279 return; 1100 1280 } 1281 #else 1282 #if H_MV 1283 m_pcBitstream->readOutTrailingBits(); 1284 parseVPSExtension( pcVPS ); 1285 READ_FLAG( uiCode, "vps_extension2_flag" ); 1286 if (uiCode) 1287 { 1288 #if H_3D 1289 m_pcBitstream->readOutTrailingBits(); 1290 parseVPSExtension2( pcVPS ); 1291 READ_FLAG( uiCode, "vps_extension3_flag" ); 1292 if (uiCode) 1293 { 1294 #endif 1295 #endif 1296 while ( xMoreRbspData() ) 1297 { 1298 READ_FLAG( uiCode, "vps_extension_data_flag"); 1299 } 1300 #if H_MV 1301 #if H_3D 1302 } 1303 #endif 1304 } 1305 #endif 1306 } 1307 } 1308 #endif 1309 1310 #if H_MV5 1311 #if H_MV 1312 Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS ) 1313 { 1314 UInt uiCode; 1315 READ_FLAG( uiCode, "avc_base_layer_flag" ); pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false ); 1316 READ_CODE( 16, uiCode, "vps_vui_offset" ); pcVPS->setVpsVuiOffset( uiCode ); 1317 READ_FLAG( uiCode, "splitting_flag" ); pcVPS->setSplittingFlag( uiCode == 1 ? true : false ); 1318 1319 for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ ) 1320 { 1321 READ_FLAG( uiCode, "scalability_mask_flag[i]" ); pcVPS->setScalabilityMaskFlag( sIdx, uiCode == 1 ? true : false ); 1322 } 1323 1324 for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ ) 1325 { 1326 READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); pcVPS->setDimensionIdLen( sIdx, uiCode + 1 ); 1327 } 1328 1329 if ( pcVPS->getSplittingFlag() ) 1330 { 1331 pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() ); 1332 } 1333 1334 READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false ); 1335 1336 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1337 { 1338 if ( pcVPS->getVpsNuhLayerIdPresentFlag() ) 1339 { 1340 READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); pcVPS->setLayerIdInNuh( i, uiCode ); 1341 } 1342 else 1343 { 1344 pcVPS->setLayerIdInNuh( i, i );; 1345 } 1346 1347 pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i ); 1348 1349 for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ ) 1350 { 1351 if ( !pcVPS->getSplittingFlag() ) 1352 { 1353 READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" ); pcVPS->setDimensionId( i, j, uiCode ); 1354 } 1355 else 1356 { 1357 pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j) ); 1358 } 1359 } 1360 } 1361 1362 // GT spec says: trac #39 1363 // if ( pcVPS->getNumViews() > 1 ) 1364 // However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. 1365 { 1366 READ_CODE( 4, uiCode, "view_id_len_minus1" ); pcVPS->setViewIdLenMinus1( uiCode ); 1367 } 1368 1369 for( Int i = 0; i < pcVPS->getNumViews(); i++ ) 1370 { 1371 READ_CODE( pcVPS->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode ); 1372 } 1373 1374 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1375 { 1376 for( Int j = 0; j < i; j++ ) 1377 { 1378 READ_FLAG( uiCode, "direct_dependency_flag[i][j]" ); pcVPS->setDirectDependencyFlag( i, j, uiCode ); 1379 } 1380 } 1381 1382 READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 ); 1383 1384 if ( pcVPS->getMaxTidRefPresentFlag() ) 1385 { 1386 for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ ) 1387 { 1388 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); pcVPS->setMaxTidIlRefPicPlus1( i , uiCode ); 1389 } 1390 } 1391 1392 READ_FLAG( uiCode, "all_ref_layers_active_flag" ); pcVPS->setAllRefLayersActiveFlag( uiCode == 1 ); 1393 READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); pcVPS->setVpsNumberLayerSetsMinus1 ( uiCode ); 1394 READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1" ); pcVPS->setVpsNumProfileTierLevelMinus1( uiCode ); 1395 1396 for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ ) 1397 { 1398 READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 ); 1399 if( !pcVPS->getVpsProfilePresentFlag( i ) ) 1400 { 1401 READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode ); 1402 } 1403 parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1); 1404 if( !pcVPS->getVpsProfilePresentFlag( i ) ) 1405 { 1406 TComPTL temp = *pcVPS->getPTL( i ); 1407 *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 ); 1408 pcVPS->getPTL( i )->copyLevelFrom( &temp ); 1409 } 1410 } 1411 1412 Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; 1413 1414 READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 ); 1415 1416 if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ) 1417 { 1418 READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1" ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode ); 1419 numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1); 1420 } 1421 1422 if( numOutputLayerSets > 1) 1423 { 1424 READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag( uiCode == 1); 1425 } 1426 1427 for( Int i = 1; i < numOutputLayerSets; i++ ) 1428 { 1429 if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) ) 1430 { 1431 READ_UVLC( uiCode, "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode ); 1432 for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ ) 1433 { 1434 READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 ); 1435 } 1436 } 1437 if ( pcVPS->getProfileLevelTierIdxLen() > 0 ) 1438 { 1439 READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" ); pcVPS->setProfileLevelTierIdx( i , uiCode ); 1440 } 1441 } 1442 1443 READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 ); 1444 if ( pcVPS->getRepFormatIdxPresentFlag() ) 1445 { 1446 READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" ); pcVPS->setVpsNumRepFormatsMinus1( uiCode ); 1447 } 1448 1449 for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ ) 1450 { 1451 assert( pcVPS->getRepFormat(i) == NULL ); 1452 TComRepFormat* repFormat = new TComRepFormat(); 1453 parseRepFormat( repFormat ); 1454 pcVPS->setRepFormat(i, repFormat ); 1455 } 1456 1457 if( pcVPS->getRepFormatIdxPresentFlag() ) 1458 { 1459 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1460 { 1461 if( pcVPS->getVpsNumRepFormatsMinus1() > 0 ) 1462 { 1463 READ_CODE( 4, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode ); 1464 } 1465 } 1466 } 1467 1468 READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 ); 1469 READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPS->setCrossLayerIrapAlignedFlag( uiCode == 1 ); 1470 READ_UVLC( uiCode, "direct_dep_type_len_minus2") ; pcVPS->setDirectDepTypeLenMinus2 ( uiCode ); 1471 1472 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1473 { 1474 for( Int j = 0; j < i; j++ ) 1475 { 1476 if (pcVPS->getDirectDependencyFlag( i, j) ) 1477 { 1478 READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode); 1479 } 1480 } 1481 } 1482 1483 READ_FLAG( uiCode, "vps_shvc_reserved_zero_flag" ); 1484 READ_FLAG( uiCode, "vps_vui_present_flag" ) ; pcVPS->setVpsVuiPresentFlag( uiCode == 1 ); 1485 1486 if( pcVPS->getVpsVuiPresentFlag() ) 1487 { 1488 m_pcBitstream->readOutTrailingBits(); // vps_vui_alignment_bit_equal_to_one 1489 parseVPSVUI( pcVPS ); 1490 } 1491 1492 pcVPS->checkVPSExtensionSyntax(); 1493 pcVPS->setRefLayers(); 1494 } 1495 1496 Void TDecCavlc::parseRepFormat( TComRepFormat* pcRepFormat ) 1497 { 1498 assert( pcRepFormat ); 1499 1500 UInt uiCode; 1501 READ_CODE( 2, uiCode, "chroma_format_vps_idc" ); pcRepFormat->setChromaFormatVpsIdc ( uiCode ); 1502 if ( pcRepFormat->getChromaFormatVpsIdc() == 3 ) 1503 { 1504 READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); 1505 } 1506 READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" ); pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode ); 1507 READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode ); 1508 READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" ); pcRepFormat->setBitDepthVpsLumaMinus8 ( uiCode ); 1509 READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" ); pcRepFormat->setBitDepthVpsChromaMinus8 ( uiCode ); 1510 } 1511 1512 1513 Void TDecCavlc::parseVPSVUI( TComVPS* pcVPS ) 1514 { 1515 assert( pcVPS ); 1516 1517 TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 1518 1519 assert( pcVPSVUI ); 1520 1521 UInt uiCode; 1522 READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 ); 1523 READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 ); 1524 if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) ) 1525 { 1526 for( Int i = 0; i <= pcVPS->getVpsNumberLayerSetsMinus1(); i++ ) 1527 { 1528 for( Int j = 0; j <= pcVPS->getMaxTLayers(); j++ ) 1529 { 1530 if( pcVPSVUI->getBitRatePresentVpsFlag( ) ) 1531 { 1532 READ_FLAG( uiCode, "bit_rate_present_flag" ); pcVPSVUI->setBitRatePresentFlag( i, j, uiCode == 1 ); 1533 } 1534 if( pcVPSVUI->getPicRatePresentVpsFlag( ) ) 1535 { 1536 READ_FLAG( uiCode, "pic_rate_present_flag" ); pcVPSVUI->setPicRatePresentFlag( i, j, uiCode == 1 ); 1537 } 1538 if( pcVPSVUI->getBitRatePresentFlag( i, j ) ) 1539 { 1540 READ_CODE( 16, uiCode, "avg_bit_rate" ); pcVPSVUI->setAvgBitRate( i, j, uiCode ); 1541 READ_CODE( 16, uiCode, "max_bit_rate" ); pcVPSVUI->setMaxBitRate( i, j, uiCode ); 1542 } 1543 if( pcVPSVUI->getPicRatePresentFlag( i, j ) ) 1544 { 1545 READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); pcVPSVUI->setConstantPicRateIdc( i, j, uiCode ); 1546 READ_CODE( 16, uiCode, "avg_pic_rate" ); pcVPSVUI->setAvgPicRate( i, j, uiCode ); 1547 } 1548 } 1549 } 1550 } 1551 1552 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1553 { 1554 for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) 1555 { 1556 READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 ); 1557 } 1558 } 1559 1560 READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 ); 1561 1562 if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ) 1563 { 1564 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1565 { 1566 for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) 1567 { 1568 READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); 1569 if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 ) 1570 { 1571 READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 ); 1572 if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) ) 1573 { 1574 READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, uiCode ); 1575 } 1576 } 1577 } 1578 } 1579 } 1580 } 1581 #endif 1582 1583 #if H_3D 1584 Void TDecCavlc::parseVPSExtension2( TComVPS* pcVPS ) 1585 { 1586 UInt uiCode; 1587 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1588 { 1589 #if H_3D_ARP 1590 pcVPS->setUseAdvRP ( i, 0 ); 1591 pcVPS->setARPStepNum( i, 1 ); 1592 #endif 1593 if ( i != 0 ) 1594 { 1595 if( !( pcVPS->getDepthId( i ) == 1 ) ) 1596 { 1597 #if H_3D_IV_MERGE 1598 READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false ); 1599 #endif 1600 #if H_3D_ARP 1601 READ_FLAG( uiCode, "iv_res_pred_flag[i]" ); pcVPS->setUseAdvRP ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 ); 1602 1603 #endif 1604 #if H_3D_NBDV_REF 1605 READ_FLAG( uiCode, "depth_refinement_flag[i]"); pcVPS->setDepthRefinementFlag ( i, uiCode == 1 ? true : false ); 1606 #endif 1607 #if H_3D_VSP 1608 READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false ); 1609 #endif 1610 } 1611 else 1612 { 1613 1614 READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false ); 1615 // READ_FLAG( uiCode, "lim_qt_pred_flag[i]"); pcVPS->setLimQtPreFlag ( i, uiCode == 1 ? true : false ); 1616 #if H_3D_DIM_DLT 1617 if( pcVPS->getVpsDepthModesFlag( i ) ) 1618 { 1619 READ_FLAG( uiCode, "dlt_flag[i]" ); pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false ); 1620 } 1621 if( pcVPS->getUseDLTFlag( i ) ) 1622 { 1623 // decode mapping 1624 UInt uiNumDepthValues; 1625 // parse number of values in DLT 1626 READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]"); 1627 1628 // parse actual DLT values 1629 Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int)); 1630 for(Int d=0; d<uiNumDepthValues; d++) 1631 { 1632 READ_UVLC(uiCode, "dlt_depth_value[i][d]"); 1633 aiIdx2DepthValue[d] = (Int)uiCode; 1634 } 1635 1636 pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); 1637 1638 // clean memory 1639 free(aiIdx2DepthValue); 1640 } 1641 #endif 1642 #if LGE_INTER_SDC_E0156 1643 READ_FLAG( uiCode, "depth_inter_SDC_flag" ); pcVPS->setInterSDCFlag( i, uiCode ? true : false ); 1644 #endif 1645 } 1646 } 1647 } 1648 READ_FLAG( uiCode, "iv_mv_scaling_flag"); pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 1649 } 1650 #endif 1651 #endif 1101 1652 1102 1653 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) … … 1129 1680 #if H_MV 1130 1681 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 1682 #if H_MV5 1683 assert( vps != NULL ); 1684 1685 sps->inferRepFormat ( vps , rpcSlice->getLayerId() ); 1686 sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 1687 1688 rpcSlice->setVPS(vps); 1689 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerId() ) ); 1690 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerId() ) ); 1691 #if H_3D 1692 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerId() ) == 1 ); 1693 #endif 1694 #else 1131 1695 assert(vps!=0); 1132 1696 rpcSlice->setVPS(vps); … … 1137 1701 #endif 1138 1702 #endif 1703 #endif 1139 1704 rpcSlice->setSPS(sps); 1140 1705 rpcSlice->setPPS(pps); … … 1182 1747 { 1183 1748 #if H_MV 1749 #if H_MV5 1750 Int esb = 0; //Don't use i, otherwise will shadow something below 1751 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) 1752 { 1753 esb++; 1754 READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 ); 1755 } 1756 1757 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) 1758 { 1759 esb++; 1760 READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 ); 1761 } 1762 1763 for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++) 1764 #else 1184 1765 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 ) 1185 1766 { … … 1188 1769 1189 1770 for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1771 #endif 1190 1772 #else 1191 1773 for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) … … 1251 1833 } 1252 1834 rpcSlice->setPOC (iPOCmsb+iPOClsb); 1253 1835 #if H_MV5 1836 #if H_MV 1837 if ( rpcSlice->getPocResetFlag() ) 1838 { 1839 rpcSlice->setPocBeforeReset ( rpcSlice->getPOC() ); 1840 rpcSlice->setPOC ( 0 ); 1841 1842 } 1843 #endif 1844 #endif 1254 1845 TComReferencePictureSet* rps; 1255 1846 rps = rpcSlice->getLocalRPS(); … … 1379 1970 } 1380 1971 #if H_MV 1972 #if H_MV5 1973 Int layerId = rpcSlice->getLayerId(); 1974 if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) { 1975 READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); 1976 if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) 1977 { 1978 if( !vps->getMaxOneActiveRefLayerFlag()) 1979 { 1980 READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode ); 1981 } 1982 if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) 1983 { 1984 for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ ) 1985 { 1986 READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( idx, uiCode ); 1987 } 1988 } 1989 } 1990 } 1991 #else 1381 1992 Int layerIdInVps = rpcSlice->getLayerIdInVps(); 1382 1993 if( rpcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 ) … … 1402 2013 READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode == 1 ); 1403 2014 } 1404 2015 #endif 1405 2016 #endif 1406 2017 if(sps->getUseSAO()) … … 1544 2155 if ( rpcSlice->getEnableTMVPFlag() ) 1545 2156 { 2157 #if !H_MV5 1546 2158 #if H_MV 1547 2159 if( rpcSlice->getLayerId() > 0 && rpcSlice->getNumActiveMotionPredRefLayers() > 0 ) … … 1557 2169 { 1558 2170 #endif 2171 #endif 1559 2172 if ( rpcSlice->getSliceType() == B_SLICE ) 1560 2173 { … … 1578 2191 rpcSlice->setColRefIdx(0); 1579 2192 } 1580 #if H_MV 1581 } 2193 #if !H_MV5 2194 #if H_MV 2195 } 2196 #endif 1582 2197 #endif 1583 2198 }
Note: See TracChangeset for help on using the changeset viewer.