History

Merge pull request #2481 from ruil2/maxbitrate1

fix iContinualSkipFrames calculation

HaiboZhu committed 10 years ago

Commit 515eeb42 parents 7ccc377 87e81a74 files · +21 −22Browse files

Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 4 files). Show all

Unified · Split

codec/encoder/core/src/ratectl.cpp+9−10
@@ -736,9 +736,9 @@ void CheckFrameSkipBasedMaxbr (sWelsEncCtx* pEncCtx, const long long uiTimeStamp · 735 unmodified lines
736736 3:if in last ODD_TIME_WINDOW the MAX Br is overflowed, make more strict skipping conditions
737737 4:such as case 3 in the other window
738738 */
739− bool bJudgeBufferFullSkip = (pEncCtx->iContinualSkipFrames <= iPredSkipFramesTarBr)
739+ bool bJudgeBufferFullSkip = (pWelsSvcRc->iContinualSkipFrames <= iPredSkipFramesTarBr)
740740 && (pWelsSvcRc->iBufferFullnessSkip > pWelsSvcRc->iBufferSizeSkip);
741− bool bJudgeMaxBRbufferFullSkip = (pEncCtx->iContinualSkipFrames <= iPredSkipFramesMaxBr)
741+ bool bJudgeMaxBRbufferFullSkip = (pWelsSvcRc->iContinualSkipFrames <= iPredSkipFramesMaxBr)
742742 && (pEncCtx->iCheckWindowInterval > TIME_CHECK_WINDOW / 2)
743743 && (pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] + pWelsSvcRc->iPredFrameBit - iAvailableBitsInTimeWindow > 0);
744744 bJudgeMaxBRbSkip[EVEN_TIME_WINDOW] = (pEncCtx->iCheckWindowInterval > TIME_CHECK_WINDOW / 2)
@@ -797,7 +797,7 @@ bool WelsRcCheckFrameStatus (sWelsEncCtx* pEncCtx, long long uiTimeStamp, int32_ · 52 unmodified lines
797797 if (bSkipMustFlag) {
798798 pEncCtx->pWelsSvcRc[iDidIdx].uiLastTimeStamp = uiTimeStamp;
799799 pEncCtx->pWelsSvcRc[iDidIdx].bSkipFlag = false;
800− pEncCtx->iContinualSkipFrames++;
800+ pEncCtx->pWelsSvcRc[iDidIdx].iContinualSkipFrames++;
801801 return true;
802802 }
803803 } else { //SVC control
@@ -821,7 +821,6 @@ bool WelsRcCheckFrameStatus (sWelsEncCtx* pEncCtx, long long uiTimeStamp, int32_ · 17 unmodified lines
821821 }
822822 }
823823 if (bSkipMustFlag) {
824− pEncCtx->iContinualSkipFrames++;
825824 break;
826825 }
827826 }
@@ -831,6 +830,7 @@ bool WelsRcCheckFrameStatus (sWelsEncCtx* pEncCtx, long long uiTimeStamp, int32_ · 3 unmodified lines
831830 int32_t iDidIdx = (pSpatialIndexMap + i)->iDid;
832831 pEncCtx->pWelsSvcRc[iDidIdx].uiLastTimeStamp = uiTimeStamp;
833832 pEncCtx->pWelsSvcRc[iDidIdx].bSkipFlag = false;
833+ pEncCtx->pWelsSvcRc[iDidIdx].iContinualSkipFrames++;
834834 }
835835 return true;
836836 }
@@ -845,8 +845,8 @@ void UpdateBufferWhenFrameSkipped (sWelsEncCtx* pEncCtx, int32_t iCurDid) { · 8 unmodified lines
845845 pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] -= kiOutputMaxBits;
846846 pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] -= kiOutputMaxBits;
847847 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
848− "[Rc] bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64,
849− pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW]);
848+ "[Rc] iDid = %d,bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64,
849+ iCurDid,pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW]);
850850
851851 pWelsSvcRc->iBufferFullnessSkip = WELS_MAX (pWelsSvcRc->iBufferFullnessSkip, 0);
852852
@@ -854,12 +854,11 @@ void UpdateBufferWhenFrameSkipped (sWelsEncCtx* pEncCtx, int32_t iCurDid) { · 1 unmodified line
854854 pWelsSvcRc->iSkipFrameNum++;
855855 pWelsSvcRc->iSkipFrameInVGop++;
856856
857− pEncCtx->iContinualSkipFrames++;
858− if ((pEncCtx->iContinualSkipFrames % 3) == 0) {
857+ if ((pWelsSvcRc->iContinualSkipFrames % 3) == 0) {
859858 //output a warning when iContinualSkipFrames is large enough, which may indicate subjective quality problem
860859 //note that here iContinualSkipFrames must be >0, so the log output will be 3/6/....
861− WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_WARNING, "[Rc] iContinualSkipFrames(%d) is large",
862− pEncCtx->iContinualSkipFrames);
860+ WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_WARNING, "[Rc] iDid = %d,iContinualSkipFrames(%d) is large",
861+ iCurDid,pWelsSvcRc->iContinualSkipFrames);
863862 }
864863 }
865864 void UpdateMaxBrCheckWindowStatus (sWelsEncCtx* pEncCtx, int32_t iSpatialNum, const long long uiTimeStamp) {

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