Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 4 files). Show all
Unified · Split
| @@ -822,6 +822,12 @@ void UpdateBufferWhenFrameSkipped (sWelsEncCtx* pEncCtx, int32_t iSpatialNum) { · 821 unmodified lines | ||
| 822 | 822 | |
| 823 | 823 | } |
| 824 | 824 | pEncCtx->iContinualSkipFrames++; |
| 825 | + if ( ( pEncCtx->iContinualSkipFrames % 3 ) == 0 ) { | |
| 826 | + //output a warning when iContinualSkipFrames is large enough, which may indicate subjective quality problem | |
| 827 | + //note that here iContinualSkipFrames must be >0, so the log output will be 3/6/.... | |
| 828 | + WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_WARNING, "[Rc] iContinualSkipFrames(%d) is large", | |
| 829 | + pEncCtx->iContinualSkipFrames); | |
| 830 | + } | |
| 825 | 831 | } |
| 826 | 832 | void UpdateMaxBrCheckWindowStatus (sWelsEncCtx* pEncCtx, int32_t iSpatialNum, const long long uiTimeStamp) { |
| 827 | 833 | SSpatialPicIndex* pSpatialIndexMap = &pEncCtx->sSpatialIndexMap[0]; |
| @@ -875,6 +881,16 @@ void UpdateMaxBrCheckWindowStatus (sWelsEncCtx* pEncCtx, int32_t iSpatialNum, co · 47 unmodified lines | ||
| 875 | 881 | return; |
| 876 | 882 | } |
| 877 | 883 | |
| 884 | +bool WelsRcPostFrameSkipping (sWelsEncCtx* pCtx, const int32_t iDid, const long long uiTimeStamp) { | |
| 885 | + //TODO: put in the decision of rate-control | |
| 886 | + return false; | |
| 887 | +} | |
| 888 | + | |
| 889 | +void WelsRcPostFrameSkippedUpdate (sWelsEncCtx* pCtx, const int32_t iDid) { | |
| 890 | + //TODO: do something to update buffers after post-skipping is done | |
| 891 | + //let RC know post-skipping happened and adjust strategy accordingly | |
| 892 | +} | |
| 893 | + | |
| 878 | 894 | void RcVBufferCalculationPadding (sWelsEncCtx* pEncCtx) { |
| 879 | 895 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; |
| 880 | 896 | const int32_t kiOutputBits = pWelsSvcRc->iBitsPerFrame; |
| @@ -1433,6 +1449,7 @@ void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode) { · 552 unmodified lines | ||
| 1433 | 1449 | pRcf->pfWelsCheckSkipBasedMaxbr = NULL; |
| 1434 | 1450 | pRcf->pfWelsUpdateBufferWhenSkip = NULL; |
| 1435 | 1451 | pRcf->pfWelsUpdateMaxBrWindowStatus = NULL; |
| 1452 | + pRcf->pfWelsRcPostFrameSkipping = NULL; | |
| 1436 | 1453 | break; |
| 1437 | 1454 | case RC_BUFFERBASED_MODE: |
| 1438 | 1455 | pRcf->pfWelsRcPictureInit = WelRcPictureInitBufferBasedQp; |
| @@ -1443,6 +1460,7 @@ void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode) { · 4 unmodified lines | ||
| 1443 | 1460 | pRcf->pfWelsCheckSkipBasedMaxbr = NULL; |
| 1444 | 1461 | pRcf->pfWelsUpdateBufferWhenSkip = NULL; |
| 1445 | 1462 | pRcf->pfWelsUpdateMaxBrWindowStatus = NULL; |
| 1463 | + pRcf->pfWelsRcPostFrameSkipping = NULL; | |
| 1446 | 1464 | break; |
| 1447 | 1465 | case RC_BITRATE_MODE: |
| 1448 | 1466 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom; |
| @@ -1453,6 +1471,18 @@ void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode) { · 4 unmodified lines | ||
| 1453 | 1471 | pRcf->pfWelsCheckSkipBasedMaxbr = CheckFrameSkipBasedMaxbr; |
| 1454 | 1472 | pRcf->pfWelsUpdateBufferWhenSkip = UpdateBufferWhenFrameSkipped; |
| 1455 | 1473 | pRcf->pfWelsUpdateMaxBrWindowStatus = UpdateMaxBrCheckWindowStatus; |
| 1474 | + pRcf->pfWelsRcPostFrameSkipping = WelsRcPostFrameSkipping; | |
| 1475 | + break; | |
| 1476 | + case RC_BITRATE_MODE_POST_SKIP: | |
| 1477 | + pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom; | |
| 1478 | + pRcf->pfWelsRcPicDelayJudge = WelsRcFrameDelayJudge; | |
| 1479 | + pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateGom; | |
| 1480 | + pRcf->pfWelsRcMbInit = WelsRcMbInitGom; | |
| 1481 | + pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateGom; | |
| 1482 | + pRcf->pfWelsCheckSkipBasedMaxbr = CheckFrameSkipBasedMaxbr; | |
| 1483 | + pRcf->pfWelsUpdateBufferWhenSkip = UpdateBufferWhenFrameSkipped; | |
| 1484 | + pRcf->pfWelsUpdateMaxBrWindowStatus = UpdateMaxBrCheckWindowStatus; | |
| 1485 | + pRcf->pfWelsRcPostFrameSkipping = WelsRcPostFrameSkipping; | |
| 1456 | 1486 | break; |
| 1457 | 1487 | case RC_TIMESTAMP_MODE: |
| 1458 | 1488 | if (pEncCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| @@ -1471,6 +1501,7 @@ void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode) { · 12 unmodified lines | ||
| 1471 | 1501 | pRcf->pfWelsCheckSkipBasedMaxbr = CheckFrameSkipBasedMaxbr; |
| 1472 | 1502 | pRcf->pfWelsUpdateBufferWhenSkip = NULL; |
| 1473 | 1503 | pRcf->pfWelsUpdateMaxBrWindowStatus = NULL; |
| 1504 | + pRcf->pfWelsRcPostFrameSkipping = NULL; | |
| 1474 | 1505 | InitRcModuleTimeStamp (pEncCtx); |
| 1475 | 1506 | break; |
| 1476 | 1507 | case RC_QUALITY_MODE: |
| @@ -1483,7 +1514,7 @@ void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode) { · 6 unmodified lines | ||
| 1483 | 1514 | pRcf->pfWelsCheckSkipBasedMaxbr = CheckFrameSkipBasedMaxbr; |
| 1484 | 1515 | pRcf->pfWelsUpdateBufferWhenSkip = UpdateBufferWhenFrameSkipped; |
| 1485 | 1516 | pRcf->pfWelsUpdateMaxBrWindowStatus = UpdateMaxBrCheckWindowStatus; |
| 1486 | − | |
| 1517 | + pRcf->pfWelsRcPostFrameSkipping = NULL; | |
| 1487 | 1518 | break; |
| 1488 | 1519 | } |
| 1489 | 1520 | } |