Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 6 files). Show all
Unified · Split
| @@ -4446,57 +4446,13 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 4445 unmodified lines | ||
| 4446 | 4446 | iRet = WelsEncoderParamAdjust (ppCtx, &sConfig); |
| 4447 | 4447 | return iRet; |
| 4448 | 4448 | } |
| 4449 | −int32_t FrameBsRealloc (sWelsEncCtx* pCtx, | |
| 4450 | − SFrameBSInfo* pFrameBsInfo, | |
| 4451 | − SLayerBSInfo* pLayerBsInfo) { | |
| 4452 | − CMemoryAlign* pMA = pCtx->pMemAlign; | |
| 4453 | − SDqLayer* pCurLayer = pCtx->pCurDqLayer; | |
| 4454 | − | |
| 4455 | − int32_t iCountNals = pCtx->pOut->iCountNals; | |
| 4456 | − int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum; | |
| 4457 | − int32_t iMaxSliceNum = iMaxSliceNumOld; | |
| 4458 | − iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag); | |
| 4459 | − iMaxSliceNum *= SLICE_NUM_EXPAND_COEF; | |
| 4460 | − | |
| 4461 | − SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | |
| 4462 | − if (NULL == pNalList) { | |
| 4463 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalList is NULL"); | |
| 4464 | − return ENC_RETURN_MEMALLOCERR; | |
| 4465 | − } | |
| 4466 | − memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals); | |
| 4467 | − pMA->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList"); | |
| 4468 | − pCtx->pOut->sNalList = pNalList; | |
| 4469 | − | |
| 4470 | − int32_t* pNalLen = (int32_t*)pMA->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen"); | |
| 4471 | − if (NULL == pNalLen) { | |
| 4472 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalLen is NULL"); | |
| 4473 | − return ENC_RETURN_MEMALLOCERR; | |
| 4474 | − } | |
| 4475 | − memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals); | |
| 4476 | − pMA->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen"); | |
| 4477 | − pCtx->pOut->pNalLen = pNalLen; | |
| 4478 | − | |
| 4479 | − pCtx->pOut->iCountNals = iCountNals; | |
| 4480 | − SLayerBSInfo* pLBI1, *pLBI2; | |
| 4481 | − pLBI1 = &pFrameBsInfo->sLayerInfo[0]; | |
| 4482 | − pLBI1->pNalLengthInByte = pCtx->pOut->pNalLen; | |
| 4483 | − while (pLBI1 != pLayerBsInfo) { | |
| 4484 | − pLBI2 = pLBI1; | |
| 4485 | − ++ pLBI1; | |
| 4486 | − pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount; | |
| 4487 | − } | |
| 4488 | − | |
| 4489 | − return ENC_RETURN_SUCCESS; | |
| 4490 | − | |
| 4491 | −} | |
| 4492 | 4449 | |
| 4493 | 4450 | int32_t DynSliceRealloc (sWelsEncCtx* pCtx, |
| 4494 | 4451 | SFrameBSInfo* pFrameBsInfo, |
| 4495 | 4452 | SLayerBSInfo* pLayerBsInfo) { |
| 4496 | 4453 | int32_t iRet = 0; |
| 4497 | 4454 | |
| 4498 | − iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo); | |
| 4499 | − | |
| 4455 | + iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum); | |
| 4500 | 4456 | if(ENC_RETURN_SUCCESS != iRet) { |
| 4501 | 4457 | return iRet; |
| 4502 | 4458 | } |
| @@ -4571,7 +4527,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 68 unmodified lines | ||
| 4571 | 4527 | } |
| 4572 | 4528 | |
| 4573 | 4529 | WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc); |
| 4574 | − | |
| 4575 | 4530 | pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx]; |
| 4576 | 4531 | assert (iSliceIdx == pCurSlice->iSliceIdx); |
| 4577 | 4532 | |
| @@ -4600,7 +4555,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 22 unmodified lines | ||
| 4600 | 4555 | #endif//SLICE_INFO_OUTPUT |
| 4601 | 4556 | |
| 4602 | 4557 | ++ iNalIdxInLayer; |
| 4603 | − | |
| 4604 | 4558 | iSliceIdx += kiSliceStep; //if iSliceIdx is not continuous |
| 4605 | 4559 | iAnyMbLeftInPartition = iEndMbIdxInPartition - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]; |
| 4606 | 4560 | } |