Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -952,6 +952,23 @@ void FreeMbCache (SMbCache* pMbCache, CMemoryAlign* pMa) { · 951 unmodified lines | |||
| 952 | } | 952 | } |
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | void FreeRefList (SRefList*& pRefList, CMemoryAlign* pMa, const int iMaxNumRefFrame) { | ||
| 956 | if (NULL == pRefList) { | ||
| 957 | return; | ||
| 958 | } | ||
| 959 | |||
| 960 | int32_t iRef = 0; | ||
| 961 | do { | ||
| 962 | if (pRefList->pRef[iRef] != NULL) { | ||
| 963 | FreePicture (pMa, &pRefList->pRef[iRef]); | ||
| 964 | } | ||
| 965 | ++ iRef; | ||
| 966 | } while (iRef < 1 + iMaxNumRefFrame); | ||
| 967 | |||
| 968 | pMa->WelsFree (pRefList, "pRefList"); | ||
| 969 | pRefList = NULL; | ||
| 970 | } | ||
| 971 | |||
| 955 | static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex, | 972 | static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex, |
| 956 | const int32_t iDlayerCount, const int32_t kiSpsId, | 973 | const int32_t iDlayerCount, const int32_t kiSpsId, |
| 957 | SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer) { | 974 | SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer) { |
| @@ -1193,7 +1210,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 235 unmodified lines | |||
| 1193 | do { | 1210 | do { |
| 1194 | pRefList->pRef[i] = AllocPicture (pMa, kiWidth, kiHeight, true, | 1211 | pRefList->pRef[i] = AllocPicture (pMa, kiWidth, kiHeight, true, |
| 1195 | (iDlayerIndex == iDlayerCount - 1) ? kiNeedFeatureStorage : 0); // to use actual size of current layer | 1212 | (iDlayerIndex == iDlayerCount - 1) ? kiNeedFeatureStorage : 0); // to use actual size of current layer |
| 1196 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pRefList->pRef[i]), FreeMemorySvc (ppCtx)) | 1213 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pRefList->pRef[i]), FreeRefList (pRefList, pMa, iNumRef)) |
| 1197 | ++ i; | 1214 | ++ i; |
| 1198 | } while (i < 1 + iNumRef); | 1215 | } while (i < 1 + iNumRef); |
| 1199 | 1216 | ||
| @@ -2203,19 +2220,8 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 1003 unmodified lines | |||
| 2203 | if (NULL != pCtx->ppRefPicListExt && pParam != NULL) { | 2220 | if (NULL != pCtx->ppRefPicListExt && pParam != NULL) { |
| 2204 | ilayer = 0; | 2221 | ilayer = 0; |
| 2205 | while (ilayer < pParam->iSpatialLayerNum) { | 2222 | while (ilayer < pParam->iSpatialLayerNum) { |
| 2206 | SRefList* pRefList = pCtx->ppRefPicListExt[ilayer]; | 2223 | FreeRefList (pCtx->ppRefPicListExt[ilayer], pMa, pParam->iMaxNumRefFrame); |
| 2207 | if (NULL != pRefList) { | 2224 | pCtx->ppRefPicListExt[ilayer] = NULL; |
| 2208 | int32_t iRef = 0; | ||
| 2209 | do { | ||
| 2210 | if (pRefList->pRef[iRef] != NULL) { | ||
| 2211 | FreePicture (pMa, &pRefList->pRef[iRef]); | ||
| 2212 | } | ||
| 2213 | ++ iRef; | ||
| 2214 | } while (iRef < 1 + pParam->iMaxNumRefFrame); | ||
| 2215 | |||
| 2216 | pMa->WelsFree (pCtx->ppRefPicListExt[ilayer], "ppRefPicListExt[]"); | ||
| 2217 | pCtx->ppRefPicListExt[ilayer] = NULL; | ||
| 2218 | } | ||
| 2219 | ++ ilayer; | 2225 | ++ ilayer; |
| 2220 | } | 2226 | } |
| 2221 | 2227 | ||