ref: a1a3873a62b8dbaed584b5b02e73ceae69f26ba0
parent: 43fdf74fa60078d64b61dbc0443de8c02f5dc8a7
author: sijchen <sijchen@cisco.com>
date: Wed Feb 10 17:25:41 EST 2016
improve the code structure
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -1267,12 +1267,6 @@
pDqLayer = (SDqLayer*)pMa->WelsMallocz (sizeof (SDqLayer), "pDqLayer");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeDqLayer (pDqLayer, pMa))
- int32_t iMaxSliceNum = 1;
- const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceArgument);
- if (iMaxSliceNum < kiSliceNum)
- iMaxSliceNum = kiSliceNum;
- pDqLayer->iMaxSliceNum = iMaxSliceNum;
-
// for dynamic slicing mode
if (SM_SIZELIMITED_SLICE == pDlayer->sSliceArgument.uiSliceMode) {
const int32_t iSize = pParam->iMultipleThreadIdc * sizeof (int32_t);
@@ -1290,6 +1284,12 @@
pDqLayer->iMbWidth = kiMbW;
pDqLayer->iMbHeight = kiMbH;
+
+ int32_t iMaxSliceNum = 1;
+ const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceArgument);
+ if (iMaxSliceNum < kiSliceNum)
+ iMaxSliceNum = kiSliceNum;
+ pDqLayer->iMaxSliceNum = iMaxSliceNum;
{
pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer->sLayerInfo.pSliceInLayer), FreeDqLayer (pDqLayer, pMa))
@@ -2029,16 +2029,11 @@
//End of pVaa memory allocation
- (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SRefList*), "ppRefPicListExt");
+ (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SRefList*), "ppRefPicListExt");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppRefPicListExt), FreeMemorySvc (ppCtx))
- (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList");
+ (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppDqLayerList), FreeMemorySvc (ppCtx))
-
- for (int32_t k = 0; k < kiNumDependencyLayers; k++) {
- (*ppCtx)->ppRefPicListExt[k] = NULL;
- (*ppCtx)->ppDqLayerList[k] = NULL;
- }
iResult = InitDqLayers (ppCtx, pExistingParasetList);
if (iResult) {