Changeset 628 in SHVCSoftware for branches/SHM-5.1-dev/source/Lib/TLibEncoder
- Timestamp:
- 14 Mar 2014, 15:29:06 (12 years ago)
- Location:
- branches/SHM-5.1-dev/source/Lib/TLibEncoder
- Files:
-
- 5 edited
-
SEIwrite.cpp (modified) (11 diffs)
-
SEIwrite.h (modified) (3 diffs)
-
TEncCavlc.cpp (modified) (1 diff)
-
TEncGOP.cpp (modified) (19 diffs)
-
TEncGOP.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-5.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r616 r628 105 105 #endif 106 106 #if SUB_BITSTREAM_PROPERTY_SEI 107 case SEI::SUB_BITSTREAM_PROPERTY: 108 fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n"); 109 break; 107 case SEI::SUB_BITSTREAM_PROPERTY: 108 fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n"); 109 break; 110 #endif 111 #if O0164_MULTI_LAYER_HRD 112 case SEI::BSP_NESTING: 113 fprintf( g_hTrace, "=========== Bitstream partition nesting SEI message ===========\n"); 114 break; 115 case SEI::BSP_INITIAL_ARRIVAL_TIME: 116 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 117 break; 118 case SEI::BSP_HRD: 119 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 120 break; 110 121 #endif 111 122 #endif //SVC_EXTENSION … … 117 128 #endif 118 129 130 #if O0164_MULTI_LAYER_HRD 131 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei) 132 #else 119 133 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 134 #endif 120 135 { 121 136 switch (sei.payloadType()) … … 161 176 break; 162 177 case SEI::SCALABLE_NESTING: 178 #if O0164_MULTI_LAYER_HRD 179 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), vps, sps); 180 #else 163 181 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 182 #endif 164 183 break; 165 184 #if SVC_EXTENSION … … 179 198 break; 180 199 #endif 200 #if O0164_MULTI_LAYER_HRD 201 case SEI::BSP_NESTING: 202 xWriteSEIBspNesting(bs, *static_cast<const SEIBspNesting*>(&sei), vps, sps, nestingSei); 203 break; 204 case SEI::BSP_INITIAL_ARRIVAL_TIME: 205 xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei), vps, sps, nestingSei, bspNestingSei); 206 break; 207 case SEI::BSP_HRD: 208 xWriteSEIBspHrd(*static_cast<const SEIBspHrd*>(&sei), sps, nestingSei); 209 break; 210 #endif 181 211 #endif //SVC_EXTENSION 182 212 default: … … 189 219 * in bitstream bs. 190 220 */ 221 #if O0164_MULTI_LAYER_HRD 222 Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei) 223 #else 191 224 Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps) 225 #endif 192 226 { 193 227 /* calculate how large the payload data is */ … … 202 236 g_HLSTraceEnable = false; 203 237 #endif 238 #if O0164_MULTI_LAYER_HRD 239 xWriteSEIpayloadData(bs_count, sei, vps, sps, *nestingSei, *bspNestingSei); 240 #else 204 241 xWriteSEIpayloadData(bs_count, sei, sps); 242 #endif 205 243 #if ENC_DEC_TRACE 206 244 g_HLSTraceEnable = traceEnable; … … 237 275 #endif 238 276 277 #if O0164_MULTI_LAYER_HRD 278 xWriteSEIpayloadData(bs, sei, vps, sps, *nestingSei, *bspNestingSei); 279 #else 239 280 xWriteSEIpayloadData(bs, sei, sps); 281 #endif 240 282 } 241 283 … … 577 619 } 578 620 621 #if O0164_MULTI_LAYER_HRD 622 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps) 623 #else 579 624 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 625 #endif 580 626 { 581 627 WRITE_FLAG( sei.m_bitStreamSubsetFlag, "bitstream_subset_flag" ); … … 587 633 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 588 634 { 589 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );590 635 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 591 636 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); … … 615 660 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) 616 661 { 662 #if O0164_MULTI_LAYER_HRD 663 writeSEImessage(bs, *(*it), vps, sps, &sei); 664 #else 617 665 writeSEImessage(bs, *(*it), sps); 666 #endif 618 667 } 619 668 } … … 699 748 } 700 749 #endif 750 751 #if O0164_MULTI_LAYER_HRD 752 Void SEIWriter::xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei) 753 { 754 WRITE_UVLC( sei.m_bspIdx, "bsp_idx" ); 755 756 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) 757 { 758 WRITE_FLAG( 0, "bsp_nesting_zero_bit" ); 759 } 760 761 // write nested SEI messages 762 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) 763 { 764 writeSEImessage(bs, *(*it), vps, sps, &nestingSei, &sei); 765 } 766 } 767 768 Void SEIWriter::xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei) 769 { 770 assert(vps->getVpsVuiPresentFlag()); 771 772 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 773 UInt len; 774 UInt hrdIdx; 775 776 if (schedCombCnt > 0) 777 { 778 hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx); 779 } 780 else 781 { 782 hrdIdx = 0; 783 } 784 785 TComHRD *hrd = vps->getBspHrd(hrdIdx); 786 787 if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag()) 788 { 789 len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1; 790 } 791 else 792 { 793 len = 23 + 1; 794 } 795 796 if (hrd->getNalHrdParametersPresentFlag()) 797 { 798 for(UInt i = 0; i < schedCombCnt; i++) 799 { 800 WRITE_CODE( sei.m_nalInitialArrivalDelay[i], len, "nal_initial_arrival_delay" ); 801 } 802 } 803 else 804 { 805 for(UInt i = 0; i < schedCombCnt; i++) 806 { 807 WRITE_CODE( sei.m_vclInitialArrivalDelay[i], len, "vcl_initial_arrival_delay" ); 808 } 809 } 810 } 811 812 Void SEIWriter::xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei) 813 { 814 WRITE_UVLC( sei.m_seiNumBspHrdParametersMinus1, "sei_num_bsp_hrd_parameters_minus1" ); 815 for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++) 816 { 817 if (i > 0) 818 { 819 WRITE_FLAG( sei.m_seiBspCprmsPresentFlag[i], "sei_bsp_cprms_present_flag" ); 820 } 821 xCodeHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1); 822 } 823 for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++) 824 { 825 UInt lsIdx = nestingSei.m_nestingOpIdx[h]; 826 WRITE_UVLC( sei.m_seiNumBitstreamPartitionsMinus1[lsIdx], "num_sei_bitstream_partitions_minus1[i]"); 827 for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++) 828 { 829 for (UInt j = 0; j < sei.m_vpsMaxLayers; j++) 830 { 831 if (sei.m_layerIdIncludedFlag[lsIdx][j]) 832 { 833 WRITE_FLAG( sei.m_seiLayerInBspFlag[lsIdx][i][j], "sei_layer_in_bsp_flag[lsIdx][i][j]" ); 834 } 835 } 836 } 837 WRITE_UVLC( sei.m_seiNumBspSchedCombinationsMinus1[lsIdx], "sei_num_bsp_sched_combinations_minus1[i]"); 838 for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++) 839 { 840 for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++) 841 { 842 WRITE_UVLC( sei.m_seiBspCombHrdIdx[lsIdx][i][j], "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); 843 WRITE_UVLC( sei.m_seiBspCombScheddx[lsIdx][i][j], "sei_bsp_comb_sched_idx[lsIdx][i][j]"); 844 } 845 } 846 } 847 } 848 849 Void SEIWriter::xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ) 850 { 851 if( commonInfPresentFlag ) 852 { 853 WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); 854 WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); 855 if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) 856 { 857 WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "sub_pic_cpb_params_present_flag" ); 858 if( hrd->getSubPicCpbParamsPresentFlag() ) 859 { 860 WRITE_CODE( hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2" ); 861 WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1" ); 862 WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); 863 WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); 864 } 865 WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); 866 WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); 867 if( hrd->getSubPicCpbParamsPresentFlag() ) 868 { 869 WRITE_CODE( hrd->getDuCpbSizeScale(), 4, "du_cpb_size_scale" ); 870 } 871 WRITE_CODE( hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1" ); 872 WRITE_CODE( hrd->getCpbRemovalDelayLengthMinus1(), 5, "au_cpb_removal_delay_length_minus1" ); 873 WRITE_CODE( hrd->getDpbOutputDelayLengthMinus1(), 5, "dpb_output_delay_length_minus1" ); 874 } 875 } 876 Int i, j, nalOrVcl; 877 for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) 878 { 879 WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0, "fixed_pic_rate_general_flag"); 880 if( !hrd->getFixedPicRateFlag( i ) ) 881 { 882 WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag"); 883 } 884 else 885 { 886 hrd->setFixedPicRateWithinCvsFlag( i, true ); 887 } 888 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 889 { 890 WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); 891 } 892 else 893 { 894 WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag"); 895 } 896 if (!hrd->getLowDelayHrdFlag( i )) 897 { 898 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); 899 } 900 901 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 902 { 903 if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || 904 ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) 905 { 906 for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) 907 { 908 WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1"); 909 WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1"); 910 if( hrd->getSubPicCpbParamsPresentFlag() ) 911 { 912 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 913 WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); 914 } 915 WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); 916 } 917 } 918 } 919 } 920 } 921 922 #endif 923 701 924 #endif //SVC_EXTENSION 702 925 -
branches/SHM-5.1-dev/source/Lib/TLibEncoder/SEIwrite.h
r595 r628 47 47 virtual ~SEIWriter() {}; 48 48 49 #if O0164_MULTI_LAYER_HRD 50 void writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei=NULL, const SEIBspNesting* bspNestingSei=NULL); 51 #else 49 52 void writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps); 53 #endif 50 54 51 55 protected: 56 #if O0164_MULTI_LAYER_HRD 57 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei); 58 #else 52 59 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 60 #endif 53 61 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 62 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 65 73 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 66 74 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 75 #if O0164_MULTI_LAYER_HRD 76 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps); 77 #else 67 78 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 79 #endif 68 80 Void xWriteByteAlign(); 69 81 #if SVC_EXTENSION … … 77 89 Void xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei); 78 90 #endif 91 #if O0164_MULTI_LAYER_HRD 92 Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei); 93 Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei); 94 Void xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei); 95 Void xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ); 96 #endif 79 97 #endif //SVC_EXTENSION 80 98 }; -
branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r627 r628 1523 1523 #endif 1524 1524 #endif 1525 #if O0164_MULTI_LAYER_HRD 1526 WRITE_FLAG(vps->getVpsVuiBspHrdPresentFlag(), "vps_vui_bsp_hrd_present_flag" ); 1527 if (vps->getVpsVuiBspHrdPresentFlag()) 1528 { 1529 WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" ); 1530 for (UInt i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++) 1531 { 1532 if (i > 0) 1533 { 1534 WRITE_FLAG( vps->getBspCprmsPresentFlag(i), "bsp_cprms_present_flag[i]" ); 1535 } 1536 codeHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 1537 } 1538 for (UInt h = 1; h <= (vps->getNumLayerSets()-1); h++) 1539 { 1540 WRITE_UVLC( vps->getNumBitstreamPartitions(h), "num_bitstream_partitions[i]"); 1541 for (UInt i = 0; i < vps->getNumBitstreamPartitions(h); i++) 1542 { 1543 for (UInt j = 0; j <= (vps->getMaxLayers()-1); j++) 1544 { 1545 if (vps->getLayerIdIncludedFlag(h, j)) 1546 { 1547 WRITE_FLAG( vps->getLayerInBspFlag(h, i, j), "layer_in_bsp_flag[h][i][j]" ); 1548 } 1549 } 1550 } 1551 if (vps->getNumBitstreamPartitions(h)) 1552 { 1553 WRITE_UVLC( vps->getNumBspSchedCombinations(h), "num_bsp_sched_combinations[h]"); 1554 for (UInt i = 0; i < vps->getNumBspSchedCombinations(h); i++) 1555 { 1556 for (UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++) 1557 { 1558 WRITE_UVLC( vps->getBspCombHrdIdx(h, i, j), "bsp_comb_hrd_idx[h][i][j]"); 1559 WRITE_UVLC( vps->getBspCombSchedIdx(h, i, j), "bsp_comb_sched_idx[h][i][j]"); 1560 } 1561 } 1562 } 1563 } 1564 } 1565 #endif 1525 1566 #if P0182_VPS_VUI_PS_FLAG 1526 1567 for(i = 1; i < vps->getMaxLayers(); i++) -
branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r627 r628 303 303 //nalu = NALUnit(NAL_UNIT_SEI); 304 304 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 305 #if O0164_MULTI_LAYER_HRD 306 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 307 #else 305 308 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 309 #endif 306 310 writeRBSPTrailingBits(nalu.m_Bitstream); 307 311 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 316 320 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 317 321 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 322 #if O0164_MULTI_LAYER_HRD 323 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 324 #else 318 325 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 326 #endif 319 327 writeRBSPTrailingBits(nalu.m_Bitstream); 320 328 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 327 335 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 328 336 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 337 #if O0164_MULTI_LAYER_HRD 338 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 339 #else 329 340 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 341 #endif 330 342 writeRBSPTrailingBits(nalu.m_Bitstream); 331 343 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 338 350 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 339 351 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 352 #if O0164_MULTI_LAYER_HRD 353 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 354 #else 340 355 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 356 #endif 341 357 writeRBSPTrailingBits(nalu.m_Bitstream); 342 358 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 350 366 SEILayersNotPresent *sei = xCreateSEILayersNotPresent (); 351 367 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 368 #if O0164_MULTI_LAYER_HRD 369 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 370 #else 352 371 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 372 #endif 353 373 writeRBSPTrailingBits(nalu.m_Bitstream); 354 374 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 364 384 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_pcCfg->getNumLayer()-1); // For highest layer 365 385 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 386 #if O0164_MULTI_LAYER_HRD 387 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 388 #else 366 389 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 390 #endif 367 391 writeRBSPTrailingBits(nalu.m_Bitstream); 368 392 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1735 1759 xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS()); 1736 1760 1761 #if O0164_MULTI_LAYER_HRD 1762 if (pcSlice->getLayerId() == 0 && m_pcEncTop->getVPS()->getVpsVuiBspHrdPresentFlag()) 1763 { 1764 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, 0, 1); 1765 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1766 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 1767 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice); 1768 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS()); 1769 writeRBSPTrailingBits(nalu.m_Bitstream); 1770 1771 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1772 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 1773 + m_bufferingPeriodSEIPresentInAU 1774 + m_pictureTimingSEIPresentInAU 1775 + m_nestedPictureTimingSEIPresentInAU; // Insert SEI after APS, BP and PT SEI 1776 AccessUnit::iterator it; 1777 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1778 { 1779 it++; 1780 } 1781 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1782 } 1783 #endif 1784 1737 1785 m_bSeqFirst = false; 1738 1786 } … … 1769 1817 SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1; 1770 1818 1819 #if O0164_MULTI_LAYER_HRD 1820 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 1821 #else 1771 1822 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS()); 1823 #endif 1772 1824 writeRBSPTrailingBits(nalu.m_Bitstream); 1773 1825 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1853 1905 sei_buffering_period.m_dpbDelayOffset = 0; 1854 1906 1907 #if O0164_MULTI_LAYER_HRD 1908 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, m_pcEncTop->getVPS(), pcSlice->getSPS()); 1909 #else 1855 1910 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS()); 1911 #endif 1856 1912 writeRBSPTrailingBits(nalu.m_Bitstream); 1857 1913 { … … 1874 1930 scalableNestingSEI.m_nestedSEIs.clear(); 1875 1931 scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period); 1932 #if O0164_MULTI_LAYER_HRD 1933 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 1934 #else 1876 1935 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1936 #endif 1877 1937 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1878 1938 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); … … 1903 1963 seiGradualDecodingRefreshInfo.m_gdrForegroundFlag = true; // Indicating all "foreground" 1904 1964 1965 #if O0164_MULTI_LAYER_HRD 1966 m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, m_pcEncTop->getVPS(), pcSlice->getSPS() ); 1967 #else 1905 1968 m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, pcSlice->getSPS() ); 1969 #endif 1906 1970 writeRBSPTrailingBits(nalu.m_Bitstream); 1907 1971 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1921 1985 sei_recovery_point.m_brokenLinkFlag = false; 1922 1986 1987 #if O0164_MULTI_LAYER_HRD 1988 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, m_pcEncTop->getVPS(), pcSlice->getSPS() ); 1989 #else 1923 1990 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, pcSlice->getSPS() ); 1991 #endif 1924 1992 writeRBSPTrailingBits(nalu.m_Bitstream); 1925 1993 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 2288 2356 /* write the SEI messages */ 2289 2357 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2358 #if O0164_MULTI_LAYER_HRD 2359 m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2360 #else 2290 2361 m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, pcSlice->getSPS()); 2362 #endif 2291 2363 writeRBSPTrailingBits(nalu.m_Bitstream); 2292 2364 … … 2312 2384 /* write the SEI messages */ 2313 2385 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2386 #if O0164_MULTI_LAYER_HRD 2387 m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2388 #else 2314 2389 m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, pcSlice->getSPS()); 2390 #endif 2315 2391 writeRBSPTrailingBits(nalu.m_Bitstream); 2316 2392 … … 2462 2538 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2463 2539 pictureTimingSEI.m_picStruct = (isField && pcSlice->getPic()->isTopField())? 1 : isField? 2 : 0; 2540 #if O0164_MULTI_LAYER_HRD 2541 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2542 #else 2464 2543 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); 2544 #endif 2465 2545 writeRBSPTrailingBits(nalu.m_Bitstream); 2466 2546 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); … … 2481 2561 scalableNestingSEI.m_nestedSEIs.clear(); 2482 2562 scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI); 2563 #if O0164_MULTI_LAYER_HRD 2564 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2565 #else 2483 2566 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 2567 #endif 2484 2568 writeRBSPTrailingBits(nalu.m_Bitstream); 2485 2569 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); … … 2513 2597 { 2514 2598 // Insert before the first slice. 2599 #if O0164_MULTI_LAYER_HRD 2600 m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2601 #else 2515 2602 m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS()); 2603 #endif 2516 2604 writeRBSPTrailingBits(nalu.m_Bitstream); 2517 2605 … … 2535 2623 { 2536 2624 // Insert before the first slice. 2625 #if O0164_MULTI_LAYER_HRD 2626 m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2627 #else 2537 2628 m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS()); 2629 #endif 2538 2630 writeRBSPTrailingBits(nalu.m_Bitstream); 2539 2631 … … 3671 3763 } 3672 3764 #endif 3765 3766 #if O0164_MULTI_LAYER_HRD 3767 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice) 3768 { 3769 SEIScalableNesting *seiScalableNesting = new SEIScalableNesting(); 3770 SEIBspInitialArrivalTime *seiBspInitialArrivalTime = new SEIBspInitialArrivalTime(); 3771 SEIBspNesting *seiBspNesting = new SEIBspNesting(); 3772 SEIBufferingPeriod *seiBufferingPeriod = new SEIBufferingPeriod(); 3773 3774 // Scalable nesting SEI 3775 3776 seiScalableNesting->m_bitStreamSubsetFlag = 1; // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1 3777 seiScalableNesting->m_nestingOpFlag = 1; 3778 seiScalableNesting->m_defaultOpFlag = 0; 3779 seiScalableNesting->m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 3780 seiScalableNesting->m_nestingOpIdx[0] = 1; 3781 seiScalableNesting->m_allLayersFlag = 0; 3782 seiScalableNesting->m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 3783 seiScalableNesting->m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1 3784 seiScalableNesting->m_nestingLayerId[0] = 0; 3785 seiScalableNesting->m_callerOwnsSEIs = true; 3786 3787 // Bitstream partition nesting SEI 3788 3789 seiBspNesting->m_bspIdx = 0; 3790 seiBspNesting->m_callerOwnsSEIs = true; 3791 3792 // Buffering period SEI 3793 3794 UInt uiInitialCpbRemovalDelay = (90000/2); // 0.5 sec 3795 seiBufferingPeriod->m_initialCpbRemovalDelay [0][0] = uiInitialCpbRemovalDelay; 3796 seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][0] = uiInitialCpbRemovalDelay; 3797 seiBufferingPeriod->m_initialCpbRemovalDelay [0][1] = uiInitialCpbRemovalDelay; 3798 seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; 3799 3800 Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale(); 3801 3802 UInt uiTmp = (UInt)( dTmp * 90000.0 ); 3803 uiInitialCpbRemovalDelay -= uiTmp; 3804 uiInitialCpbRemovalDelay -= uiTmp / ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2 ); 3805 seiBufferingPeriod->m_initialAltCpbRemovalDelay [0][0] = uiInitialCpbRemovalDelay; 3806 seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][0] = uiInitialCpbRemovalDelay; 3807 seiBufferingPeriod->m_initialAltCpbRemovalDelay [0][1] = uiInitialCpbRemovalDelay; 3808 seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; 3809 3810 seiBufferingPeriod->m_rapCpbParamsPresentFlag = 0; 3811 //for the concatenation, it can be set to one during splicing. 3812 seiBufferingPeriod->m_concatenationFlag = 0; 3813 //since the temporal layer HRD is not ready, we assumed it is fixed 3814 seiBufferingPeriod->m_auCpbRemovalDelayDelta = 1; 3815 seiBufferingPeriod->m_cpbDelayOffset = 0; 3816 seiBufferingPeriod->m_dpbDelayOffset = 0; 3817 3818 // Intial arrival time SEI message 3819 3820 seiBspInitialArrivalTime->m_nalInitialArrivalDelay[0] = 0; 3821 seiBspInitialArrivalTime->m_vclInitialArrivalDelay[0] = 0; 3822 3823 3824 seiBspNesting->m_nestedSEIs.push_back(seiBufferingPeriod); 3825 seiBspNesting->m_nestedSEIs.push_back(seiBspInitialArrivalTime); 3826 seiScalableNesting->m_nestedSEIs.push_back(seiBspNesting); // BSP nesting SEI is contained in scalable nesting SEI 3827 3828 return seiScalableNesting; 3829 } 3830 #endif 3831 3673 3832 #endif //SVC_EXTENSION 3674 3833 -
branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncGOP.h
r595 r628 211 211 SEIInterLayerConstrainedTileSets* xCreateSEIInterLayerConstrainedTileSets(); 212 212 #endif 213 #if O0164_MULTI_LAYER_HRD 214 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice); 215 #endif 213 216 #endif //SVC_EXTENSION 214 217 };// END CLASS DEFINITION TEncGOP
Note: See TracChangeset for help on using the changeset viewer.