Changeset 894 in SHVCSoftware
- Timestamp:
- 26 Sep 2014, 03:22:40 (10 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r884 r894 1734 1734 #endif 1735 1735 1736 #if VPS_VUI_BSP_HRD_PARAMS 1737 vps->setVpsVuiBspHrdPresentFlag(false); 1738 TEncTop *pcCfg = &m_acTEncTop[0]; 1739 if( pcCfg->getBufferingPeriodSEIEnabled() ) 1740 { 1741 vps->setVpsVuiBspHrdPresentFlag(true); 1742 vps->setVpsNumAddHrdParams( vps->getMaxLayers() ); 1743 vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams() + 1); 1744 for(Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++) 1745 { 1746 vps->setCprmsAddPresentFlag( j, true ); 1747 vps->setNumSubLayerHrdMinus1( j, vps->getMaxTLayers() - 1 ); 1748 1749 UInt layerId = j; 1750 TEncTop *pcCfgLayer = &m_acTEncTop[layerId]; 1751 1752 Int iPicWidth = pcCfgLayer->getSourceWidth(); 1753 Int iPicHeight = pcCfgLayer->getSourceHeight(); 1754 #if LAYER_CTB 1755 UInt uiWidthInCU = ( iPicWidth % m_acLayerCfg[layerId].m_uiMaxCUWidth ) ? iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth + 1 : iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth; 1756 UInt uiHeightInCU = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight; 1757 UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1); 1758 #else 1759 UInt uiWidthInCU = ( iPicWidth %m_uiMaxCUWidth ) ? iPicWidth /m_uiMaxCUWidth + 1 : iPicWidth /m_uiMaxCUWidth; 1760 UInt uiHeightInCU = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight; 1761 UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1); 1762 #endif 1763 UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; 1764 1765 UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 ); 1766 if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 ) 1767 { 1768 numDU ++; 1769 } 1770 vps->getBspHrd(i)->setNumDU( numDU ); 1771 vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) ); 1772 } 1773 1774 // Signalling of additional partitioning schemes 1775 for(Int h = 1; h < vps->getNumOutputLayerSets(); h++) 1776 { 1777 Int lsIdx = vps->getOutputLayerSetIdx( h ); 1778 vps->setNumSignalledPartitioningSchemes(h, 1); // Only the default per-layer partitioning scheme 1779 for(Int j = 1; j < vps->getNumSignalledPartitioningSchemes(h); j++) 1780 { 1781 // ToDo: Add code for additional partitioning schemes here 1782 // ToDo: Initialize num_partitions_in_scheme_minus1 and layer_included_in_partition_flag 1783 } 1784 1785 for(Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h); i++) 1786 { 1787 if( i == 0 ) 1788 { 1789 for(Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1( lsIdx ); t++) 1790 { 1791 vps->setNumBspSchedulesMinus1( h, i, t, 0 ); 1792 for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 1793 { 1794 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 1795 { 1796 // Only for the default partition 1797 Int nuhlayerId = vps->getLayerSetLayerIdList( lsIdx, k); 1798 Int layerIdxInVps = vps->getLayerIdInVps( nuhlayerId ); 1799 vps->setBspHrdIdx(h, i, t, j, k, layerIdxInVps + vps->getNumHrdParameters()); 1800 1801 vps->setBspSchedIdx(h, i, t, j, k, 0); 1802 } 1803 } 1804 } 1805 } 1806 else 1807 { 1808 assert(0); // Need to add support for additional partitioning schemes. 1809 } 1810 } 1811 } 1812 } 1813 #else 1814 1736 1815 #if O0164_MULTI_LAYER_HRD 1737 1816 vps->setVpsVuiBspHrdPresentFlag(false); … … 1805 1884 } 1806 1885 } 1886 #endif 1807 1887 #endif 1808 1888 -
branches/SHM-dev/source/Lib/TLibCommon/SEI.h
r884 r894 592 592 Bool m_callerOwnsSEIs; 593 593 SEIMessages m_nestedSEIs; 594 #if VPS_VUI_BSP_HRD_PARAMS 595 Int m_seiPartitioningSchemeIdx; 596 Int m_seiOlsIdx; 597 #endif 594 598 }; 595 599 -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
r890 r894 3175 3175 } 3176 3176 #endif 3177 3177 3178 #if RESOLUTION_BASED_DPB 3178 3179 // RepFormat Assignment operator -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r890 r894 370 370 UInt getNumDU ( ) { return m_numDU; } 371 371 Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); } 372 373 #if VPS_VUI_BSP_HRD_PARAMS 374 Void copyCommonInformation( TComHRD *refHrd ) 375 { 376 m_nalHrdParametersPresentFlag = refHrd->getNalHrdParametersPresentFlag(); 377 m_vclHrdParametersPresentFlag = refHrd->getVclHrdParametersPresentFlag(); 378 m_subPicCpbParamsPresentFlag = refHrd->getSubPicCpbParamsPresentFlag(); 379 m_tickDivisorMinus2 = refHrd->getTickDivisorMinus2(); 380 m_duCpbRemovalDelayLengthMinus1 = refHrd->getDuCpbRemovalDelayLengthMinus1(); 381 m_subPicCpbParamsInPicTimingSEIFlag = refHrd->getSubPicCpbParamsInPicTimingSEIFlag(); 382 m_dpbOutputDelayDuLengthMinus1 = refHrd->getDpbOutputDelayDuLengthMinus1(); 383 m_bitRateScale = refHrd->getBitRateScale(); 384 m_cpbSizeScale = refHrd->getCpbSizeScale(); 385 m_ducpbSizeScale = refHrd->getDuCpbSizeScale(); 386 m_initialCpbRemovalDelayLengthMinus1 = refHrd->getInitialCpbRemovalDelayLengthMinus1(); 387 m_cpbRemovalDelayLengthMinus1 = refHrd->getCpbRemovalDelayLengthMinus1(); 388 m_dpbOutputDelayLengthMinus1 = refHrd->getDpbOutputDelayLengthMinus1(); 389 } 390 #endif 372 391 }; 373 392 … … 814 833 #if O0164_MULTI_LAYER_HRD 815 834 Bool m_vpsVuiBspHrdPresentFlag; 835 #if VPS_VUI_BSP_HRD_PARAMS 836 Int m_vpsNumAddHrdParams; 837 std::vector<Bool> m_cprmsAddPresentFlag; 838 std::vector<Int> m_numSubLayerHrdMinus1; 839 std::vector<TComHRD> m_bspHrd; 840 Int m_numSignalledPartitioningSchemes[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1]; 841 Int m_numPartitionsInSchemeMinus1 [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16]; 842 Int m_layerIncludedInPartitionFlag [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_LAYERS][MAX_LAYERS]; 843 Int m_numBspSchedulesMinus1 [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER]; 844 Int m_bspHrdIdx [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS]; 845 Int m_bspSchedIdx [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS]; 846 #else 816 847 UInt m_vpsNumBspHrdParametersMinus1; 817 848 Bool m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1]; … … 823 854 UInt m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16]; 824 855 #endif 856 #endif 825 857 826 858 #if P0182_VPS_VUI_PS_FLAG … … 867 899 Void createBspHrdParamBuffer(UInt numHrds) 868 900 { 901 #if VPS_VUI_BSP_HRD_PARAMS 902 m_bspHrd.resize( numHrds ); 903 m_cprmsAddPresentFlag.resize( numHrds ); 904 m_numSubLayerHrdMinus1.resize( numHrds ); 905 #else 869 906 m_bspHrd = new TComHRD[ numHrds ]; 907 #endif 870 908 // m_hrdOpSetIdx = new UInt [ getNumHrdParameters() ]; 871 909 // m_cprmsPresentFlag = new Bool [ getNumHrdParameters() ]; … … 875 913 Int getBspHrdParamBufferCpbCntMinus1(UInt i, UInt sl) 876 914 { 915 #if VPS_VUI_BSP_HRD_PARAMS 916 return m_bspHrd[i].getCpbCntMinus1(sl); 917 #else 877 918 return m_bspHrd->getCpbCntMinus1(sl); 919 #endif 878 920 } 879 921 #endif … … 1196 1238 Bool getVpsVuiBspHrdPresentFlag() { return m_vpsVuiBspHrdPresentFlag; } 1197 1239 Void setVpsVuiBspHrdPresentFlag(Bool x) { m_vpsVuiBspHrdPresentFlag = x; } 1240 #if VPS_VUI_BSP_HRD_PARAMS 1241 Int getVpsNumAddHrdParams() { return m_vpsNumAddHrdParams; } 1242 Void setVpsNumAddHrdParams(Int i) { m_vpsNumAddHrdParams = i; } 1243 1244 Bool getCprmsAddPresentFlag(Int i) { return m_cprmsAddPresentFlag[i]; } 1245 Void setCprmsAddPresentFlag(Int i, Bool val) { m_cprmsAddPresentFlag[i] = val; } 1246 1247 Int getNumSubLayerHrdMinus1(Int i) { return m_numSubLayerHrdMinus1[i]; } 1248 Void setNumSubLayerHrdMinus1(Int i, Int val) { m_numSubLayerHrdMinus1[i] = val; } 1249 1250 TComHRD* getBspHrd(Int i) {return &m_bspHrd[i];} 1251 1252 Int getNumSignalledPartitioningSchemes(Int i) { return m_numSignalledPartitioningSchemes[i]; } 1253 Void setNumSignalledPartitioningSchemes(Int i, Int val) { m_numSignalledPartitioningSchemes[i] = val; } 1254 1255 Int getNumPartitionsInSchemeMinus1(Int i, Int j) { return m_numPartitionsInSchemeMinus1[i][j];} 1256 Void setNumPartitionsInSchemeMinus1(Int i, Int j, Int val) { m_numPartitionsInSchemeMinus1[i][j] = val; } 1257 1258 Int getLayerIncludedInPartitionFlag(Int i, Int j, Int k, Int l) { return m_layerIncludedInPartitionFlag[i][j][k][l];} 1259 Void setLayerIncludedInPartitionFlag(Int i, Int j, Int k, Int l, Int val) { m_layerIncludedInPartitionFlag[i][j][k][l] = val; } 1260 1261 Int getNumBspSchedulesMinus1(Int i, Int j, Int k) { return m_numBspSchedulesMinus1[i][j][k];} 1262 Void setNumBspSchedulesMinus1(Int i, Int j, Int k, Int val) { m_numBspSchedulesMinus1[i][j][k] = val; } 1263 1264 Int getBspSchedIdx(Int i, Int j, Int k, Int l, Int m) { return m_bspSchedIdx[i][j][k][l][m];} 1265 Void setBspSchedIdx(Int i, Int j, Int k, Int l, Int m, Int val) { m_bspSchedIdx[i][j][k][l][m] = val; } 1266 1267 Int getBspHrdIdx(Int i, Int j, Int k, Int l, Int m) { return m_bspHrdIdx[i][j][k][l][m];} 1268 Void setBspHrdIdx(Int i, Int j, Int k, Int l, Int m, Int val) { m_bspHrdIdx[i][j][k][l][m] = val; } 1269 #else 1198 1270 UInt getVpsNumBspHrdParametersMinus1() { return m_vpsNumBspHrdParametersMinus1; } 1199 1271 Void setVpsNumBspHrdParametersMinus1(UInt i) { m_vpsNumBspHrdParametersMinus1 = i; } … … 1211 1283 UInt getBspCombSchedIdx(UInt h, UInt i, UInt j) { return m_bspCombSchedIdx[h][i][j]; } 1212 1284 Void setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val; } 1285 #endif 1213 1286 #endif 1214 1287 #if P0182_VPS_VUI_PS_FLAG -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r893 r894 66 66 #define BSP_INIT_ARRIVAL_SEI 1 ///< JCTVC-R0231: Make signalling of vcl_initial_arrival_delay independent of NalHrdBpPresentFlag 67 67 #define SUB_LAYERS_IN_LAYER_SET 1 ///< Move calculation of MaxSubLayerInLayerSets to a separate function 68 #define VPS_VUI_BSP_HRD_PARAMS 1 ///< JCTVC-R0231: Define the VPS VUI BSP hrd_params() as a separate function, and apply changes adopted. 68 69 #define O0137_MAX_LAYERID 1 ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1 69 70 … … 493 494 typedef double Double; 494 495 typedef float Float; 495 496 496 // ==================================================================================================================== 497 497 // 64-bit integer type -
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp
r884 r894 251 251 { 252 252 sei = new SEIDecodingUnitInfo; 253 #if VPS_VUI_BSP_HRD_PARAMS 254 xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 255 #else 253 256 xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps); 257 #endif 254 258 } 255 259 break; … … 262 266 { 263 267 sei = new SEIBufferingPeriod; 268 #if VPS_VUI_BSP_HRD_PARAMS 269 xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 270 #else 264 271 xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps); 272 #endif 265 273 } 266 274 break; … … 273 281 { 274 282 sei = new SEIPictureTiming; 283 #if VPS_VUI_BSP_HRD_PARAMS 284 xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 285 #else 275 286 xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps); 287 #endif 276 288 } 277 289 break; … … 600 612 } 601 613 614 #if VPS_VUI_BSP_HRD_PARAMS 615 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 616 #else 602 617 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps) 618 #endif 603 619 { 604 620 UInt val; … … 606 622 sei.m_decodingUnitIdx = val; 607 623 624 #if VPS_VUI_BSP_HRD_PARAMS 625 TComHRD *hrd; 626 if( bspNestingSei ) // If DU info SEI contained inside a BSP nesting SEI message 627 { 628 assert( nestingSei ); 629 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 630 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 631 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 632 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 633 std::vector<Int> hrdIdx(maxValues, 0); 634 std::vector<TComHRD *> hrdVec; 635 std::vector<Int> syntaxElemLen(maxValues, 0); 636 for(Int i = 0; i < maxValues; i++) 637 { 638 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 639 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 640 641 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 642 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 643 { 644 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 645 } 646 if( i > 0 ) 647 { 648 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 649 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 650 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 651 // To be done: Check CpbDpbDelaysPresentFlag 652 } 653 } 654 hrd = hrdVec[0]; 655 } 656 else 657 { 658 TComVUI *vui = sps->getVuiParameters(); 659 hrd = vui->getHrdParameters(); 660 } 661 #else 608 662 TComVUI *vui = sps->getVuiParameters(); 609 if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) 610 { 611 READ_CODE( ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); 663 TComHrd *hrd = vui->getHrdParameters(); 664 #endif 665 if(hrd->getSubPicCpbParamsInPicTimingSEIFlag()) 666 { 667 READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); 612 668 sei.m_duSptCpbRemovalDelay = val; 613 669 } … … 619 675 if(sei.m_dpbOutputDuDelayPresentFlag) 620 676 { 621 READ_CODE( vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay");677 READ_CODE(hrd->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); 622 678 sei.m_picSptDpbOutputDuDelay = val; 623 679 } … … 625 681 } 626 682 683 #if VPS_VUI_BSP_HRD_PARAMS 684 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 685 #else 627 686 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps) 687 #endif 628 688 { 629 689 Int i, nalOrVcl; 630 690 UInt code; 631 691 692 #if VPS_VUI_BSP_HRD_PARAMS 693 TComHRD *pHRD; 694 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 695 { 696 assert( nestingSei ); 697 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 698 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 699 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 700 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 701 std::vector<Int> hrdIdx(maxValues, 0); 702 std::vector<TComHRD *> hrdVec; 703 std::vector<Int> syntaxElemLen(maxValues, 0); 704 for(i = 0; i < maxValues; i++) 705 { 706 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 707 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 708 709 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 710 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 711 { 712 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 713 } 714 if( i > 0 ) 715 { 716 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 717 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 718 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 719 } 720 } 721 pHRD = hrdVec[i]; 722 } 723 else 724 { 725 TComVUI *vui = sps->getVuiParameters(); 726 pHRD = vui->getHrdParameters(); 727 } 728 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 729 #else 632 730 TComVUI *pVUI = sps->getVuiParameters(); 633 731 TComHRD *pHRD = pVUI->getHrdParameters(); 732 #endif 634 733 635 734 READ_UVLC( code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; … … 683 782 xParseByteAlign(); 684 783 } 784 #if VPS_VUI_BSP_HRD_PARAMS 785 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 786 #else 685 787 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps) 788 #endif 686 789 { 687 790 Int i; 688 791 UInt code; 689 792 793 #if VPS_VUI_BSP_HRD_PARAMS 794 TComHRD *hrd; 795 TComVUI *vui = sps->getVuiParameters(); 796 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 797 { 798 assert( nestingSei ); 799 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 800 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 801 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 802 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 803 std::vector<Int> hrdIdx(maxValues, 0); 804 std::vector<TComHRD *> hrdVec; 805 std::vector<Int> syntaxElemLen(maxValues, 0); 806 for(i = 0; i < maxValues; i++) 807 { 808 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 809 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 810 811 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 812 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 813 { 814 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 815 } 816 if( i > 0 ) 817 { 818 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 819 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 820 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 821 assert( hrdVec[i]->getDpbOutputDelayLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayLengthMinus1() ); 822 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 823 assert( hrdVec[i]->getDuCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getDuCpbRemovalDelayLengthMinus1() ); 824 // To be done: Check CpbDpbDelaysPresentFlag 825 } 826 } 827 hrd = hrdVec[0]; 828 } 829 else 830 { 831 hrd = vui->getHrdParameters(); 832 } 833 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 834 #else 690 835 TComVUI *vui = sps->getVuiParameters(); 691 836 TComHRD *hrd = vui->getHrdParameters(); 837 #endif 692 838 693 839 if( vui->getFrameFieldInfoPresentFlag() ) … … 1264 1410 assert(vps->getVpsVuiPresentFlag()); 1265 1411 1412 #if VPS_VUI_BSP_HRD_PARAMS 1413 UInt uiCode; 1414 Int psIdx = bspNestingSei.m_seiPartitioningSchemeIdx; 1415 Int seiOlsIdx = bspNestingSei.m_seiOlsIdx; 1416 Int maxTemporalId = nestingSei.m_nestingMaxTemporalIdPlus1[0]; 1417 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 1418 std::vector<Int> hrdIdx(0, maxValues); 1419 std::vector<TComHRD *> hrdVec; 1420 std::vector<Int> syntaxElemLen; 1421 for(Int i = 0; i < maxValues; i++) 1422 { 1423 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei.m_bspIdx); 1424 hrdVec[i] = vps->getBspHrd(hrdIdx[i]); 1425 1426 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 1427 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 1428 { 1429 assert( syntaxElemLen[i] == 24 ); // Default value of init_cpb_removal_delay_length_minus1 is 23 1430 } 1431 if( i > 0 ) 1432 { 1433 assert( hrdVec[i]->getNalHrdParametersPresentFlag() == hrdVec[i-1]->getNalHrdParametersPresentFlag() ); 1434 assert( hrdVec[i]->getVclHrdParametersPresentFlag() == hrdVec[i-1]->getVclHrdParametersPresentFlag() ); 1435 } 1436 } 1437 if (hrdVec[0]->getNalHrdParametersPresentFlag()) 1438 { 1439 for(UInt i = 0; i < maxValues; i++) 1440 { 1441 READ_CODE( syntaxElemLen[i], uiCode, "nal_initial_arrival_delay[i]" ); sei.m_nalInitialArrivalDelay[i] = uiCode; 1442 } 1443 } 1444 if( hrdVec[0]->getVclHrdParametersPresentFlag() ) 1445 { 1446 for(UInt i = 0; i < maxValues; i++) 1447 { 1448 READ_CODE( syntaxElemLen[i], uiCode, "vcl_initial_arrival_delay[i]" ); sei.m_vclInitialArrivalDelay[i] = uiCode; 1449 } 1450 } 1451 #else 1266 1452 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 1267 1453 UInt len; … … 1307 1493 } 1308 1494 } 1495 #endif 1309 1496 } 1310 1497 -
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.h
r856 r894 80 80 Void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, UInt payloadSize); 81 81 Void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, UInt payloadSize); 82 Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize); 83 #if VPS_VUI_BSP_HRD_PARAMS 84 Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 85 Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 86 Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 87 #else 82 88 Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps); 83 Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize);84 89 Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps); 85 90 Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps); 91 #endif 86 92 Void xParseSEIRecoveryPoint (SEIRecoveryPoint& sei, UInt payloadSize); 87 93 Void xParseSEIFramePacking (SEIFramePacking& sei, UInt payloadSize); -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r893 r894 578 578 READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); 579 579 } 580 #if VPS_VUI_BSP_HRD_PARAMS 581 else 582 { 583 hrd->setInitialCpbRemovalDelayLengthMinus1( 23 ); 584 // Add inferred values for other syntax elements here. 585 } 586 #endif 580 587 } 581 588 Int i, j, nalOrVcl; … … 2625 2632 if (vps->getVpsVuiBspHrdPresentFlag()) 2626 2633 { 2634 #if VPS_VUI_BSP_HRD_PARAMS 2635 parseVpsVuiBspHrdParams(vps); 2636 #else 2627 2637 #if R0227_VUI_BSP_HRD_FLAG 2628 2638 assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); … … 2703 2713 } 2704 2714 } 2705 } 2706 #endif 2707 2715 #endif 2716 } 2717 #endif 2708 2718 #if P0182_VPS_VUI_PS_FLAG 2709 2719 for(i = 1; i < vps->getMaxLayers(); i++) … … 2721 2731 #endif 2722 2732 } 2733 2723 2734 #endif //SVC_EXTENSION 2724 2735 … … 4487 4498 } 4488 4499 #endif 4500 #if VPS_VUI_BSP_HRD_PARAMS 4501 Void TDecCavlc::parseVpsVuiBspHrdParams( TComVPS *vps ) 4502 { 4503 UInt uiCode; 4504 assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); 4505 READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vps->setVpsNumAddHrdParams(uiCode); 4506 vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams()); // Also allocates m_cprmsAddPresentFlag and m_numSubLayerHrdMinus 4507 4508 for( Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) // j = i - vps->getNumHrdParameters() 4509 { 4510 if( i > 0 ) 4511 { 4512 READ_FLAG( uiCode, "cprms_add_present_flag[i]" ); vps->setCprmsAddPresentFlag(j, uiCode ? true : false); 4513 } 4514 else 4515 { 4516 // i == 0 4517 if( vps->getNumHrdParameters() == 0 ) 4518 { 4519 vps->setCprmsAddPresentFlag(0, true); 4520 } 4521 } 4522 READ_UVLC( uiCode, "num_sub_layer_hrd_minus1[i]" ); vps->setNumSubLayerHrdMinus1(j, uiCode ); 4523 assert( uiCode <= vps->getMaxTLayers() - 1 ); 4524 4525 parseHrdParameters( vps->getBspHrd(j), vps->getCprmsAddPresentFlag(j), vps->getNumSubLayerHrdMinus1(j) ); 4526 if( i > 0 && !vps->getCprmsAddPresentFlag(i) ) 4527 { 4528 // Copy common information parameters 4529 if( i == vps->getNumHrdParameters() ) 4530 { 4531 vps->getBspHrd(j)->copyCommonInformation( vps->getHrdParameters( vps->getNumHrdParameters() - 1 ) ); 4532 } 4533 else 4534 { 4535 vps->getBspHrd(j)->copyCommonInformation( vps->getBspHrd( j - 1 ) ); 4536 } 4537 } 4538 } 4539 for (Int h = 1; h < vps->getNumOutputLayerSets(); h++) 4540 { 4541 Int lsIdx = vps->getOutputLayerSetIdx( h ); 4542 READ_UVLC( uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode); 4543 for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) 4544 { 4545 READ_UVLC( uiCode, "num_partitions_in_scheme_minus1[h][j]" ); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode); 4546 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ ) 4547 { 4548 for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ ) 4549 { 4550 READ_FLAG( uiCode, "layer_included_in_partition_flag[h][j][k][r]" ); vps->setLayerIncludedInPartitionFlag(h, j, k, r, uiCode ? true : false); 4551 } 4552 } 4553 } 4554 for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ ) 4555 { 4556 for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ ) 4557 { 4558 READ_UVLC( uiCode, "num_bsp_schedules_minus1[h][i][t]"); vps->setNumBspSchedulesMinus1(h, i, t, uiCode); 4559 for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 4560 { 4561 for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 4562 { 4563 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]"); vps->setBspHrdIdx(h, i, t, j, k, uiCode); 4564 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][t][j][k]"); vps->setBspSchedIdx(h, i, t, j, k, uiCode); 4565 } 4566 } 4567 } 4568 } 4569 4570 // To be done: Check each layer included in not more than one BSP in every partitioning scheme, 4571 // and other related checks associated with layers in bitstream partitions. 4572 4573 } 4574 } 4575 #endif 4489 4576 #endif 4490 4577 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r826 r894 86 86 Void parseVpsDpbSizeTable( TComVPS *vps ); 87 87 #endif 88 #if VPS_VUI_BSP_HRD_PARAMS 89 Void parseVpsVuiBspHrdParams( TComVPS *vps ); 90 #endif 88 91 #if SPS_DPB_PARAMS 89 92 Void parseSPS ( TComSPS* pcSPS ); // it should be removed after macro clean up -
branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r884 r894 149 149 150 150 #if O0164_MULTI_LAYER_HRD 151 #if VPS_VUI_BSP_HRD_PARAMS 152 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSeiPtr, const SEIBspNesting* bspNestingSeiPtr) 153 #else 151 154 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei) 155 #endif 152 156 #else 153 157 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 154 158 #endif 155 159 { 160 #if VPS_VUI_BSP_HRD_PARAMS 161 SEIScalableNesting nestingSei; 162 SEIBspNesting bspNestingSei; 163 if( nestingSeiPtr ) 164 { 165 nestingSei = *nestingSeiPtr; 166 } 167 if( bspNestingSeiPtr ) 168 { 169 bspNestingSei = *bspNestingSeiPtr; 170 } 171 #endif 156 172 switch (sei.payloadType()) 157 173 { … … 162 178 xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); 163 179 break; 180 case SEI::DECODED_PICTURE_HASH: 181 xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); 182 break; 183 #if VPS_VUI_BSP_HRD_PARAMS 184 case SEI::DECODING_UNIT_INFO: 185 xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 186 break; 187 case SEI::BUFFERING_PERIOD: 188 xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 189 break; 190 case SEI::PICTURE_TIMING: 191 xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 192 break; 193 #else 164 194 case SEI::DECODING_UNIT_INFO: 165 195 xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps); 166 196 break; 167 case SEI::DECODED_PICTURE_HASH:168 xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei));169 break;170 197 case SEI::BUFFERING_PERIOD: 171 198 xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); … … 174 201 xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps); 175 202 break; 203 #endif 176 204 case SEI::RECOVERY_POINT: 177 205 xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); … … 287 315 #endif 288 316 #if O0164_MULTI_LAYER_HRD 317 #if VPS_VUI_BSP_HRD_PARAMS 318 xWriteSEIpayloadData(bs_count, sei, vps, sps, nestingSei, bspNestingSei); 319 #else 289 320 xWriteSEIpayloadData(bs_count, sei, vps, sps, *nestingSei, *bspNestingSei); 321 #endif 290 322 #else 291 323 xWriteSEIpayloadData(bs_count, sei, sps); … … 326 358 327 359 #if O0164_MULTI_LAYER_HRD 360 #if VPS_VUI_BSP_HRD_PARAMS 361 xWriteSEIpayloadData(bs, sei, vps, sps, nestingSei, bspNestingSei); 362 #else 328 363 xWriteSEIpayloadData(bs, sei, vps, sps, *nestingSei, *bspNestingSei); 364 #endif 329 365 #else 330 366 xWriteSEIpayloadData(bs, sei, sps); … … 403 439 } 404 440 441 #if VPS_VUI_BSP_HRD_PARAMS 442 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 443 #else 405 444 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps) 406 { 445 #endif 446 { 447 #if VPS_VUI_BSP_HRD_PARAMS 448 TComHRD *hrd; 449 if( bspNestingSei ) // If DU info SEI contained inside a BSP nesting SEI message 450 { 451 assert( nestingSei ); 452 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 453 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 454 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 455 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 456 std::vector<Int> hrdIdx(maxValues, 0); 457 std::vector<TComHRD *> hrdVec; 458 std::vector<Int> syntaxElemLen(maxValues, 0); 459 for(Int i = 0; i < maxValues; i++) 460 { 461 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 462 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 463 464 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 465 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 466 { 467 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 468 } 469 if( i > 0 ) 470 { 471 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 472 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 473 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 474 // To be done: Check CpbDpbDelaysPresentFlag 475 } 476 } 477 hrd = hrdVec[0]; 478 } 479 else 480 { 481 TComVUI *vui = sps->getVuiParameters(); 482 hrd = vui->getHrdParameters(); 483 } 484 #else 407 485 TComVUI *vui = sps->getVuiParameters(); 486 TComHrd *hrd = vui->getHrdParameters(); 487 #endif 408 488 WRITE_UVLC(sei.m_decodingUnitIdx, "decoding_unit_idx"); 409 if( vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())410 { 411 WRITE_CODE( sei.m_duSptCpbRemovalDelay, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay");489 if(hrd->getSubPicCpbParamsInPicTimingSEIFlag()) 490 { 491 WRITE_CODE( sei.m_duSptCpbRemovalDelay, (hrd->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay"); 412 492 } 413 493 WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); 414 494 if(sei.m_dpbOutputDuDelayPresentFlag) 415 495 { 416 WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 417 } 418 xWriteByteAlign(); 419 } 420 496 WRITE_CODE(sei.m_picSptDpbOutputDuDelay,hrd->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 497 } 498 xWriteByteAlign(); 499 } 500 501 #if VPS_VUI_BSP_HRD_PARAMS 502 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 503 #else 421 504 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps) 505 #endif 422 506 { 423 507 Int i, nalOrVcl; 508 #if VPS_VUI_BSP_HRD_PARAMS 509 TComHRD *hrd; 510 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 511 { 512 assert( nestingSei ); 513 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 514 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 515 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 516 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 517 std::vector<Int> hrdIdx(maxValues, 0); 518 std::vector<TComHRD *> hrdVec; 519 std::vector<Int> syntaxElemLen(maxValues, 0); 520 for(i = 0; i < maxValues; i++) 521 { 522 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 523 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 524 525 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 526 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 527 { 528 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 529 } 530 if( i > 0 ) 531 { 532 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 533 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 534 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 535 } 536 } 537 hrd = hrdVec[i]; 538 } 539 else 540 { 541 TComVUI *vui = sps->getVuiParameters(); 542 hrd = vui->getHrdParameters(); 543 } 544 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 545 #else 424 546 TComVUI *vui = sps->getVuiParameters(); 425 547 TComHRD *hrd = vui->getHrdParameters(); 548 #endif 426 549 427 550 WRITE_UVLC( sei.m_bpSeqParameterSetId, "bp_seq_parameter_set_id" ); … … 462 585 xWriteByteAlign(); 463 586 } 587 #if VPS_VUI_BSP_HRD_PARAMS 588 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 589 #else 464 590 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps) 591 #endif 465 592 { 466 593 Int i; 594 #if VPS_VUI_BSP_HRD_PARAMS 595 TComHRD *hrd; 596 TComVUI *vui = sps->getVuiParameters(); 597 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 598 { 599 assert( nestingSei ); 600 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 601 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 602 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 603 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 604 std::vector<Int> hrdIdx(maxValues, 0); 605 std::vector<TComHRD *> hrdVec; 606 std::vector<Int> syntaxElemLen(maxValues, 0); 607 for(i = 0; i < maxValues; i++) 608 { 609 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 610 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 611 612 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 613 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 614 { 615 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 616 } 617 if( i > 0 ) 618 { 619 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 620 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 621 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 622 assert( hrdVec[i]->getDpbOutputDelayLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayLengthMinus1() ); 623 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 624 assert( hrdVec[i]->getDuCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getDuCpbRemovalDelayLengthMinus1() ); 625 // To be done: Check CpbDpbDelaysPresentFlag 626 } 627 } 628 hrd = hrdVec[0]; 629 } 630 else 631 { 632 hrd = vui->getHrdParameters(); 633 } 634 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 635 #else 467 636 TComVUI *vui = sps->getVuiParameters(); 468 637 TComHRD *hrd = vui->getHrdParameters(); 469 470 if( vui->getFrameFieldInfoPresentFlag() ) 638 #endif 639 640 if( vui->getFrameFieldInfoPresentFlag() ) // To be done: Check whether this is the correct invocation of vui when PT SEI contained in BSP nesting SEI 471 641 { 472 642 WRITE_CODE( sei.m_picStruct, 4, "pic_struct" ); … … 754 924 { 755 925 WRITE_FLAG( sei.m_defaultOpFlag, "default_op_flag" ); 756 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops ");926 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops_minus1" ); 757 927 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 758 928 { 759 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 760 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 929 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id_plus1" ); 761 930 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); 762 931 } … … 767 936 if (!sei.m_allLayersFlag) 768 937 { 769 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id " );770 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" );938 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id_plus1" ); 939 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" ); 771 940 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 772 941 { … … 917 1086 assert(vps->getVpsVuiPresentFlag()); 918 1087 1088 #if VPS_VUI_BSP_HRD_PARAMS 1089 Int psIdx = bspNestingSei.m_seiPartitioningSchemeIdx; 1090 Int seiOlsIdx = bspNestingSei.m_seiOlsIdx; 1091 Int maxTemporalId = nestingSei.m_nestingMaxTemporalIdPlus1[0] - 1; 1092 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 1093 std::vector<Int> hrdIdx(maxValues, 0); 1094 std::vector<TComHRD *> hrdVec; 1095 std::vector<Int> syntaxElemLen(maxValues, 0); 1096 for(Int i = 0; i < maxValues; i++) 1097 { 1098 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei.m_bspIdx); 1099 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 1100 1101 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 1102 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 1103 { 1104 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 1105 } 1106 if( i > 0 ) 1107 { 1108 assert( hrdVec[i]->getNalHrdParametersPresentFlag() == hrdVec[i-1]->getNalHrdParametersPresentFlag() ); 1109 assert( hrdVec[i]->getVclHrdParametersPresentFlag() == hrdVec[i-1]->getVclHrdParametersPresentFlag() ); 1110 } 1111 } 1112 if (hrdVec[0]->getNalHrdParametersPresentFlag()) 1113 { 1114 for(UInt i = 0; i < maxValues; i++) 1115 { 1116 WRITE_CODE( sei.m_nalInitialArrivalDelay[i], syntaxElemLen[i], "nal_initial_arrival_delay[i]" ); 1117 } 1118 } 1119 if( hrdVec[0]->getVclHrdParametersPresentFlag() ) 1120 { 1121 for(UInt i = 0; i < maxValues; i++) 1122 { 1123 WRITE_CODE( sei.m_vclInitialArrivalDelay[i], syntaxElemLen[i], "vcl_initial_arrival_delay[i]" ); 1124 } 1125 } 1126 #else 919 1127 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 920 1128 UInt len; … … 959 1167 } 960 1168 } 1169 #endif 961 1170 } 962 1171 -
branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.h
r856 r894 55 55 protected: 56 56 #if O0164_MULTI_LAYER_HRD 57 #if VPS_VUI_BSP_HRD_PARAMS 58 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei); 59 #else 57 60 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei); 61 #endif 58 62 #else 59 63 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); … … 61 65 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 62 66 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); 67 Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei); 68 #if VPS_VUI_BSP_HRD_PARAMS 69 Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 70 Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 71 Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 72 #else 63 73 Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps); 64 Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei);65 74 Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps); 66 75 Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps); 76 #endif 67 77 TComSPS *m_pSPS; 68 78 Void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r891 r894 1813 1813 if (vps->getVpsVuiBspHrdPresentFlag()) 1814 1814 { 1815 #if VPS_VUI_BSP_HRD_PARAMS 1816 codeVpsVuiBspHrdParams(vps); 1817 #else 1815 1818 WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" ); 1816 1819 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) … … 1856 1859 } 1857 1860 } 1861 #endif 1858 1862 } 1859 1863 #endif … … 3188 3192 } 3189 3193 #endif 3190 3194 #if VPS_VUI_BSP_HRD_PARAMS 3195 Void TEncCavlc::codeVpsVuiBspHrdParams(TComVPS * const vps) 3196 { 3197 WRITE_UVLC( vps->getVpsNumAddHrdParams(), "vps_num_add_hrd_params" ); 3198 for( Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) // j = i - vps->getNumHrdParameters() 3199 { 3200 if( i > 0 ) 3201 { 3202 WRITE_FLAG( vps->getCprmsAddPresentFlag(j), "cprms_add_present_flag[i]" ); 3203 } 3204 WRITE_UVLC( vps->getNumSubLayerHrdMinus1(j), "num_sub_layer_hrd_minus1[i]" ); 3205 codeHrdParameters(vps->getBspHrd(j), i == 0 ? true : vps->getCprmsAddPresentFlag(j), vps->getNumSubLayerHrdMinus1(j)); 3206 } 3207 for( Int h = 1; h < vps->getNumOutputLayerSets(); h++ ) 3208 { 3209 Int lsIdx = vps->getOutputLayerSetIdx( h ); 3210 WRITE_UVLC( vps->getNumSignalledPartitioningSchemes(h), "num_signalled_partitioning_schemes[h]"); 3211 for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) 3212 { 3213 WRITE_UVLC( vps->getNumPartitionsInSchemeMinus1(h, j), "num_partitions_in_scheme_minus1[h][j]" ); 3214 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ ) 3215 { 3216 for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ ) 3217 { 3218 WRITE_FLAG( vps->getLayerIncludedInPartitionFlag(h, j, k, r), "layer_included_in_partition_flag[h][j][k][r]" ); 3219 } 3220 } 3221 } 3222 for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ ) 3223 { 3224 for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ ) 3225 { 3226 WRITE_UVLC(vps->getNumBspSchedulesMinus1(h, i, t), "num_bsp_schedules_minus1[h][i][t]"); 3227 for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 3228 { 3229 for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 3230 { 3231 WRITE_UVLC( vps->getBspHrdIdx(h, i, t, j, k), "bsp_comb_hrd_idx[h][i][t][j][k]"); 3232 WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_comb_sched_idx[h][i][t][j][k]"); 3233 } 3234 } 3235 } 3236 } 3237 } 3238 } 3239 #endif 3191 3240 #endif 3192 3241 //! \} -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h
r877 r894 169 169 Void codeVpsDpbSizeTable (TComVPS *vps); 170 170 #endif 171 #if VPS_VUI_BSP_HRD_PARAMS 172 Void codeVpsVuiBspHrdParams (TComVPS * const); 173 #endif 171 174 #if Q0048_CGS_3D_ASYMLUT 172 175 #if R0179_ENC_OPT_3DLUT_SIZE -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r890 r894 2361 2361 if (pcSlice->getLayerId() == 0 && m_pcEncTop->getVPS()->getVpsVuiBspHrdPresentFlag()) 2362 2362 { 2363 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, 1); 2364 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2365 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2366 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice); 2367 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2368 writeRBSPTrailingBits(nalu.m_Bitstream); 2369 2370 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2371 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 2372 + m_bufferingPeriodSEIPresentInAU 2373 + m_pictureTimingSEIPresentInAU 2374 + m_nestedPictureTimingSEIPresentInAU; // Insert SEI after APS, BP and PT SEI 2375 AccessUnit::iterator it; 2376 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 2377 { 2378 it++; 2379 } 2380 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2363 #if VPS_VUI_BSP_HRD_PARAMS 2364 TComVPS *vps = m_pcEncTop->getVPS(); 2365 for(Int i = 0; i < vps->getNumOutputLayerSets(); i++) 2366 { 2367 for(Int k = 0; k < vps->getNumSignalledPartitioningSchemes(i); k++) 2368 { 2369 for(Int l = 0; l < vps->getNumPartitionsInSchemeMinus1(i, k)+1; l++) 2370 { 2371 #endif 2372 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, 1); 2373 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2374 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2375 #if VPS_VUI_BSP_HRD_PARAMS 2376 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice, i, k, l); 2377 #else 2378 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice); 2379 #endif 2380 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2381 writeRBSPTrailingBits(nalu.m_Bitstream); 2382 2383 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2384 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 2385 + m_bufferingPeriodSEIPresentInAU 2386 + m_pictureTimingSEIPresentInAU 2387 + m_nestedPictureTimingSEIPresentInAU; // Insert SEI after APS, BP and PT SEI 2388 AccessUnit::iterator it; 2389 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 2390 { 2391 it++; 2392 } 2393 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2394 #if VPS_VUI_BSP_HRD_PARAMS 2395 } 2396 } 2397 } 2398 #endif 2381 2399 } 2382 2400 #endif … … 4746 4764 4747 4765 #if O0164_MULTI_LAYER_HRD 4766 #if VPS_VUI_BSP_HRD_PARAMS 4767 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice, Int olsIdx, Int partitioningSchemeIdx, Int bspIdx) 4768 #else 4748 4769 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice) 4770 #endif 4749 4771 { 4750 4772 SEIScalableNesting *seiScalableNesting = new SEIScalableNesting(); … … 4759 4781 seiScalableNesting->m_defaultOpFlag = 0; 4760 4782 seiScalableNesting->m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 4783 #if VPS_VUI_BSP_HRD_PARAMS 4784 seiScalableNesting->m_nestingOpIdx[0] = pcSlice->getVPS()->getOutputLayerSetIdx(olsIdx); 4785 seiScalableNesting->m_nestingMaxTemporalIdPlus1[0] = 6 + 1; 4786 #else 4761 4787 seiScalableNesting->m_nestingOpIdx[0] = 1; 4788 #endif 4762 4789 seiScalableNesting->m_allLayersFlag = 0; 4763 4790 seiScalableNesting->m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 … … 4805 4832 seiBspNesting->m_nestedSEIs.push_back(seiBufferingPeriod); 4806 4833 seiBspNesting->m_nestedSEIs.push_back(seiBspInitialArrivalTime); 4834 #if VPS_VUI_BSP_HRD_PARAMS 4835 seiBspNesting->m_bspIdx = bspIdx; 4836 seiBspNesting->m_seiOlsIdx = olsIdx; 4837 seiBspNesting->m_seiPartitioningSchemeIdx = partitioningSchemeIdx; 4838 #endif 4807 4839 seiScalableNesting->m_nestedSEIs.push_back(seiBspNesting); // BSP nesting SEI is contained in scalable nesting SEI 4808 4840 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
r856 r894 253 253 #endif 254 254 #if O0164_MULTI_LAYER_HRD 255 #if VPS_VUI_BSP_HRD_PARAMS 256 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice, Int olsIdx, Int partitioningSchemeIdx, Int bspIdx); 257 #else 255 258 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice); 259 #endif 256 260 #endif 257 261 #if Q0048_CGS_3D_ASYMLUT -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r873 r894 323 323 /* set the VPS profile information */ 324 324 *m_cVPS.getPTL() = *m_cSPS.getPTL(); 325 #if VPS_VUI_BSP_HRD_PARAMS 326 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( true ); 327 #else 325 328 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( false ); 329 #endif 326 330 // initialize PPS 327 331 m_cPPS.setSPS(&m_cSPS);
Note: See TracChangeset for help on using the changeset viewer.