! * \brief initialize frame coding */
| 279 | * \brief initialize frame coding |
| 280 | */ |
| 281 | void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType, const int32_t kiDidx) { |
| 282 | SSpatialLayerInternal* pParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[kiDidx]; |
| 283 | if (keFrameType == videoFrameTypeP) { |
| 284 | ++pParamInternal->iFrameIndex; |
| 285 | |
| 286 | if (pParamInternal->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - |
| 287 | 2) // if iPOC type is no 0, this need be modification |
| 288 | pParamInternal->iPOC += 2; // for POC type 0 |
| 289 | else |
| 290 | pParamInternal->iPOC = 0; |
| 291 | |
| 292 | UpdateFrameNum (pEncCtx, kiDidx); |
| 293 | |
| 294 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; |
| 295 | pEncCtx->eSliceType = P_SLICE; |
| 296 | pEncCtx->eNalPriority = NRI_PRI_HIGH; |
| 297 | } else if (keFrameType == videoFrameTypeIDR) { |
| 298 | pParamInternal->iFrameNum = 0; |
| 299 | pParamInternal->iPOC = 0; |
| 300 | pParamInternal->bEncCurFrmAsIdrFlag = false; |
| 301 | pParamInternal->iFrameIndex = 0; |
| 302 | |
| 303 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE_IDR; |
| 304 | pEncCtx->eSliceType = I_SLICE; |
| 305 | pEncCtx->eNalPriority = NRI_PRI_HIGHEST; |
| 306 | |
| 307 | pParamInternal->iCodingIndex = 0; |
| 308 | |
| 309 | // reset_ref_list |
| 310 | |
| 311 | // rc_init_gop |
| 312 | } else if (keFrameType == videoFrameTypeI) { |
| 313 | if (pParamInternal->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - |
| 314 | 2) // if iPOC type is no 0, this need be modification |
| 315 | pParamInternal->iPOC += 2; // for POC type 0 |
| 316 | else |
| 317 | pParamInternal->iPOC = 0; |
| 318 | |
| 319 | UpdateFrameNum (pEncCtx, kiDidx); |
| 320 | |
| 321 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; |
| 322 | pEncCtx->eSliceType = I_SLICE; |
| 323 | pEncCtx->eNalPriority = NRI_PRI_HIGHEST; |
| 324 | |
| 325 | // rc_init_gop |
| 326 | } else { // B pictures are not supported now, any else? |
| 327 | assert (0); |
| 328 | } |
| 329 | |
| 330 | #if defined(STAT_OUTPUT) |
| 331 | memset (&pEncCtx->sPerInfo, 0, sizeof (SStatSliceInfo)); |
| 332 | #endif//FRAME_INFO_OUTPUT |
| 333 | } |
| 334 | |
| 335 | EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum, const int32_t kiDidx, |
| 336 | bool bSkipFrameFlag) { |
no test coverage detected