Changeset 1348 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
22 Jul 2015, 03:11:09 (10 years ago)
Author:
seregin
Message:

port rev 4426

Location:
branches/SHM-dev/source/Lib/TLibCommon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r1337 r1348  
    20902090}
    20912091
    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_EXTENSION
    2104   if( m_layerId > 0 )
    2105   {
    2106     timingInfo->setTimingInfoPresentFlag( false );
    2107     return;
    2108   }
    2109 #endif
    2110 
    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 delay
    2146   }
    2147   else
    2148   {
    2149     hrd->setSubPicCpbParamsInPicTimingSEIFlag( false );
    2150   }
    2151 
    2152   hrd->setBitRateScale( 4 );                                       // in units of 2~( 6 + 4 ) = 1,024 bps
    2153   hrd->setCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
    2154   hrd->setDuCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
    2155 
    2156   hrd->setInitialCpbRemovalDelayLengthMinus1(15);                  // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit
    2157   if( randomAccess )
    2158   {
    2159     hrd->setCpbRemovalDelayLengthMinus1(5);                        // 32 = 2^5 (plus 1)
    2160     hrd->setDpbOutputDelayLengthMinus1 (5);                        // 32 + 3 = 2^6
    2161   }
    2162   else
    2163   {
    2164     hrd->setCpbRemovalDelayLengthMinus1(9);                        // max. 2^10
    2165     hrd->setDpbOutputDelayLengthMinus1 (9);                        // max. 2^10
    2166   }
    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 second
    2185     // DU CPB size could be smaller, but we don't know how
    2186     // in how many DUs the slice segment settings will result
    2187     // (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 }
    22062092
    22072093const Int TComSPS::m_winUnitX[]={1,2,2,1};
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r1336 r1348  
    15751575  TComVUI*               getVuiParameters()                                                              { return &m_vuiParameters;                                             }
    15761576  const TComVUI*         getVuiParameters() const                                                        { return &m_vuiParameters;                                             }
    1577   Void                   setHrdParameters( UInt frameRate, Bool useSubCpbParams, UInt bitRate, Bool randomAccess );
    15781577  const TComPTL*         getPTL() const                                                                  { return &m_pcPTL;                                                     }
    15791578  TComPTL*               getPTL()                                                                        { return &m_pcPTL;                                                     }
Note: See TracChangeset for help on using the changeset viewer.