Changeset 1348 in SHVCSoftware for branches/SHM-dev
- Timestamp:
- 22 Jul 2015, 03:11:09 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
r1337 r1348 2090 2090 } 2091 2091 2092 Void TComSPS::setHrdParameters( UInt frameRate, Bool useSubCpbParams, UInt bitRate, Bool randomAccess )2093 {2094 if( !getVuiParametersPresentFlag() )2095 {2096 return;2097 }2098 2099 TComVUI *vui = getVuiParameters();2100 TComHRD *hrd = vui->getHrdParameters();2101 2102 TimingInfo *timingInfo = vui->getTimingInfo();2103 #if SVC_EXTENSION2104 if( m_layerId > 0 )2105 {2106 timingInfo->setTimingInfoPresentFlag( false );2107 return;2108 }2109 #endif2110 2111 timingInfo->setTimingInfoPresentFlag( true );2112 switch( frameRate )2113 {2114 case 24:2115 timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 );2116 break;2117 case 25:2118 timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 );2119 break;2120 case 30:2121 timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 );2122 break;2123 case 50:2124 timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 );2125 break;2126 case 60:2127 timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 );2128 break;2129 default:2130 timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 );2131 break;2132 }2133 2134 Bool rateCnt = ( bitRate > 0 );2135 hrd->setNalHrdParametersPresentFlag( rateCnt );2136 hrd->setVclHrdParametersPresentFlag( rateCnt );2137 2138 hrd->setSubPicCpbParamsPresentFlag( useSubCpbParams );2139 2140 if( hrd->getSubPicCpbParamsPresentFlag() )2141 {2142 hrd->setTickDivisorMinus2( 100 - 2 ); //2143 hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU )2144 hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );2145 hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay2146 }2147 else2148 {2149 hrd->setSubPicCpbParamsInPicTimingSEIFlag( false );2150 }2151 2152 hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps2153 hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit2154 hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit2155 2156 hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit2157 if( randomAccess )2158 {2159 hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1)2160 hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^62161 }2162 else2163 {2164 hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^102165 hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^102166 }2167 2168 /*2169 Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported.2170 */2171 Int i, j;2172 UInt bitrateValue, cpbSizeValue;2173 UInt duCpbSizeValue;2174 UInt duBitRateValue = 0;2175 2176 for( i = 0; i < MAX_TLAYER; i ++ )2177 {2178 hrd->setFixedPicRateFlag( i, 1 );2179 hrd->setPicDurationInTcMinus1( i, 0 );2180 hrd->setLowDelayHrdFlag( i, 0 );2181 hrd->setCpbCntMinus1( i, 0 );2182 2183 bitrateValue = bitRate;2184 cpbSizeValue = bitRate; // 1 second2185 // DU CPB size could be smaller, but we don't know how2186 // in how many DUs the slice segment settings will result2187 // (used to be: bitRate/numDU)2188 duCpbSizeValue = bitRate;2189 duBitRateValue = bitRate;2190 2191 for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )2192 {2193 hrd->setBitRateValueMinus1( i, j, 0, ( bitrateValue - 1 ) );2194 hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) );2195 hrd->setDuCpbSizeValueMinus1( i, j, 0, ( duCpbSizeValue - 1 ) );2196 hrd->setCbrFlag( i, j, 0, ( j == 0 ) );2197 2198 hrd->setBitRateValueMinus1( i, j, 1, ( bitrateValue - 1) );2199 hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );2200 hrd->setDuCpbSizeValueMinus1( i, j, 1, ( duCpbSizeValue - 1 ) );2201 hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );2202 hrd->setCbrFlag( i, j, 1, ( j == 0 ) );2203 }2204 }2205 }2206 2092 2207 2093 const Int TComSPS::m_winUnitX[]={1,2,2,1}; -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r1336 r1348 1575 1575 TComVUI* getVuiParameters() { return &m_vuiParameters; } 1576 1576 const TComVUI* getVuiParameters() const { return &m_vuiParameters; } 1577 Void setHrdParameters( UInt frameRate, Bool useSubCpbParams, UInt bitRate, Bool randomAccess );1578 1577 const TComPTL* getPTL() const { return &m_pcPTL; } 1579 1578 TComPTL* getPTL() { return &m_pcPTL; } -
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.