Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 8 files). Show all
Unified · Split
| @@ -2766,18 +2766,18 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 2765 unmodified lines | ||
| 2766 | 2766 | i = 0; |
| 2767 | 2767 | while (i < iPartitionNum) { |
| 2768 | 2768 | if (i + 1 == iPartitionNum) { |
| 2769 | − pSliceCtx->pCountMbNumInSlice[i] = iAssignableMbLeft; | |
| 2769 | + pSliceInLayer[i].iCountMbNumInSlice = iAssignableMbLeft; | |
| 2770 | 2770 | } else { |
| 2771 | − pSliceCtx->pCountMbNumInSlice[i] = iCountMbNumPerPartition; | |
| 2771 | + pSliceInLayer[i].iCountMbNumInSlice = iCountMbNumPerPartition; | |
| 2772 | 2772 | } |
| 2773 | 2773 | pSliceInLayer[i].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbIdx; |
| 2774 | 2774 | |
| 2775 | 2775 | WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdx, i, |
| 2776 | − pSliceCtx->pCountMbNumInSlice[i], sizeof (uint16_t)); | |
| 2776 | + pSliceInLayer[i].iCountMbNumInSlice, sizeof (uint16_t)); | |
| 2777 | 2777 | |
| 2778 | 2778 | // for next partition(or pSlice) |
| 2779 | − iFirstMbIdx += pSliceCtx->pCountMbNumInSlice[i]; | |
| 2780 | − iAssignableMbLeft -= pSliceCtx->pCountMbNumInSlice[i]; | |
| 2779 | + iFirstMbIdx += pSliceInLayer[i].iCountMbNumInSlice; | |
| 2780 | + iAssignableMbLeft -= pSliceInLayer[i].iCountMbNumInSlice; | |
| 2781 | 2781 | ++ i; |
| 2782 | 2782 | } |
| 2783 | 2783 | } |
| @@ -4803,21 +4803,6 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2019 unmodified lines | ||
| 4803 | 4803 | } |
| 4804 | 4804 | pMA->WelsFree (pCurLayer->sLayerInfo.pSliceInLayer, "Slice"); |
| 4805 | 4805 | pCurLayer->sLayerInfo.pSliceInLayer = pSlice; |
| 4806 | − int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t), | |
| 4807 | − "pSliceSeg->pCountMbNumInSlice"); | |
| 4808 | − if (NULL == pCountMbNumInSlice) { | |
| 4809 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 4810 | − "CWelsH264SVCEncoder::DynSliceRealloc: realloc pCountMbNumInSlice not successful"); | |
| 4811 | − return ENC_RETURN_MEMALLOCERR; | |
| 4812 | − } | |
| 4813 | − memcpy (pCountMbNumInSlice, pCurLayer->sSliceEncCtx.pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld); | |
| 4814 | − uiSliceIdx = iMaxSliceNumOld; | |
| 4815 | − while (uiSliceIdx < iMaxSliceNum) { | |
| 4816 | − pCountMbNumInSlice[uiSliceIdx] = pCurLayer->sSliceEncCtx.iMbNumInFrame; | |
| 4817 | − uiSliceIdx++; | |
| 4818 | − } | |
| 4819 | − pMA->WelsFree (pCurLayer->sSliceEncCtx.pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice"); | |
| 4820 | − pCurLayer->sSliceEncCtx.pCountMbNumInSlice = pCountMbNumInSlice; | |
| 4821 | 4806 | |
| 4822 | 4807 | //deal with rate control variables |
| 4823 | 4808 | const int32_t kiCurDid = pCtx->uiDependencyId; |
| @@ -4837,7 +4822,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 13 unmodified lines | ||
| 4837 | 4822 | pSORC->iCalculatedQpSlice = pCtx->iGlobalQp; |
| 4838 | 4823 | pSORC->iTotalQpSlice = 0; |
| 4839 | 4824 | pSORC->iTotalMbSlice = 0; |
| 4840 | − pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->sSliceEncCtx.pCountMbNumInSlice[uiSliceIdx], | |
| 4825 | + pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice, | |
| 4841 | 4826 | INT_MULTIPLY); |
| 4842 | 4827 | pSORC->iFrameBitsSlice = 0; |
| 4843 | 4828 | pSORC->iGomBitsSlice = 0; |