Showing the changes to codec/encoder/core/src/svc_encode_slice.cpp (1 of 3 files). Show all
Unified · Split
| @@ -928,21 +928,16 @@ void FreeSliceBuffer (SSlice*& pSliceList, const int32_t kiMaxSliceNum, CMemoryA · 927 unmodified lines | |||
| 928 | } | 928 | } |
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | int32_t InitSliceList (sWelsEncCtx* pCtx, | 931 | int32_t InitSliceList (SSlice*& pSliceList, |
| 932 | SSlice*& pSliceList, | 932 | SBitStringAux* pBsWrite, |
| 933 | const int32_t kiMaxSliceNum, | 933 | const int32_t kiMaxSliceNum, |
| 934 | const int32_t kiDlayerIndex, | 934 | const int32_t kiMaxSliceBufferSize, |
| 935 | const bool bIndependenceBsBuffer, | ||
| 935 | CMemoryAlign* pMa) { | 936 | CMemoryAlign* pMa) { |
| 936 | SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument; | ||
| 937 | int32_t iMaxSliceBufferSize = (pCtx)->iSliceBufferSize[kiDlayerIndex]; | ||
| 938 | int32_t iSliceIdx = 0; | 937 | int32_t iSliceIdx = 0; |
| 939 | int32_t iRet = 0; | 938 | int32_t iRet = 0; |
| 940 | 939 | ||
| 941 | //SM_SINGLE_SLICE mode using single-thread bs writer pOut->sBsWrite | 940 | if (kiMaxSliceBufferSize <= 0) { |
| 942 | //even though multi-thread is on for other layers | ||
| 943 | bool bIndependenceBsBuffer = (pCtx->pSvcParam->iMultipleThreadIdc > 1 && | ||
| 944 | SM_SINGLE_SLICE != pSliceArgument->uiSliceMode) ? true : false; | ||
| 945 | if (iMaxSliceBufferSize <= 0) { | ||
| 946 | return ENC_RETURN_UNEXPECTED; | 941 | return ENC_RETURN_UNEXPECTED; |
| 947 | } | 942 | } |
| 948 | 943 | ||
| @@ -958,9 +953,9 @@ int32_t InitSliceList (sWelsEncCtx* pCtx, · 9 unmodified lines | |||
| 958 | pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = 0; | 953 | pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = 0; |
| 959 | 954 | ||
| 960 | iRet = InitSliceBsBuffer (pSlice, | 955 | iRet = InitSliceBsBuffer (pSlice, |
| 961 | &pCtx->pOut->sBsWrite, | 956 | pBsWrite, |
| 962 | bIndependenceBsBuffer, | 957 | bIndependenceBsBuffer, |
| 963 | iMaxSliceBufferSize, | 958 | kiMaxSliceBufferSize, |
| 964 | pMa); | 959 | pMa); |
| 965 | if (ENC_RETURN_SUCCESS != iRet) { | 960 | if (ENC_RETURN_SUCCESS != iRet) { |
| 966 | return iRet; | 961 | return iRet; |
| @@ -1043,10 +1038,11 @@ int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx, · 76 unmodified lines | |||
| 1043 | "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL"); | 1038 | "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL"); |
| 1044 | return ENC_RETURN_MEMALLOCERR; | 1039 | return ENC_RETURN_MEMALLOCERR; |
| 1045 | } | 1040 | } |
| 1046 | iRet = InitSliceList (pCtx, | 1041 | iRet = InitSliceList (pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread, |
| 1047 | pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread, | 1042 | &pCtx->pOut->sBsWrite, |
| 1048 | iMaxSliceNum, | 1043 | iMaxSliceNum, |
| 1049 | kiDlayerIndex, | 1044 | pCtx->iSliceBufferSize[kiDlayerIndex], |
| 1045 | pDqLayer->bSliceBsBufferFlag, | ||
| 1050 | pMa); | 1046 | pMa); |
| 1051 | if (ENC_RETURN_SUCCESS != iRet) { | 1047 | if (ENC_RETURN_SUCCESS != iRet) { |
| 1052 | return iRet; | 1048 | return iRet; |
| @@ -1071,6 +1067,15 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 18 unmodified lines | |||
| 1071 | int32_t iThreadIdx = 0; | 1067 | int32_t iThreadIdx = 0; |
| 1072 | int32_t iStartIdx = 0; | 1068 | int32_t iStartIdx = 0; |
| 1073 | int32_t iMaxSliceNum = pDqLayer->iMaxSliceNum; | 1069 | int32_t iMaxSliceNum = pDqLayer->iMaxSliceNum; |
| 1070 | SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument; | ||
| 1071 | |||
| 1072 | //SM_SINGLE_SLICE mode using single-thread bs writer pOut->sBsWrite | ||
| 1073 | //even though multi-thread is on for other layers | ||
| 1074 | pDqLayer->bSliceBsBufferFlag = (pCtx->pSvcParam->iMultipleThreadIdc > 1 && | ||
| 1075 | SM_SINGLE_SLICE != pSliceArgument->uiSliceMode) ? true : false; | ||
| 1076 | |||
| 1077 | pDqLayer->bThreadSlcBufferFlag = (pCtx->pSvcParam->iMultipleThreadIdc > 1 && | ||
| 1078 | SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) ? true : false; | ||
| 1074 | 1079 | ||
| 1075 | iRet = InitSliceThreadInfo (pCtx, | 1080 | iRet = InitSliceThreadInfo (pCtx, |
| 1076 | pDqLayer, | 1081 | pDqLayer, |