| 944 | } |
| 945 | |
| 946 | int32_t InitSliceList (SSlice*& pSliceList, |
| 947 | SBitStringAux* pBsWrite, |
| 948 | const int32_t kiMaxSliceNum, |
| 949 | const int32_t kiMaxSliceBufferSize, |
| 950 | const bool bIndependenceBsBuffer, |
| 951 | CMemoryAlign* pMa) { |
| 952 | int32_t iSliceIdx = 0; |
| 953 | int32_t iRet = 0; |
| 954 | |
| 955 | if (kiMaxSliceBufferSize <= 0) { |
| 956 | return ENC_RETURN_UNEXPECTED; |
| 957 | } |
| 958 | |
| 959 | while (iSliceIdx < kiMaxSliceNum) { |
| 960 | SSlice* pSlice = pSliceList + iSliceIdx; |
| 961 | if (NULL == pSlice) { |
| 962 | return ENC_RETURN_MEMALLOCERR; |
| 963 | } |
| 964 | |
| 965 | pSlice->iSliceIdx = iSliceIdx; |
| 966 | pSlice->uiBufferIdx = 0; |
| 967 | pSlice->iCountMbNumInSlice = 0; |
| 968 | pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = 0; |
| 969 | |
| 970 | iRet = InitSliceBsBuffer (pSlice, |
| 971 | pBsWrite, |
| 972 | bIndependenceBsBuffer, |
| 973 | kiMaxSliceBufferSize, |
| 974 | pMa); |
| 975 | if (ENC_RETURN_SUCCESS != iRet) { |
| 976 | return iRet; |
| 977 | } |
| 978 | |
| 979 | iRet = AllocateSliceMBBuffer (pSlice, pMa); |
| 980 | |
| 981 | if (ENC_RETURN_SUCCESS != iRet) { |
| 982 | return iRet; |
| 983 | } |
| 984 | ++ iSliceIdx; |
| 985 | } |
| 986 | return ENC_RETURN_SUCCESS; |
| 987 | } |
| 988 | |
| 989 | int32_t InitAllSlicesInThread (sWelsEncCtx* pCtx) { |
| 990 | SDqLayer* pCurDqLayer = pCtx->pCurDqLayer; |
no test coverage detected