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

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all

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
9292 return ENC_RETURN_UNSUPPORTED_PARA;
9393 }
9494 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",
9696 pCfg->bEnableAdaptiveQuant);
97− pCfg->bEnableAdaptiveQuant = false;
97+ pCfg->bEnableAdaptiveQuant = false;
9898 }
9999 }
100100 if (pCfg->iSpatialLayerNum > 1) {
@@ -458,12 +458,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 357 unmodified lines
458458 const int32_t iNumLayers = pParam->iSpatialLayerNum;
459459 int32_t i, iOrigTotalBitrate = 0;
460460 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− }
467461 //read old BR
468462 for (i = 0; i < iNumLayers; i++) {
469463 iOrigTotalBitrate += pParam->sSpatialLayers[i].iSpatialBitrate;
@@ -475,14 +469,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 5 unmodified lines
475469 fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate));
476470 pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio);
477471 }
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−
486472 }
487473 }
488474 /*!
@@ -2943,6 +2929,28 @@ int32_t GetSubSequenceId (sWelsEncCtx* pCtx, EVideoFrameType eFrameType) { · 2454 unmodified lines
29432929 iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM;
29442930 return iSubSeqId;
29452931 }
2932+
2933+//loop each layer to check if have skip frame when RC and frame skip enable (maxbr>0)
2934+bool 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+
29462954 /*!
29472955 * \brief core svc encoding process
29482956 *
@@ -3003,22 +3011,11 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 54 unmodified lines
30033011 }
30043012
30053013 //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) {
3007− bool bSkipMustFlag = false;
3008− for (int32_t i = 0; i < iSpatialNum; i++) {
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− }
3014+ if (CheckFrameSkipBasedMaxbr(pCtx, iSpatialNum)) {
3015+ pFbi->eFrameType = videoFrameTypeSkip;
3016+ return ENC_RETURN_SUCCESS;
30193017 }
30203018
3021−
30223019 InitFrameCoding (pCtx, eFrameType);
30233020
30243021 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