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
332332 m_iMaxPicHeight = pCfg->iPicHeight;
333333
334334 TraceParamInfo (pCfg);
335− if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {
335+ if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx, NULL)) {
336336 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");
337337 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_DEBUG,
338338 "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
477477 }
478478 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
479479 "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);
480+
480481 ForceCodingIDR (m_pEncContext);
481482
482483 m_pEncContext->sEncoderStatistics.uiIDRReqNum++;
@@ -486,8 +487,8 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 3 unmodified lines
486487 void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
487488 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
488489 "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− iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d",
490+ iSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\
491+ iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d)",
491492 pParam->iUsageType,
492493 pParam->iPicWidth,
493494 pParam->iPicHeight,
@@ -499,7 +500,7 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 5 unmodified lines
499500 pParam->iSpatialLayerNum,
500501 pParam->fMaxFrameRate,
501502 pParam->uiIntraPeriod,
502− pParam->bEnableSpsPpsIdAddition,
503+ pParam->iSpsPpsIdStrategy,
503504 pParam->bPrefixNalAddingCtrl,
504505 pParam->bEnableDenoise,
505506 pParam->bEnableBackgroundDetection,
@@ -513,7 +514,9 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 7 unmodified lines
513514 pParam->uiMaxNalSize,
514515 pParam->iLTRRefNum,
515516 pParam->iMultipleThreadIdc,
516− pParam->iLoopFilterDisableIdc
517+ pParam->iLoopFilterDisableIdc,
518+ pParam->iLoopFilterAlphaC0Offset,
519+ pParam->iLoopFilterBetaOffset
517520 );
518521 int32_t i = 0;
519522 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
706709 #endif//OUTPUT_BIT_STREAM
707710 if (sEncodingParam.iSpatialLayerNum < 1
708711 || 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);
709715 return cmInitParaError;
710716 }
711717
712718 if (sConfig.ParamTranscode (sEncodingParam)) {
719+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
720+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ParamTranscode failed!");
713721 return cmInitParaError;
714722 }
715723 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);
716727 return cmInitParaError;
717728 }
718729 if (sConfig.DetermineTemporalSettings()) {
730+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
731+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, DetermineTemporalSettings failed!");
719732 return cmInitParaError;
720733 }
721734
@@ -898,11 +911,17 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 176 unmodified lines
898911 }
899912 break;
900913 case ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION: {
901− bool iValue = * ((bool*)pOption);
902−
903− m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition = iValue;
904− WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable SPS/PPS ID = %d ",
905− m_pEncContext->pSvcParam->bEnableSpsPpsIdAddition);
914+ int32_t iValue = * ((int32_t*)pOption);
915+ if (((iValue > INCREASING_ID) || (m_pEncContext->pSvcParam->iSpsPpsIdStrategy > INCREASING_ID))
916+ && m_pEncContext->pSvcParam->iSpsPpsIdStrategy != iValue) {
917+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
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);
906925 }
907926 break;
908927 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