Showing the changes to codec/encoder/core/src/svc_encode_slice.cpp (1 of 6 files). Show all
Unified · Split
| @@ -948,7 +948,7 @@ int32_t InitSliceList (sWelsEncCtx* pCtx, · 947 unmodified lines | |||
| 948 | iMaxSliceBufferSize, | 948 | iMaxSliceBufferSize, |
| 949 | pMa); | 949 | pMa); |
| 950 | if (ENC_RETURN_SUCCESS != iRet) { | 950 | if (ENC_RETURN_SUCCESS != iRet) { |
| 951 | return iRet; | 951 | return iRet; |
| 952 | } | 952 | } |
| 953 | 953 | ||
| 954 | iRet = InitSliceMBInfo (pSliceArgument, pSlice, | 954 | iRet = InitSliceMBInfo (pSliceArgument, pSlice, |
| @@ -1014,14 +1014,14 @@ int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx, · 59 unmodified lines | |||
| 1014 | int32_t iRet = 0; | 1014 | int32_t iRet = 0; |
| 1015 | 1015 | ||
| 1016 | assert (iThreadNum > 0); | 1016 | assert (iThreadNum > 0); |
| 1017 | iMaxSliceNumInThread = (pCtx->iMaxSliceCount / iThreadNum + 1) * 2; | 1017 | //iMaxSliceNumInThread = (pCtx->iMaxSliceCount / iThreadNum + 1) * 2; |
| 1018 | iMaxSliceNumInThread = pDqLayer->iMaxSliceNum; | ||
| 1018 | iMaxSliceNumInThread = WELS_MIN (pCtx->iMaxSliceCount, (int) iMaxSliceNumInThread); | 1019 | iMaxSliceNumInThread = WELS_MIN (pCtx->iMaxSliceCount, (int) iMaxSliceNumInThread); |
| 1019 | 1020 | ||
| 1020 | while (iIdx < iThreadNum) { | 1021 | while (iIdx < iThreadNum) { |
| 1021 | pSliceThreadInfo->iMaxSliceNumInThread[iIdx] = iMaxSliceNumInThread; | 1022 | pSliceThreadInfo->iMaxSliceNumInThread[iIdx] = iMaxSliceNumInThread; |
| 1022 | pSliceThreadInfo->iEncodedSliceNumInThread[iIdx] = 0; | 1023 | pSliceThreadInfo->iEncodedSliceNumInThread[iIdx] = 0; |
| 1023 | pSliceThreadInfo->pSliceInThread[iIdx] = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * | 1024 | pSliceThreadInfo->pSliceInThread[iIdx] = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNumInThread, "pSliceInThread"); |
| 1024 | iMaxSliceNumInThread, "pSliceInThread"); | ||
| 1025 | if (NULL == pSliceThreadInfo->pSliceInThread[iIdx]) { | 1025 | if (NULL == pSliceThreadInfo->pSliceInThread[iIdx]) { |
| 1026 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | 1026 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 1027 | "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL"); | 1027 | "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL"); |
| @@ -1069,25 +1069,8 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 41 unmodified lines | |||
| 1069 | return iRet; | 1069 | return iRet; |
| 1070 | } | 1070 | } |
| 1071 | 1071 | ||
| 1072 | pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer"); | ||
| 1073 | if (NULL == pDqLayer->sLayerInfo.pSliceInLayer) { | ||
| 1074 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | ||
| 1075 | "CWelsH264SVCEncoder::InitSliceInLayer: pDqLayer->sLayerInfo.pSliceInLayeris NULL"); | ||
| 1076 | return ENC_RETURN_MEMALLOCERR; | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | iRet = InitSliceList (pCtx, | ||
| 1080 | pDqLayer, | ||
| 1081 | pDqLayer->sLayerInfo.pSliceInLayer, | ||
| 1082 | iMaxSliceNum, | ||
| 1083 | kiDlayerIndex, | ||
| 1084 | pMa); | ||
| 1085 | if (ENC_RETURN_SUCCESS != iRet) { | ||
| 1086 | return iRet; | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | for (iSliceIdx = 0; iSliceIdx < iMaxSliceNum; iSliceIdx++) { | 1072 | for (iSliceIdx = 0; iSliceIdx < iMaxSliceNum; iSliceIdx++) { |
| 1090 | pDqLayer->ppSliceInLayer[iSliceIdx] = &pDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx]; | 1073 | pDqLayer->ppSliceInLayer[iSliceIdx] = pDqLayer->sSliceThreadInfo.pSliceInThread[0] + iSliceIdx; |
| 1091 | } | 1074 | } |
| 1092 | 1075 | ||
| 1093 | return ENC_RETURN_SUCCESS; | 1076 | return ENC_RETURN_SUCCESS; |
| @@ -1295,7 +1278,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 201 unmodified lines | |||
| 1295 | int32_t iSliceIdx = 0; | 1278 | int32_t iSliceIdx = 0; |
| 1296 | const int32_t kiCurDid = pCtx->uiDependencyId; | 1279 | const int32_t kiCurDid = pCtx->uiDependencyId; |
| 1297 | 1280 | ||
| 1298 | SSlice* pLastCodedSlice = pCurLayer->sLayerInfo.pSliceInLayer + (iMaxSliceNumOld - 1); | 1281 | SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + (iMaxSliceNumOld - 1); |
| 1299 | SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument; | 1282 | SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument; |
| 1300 | iRet = CalculateNewSliceNum (pCurLayer, | 1283 | iRet = CalculateNewSliceNum (pCurLayer, |
| 1301 | pLastCodedSlice, | 1284 | pLastCodedSlice, |
| @@ -1308,7 +1291,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 6 unmodified lines | |||
| 1308 | 1291 | ||
| 1309 | iRet = ReallocateSliceList (pCtx, | 1292 | iRet = ReallocateSliceList (pCtx, |
| 1310 | pSliceArgument, | 1293 | pSliceArgument, |
| 1311 | pCurLayer->sLayerInfo.pSliceInLayer, | 1294 | pCurLayer->sSliceThreadInfo.pSliceInThread[0], |
| 1312 | iMaxSliceNumOld, | 1295 | iMaxSliceNumOld, |
| 1313 | iMaxSliceNumNew); | 1296 | iMaxSliceNumNew); |
| 1314 | if (ENC_RETURN_SUCCESS != iRet) { | 1297 | if (ENC_RETURN_SUCCESS != iRet) { |
| @@ -1325,14 +1308,15 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 10 unmodified lines | |||
| 1325 | pCurLayer->ppSliceInLayer = ppSlice; | 1308 | pCurLayer->ppSliceInLayer = ppSlice; |
| 1326 | 1309 | ||
| 1327 | for (iSliceIdx = 0; iSliceIdx < iMaxSliceNumNew; iSliceIdx++) { | 1310 | for (iSliceIdx = 0; iSliceIdx < iMaxSliceNumNew; iSliceIdx++) { |
| 1328 | pCurLayer->ppSliceInLayer[iSliceIdx] = &pCurLayer->sLayerInfo.pSliceInLayer[iSliceIdx]; | 1311 | pCurLayer->ppSliceInLayer[iSliceIdx] = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + iSliceIdx; |
| 1329 | } | 1312 | } |
| 1330 | 1313 | ||
| 1331 | if (pCtx->iMaxSliceCount < iMaxSliceNumNew) { | 1314 | if (pCtx->iMaxSliceCount < iMaxSliceNumNew) { |
| 1332 | pCtx->iMaxSliceCount = iMaxSliceNumNew; | 1315 | pCtx->iMaxSliceCount = iMaxSliceNumNew; |
| 1333 | } | 1316 | } |
| 1334 | 1317 | ||
| 1335 | pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew; | 1318 | pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew; |
| 1319 | pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew; | ||
| 1336 | pCurLayer->iMaxSliceNum = iMaxSliceNumNew; | 1320 | pCurLayer->iMaxSliceNum = iMaxSliceNumNew; |
| 1337 | return ENC_RETURN_SUCCESS; | 1321 | return ENC_RETURN_SUCCESS; |
| 1338 | } | 1322 | } |