Changeset 1348 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 22 Jul 2015, 03:11:09 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1344 r1348 1008 1008 if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() ) 1009 1009 { 1010 Bool useDUParameters = (getSliceMode() > 0) || (getSliceSegmentMode() > 0); 1011 m_cSPS.setHrdParameters( getFrameRate(), useDUParameters, getTargetBitrate(), ( getIntraPeriod() > 0 ) ); 1010 xInitHrdParameters(); 1012 1011 } 1013 1012 if( getBufferingPeriodSEIEnabled() || getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() ) … … 1028 1027 m_cSPS.getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag(m_persistentRiceAdaptationEnabledFlag); 1029 1028 m_cSPS.getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag(m_cabacBypassAlignmentEnabledFlag); 1029 } 1030 1031 Void TEncTop::xInitHrdParameters() 1032 { 1033 Bool useSubCpbParams = (getSliceMode() > 0) || (getSliceSegmentMode() > 0); 1034 Int bitRate = getTargetBitrate(); 1035 Bool isRandomAccess = getIntraPeriod() > 0; 1036 1037 if( !getVuiParametersPresentFlag() ) 1038 { 1039 return; 1040 } 1041 1042 TComVUI *vui = m_cSPS.getVuiParameters(); 1043 TComHRD *hrd = vui->getHrdParameters(); 1044 1045 TimingInfo *timingInfo = vui->getTimingInfo(); 1046 1047 #if SVC_EXTENSION 1048 if( m_layerId > 0 ) 1049 { 1050 timingInfo->setTimingInfoPresentFlag( false ); 1051 return; 1052 } 1053 #endif 1054 1055 timingInfo->setTimingInfoPresentFlag( true ); 1056 switch( getFrameRate() ) 1057 { 1058 case 24: 1059 timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 ); 1060 break; 1061 case 25: 1062 timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 ); 1063 break; 1064 case 30: 1065 timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 ); 1066 break; 1067 case 50: 1068 timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 ); 1069 break; 1070 case 60: 1071 timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 ); 1072 break; 1073 default: 1074 timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 ); 1075 break; 1076 } 1077 1078 Bool rateCnt = ( bitRate > 0 ); 1079 hrd->setNalHrdParametersPresentFlag( rateCnt ); 1080 hrd->setVclHrdParametersPresentFlag( rateCnt ); 1081 1082 hrd->setSubPicCpbParamsPresentFlag( useSubCpbParams ); 1083 1084 if( hrd->getSubPicCpbParamsPresentFlag() ) 1085 { 1086 hrd->setTickDivisorMinus2( 100 - 2 ); // 1087 hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) 1088 hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); 1089 hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay 1090 } 1091 else 1092 { 1093 hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); 1094 } 1095 1096 hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps 1097 hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit 1098 hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit 1099 1100 hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit 1101 if( isRandomAccess ) 1102 { 1103 hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) 1104 hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 1105 } 1106 else 1107 { 1108 hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10 1109 hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10 1110 } 1111 1112 // Note: parameters for all temporal layers are initialized with the same values 1113 Int i, j; 1114 UInt bitrateValue, cpbSizeValue; 1115 UInt duCpbSizeValue; 1116 UInt duBitRateValue = 0; 1117 1118 for( i = 0; i < MAX_TLAYER; i ++ ) 1119 { 1120 hrd->setFixedPicRateFlag( i, 1 ); 1121 hrd->setPicDurationInTcMinus1( i, 0 ); 1122 hrd->setLowDelayHrdFlag( i, 0 ); 1123 hrd->setCpbCntMinus1( i, 0 ); 1124 1125 bitrateValue = bitRate; 1126 cpbSizeValue = bitRate; // 1 second 1127 // DU CPB size could be smaller, but we don't know how 1128 // in how many DUs the slice segment settings will result 1129 // (used to be: bitRate/numDU) 1130 duCpbSizeValue = bitRate; 1131 duBitRateValue = bitRate; 1132 1133 for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) 1134 { 1135 hrd->setBitRateValueMinus1( i, j, 0, ( bitrateValue - 1 ) ); 1136 hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); 1137 hrd->setDuCpbSizeValueMinus1( i, j, 0, ( duCpbSizeValue - 1 ) ); 1138 hrd->setCbrFlag( i, j, 0, ( j == 0 ) ); 1139 1140 hrd->setBitRateValueMinus1( i, j, 1, ( bitrateValue - 1) ); 1141 hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); 1142 hrd->setDuCpbSizeValueMinus1( i, j, 1, ( duCpbSizeValue - 1 ) ); 1143 hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); 1144 hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); 1145 } 1146 } 1030 1147 } 1031 1148 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h
r1307 r1348 150 150 Void xInitSPS (); ///< initialize SPS from encoder options 151 151 Void xInitPPS (); ///< initialize PPS from encoder options 152 Void xInitScalingLists(); ///< initialize scaling lists 152 Void xInitScalingLists (); ///< initialize scaling lists 153 Void xInitHrdParameters(); ///< initialize HRD parameters 153 154 154 155 Void xInitPPSforTiles ();
Note: See TracChangeset for help on using the changeset viewer.