ref: b4a9e99823eb2e931d3bef78590d01a20a070f1e
parent: 7f3d6d8411309195df7a51a9c2d915484e3b36bc
author: Sijia Chen <[email protected]>
date: Mon Mar 16 10:48:55 EDT 2015
fix an uninitialization in RC when slice-increasing
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -4763,6 +4763,8 @@
pMA->WelsFree (pCurLayer->pSliceEncCtx->pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice");
pCurLayer->pSliceEncCtx->pCountMbNumInSlice = pCountMbNumInSlice;
+ //deal with rate control variables
+ const int32_t kiCurDid = pCtx->uiDependencyId;
SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMalloc (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC");
if (NULL == pSlcingOverRc) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
@@ -4769,11 +4771,11 @@
"CWelsH264SVCEncoder::DynSliceRealloc: realloc pSlcingOverRc not successful");
return ENC_RETURN_MEMALLOCERR;
}
- memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
+ memcpy (pSlcingOverRc, pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
uiSliceIdx = iMaxSliceNumOld;
SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
- const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc->iTargetBits * INT_MULTIPLY,
- pCtx->pWelsSvcRc->iNumberMbFrame);
+ const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
+ pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
while (uiSliceIdx < iMaxSliceNum) {
pSORC->iComplexityIndexSlice = 0;
pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
@@ -4786,8 +4788,8 @@
pSORC ++;
uiSliceIdx ++;
}
- pMA->WelsFree (pCtx->pWelsSvcRc->pSlicingOverRc, "SlicingOverRC");
- pCtx->pWelsSvcRc->pSlicingOverRc = pSlcingOverRc;
+ pMA->WelsFree (pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc, "SlicingOverRC");
+ pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc = pSlcingOverRc;
if (pCtx->iMaxSliceCount < iMaxSliceNum)
pCtx->iMaxSliceCount = iMaxSliceNum;