Changeset 644 in SHVCSoftware for trunk/source/App/TAppEncoder


Ignore:
Timestamp:
25 Mar 2014, 21:51:30 (11 years ago)
Author:
seregin
Message:

merge with SHM-5.1-dev branch

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r595 r644  
    385385  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
    386386  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
     387#if P0312_VERT_PHASE_ADJ
     388  string    cfg_vertPhasePositionEnableFlag[MAX_LAYERS];
     389#endif
    387390
    388391#if O0098_SCALED_REF_LAYER_ID
     
    393396  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    394397  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
     398#if P0312_VERT_PHASE_ADJ
     399  string*    cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS];
     400#endif
     401
    395402#if RC_SHVC_HARMONIZATION
    396403  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    451458    {
    452459#if O0098_SCALED_REF_LAYER_ID
    453       cfg_scaledRefLayerIdPtr          [layer] = &cfg_scaledRefLayerId[layer]          ;
    454 #endif
    455       cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer]  ;
    456       cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer]   ;
    457       cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ;
     460      cfg_scaledRefLayerIdPtr          [layer] = &cfg_scaledRefLayerId[layer];
     461#endif
     462      cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer];
     463      cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer];
     464      cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer];
    458465      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
     466#if P0312_VERT_PHASE_ADJ
     467      cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer];
     468#endif
    459469    }
    460470#if RC_SHVC_HARMONIZATION
     
    569579                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    570580  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    571                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
     581  " bottom-right luma sample of the EL picture, in units of two luma samples")
     582#if P0312_VERT_PHASE_ADJ
     583  ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
     584#endif
    572585#if O0194_DIFFERENT_BITDEPTH_EL_BL
    573586  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     
    588601#if N0147_IRAP_ALIGN_FLAG
    589602  ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) 
     603#endif
     604#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     605  ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) 
    590606#endif
    591607#if O0194_WEIGHTED_PREDICTION_CGS
     
    714730  ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
    715731  ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
    716   ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7")
    717732#endif
    718733
     
    10701085      assert( strcmp(cfg_scaledRefLayerId[layer].c_str(),  ""));
    10711086#endif
     1087#if P0312_VERT_PHASE_ADJ
    10721088      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
    10731089              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
    10741090              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
    1075               strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"")
    1076             );
     1091              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") ||
     1092              strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),"") );
     1093#else
     1094      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
     1095              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
     1096              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
     1097              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") );
     1098#endif
    10771099    }
    10781100
     
    11501172      }
    11511173    }
     1174#if P0312_VERT_PHASE_ADJ
     1175   // VertPhasePositionEnableFlag //
     1176    if(strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),  ""))
     1177    {
     1178      cfgStringToArray( &tempArray, cfg_vertPhasePositionEnableFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "VertPhasePositionEnableFlag");
     1179      if(tempArray)
     1180      {
     1181        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1182        {
     1183          m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] = tempArray[i];
     1184        }
     1185        delete [] tempArray; tempArray = NULL;
     1186      }
     1187    }
     1188#endif
    11521189  }
    11531190#if VPS_EXTN_DIRECT_REF_LAYERS
     
    23422379  printf("Cross layer IRAP alignment    : %d\n", m_crossLayerIrapAlignFlag );
    23432380#endif
     2381#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     2382  printf("IDR only for IRAP             : %d\n", m_crossLayerAlignedIdrOnlyFlag );
     2383#endif
    23442384#if O0194_WEIGHTED_PREDICTION_CGS
    23452385  printf("InterLayerWeightedPred        : %d\n", m_useInterLayerWeightedPred );
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r595 r644  
    384384  Bool      m_crossLayerIrapAlignFlag;
    385385#endif
     386#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     387  Bool      m_crossLayerAlignedIdrOnlyFlag;
     388#endif
    386389#if O0149_CROSS_LAYER_BLA_FLAG
    387390  Bool      m_crossLayerBLAFlag;
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r540 r644  
    6060  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    6161  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     62#if P0312_VERT_PHASE_ADJ
     63  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     64#endif
    6265}
    6366
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r588 r644  
    9797  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    9898  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
     99#if P0312_VERT_PHASE_ADJ
     100  Bool      m_vertPhasePositionEnableFlag[MAX_LAYERS];
     101#endif
     102
    99103#if O0194_DIFFERENT_BITDEPTH_EL_BL
    100104  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r597 r644  
    570570        m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    571571#endif
     572#if P0312_VERT_PHASE_ADJ
     573        m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     574        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     575                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     576#else
    572577        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    573578                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     579#endif
    574580      }
    575581    }
     
    956962#endif
    957963    m_acTEncTop[layer].init(isFieldCoding);
     964#if P0182_VPS_VUI_PS_FLAG
     965    m_acTEncTop[layer].getVPS()->setSPSId(layer, m_acTEncTop[layer].getSPS()->getSPSId());
     966    m_acTEncTop[layer].getVPS()->setPPSId(layer, m_acTEncTop[layer].getPPS()->getPPSId());
     967#endif
    958968  }
    959969#if VPS_RENAME
     
    11931203        // at the encoder, modify below
    11941204        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
    1195         oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j );
     1205        oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ) + 1;
    11961206        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue );
    11971207#else
     
    12001210        maxNumReorderPics       = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j));
    12011211      }
     1212#if RESOLUTION_BASED_DPB
     1213      for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     1214      {
     1215        // Decrement m_maxVpsDecPicBufferingMinus1
     1216        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
     1217        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue - 1 );
     1218      }
     1219#endif
    12021220      vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics);
    12031221      vps->determineSubDpbInfoFlags();
     
    12861304    vps->setCrossLayerPictureTypeAlignFlag( m_crossLayerPictureTypeAlignFlag );
    12871305#endif
     1306#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     1307    vps->setCrossLayerAlignedIdrOnlyFlag( m_crossLayerAlignedIdrOnlyFlag );
     1308#endif
    12881309#if N0147_IRAP_ALIGN_FLAG
    12891310    vps->setCrossLayerIrapAlignFlag( m_crossLayerIrapAlignFlag );
     
    13271348#endif
    13281349
     1350#if P0300_ALT_OUTPUT_LAYER_FLAG
     1351  for (Int k = 0; k < MAX_VPS_LAYER_SETS_PLUS1; k++)
     1352  {
     1353    vps->setAltOuputLayerFlag( k, m_altOutputLayerFlag );
     1354  }
     1355#else
    13291356#if O0153_ALT_OUTPUT_LAYER_FLAG
    13301357  vps->setAltOuputLayerFlag( m_altOutputLayerFlag );
     1358#endif
     1359#endif
     1360
     1361#if P0312_VERT_PHASE_ADJ
     1362  Bool vpsVuiVertPhaseInUseFlag = false;
     1363  for( UInt layerId = 1; layerId < m_numLayers; layerId++ )
     1364  {
     1365    for( i = 0; i < m_acLayerCfg[layerId].m_numScaledRefLayerOffsets; i++ )
     1366    {
     1367      if( m_acTEncTop[layerId].getVertPhasePositionEnableFlag(i) )
     1368      {
     1369        vpsVuiVertPhaseInUseFlag = true;
     1370        break;
     1371      }
     1372    }
     1373  }
     1374  vps->setVpsVuiVertPhaseInUseFlag( vpsVuiVertPhaseInUseFlag );
     1375#endif
     1376
     1377#if O0164_MULTI_LAYER_HRD
     1378  vps->setVpsVuiBspHrdPresentFlag(false);
     1379  TEncTop *pcCfg = &m_acTEncTop[0];
     1380  if( pcCfg->getBufferingPeriodSEIEnabled() )
     1381  {
     1382    vps->setVpsVuiBspHrdPresentFlag(true);
     1383    vps->setVpsNumBspHrdParametersMinus1(vps->getNumLayerSets() - 2);
     1384    vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     1385    for ( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     1386    {
     1387      vps->setBspCprmsPresentFlag(i, true);
     1388
     1389      UInt layerId = i + 1;
     1390      TEncTop *pcCfgLayer = &m_acTEncTop[layerId];
     1391
     1392      Int iPicWidth         = pcCfgLayer->getSourceWidth();
     1393      Int iPicHeight        = pcCfgLayer->getSourceHeight();
     1394      UInt uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
     1395      UInt uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     1396      UInt uiNumCUsInFrame   = uiWidthInCU * uiHeightInCU;
     1397
     1398      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1);
     1399      UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 );
     1400      if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 )
     1401      {
     1402        numDU ++;
     1403      }
     1404      vps->getBspHrd(i)->setNumDU( numDU );
     1405      vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) );
     1406    }
     1407    for(UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     1408    {
     1409      vps->setNumBitstreamPartitions(h, 1);
     1410      for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
     1411      {
     1412        for( UInt j = 0; j <= (vps->getMaxLayers()-1); j++ )
     1413        {
     1414          if (vps->getLayerIdIncludedFlag(h, j) && h == j)
     1415          {
     1416            vps->setLayerInBspFlag(h, i, j, true);
     1417          }
     1418        }
     1419      }
     1420      vps->setNumBspSchedCombinations(h, 1);
     1421      for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
     1422      {
     1423        for( UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++ )
     1424        {
     1425          vps->setBspCombHrdIdx(h, i, j, 0);
     1426          vps->setBspCombSchedIdx(h, i, j, 0);
     1427        }
     1428      }
     1429    }
     1430  }
    13311431#endif
    13321432
Note: See TracChangeset for help on using the changeset viewer.