1257 lines · 48.8 KB · C++
RawDownload
}void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {  SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];  pLayerInfo->uiLevelIdc = uiLevelIdc;  if ((uiLevelIdc < LEVEL_1_0) || (uiLevelIdc > LEVEL_5_2)) {    pLayerInfo->uiLevelIdc = LEVEL_5_2;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support level(%d) change to LEVEL_5_2", uiLevelIdc);  }}void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {  int32_t iRefUpperBound = (m_pEncContext->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ?                           MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN;  m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;  if ((iNumRef < MIN_REF_PIC_COUNT) || (iNumRef > iRefUpperBound)) {    m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,             "doesn't support the number of reference frame(%d) change to auto select mode", iNumRef);  }}void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,           "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\             bEnableSpsPpsIdAddition = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\             iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d",           pParam->iUsageType,           pParam->iPicWidth,           pParam->iPicHeight,           pParam->iTargetBitrate,           pParam->iMaxBitrate,           pParam->iRCMode,           pParam->iPaddingFlag,           pParam->iTemporalLayerNum,           pParam->iSpatialLayerNum,           pParam->fMaxFrameRate,           pParam->uiIntraPeriod,           pParam->bEnableSpsPpsIdAddition,           pParam->bPrefixNalAddingCtrl,           pParam->bEnableDenoise,           pParam->bEnableBackgroundDetection,           pParam->bEnableAdaptiveQuant,           pParam->bEnableFrameSkip,           pParam->bEnableLongTermReference,           pParam->iLtrMarkPeriod,           pParam->iComplexityMode,           pParam->iNumRefFrame,           pParam->iEntropyCodingModeFlag,           pParam->uiMaxNalSize,           pParam->iLTRRefNum,           pParam->iMultipleThreadIdc,           pParam->iLoopFilterDisableIdc          );  int32_t i = 0;  while (i < pParam->iSpatialLayerNum) {    SSpatialLayerConfig* pSpatialCfg = &pParam->sSpatialLayers[i];    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;\               uiProfileIdc = %d;uiLevelIdc = %d",             i, pSpatialCfg->iVideoWidth,             pSpatialCfg->iVideoHeight,             pSpatialCfg->fFrameRate,             pSpatialCfg->iSpatialBitrate,             pSpatialCfg->iMaxSpatialBitrate,             pSpatialCfg->sSliceCfg.uiSliceMode,             pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceNum,             pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceSizeConstraint,             pSpatialCfg->uiProfileIdc,             pSpatialCfg->uiLevelIdc            );    ++ i;  }} void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVideoFrameType eFrameType,    const int32_t kiCurrentFrameSize, const int64_t kiCurrentFrameMs) {  SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics);   int32_t iMaxDid = m_pEncContext->pSvcParam->iSpatialLayerNum - 1;  if ((0 != pStatistics->uiWidth && 0 != pStatistics->uiHeight)      && (pStatistics->uiWidth != (unsigned int) m_pEncContext->pSvcParam->sDependencyLayers[iMaxDid].iActualWidth          || pStatistics->uiHeight != (unsigned int) m_pEncContext->pSvcParam->sDependencyLayers[iMaxDid].iActualHeight)) {    pStatistics->uiResolutionChangeTimes ++;  }  pStatistics->uiWidth = m_pEncContext->pSvcParam->sDependencyLayers[iMaxDid].iActualWidth;  pStatistics->uiHeight = m_pEncContext->pSvcParam->sDependencyLayers[iMaxDid].iActualHeight;   int32_t iProcessedFrameCount = pStatistics->uiInputFrameCount - pStatistics->uiSkippedFrameCount;  const bool kbCurrentFrameSkipped = (videoFrameTypeSkip == eFrameType);  if (!kbCurrentFrameSkipped && (iProcessedFrameCount + 1) != 0) {    pStatistics->fAverageFrameSpeedInMs = (iProcessedFrameCount * pStatistics->fAverageFrameSpeedInMs +                                           kiCurrentFrameMs) / (iProcessedFrameCount + 1);  }  pStatistics->uiInputFrameCount ++;  pStatistics->uiSkippedFrameCount += (kbCurrentFrameSkipped ? 1 : 0);   // rate control related  if (0 != m_pEncContext->uiStartTimestamp) {    if (kiCurrentFrameTs > m_pEncContext->uiStartTimestamp + 800) {      pStatistics->fAverageFrameRate = (static_cast<float> (pStatistics->uiInputFrameCount) * 1000 /                                        (kiCurrentFrameTs - m_pEncContext->uiStartTimestamp));    }  } else {    m_pEncContext->uiStartTimestamp = kiCurrentFrameTs;  }  pStatistics->fLatestFrameRate = m_pEncContext->pWelsSvcRc->fLatestFrameRate; //TODO: finish the calculation in RC  pStatistics->uiBitRate = m_pEncContext->pWelsSvcRc->iActualBitRate; //TODO: finish the calculation in RC   if (videoFrameTypeIDR == eFrameType || videoFrameTypeI == eFrameType) {    pStatistics->uiIDRSentNum ++;  }  if (m_pEncContext->pLtr->bLTRMarkingFlag) {    pStatistics->uiLTRSentNum ++;  }   m_pEncContext->iTotalEncodedBits += kiCurrentFrameSize;   if (m_pEncContext->iStatisticsLogInterval > 0) {    int64_t iTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs;    if ((iTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) {      if (iTimeDiff) {        pStatistics->fLatestFrameRate = static_cast<float> ((pStatistics->uiInputFrameCount -                                        m_pEncContext->iLastStatisticsFrameCount) * 1000 /                                        iTimeDiff);        pStatistics->uiBitRate = static_cast<unsigned int> ((m_pEncContext->iTotalEncodedBits -                                 m_pEncContext->iLastStatisticsBits) * 1000 / iTimeDiff);      }       // update variables      m_pEncContext->iLastStatisticsLogTs = kiCurrentFrameTs;      m_pEncContext->iLastStatisticsBits = m_pEncContext->iTotalEncodedBits;      m_pEncContext->iLastStatisticsFrameCount = pStatistics->uiInputFrameCount;       WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,               "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, \               LastFrameRate=%f, LatestBitRate=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, \               uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA",               pStatistics->uiWidth, pStatistics->uiHeight,               pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate,               pStatistics->fLatestFrameRate, pStatistics->uiBitRate,               pStatistics->uiInputFrameCount, pStatistics->uiSkippedFrameCount,               pStatistics->uiResolutionChangeTimes, pStatistics->uiIDRReqNum, pStatistics->uiIDRSentNum);      //TODO: the following statistics will be calculated and added later      //pStatistics->uiLTRSentNum    }  } } /************************************************************************* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..************************************************************************/int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {  if (NULL == pOption) {    return cmInitParaError;  }   if ((NULL == m_pEncContext || false == m_bInitialFlag) && eOptionId != ENCODER_OPTION_TRACE_LEVEL      && eOptionId != ENCODER_OPTION_TRACE_CALLBACK && eOptionId != ENCODER_OPTION_TRACE_CALLBACK_CONTEXT) {    return cmInitExpected;  }   switch (eOptionId) {  case ENCODER_OPTION_INTER_SPATIAL_PRED: {	// Inter spatial layer prediction flag    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");  }  break;  case ENCODER_OPTION_DATAFORMAT: {	// Input color space    int32_t iValue = * ((int32_t*)pOption);    int32_t iColorspace = iValue;    if (iColorspace == 0) {      return cmInitParaError;    }     m_iCspInternal = iColorspace;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);  }  break;  case ENCODER_OPTION_IDR_INTERVAL: {	// IDR Interval    int32_t iValue	= * ((int32_t*)pOption);    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL iValue= %d", iValue);    if (iValue < -1 || iValue == 0)      iValue = 1;    if (iValue == (int32_t)m_pEncContext->pSvcParam->uiIntraPeriod) {      return cmResultSuccess;    }    m_pEncContext->pSvcParam->uiIntraPeriod	= (uint32_t)iValue;  }  break;  case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: {	// SVC Encoding Parameter    SEncParamBase		sEncodingParam;    SWelsSvcCodingParam	sConfig;    int32_t iTargetWidth = 0;    int32_t iTargetHeight = 0;     memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase));	// confirmed_safe_unsafe_usage    if (sConfig.ParamBaseTranscode (sEncodingParam)) {      return cmInitParaError;    }    /* New configuration available here */    iTargetWidth	= sConfig.iPicWidth;    iTargetHeight	= sConfig.iPicHeight;    if (m_iMaxPicWidth != iTargetWidth        || m_iMaxPicHeight != iTargetHeight) {      m_iMaxPicWidth	= iTargetWidth;      m_iMaxPicHeight	= iTargetHeight;    }    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;fMaxFrameRate=  %.6ff;iRCMode= %d",             sEncodingParam.iUsageType,             sEncodingParam.iPicWidth,             sEncodingParam.iPicHeight,             sEncodingParam.iTargetBitrate,             sEncodingParam.fMaxFrameRate,             sEncodingParam.iRCMode);    if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {      return cmInitParaError;    }  }  break;   case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: {	// SVC Encoding Parameter    SEncParamExt		sEncodingParam;    SWelsSvcCodingParam	sConfig;    int32_t iTargetWidth = 0;    int32_t iTargetHeight = 0;     memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt));	// confirmed_safe_unsafe_usage    TraceParamInfo (&sEncodingParam);#ifdef OUTPUT_BIT_STREAM    if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=        m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) {      ++ m_iSwitchTimes;      m_bSwitch = true;    }#endif//OUTPUT_BIT_STREAM    if (sEncodingParam.iSpatialLayerNum < 1        || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) {	// verify number of spatial layer      return cmInitParaError;    }     if (sConfig.ParamTranscode (sEncodingParam)) {      return cmInitParaError;    }    if (sConfig.iSpatialLayerNum < 1) {      return cmInitParaError;    }    if (sConfig.DetermineTemporalSettings()) {      return cmInitParaError;    }     /* New configuration available here */    iTargetWidth	= sConfig.iPicWidth;    iTargetHeight	= sConfig.iPicHeight;    if (m_iMaxPicWidth != iTargetWidth        || m_iMaxPicHeight != iTargetHeight) {      m_iMaxPicWidth	= iTargetWidth;      m_iMaxPicHeight	= iTargetHeight;    }    /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */    if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {      return cmInitParaError;    }  }  break;  case ENCODER_OPTION_FRAME_RATE: {	// Maximal input frame rate    float iValue	= * ((float*)pOption);    if (iValue <= 0) {      return cmInitParaError;    }    //adjust to valid range    m_pEncContext->pSvcParam->fMaxFrameRate = WELS_CLIP3 (iValue, MIN_FRAME_RATE, MAX_FRAME_RATE);    WelsEncoderApplyFrameRate (m_pEncContext->pSvcParam);    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_FRAME_RATE,m_pEncContext->pSvcParam->fMaxFrameRate= %f",             m_pEncContext->pSvcParam->fMaxFrameRate);  }  break;  case ENCODER_OPTION_BITRATE: {	// Target bit-rate    SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));    int32_t iBitrate = pInfo->iBitrate;    if (iBitrate <= 0) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d",               iBitrate);      return cmInitParaError;    }    iBitrate	= WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE);    switch (pInfo->iLayer) {    case SPATIAL_LAYER_ALL:      m_pEncContext->pSvcParam->iTargetBitrate = iBitrate;      break;    case SPATIAL_LAYER_0:      m_pEncContext->pSvcParam->sSpatialLayers[0].iSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_1:      m_pEncContext->pSvcParam->sSpatialLayers[1].iSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_2:      m_pEncContext->pSvcParam->sSpatialLayers[2].iSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_3:      m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate;      break;    default:      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d",               pInfo->iLayer);      return cmInitParaError;      break;    }    //adjust to valid range    if (WelsEncoderApplyBitRate (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, pInfo->iLayer)) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE layerId= %d,iSpatialBitrate = %d", pInfo->iLayer, iBitrate);      return cmInitParaError;    } else {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE layerId= %d,iSpatialBitrate = %d", pInfo->iLayer, iBitrate);     }   }  break;  case ENCODER_OPTION_MAX_BITRATE: {	// Target bit-rate    SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));    int32_t iBitrate = pInfo->iBitrate;    if (iBitrate <= 0) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d",               iBitrate);      return cmInitParaError;    }    iBitrate	= WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE);    switch (pInfo->iLayer) {    case SPATIAL_LAYER_ALL:      m_pEncContext->pSvcParam->iMaxBitrate = iBitrate;      break;    case SPATIAL_LAYER_0:      m_pEncContext->pSvcParam->sSpatialLayers[0].iMaxSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_1:      m_pEncContext->pSvcParam->sSpatialLayers[1].iMaxSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_2:      m_pEncContext->pSvcParam->sSpatialLayers[2].iMaxSpatialBitrate = iBitrate;      break;    case SPATIAL_LAYER_3:      m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate;      break;    default:      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d",               pInfo->iLayer);      return cmInitParaError;      break;    }    //adjust to valid range    if (WelsEncoderApplyBitRate (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, pInfo->iLayer)) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE layerId= %d,iMaxSpatialBitrate = %d", pInfo->iLayer, iBitrate);      return cmInitParaError;    } else {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE layerId= %d,iMaxSpatialBitrate = %d", pInfo->iLayer, iBitrate);     }  }  break;  case ENCODER_OPTION_RC_MODE: {	// 0:quality mode;1:bit-rate mode;2:bitrate limited mode    int32_t iValue = * ((int32_t*)pOption);    m_pEncContext->pSvcParam->iRCMode	= (RC_MODES) iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_RC_MODE iRCMode= %d ",             iValue);  }  break;  case ENCODER_PADDING_PADDING: {	// 0:disable padding;1:padding    int32_t iValue = * ((int32_t*)pOption);    m_pEncContext->pSvcParam->iPaddingFlag	= iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_PADDING_PADDING iPaddingFlag= %d ",             iValue);  }  break;  case ENCODER_LTR_RECOVERY_REQUEST: {    SLTRRecoverRequest* pLTR_Recover_Request = (SLTRRecoverRequest*) (pOption);    FilterLTRRecoveryRequest (m_pEncContext, pLTR_Recover_Request);  }  break;  case ENCODER_LTR_MARKING_FEEDBACK: {    SLTRMarkingFeedback* fb = (SLTRMarkingFeedback*) (pOption);    FilterLTRMarkingFeedback (m_pEncContext, fb);  }  break;  case ENCODER_LTR_MARKING_PERIOD: {    uint32_t iValue = * ((uint32_t*) (pOption));    m_pEncContext->pSvcParam->iLtrMarkPeriod = iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_LTR_MARKING_PERIOD iLtrMarkPeriod= %d ",             iValue);  }  break;  case ENCODER_OPTION_LTR: {    SLTRConfig* pLTRValue = ((SLTRConfig*) (pOption));    if (WelsEncoderApplyLTR (&m_pWelsTrace->m_sLogCtx, &m_pEncContext, pLTRValue)) {      return cmInitParaError;    }    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_LTR,expected bEnableLongTermReference = %d,expeced iLTRRefNum = %d,actual bEnableLongTermReference = %d,actual iLTRRefNum = %d",             pLTRValue->bEnableLongTermReference, pLTRValue->iLTRRefNum, m_pEncContext->pSvcParam->bEnableLongTermReference,             m_pEncContext->pSvcParam->iLTRRefNum);  }  break;  case ENCODER_OPTION_ENABLE_SSEI: {    bool iValue = * ((bool*)pOption);    m_pEncContext->pSvcParam->bEnableSSEI = iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable SSEI = %d ",             m_pEncContext->pSvcParam->bEnableSSEI);  }  break;  case ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING: {    bool iValue = * ((bool*)pOption);    m_pEncContext->pSvcParam->bPrefixNalAddingCtrl = iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption bPrefixNalAddingCtrl = %d ",             m_pEncContext->pSvcParam->bPrefixNalAddingCtrl);  }  break;  case ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION: {    bool iValue = * ((bool*)pOption);     m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition = iValue;    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable SPS/PPS ID = %d ",             m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition);  }  break;  case ENCODER_OPTION_CURRENT_PATH: {    if (m_pEncContext->pSvcParam != NULL) {      char* path = static_cast<char*> (pOption);      m_pEncContext->pSvcParam->pCurPath = path;    }  }  break;  case ENCODER_OPTION_DUMP_FILE: {#ifdef ENABLE_FRAME_DUMP    if (m_pEncContext->pSvcParam != NULL) {      SDumpLayer* pDump = (static_cast<SDumpLayer*> (pOption));      WelsStrncpy (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName,                   sizeof (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName), pDump->pFileName);    }#endif  }  break;  case ENCODER_OPTION_TRACE_LEVEL: {    if (m_pWelsTrace) {      uint32_t level = * ((uint32_t*)pOption);      m_pWelsTrace->SetTraceLevel (level);    }  }  break;  case ENCODER_OPTION_TRACE_CALLBACK: {    if (m_pWelsTrace) {      WelsTraceCallback callback = * ((WelsTraceCallback*)pOption);      m_pWelsTrace->SetTraceCallback (callback);      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::SetOption(), openh264 codec version = %s.",               VERSION_NUMBER);    }  }  break;  case ENCODER_OPTION_TRACE_CALLBACK_CONTEXT: {    if (m_pWelsTrace) {      void* ctx = * ((void**)pOption);      m_pWelsTrace->SetTraceCallbackContext (ctx);    }  }  break;  case ENCODER_OPTION_PROFILE: {    SProfileInfo* pProfileInfo = (static_cast<SProfileInfo*> (pOption));    if ((pProfileInfo->iLayer < SPATIAL_LAYER_0) || (pProfileInfo->iLayer > SPATIAL_LAYER_3)) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)", pProfileInfo->iLayer);      return cmInitParaError;    }    CheckProfileSetting (pProfileInfo->iLayer, pProfileInfo->uiProfileIdc);    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,layerId = %d,expected profile = %d,actual profile = %d",             pProfileInfo->iLayer, pProfileInfo->uiProfileIdc,             m_pEncContext->pSvcParam->sSpatialLayers[pProfileInfo->iLayer].uiProfileIdc);  }  break;  case ENCODER_OPTION_LEVEL: {    SLevelInfo* pLevelInfo = (static_cast<SLevelInfo*> (pOption));    if ((pLevelInfo->iLayer < SPATIAL_LAYER_0) || (pLevelInfo->iLayer > SPATIAL_LAYER_3)) {      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)", pLevelInfo->iLayer);      return cmInitParaError;    }    CheckLevelSetting (pLevelInfo->iLayer, pLevelInfo->uiLevelIdc);    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,

Lines 501–1000 of 1257. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t