! * \brief initialize current layer */
| 2525 | * \brief initialize current layer |
| 2526 | */ |
| 2527 | void WelsInitCurrentLayer (sWelsEncCtx* pCtx, |
| 2528 | const int32_t kiWidth, |
| 2529 | const int32_t kiHeight) { |
| 2530 | SWelsSvcCodingParam* pParam = pCtx->pSvcParam; |
| 2531 | SPicture* pEncPic = pCtx->pEncPic; |
| 2532 | SPicture* pDecPic = pCtx->pDecPic; |
| 2533 | SDqLayer* pCurDq = pCtx->pCurDqLayer; |
| 2534 | SSlice* pBaseSlice = pCurDq->ppSliceInLayer[0]; |
| 2535 | const uint8_t kiCurDid = pCtx->uiDependencyId; |
| 2536 | const bool kbUseSubsetSpsFlag = (!pParam->bSimulcastAVC) && (kiCurDid > BASE_DEPENDENCY_ID); |
| 2537 | SNalUnitHeaderExt* pNalHdExt = &pCurDq->sLayerInfo.sNalHeaderExt; |
| 2538 | SNalUnitHeader* pNalHd = &pNalHdExt->sNalUnitHeader; |
| 2539 | SDqIdc* pDqIdc = &pCtx->pDqIdcMap[kiCurDid]; |
| 2540 | int32_t iIdx = 0; |
| 2541 | int32_t iSliceCount = pCurDq->iMaxSliceNum; |
| 2542 | SSpatialLayerInternal* pParamInternal = &pParam->sDependencyLayers[kiCurDid]; |
| 2543 | if (NULL == pCurDq || NULL == pBaseSlice) |
| 2544 | return; |
| 2545 | |
| 2546 | pCurDq->pDecPic = pDecPic; |
| 2547 | |
| 2548 | assert (iSliceCount > 0); |
| 2549 | |
| 2550 | int32_t iCurPpsId = pDqIdc->iPpsId; |
| 2551 | int32_t iCurSpsId = pDqIdc->iSpsId; |
| 2552 | |
| 2553 | iCurPpsId = pCtx->pFuncList->pParametersetStrategy->GetCurrentPpsId (iCurPpsId, |
| 2554 | WELS_ABS (pParamInternal->uiIdrPicId - 1) % MAX_PPS_COUNT); |
| 2555 | |
| 2556 | pBaseSlice->sSliceHeaderExt.sSliceHeader.iPpsId = iCurPpsId; |
| 2557 | pCurDq->sLayerInfo.pPpsP = |
| 2558 | pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps = &pCtx->pPPSArray[iCurPpsId]; |
| 2559 | |
| 2560 | pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId = iCurSpsId; |
| 2561 | if (kbUseSubsetSpsFlag) { |
| 2562 | pCurDq->sLayerInfo.pSubsetSpsP = &pCtx->pSubsetArray[iCurSpsId]; |
| 2563 | pCurDq->sLayerInfo.pSpsP = |
| 2564 | pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCurDq->sLayerInfo.pSubsetSpsP->pSps; |
| 2565 | } else { |
| 2566 | pCurDq->sLayerInfo.pSubsetSpsP = NULL; |
| 2567 | pCurDq->sLayerInfo.pSpsP = |
| 2568 | pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCtx->pSpsArray[iCurSpsId]; |
| 2569 | } |
| 2570 | |
| 2571 | pBaseSlice->bSliceHeaderExtFlag = (NAL_UNIT_CODED_SLICE_EXT == pCtx->eNalType); |
| 2572 | |
| 2573 | iIdx = 1; |
| 2574 | while (iIdx < iSliceCount) { |
| 2575 | InitSliceHeadWithBase (pCurDq->ppSliceInLayer[iIdx], pBaseSlice); |
| 2576 | ++ iIdx; |
| 2577 | } |
| 2578 | |
| 2579 | memset (pNalHdExt, 0, sizeof (SNalUnitHeaderExt)); |
| 2580 | pNalHd->uiNalRefIdc = pCtx->eNalPriority; |
| 2581 | pNalHd->eNalUnitType = pCtx->eNalType; |
| 2582 | |
| 2583 | pNalHdExt->uiDependencyId = kiCurDid; |
| 2584 | pNalHdExt->bDiscardableFlag = (pCtx->bNeedPrefixNalFlag) ? (pNalHd->uiNalRefIdc == NRI_PRI_LOWEST) : false; |
no test coverage detected