| 3378 | pFbi->iFrameSizeInBytes = 0; |
| 3379 | } |
| 3380 | EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsInfo, int32_t iSpatialNum, |
| 3381 | int8_t& iCurDid, int32_t& iCurTid, |
| 3382 | int32_t& iLayerNum, int32_t& iFrameSize, long long uiTimeStamp) { |
| 3383 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; |
| 3384 | SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0]; |
| 3385 | |
| 3386 | bool bSkipFrameFlag = WelsRcCheckFrameStatus (pCtx, uiTimeStamp, iSpatialNum, iCurDid); |
| 3387 | EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid, bSkipFrameFlag); |
| 3388 | if (eFrameType == videoFrameTypeSkip) { |
| 3389 | if (pSvcParam->bSimulcastAVC) { |
| 3390 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) |
| 3391 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iCurDid); |
| 3392 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3393 | "[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames", |
| 3394 | uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames); |
| 3395 | } |
| 3396 | |
| 3397 | else { |
| 3398 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) { |
| 3399 | for (int32_t i = 0; i < iSpatialNum; i++) { |
| 3400 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, (pSpatialIndexMap + i)->iDid); |
| 3401 | } |
| 3402 | } |
| 3403 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3404 | "[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames", |
| 3405 | uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames); |
| 3406 | } |
| 3407 | |
| 3408 | } else { |
| 3409 | SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iCurDid]; |
| 3410 | |
| 3411 | iCurTid = GetTemporalLevel (pParamInternal, pParamInternal->iCodingIndex, |
| 3412 | pSvcParam->uiGopSize); |
| 3413 | pCtx->uiTemporalId = iCurTid; |
| 3414 | if (eFrameType == videoFrameTypeIDR) { |
| 3415 | // write parameter sets bitstream or SEI/SSEI (if any) here |
| 3416 | // TODO: use function pointer instead |
| 3417 | if (! (SPS_LISTING & pCtx->pSvcParam->eSpsPpsIdStrategy)) { |
| 3418 | if (pSvcParam->bSimulcastAVC) { |
| 3419 | pCtx->iEncoderError = WriteSavcParaset (pCtx, iCurDid, pLayerBsInfo, iLayerNum, iFrameSize); |
| 3420 | ++ pParamInternal->uiIdrPicId; |
| 3421 | } else { |
| 3422 | pCtx->iEncoderError = WriteSsvcParaset (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize); |
| 3423 | } |
| 3424 | } else { |
| 3425 | pCtx->iEncoderError = WriteSavcParaset_Listing (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize); |
| 3426 | |
| 3427 | |
| 3428 | } |
| 3429 | } |
| 3430 | } |
| 3431 | return eFrameType; |
| 3432 | } |
| 3433 | /*! |
| 3434 | * \brief core svc encoding process |
| 3435 | * |
no test coverage detected