ref: 9f30ffc0150ab69000b93bc8355a70b562bb65d1
parent: 4c3852c880d02df36b8ad6616ac51e8fa62e7a67
author: Huade Shi (huashi) <huashi@cisco.com>
date: Tue Mar 28 10:46:27 EDT 2017
SliceBufferReallocate:clean unneed code
--- a/codec/encoder/core/inc/rc.h
+++ b/codec/encoder/core/inc/rc.h
@@ -181,6 +181,7 @@
int32_t iRemainingWeights;
int32_t iFrameDqBits;
+bool bGomRC;
double* pGomComplexity;
int32_t* pGomForegroundBlockNum;
int32_t* pCurrentFrameGomSad;
@@ -261,7 +262,7 @@
PWelsRCPostFrameSkippingFunc pfWelsRcPostFrameSkipping;
} SWelsRcFunc;
-void RCInitOneSliceInformation(sWelsEncCtx* pEncCtx, SSlice* pSlice);
+void GomRCInitForOneSlice(SSlice* pSlice, const int32_t kiBitsPerMb);
void CheckFrameSkipBasedMaxbr (sWelsEncCtx* pCtx,const long long uiTimeStamp, int32_t iDidIdx);
void UpdateBufferWhenFrameSkipped(sWelsEncCtx* pCtx, int32_t iSpatialNum);
void UpdateMaxBrCheckWindowStatus(sWelsEncCtx* pCtx, int32_t iSpatialNum, const long long uiTimeStamp);
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -510,18 +510,12 @@
pEncCtx->iGlobalQp = iLumaQp;
}
-void RCInitOneSliceInformation(sWelsEncCtx* pEncCtx, SSlice* pSlice) {
-
- bool bGomRC = (RC_OFF_MODE == pEncCtx->pSvcParam->iRCMode ||
- RC_BUFFERBASED_MODE == pEncCtx->pSvcParam->iRCMode ) ? false : true;
- if(bGomRC) {
- SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc;
- const int32_t kiBitsPerMb = pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId].iBitsPerMb;
- pSOverRc->iStartMbSlice = pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
- pSOverRc->iEndMbSlice = pSOverRc->iStartMbSlice + pSlice->iCountMbNumInSlice - 1;
- pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * pSlice->iCountMbNumInSlice,
- INT_MULTIPLY);
- }
+void GomRCInitForOneSlice(SSlice* pSlice, const int32_t kiBitsPerMb) {
+ SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc;
+ pSOverRc->iStartMbSlice = pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
+ pSOverRc->iEndMbSlice = pSOverRc->iStartMbSlice + pSlice->iCountMbNumInSlice - 1;
+ pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * pSlice->iCountMbNumInSlice,
+ INT_MULTIPLY);
}
void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {
@@ -530,6 +524,8 @@
const int32_t kiSliceNum = pEncCtx->pCurDqLayer->iMaxSliceNum;
pWelsSvcRc->iBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,
pWelsSvcRc->iNumberMbFrame);
+ pWelsSvcRc->bGomRC = (RC_OFF_MODE == pEncCtx->pSvcParam->iRCMode ||
+ RC_BUFFERBASED_MODE == pEncCtx->pSvcParam->iRCMode) ? false : true;
for (int32_t i = 0; i < kiSliceNum; i++) {
SRCSlicing* pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
pSOverRc->iTotalQpSlice = 0;
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -450,7 +450,7 @@
return true;
}
-static inline void WlesMarkMMCORefInfoWithBase(SSlice** ppSliceList,
+static inline void WelsMarkMMCORefInfoWithBase(SSlice** ppSliceList,
SSlice* pBaseSlice,
const int32_t kiCountSliceNum) {
int32_t iSliceIdx = 0;
@@ -463,7 +463,7 @@
}
}
-void WlesMarkMMCORefInfo (sWelsEncCtx* pCtx, SLTRState* pLtr,
+void WelsMarkMMCORefInfo (sWelsEncCtx* pCtx, SLTRState* pLtr,
SSlice** ppSliceList, const int32_t kiCountSliceNum) {
SSlice* pBaseSlice = ppSliceList[0];
SRefPicMarking* pRefPicMark = &pBaseSlice->sSliceHeaderExt.sSliceHeader.sRefMarking;
@@ -488,7 +488,7 @@
}
}
- WlesMarkMMCORefInfoWithBase(ppSliceList, pBaseSlice, kiCountSliceNum);
+ WelsMarkMMCORefInfoWithBase(ppSliceList, pBaseSlice, kiCountSliceNum);
}
void WelsMarkPic (sWelsEncCtx* pCtx) {
@@ -511,7 +511,7 @@
}
}
- WlesMarkMMCORefInfo (pCtx, pLtr, pCtx->pCurDqLayer->ppSliceInLayer, kiCountSliceNum);
+ WelsMarkMMCORefInfo (pCtx, pLtr, pCtx->pCurDqLayer->ppSliceInLayer, kiCountSliceNum);
}
int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest) {
@@ -889,7 +889,7 @@
return (kiFrameNum < (1 << 30)); // TODO: use the original judge first, may be improved
}
-void WlesMarkMMCORefInfoScreen (sWelsEncCtx* pCtx, SLTRState* pLtr,
+void WelsMarkMMCORefInfoScreen (sWelsEncCtx* pCtx, SLTRState* pLtr,
SSlice** ppSliceList, const int32_t kiCountSliceNum) {
SSlice* pBaseSlice = ppSliceList[0];
SRefPicMarking* pRefPicMark = &pBaseSlice->sSliceHeaderExt.sSliceHeader.sRefMarking;
@@ -904,7 +904,7 @@
pRefPicMark->SMmcoRef[pRefPicMark->uiMmcoCount++].iMmcoType = MMCO_LONG;
}
- WlesMarkMMCORefInfoWithBase(ppSliceList, pBaseSlice, kiCountSliceNum);
+ WelsMarkMMCORefInfoWithBase(ppSliceList, pBaseSlice, kiCountSliceNum);
}
void WelsMarkPicScreen (sWelsEncCtx* pCtx) {
@@ -987,7 +987,7 @@
const int32_t iSliceNum = pCtx->pCurDqLayer->iMaxSliceNum;
- WlesMarkMMCORefInfoScreen (pCtx, pLtr, pCtx->pCurDqLayer->ppSliceInLayer, iSliceNum);
+ WelsMarkMMCORefInfoScreen (pCtx, pLtr, pCtx->pCurDqLayer->ppSliceInLayer, iSliceNum);
return;
}
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -1605,10 +1605,11 @@
}
int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, const int32_t kiNalType) {
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
- SBitStringAux* pBs = pCurSlice->pSliceBsa;
- const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceArgument.uiSliceMode
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
+ SBitStringAux* pBs = pCurSlice->pSliceBsa;
+ const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceArgument.uiSliceMode
== SM_SIZELIMITED_SLICE);
if (I_SLICE == pEncCtx->eSliceType) {
pNalHeadExt->bIdrFlag = 1;
@@ -1620,8 +1621,10 @@
WelsSliceHeaderExtInit (pEncCtx, pCurLayer, pCurSlice);
- //init slice RC information
- RCInitOneSliceInformation(pEncCtx, pCurSlice);
+ //RomRC init slice by slice
+ if (pWelsSvcRc->bGomRC) {
+ GomRCInitForOneSlice(pCurSlice, pWelsSvcRc->iBitsPerMb);
+ }
g_pWelsWriteSliceHeader[pCurSlice->bSliceHeaderExtFlag] (pEncCtx, pBs, pCurLayer, pCurSlice,
pEncCtx->pFuncList->pParametersetStrategy);
--- a/codec/encoder/core/src/wels_task_encoder.cpp
+++ b/codec/encoder/core/src/wels_task_encoder.cpp
@@ -119,9 +119,6 @@
iReturn = SetSliceBoundaryInfo(m_pCtx->pCurDqLayer, m_pSlice, m_iSliceIdx);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
- m_pCtx->iEncoderError = SetSliceBoundaryInfo(m_pCtx->pCurDqLayer, m_pSlice, m_iSliceIdx);
- WELS_VERIFY_RETURN_IFNEQ (m_pCtx->iEncoderError, ENC_RETURN_SUCCESS)
-
SetOneSliceBsBufferUnderMultithread (m_pCtx, m_iThreadIdx, m_pSlice);
assert ((void*) (&m_pSliceBs->sBsWrite) == (void*)m_pSlice->pSliceBsa);
--- a/run_NasmCheck.sh
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/bash
-
-echo "test common!"
-nasm=""
-nasm_list=(nasm /usr/bin/nasm /opt/local/bin/nasm)
-for cmd in ${nasm_list[@]}
-do
- ver=`$cmd -v 2>/dev/null | awk '{print $3}'`
- [[ $ver =~ ^2\.1[0-9] ]] && nasm=$cmd && break
-done
-
-echo "ver is $ver"
-echo "nasm is $nasm"
-[ "$nasm" = "" ] && echo "[Error] pls install nasm (2.10+)" 1>&2 && exit 1
-