History

add checking of frame rate and temporal layer setting for encoder input param Reviewed at https://rbcommons.com/s/OpenH264/r/836/

Sijia Chen committed 12 years ago

Commit 68fed531 parent 007fb473 files · +33 −32Browse files

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

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+13−6
@@ -346,6 +346,10 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 345 unmodified lines
346346 TraceParamInfo (pCfg);
347347 if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {
348348 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");
349+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_DEBUG,
350+ "Problematic Input Base Param: iUsageType=%d, Resolution=%dx%d, FR=%f, TLayerNum=%d, DLayerNum=%d",
351+ pCfg->iUsageType, pCfg->iPicWidth, pCfg->iPicHeight, pCfg->fMaxFrameRate, pCfg->iTemporalLayerNum,
352+ pCfg->iSpatialLayerNum);
349353 Uninitialize();
350354 return cmInitParaError;
351355 }
@@ -519,7 +523,8 @@ void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelId · 167 unmodified lines
519523 }
520524 }
521525 void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {
522− int32_t iRefUpperBound = (m_pEncContext->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME)?MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA:MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN;
526+ int32_t iRefUpperBound = (m_pEncContext->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ?
527+ MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN;
523528 m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
524529 if ((iNumRef < MIN_REF_PIC_COUNT) || (iNumRef > iRefUpperBound)) {
525530 m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;
@@ -663,6 +668,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 137 unmodified lines
663668 if (sConfig.iSpatialLayerNum < 1) {
664669 return cmInitParaError;
665670 }
671+ if (sConfig.DetermineTemporalSettings()) {
672+ return cmInitParaError;
673+ }
674+
675+ /* New configuration available here */
666676 iTargetWidth = sConfig.iPicWidth;
667677 iTargetHeight = sConfig.iPicHeight;
668678 if (m_iMaxPicWidth != iTargetWidth
@@ -676,9 +686,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 7 unmodified lines
676686 m_uiCountFrameNum, m_iCspInternal);
677687 #endif//REC_FRAME_COUNT
678688
679− /* New configuration available here */
680− sConfig.DetermineTemporalSettings();
681−
682689 /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */
683690 WelsEncoderParamAdjust (&m_pEncContext, &sConfig);
684691 }
@@ -906,12 +913,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 221 unmodified lines
906913 }
907914 break;
908915 case ENCODER_OPTION_COMPLEXITY: {
909− int32_t iValue = * (static_cast<int32_t*>(pOption));
916+ int32_t iValue = * (static_cast<int32_t*> (pOption));
910917 m_pEncContext->pSvcParam->iComplexityMode = (ECOMPLEXITY_MODE)iValue;
911918 }
912919 break;
913920 case ENCODER_OPTION_IS_LOSSLESS_LINK: {
914− bool bValue = * (static_cast<bool*>(pOption));
921+ bool bValue = * (static_cast<bool*> (pOption));
915922 m_pEncContext->pSvcParam->bIsLosslessLink = bValue;
916923 }
917924 break;

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