History

refactor for future simplification

Sijia Chen committed 11 years ago

Commit dfcc78e1 parent 82a0d3e2 files · +24 −31Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+22−27
@@ -1067,6 +1067,25 @@ int32_t FindExistingPps (SWelsSPS* pSps, SSubsetSps* pSubsetSps, const bool kbUs · 1066 unmodified lines
1067 return INVALID_ID;1067 return INVALID_ID;
1068}1068}
1069 1069
1070static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer, CMemoryAlign* pMa,
1071 const int32_t iMaxSliceNum, bool bMultithread) {
1072 int32_t iSliceIdx = 0;
1073 while (iSliceIdx < iMaxSliceNum) {
1074 SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx];
1075 pSlice->uiSliceIdx = iSliceIdx;
1076 if (bMultithread)
1077 pSlice->pSliceBsa = & (*ppCtx)->pSliceBs[iSliceIdx].sBsWrite;
1078 else
1079 pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
1080 if (AllocMbCacheAligned (&pSlice->sMbCacheInfo, pMa)) {
1081 FreeMemorySvc (ppCtx);
1082 return ENC_RETURN_MEMALLOCERR;
1083 }
1084 ++ iSliceIdx;
1085 }
1086 return ENC_RETURN_SUCCESS;
1087}
1088
1070/*!1089/*!
1071 * \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available1090 * \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available
1072 * \pParam pCtx sWelsEncCtx*1091 * \pParam pCtx sWelsEncCtx*
@@ -1161,35 +1180,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 88 unmodified lines
1161 pDqLayer->iMbWidth = kiMbW;1180 pDqLayer->iMbWidth = kiMbW;
1162 pDqLayer->iMbHeight = kiMbH;1181 pDqLayer->iMbHeight = kiMbH;
1163 {1182 {
1164 int32_t iSliceIdx = 0;
1165 pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer");1183 pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer");
1166
1167 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer->sLayerInfo.pSliceInLayer), FreeMemorySvc (ppCtx))1184 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer->sLayerInfo.pSliceInLayer), FreeMemorySvc (ppCtx))
1168 if (iMaxSliceNum > 1) {1185
1169 while (iSliceIdx < iMaxSliceNum) {1186 int32_t iReturn = InitpSliceInLayer (ppCtx, pDqLayer, pMa, iMaxSliceNum, pParam->iMultipleThreadIdc > 1);
1170 SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx];1187 WELS_VERIFY_RETURN_PROC_IF (1, (ENC_RETURN_SUCCESS != iReturn), FreeMemorySvc (ppCtx))
1171 pSlice->uiSliceIdx = iSliceIdx;
1172 if (pParam->iMultipleThreadIdc > 1)
1173 pSlice->pSliceBsa = & (*ppCtx)->pSliceBs[iSliceIdx].sBsWrite;
1174 else
1175 pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
1176 if (AllocMbCacheAligned (&pSlice->sMbCacheInfo, pMa)) {
1177 FreeMemorySvc (ppCtx);
1178 return 1;
1179 }
1180 ++ iSliceIdx;
1181 }
1182 }
1183 // fix issue in case single pSlice coding might be inclusive exist in variant spatial layer setting, also introducing multi-pSlice modes
1184 else { // only one pSlice
1185 SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[0];
1186 pSlice->uiSliceIdx = 0;
1187 pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
1188 if (AllocMbCacheAligned (&pSlice->sMbCacheInfo, pMa)) {
1189 FreeMemorySvc (ppCtx);
1190 return 1;
1191 }
1192 }
1193 }1188 }
1194 1189
1195 //deblocking parameters initialization1190 //deblocking parameters initialization

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