History

add profile and level checking in ParamValidation

ruil2 committed 11 years ago

Commit 0babd8d1 parent bd50f644 files · +45 −44Browse files

Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 4 files). Show all

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+5−38
@@ -484,40 +484,6 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 483 unmodified lines
484484
485485 return 0;
486486 }
487−void CWelsH264SVCEncoder::CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc) {
488− SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
489− pLayerInfo->uiProfileIdc = uiProfileIdc;
490− if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
491− pLayerInfo->uiProfileIdc = PRO_BASELINE;
492− WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile",
493− uiProfileIdc);
494− }
495− if (iLayer > SPATIAL_LAYER_0) {
496− if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
497− pLayerInfo->uiProfileIdc = PRO_BASELINE;
498− WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile",
499− uiProfileIdc);
500− }
501− }
502−}
503−void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {
504− SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
505− pLayerInfo->uiLevelIdc = uiLevelIdc;
506− if ((uiLevelIdc < LEVEL_1_0) || (uiLevelIdc > LEVEL_5_2)) {
507− pLayerInfo->uiLevelIdc = LEVEL_5_2;
508− WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support level(%d) change to LEVEL_5_2", uiLevelIdc);
509− }
510−}
511−void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {
512− int32_t iRefUpperBound = (m_pEncContext->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ?
513− MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN;
514− m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
515− if ((iNumRef < MIN_REF_PIC_COUNT) || (iNumRef > iRefUpperBound)) {
516− m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;
517− WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
518− "doesn't support the number of reference frame(%d) change to auto select mode", iNumRef);
519− }
520−}
521487 void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
522488 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
523489 "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\
@@ -986,7 +952,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 462 unmodified lines
986952 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)", pProfileInfo->iLayer);
987953 return cmInitParaError;
988954 }
989− CheckProfileSetting (pProfileInfo->iLayer, pProfileInfo->uiProfileIdc);
955+ CheckProfileSetting (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, pProfileInfo->iLayer,
956+ pProfileInfo->uiProfileIdc);
990957 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
991958 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,layerId = %d,expected profile = %d,actual profile = %d",
992959 pProfileInfo->iLayer, pProfileInfo->uiProfileIdc,
@@ -1000,7 +967,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 7 unmodified lines
1000967 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)", pLevelInfo->iLayer);
1001968 return cmInitParaError;
1002969 }
1003− CheckLevelSetting (pLevelInfo->iLayer, pLevelInfo->uiLevelIdc);
970+ CheckLevelSetting (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, pLevelInfo->iLayer, pLevelInfo->uiLevelIdc);
1004971 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1005972 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_LEVEL,layerId = %d,expected level = %d,actual level = %d",
1006973 pLevelInfo->iLayer, pLevelInfo->uiLevelIdc, m_pEncContext->pSvcParam->sSpatialLayers[pLevelInfo->iLayer].uiLevelIdc);
@@ -1008,7 +975,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 1 unmodified line
1008975 break;
1009976 case ENCODER_OPTION_NUMBER_REF: {
1010977 int32_t iValue = * ((int32_t*)pOption);
1011− CheckReferenceNumSetting (iValue);
978+ CheckReferenceNumSetting (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, iValue);
1012979 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1013980 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_NUMBER_REF,expected refNum = %d,actual refnum = %d", iValue,
1014981 m_pEncContext->pSvcParam->iNumRefFrame);
@@ -1260,7 +1227,7 @@ void WelsDestroySVCEncoder (ISVCEncoder* pEncoder) { · 245 unmodified lines
12601227 }
12611228 }
12621229
1263−OpenH264Version WelsGetCodecVersion () {
1230+OpenH264Version WelsGetCodecVersion() {
12641231 (void) g_strCodecVer; // Avoid warnings about unused static variables
12651232 return g_stCodecVersion;
12661233 }

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