History

disable delay skip if maxbr=0 which means no maxbr setting from upper layer

JuannyWang committed 12 years ago

Commit 24cd5af1 parent 0fa845e1 file · +27 −30Browse files

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+27−30
@@ -92,9 +92,9 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 91 unmodified lines
92 return ENC_RETURN_UNSUPPORTED_PARA;92 return ENC_RETURN_UNSUPPORTED_PARA;
93 }93 }
94 if (pCfg->bEnableAdaptiveQuant) {94 if (pCfg->bEnableAdaptiveQuant) {
95 WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidation(), AdaptiveQuant(%d) is not supported yet for screen content, auto turned off\n",95 WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidation(), AdaptiveQuant(%d) is not supported yet for screen content, auto turned off\n",
96 pCfg->bEnableAdaptiveQuant);96 pCfg->bEnableAdaptiveQuant);
97 pCfg->bEnableAdaptiveQuant = false;97 pCfg->bEnableAdaptiveQuant = false;
98 }98 }
99 }99 }
100 if (pCfg->iSpatialLayerNum > 1) {100 if (pCfg->iSpatialLayerNum > 1) {
@@ -458,12 +458,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 357 unmodified lines
458 const int32_t iNumLayers = pParam->iSpatialLayerNum;458 const int32_t iNumLayers = pParam->iSpatialLayerNum;
459 int32_t i, iOrigTotalBitrate = 0;459 int32_t i, iOrigTotalBitrate = 0;
460 if (iLayer == SPATIAL_LAYER_ALL) {460 if (iLayer == SPATIAL_LAYER_ALL) {
461 if (pParam->iMaxBitrate < pParam->iTargetBitrate) {
462 WelsLog (pLogCtx, WELS_LOG_WARNING,
463 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,overall settting,TargetBitrate = %d,iMaxBitrate = %d\n",
464 pParam->iTargetBitrate, pParam->iMaxBitrate);
465 pParam->iMaxBitrate = pParam->iTargetBitrate;
466 }
467 //read old BR461 //read old BR
468 for (i = 0; i < iNumLayers; i++) {462 for (i = 0; i < iNumLayers; i++) {
469 iOrigTotalBitrate += pParam->sSpatialLayers[i].iSpatialBitrate;463 iOrigTotalBitrate += pParam->sSpatialLayers[i].iSpatialBitrate;
@@ -475,14 +469,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 5 unmodified lines
475 fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate));469 fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate));
476 pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio);470 pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio);
477 }471 }
478 } else {
479 if (pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate < pParam->sSpatialLayers[iLayer].iSpatialBitrate) {
480 WelsLog (pLogCtx, WELS_LOG_WARNING,
481 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d,iTargetBitrate = %d,iMaxBitrate = %d\n",
482 iLayer, pParam->sSpatialLayers[iLayer].iSpatialBitrate, pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate);
483 pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate = pParam->sSpatialLayers[iLayer].iSpatialBitrate;
484 }
485
486 }472 }
487}473}
488/*!474/*!
@@ -2943,6 +2929,28 @@ int32_t GetSubSequenceId (sWelsEncCtx* pCtx, EVideoFrameType eFrameType) { · 2454 unmodified lines
2943 iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM;2929 iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM;
2944 return iSubSeqId;2930 return iSubSeqId;
2945}2931}
2932
2933//loop each layer to check if have skip frame when RC and frame skip enable (maxbr>0)
2934bool CheckFrameSkipBasedMaxbr(sWelsEncCtx* pCtx, int32_t iSpatialNum) {
2935 SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
2936 bool bSkipMustFlag = false;
2937
2938 if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) {
2939 for (int32_t i = 0; i < iSpatialNum; i++) {
2940 if(0 == pCtx->pSvcParam->sSpatialLayers[i].iMaxSpatialBitrate) {
2941 break;
2942 }
2943 pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid;
2944 pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx);
2945 if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) {
2946 bSkipMustFlag = true;
2947 break;
2948 }
2949 }
2950 }
2951 return bSkipMustFlag;
2952}
2953
2946/*!2954/*!
2947 * \brief core svc encoding process2955 * \brief core svc encoding process
2948 *2956 *
@@ -3003,22 +3011,11 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 54 unmodified lines
3003 }3011 }
3004 3012
3005 //loop each layer to check if have skip frame when RC and frame skip enable3013 //loop each layer to check if have skip frame when RC and frame skip enable
3006 if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) {3014 if (CheckFrameSkipBasedMaxbr(pCtx, iSpatialNum)) {
3007 bool bSkipMustFlag = false;3015 pFbi->eFrameType = videoFrameTypeSkip;
3008 for (int32_t i = 0; i < iSpatialNum; i++) {3016 return ENC_RETURN_SUCCESS;
3009 pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid;
3010 pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx);
3011 if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) {
3012 bSkipMustFlag = true;
3013 }
3014 }
3015 if (true == bSkipMustFlag) {
3016 pFbi->eFrameType = videoFrameTypeSkip;
3017 return ENC_RETURN_SUCCESS;
3018 }
3019 }3017 }
3020 3018
3021
3022 InitFrameCoding (pCtx, eFrameType);3019 InitFrameCoding (pCtx, eFrameType);
3023 3020
3024 iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[pSpatialIndexMap->iDid], pCtx->iCodingIndex,3021 iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[pSpatialIndexMap->iDid], pCtx->iCodingIndex,

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