Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 16 files). Show all
Unified · Split
| @@ -907,10 +907,10 @@ int32_t InitMbListD (sWelsEncCtx** ppCtx) { · 906 unmodified lines | ||
| 907 | 907 | |
| 908 | 908 | (*ppCtx)->ppMbListD = static_cast<SMB**> ((*ppCtx)->pMemAlign->WelsMallocz (iNumDlayer * sizeof (SMB*), "ppMbListD")); |
| 909 | 909 | (*ppCtx)->ppMbListD[0] = NULL; |
| 910 | − WELS_VERIFY_RETURN_PROC_IF (1, (*ppCtx)->ppMbListD == NULL, FreeMemorySvc (ppCtx)); | |
| 910 | + WELS_VERIFY_RETURN_IF (1, (*ppCtx)->ppMbListD == NULL) | |
| 911 | 911 | (*ppCtx)->ppMbListD[0] = static_cast<SMB*> ((*ppCtx)->pMemAlign->WelsMallocz (iOverallMbNum * sizeof (SMB), |
| 912 | 912 | "ppMbListD[0]")); |
| 913 | − WELS_VERIFY_RETURN_PROC_IF (1, (*ppCtx)->ppMbListD[0] == NULL, FreeMemorySvc (ppCtx)); | |
| 913 | + WELS_VERIFY_RETURN_IF (1, (*ppCtx)->ppMbListD[0] == NULL) | |
| 914 | 914 | (*ppCtx)->ppDqLayerList[0]->sMbDataP = (*ppCtx)->ppMbListD[0]; |
| 915 | 915 | InitMbInfo (*ppCtx, (*ppCtx)->ppMbListD[0], (*ppCtx)->ppDqLayerList[0], 0, iMbSize[iNumDlayer - 1]); |
| 916 | 916 | for (i = 1; i < iNumDlayer; i++) { |
| @@ -1166,7 +1166,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 249 unmodified lines | ||
| 1166 | 1166 | |
| 1167 | 1167 | // pRef list |
| 1168 | 1168 | pRefList = (SRefList*)pMa->WelsMallocz (sizeof (SRefList), "pRefList"); |
| 1169 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pRefList), FreeMemorySvc (ppCtx)) | |
| 1169 | + WELS_VERIFY_RETURN_IF (1, (NULL == pRefList)) | |
| 1170 | 1170 | do { |
| 1171 | 1171 | pRefList->pRef[i] = AllocPicture (pMa, kiWidth, kiHeight, true, |
| 1172 | 1172 | (iDlayerIndex == iDlayerCount - 1) ? kiNeedFeatureStorage : 0); // to use actual size of current layer |
| @@ -1255,11 +1255,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 82 unmodified lines | ||
| 1255 | 1255 | if (kiNeedFeatureStorage && iDlayerIndex == iDlayerCount - 1) { |
| 1256 | 1256 | pDqLayer->pFeatureSearchPreparation = static_cast<SFeatureSearchPreparation*> (pMa->WelsMallocz (sizeof ( |
| 1257 | 1257 | SFeatureSearchPreparation), "pFeatureSearchPreparation")); |
| 1258 | − WELS_VERIFY_RETURN_PROC_IF (1, NULL == pDqLayer->pFeatureSearchPreparation, FreeMemorySvc (ppCtx)); | |
| 1258 | + WELS_VERIFY_RETURN_IF (1, NULL == pDqLayer->pFeatureSearchPreparation) | |
| 1259 | 1259 | int32_t iReturn = RequestFeatureSearchPreparation (pMa, pDlayer->iVideoWidth, pDlayer->iVideoHeight, |
| 1260 | 1260 | kiNeedFeatureStorage, |
| 1261 | 1261 | pDqLayer->pFeatureSearchPreparation); |
| 1262 | − WELS_VERIFY_RETURN_PROC_IF (1, ENC_RETURN_SUCCESS != iReturn, FreeMemorySvc (ppCtx)); | |
| 1262 | + WELS_VERIFY_RETURN_IF (1, ENC_RETURN_SUCCESS != iReturn) | |
| 1263 | 1263 | } else { |
| 1264 | 1264 | pDqLayer->pFeatureSearchPreparation = NULL; |
| 1265 | 1265 | } |
| @@ -1270,15 +1270,15 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 4 unmodified lines | ||
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | // for dynamically malloc for parameter sets memory instead of maximal items for standard to reduce size, 3/18/2010 |
| 1273 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pFuncList), FreeMemorySvc (ppCtx)) | |
| 1274 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pFuncList->pParametersetStrategy), FreeMemorySvc (ppCtx)) | |
| 1273 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pFuncList)) | |
| 1274 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pFuncList->pParametersetStrategy)) | |
| 1275 | 1275 | const int32_t kiNeededSpsNum = (*ppCtx)->pFuncList->pParametersetStrategy->GetNeededSpsNum(); |
| 1276 | 1276 | const int32_t kiNeededSubsetSpsNum = (*ppCtx)->pFuncList->pParametersetStrategy->GetNeededSubsetSpsNum(); |
| 1277 | 1277 | (*ppCtx)->pSpsArray = (SWelsSPS*)pMa->WelsMallocz (kiNeededSpsNum * sizeof (SWelsSPS), "pSpsArray"); |
| 1278 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSpsArray), FreeMemorySvc (ppCtx)) | |
| 1278 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pSpsArray)) | |
| 1279 | 1279 | if (kiNeededSubsetSpsNum > 0) { |
| 1280 | 1280 | (*ppCtx)->pSubsetArray = (SSubsetSps*)pMa->WelsMallocz (kiNeededSubsetSpsNum * sizeof (SSubsetSps), "pSubsetArray"); |
| 1281 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSubsetArray), FreeMemorySvc (ppCtx)) | |
| 1281 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pSubsetArray)) | |
| 1282 | 1282 | } else { |
| 1283 | 1283 | (*ppCtx)->pSubsetArray = NULL; |
| 1284 | 1284 | } |
| @@ -1286,14 +1286,14 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 1 unmodified line | ||
| 1286 | 1286 | // PPS |
| 1287 | 1287 | const int32_t kiNeededPpsNum = (*ppCtx)->pFuncList->pParametersetStrategy->GetNeededPpsNum(); |
| 1288 | 1288 | (*ppCtx)->pPPSArray = (SWelsPPS*)pMa->WelsMallocz (kiNeededPpsNum * sizeof (SWelsPPS), "pPPSArray"); |
| 1289 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pPPSArray), FreeMemorySvc (ppCtx)) | |
| 1289 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pPPSArray)) | |
| 1290 | 1290 | |
| 1291 | 1291 | (*ppCtx)->pFuncList->pParametersetStrategy->LoadPrevious (pExistingParasetList, (*ppCtx)->pSpsArray, |
| 1292 | 1292 | (*ppCtx)->pSubsetArray, (*ppCtx)->pPPSArray); |
| 1293 | 1293 | |
| 1294 | 1294 | |
| 1295 | 1295 | (*ppCtx)->pDqIdcMap = (SDqIdc*)pMa->WelsMallocz (iDlayerCount * sizeof (SDqIdc), "pDqIdcMap"); |
| 1296 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pDqIdcMap), FreeMemorySvc (ppCtx)) | |
| 1296 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pDqIdcMap)) | |
| 1297 | 1297 | |
| 1298 | 1298 | iDlayerIndex = 0; |
| 1299 | 1299 | while (iDlayerIndex < iDlayerCount) { |
| @@ -1328,7 +1328,6 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 28 unmodified lines | ||
| 1328 | 1328 | pPps); |
| 1329 | 1329 | if (iResult) { |
| 1330 | 1330 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult); |
| 1331 | − FreeMemorySvc (ppCtx); | |
| 1332 | 1331 | return iResult; |
| 1333 | 1332 | } |
| 1334 | 1333 | } |
| @@ -1682,7 +1681,6 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 347 unmodified lines | ||
| 1682 | 1681 | if (kiNumDependencyLayers < 1 || kiNumDependencyLayers > MAX_DEPENDENCY_LAYER) { |
| 1683 | 1682 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!", |
| 1684 | 1683 | kiNumDependencyLayers); |
| 1685 | − FreeMemorySvc (ppCtx); | |
| 1686 | 1684 | return 1; |
| 1687 | 1685 | } |
| 1688 | 1686 | |
| @@ -1690,7 +1688,6 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1 unmodified line | ||
| 1690 | 1688 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, |
| 1691 | 1689 | "RequestMemorySvc() failed due to invalid uiIntraPeriod(%d) (=multipler of uiGopSize(%d)!", |
| 1692 | 1690 | pParam->uiIntraPeriod, pParam->uiGopSize); |
| 1693 | − FreeMemorySvc (ppCtx); | |
| 1694 | 1691 | return 1; |
| 1695 | 1692 | } |
| 1696 | 1693 | |
| @@ -1702,7 +1699,6 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 5 unmodified lines | ||
| 1702 | 1699 | iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals); |
| 1703 | 1700 | if (iResult) { |
| 1704 | 1701 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AcquireLayersNals failed(%d)!", iResult); |
| 1705 | − FreeMemorySvc (ppCtx); | |
| 1706 | 1702 | return 1; |
| 1707 | 1703 | } |
| 1708 | 1704 | |
| @@ -1755,21 +1751,20 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 46 unmodified lines | ||
| 1755 | 1751 | |
| 1756 | 1752 | // Output |
| 1757 | 1753 | (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMallocz (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput"); |
| 1758 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut), FreeMemorySvc (ppCtx)) | |
| 1754 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pOut)) | |
| 1759 | 1755 | (*ppCtx)->pOut->pBsBuffer = (uint8_t*)pMa->WelsMallocz (iCountBsLen, "pOut->pBsBuffer"); |
| 1760 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pBsBuffer), FreeMemorySvc (ppCtx)) | |
| 1756 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pOut->pBsBuffer)) | |
| 1761 | 1757 | (*ppCtx)->pOut->uiSize = iCountBsLen; |
| 1762 | 1758 | (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); |
| 1763 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx)) | |
| 1759 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pOut->sNalList)) | |
| 1764 | 1760 | (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen"); |
| 1765 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc (ppCtx)) | |
| 1761 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pOut->pNalLen)) | |
| 1766 | 1762 | (*ppCtx)->pOut->iCountNals = iCountNals; |
| 1767 | 1763 | (*ppCtx)->pOut->iNalIndex = 0; |
| 1768 | 1764 | (*ppCtx)->pOut->iLayerBsIndex = 0; |
| 1769 | 1765 | |
| 1770 | − | |
| 1771 | 1766 | (*ppCtx)->pFrameBs = (uint8_t*)pMa->WelsMalloc (iTotalLength, "pFrameBs"); |
| 1772 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pFrameBs), FreeMemorySvc (ppCtx)) | |
| 1767 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pFrameBs)) | |
| 1773 | 1768 | (*ppCtx)->iFrameBsSize = iTotalLength; |
| 1774 | 1769 | (*ppCtx)->iPosBsBuffer = 0; |
| 1775 | 1770 | |
| @@ -1777,45 +1772,44 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1 unmodified line | ||
| 1777 | 1772 | if (bDynamicSlice && pParam->iEntropyCodingModeFlag) { |
| 1778 | 1773 | for (int32_t iIdx = 0; iIdx < MAX_THREADS_NUM; iIdx++) { |
| 1779 | 1774 | (*ppCtx)->pDynamicBsBuffer[iIdx] = (uint8_t*)pMa->WelsMalloc (iMaxSliceBufferSize, "DynamicSliceBs"); |
| 1780 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pDynamicBsBuffer[iIdx]), FreeMemorySvc (ppCtx)) | |
| 1775 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pDynamicBsBuffer[iIdx])) | |
| 1781 | 1776 | } |
| 1782 | 1777 | } |
| 1783 | 1778 | // for pSlice bs buffers |
| 1784 | 1779 | if (pParam->iMultipleThreadIdc > 1 |
| 1785 | 1780 | && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) { |
| 1786 | 1781 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!"); |
| 1787 | − FreeMemorySvc (ppCtx); | |
| 1788 | 1782 | return 1; |
| 1789 | 1783 | } |
| 1790 | 1784 | |
| 1791 | 1785 | (*ppCtx)->pReferenceStrategy = IWelsReferenceStrategy::CreateReferenceStrategy ((*ppCtx), pParam->iUsageType, |
| 1792 | 1786 | pParam->bEnableLongTermReference); |
| 1793 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pReferenceStrategy), FreeMemorySvc (ppCtx)) | |
| 1787 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pReferenceStrategy)) | |
| 1794 | 1788 | |
| 1795 | 1789 | (*ppCtx)->pIntra4x4PredModeBlocks = static_cast<int8_t*> |
| 1796 | 1790 | (pMa->WelsMallocz (iCountMaxMbNum * INTRA_4x4_MODE_NUM, "pIntra4x4PredModeBlocks")); |
| 1797 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pIntra4x4PredModeBlocks), FreeMemorySvc (ppCtx)) | |
| 1791 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pIntra4x4PredModeBlocks)) | |
| 1798 | 1792 | |
| 1799 | 1793 | (*ppCtx)->pNonZeroCountBlocks = static_cast<int8_t*> |
| 1800 | 1794 | (pMa->WelsMallocz (iCountMaxMbNum * MB_LUMA_CHROMA_BLOCK4x4_NUM, "pNonZeroCountBlocks")); |
| 1801 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pNonZeroCountBlocks), FreeMemorySvc (ppCtx)) | |
| 1795 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pNonZeroCountBlocks)) | |
| 1802 | 1796 | |
| 1803 | 1797 | (*ppCtx)->pMvUnitBlock4x4 = static_cast<SMVUnitXY*> |
| 1804 | 1798 | (pMa->WelsMallocz (iCountMaxMbNum * 2 * MB_BLOCK4x4_NUM * sizeof (SMVUnitXY), "pMvUnitBlock4x4")); |
| 1805 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pMvUnitBlock4x4), FreeMemorySvc (ppCtx)) | |
| 1799 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pMvUnitBlock4x4)) | |
| 1806 | 1800 | |
| 1807 | 1801 | (*ppCtx)->pRefIndexBlock4x4 = static_cast<int8_t*> |
| 1808 | 1802 | (pMa->WelsMallocz (iCountMaxMbNum * 2 * MB_BLOCK8x8_NUM * sizeof (int8_t), "pRefIndexBlock4x4")); |
| 1809 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pRefIndexBlock4x4), FreeMemorySvc (ppCtx)) | |
| 1803 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pRefIndexBlock4x4)) | |
| 1810 | 1804 | |
| 1811 | 1805 | (*ppCtx)->pSadCostMb = static_cast<int32_t*> |
| 1812 | 1806 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pSadCostMb")); |
| 1813 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSadCostMb), FreeMemorySvc (ppCtx)) | |
| 1807 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pSadCostMb)) | |
| 1814 | 1808 | |
| 1815 | 1809 | (*ppCtx)->iGlobalQp = 26; // global qp in default |
| 1816 | 1810 | |
| 1817 | 1811 | (*ppCtx)->pLtr = (SLTRState*)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SLTRState), "SLTRState"); |
| 1818 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pLtr), FreeMemorySvc (ppCtx)) | |
| 1812 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pLtr)) | |
| 1819 | 1813 | int32_t i = 0; |
| 1820 | 1814 | for (i = 0; i < kiNumDependencyLayers; i++) { |
| 1821 | 1815 | ResetLtrState (& (*ppCtx)->pLtr[i]); |
| @@ -1824,85 +1818,80 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 2 unmodified lines | ||
| 1824 | 1818 | // stride tables |
| 1825 | 1819 | if (AllocStrideTables (ppCtx, kiNumDependencyLayers)) { |
| 1826 | 1820 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AllocStrideTables failed!"); |
| 1827 | − FreeMemorySvc (ppCtx); | |
| 1828 | 1821 | return 1; |
| 1829 | 1822 | } |
| 1830 | 1823 | |
| 1831 | 1824 | //Rate control module memory allocation |
| 1832 | 1825 | // only malloc once for RC pData, 12/14/2009 |
| 1833 | 1826 | (*ppCtx)->pWelsSvcRc = (SWelsSvcRc*)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SWelsSvcRc), "pWelsSvcRc"); |
| 1834 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pWelsSvcRc), FreeMemorySvc (ppCtx)) | |
| 1827 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pWelsSvcRc)) | |
| 1835 | 1828 | //End of Rate control module memory allocation |
| 1836 | 1829 | |
| 1837 | 1830 | //pVaa memory allocation |
| 1838 | 1831 | if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 1839 | 1832 | (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa"); |
| 1840 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx)) | |
| 1833 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa)) | |
| 1841 | 1834 | if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iMaxNumRefFrame, iCountMaxMbNum << 2)) { |
| 1842 | 1835 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!"); |
| 1843 | − FreeMemorySvc (ppCtx); | |
| 1844 | 1836 | return 1; |
| 1845 | 1837 | } |
| 1846 | 1838 | } else { |
| 1847 | 1839 | (*ppCtx)->pVaa = (SVAAFrameInfo*)pMa->WelsMallocz (sizeof (SVAAFrameInfo), "pVaa"); |
| 1848 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx)) | |
| 1840 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa)) | |
| 1849 | 1841 | } |
| 1850 | 1842 | |
| 1851 | 1843 | if ((*ppCtx)->pSvcParam->bEnableAdaptiveQuant) { //malloc mem |
| 1852 | 1844 | (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureUnit = static_cast<SMotionTextureUnit*> |
| 1853 | 1845 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (SMotionTextureUnit), "pVaa->sAdaptiveQuantParam.pMotionTextureUnit")); |
| 1854 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureUnit), FreeMemorySvc (ppCtx)) | |
| 1846 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureUnit)) | |
| 1855 | 1847 | (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp = static_cast<int8_t*> |
| 1856 | 1848 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int8_t), "pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp")); |
| 1857 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp), | |
| 1858 | − FreeMemorySvc (ppCtx)) | |
| 1849 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp)) | |
| 1859 | 1850 | } |
| 1860 | 1851 | |
| 1861 | 1852 | (*ppCtx)->pVaa->pVaaBackgroundMbFlag = (int8_t*)pMa->WelsMallocz (iCountMaxMbNum * sizeof (int8_t), |
| 1862 | 1853 | "pVaa->pVaaBackgroundMbFlag"); |
| 1863 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->pVaaBackgroundMbFlag), FreeMemorySvc (ppCtx)) | |
| 1854 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->pVaaBackgroundMbFlag)) | |
| 1864 | 1855 | |
| 1865 | 1856 | (*ppCtx)->pVaa->sVaaCalcInfo.pSad8x8 = static_cast<int32_t (*)[4]> |
| 1866 | 1857 | (pMa->WelsMallocz (iCountMaxMbNum * 4 * sizeof (int32_t), "pVaa->sVaaCalcInfo.sad8x8")); |
| 1867 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSad8x8), FreeMemorySvc (ppCtx)) | |
| 1858 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSad8x8)) | |
| 1868 | 1859 | (*ppCtx)->pVaa->sVaaCalcInfo.pSsd16x16 = static_cast<int32_t*> |
| 1869 | 1860 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pVaa->sVaaCalcInfo.pSsd16x16")); |
| 1870 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSsd16x16), FreeMemorySvc (ppCtx)) | |
| 1861 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSsd16x16)) | |
| 1871 | 1862 | (*ppCtx)->pVaa->sVaaCalcInfo.pSum16x16 = static_cast<int32_t*> |
| 1872 | 1863 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pVaa->sVaaCalcInfo.pSum16x16")); |
| 1873 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSum16x16), FreeMemorySvc (ppCtx)) | |
| 1864 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSum16x16)) | |
| 1874 | 1865 | (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfSquare16x16 = static_cast<int32_t*> |
| 1875 | 1866 | (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pVaa->sVaaCalcInfo.pSumOfSquare16x16")); |
| 1876 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfSquare16x16), FreeMemorySvc (ppCtx)) | |
| 1867 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfSquare16x16)) | |
| 1877 | 1868 | |
| 1878 | 1869 | if ((*ppCtx)->pSvcParam->bEnableBackgroundDetection) { //BGD control |
| 1879 | 1870 | (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfDiff8x8 = static_cast<int32_t (*)[4]> |
| 1880 | 1871 | (pMa->WelsMallocz (iCountMaxMbNum * 4 * sizeof (int32_t), "pVaa->sVaaCalcInfo.pSumOfDiff8x8")); |
| 1881 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfDiff8x8), FreeMemorySvc (ppCtx)) | |
| 1872 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pSumOfDiff8x8)) | |
| 1882 | 1873 | (*ppCtx)->pVaa->sVaaCalcInfo.pMad8x8 = static_cast<uint8_t (*)[4]> |
| 1883 | 1874 | (pMa->WelsMallocz (iCountMaxMbNum * 4 * sizeof (uint8_t), "pVaa->sVaaCalcInfo.pMad8x8")); |
| 1884 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pMad8x8), FreeMemorySvc (ppCtx)) | |
| 1875 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pVaa->sVaaCalcInfo.pMad8x8)) | |
| 1885 | 1876 | } |
| 1886 | 1877 | |
| 1887 | 1878 | //End of pVaa memory allocation |
| 1888 | 1879 | |
| 1889 | 1880 | (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SRefList*), |
| 1890 | 1881 | "ppRefPicListExt"); |
| 1891 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppRefPicListExt), FreeMemorySvc (ppCtx)) | |
| 1882 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->ppRefPicListExt)) | |
| 1892 | 1883 | |
| 1893 | 1884 | (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList"); |
| 1894 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppDqLayerList), FreeMemorySvc (ppCtx)) | |
| 1885 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->ppDqLayerList)) | |
| 1895 | 1886 | |
| 1896 | 1887 | iResult = InitDqLayers (ppCtx, pExistingParasetList); |
| 1897 | 1888 | if (iResult) { |
| 1898 | 1889 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitDqLayers failed(%d)!", iResult); |
| 1899 | − FreeMemorySvc (ppCtx); | |
| 1900 | 1890 | return iResult; |
| 1901 | 1891 | } |
| 1902 | 1892 | |
| 1903 | 1893 | if (InitMbListD (ppCtx)) { |
| 1904 | 1894 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitMbListD failed!"); |
| 1905 | − FreeMemorySvc (ppCtx); | |
| 1906 | 1895 | return 1; |
| 1907 | 1896 | } |
| 1908 | 1897 | |
| @@ -1915,7 +1904,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 6 unmodified lines | ||
| 1915 | 1904 | (*ppCtx)->iMvdCostTableSize = kuiMvdInterTableSize; |
| 1916 | 1905 | (*ppCtx)->iMvdCostTableStride = kuiMvdInterTableStride; |
| 1917 | 1906 | (*ppCtx)->pMvdCostTable = (uint16_t*)pMa->WelsMallocz (52 * kuiMvdCacheAlignedSize, "pMvdCostTable"); |
| 1918 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pMvdCostTable), FreeMemorySvc (ppCtx)) | |
| 1907 | + WELS_VERIFY_RETURN_IF (1, (NULL == (*ppCtx)->pMvdCostTable)) | |
| 1919 | 1908 | MvdCostInit ((*ppCtx)->pMvdCostTable, kuiMvdInterTableStride); //should put to a better place? |
| 1920 | 1909 | |
| 1921 | 1910 | if ((*ppCtx)->ppRefPicListExt[0] != NULL && (*ppCtx)->ppRefPicListExt[0]->pRef[0] != NULL) |