| 288 | } |
| 289 | |
| 290 | void RcInitRefreshParameter (sWelsEncCtx* pEncCtx) { |
| 291 | const int32_t kiDid = pEncCtx->uiDependencyId; |
| 292 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid]; |
| 293 | SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc; |
| 294 | SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[kiDid]; |
| 295 | SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[kiDid]; |
| 296 | const int32_t kiHighestTid = pDLayerParamInternal->iHighestTemporalId; |
| 297 | const bool fix_rc_overshoot = pEncCtx->pSvcParam->bFixRCOverShoot; |
| 298 | int32_t i; |
| 299 | |
| 300 | //I frame R-Q Model |
| 301 | pWelsSvcRc->iIntraComplexity = 0; |
| 302 | pWelsSvcRc->iIntraMbCount = 0; |
| 303 | pWelsSvcRc->iIntraComplxMean = 0; |
| 304 | //P frame R-Q Model |
| 305 | for (i = 0; i <= kiHighestTid; i++) { |
| 306 | pTOverRc[i].iPFrameNum = 0; |
| 307 | pTOverRc[i].iLinearCmplx = 0; |
| 308 | pTOverRc[i].iFrameCmplxMean = 0; |
| 309 | } |
| 310 | |
| 311 | pWelsSvcRc->iBufferFullnessSkip = 0; |
| 312 | pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] = 0; |
| 313 | pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] = 0; |
| 314 | pWelsSvcRc->iPredFrameBit = 0; |
| 315 | pWelsSvcRc->iBufferFullnessPadding = 0; |
| 316 | |
| 317 | pWelsSvcRc->iGopIndexInVGop = 0; |
| 318 | if (fix_rc_overshoot) { |
| 319 | pWelsSvcRc->iLastAllocatedBits = 0; |
| 320 | } |
| 321 | pWelsSvcRc->iRemainingBits = 0; |
| 322 | pWelsSvcRc->iBitsPerFrame = 0; |
| 323 | |
| 324 | //Backup the initial bitrate and fps |
| 325 | pWelsSvcRc->iPreviousBitrate = pDLayerParam->iSpatialBitrate; |
| 326 | pWelsSvcRc->dPreviousFps = pDLayerParamInternal->fOutputFrameRate; |
| 327 | |
| 328 | memset (pWelsSvcRc->pCurrentFrameGomSad, 0, pWelsSvcRc->iGomSize * sizeof (int32_t)); |
| 329 | |
| 330 | RcInitTlWeight (pEncCtx); |
| 331 | RcUpdateBitrateFps (pEncCtx); |
| 332 | RcInitVGop (pEncCtx); |
| 333 | } |
| 334 | |
| 335 | bool RcJudgeBitrateFpsUpdate (sWelsEncCtx* pEncCtx) { |
| 336 | int32_t iCurDid = pEncCtx->uiDependencyId; |
no test coverage detected