History

replace LayerBsInfo with FrameBsInfo in thread-based private data structure

huade committed 11 years ago

Commit 7b286bc1 parent 5d9b9527 files · +41 −23Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+18−7
@@ -1812,8 +1812,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1811 unmodified lines
18121812 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx))
18131813 (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
18141814 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc (ppCtx))
1815− (*ppCtx)->pOut->iCountNals = iCountNals;
1816− (*ppCtx)->pOut->iNalIndex = 0;
1815+ (*ppCtx)->pOut->iCountNals = iCountNals;
1816+ (*ppCtx)->pOut->iNalIndex = 0;
1817+ (*ppCtx)->pOut->iLayerBsIndex = 0;
18171818
18181819
18191820 (*ppCtx)->pFrameBs = (uint8_t*)pMa->WelsMalloc (iTotalLength, "pFrameBs");
@@ -3520,8 +3521,10 @@ int32_t WriteSsvcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 1700 unmodified lines
35203521
35213522 //point to next pLayerBsInfo
35223523 ++ pLayerBsInfo;
3524+ ++ pCtx->pOut->iLayerBsIndex;
35233525 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
35243526 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
3527+
35253528 //update for external countings
35263529 ++ iLayerNum;
35273530 iFrameSize += iNonVclSize;
@@ -3557,6 +3560,7 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 29 unmodified lines
35573560
35583561 //point to next pLayerBsInfo
35593562 ++ pLayerBsInfo;
3563+ ++ pCtx->pOut->iLayerBsIndex;
35603564 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
35613565 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
35623566 //update for external countings
@@ -3588,6 +3592,7 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 25 unmodified lines
35883592
35893593 //point to next pLayerBsInfo
35903594 ++ pLayerBsInfo;
3595+ ++ pCtx->pOut->iLayerBsIndex;
35913596 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
35923597 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
35933598 //update for external countings
@@ -3636,6 +3641,7 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 42 unmodified lines
36363641
36373642 //point to next pLayerBsInfo
36383643 ++ pLayerBsInfo;
3644+ ++ pCtx->pOut->iLayerBsIndex;
36393645 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
36403646 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
36413647 //update for external countings
@@ -3671,6 +3677,7 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 29 unmodified lines
36713677
36723678 //point to next pLayerBsInfo
36733679 ++ pLayerBsInfo;
3680+ ++ pCtx->pOut->iLayerBsIndex;
36743681 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
36753682 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
36763683 //update for external countings
@@ -3692,8 +3699,9 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 15 unmodified lines
36923699 void StackBackEncoderStatus (sWelsEncCtx* pEncCtx,
36933700 EVideoFrameType keFrameType) {
36943701 // for bitstream writing
3695− pEncCtx->iPosBsBuffer = 0; // reset bs pBuffer position
3696− pEncCtx->pOut->iNalIndex = 0; // reset NAL index
3702+ pEncCtx->iPosBsBuffer = 0; // reset bs pBuffer position
3703+ pEncCtx->pOut->iNalIndex = 0; // reset NAL index
3704+ pEncCtx->pOut->iLayerBsIndex = 0; // reset index of Layer Bs
36973705
36983706 InitBits (&pEncCtx->pOut->sBsWrite, pEncCtx->pOut->pBsBuffer, pEncCtx->pOut->uiSize);
36993707 if ((keFrameType == videoFrameTypeP) || (keFrameType == videoFrameTypeI)) {
@@ -4033,7 +4041,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 333 unmodified lines
40334041 iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],
40344042 &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
40354043 &pCtx->pSliceThreading->pThreadMasterEvent[0],
4036− pLayerBsInfo, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false);
4044+ pFbi, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false);
40374045 if (iRet) {
40384046 WelsLog (pLogCtx, WELS_LOG_ERROR,
40394047 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
@@ -4073,7 +4081,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines
40734081 iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],
40744082 &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
40754083 &pCtx->pSliceThreading->pThreadMasterEvent[0],
4076− pLayerBsInfo, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false);
4084+ pFbi, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false);
40774085 if (iRet) {
40784086 WelsLog (pLogCtx, WELS_LOG_ERROR,
40794087 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
@@ -4120,7 +4128,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 40 unmodified lines
41204128 iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],
41214129 &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
41224130 &pCtx->pSliceThreading->pThreadMasterEvent[0],
4123− pLayerBsInfo, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true);
4131+ pFbi, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true);
41244132 if (iRet) {
41254133 WelsLog (pLogCtx, WELS_LOG_ERROR,
41264134 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
@@ -4332,6 +4340,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 205 unmodified lines
43324340 iCountNal = pLayerBsInfo->iNalCount;
43334341 ++ iLayerNum;
43344342 ++ pLayerBsInfo;
4343+ ++ pCtx->pOut->iLayerBsIndex;
43354344
43364345 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
43374346 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
@@ -4360,6 +4369,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 22 unmodified lines
43604369 pLayerBsInfo->iNalCount = 1;
43614370 pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize;
43624371 ++ pLayerBsInfo;
4372+ ++ pCtx->pOut->iLayerBsIndex;
43634373 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
43644374 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;
43654375 ++ iLayerNum;
@@ -4928,6 +4938,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 562 unmodified lines
49284938 pCurLayer->pSliceEncCtx->iMaxSliceNumConstraint = iMaxSliceNum;
49294939 return ENC_RETURN_SUCCESS;
49304940 }
4941+
49314942 int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
49324943 SFrameBSInfo* pFrameBSInfo,
49334944 SLayerBSInfo* pLayerBsInfo,

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