Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 9 files). Show all
Unified · Split
| @@ -487,7 +487,7 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 486 unmodified lines | ||
| 487 | 487 | void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { |
| 488 | 488 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 489 | 489 | "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\ |
| 490 | − iSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\ | |
| 490 | + eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\ | |
| 491 | 491 | iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d)", |
| 492 | 492 | pParam->iUsageType, |
| 493 | 493 | pParam->iPicWidth, |
| @@ -500,7 +500,7 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 6 unmodified lines | ||
| 500 | 500 | pParam->iSpatialLayerNum, |
| 501 | 501 | pParam->fMaxFrameRate, |
| 502 | 502 | pParam->uiIntraPeriod, |
| 503 | − pParam->iSpsPpsIdStrategy, | |
| 503 | + pParam->eSpsPpsIdStrategy, | |
| 504 | 504 | pParam->bPrefixNalAddingCtrl, |
| 505 | 505 | pParam->bEnableDenoise, |
| 506 | 506 | pParam->bEnableBackgroundDetection, |
| @@ -911,17 +911,41 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 404 unmodified lines | ||
| 911 | 911 | } |
| 912 | 912 | break; |
| 913 | 913 | case ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION: { |
| 914 | − int32_t iValue = * ((int32_t*)pOption); | |
| 915 | − if (((iValue > INCREASING_ID) || (m_pEncContext->pSvcParam->iSpsPpsIdStrategy > INCREASING_ID)) | |
| 916 | − && m_pEncContext->pSvcParam->iSpsPpsIdStrategy != iValue) { | |
| 914 | + int32_t iValue = * (static_cast<int32_t*>(pOption)); | |
| 915 | + EParameterSetStrategy eNewStrategy = CONSTANT_ID; | |
| 916 | + switch (iValue) { | |
| 917 | + case 0: | |
| 918 | + eNewStrategy = CONSTANT_ID; | |
| 919 | + break; | |
| 920 | + case 0x01: | |
| 921 | + eNewStrategy = INCREASING_ID; | |
| 922 | + break; | |
| 923 | + case 0x02: | |
| 924 | + eNewStrategy = SPS_LISTING; | |
| 925 | + break; | |
| 926 | + case 0x03: | |
| 927 | + eNewStrategy = SPS_LISTING_AND_PPS_INCREASING; | |
| 928 | + break; | |
| 929 | + case 0x06: | |
| 930 | + eNewStrategy = SPS_PPS_LISTING; | |
| 931 | + break; | |
| 932 | + default: | |
| 933 | + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, | |
| 934 | + " CWelsH264SVCEncoder::SetOption eSpsPpsIdStrategy(%d) not in valid range, unchanged! existing=%d", | |
| 935 | + iValue, m_pEncContext->pSvcParam->eSpsPpsIdStrategy); | |
| 936 | + break; | |
| 937 | + } | |
| 938 | + | |
| 939 | + if (((eNewStrategy & SPS_LISTING) || (m_pEncContext->pSvcParam->eSpsPpsIdStrategy & SPS_LISTING)) | |
| 940 | + && m_pEncContext->pSvcParam->eSpsPpsIdStrategy != eNewStrategy) { | |
| 917 | 941 | 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); | |
| 942 | + " CWelsH264SVCEncoder::SetOption eSpsPpsIdStrategy changing in the middle of call is NOT allowed for eSpsPpsIdStrategy>INCREASING_ID: existing setting is %d and the new one is %d", | |
| 943 | + m_pEncContext->pSvcParam->eSpsPpsIdStrategy, iValue); | |
| 920 | 944 | return cmInitParaError; |
| 921 | 945 | } |
| 922 | − m_pEncContext->pSvcParam->iSpsPpsIdStrategy = iValue; | |
| 923 | − WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption iSpsPpsIdStrategy = %d ", | |
| 924 | − m_pEncContext->pSvcParam->iSpsPpsIdStrategy); | |
| 946 | + m_pEncContext->pSvcParam->eSpsPpsIdStrategy = eNewStrategy; | |
| 947 | + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption eSpsPpsIdStrategy = %d ", | |
| 948 | + m_pEncContext->pSvcParam->eSpsPpsIdStrategy); | |
| 925 | 949 | } |
| 926 | 950 | break; |
| 927 | 951 | case ENCODER_OPTION_CURRENT_PATH: { |