shithub: openh264

Download patch

ref: 6cb5e468d050dfc49775a43b1704c3316b38bb90
parent: 14725d43561724d2cc4bae1e85f7206aa7d8a527
author: Huade Shi (huashi) <huashi@cisco.com>
date: Tue Apr 11 09:52:13 EDT 2017

Slice buffer design:fixes partitionID/last code slice in partition buffer error issue

--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -1284,7 +1284,7 @@
     return ENC_RETURN_SUCCESS;
   }
 
-  int32_t iPartitionID     = pLastCodedSlice->iSliceIdx / pCtx->iActiveThreadsNum;
+  int32_t iPartitionID     = pLastCodedSlice->iSliceIdx % pCtx->iActiveThreadsNum;
   int32_t iMBNumInPatition = pCtx->pCurDqLayer->EndMbIdxOfPartition[iPartitionID]
                              - pCtx->pCurDqLayer->FirstMbIdxOfPartition[iPartitionID] + 1;
   int32_t iLeftMBNum       = pCtx->pCurDqLayer->EndMbIdxOfPartition[iPartitionID]
@@ -1302,9 +1302,10 @@
                                  const int32_t kiDlayerIdx,
                                  const int32_t KiSlcBuffIdx) {
   int32_t iMaxSliceNum    = pDqLayer->sSliceBufferInfo[KiSlcBuffIdx].iMaxSliceNum;
+  int32_t iCodedSliceNum  = pDqLayer->sSliceBufferInfo[KiSlcBuffIdx].iCodedSliceNum;
   int32_t iMaxSliceNumNew = 0;
   int32_t iRet            = 0;
-  SSlice* pLastCodedSlice = &pDqLayer->sSliceBufferInfo[KiSlcBuffIdx].pSliceBuffer [iMaxSliceNum - 1];
+  SSlice* pLastCodedSlice = &pDqLayer->sSliceBufferInfo[KiSlcBuffIdx].pSliceBuffer [iCodedSliceNum - 1];
   SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIdx].sSliceArgument;
 
   iRet = CalculateNewSliceNum (pCtx,