History

add new SpsPpsStrategy and UT

Sijia Chen committed 11 years ago

Commit 98ed3021 parent e9ec60316 files · +1150 −161Browse files

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

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+29−10
@@ -332,7 +332,7 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 331 unmodified lines
332 m_iMaxPicHeight = pCfg->iPicHeight;332 m_iMaxPicHeight = pCfg->iPicHeight;
333 333
334 TraceParamInfo (pCfg);334 TraceParamInfo (pCfg);
335 if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {335 if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx, NULL)) {
336 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");336 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");
337 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_DEBUG,337 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_DEBUG,
338 "Problematic Input Base Param: iUsageType=%d, Resolution=%dx%d, FR=%f, TLayerNum=%d, DLayerNum=%d",338 "Problematic Input Base Param: iUsageType=%d, Resolution=%dx%d, FR=%f, TLayerNum=%d, DLayerNum=%d",
@@ -477,6 +477,7 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 138 unmodified lines
477 }477 }
478 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,478 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
479 "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);479 "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);
480
480 ForceCodingIDR (m_pEncContext);481 ForceCodingIDR (m_pEncContext);
481 482
482 m_pEncContext->sEncoderStatistics.uiIDRReqNum++;483 m_pEncContext->sEncoderStatistics.uiIDRReqNum++;
@@ -486,8 +487,8 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 3 unmodified lines
486void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {487void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
487 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,488 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
488 "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\489 "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\
489 bEnableSpsPpsIdAddition = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\490 iSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\
490 iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d",491 iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d)",
491 pParam->iUsageType,492 pParam->iUsageType,
492 pParam->iPicWidth,493 pParam->iPicWidth,
493 pParam->iPicHeight,494 pParam->iPicHeight,
@@ -499,7 +500,7 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 5 unmodified lines
499 pParam->iSpatialLayerNum,500 pParam->iSpatialLayerNum,
500 pParam->fMaxFrameRate,501 pParam->fMaxFrameRate,
501 pParam->uiIntraPeriod,502 pParam->uiIntraPeriod,
502 pParam->bEnableSpsPpsIdAddition,503 pParam->iSpsPpsIdStrategy,
503 pParam->bPrefixNalAddingCtrl,504 pParam->bPrefixNalAddingCtrl,
504 pParam->bEnableDenoise,505 pParam->bEnableDenoise,
505 pParam->bEnableBackgroundDetection,506 pParam->bEnableBackgroundDetection,
@@ -513,7 +514,9 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 7 unmodified lines
513 pParam->uiMaxNalSize,514 pParam->uiMaxNalSize,
514 pParam->iLTRRefNum,515 pParam->iLTRRefNum,
515 pParam->iMultipleThreadIdc,516 pParam->iMultipleThreadIdc,
516 pParam->iLoopFilterDisableIdc517 pParam->iLoopFilterDisableIdc,
518 pParam->iLoopFilterAlphaC0Offset,
519 pParam->iLoopFilterBetaOffset
517 );520 );
518 int32_t i = 0;521 int32_t i = 0;
519 int32_t iSpatialLayers = (pParam->iSpatialLayerNum < MAX_SPATIAL_LAYER_NUM) ? (pParam->iSpatialLayerNum) :522 int32_t iSpatialLayers = (pParam->iSpatialLayerNum < MAX_SPATIAL_LAYER_NUM) ? (pParam->iSpatialLayerNum) :
@@ -706,16 +709,26 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 186 unmodified lines
706#endif//OUTPUT_BIT_STREAM709#endif//OUTPUT_BIT_STREAM
707 if (sEncodingParam.iSpatialLayerNum < 1710 if (sEncodingParam.iSpatialLayerNum < 1
708 || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer711 || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer
712 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
713 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
714 sEncodingParam.iSpatialLayerNum);
709 return cmInitParaError;715 return cmInitParaError;
710 }716 }
711 717
712 if (sConfig.ParamTranscode (sEncodingParam)) {718 if (sConfig.ParamTranscode (sEncodingParam)) {
719 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
720 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ParamTranscode failed!");
713 return cmInitParaError;721 return cmInitParaError;
714 }722 }
715 if (sConfig.iSpatialLayerNum < 1) {723 if (sConfig.iSpatialLayerNum < 1) {
724 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
725 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
726 sConfig.iSpatialLayerNum);
716 return cmInitParaError;727 return cmInitParaError;
717 }728 }
718 if (sConfig.DetermineTemporalSettings()) {729 if (sConfig.DetermineTemporalSettings()) {
730 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
731 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, DetermineTemporalSettings failed!");
719 return cmInitParaError;732 return cmInitParaError;
720 }733 }
721 734
@@ -898,11 +911,17 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 176 unmodified lines
898 }911 }
899 break;912 break;
900 case ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION: {913 case ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION: {
901 bool iValue = * ((bool*)pOption);914 int32_t iValue = * ((int32_t*)pOption);
902 915 if (((iValue > INCREASING_ID) || (m_pEncContext->pSvcParam->iSpsPpsIdStrategy > INCREASING_ID))
903 m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition = iValue;916 && m_pEncContext->pSvcParam->iSpsPpsIdStrategy != iValue) {
904 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable SPS/PPS ID = %d ",917 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
905 m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition);918 " CWelsH264SVCEncoder::SetOption iSpsPpsIdStrategy changing in the middle of call is NOT allowed for iSpsPpsIdStrategy>INCREASING_ID: existing setting is %d and the new one is %d",
919 m_pEncContext->pSvcParam->iSpsPpsIdStrategy, iValue);
920 return cmInitParaError;
921 }
922 m_pEncContext->pSvcParam->iSpsPpsIdStrategy = iValue;
923 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption iSpsPpsIdStrategy = %d ",
924 m_pEncContext->pSvcParam->iSpsPpsIdStrategy);
906 }925 }
907 break;926 break;
908 case ENCODER_OPTION_CURRENT_PATH: {927 case ENCODER_OPTION_CURRENT_PATH: {

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