Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -494,7 +494,8 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 493 unmodified lines | |||
| 494 | pLayerParam = & (pParam->sSpatialLayers[i]); | 494 | pLayerParam = & (pParam->sSpatialLayers[i]); |
| 495 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); | 495 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); |
| 496 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); | 496 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); |
| 497 | if ( UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate ) { | 497 | if (UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate |
| 498 | && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate) { | ||
| 498 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 499 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 499 | "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", | 500 | "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", |
| 500 | pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); | 501 | pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); |
| @@ -503,7 +504,8 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 2 unmodified lines | |||
| 503 | } | 504 | } |
| 504 | } else { | 505 | } else { |
| 505 | SSpatialLayerConfig* pLayerParam = & (pParam->sSpatialLayers[iLayer]); | 506 | SSpatialLayerConfig* pLayerParam = & (pParam->sSpatialLayers[iLayer]); |
| 506 | if ( UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate ) { | 507 | if (UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate |
| 508 | && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate) { | ||
| 507 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 509 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 508 | "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", | 510 | "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", |
| 509 | pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); | 511 | pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); |
| @@ -3087,24 +3089,24 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2577 unmodified lines | |||
| 3087 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) | 3089 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) |
| 3088 | ++ pCtx->iCodingIndex; | 3090 | ++ pCtx->iCodingIndex; |
| 3089 | pFbi->eFrameType = videoFrameTypeSkip; | 3091 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3090 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld", | 3092 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, Frame type =%d", |
| 3091 | pSrcPic->uiTimeStamp); | 3093 | pSrcPic->uiTimeStamp, pFbi->eFrameType); |
| 3092 | return ENC_RETURN_SUCCESS; | 3094 | return ENC_RETURN_SUCCESS; |
| 3093 | } | 3095 | } |
| 3094 | 3096 | ||
| 3095 | eFrameType = DecideFrameType (pCtx, iSpatialNum); | 3097 | eFrameType = DecideFrameType (pCtx, iSpatialNum); |
| 3096 | if (eFrameType == videoFrameTypeSkip) { | 3098 | if (eFrameType == videoFrameTypeSkip) { |
| 3097 | pFbi->eFrameType = eFrameType; | 3099 | pFbi->eFrameType = eFrameType; |
| 3098 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld", | 3100 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, Frame type =%d", |
| 3099 | pSrcPic->uiTimeStamp); | 3101 | pSrcPic->uiTimeStamp, pFbi->eFrameType); |
| 3100 | return ENC_RETURN_SUCCESS; | 3102 | return ENC_RETURN_SUCCESS; |
| 3101 | } | 3103 | } |
| 3102 | 3104 | ||
| 3103 | //loop each layer to check if have skip frame when RC and frame skip enable | 3105 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 3104 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, pSrcPic->uiTimeStamp)) { | 3106 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, pSrcPic->uiTimeStamp)) { |
| 3105 | pFbi->eFrameType = videoFrameTypeSkip; | 3107 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3106 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld", | 3108 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, Frame type =%d", |
| 3107 | pSrcPic->uiTimeStamp); | 3109 | pSrcPic->uiTimeStamp, pFbi->eFrameType); |
| 3108 | return ENC_RETURN_SUCCESS; | 3110 | return ENC_RETURN_SUCCESS; |
| 3109 | } | 3111 | } |
| 3110 | InitFrameCoding (pCtx, eFrameType); | 3112 | InitFrameCoding (pCtx, eFrameType); |
| @@ -3701,8 +3703,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 590 unmodified lines | |||
| 3701 | pFbi->iLayerNum = iLayerNum; | 3703 | pFbi->iLayerNum = iLayerNum; |
| 3702 | pFbi->iSubSeqId = GetSubSequenceId (pCtx, eFrameType); | 3704 | pFbi->iSubSeqId = GetSubSequenceId (pCtx, eFrameType); |
| 3703 | 3705 | ||
| 3704 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerNum = %d,iSubSeqId = %d", iLayerNum, | 3706 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerNum = %d,iSubSeqId = %d,iFrameSize = %d", |
| 3705 | pFbi->iSubSeqId); | 3707 | iLayerNum, |
| 3708 | pFbi->iSubSeqId, iFrameSize); | ||
| 3706 | for (int32_t i = 0; i < iLayerNum; i++) | 3709 | for (int32_t i = 0; i < iLayerNum; i++) |
| 3707 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d", i, | 3710 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d", i, |
| 3708 | pFbi->sLayerInfo[i].uiLayerType, pFbi->sLayerInfo[i].iNalCount); | 3711 | pFbi->sLayerInfo[i].uiLayerType, pFbi->sLayerInfo[i].iNalCount); |