Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -878,7 +878,7 @@ int32_t InitMbListD (sWelsEncCtx** ppCtx) { · 877 unmodified lines | ||
| 878 | 878 | iOverallMbNum += iMbSize[i]; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | − (*ppCtx)->ppMbListD = static_cast<SMB**> ((*ppCtx)->pMemAlign->WelsMalloc (iNumDlayer * sizeof (SMB*), "ppMbListD")); | |
| 881 | + (*ppCtx)->ppMbListD = static_cast<SMB**> ((*ppCtx)->pMemAlign->WelsMallocz (iNumDlayer * sizeof (SMB*), "ppMbListD")); | |
| 882 | 882 | (*ppCtx)->ppMbListD[0] = NULL; |
| 883 | 883 | WELS_VERIFY_RETURN_PROC_IF (1, (*ppCtx)->ppMbListD == NULL, FreeMemorySvc (ppCtx)); |
| 884 | 884 | (*ppCtx)->ppMbListD[0] = static_cast<SMB*> ((*ppCtx)->pMemAlign->WelsMallocz (iOverallMbNum * sizeof (SMB), |
| @@ -896,23 +896,23 @@ int32_t InitMbListD (sWelsEncCtx** ppCtx) { · 11 unmodified lines | ||
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | int32_t AllocMbCacheAligned (SMbCache* pMbCache, CMemoryAlign* pMa) { |
| 899 | − pMbCache->pCoeffLevel = (int16_t*)pMa->WelsMalloc (MB_COEFF_LIST_SIZE * sizeof (int16_t), "pMbCache->pCoeffLevel"); | |
| 899 | + pMbCache->pCoeffLevel = (int16_t*)pMa->WelsMallocz (MB_COEFF_LIST_SIZE * sizeof (int16_t), "pMbCache->pCoeffLevel"); | |
| 900 | 900 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pCoeffLevel)); |
| 901 | − pMbCache->pMemPredMb = (uint8_t*)pMa->WelsMalloc (2 * 256 * sizeof (uint8_t), "pMbCache->pMemPredMb"); | |
| 901 | + pMbCache->pMemPredMb = (uint8_t*)pMa->WelsMallocz (2 * 256 * sizeof (uint8_t), "pMbCache->pMemPredMb"); | |
| 902 | 902 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pMemPredMb)); |
| 903 | − pMbCache->pSkipMb = (uint8_t*)pMa->WelsMalloc (384 * sizeof (uint8_t), "pMbCache->pSkipMb"); | |
| 903 | + pMbCache->pSkipMb = (uint8_t*)pMa->WelsMallocz (384 * sizeof (uint8_t), "pMbCache->pSkipMb"); | |
| 904 | 904 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pSkipMb)); |
| 905 | − pMbCache->pMemPredBlk4 = (uint8_t*)pMa->WelsMalloc (2 * 16 * sizeof (uint8_t), "pMbCache->pMemPredBlk4"); | |
| 905 | + pMbCache->pMemPredBlk4 = (uint8_t*)pMa->WelsMallocz (2 * 16 * sizeof (uint8_t), "pMbCache->pMemPredBlk4"); | |
| 906 | 906 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pMemPredBlk4)); |
| 907 | − pMbCache->pBufferInterPredMe = (uint8_t*)pMa->WelsMalloc (4 * 640 * sizeof (uint8_t), "pMbCache->pBufferInterPredMe"); | |
| 907 | + pMbCache->pBufferInterPredMe = (uint8_t*)pMa->WelsMallocz (4 * 640 * sizeof (uint8_t), "pMbCache->pBufferInterPredMe"); | |
| 908 | 908 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pBufferInterPredMe)); |
| 909 | − pMbCache->pPrevIntra4x4PredModeFlag = (bool*)pMa->WelsMalloc (16 * sizeof (bool), | |
| 909 | + pMbCache->pPrevIntra4x4PredModeFlag = (bool*)pMa->WelsMallocz (16 * sizeof (bool), | |
| 910 | 910 | "pMbCache->pPrevIntra4x4PredModeFlag"); |
| 911 | 911 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pPrevIntra4x4PredModeFlag)); |
| 912 | − pMbCache->pRemIntra4x4PredModeFlag = (int8_t*)pMa->WelsMalloc (16 * sizeof (int8_t), | |
| 912 | + pMbCache->pRemIntra4x4PredModeFlag = (int8_t*)pMa->WelsMallocz (16 * sizeof (int8_t), | |
| 913 | 913 | "pMbCache->pRemIntra4x4PredModeFlag"); |
| 914 | 914 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pRemIntra4x4PredModeFlag)); |
| 915 | − pMbCache->pDct = (SDCTCoeff*)pMa->WelsMalloc (sizeof (SDCTCoeff), "pMbCache->pDct"); | |
| 915 | + pMbCache->pDct = (SDCTCoeff*)pMa->WelsMallocz (sizeof (SDCTCoeff), "pMbCache->pDct"); | |
| 916 | 916 | WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pDct)); |
| 917 | 917 | return 0; |
| 918 | 918 | } |
| @@ -1294,10 +1294,10 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 375 unmodified lines | ||
| 1294 | 1294 | // for dynamically malloc for parameter sets memory instead of maximal items for standard to reduce size, 3/18/2010 |
| 1295 | 1295 | const int32_t kiNeededSpsNum = (*ppCtx)->GetNeededSpsNum(); |
| 1296 | 1296 | const int32_t kiNeededSubsetSpsNum = (*ppCtx)->GetNeededSubsetSpsNum(); |
| 1297 | − (*ppCtx)->pSpsArray = (SWelsSPS*)pMa->WelsMalloc (kiNeededSpsNum * sizeof (SWelsSPS), "pSpsArray"); | |
| 1297 | + (*ppCtx)->pSpsArray = (SWelsSPS*)pMa->WelsMallocz (kiNeededSpsNum * sizeof (SWelsSPS), "pSpsArray"); | |
| 1298 | 1298 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSpsArray), FreeMemorySvc (ppCtx)) |
| 1299 | 1299 | if (kiNeededSubsetSpsNum > 0) { |
| 1300 | − (*ppCtx)->pSubsetArray = (SSubsetSps*)pMa->WelsMalloc (kiNeededSubsetSpsNum * sizeof (SSubsetSps), "pSubsetArray"); | |
| 1300 | + (*ppCtx)->pSubsetArray = (SSubsetSps*)pMa->WelsMallocz (kiNeededSubsetSpsNum * sizeof (SSubsetSps), "pSubsetArray"); | |
| 1301 | 1301 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSubsetArray), FreeMemorySvc (ppCtx)) |
| 1302 | 1302 | } else { |
| 1303 | 1303 | (*ppCtx)->pSubsetArray = NULL; |
| @@ -1317,7 +1317,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 13 unmodified lines | ||
| 1317 | 1317 | |
| 1318 | 1318 | // PPS |
| 1319 | 1319 | const int32_t kiNeededPpsNum = (*ppCtx)->GetNeededPpsNum(); |
| 1320 | − (*ppCtx)->pPPSArray = (SWelsPPS*)pMa->WelsMalloc (kiNeededPpsNum * sizeof (SWelsPPS), "pPPSArray"); | |
| 1320 | + (*ppCtx)->pPPSArray = (SWelsPPS*)pMa->WelsMallocz (kiNeededPpsNum * sizeof (SWelsPPS), "pPPSArray"); | |
| 1321 | 1321 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pPPSArray), FreeMemorySvc (ppCtx)) |
| 1322 | 1322 | |
| 1323 | 1323 | // copy from existing if the pointer exists |
| @@ -1493,7 +1493,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 169 unmodified lines | ||
| 1493 | 1493 | if (kiNumSpatialLayers <= 0 || kiNumSpatialLayers > MAX_DEPENDENCY_LAYER) |
| 1494 | 1494 | return 1; |
| 1495 | 1495 | |
| 1496 | − pPtr = (SStrideTables*)pMa->WelsMalloc (sizeof (SStrideTables), "SStrideTables"); | |
| 1496 | + pPtr = (SStrideTables*)pMa->WelsMallocz (sizeof (SStrideTables), "SStrideTables"); | |
| 1497 | 1497 | if (NULL == pPtr) |
| 1498 | 1498 | return 1; |
| 1499 | 1499 | (*ppCtx)->pStrideTab = pPtr; |
| @@ -1540,7 +1540,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 40 unmodified lines | ||
| 1540 | 1540 | |
| 1541 | 1541 | iNeedAllocSize = iSizeDec + iSizeEnc + (iUnit2Size << 1); |
| 1542 | 1542 | |
| 1543 | − pBase = (uint8_t*)pMa->WelsMalloc (iNeedAllocSize, "pBase"); | |
| 1543 | + pBase = (uint8_t*)pMa->WelsMallocz (iNeedAllocSize, "pBase"); | |
| 1544 | 1544 | if (NULL == pBase) { |
| 1545 | 1545 | return 1; |
| 1546 | 1546 | } |
| @@ -1639,7 +1639,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 92 unmodified lines | ||
| 1639 | 1639 | iMaxMbWidth = WELS_ALIGN (iMaxMbWidth, 4); // 4 loops for int16_t required introduced as below |
| 1640 | 1640 | iRowSize = iMaxMbWidth * sizeof (int16_t); |
| 1641 | 1641 | |
| 1642 | − pTmpRow = (int16_t*)pMa->WelsMalloc (iRowSize, "pTmpRow"); | |
| 1642 | + pTmpRow = (int16_t*)pMa->WelsMallocz (iRowSize, "pTmpRow"); | |
| 1643 | 1643 | if (NULL == pTmpRow) { |
| 1644 | 1644 | return 1; |
| 1645 | 1645 | } |
| @@ -1860,12 +1860,12 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 214 unmodified lines | ||
| 1860 | 1860 | MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN)); |
| 1861 | 1861 | |
| 1862 | 1862 | // Output |
| 1863 | − (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput"); | |
| 1863 | + (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMallocz (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput"); | |
| 1864 | 1864 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut), FreeMemorySvc (ppCtx)) |
| 1865 | − (*ppCtx)->pOut->pBsBuffer = (uint8_t*)pMa->WelsMalloc (iCountBsLen, "pOut->pBsBuffer"); | |
| 1865 | + (*ppCtx)->pOut->pBsBuffer = (uint8_t*)pMa->WelsMallocz (iCountBsLen, "pOut->pBsBuffer"); | |
| 1866 | 1866 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pBsBuffer), FreeMemorySvc (ppCtx)) |
| 1867 | 1867 | (*ppCtx)->pOut->uiSize = iCountBsLen; |
| 1868 | − (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | |
| 1868 | + (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | |
| 1869 | 1869 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx)) |
| 1870 | 1870 | (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen"); |
| 1871 | 1871 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc (ppCtx)) |
| @@ -1909,7 +1909,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 37 unmodified lines | ||
| 1909 | 1909 | |
| 1910 | 1910 | (*ppCtx)->iGlobalQp = 26; // global qp in default |
| 1911 | 1911 | |
| 1912 | − (*ppCtx)->pLtr = (SLTRState*)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SLTRState), "SLTRState"); | |
| 1912 | + (*ppCtx)->pLtr = (SLTRState*)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SLTRState), "SLTRState"); | |
| 1913 | 1913 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pLtr), FreeMemorySvc (ppCtx)) |
| 1914 | 1914 | int32_t i = 0; |
| 1915 | 1915 | for (i = 0; i < kiNumDependencyLayers; i++) { |
| @@ -2535,7 +2535,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 619 unmodified lines | ||
| 2535 | 2535 | } |
| 2536 | 2536 | memcpy (pCtx->pSvcParam, pCodingParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage |
| 2537 | 2537 | |
| 2538 | − pCtx->pFuncList = (SWelsFuncPtrList*)pCtx->pMemAlign->WelsMalloc (sizeof (SWelsFuncPtrList), "SWelsFuncPtrList"); | |
| 2538 | + pCtx->pFuncList = (SWelsFuncPtrList*)pCtx->pMemAlign->WelsMallocz (sizeof (SWelsFuncPtrList), "SWelsFuncPtrList"); | |
| 2539 | 2539 | if (NULL == pCtx->pFuncList) { |
| 2540 | 2540 | WelsUninitEncoderExt (&pCtx); |
| 2541 | 2541 | return 1; |
| @@ -4787,7 +4787,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2245 unmodified lines | ||
| 4787 | 4787 | iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag); |
| 4788 | 4788 | iMaxSliceNum *= SLICE_NUM_EXPAND_COEF; |
| 4789 | 4789 | |
| 4790 | − SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | |
| 4790 | + SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | |
| 4791 | 4791 | if (NULL == pNalList) { |
| 4792 | 4792 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalList is NULL"); |
| 4793 | 4793 | return ENC_RETURN_MEMALLOCERR; |
| @@ -4796,7 +4796,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2 unmodified lines | ||
| 4796 | 4796 | pMA->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList"); |
| 4797 | 4797 | pCtx->pOut->sNalList = pNalList; |
| 4798 | 4798 | |
| 4799 | − int32_t* pNalLen = (int32_t*)pMA->WelsMalloc (iCountNals * sizeof (int32_t), "pOut->pNalLen"); | |
| 4799 | + int32_t* pNalLen = (int32_t*)pMA->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen"); | |
| 4800 | 4800 | if (NULL == pNalLen) { |
| 4801 | 4801 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalLen is NULL"); |
| 4802 | 4802 | return ENC_RETURN_MEMALLOCERR; |
| @@ -4858,7 +4858,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 55 unmodified lines | ||
| 4858 | 4858 | |
| 4859 | 4859 | //deal with rate control variables |
| 4860 | 4860 | const int32_t kiCurDid = pCtx->uiDependencyId; |
| 4861 | − SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMalloc (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC"); | |
| 4861 | + SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMallocz (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC"); | |
| 4862 | 4862 | if (NULL == pSlcingOverRc) { |
| 4863 | 4863 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 4864 | 4864 | "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSlcingOverRc not successful"); |