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
346 TraceParamInfo (pCfg);346 TraceParamInfo (pCfg);
347 if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {347 if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {
348 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");348 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);
349 Uninitialize();353 Uninitialize();
350 return cmInitParaError;354 return cmInitParaError;
351 }355 }
@@ -519,7 +523,8 @@ void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelId · 167 unmodified lines
519 }523 }
520}524}
521void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {525void 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;
523 m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;528 m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
524 if ((iNumRef < MIN_REF_PIC_COUNT) || (iNumRef > iRefUpperBound)) {529 if ((iNumRef < MIN_REF_PIC_COUNT) || (iNumRef > iRefUpperBound)) {
525 m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;530 m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;
@@ -663,6 +668,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 137 unmodified lines
663 if (sConfig.iSpatialLayerNum < 1) {668 if (sConfig.iSpatialLayerNum < 1) {
664 return cmInitParaError;669 return cmInitParaError;
665 }670 }
671 if (sConfig.DetermineTemporalSettings()) {
672 return cmInitParaError;
673 }
674
675 /* New configuration available here */
666 iTargetWidth = sConfig.iPicWidth;676 iTargetWidth = sConfig.iPicWidth;
667 iTargetHeight = sConfig.iPicHeight;677 iTargetHeight = sConfig.iPicHeight;
668 if (m_iMaxPicWidth != iTargetWidth678 if (m_iMaxPicWidth != iTargetWidth
@@ -676,9 +686,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 7 unmodified lines
676 m_uiCountFrameNum, m_iCspInternal);686 m_uiCountFrameNum, m_iCspInternal);
677#endif//REC_FRAME_COUNT687#endif//REC_FRAME_COUNT
678 688
679 /* New configuration available here */
680 sConfig.DetermineTemporalSettings();
681
682 /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */689 /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */
683 WelsEncoderParamAdjust (&m_pEncContext, &sConfig);690 WelsEncoderParamAdjust (&m_pEncContext, &sConfig);
684 }691 }
@@ -906,12 +913,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 221 unmodified lines
906 }913 }
907 break;914 break;
908 case ENCODER_OPTION_COMPLEXITY: {915 case ENCODER_OPTION_COMPLEXITY: {
909 int32_t iValue = * (static_cast<int32_t*>(pOption));916 int32_t iValue = * (static_cast<int32_t*> (pOption));
910 m_pEncContext->pSvcParam->iComplexityMode = (ECOMPLEXITY_MODE)iValue;917 m_pEncContext->pSvcParam->iComplexityMode = (ECOMPLEXITY_MODE)iValue;
911 }918 }
912 break;919 break;
913 case ENCODER_OPTION_IS_LOSSLESS_LINK: {920 case ENCODER_OPTION_IS_LOSSLESS_LINK: {
914 bool bValue = * (static_cast<bool*>(pOption));921 bool bValue = * (static_cast<bool*> (pOption));
915 m_pEncContext->pSvcParam->bIsLosslessLink = bValue;922 m_pEncContext->pSvcParam->bIsLosslessLink = bValue;
916 }923 }
917 break;924 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