History

remove repeat initialization

ruil2 committed 12 years ago

Commit ac404ce1 parent 44013d46 files · +8469 −8481Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 6 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+18−13
@@ -961,7 +961,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 960 unmodified lines
961 }961 }
962 962
963 // initialize pPps963 // initialize pPps
964 WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps,pParam->iEntropyCodingModeFlag != 0);964 WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps, pParam->iEntropyCodingModeFlag != 0);
965 965
966 // Not using FMO in SVC coding so far, come back if need FMO966 // Not using FMO in SVC coding so far, come back if need FMO
967 {967 {
@@ -2347,8 +2347,8 @@ void UpdateSlicepEncCtxWithPartition (SSliceCtx* pSliceCtx, int32_t iPartitionNu · 1379 unmodified lines
2347 }2347 }
2348 pSliceCtx->pFirstMbInSlice[i] = iFirstMbIdx;2348 pSliceCtx->pFirstMbInSlice[i] = iFirstMbIdx;
2349 2349
2350 WelsSetMemMultiplebytes_c(pSliceCtx->pOverallMbMap + iFirstMbIdx, i,2350 WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdx, i,
2351 pSliceCtx->pCountMbNumInSlice[i], sizeof(uint16_t));2351 pSliceCtx->pCountMbNumInSlice[i], sizeof (uint16_t));
2352 2352
2353 // for next partition(or pSlice)2353 // for next partition(or pSlice)
2354 iFirstMbIdx += pSliceCtx->pCountMbNumInSlice[i];2354 iFirstMbIdx += pSliceCtx->pCountMbNumInSlice[i];
@@ -3080,7 +3080,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 725 unmodified lines
3080 pSrcPic->uiTimeStamp);3080 pSrcPic->uiTimeStamp);
3081 return ENC_RETURN_SUCCESS;3081 return ENC_RETURN_SUCCESS;
3082 }3082 }
3083
3084 InitFrameCoding (pCtx, eFrameType);3083 InitFrameCoding (pCtx, eFrameType);
3085 3084
3086 iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[pSpatialIndexMap->iDid], pCtx->iCodingIndex,3085 iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[pSpatialIndexMap->iDid], pCtx->iCodingIndex,
@@ -3926,7 +3925,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 839 unmodified lines
3926 3925
3927 SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");3926 SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
3928 if (NULL == pNalList) {3927 if (NULL == pNalList) {
3929 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalList is NULL");3928 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalList is NULL");
3930 return ENC_RETURN_MEMALLOCERR;3929 return ENC_RETURN_MEMALLOCERR;
3931 }3930 }
3932 memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals);3931 memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals);
@@ -3935,7 +3934,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2 unmodified lines
3935 3934
3936 int32_t* pNalLen = (int32_t*)pMA->WelsMalloc (iCountNals * sizeof (int32_t), "pOut->pNalLen");3935 int32_t* pNalLen = (int32_t*)pMA->WelsMalloc (iCountNals * sizeof (int32_t), "pOut->pNalLen");
3937 if (NULL == pNalLen) {3936 if (NULL == pNalLen) {
3938 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalLen is NULL");3937 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pNalLen is NULL");
3939 return ENC_RETURN_MEMALLOCERR;3938 return ENC_RETURN_MEMALLOCERR;
3940 }3939 }
3941 memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals);3940 memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals);
@@ -3954,7 +3953,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 12 unmodified lines
3954 3953
3955 SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");3954 SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");
3956 if (NULL == pSlice) {3955 if (NULL == pSlice) {
3957 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pSlice is NULL");3956 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pSlice is NULL");
3958 return ENC_RETURN_MEMALLOCERR;3957 return ENC_RETURN_MEMALLOCERR;
3959 }3958 }
3960 memcpy (pSlice, pCurLayer->sLayerInfo.pSliceInLayer, sizeof (SSlice) * iMaxSliceNumOld);3959 memcpy (pSlice, pCurLayer->sLayerInfo.pSliceInLayer, sizeof (SSlice) * iMaxSliceNumOld);
@@ -3971,7 +3970,8 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 10 unmodified lines
3971 else3970 else
3972 pSliceIdx->pSliceBsa = &pCtx->pOut->sBsWrite;3971 pSliceIdx->pSliceBsa = &pCtx->pOut->sBsWrite;
3973 if (AllocMbCacheAligned (&pSliceIdx->sMbCacheInfo, pMA)) {3972 if (AllocMbCacheAligned (&pSliceIdx->sMbCacheInfo, pMA)) {
3974 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: realloc MbCache not successful at slice_idx=%d (max-slice=%d)",3973 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
3974 "CWelsH264SVCEncoder::DynSliceRealloc: realloc MbCache not successful at slice_idx=%d (max-slice=%d)",
3975 uiSliceIdx, iMaxSliceNum);3975 uiSliceIdx, iMaxSliceNum);
3976 return ENC_RETURN_MEMALLOCERR;3976 return ENC_RETURN_MEMALLOCERR;
3977 }3977 }
@@ -3994,7 +3994,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 16 unmodified lines
3994 3994
3995 int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice");3995 int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice");
3996 if (NULL == pFirstMbInSlice) {3996 if (NULL == pFirstMbInSlice) {
3997 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pFirstMbInSlice is NULL");3997 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pFirstMbInSlice is NULL");
3998 return ENC_RETURN_MEMALLOCERR;3998 return ENC_RETURN_MEMALLOCERR;
3999 }3999 }
4000 memset (pFirstMbInSlice, 0, sizeof (int16_t) * iMaxSliceNum);4000 memset (pFirstMbInSlice, 0, sizeof (int16_t) * iMaxSliceNum);
@@ -4005,7 +4005,8 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 4 unmodified lines
4005 int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),4005 int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),
4006 "pSliceSeg->pCountMbNumInSlice");4006 "pSliceSeg->pCountMbNumInSlice");
4007 if (NULL == pCountMbNumInSlice) {4007 if (NULL == pCountMbNumInSlice) {
4008 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: realloc pCountMbNumInSlice not successful");4008 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
4009 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pCountMbNumInSlice not successful");
4009 return ENC_RETURN_MEMALLOCERR;4010 return ENC_RETURN_MEMALLOCERR;
4010 }4011 }
4011 memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);4012 memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);
@@ -4019,7 +4020,8 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 7 unmodified lines
4019 4020
4020 SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMalloc (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC");4021 SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMalloc (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC");
4021 if (NULL == pSlcingOverRc) {4022 if (NULL == pSlcingOverRc) {
4022 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSlcingOverRc not successful");4023 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
4024 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSlcingOverRc not successful");
4023 return ENC_RETURN_MEMALLOCERR;4025 return ENC_RETURN_MEMALLOCERR;
4024 }4026 }
4025 memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);4027 memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
@@ -4087,11 +4089,14 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 61 unmodified lines
4087 if (pCtx->iActiveThreadsNum == 1) {4089 if (pCtx->iActiveThreadsNum == 1) {
4088 //only single thread support re-alloc now4090 //only single thread support re-alloc now
4089 if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {4091 if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
4090 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::WelsCodeOnePicPartition: DynSliceRealloc not successful");4092 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
4093 "CWelsH264SVCEncoder::WelsCodeOnePicPartition: DynSliceRealloc not successful");
4091 return ENC_RETURN_MEMALLOCERR;4094 return ENC_RETURN_MEMALLOCERR;
4092 }4095 }
4093 } else if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) {4096 } else if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) {
4094 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::WelsCodeOnePicPartition: iSliceIdx(%d) over iMaxSliceNumConstraint(%d)", iSliceIdx, pSliceCtx->iMaxSliceNumConstraint);4097 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
4098 "CWelsH264SVCEncoder::WelsCodeOnePicPartition: iSliceIdx(%d) over iMaxSliceNumConstraint(%d)", iSliceIdx,
4099 pSliceCtx->iMaxSliceNumConstraint);
4095 return ENC_RETURN_MEMALLOCERR;4100 return ENC_RETURN_MEMALLOCERR;
4096 }4101 }
4097 }4102 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t