History

Merge pull request #2323 from ruil2/rc_timestamp

resolve abnormal timestamp(rollback or jump case)

HaiboZhu committed 10 years ago

Commit cd755412 parents 5398181 0d5db3d1 file · +10 −6Browse files

Unified · Split

codec/encoder/core/src/ratectl.cpp+10−6
@@ -193,10 +193,10 @@ void RcInitTlWeight (sWelsEncCtx* pEncCtx) { · 192 unmodified lines
193 n = 0;193 n = 0;
194 while (n <= kiHighestTid) {194 while (n <= kiHighestTid) {
195 pTOverRc[n].iTlayerWeight = iWeightArray[kiDecompositionStages][n];195 pTOverRc[n].iTlayerWeight = iWeightArray[kiDecompositionStages][n];
196 pTOverRc[n].iMinQp = pWelsSvcRc->iMinQp + (n<<1);196 pTOverRc[n].iMinQp = pWelsSvcRc->iMinQp + (n << 1);
197 pTOverRc[n].iMinQp = WELS_CLIP3(pTOverRc[n].iMinQp, 0, 51);197 pTOverRc[n].iMinQp = WELS_CLIP3 (pTOverRc[n].iMinQp, 0, 51);
198 pTOverRc[n].iMaxQp = pWelsSvcRc->iMaxQp + (n<<1);198 pTOverRc[n].iMaxQp = pWelsSvcRc->iMaxQp + (n << 1);
199 pTOverRc[n].iMaxQp = WELS_CLIP3(pTOverRc[n].iMaxQp, pTOverRc[n].iMinQp, 51);199 pTOverRc[n].iMaxQp = WELS_CLIP3 (pTOverRc[n].iMaxQp, pTOverRc[n].iMinQp, 51);
200 ++ n;200 ++ n;
201 }201 }
202//Calculate the frame index for the current frame and its reference frame202//Calculate the frame index for the current frame and its reference frame
@@ -660,7 +660,7 @@ void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) { · 457 unmodified lines
660 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;660 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;
661 int64_t iTargetLeftBits = iLeftBits + pSOverRc->iGomBitsSlice - pSOverRc->iGomTargetBits;661 int64_t iTargetLeftBits = iLeftBits + pSOverRc->iGomBitsSlice - pSOverRc->iGomTargetBits;
662 662
663 if ((iLeftBits <= 0)||(iTargetLeftBits <=0)) {663 if ((iLeftBits <= 0) || (iTargetLeftBits <= 0)) {
664 pSOverRc->iCalculatedQpSlice += 2;664 pSOverRc->iCalculatedQpSlice += 2;
665 } else {665 } else {
666//globe decision666//globe decision
@@ -1076,7 +1076,7 @@ void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) { · 409 unmodified lines
1076 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;1076 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
1077 1077
1078 pSOverRc->iBsPosSlice = BsGetBitsPos (bs);1078 pSOverRc->iBsPosSlice = BsGetBitsPos (bs);
1079 if((pEncCtx->pSvcParam->iRCMode == RC_BITRATE_MODE)&&(pEncCtx->eSliceType == I_SLICE)){1079 if ((pEncCtx->pSvcParam->iRCMode == RC_BITRATE_MODE) && (pEncCtx->eSliceType == I_SLICE)) {
1080 pCurMb->uiLumaQp = pEncCtx->iGlobalQp;1080 pCurMb->uiLumaQp = pEncCtx->iGlobalQp;
1081 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];1081 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
1082 return;1082 return;
@@ -1288,6 +1288,10 @@ void WelsRcFrameDelayJudgeTimeStamp (sWelsEncCtx* pEncCtx, EVideoFrameType eFram · 205 unmodified lines
1288 1288
1289 int32_t iBitRate = pDLayerConfig->iSpatialBitrate;1289 int32_t iBitRate = pDLayerConfig->iSpatialBitrate;
1290 int32_t iEncTimeInv = (pWelsSvcRc->uiLastTimeStamp == 0) ? 0 : (int32_t) (uiTimeStamp - pWelsSvcRc->uiLastTimeStamp);1290 int32_t iEncTimeInv = (pWelsSvcRc->uiLastTimeStamp == 0) ? 0 : (int32_t) (uiTimeStamp - pWelsSvcRc->uiLastTimeStamp);
1291 if ((iEncTimeInv < 0) || (iEncTimeInv > 1000)) {
1292 pWelsSvcRc->uiLastTimeStamp = uiTimeStamp - 1000.0 / pDLayerConfig->fFrameRate;
1293 iEncTimeInv = 1000.0 / pDLayerConfig->fFrameRate;
1294 }
1291 int32_t iSentBits = (int32_t) ((double)iBitRate * iEncTimeInv * (1.0E-3) + 0.5);1295 int32_t iSentBits = (int32_t) ((double)iBitRate * iEncTimeInv * (1.0E-3) + 0.5);
1292 iSentBits = WELS_MAX (iSentBits, 0);1296 iSentBits = WELS_MAX (iSentBits, 0);
1293 1297

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