History

remove (ppCtx)->pSliceCtxList and only keep DqLayer->sSliceCtx to simply the structure manage

huade committed 10 years ago

Commit 35ab32b1 parent f9d8e9a10 files · +67 −84Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+33−46
@@ -764,7 +764,7 @@ static void InitMbInfo (sWelsEncCtx* pEnc, SMB* pList, SDqLayer* pLayer, con · 763 unmodified lines
764 int32_t iMbHeight = pLayer->iMbHeight;764 int32_t iMbHeight = pLayer->iMbHeight;
765 int32_t iIdx;765 int32_t iIdx;
766 int32_t iMbNum = iMbWidth * iMbHeight;766 int32_t iMbNum = iMbWidth * iMbHeight;
767 SSliceCtx* pSliceCtx = pLayer->pSliceEncCtx;767 SSliceCtx* pSliceCtx = &pLayer->sSliceEncCtx;
768 uint32_t uiNeighborAvail;768 uint32_t uiNeighborAvail;
769 const int32_t kiOffset = (kiDlayerId & 0x01) * kiMaxMbNum;769 const int32_t kiOffset = (kiDlayerId & 0x01) * kiMaxMbNum;
770 SMVUnitXY (*pLayerMvUnitBlock4x4)[MB_BLOCK4x4_NUM] = (SMVUnitXY (*)[MB_BLOCK4x4_NUM]) (770 SMVUnitXY (*pLayerMvUnitBlock4x4)[MB_BLOCK4x4_NUM] = (SMVUnitXY (*)[MB_BLOCK4x4_NUM]) (
@@ -1361,7 +1361,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 590 unmodified lines
1361 1361
1362 // Not using FMO in SVC coding so far, come back if need FMO1362 // Not using FMO in SVC coding so far, come back if need FMO
1363 {1363 {
1364 iResult = InitSlicePEncCtx (& (*ppCtx)->pSliceCtxList[iDlayerIndex],1364 iResult = InitSlicePEncCtx (&(*ppCtx)->ppDqLayerList[iDlayerIndex]->sSliceEncCtx,
1365 (*ppCtx)->pMemAlign,1365 (*ppCtx)->pMemAlign,
1366 false,1366 false,
1367 pSps->iMbWidth,1367 pSps->iMbWidth,
@@ -1373,7 +1373,6 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 5 unmodified lines
1373 FreeMemorySvc (ppCtx);1373 FreeMemorySvc (ppCtx);
1374 return iResult;1374 return iResult;
1375 }1375 }
1376 (*ppCtx)->ppDqLayerList[iDlayerIndex]->pSliceEncCtx = & (*ppCtx)->pSliceCtxList[iDlayerIndex];
1377 }1376 }
1378 pDqIdc->iSpsId = iSpsId;1377 pDqIdc->iSpsId = iSpsId;
1379 pDqIdc->iPpsId = iPpsId;1378 pDqIdc->iPpsId = iPpsId;
@@ -1860,10 +1859,6 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 480 unmodified lines
1860 (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SRefList*), "ppRefPicListExt");1859 (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SRefList*), "ppRefPicListExt");
1861 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppRefPicListExt), FreeMemorySvc (ppCtx))1860 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppRefPicListExt), FreeMemorySvc (ppCtx))
1862 1861
1863 // pSlice context list
1864 (*ppCtx)->pSliceCtxList = (SSliceCtx*)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SSliceCtx), "pSliceCtxList");
1865 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSliceCtxList), FreeMemorySvc (ppCtx))
1866
1867 (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList");1862 (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMalloc (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList");
1868 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppDqLayerList), FreeMemorySvc (ppCtx))1863 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppDqLayerList), FreeMemorySvc (ppCtx))
1869 1864
@@ -2096,8 +2091,8 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 226 unmodified lines
2096 int32_t iSliceIdx = 0;2091 int32_t iSliceIdx = 0;
2097 int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceArgument);2092 int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceArgument);
2098 if (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE && pCtx->iActiveThreadsNum == 1) {2093 if (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE && pCtx->iActiveThreadsNum == 1) {
2099 if (iSliceNum < pDq->pSliceEncCtx->iMaxSliceNumConstraint) {2094 if (iSliceNum < pDq->sSliceEncCtx.iMaxSliceNumConstraint) {
2100 iSliceNum = pDq->pSliceEncCtx->iMaxSliceNumConstraint;2095 iSliceNum = pDq->sSliceEncCtx.iMaxSliceNumConstraint;
2101 }2096 }
2102 }2097 }
2103 if (iSliceNum < 1)2098 if (iSliceNum < 1)
@@ -2125,6 +2120,11 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 21 unmodified lines
2125 pDq->pFeatureSearchPreparation = NULL;2120 pDq->pFeatureSearchPreparation = NULL;
2126 }2121 }
2127 2122
2123 SSliceCtx* pSliceCtx = &pDq->sSliceEncCtx;
2124 if (NULL != pSliceCtx) {
2125 UninitSlicePEncCtx (pSliceCtx, pMa);
2126 }
2127
2128 pMa->WelsFree (pDq, "pDq");2128 pMa->WelsFree (pDq, "pDq");
2129 pDq = NULL;2129 pDq = NULL;
2130 pCtx->ppDqLayerList[ilayer] = NULL;2130 pCtx->ppDqLayerList[ilayer] = NULL;
@@ -2158,19 +2158,6 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 27 unmodified lines
2158 pCtx->ppRefPicListExt = NULL;2158 pCtx->ppRefPicListExt = NULL;
2159 }2159 }
2160 2160
2161 // pSlice context list
2162 if (NULL != pCtx->pSliceCtxList && pParam != NULL) {
2163 ilayer = 0;
2164 while (ilayer < pParam->iSpatialLayerNum) {
2165 SSliceCtx* pSliceCtx = &pCtx->pSliceCtxList[ilayer];
2166 if (NULL != pSliceCtx)
2167 UninitSlicePEncCtx (pSliceCtx, pMa);
2168 ++ ilayer;
2169 }
2170 pMa->WelsFree (pCtx->pSliceCtxList, "pSliceCtxList");
2171 pCtx->pSliceCtxList = NULL;
2172 }
2173
2174 // VAA2161 // VAA
2175 if (NULL != pCtx->pVaa) {2162 if (NULL != pCtx->pVaa) {
2176 if (pCtx->pSvcParam->bEnableAdaptiveQuant) { //free mem2163 if (pCtx->pSvcParam->bEnableAdaptiveQuant) { //free mem
@@ -2758,14 +2745,14 @@ int32_t PicPartitionNumDecision (sWelsEncCtx* pCtx) { · 581 unmodified lines
2758void WelsInitCurrentQBLayerMltslc (sWelsEncCtx* pCtx) {2745void WelsInitCurrentQBLayerMltslc (sWelsEncCtx* pCtx) {
2759 //pData init2746 //pData init
2760 SDqLayer* pCurDq = pCtx->pCurDqLayer;2747 SDqLayer* pCurDq = pCtx->pCurDqLayer;
2761 SSliceCtx* pSliceCtx = (pCurDq->pSliceEncCtx);2748 SSliceCtx* pSliceCtx = &(pCurDq->sSliceEncCtx);
2762 2749
2763 //mb_neighbor2750 //mb_neighbor
2764 DynslcUpdateMbNeighbourInfoListForAllSlices (pSliceCtx, pCurDq->sMbDataP);2751 DynslcUpdateMbNeighbourInfoListForAllSlices (pSliceCtx, pCurDq->sMbDataP);
2765}2752}
2766 2753
2767void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) {2754void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) {
2768 SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;2755 SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
2769 const int32_t kiMbNumInFrame = pSliceCtx->iMbNumInFrame;2756 const int32_t kiMbNumInFrame = pSliceCtx->iMbNumInFrame;
2770 int32_t iCountMbNumPerPartition = kiMbNumInFrame;2757 int32_t iCountMbNumPerPartition = kiMbNumInFrame;
2771 int32_t iAssignableMbLeft = kiMbNumInFrame;2758 int32_t iAssignableMbLeft = kiMbNumInFrame;
@@ -2799,7 +2786,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 27 unmodified lines
2799 2786
2800void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) {2787void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) {
2801 SDqLayer* pCurDq = pCtx->pCurDqLayer;2788 SDqLayer* pCurDq = pCtx->pCurDqLayer;
2802 SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;2789 SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
2803 2790
2804 UpdateSlicepEncCtxWithPartition (pCurDq, iPartitionNum);2791 UpdateSlicepEncCtxWithPartition (pCurDq, iPartitionNum);
2805 2792
@@ -2877,7 +2864,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 71 unmodified lines
2877 if (fDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE) // need get extra slices for update2864 if (fDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE) // need get extra slices for update
2878 iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceArgument);2865 iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceArgument);
2879 else2866 else
2880 iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);2867 iSliceCount = GetCurrentSliceNum (&pCurDq->sSliceEncCtx);
2881 assert (iSliceCount > 0);2868 assert (iSliceCount > 0);
2882 2869
2883 int32_t iCurPpsId = pDqIdc->iPpsId;2870 int32_t iCurPpsId = pDqIdc->iPpsId;
@@ -3140,7 +3127,7 @@ static inline void WelsSwapDqLayers (sWelsEncCtx* pCtx, const int32_t kiNextDqId · 256 unmodified lines
3140 */3127 */
3141static inline void PrefetchReferencePicture (sWelsEncCtx* pCtx, const EVideoFrameType keFrameType) {3128static inline void PrefetchReferencePicture (sWelsEncCtx* pCtx, const EVideoFrameType keFrameType) {
3142 SSlice* pSliceBase = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[0];3129 SSlice* pSliceBase = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[0];
3143 const int32_t kiSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);3130 const int32_t kiSliceCount = GetCurrentSliceNum (&pCtx->pCurDqLayer->sSliceEncCtx);
3144 int32_t iIdx = 0;3131 int32_t iIdx = 0;
3145 uint8_t uiRefIdx = -1;3132 uint8_t uiRefIdx = -1;
3146 3133
@@ -4019,7 +4006,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 872 unmodified lines
4019 }4006 }
4020 // for dynamic slicing single threading..4007 // for dynamic slicing single threading..
4021 else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {4008 else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
4022 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;4009 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;
4023 pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,4010 pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,
4024 kiLastMbInFrame, 0);4011 kiLastMbInFrame, 0);
4025 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)4012 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
@@ -4028,7 +4015,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines
4028 int32_t iRet = 0;4015 int32_t iRet = 0;
4029 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_SIZELIMITED_SLICE4016 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_SIZELIMITED_SLICE
4030 if ((SM_SIZELIMITED_SLICE != pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {4017 if ((SM_SIZELIMITED_SLICE != pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
4031 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);4018 iSliceCount = GetCurrentSliceNum (&pCtx->pCurDqLayer->sSliceEncCtx);
4032 if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed4019 if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
4033 WelsLog (pLogCtx, WELS_LOG_ERROR,4020 WelsLog (pLogCtx, WELS_LOG_ERROR,
4034 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",4021 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",
@@ -4061,7 +4048,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 26 unmodified lines
4061 iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],4048 iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],
4062 &pCtx->pSliceThreading->pReadySliceCodingEvent[0],4049 &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
4063 &pCtx->pSliceThreading->pThreadMasterEvent[0],4050 &pCtx->pSliceThreading->pThreadMasterEvent[0],
4064 pFbi, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true);4051 pFbi, kiPartitionCnt, &pCtx->pCurDqLayer->sSliceEncCtx, true);
4065 if (iRet) {4052 if (iRet) {
4066 WelsLog (pLogCtx, WELS_LOG_ERROR,4053 WelsLog (pLogCtx, WELS_LOG_ERROR,
4067 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",4054 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
@@ -4078,7 +4065,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 10 unmodified lines
4078 const bool bNeedPrefix = pCtx->bNeedPrefixNalFlag;4065 const bool bNeedPrefix = pCtx->bNeedPrefixNalFlag;
4079 int32_t iSliceIdx = 0;4066 int32_t iSliceIdx = 0;
4080 4067
4081 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);4068 iSliceCount = GetCurrentSliceNum (&pCtx->pCurDqLayer->sSliceEncCtx);
4082 while (iSliceIdx < iSliceCount) {4069 while (iSliceIdx < iSliceCount) {
4083 int32_t iSliceSize = 0;4070 int32_t iSliceSize = 0;
4084 int32_t iPayloadSize = 0;4071 int32_t iPayloadSize = 0;
@@ -4314,7 +4301,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 229 unmodified lines
4314 && pSvcParam->bUseLoadBalancing4301 && pSvcParam->bUseLoadBalancing
4315 && pSvcParam->iMultipleThreadIdc > 1 &&4302 && pSvcParam->iMultipleThreadIdc > 1 &&
4316 pSvcParam->iMultipleThreadIdc >= pParam->sSliceArgument.uiSliceNum) {4303 pSvcParam->iMultipleThreadIdc >= pParam->sSliceArgument.uiSliceNum) {
4317 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,4304 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], &pCtx->pCurDqLayer->sSliceEncCtx,
4318 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);4305 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
4319#if defined(MT_DEBUG)4306#if defined(MT_DEBUG)
4320 TrackSliceComplexities (pCtx, iCurDid);4307 TrackSliceComplexities (pCtx, iCurDid);
@@ -4740,7 +4727,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 419 unmodified lines
4740 SDqLayer* pCurLayer = pCtx->pCurDqLayer;4727 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
4741 4728
4742 int32_t iCountNals = pCtx->pOut->iCountNals;4729 int32_t iCountNals = pCtx->pOut->iCountNals;
4743 int32_t iMaxSliceNumOld = pCurLayer->pSliceEncCtx->iMaxSliceNumConstraint;4730 int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint;
4744 int32_t iMaxSliceNum = iMaxSliceNumOld;4731 int32_t iMaxSliceNum = iMaxSliceNumOld;
4745 iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag);4732 iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag);
4746 iMaxSliceNum *= SLICE_NUM_EXPAND_COEF;4733 iMaxSliceNum *= SLICE_NUM_EXPAND_COEF;
@@ -4820,9 +4807,9 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 73 unmodified lines
4820 return ENC_RETURN_MEMALLOCERR;4807 return ENC_RETURN_MEMALLOCERR;
4821 }4808 }
4822 memset (pFirstMbInSlice, 0, sizeof (int32_t) * iMaxSliceNum);4809 memset (pFirstMbInSlice, 0, sizeof (int32_t) * iMaxSliceNum);
4823 memcpy (pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof (int32_t) * iMaxSliceNumOld);4810 memcpy (pFirstMbInSlice, pCurLayer->sSliceEncCtx.pFirstMbInSlice, sizeof (int32_t) * iMaxSliceNumOld);
4824 pMA->WelsFree (pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice");4811 pMA->WelsFree (pCurLayer->sSliceEncCtx.pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice");
4825 pCurLayer->pSliceEncCtx->pFirstMbInSlice = pFirstMbInSlice;4812 pCurLayer->sSliceEncCtx.pFirstMbInSlice = pFirstMbInSlice;
4826 4813
4827 int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),4814 int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),
4828 "pSliceSeg->pCountMbNumInSlice");4815 "pSliceSeg->pCountMbNumInSlice");
@@ -4831,14 +4818,14 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2 unmodified lines
4831 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pCountMbNumInSlice not successful");4818 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pCountMbNumInSlice not successful");
4832 return ENC_RETURN_MEMALLOCERR;4819 return ENC_RETURN_MEMALLOCERR;
4833 }4820 }
4834 memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);4821 memcpy (pCountMbNumInSlice, pCurLayer->sSliceEncCtx.pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);
4835 uiSliceIdx = iMaxSliceNumOld;4822 uiSliceIdx = iMaxSliceNumOld;
4836 while (uiSliceIdx < iMaxSliceNum) {4823 while (uiSliceIdx < iMaxSliceNum) {
4837 pCountMbNumInSlice[uiSliceIdx] = pCurLayer->pSliceEncCtx->iMbNumInFrame;4824 pCountMbNumInSlice[uiSliceIdx] = pCurLayer->sSliceEncCtx.iMbNumInFrame;
4838 uiSliceIdx++;4825 uiSliceIdx++;
4839 }4826 }
4840 pMA->WelsFree (pCurLayer->pSliceEncCtx->pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice");4827 pMA->WelsFree (pCurLayer->sSliceEncCtx.pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice");
4841 pCurLayer->pSliceEncCtx->pCountMbNumInSlice = pCountMbNumInSlice;4828 pCurLayer->sSliceEncCtx.pCountMbNumInSlice = pCountMbNumInSlice;
4842 4829
4843 uint32_t* pSliceConsumeTime = (uint32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (uint32_t),4830 uint32_t* pSliceConsumeTime = (uint32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (uint32_t),
4844 "pSliceSeg->pSliceConsumeTime");4831 "pSliceSeg->pSliceConsumeTime");
@@ -4847,9 +4834,9 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 2 unmodified lines
4847 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSliceConsumeTime not successful");4834 "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSliceConsumeTime not successful");
4848 return ENC_RETURN_MEMALLOCERR;4835 return ENC_RETURN_MEMALLOCERR;
4849 }4836 }
4850 memcpy (pSliceConsumeTime, pCurLayer->pSliceEncCtx->pSliceConsumeTime, sizeof (int32_t) * iMaxSliceNumOld);4837 memcpy (pSliceConsumeTime, pCurLayer->sSliceEncCtx.pSliceConsumeTime, sizeof (int32_t) * iMaxSliceNumOld);
4851 pMA->WelsFree (pCurLayer->pSliceEncCtx->pSliceConsumeTime, "pSliceSeg->pSliceConsumeTime");4838 pMA->WelsFree (pCurLayer->sSliceEncCtx.pSliceConsumeTime, "pSliceSeg->pSliceConsumeTime");
4852 pCurLayer->pSliceEncCtx->pSliceConsumeTime = pSliceConsumeTime;4839 pCurLayer->sSliceEncCtx.pSliceConsumeTime = pSliceConsumeTime;
4853 4840
4854 //deal with rate control variables4841 //deal with rate control variables
4855 const int32_t kiCurDid = pCtx->uiDependencyId;4842 const int32_t kiCurDid = pCtx->uiDependencyId;
@@ -4869,7 +4856,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 13 unmodified lines
4869 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;4856 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
4870 pSORC->iTotalQpSlice = 0;4857 pSORC->iTotalQpSlice = 0;
4871 pSORC->iTotalMbSlice = 0;4858 pSORC->iTotalMbSlice = 0;
4872 pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx],4859 pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->sSliceEncCtx.pCountMbNumInSlice[uiSliceIdx],
4873 INT_MULTIPLY);4860 INT_MULTIPLY);
4874 pSORC->iFrameBitsSlice = 0;4861 pSORC->iFrameBitsSlice = 0;
4875 pSORC->iGomBitsSlice = 0;4862 pSORC->iGomBitsSlice = 0;
@@ -4881,7 +4868,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 5 unmodified lines
4881 4868
4882 if (pCtx->iMaxSliceCount < iMaxSliceNum)4869 if (pCtx->iMaxSliceCount < iMaxSliceNum)
4883 pCtx->iMaxSliceCount = iMaxSliceNum;4870 pCtx->iMaxSliceCount = iMaxSliceNum;
4884 pCurLayer->pSliceEncCtx->iMaxSliceNumConstraint = iMaxSliceNum;4871 pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNum;
4885 return ENC_RETURN_SUCCESS;4872 return ENC_RETURN_SUCCESS;
4886}4873}
4887 4874
@@ -4896,7 +4883,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 8 unmodified lines
4896 ) {4883 ) {
4897 4884
4898 SDqLayer* pCurLayer = pCtx->pCurDqLayer;4885 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
4899 SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;4886 SSliceCtx* pSliceCtx = &pCurLayer->sSliceEncCtx;
4900 int32_t iNalIdxInLayer = *pNalIdxInLayer;4887 int32_t iNalIdxInLayer = *pNalIdxInLayer;
4901 int32_t iSliceIdx = iStartSliceIdx;4888 int32_t iSliceIdx = iStartSliceIdx;
4902 const int32_t kiSliceStep = pCtx->iActiveThreadsNum;4889 const int32_t kiSliceStep = pCtx->iActiveThreadsNum;

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