| 3332 | } |
| 3333 | |
| 3334 | void StackBackEncoderStatus (sWelsEncCtx* pEncCtx, |
| 3335 | EVideoFrameType keFrameType) { |
| 3336 | SSpatialLayerInternal* pParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId]; |
| 3337 | // for bitstream writing |
| 3338 | pEncCtx->iPosBsBuffer = 0; // reset bs pBuffer position |
| 3339 | pEncCtx->pOut->iNalIndex = 0; // reset NAL index |
| 3340 | pEncCtx->pOut->iLayerBsIndex = 0; // reset index of Layer Bs |
| 3341 | |
| 3342 | InitBits (&pEncCtx->pOut->sBsWrite, pEncCtx->pOut->pBsBuffer, pEncCtx->pOut->uiSize); |
| 3343 | if ((keFrameType == videoFrameTypeP) || (keFrameType == videoFrameTypeI)) { |
| 3344 | pParamInternal->iFrameIndex --; |
| 3345 | if (pParamInternal->iPOC != 0) { |
| 3346 | pParamInternal->iPOC -= 2; |
| 3347 | } else { |
| 3348 | pParamInternal->iPOC = (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2; |
| 3349 | } |
| 3350 | |
| 3351 | LoadBackFrameNum (pEncCtx, pEncCtx->uiDependencyId); |
| 3352 | |
| 3353 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; |
| 3354 | pEncCtx->eSliceType = P_SLICE; |
| 3355 | //pEncCtx->eNalPriority = pEncCtx->eLastNalPriority; //not need this since eNalPriority will be updated at the beginning of coding a frame |
| 3356 | } else if (keFrameType == videoFrameTypeIDR) { |
| 3357 | pParamInternal->uiIdrPicId --; |
| 3358 | |
| 3359 | //set the next frame to be IDR |
| 3360 | ForceCodingIDR (pEncCtx, pEncCtx->uiDependencyId); |
| 3361 | } else { // B pictures are not supported now, any else? |
| 3362 | assert (0); |
| 3363 | } |
| 3364 | |
| 3365 | // no need to stack back RC info since the info is still useful for later RQ model calculation |
| 3366 | // no need to stack back MB slicing info for dynamic balancing, since the info is still refer-able |
| 3367 | } |
| 3368 | |
| 3369 | void ClearFrameBsInfo (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi) { |
| 3370 | pFbi->sLayerInfo[0].pBsBuf = pCtx->pFrameBs; |
no test coverage detected