Changeset 1246 in SHVCSoftware for branches/SHM-dev/source/App/TAppEncoder


Ignore:
Timestamp:
14 Jul 2015, 00:26:07 (10 years ago)
Author:
seregin
Message:

port rev 4240

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

Legend:

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

    r1235 r1246  
    558558      pStr=eptr;
    559559      for(;isspace(*pStr);pStr++);
    560       if (*pStr == ',') pStr++;
     560      if (*pStr == ',')
     561      {
     562        pStr++;
     563      }
    561564      for(;isspace(*pStr);pStr++);
    562565    }
     
    604607      pStr=eptr;
    605608      for(;isspace(*pStr);pStr++);
    606       if (*pStr == ',') pStr++;
     609      if (*pStr == ',')
     610      {
     611        pStr++;
     612      }
    607613      for(;isspace(*pStr);pStr++);
    608614    }
     
    650656      pStr=eptr;
    651657      for(;isspace(*pStr);pStr++);
    652       if (*pStr == ',') pStr++;
     658      if (*pStr == ',')
     659      {
     660        pStr++;
     661      }
    653662      for(;isspace(*pStr);pStr++);
    654663    }
     
    673682  // Try to choose profile, according to table in Q1013.
    674683  UInt trialBitDepthConstraint=maxBitDepth;
    675   if (trialBitDepthConstraint<8) trialBitDepthConstraint=8;
    676   else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11) trialBitDepthConstraint++;
    677   else if (trialBitDepthConstraint>12) trialBitDepthConstraint=16;
     684  if (trialBitDepthConstraint<8)
     685  {
     686    trialBitDepthConstraint=8;
     687  }
     688  else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11)
     689  {
     690    trialBitDepthConstraint++;
     691  }
     692  else if (trialBitDepthConstraint>12)
     693  {
     694    trialBitDepthConstraint=16;
     695  }
    678696
    679697  // both format and bit depth constraints are unspecified
     
    713731    bitDepthConstraint = trialBitDepthConstraint;
    714732    chromaFormatConstraint = chromaFormat;
    715     if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420) chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
    716     if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8) bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
    717     if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag) bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
     733    if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420)
     734    {
     735      chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
     736    }
     737    if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8)
     738    {
     739      bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
     740    }
     741    if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag)
     742    {
     743      bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
     744    }
    718745  }
    719746}
     
    16511678  ;
    16521679
    1653   for(Int i=1; i<MAX_GOP+1; i++) {
     1680  for(Int i=1; i<MAX_GOP+1; i++)
     1681  {
    16541682    std::ostringstream cOSS;
    16551683    cOSS<<"Frame"<<i;
     
    17661794      m_tileColumnWidth.resize(m_numTileColumnsMinus1);
    17671795      for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
     1796      {
    17681797        m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
     1798      }
    17691799    }
    17701800  }
     
    17901820      m_tileRowHeight.resize(m_numTileRowsMinus1);
    17911821      for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
     1822      {
    17921823        m_tileRowHeight[i]=cfg_RowHeight.values[i];
     1824      }
    17931825    }
    17941826  }
     
    19271959#else
    19281960 /* rules for input, output and internal bitdepths as per help text */
    1929   if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
    1930   if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
    1931   if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0) { m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
    1932   if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0) { m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
    1933   if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0) { m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
    1934   if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0) { m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
    1935   if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0) { m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA]; }
     1961  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
     1962  {
     1963    m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1964  }
     1965  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0)
     1966  {
     1967    m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1968  }
     1969  if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0)
     1970  {
     1971    m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1972  }
     1973  if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0)
     1974  {
     1975    m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1976  }
     1977  if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0)
     1978  {
     1979    m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1980  }
     1981  if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0)
     1982  {
     1983    m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1984  }
     1985  if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0)
     1986  {
     1987    m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA];
     1988  }
    19361989
    19371990  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     
    19632016  if (m_profile == Profile::HIGHTHROUGHPUTREXT )
    19642017  {
    1965     if (m_bitDepthConstraint == 0) m_bitDepthConstraint = 16;
     2018    if (m_bitDepthConstraint == 0)
     2019    {
     2020      m_bitDepthConstraint = 16;
     2021    }
    19662022    m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
    19672023  }
     
    25812637      while ( iPOC < m_framesToBeEncoded )
    25822638      {
    2583         if ( fscanf(fpt, "%d", &iValue ) == EOF ) break;
     2639        if ( fscanf(fpt, "%d", &iValue ) == EOF )
     2640        {
     2641          break;
     2642        }
    25842643        m_aidQP[ iPOC ] = iValue;
    25852644        iPOC++;
     
    31943253    ui >>= 1;
    31953254    if( (ui & 1) == 1)
     3255    {
    31963256      xConfirmPara( ui != 1 , "Width should be 2^n");
     3257    }
    31973258  }
    31983259  ui = m_uiMaxCUHeight;
     
    32013262    ui >>= 1;
    32023263    if( (ui & 1) == 1)
     3264    {
    32033265      xConfirmPara( ui != 1 , "Height should be 2^n");
     3266    }
    32043267  }
    32053268#endif
     
    40074070  {
    40084071    xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998");
    4009     for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ){
     4072    for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ )
     4073    {
    40104074      xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999");
    40114075      xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000");
     
    42434307  // compute actual CU depth with respect to config depth and max transform size
    42444308  g_uiAddCUDepth  = 0;
    4245   while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth )  ) ) g_uiAddCUDepth++;
     4309  while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth )  ) )
     4310  {
     4311    g_uiAddCUDepth++;
     4312  }
    42464313
    42474314  g_uiAddCUDepth+=getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.
     
    42614328#endif
    42624329    g_PCMBitDepth[channelType] = m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType];
    4263 
    4264     if (m_useExtendedPrecision) g_maxTrDynamicRange[channelType] = std::max<Int>(15, (g_bitDepth[channelType] + 6));
    4265     else                        g_maxTrDynamicRange[channelType] = 15;
     4330    g_maxTrDynamicRange[channelType] = m_useExtendedPrecision? std::max<Int>(15, (g_bitDepth[channelType] + 6)) : 15;
    42664331  }
    42674332
     
    42754340  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
    42764341  {
    4277     if (strToProfile[profileIndex].value == profile) return strToProfile[profileIndex].str;
     4342    if (strToProfile[profileIndex].value == profile)
     4343    {
     4344      return strToProfile[profileIndex].str;
     4345    }
    42784346  }
    42794347
     
    43454413    const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
    43464414    std::string rextSubProfile;
    4347     if (validProfileName!=NONE) rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
    4348     if (rextSubProfile == "main_444_16") rextSubProfile="main_444_16 [NON STANDARD]";
     4415    if (validProfileName!=NONE)
     4416    {
     4417      rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     4418    }
     4419    if (rextSubProfile == "main_444_16")
     4420    {
     4421      rextSubProfile="main_444_16 [NON STANDARD]";
     4422    }
    43494423    printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
    43504424  }
     
    45114585{
    45124586  if (!bflag)
     4587  {
    45134588    return false;
     4589  }
    45144590
    45154591  printf("Error: %s\n",message);
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1237 r1246  
    571571    m_acTEncTop[layer].setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
    572572    m_acTEncTop[layer].setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
    573     for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); }
     573    for(Int i = 0; i < m_timeCodeSEINumTs; i++)
     574    {
     575      m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i);
     576    }
    574577    m_acTEncTop[layer].setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
    575578    m_acTEncTop[layer].setKneeSEIId                                         ( m_kneeSEIId );
     
    979982  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
    980983  m_cTEncTop.setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
    981   for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_cTEncTop.setTimeSet(m_timeSetArray[i], i); }
     984  for(Int i = 0; i < m_timeCodeSEINumTs; i++)
     985  {
     986    m_cTEncTop.setTimeSet(m_timeSetArray[i], i);
     987  }
    982988  m_cTEncTop.setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
    983989  m_cTEncTop.setKneeSEIId                                         ( m_kneeSEIId );
     
    18321838#endif
    18331839        // call encoding function for one frame
    1834         if ( m_isField ) m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
    1835         else             m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
     1840        if ( m_isField )
     1841        {
     1842          m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
     1843        }
     1844        else
     1845        {
     1846          m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
     1847        }
    18361848      }
    18371849    }
     
    20932105
    20942106    // call encoding function for one frame
    2095     if ( m_isField ) m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
    2096     else             m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
     2107    if ( m_isField )
     2108    {
     2109      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
     2110    }
     2111    else
     2112    {
     2113      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
     2114    }
    20972115
    20982116    // write bistream to file if necessary
Note: See TracChangeset for help on using the changeset viewer.