shithub: openh264

Download patch

ref: ffb65792e1210a7e59847ecaa3aaf59e5319af56
parent: 097734e7b7d11d5a90509746c55d4b75c93a8383
author: Huade Shi (huashi) <huashi@cisco.com>
date: Wed Mar 29 06:35:59 EDT 2017

slice buffer variable rename:sSliceThreadInfo replace by sSliceBufferInfo

--- a/codec/encoder/core/inc/svc_enc_frame.h
+++ b/codec/encoder/core/inc/svc_enc_frame.h
@@ -68,11 +68,11 @@
 int32_t iHighFreMbCount;
 } SFeatureSearchPreparation; //maintain only one
 
-typedef struct TagSliceThreadInfo {
+typedef struct TagSliceBufferInfo {
 SSlice*                 pSliceBuffer;  // slice buffer for multi thread,
 int32_t                 iMaxSliceNum;
 int32_t                 iCodedSliceNum;
-}SSliceThreadInfo;
+}SSliceBufferInfo;
 
 typedef struct TagLayerInfo {
 SNalUnitHeaderExt       sNalHeaderExt;
@@ -83,7 +83,7 @@
 /* Layer Representation */
 struct TagDqLayer {
 SLayerInfo              sLayerInfo;
-SSliceThreadInfo        sSliceThreadInfo[MAX_THREADS_NUM];
+SSliceBufferInfo        sSliceBufferInfo[MAX_THREADS_NUM];
 SSlice**                ppSliceInLayer;
 SSliceCtx               sSliceEncCtx;   // current slice context
 uint8_t*                pCsData[3];     // pointer to reconstructed picture pData
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -923,8 +923,8 @@
 void FreeSliceInLayer (SDqLayer* pDq, CMemoryAlign* pMa) {
   int32_t iIdx = 0;
   for (; iIdx < MAX_THREADS_NUM; iIdx ++) {
-    FreeSliceBuffer (pDq->sSliceThreadInfo[iIdx].pSliceBuffer,
-                     pDq->sSliceThreadInfo[iIdx].iMaxSliceNum,
+    FreeSliceBuffer (pDq->sSliceBufferInfo[iIdx].pSliceBuffer,
+                     pDq->sSliceBufferInfo[iIdx].iMaxSliceNum,
                      pMa, "pSliceBuffer");
   }
 }
@@ -3643,7 +3643,7 @@
     if (SM_SINGLE_SLICE == pParam->sSliceArgument.uiSliceMode) { // only one slice within a sQualityStat layer
       int32_t iSliceSize   = 0;
       int32_t iPayloadSize = 0;
-      SSlice* pCurSlice    = &pCtx->pCurDqLayer->sSliceThreadInfo[0].pSliceBuffer[0];
+      SSlice* pCurSlice    = &pCtx->pCurDqLayer->sSliceBufferInfo[0].pSliceBuffer[0];
 
       if (pCtx->bNeedPrefixNalFlag) {
         pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType,
@@ -3795,7 +3795,7 @@
 
           WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc);
 
-          pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo[uiTheadIdx].pSliceBuffer[iSliceIdx];
+          pCurSlice = &pCtx->pCurDqLayer->sSliceBufferInfo[uiTheadIdx].pSliceBuffer[iSliceIdx];
           assert (iSliceIdx == pCurSlice->iSliceIdx);
           pCtx->iEncoderError   = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx);
 
@@ -4443,7 +4443,7 @@
 
   SDqLayer* pCurLayer                   = pCtx->pCurDqLayer;
   uint32_t uiTheadIdx                   = 0;
-  SSlice* pStartSlice                   = &pCurLayer->sSliceThreadInfo[uiTheadIdx].pSliceBuffer[iStartSliceIdx];
+  SSlice* pStartSlice                   = &pCurLayer->sSliceBufferInfo[uiTheadIdx].pSliceBuffer[iStartSliceIdx];
   int32_t iNalIdxInLayer                = *pNalIdxInLayer;
   int32_t iSliceIdx                     = iStartSliceIdx;
   const int32_t kiSliceStep             = pCtx->iActiveThreadsNum;
@@ -4463,7 +4463,7 @@
     int32_t iPayloadSize    = 0;
     SSlice* pCurSlice = NULL;
 
-    if (iSliceIdx >= (pCurLayer->sSliceThreadInfo[uiTheadIdx].iMaxSliceNum - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
+    if (iSliceIdx >= (pCurLayer->sSliceBufferInfo[uiTheadIdx].iMaxSliceNum - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
       if (pCtx->iActiveThreadsNum == 1) {
         //only single thread support re-alloc now
         if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
@@ -4487,7 +4487,7 @@
     }
 
     WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc);
-    pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo[uiTheadIdx].pSliceBuffer[iSliceIdx];
+    pCurSlice = &pCtx->pCurDqLayer->sSliceBufferInfo[uiTheadIdx].pSliceBuffer[iSliceIdx];
     pCurSlice->iSliceIdx = iSliceIdx;
 
     iReturn = WelsCodeOneSlice (pCtx, pCurSlice, keNalType);
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -985,7 +985,7 @@
   }
 
   for( ; iTheadIdx < pCtx->iActiveThreadsNum; iTheadIdx++ ) {
-    pCurDqLayer->sSliceThreadInfo[iTheadIdx].iCodedSliceNum = 0;
+    pCurDqLayer->sSliceBufferInfo[iTheadIdx].iCodedSliceNum = 0;
   }
 
   return ENC_RETURN_SUCCESS;
@@ -998,11 +998,11 @@
                               const int32_t kiSliceIdx) {
 
   if (pCtx->pCurDqLayer->bThreadSlcBufferFlag) {
-      const int32_t kiCodedNumInThread = pCtx->pCurDqLayer->sSliceThreadInfo[kiThreadIdx].iCodedSliceNum;
-      assert(kiCodedNumInThread <= pCtx->pCurDqLayer->sSliceThreadInfo[kiThreadIdx].iMaxSliceNum -1 );
-      pSlice = &pCtx->pCurDqLayer->sSliceThreadInfo [kiThreadIdx].pSliceBuffer[kiCodedNumInThread];
+      const int32_t kiCodedNumInThread = pCtx->pCurDqLayer->sSliceBufferInfo[kiThreadIdx].iCodedSliceNum;
+      assert(kiCodedNumInThread <= pCtx->pCurDqLayer->sSliceBufferInfo[kiThreadIdx].iMaxSliceNum -1 );
+      pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [kiThreadIdx].pSliceBuffer[kiCodedNumInThread];
   } else {
-      pSlice = &pCtx->pCurDqLayer->sSliceThreadInfo [0].pSliceBuffer[kiSliceIdx];
+      pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [0].pSliceBuffer[kiSliceIdx];
   }
   pSlice->iSliceIdx   = kiSliceIdx;
   pSlice->uiThreadIdx = kiThreadIdx;
@@ -1037,15 +1037,15 @@
   }
 
   while (iIdx < iSlcBufferNum) {
-    pDqLayer->sSliceThreadInfo[iIdx].iMaxSliceNum   = iMaxSliceNum;
-    pDqLayer->sSliceThreadInfo[iIdx].iCodedSliceNum = 0;
-    pDqLayer->sSliceThreadInfo[iIdx].pSliceBuffer   = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceBuffer");
-    if (NULL == pDqLayer->sSliceThreadInfo[iIdx].pSliceBuffer) {
+    pDqLayer->sSliceBufferInfo[iIdx].iMaxSliceNum   = iMaxSliceNum;
+    pDqLayer->sSliceBufferInfo[iIdx].iCodedSliceNum = 0;
+    pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer   = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceBuffer");
+    if (NULL == pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer) {
       WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceBuffer[iIdx] is NULL");
       return ENC_RETURN_MEMALLOCERR;
     }
-    iRet = InitSliceList (pDqLayer->sSliceThreadInfo[iIdx].pSliceBuffer,
+    iRet = InitSliceList (pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer,
                           &pCtx->pOut->sBsWrite,
                           iMaxSliceNum,
                           pCtx->iSliceBufferSize[kiDlayerIndex],
@@ -1058,9 +1058,9 @@
   }
 
   for (; iIdx < MAX_THREADS_NUM; iIdx++) {
-    pDqLayer->sSliceThreadInfo[iIdx].iMaxSliceNum   = 0;
-    pDqLayer->sSliceThreadInfo[iIdx].iCodedSliceNum = 0;
-    pDqLayer->sSliceThreadInfo[iIdx].pSliceBuffer   = NULL;
+    pDqLayer->sSliceBufferInfo[iIdx].iMaxSliceNum   = 0;
+    pDqLayer->sSliceBufferInfo[iIdx].iCodedSliceNum = 0;
+    pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer   = NULL;
   }
 
   return ENC_RETURN_SUCCESS;
@@ -1095,7 +1095,7 @@
 
   pDqLayer->iMaxSliceNum = 0;
   for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
-    pDqLayer->iMaxSliceNum += pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+    pDqLayer->iMaxSliceNum += pDqLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
   }
 
   pDqLayer->ppSliceInLayer = (SSlice**)pMa->WelsMallocz (sizeof (SSlice*) * pDqLayer->iMaxSliceNum, "ppSliceInLayer");
@@ -1123,11 +1123,11 @@
 
   iStartIdx = 0;
   for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
-    for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++ ) {
-      pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceThreadInfo[iThreadIdx].pSliceBuffer+ iSliceIdx;
+    for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++ ) {
+      pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceBufferInfo[iThreadIdx].pSliceBuffer+ iSliceIdx;
     }
 
-    iStartIdx += pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+    iStartIdx += pDqLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
   }
 
   return ENC_RETURN_SUCCESS;
@@ -1301,10 +1301,10 @@
                                  SDqLayer* pDqLayer,
                                  const int32_t kiDlayerIdx,
                                  const int32_t kiThreadIndex) {
-  int32_t iMaxSliceNum    = pDqLayer->sSliceThreadInfo[kiThreadIndex].iMaxSliceNum;
+  int32_t iMaxSliceNum    = pDqLayer->sSliceBufferInfo[kiThreadIndex].iMaxSliceNum;
   int32_t iMaxSliceNumNew = 0;
   int32_t iRet            = 0;
-  SSlice* pLastCodedSlice = &pDqLayer->sSliceThreadInfo[kiThreadIndex].pSliceBuffer [iMaxSliceNum - 1];
+  SSlice* pLastCodedSlice = &pDqLayer->sSliceBufferInfo[kiThreadIndex].pSliceBuffer [iMaxSliceNum - 1];
   SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIdx].sSliceArgument;
 
   iRet = CalculateNewSliceNum (pCtx,
@@ -1317,7 +1317,7 @@
 
   iRet = ReallocateSliceList (pCtx,
                               pSliceArgument,
-                              pDqLayer->sSliceThreadInfo[kiThreadIndex].pSliceBuffer,
+                              pDqLayer->sSliceBufferInfo[kiThreadIndex].pSliceBuffer,
                               iMaxSliceNum,
                               iMaxSliceNumNew);
   if (ENC_RETURN_SUCCESS != iRet) {
@@ -1324,7 +1324,7 @@
     return iRet;
   }
 
-  pDqLayer->sSliceThreadInfo[kiThreadIndex].iMaxSliceNum = iMaxSliceNumNew;
+  pDqLayer->sSliceBufferInfo[kiThreadIndex].iMaxSliceNum = iMaxSliceNumNew;
 
   return ENC_RETURN_SUCCESS;
 }
@@ -1375,7 +1375,7 @@
 int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) {
 
   SDqLayer* pCurLayer      = pCtx->pCurDqLayer;
-  int32_t iMaxSliceNumOld  = pCurLayer->sSliceThreadInfo[0].iMaxSliceNum;
+  int32_t iMaxSliceNumOld  = pCurLayer->sSliceBufferInfo[0].iMaxSliceNum;
   int32_t iMaxSliceNumNew  = 0;
   int32_t iRet             = 0;
   int32_t iSliceIdx        = 0;
@@ -1382,7 +1382,7 @@
   int32_t iThreadIdx       = 0;
   int32_t iStartIdx        = 0;
   const int32_t kiCurDid   = pCtx->uiDependencyId;
-  SSlice* pLastCodedSlice        = pCurLayer->sSliceThreadInfo[0].pSliceBuffer + (iMaxSliceNumOld - 1);
+  SSlice* pLastCodedSlice        = pCurLayer->sSliceBufferInfo[0].pSliceBuffer + (iMaxSliceNumOld - 1);
   SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument;
   iRet = CalculateNewSliceNum (pCtx,
                                pLastCodedSlice,
@@ -1395,7 +1395,7 @@
 
   iRet = ReallocateSliceList (pCtx,
                               pSliceArgument,
-                              pCurLayer->sSliceThreadInfo[0].pSliceBuffer,
+                              pCurLayer->sSliceBufferInfo[0].pSliceBuffer,
                               iMaxSliceNumOld,
                               iMaxSliceNumNew);
   if (ENC_RETURN_SUCCESS != iRet) {
@@ -1402,11 +1402,11 @@
     return iRet;
   }
 
-  pCurLayer->sSliceThreadInfo[0].iMaxSliceNum = iMaxSliceNumNew;
+  pCurLayer->sSliceBufferInfo[0].iMaxSliceNum = iMaxSliceNumNew;
 
   iMaxSliceNumNew = 0;
   for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
-      iMaxSliceNumNew += pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+      iMaxSliceNumNew += pCurLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
   }
 
   iRet = ExtendLayerBuffer(pCtx, pCurLayer->iMaxSliceNum, iMaxSliceNumNew);
@@ -1415,10 +1415,10 @@
   }
 
   for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
-    for (iSliceIdx = 0; iSliceIdx < pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++) {
-      pCurLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pCurLayer->sSliceThreadInfo[iThreadIdx].pSliceBuffer + iSliceIdx;
+    for (iSliceIdx = 0; iSliceIdx < pCurLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++) {
+      pCurLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pCurLayer->sSliceBufferInfo[iThreadIdx].pSliceBuffer + iSliceIdx;
     }
-    iStartIdx += pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+    iStartIdx += pCurLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
   }
 
   pCurLayer->iMaxSliceNum = iMaxSliceNumNew;
@@ -1477,10 +1477,10 @@
   //before encode all slices in layer, slices' index are init with -1
   //pSliceBuffer->iSliceIdx will be set to actual slice index when encode one slice
   for (iThreadIdx = 0; iThreadIdx < kiThreadNum; iThreadIdx++) {
-    iSliceNumInThread = pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+    iSliceNumInThread = pCurLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
 
     for(iSliceIdx =0; iSliceIdx < iSliceNumInThread; iSliceIdx++) {
-      pSliceBuffer = pCurLayer->sSliceThreadInfo[iThreadIdx].pSliceBuffer + iSliceIdx;
+      pSliceBuffer = pCurLayer->sSliceBufferInfo[iThreadIdx].pSliceBuffer + iSliceIdx;
       if (NULL == pSliceBuffer) {
         return ENC_RETURN_UNEXPECTED;
       }
@@ -1582,7 +1582,7 @@
   int32_t iRet           = 0;
 
   for ( int32_t iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++) {
-    iMaxSliceNum += pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+    iMaxSliceNum += pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
   }
 
   //reallocate ppSliceInLayer if total encoded slice num exceed max slice num
@@ -1678,8 +1678,8 @@
 void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
                        int32_t iFirstMbIdxOfNextSlice, const int32_t kiLastMbIdxInPartition) {
   SDqLayer*     pCurLayer       = pEncCtx->pCurDqLayer;
-  SSlice*       pSliceBuffer    = pCurLayer->sSliceThreadInfo[pCurSlice->uiThreadIdx].pSliceBuffer;
-  int32_t       iCodedSliceNum  = pCurLayer->sSliceThreadInfo[pCurSlice->uiThreadIdx].iCodedSliceNum;
+  SSlice*       pSliceBuffer    = pCurLayer->sSliceBufferInfo[pCurSlice->uiThreadIdx].pSliceBuffer;
+  int32_t       iCodedSliceNum  = pCurLayer->sSliceBufferInfo[pCurSlice->uiThreadIdx].iCodedSliceNum;
   int32_t       iCurMbIdx       = pCurMb->iMbXY;
   uint16_t      iCurSliceIdc    = pSliceCtx->pOverallMbMap[ iCurMbIdx ];
   const int32_t kiSliceIdxStep  = pEncCtx->iActiveThreadsNum;
--- a/codec/encoder/core/src/wels_task_encoder.cpp
+++ b/codec/encoder/core/src/wels_task_encoder.cpp
@@ -237,8 +237,8 @@
   const int32_t kiPartitionId             = m_iSliceIdx % kiSliceIdxStep;
   const int32_t kiFirstMbInPartition      = pCurDq->FirstMbIdxOfPartition[kiPartitionId];
   const int32_t kiEndMbIdxInPartition     = pCurDq->EndMbIdxOfPartition[kiPartitionId];
-  const int32_t kiCodedSliceNumByThread   = pCurDq->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum;
-  m_pSlice                                = &pCurDq->sSliceThreadInfo[m_iThreadIdx].pSliceBuffer[kiCodedSliceNumByThread];
+  const int32_t kiCodedSliceNumByThread   = pCurDq->sSliceBufferInfo[m_iThreadIdx].iCodedSliceNum;
+  m_pSlice                                = &pCurDq->sSliceBufferInfo[m_iThreadIdx].pSliceBuffer[kiCodedSliceNumByThread];
   m_pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice  = kiFirstMbInPartition;
   int32_t iReturn      = 0;
   bool bNeedReallocate = false;
@@ -253,8 +253,8 @@
   int32_t iAnyMbLeftInPartition = iDiffMbIdx + 1;
   int32_t iLocalSliceIdx = m_iSliceIdx;
   while (iAnyMbLeftInPartition > 0) {
-      bNeedReallocate = (pCurDq->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum
-                         >=  pCurDq->sSliceThreadInfo[m_iThreadIdx].iMaxSliceNum -1) ? true : false;
+      bNeedReallocate = (pCurDq->sSliceBufferInfo[m_iThreadIdx].iCodedSliceNum
+                         >=  pCurDq->sSliceBufferInfo[m_iThreadIdx].iMaxSliceNum -1) ? true : false;
       if (bNeedReallocate) {
           WelsMutexLock (&m_pCtx->pSliceThreading->mutexThreadSlcBuffReallocate);
           //for memory statistic variable
@@ -316,7 +316,7 @@
 
     iAnyMbLeftInPartition = kiEndMbIdxInPartition - pCurDq->LastCodedMbIdxOfPartition[kiPartitionId];
     iLocalSliceIdx += kiSliceIdxStep;
-    m_pCtx->pCurDqLayer->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum ++;
+    m_pCtx->pCurDqLayer->sSliceBufferInfo[m_iThreadIdx].iCodedSliceNum ++;
   }
 
   return ENC_RETURN_SUCCESS;
--- a/test/encoder/EncUT_SliceBufferReallocate.cpp
+++ b/test/encoder/EncUT_SliceBufferReallocate.cpp
@@ -30,8 +30,8 @@
     }
 
     for (int32_t iThrdIdx = 0; iThrdIdx < pCtx->iActiveThreadsNum; iThrdIdx++) {
-        iCodedSlcNum = pCtx->pCurDqLayer->sSliceThreadInfo[iThrdIdx].iCodedSliceNum;
-        iMaxSlcNumInThrd = pCtx->pCurDqLayer->sSliceThreadInfo[iThrdIdx].iMaxSliceNum;
+        iCodedSlcNum = pCtx->pCurDqLayer->sSliceBufferInfo[iThrdIdx].iCodedSliceNum;
+        iMaxSlcNumInThrd = pCtx->pCurDqLayer->sSliceBufferInfo[iThrdIdx].iMaxSliceNum;
 
         if ((iCodedSlcNum + kiMinBufferNum) <= iMaxSlcNumInThrd) {
             aiThrdList[iAvailableThrdNum] = iThrdIdx;
@@ -147,9 +147,9 @@
     SSpatialLayerConfig* pLayerCfg = &pCtx->pSvcParam->sSpatialLayers[iLayerIdx];
     int32_t iPartitionID = rand() % iPartitionNum;
     int32_t iMBNumInPatition = 0;
-    int32_t iCodedSlcNum = pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iMaxSliceNum - 1;
+    int32_t iCodedSlcNum = pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iMaxSliceNum - 1;
     int32_t iLastCodeSlcIdx = iPartitionID + iCodedSlcNum * iPartitionNum;
-    SSlice* pLastCodedSlc = &pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].pSliceBuffer[iCodedSlcNum - 1];
+    SSlice* pLastCodedSlc = &pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].pSliceBuffer[iCodedSlcNum - 1];
     pLastCodedSlc->iSliceIdx = iLastCodeSlcIdx;
 
     SetPartitonMBNum(pCtx->ppDqLayerList[iLayerIdx], pLayerCfg, iPartitionNum);
@@ -156,7 +156,7 @@
 
     iMBNumInPatition = pCtx->pCurDqLayer->EndMbIdxOfPartition[iPartitionID] -
                        pCtx->pCurDqLayer->FirstMbIdxOfPartition[iPartitionID] + 1;
-    pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iCodedSliceNum = iCodedSlcNum;
+    pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iCodedSliceNum = iCodedSlcNum;
     pCtx->pCurDqLayer->LastCodedMbIdxOfPartition[iPartitionID] = rand() % iMBNumInPatition + 1;
 
 }
@@ -369,15 +369,15 @@
 
 void CSliceBufferReallocatTest::SimulateEncodedOneSlice(const int32_t kiSlcIdx, const int32_t kiThreadIdx) {
     if(m_EncContext.pCurDqLayer->bThreadSlcBufferFlag) {
-        int32_t iCodedSlcNumInThrd = m_EncContext.pCurDqLayer->sSliceThreadInfo[kiThreadIdx].iCodedSliceNum;
+        int32_t iCodedSlcNumInThrd = m_EncContext.pCurDqLayer->sSliceBufferInfo[kiThreadIdx].iCodedSliceNum;
 
-        EXPECT_TRUE(NULL != m_EncContext.pCurDqLayer->sSliceThreadInfo[kiThreadIdx].pSliceBuffer);
-        EXPECT_TRUE(NULL != &m_EncContext.pCurDqLayer->sSliceThreadInfo[kiThreadIdx].pSliceBuffer[iCodedSlcNumInThrd]);
+        EXPECT_TRUE(NULL != m_EncContext.pCurDqLayer->sSliceBufferInfo[kiThreadIdx].pSliceBuffer);
+        EXPECT_TRUE(NULL != &m_EncContext.pCurDqLayer->sSliceBufferInfo[kiThreadIdx].pSliceBuffer[iCodedSlcNumInThrd]);
 
-        m_EncContext.pCurDqLayer->sSliceThreadInfo[kiThreadIdx].pSliceBuffer[iCodedSlcNumInThrd].iSliceIdx = kiSlcIdx;
-        m_EncContext.pCurDqLayer->sSliceThreadInfo[kiThreadIdx].iCodedSliceNum ++;
+        m_EncContext.pCurDqLayer->sSliceBufferInfo[kiThreadIdx].pSliceBuffer[iCodedSlcNumInThrd].iSliceIdx = kiSlcIdx;
+        m_EncContext.pCurDqLayer->sSliceBufferInfo[kiThreadIdx].iCodedSliceNum ++;
     } else {
-        m_EncContext.pCurDqLayer->sSliceThreadInfo[0].pSliceBuffer[kiSlcIdx].iSliceIdx = kiSlcIdx;
+        m_EncContext.pCurDqLayer->sSliceBufferInfo[0].pSliceBuffer[kiSlcIdx].iSliceIdx = kiSlcIdx;
     }
 }
 
@@ -409,7 +409,7 @@
     if (SM_SIZELIMITED_SLICE == pLayerCfg->sSliceArgument.uiSliceMode) {
         int32_t iPartNum         = m_EncContext.iActiveThreadsNum;
         int32_t iSlicNumPerPart  = iSimulateSliceNum / iPartNum;
-        int32_t iMaxSlcNumInThrd = m_EncContext.pCurDqLayer->sSliceThreadInfo[0].iMaxSliceNum;
+        int32_t iMaxSlcNumInThrd = m_EncContext.pCurDqLayer->sSliceBufferInfo[0].iMaxSliceNum;
         int32_t iLastPartSlcNum = 0;
 
         iSlicNumPerPart = WelsClip3(iSlicNumPerPart, 1, iMaxSlcNumInThrd);
@@ -449,15 +449,14 @@
     //          thrd_1: partition_1
     //          thrd_2: idle
     int32_t iThreadIndex  = rand() % pCtx->iActiveThreadsNum;
-    int32_t iPartitionNum = rand() % pCtx->iActiveThreadsNum + 1;
-    int32_t iSlcBufferNum = pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iMaxSliceNum;
+    int32_t iPartitionNum = rand() % pCtx->iActiveThreadsNum + 1; //include cases which part num less than thread num
+    int32_t iSlcBufferNum = pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iMaxSliceNum;
 
     ParamSetForReallocateTest(pCtx, iLayerIdx, iThreadIndex, iPartitionNum);
     iRet = ReallocateSliceInThread(pCtx, pCtx->pCurDqLayer, iLayerIdx, iThreadIndex);
-
     EXPECT_TRUE(cmResultSuccess == iRet);
-    EXPECT_TRUE(NULL != pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].pSliceBuffer);
-    EXPECT_TRUE(iSlcBufferNum < pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iMaxSliceNum);
+    EXPECT_TRUE(NULL != pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].pSliceBuffer);
+    EXPECT_TRUE(iSlcBufferNum < pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iMaxSliceNum);
 
     UnInitParamForTestCase(iLayerIdx);
 }
@@ -485,13 +484,12 @@
     ParamSetForReallocateTest(pCtx, iLayerIdx, iThreadIndex, iPartitionNum);
 
     for (int32_t iPartIdx = 0; iPartIdx < iPartitionNum; iPartIdx++) {
-        iSlcBufferNum = pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iMaxSliceNum;
+        iSlcBufferNum = pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iMaxSliceNum;
 
         iRet = ReallocateSliceInThread(pCtx, pCtx->pCurDqLayer, iLayerIdx, iThreadIndex);
-
         EXPECT_TRUE(cmResultSuccess == iRet);
-        EXPECT_TRUE(NULL != pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].pSliceBuffer);
-        EXPECT_TRUE(iSlcBufferNum < pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIndex].iMaxSliceNum);
+        EXPECT_TRUE(NULL != pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].pSliceBuffer);
+        EXPECT_TRUE(iSlcBufferNum < pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIndex].iMaxSliceNum);
     }
 
     UnInitParamForTestCase(iLayerIdx);
@@ -512,18 +510,18 @@
 
     //before extend, simulate reallocate slice buffer in one thread
     int32_t iReallocateThrdIdx = rand() % pCtx->iActiveThreadsNum;
-    iSlcBuffNumInThrd = pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iMaxSliceNum;
-    pSlcListInThrd = pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].pSliceBuffer;
+    iSlcBuffNumInThrd = pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iMaxSliceNum;
+    pSlcListInThrd = pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].pSliceBuffer;
 
     iRet = ReallocateSliceList(pCtx, &pCtx->pSvcParam->sSpatialLayers[iLayerIdx].sSliceArgument,
                                pSlcListInThrd, iSlcBuffNumInThrd, iSlcBuffNumInThrd * 2);
     EXPECT_TRUE(cmResultSuccess == iRet);
     EXPECT_TRUE(NULL != pSlcListInThrd);
-    pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].pSliceBuffer = pSlcListInThrd;
-    pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iMaxSliceNum   = iSlcBuffNumInThrd * 2;
+    pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].pSliceBuffer = pSlcListInThrd;
+    pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iMaxSliceNum   = iSlcBuffNumInThrd * 2;
 
     for (int32_t iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++) {
-        iMaxSliceNumNew += pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
+        iMaxSliceNumNew += pCtx->pCurDqLayer->sSliceBufferInfo[iThreadIdx].iMaxSliceNum;
     }
 
     iRet = ExtendLayerBuffer(pCtx, pCtx->pCurDqLayer->iMaxSliceNum, iMaxSliceNumNew);
@@ -608,9 +606,9 @@
 
     //simulate reallocate slice buffer in one thread
     int32_t iReallocateThrdIdx = rand() % pCtx->iActiveThreadsNum;
-    int32_t iSlcBuffNumInThrd  = pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iMaxSliceNum;
-    int32_t iCodedSlcNumInThrd = pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iCodedSliceNum;
-    SSlice* pSlcListInThrd     = pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].pSliceBuffer;
+    int32_t iSlcBuffNumInThrd  = pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iMaxSliceNum;
+    int32_t iCodedSlcNumInThrd = pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iCodedSliceNum;
+    SSlice* pSlcListInThrd     = pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].pSliceBuffer;
     SliceModeEnum eSlcMode     = pCtx->pSvcParam->sSpatialLayers[iLayerIdx].sSliceArgument.uiSliceMode;
     int32_t iSlcIdxInThrd      = 0;
     int32_t iPartitionNum      = (SM_SIZELIMITED_SLICE == eSlcMode) ? pCtx->iActiveThreadsNum : 1;
@@ -622,8 +620,8 @@
                                pSlcListInThrd, iSlcBuffNumInThrd, iSlcBuffNumInThrd * 2);
     EXPECT_TRUE(cmResultSuccess == iRet);
     EXPECT_TRUE(NULL != pSlcListInThrd);
-    pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].pSliceBuffer = pSlcListInThrd;
-    pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iMaxSliceNum = iSlcBuffNumInThrd * 2;
+    pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].pSliceBuffer = pSlcListInThrd;
+    pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iMaxSliceNum = iSlcBuffNumInThrd * 2;
 
     //update reallocate slice idx/NalNum info
     for (int32_t iSlcIdx = iCodedSlcNumInThrd; iSlcIdx < iSlcBuffNumInThrd * 2; iSlcIdx++) {
@@ -638,7 +636,7 @@
         pSlcListInThrd[iSlcIdx].sSliceBs.iNalIndex = rand() % 2 + 1;
         pSlcListInThrd[iSlcIdx].sSliceBs.uiBsPos = rand() % pSlcListInThrd[iSlcIdx].sSliceBs.uiSize + 1;
         pCtx->pCurDqLayer->sSliceEncCtx.iSliceNumInFrame ++;
-        pCtx->pCurDqLayer->sSliceThreadInfo[iReallocateThrdIdx].iCodedSliceNum++;
+        pCtx->pCurDqLayer->sSliceBufferInfo[iReallocateThrdIdx].iCodedSliceNum++;
     }
 
     //simulate for layer bs