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


Ignore:
Timestamp:
22 Jul 2015, 04:03:45 (9 years ago)
Author:
seregin
Message:

port rev 4434

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

Legend:

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

    r1336 r1356  
    7474  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
    7575  //                           the chroma format in the next digit
    76   //                           the intra constraint in the top digit
     76  //                           the intra constraint in the next digit
     77  //                           If it is a RExt still picture, there is a '1' for the top digit.
    7778  MONOCHROME_8      = 1008,
    7879  MONOCHROME_12     = 1012,
     
    9394  MAIN_444_10_INTRA = 2310,
    9495  MAIN_444_12_INTRA = 2312,
    95   MAIN_444_16_INTRA = 2316
     96  MAIN_444_16_INTRA = 2316,
     97  MAIN_444_STILL_PICTURE = 11308,
     98  MAIN_444_16_STILL_PICTURE = 12316
    9699};
    97100
     
    309312strToExtendedProfile[] =
    310313{
    311     {"none",               NONE             },
    312     {"main",               MAIN             },
    313     {"main10",             MAIN10           },
    314     {"main-still-picture", MAINSTILLPICTURE },
    315     {"main-RExt",          MAINREXT         },
    316     {"high-throughput-RExt", HIGHTHROUGHPUTREXT },
    317     {"monochrome",         MONOCHROME_8     },
    318     {"monochrome12",       MONOCHROME_12    },
    319     {"monochrome16",       MONOCHROME_16    },
    320     {"main12",             MAIN_12          },
    321     {"main_422_10",        MAIN_422_10      },
    322     {"main_422_12",        MAIN_422_12      },
    323     {"main_444",           MAIN_444         },
    324     {"main_444_10",        MAIN_444_10      },
    325     {"main_444_12",        MAIN_444_12      },
    326     {"main_444_16",        MAIN_444_16      },
    327     {"main_intra",         MAIN_INTRA       },
    328     {"main_10_intra",      MAIN_10_INTRA    },
    329     {"main_12_intra",      MAIN_12_INTRA    },
    330     {"main_422_10_intra",  MAIN_422_10_INTRA},
    331     {"main_422_12_intra",  MAIN_422_12_INTRA},
    332     {"main_444_intra",     MAIN_444_INTRA   },
    333     {"main_444_10_intra",  MAIN_444_10_INTRA},
    334     {"main_444_12_intra",  MAIN_444_12_INTRA},
    335     {"main_444_16_intra",  MAIN_444_16_INTRA},
     314    {"none",                      NONE             },
     315    {"main",                      MAIN             },
     316    {"main10",                    MAIN10           },
     317    {"main_still_picture",        MAINSTILLPICTURE },
     318    {"main-still-picture",        MAINSTILLPICTURE },
     319    {"main_RExt",                 MAINREXT         },
     320    {"main-RExt",                 MAINREXT         },
     321    {"main_rext",                 MAINREXT         },
     322    {"main-rext",                 MAINREXT         },
     323    {"high_throughput_RExt",      HIGHTHROUGHPUTREXT },
     324    {"high-throughput-RExt",      HIGHTHROUGHPUTREXT },
     325    {"high_throughput_rext",      HIGHTHROUGHPUTREXT },
     326    {"high-throughput-rext",      HIGHTHROUGHPUTREXT },
     327    {"monochrome",                MONOCHROME_8     },
     328    {"monochrome12",              MONOCHROME_12    },
     329    {"monochrome16",              MONOCHROME_16    },
     330    {"main12",                    MAIN_12          },
     331    {"main_422_10",               MAIN_422_10      },
     332    {"main_422_12",               MAIN_422_12      },
     333    {"main_444",                  MAIN_444         },
     334    {"main_444_10",               MAIN_444_10      },
     335    {"main_444_12",               MAIN_444_12      },
     336    {"main_444_16",               MAIN_444_16      },
     337    {"main_intra",                MAIN_INTRA       },
     338    {"main_10_intra",             MAIN_10_INTRA    },
     339    {"main_12_intra",             MAIN_12_INTRA    },
     340    {"main_422_10_intra",         MAIN_422_10_INTRA},
     341    {"main_422_12_intra",         MAIN_422_12_INTRA},
     342    {"main_444_intra",            MAIN_444_INTRA   },
     343    {"main_444_still_picture",    MAIN_444_STILL_PICTURE },
     344    {"main_444_10_intra",         MAIN_444_10_INTRA},
     345    {"main_444_12_intra",         MAIN_444_12_INTRA},
     346    {"main_444_16_intra",         MAIN_444_16_INTRA},
     347    {"main_444_16_still_picture", MAIN_444_16_STILL_PICTURE },
    336348#if SVC_EXTENSION
    337     {"multiview-main",     MULTIVIEWMAIN    },
    338     {"scalable-main",      SCALABLEMAIN     },
    339     {"scalable-main10",    SCALABLEMAIN10   },
     349    {"multiview-main",            MULTIVIEWMAIN    },
     350    {"scalable-main",             SCALABLEMAIN     },
     351    {"scalable-main10",           SCALABLEMAIN10   },
    340352#endif
    341353};
     
    849861  Int*    cfg_layerSwitchOffBegin[MAX_LAYERS];
    850862  Int*    cfg_layerSwitchOffEnd[MAX_LAYERS];
    851 
    852   Bool    tmpIntraConstraintFlag;
    853   Bool    tmpLowerBitRateConstraintFlag;
    854   UInt    tmpBitDepthConstraint;
    855863  Int*    cfg_layerPTLIdx[MAX_VPS_LAYER_IDX_PLUS1];
    856864
     
    12151223  ("Level%d",                                         m_levelList,       Level::NONE, (MAX_NUM_LAYER_IDS + 1), "Level limit to be used, eg 5.1, or none")
    12161224  ("Tier%d",                                          m_levelTierList,   Level::MAIN, (MAX_NUM_LAYER_IDS + 1), "Tier to use for interpretation of --Level (main or high only)")
    1217   ("MaxBitDepthConstraint",                           tmpBitDepthConstraint,                               0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1225#endif
     1226  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    12181227  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    1219   ("IntraConstraintFlag",                             tmpIntraConstraintFlag,                           false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
    1220   ("LowerBitRateConstraintFlag",                      tmpLowerBitRateConstraintFlag,                     true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
    1221 
     1228  ("IntraConstraintFlag",                             m_intraConstraintFlag,                            false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1229  ("OnePictureOnlyConstraintFlag",                    m_onePictureOnlyConstraintFlag,                   false, "Value of general_one_picture_only_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1230  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1231#if SVC_EXTENSION
    12221232  ("ProfileCompatibility%d",                          m_profileCompatibility, Profile::NONE, (MAX_NUM_LAYER_IDS + 1), "Compatible profile to be used when encoding")
    12231233  ("ProgressiveSource%d",                             m_progressiveSourceFlagList,   false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source is progressive")
     
    12451255  ("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")
    12461256  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
    1247   ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
    1248   ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    1249   ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    1250   ("IntraConstraintFlag",                             m_intraConstraintFlag,                            false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
    1251   ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1257  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)") 
    12521258
    12531259  ("ProgressiveSource",                               m_progressiveSourceFlag,                          false, "Indicate that source is progressive")
     
    18861892    }
    18871893
    1888     m_acLayerCfg[layer].m_bitDepthConstraint = tmpBitDepthConstraint;
    1889     m_acLayerCfg[layer].m_intraConstraintFlag = tmpIntraConstraintFlag;
    1890     m_acLayerCfg[layer].m_lowerBitRateConstraintFlag = tmpLowerBitRateConstraintFlag;   
     1894    m_acLayerCfg[layer].m_bitDepthConstraint = m_bitDepthConstraint;
     1895    m_acLayerCfg[layer].m_intraConstraintFlag = m_intraConstraintFlag;
     1896    m_acLayerCfg[layer].m_lowerBitRateConstraintFlag = m_lowerBitRateConstraintFlag;   
    18911897
    18921898    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     
    20052011  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
    20062012
    2007   if (extendedProfile >= 1000 && extendedProfile <= 2316)
     2013  if (extendedProfile >= 1000 && extendedProfile <= 12316)
    20082014  {
    20092015    m_profile = Profile::MAINREXT;
     
    20132019      exit(EXIT_FAILURE);
    20142020    }
    2015     m_bitDepthConstraint     = (extendedProfile%100);
    2016     m_intraConstraintFlag    = (extendedProfile>=2000);
     2021    m_bitDepthConstraint           = (extendedProfile%100);
     2022    m_intraConstraintFlag          = ((extendedProfile%10000)>=2000);
     2023    m_onePictureOnlyConstraintFlag = (extendedProfile >= 10000);
    20172024    switch ((extendedProfile/100)%10)
    20182025    {
     
    20502057      const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
    20512058      const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
    2052       m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
    2053       automaticallySelectRExtProfile(bUsingGeneralRExtTools,
    2054                                      bUsingChromaQPAdjustment,
    2055                                      bUsingExtendedPrecision,
    2056                                      m_intraConstraintFlag,
    2057                                      m_bitDepthConstraint,
    2058                                      m_chromaFormatConstraint,
    2059                                      m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
    2060                                      m_chromaFormatIDC);
     2059      if (m_onePictureOnlyConstraintFlag)
     2060      {
     2061        m_chromaFormatConstraint = CHROMA_444;
     2062        if (m_intraConstraintFlag != true)
     2063        {
     2064          fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     2065          exit(EXIT_FAILURE);
     2066        }
     2067        const Int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     2068        m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
     2069      }
     2070      else
     2071      {
     2072        m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     2073        automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     2074                                       bUsingChromaQPAdjustment,
     2075                                       bUsingExtendedPrecision,
     2076                                       m_intraConstraintFlag,
     2077                                       m_bitDepthConstraint,
     2078                                       m_chromaFormatConstraint,
     2079                                       m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     2080                                       m_chromaFormatIDC);
     2081      }
    20612082    }
    20622083    else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     
    30283049        xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
    30293050      }
     3051      xConfirmPara( m_onePictureOnlyConstraintFlag && m_chromaFormatConstraint!=CHROMA_444, "chroma format constraint must be 4:4:4 when one-picture-only constraint flag is 1");
     3052      xConfirmPara( m_onePictureOnlyConstraintFlag && m_bitDepthConstraint != 8 && m_bitDepthConstraint != 16, "bit depth constraint must be 8 or 16 when one-picture-only constraint flag is 1");
     3053      xConfirmPara( m_onePictureOnlyConstraintFlag && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when one-picture-only constraint flag is 1.");
     3054
    30303055      if (!m_intraConstraintFlag && m_bitDepthConstraint==16 && m_chromaFormatConstraint==CHROMA_444)
    30313056      {
     
    30523077    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
    30533078    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     3079    xConfirmPara(m_profile == Profile::MAINSTILLPICTURE && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when main still picture profile is used.");
    30543080
    30553081    xConfirmPara(m_crossComponentPredictionEnabledFlag==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     
    43334359  if (m_profile == Profile::MAINREXT)
    43344360  {
    4335     const UInt intraIdx = m_intraConstraintFlag ? 1:0;
    4336     const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
    4337     const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
    4338     const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4361    ExtendedProfileName validProfileName;
     4362    if (m_onePictureOnlyConstraintFlag)
     4363    {
     4364      validProfileName = m_bitDepthConstraint == 8 ? MAIN_444_STILL_PICTURE : (m_bitDepthConstraint == 16 ? MAIN_444_16_STILL_PICTURE : NONE);
     4365    }
     4366    else
     4367    {
     4368      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     4369      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     4370      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     4371      validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4372    }
    43394373    std::string rextSubProfile;
    43404374    if (validProfileName!=NONE)
  • TabularUnified branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1334 r1356  
    144144  Level::Tier   m_levelTier;
    145145  Level::Name   m_level;
     146#endif
    146147  UInt          m_bitDepthConstraint;
    147148  ChromaFormat  m_chromaFormatConstraint;
    148149  Bool          m_intraConstraintFlag;
     150  Bool          m_onePictureOnlyConstraintFlag;
    149151  Bool          m_lowerBitRateConstraintFlag;
     152#if !SVC_EXTENSION
    150153  Bool m_progressiveSourceFlag;
    151154  Bool m_interlacedSourceFlag;
  • TabularUnified branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1334 r1356  
    229229    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
    230230    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_acLayerCfg[layer].m_intraConstraintFlag );
     231    m_acTEncTop[layer].setOnePictureOnlyConstraintFlag                    ( m_onePictureOnlyConstraintFlag );
    231232    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_acLayerCfg[layer].m_lowerBitRateConstraintFlag );
    232233
     
    809810  m_cTEncTop.setChromaFormatConstraintValue                       ( m_chromaFormatConstraint );
    810811  m_cTEncTop.setIntraConstraintFlag                               ( m_intraConstraintFlag );
     812  m_cTEncTop.setOnePictureOnlyConstraintFlag                      ( m_onePictureOnlyConstraintFlag );
    811813  m_cTEncTop.setLowerBitRateConstraintFlag                        ( m_lowerBitRateConstraintFlag );
    812814
Note: See TracChangeset for help on using the changeset viewer.