Changeset 1433 in SHVCSoftware for branches/SHM-dev/source/App


Ignore:
Timestamp:
11 Aug 2015, 20:22:28 (9 years ago)
Author:
seregin
Message:

port rev 4587 and fixes for the previous commit

Location:
branches/SHM-dev/source/App/TAppEncoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1424 r1433  
    399399};
    400400
     401#if U0132_TARGET_BITS_SATURATION
     402UInt g_uiMaxCpbSize[2][21] =
     403{
     404  //         LEVEL1,        LEVEL2,LEVEL2_1,     LEVEL3, LEVEL3_1,      LEVEL4, LEVEL4_1,       LEVEL5,  LEVEL5_1,  LEVEL5_2,    LEVEL6,  LEVEL6_1,  LEVEL6_2
     405  { 0, 0, 0, 350000, 0, 0, 1500000, 3000000, 0, 6000000, 10000000, 0, 12000000, 20000000, 0,  25000000,  40000000,  60000000,  60000000, 120000000, 240000000 },
     406  { 0, 0, 0,      0, 0, 0,       0,       0, 0,       0,        0, 0, 30000000, 50000000, 0, 100000000, 160000000, 240000000, 240000000, 480000000, 800000000 }
     407};
     408#endif
     409
    401410static const struct MapStrToCostMode
    402411{
     
    826835  Int*    cfg_RCInitialQP          [MAX_LAYERS];
    827836  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
     837
     838#if U0132_TARGET_BITS_SATURATION
     839  Bool*   cfg_RCCpbSaturationEnabled[MAX_LAYERS];
     840  UInt*   cfg_RCCpbSize             [MAX_LAYERS];
     841  Double* cfg_RCInitialCpbFullness  [MAX_LAYERS];
     842#endif
    828843#endif
    829844
     
    916931    cfg_RCInitialQP[layer]           = &m_apcLayerCfg[layer]->m_RCInitialQP;
    917932    cfg_RCForceIntraQP[layer]        = &m_apcLayerCfg[layer]->m_RCForceIntraQP;
     933
     934#if U0132_TARGET_BITS_SATURATION
     935    cfg_RCCpbSaturationEnabled[layer] = &m_apcLayerCfg[layer]->m_RCCpbSaturationEnabled;
     936    cfg_RCCpbSize[layer]              = &m_apcLayerCfg[layer]->m_RCCpbSize;
     937    cfg_RCInitialCpbFullness[layer]   = &m_apcLayerCfg[layer]->m_RCInitialCpbFullness;
     938#endif
    918939#endif
    919940
     
    12481269  ("Profile",                                         extendedProfile,                                   NONE, "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
    12491270  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
    1250   ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)") 
    1251 
     1271  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
    12521272  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    12531273  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     
    14491469  ("InitialQP%d",                                     cfg_RCInitialQP,                         0, m_numLayers, "Rate control: initial QP")
    14501470  ("RCForceIntraQP%d",                                cfg_RCForceIntraQP,                  false, m_numLayers, "Rate control: force intra QP to be equal to initial QP")
     1471#if U0132_TARGET_BITS_SATURATION
     1472  ( "RCCpbSaturation%d",                              cfg_RCCpbSaturationEnabled,          false, m_numLayers, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" )
     1473  ( "RCCpbSize%d",                                    cfg_RCCpbSize,                          0u, m_numLayers, "Rate control: CPB size" )
     1474  ( "RCInitialCpbFullness%d",                         cfg_RCInitialCpbFullness,              0.9, m_numLayers, "Rate control: initial CPB fullness" )
     1475#endif
    14511476#else
    14521477  ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
     
    14571482  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
    14581483  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
     1484#if U0132_TARGET_BITS_SATURATION
     1485  ( "RCCpbSaturation",                                m_RCCpbSaturationEnabled,                         false, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" )
     1486  ( "RCCpbSize",                                      m_RCCpbSize,                                         0u, "Rate control: CPB size" )
     1487  ( "RCInitialCpbFullness",                           m_RCInitialCpbFullness,                             0.9, "Rate control: initial CPB fullness" )
     1488#endif
    14591489#endif
    14601490
     
    41994229      }
    42004230    }
    4201   }
    4202   xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
     4231    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
     4232#if U0132_TARGET_BITS_SATURATION
     4233    Int layerPTLIdx = m_apcLayerCfg[layerIdx]->m_layerPTLIdx;
     4234
     4235    if( m_apcLayerCfg[layerIdx]->m_RCCpbSaturationEnabled && m_levelList[layerPTLIdx]!=Level::NONE && m_profileList[layerPTLIdx]!=Profile::NONE )
     4236    {
     4237      UInt uiLevelIdx = (m_levelList[layerPTLIdx] / 10) + (UInt)((m_levelList[layerPTLIdx] % 10) / 3);    // (m_level / 30)*3 + ((m_level % 10) / 3);
     4238      xConfirmPara( m_apcLayerCfg[layerIdx]->m_RCCpbSize > g_uiMaxCpbSize[m_levelTierList[layerPTLIdx]][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level");
     4239      xConfirmPara( m_apcLayerCfg[layerIdx]->m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1");
     4240    }
     4241#endif
     4242  }
     4243#if U0132_TARGET_BITS_SATURATION
     4244  else
     4245  {
     4246    xConfirmPara( m_apcLayerCfg[layerIdx]->m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" );
     4247  }
     4248#endif
    42034249#else
    42044250  if ( m_RCEnableRateControl )
     
    42134259    }
    42144260    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    4215   }
     4261#if U0132_TARGET_BITS_SATURATION
     4262    if ((m_RCCpbSaturationEnabled) && (m_level!=Level::NONE) && (m_profile!=Profile::NONE))
     4263    {
     4264      UInt uiLevelIdx = (m_level / 10) + (UInt)((m_level % 10) / 3);    // (m_level / 30)*3 + ((m_level % 10) / 3);
     4265      xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level");
     4266      xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1");
     4267    }
     4268#endif
     4269  }
     4270#if U0132_TARGET_BITS_SATURATION
     4271  else
     4272  {
     4273    xConfirmPara( m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" );
     4274  }
     4275#endif
    42164276#endif
    42174277
     
    45044564    printf("InitialQP                              : %d\n", m_RCInitialQP );
    45054565    printf("ForceIntraQP                           : %d\n", m_RCForceIntraQP );
     4566#if U0132_TARGET_BITS_SATURATION
     4567    printf("CpbSaturation                          : %d\n", m_RCCpbSaturationEnabled );
     4568    if (m_RCCpbSaturationEnabled)
     4569    {
     4570      printf("CpbSize                                : %d\n", m_RCCpbSize);
     4571      printf("InitalCpbFullness                      : %.2f\n", m_RCInitialCpbFullness);
     4572    }
     4573#endif
    45064574  }
    45074575#endif
     
    45714639
    45724640  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    4573   printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
     4641  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    45744642
    45754643#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1424 r1433  
    407407  Int       m_RCInitialQP;                        ///< inital QP for rate control
    408408  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
     409#if U0132_TARGET_BITS_SATURATION
     410  Bool      m_RCCpbSaturationEnabled;             ///< enable target bits saturation to avoid CPB overflow and underflow
     411  UInt      m_RCCpbSize;                          ///< CPB size
     412  Double    m_RCInitialCpbFullness;               ///< initial CPB fullness
     413#endif
    409414#endif
    410415#if !SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r1381 r1433  
    266266    printf("InitialQP                         : %d\n", m_RCInitialQP );
    267267    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
     268#if U0132_TARGET_BITS_SATURATION
     269    printf("CpbSaturation                          : %d\n", m_RCCpbSaturationEnabled );
     270    if (m_RCCpbSaturationEnabled)
     271    {
     272      printf("CpbSize                                : %d\n", m_RCCpbSize);
     273      printf("InitalCpbFullness                      : %.2f\n", m_RCInitialCpbFullness);
     274    }
     275#endif
    268276  }
    269277#endif
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r1381 r1433  
    8585  Int       m_RCInitialQP;                        ///< inital QP for rate control
    8686  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
     87#if U0132_TARGET_BITS_SATURATION
     88  Bool      m_RCCpbSaturationEnabled;             ///< enable target bits saturation to avoid CPB overflow and underflow
     89  UInt      m_RCCpbSize;                          ///< CPB size
     90  Double    m_RCInitialCpbFullness;               ///< initial CPB fullness
     91#endif
    8792#endif
    8893
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1432 r1433  
    493493    Int           m_RCInitialQP                                = m_apcLayerCfg[layer]->getRCInitialQP();
    494494    Bool          m_RCForceIntraQP                             = m_apcLayerCfg[layer]->getRCForceIntraQP();
     495
     496#if U0132_TARGET_BITS_SATURATION
     497    Bool          m_RCCpbSaturationEnabled                     = m_apcLayerCfg[layer]->m_RCCpbSaturationEnabled;
     498    UInt          m_RCCpbSize                                  = m_apcLayerCfg[layer]->m_RCCpbSize;
     499    Double        m_RCInitialCpbFullness                       = m_apcLayerCfg[layer]->m_RCInitialCpbFullness;
     500#endif
    495501
    496502    ScalingListMode m_useScalingListId                         = m_apcLayerCfg[layer]->m_useScalingListId;
     
    789795  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
    790796  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
     797#if U0132_TARGET_BITS_SATURATION
     798  m_cTEncTop.setCpbSaturationEnabled                              ( m_RCCpbSaturationEnabled );
     799  m_cTEncTop.setCpbSize                                           ( m_RCCpbSize );
     800  m_cTEncTop.setInitialCpbFullness                                ( m_RCInitialCpbFullness );
     801#endif
    791802  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
    792803  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
Note: See TracChangeset for help on using the changeset viewer.