Remove the pBuffer parameter from the entropy encoder stash functions
The parameter didn't make sense since it only pointed to the pSliceBsa field, which isn't what should be used to stash the cabac context.
This commit is contained in:
parent
9a9f92bcfe
commit
f2c1395ab6
@ -202,8 +202,8 @@ typedef void (*PAfterBuildRefListFunc) (void* pCtx);
|
|||||||
typedef int32_t (*PCavlcParamCalFunc) (int16_t* pCoff, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs,
|
typedef int32_t (*PCavlcParamCalFunc) (int16_t* pCoff, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs,
|
||||||
int32_t iEndIdx);
|
int32_t iEndIdx);
|
||||||
typedef int32_t (*PWelsSpatialWriteMbSyn) (void* pCtx, SSlice* pSlice, SMB* pCurMb);
|
typedef int32_t (*PWelsSpatialWriteMbSyn) (void* pCtx, SSlice* pSlice, SMB* pCurMb);
|
||||||
typedef void (*PStashMBStatus) (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun);
|
typedef void (*PStashMBStatus) (SDynamicSlicingStack* pDss, SSlice* pSlice, int32_t iMbSkipRun);
|
||||||
typedef int32_t (*PStashPopMBStatus) (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice);
|
typedef int32_t (*PStashPopMBStatus) (SDynamicSlicingStack* pDss, SSlice* pSlice);
|
||||||
|
|
||||||
struct TagWelsFuncPointerList {
|
struct TagWelsFuncPointerList {
|
||||||
SExpandPicFunc sExpandPicFunc;
|
SExpandPicFunc sExpandPicFunc;
|
||||||
|
@ -199,29 +199,29 @@ int32_t WriteBlockResidualCavlc (SWelsFuncPtrList* pFuncList, int16_t* pCoffLev
|
|||||||
return ENC_RETURN_SUCCESS;
|
return ENC_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StashMBStatusCavlc (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun) {
|
void StashMBStatusCavlc (SDynamicSlicingStack* pDss, SSlice* pSlice, int32_t iMbSkipRun) {
|
||||||
SBitStringAux* pBs = (SBitStringAux*)pBuffer;
|
SBitStringAux* pBs = pSlice->pSliceBsa;
|
||||||
pDss->pBsStackBufPtr = pBs->pBufPtr;
|
pDss->pBsStackBufPtr = pBs->pBufPtr;
|
||||||
pDss->uiBsStackCurBits = pBs->uiCurBits;
|
pDss->uiBsStackCurBits = pBs->uiCurBits;
|
||||||
pDss->iBsStackLeftBits = pBs->iLeftBits;
|
pDss->iBsStackLeftBits = pBs->iLeftBits;
|
||||||
pDss->uiLastMbQp = pSlice->uiLastMbQp;
|
pDss->uiLastMbQp = pSlice->uiLastMbQp;
|
||||||
pDss->iMbSkipRunStack = iMbSkipRun;
|
pDss->iMbSkipRunStack = iMbSkipRun;
|
||||||
}
|
}
|
||||||
int32_t StashPopMBStatusCavlc (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice) {
|
int32_t StashPopMBStatusCavlc (SDynamicSlicingStack* pDss, SSlice* pSlice) {
|
||||||
SBitStringAux* pBs = (SBitStringAux*)pBuffer;
|
SBitStringAux* pBs = pSlice->pSliceBsa;
|
||||||
pBs->pBufPtr = pDss->pBsStackBufPtr;
|
pBs->pBufPtr = pDss->pBsStackBufPtr;
|
||||||
pBs->uiCurBits = pDss->uiBsStackCurBits;
|
pBs->uiCurBits = pDss->uiBsStackCurBits;
|
||||||
pBs->iLeftBits = pDss->iBsStackLeftBits;
|
pBs->iLeftBits = pDss->iBsStackLeftBits;
|
||||||
pSlice->uiLastMbQp = pDss->uiLastMbQp;
|
pSlice->uiLastMbQp = pDss->uiLastMbQp;
|
||||||
return pDss->iMbSkipRunStack;
|
return pDss->iMbSkipRunStack;
|
||||||
}
|
}
|
||||||
void StashMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun) {
|
void StashMBStatusCabac (SDynamicSlicingStack* pDss, SSlice* pSlice, int32_t iMbSkipRun) {
|
||||||
SCabacCtx* pCtx = &pSlice->sCabacCtx;
|
SCabacCtx* pCtx = &pSlice->sCabacCtx;
|
||||||
memcpy (&pDss->sStoredCabac, pCtx, sizeof (SCabacCtx));
|
memcpy (&pDss->sStoredCabac, pCtx, sizeof (SCabacCtx));
|
||||||
pDss->uiLastMbQp = pSlice->uiLastMbQp;
|
pDss->uiLastMbQp = pSlice->uiLastMbQp;
|
||||||
pDss->iMbSkipRunStack = iMbSkipRun;
|
pDss->iMbSkipRunStack = iMbSkipRun;
|
||||||
}
|
}
|
||||||
int32_t StashPopMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice) {
|
int32_t StashPopMBStatusCabac (SDynamicSlicingStack* pDss, SSlice* pSlice) {
|
||||||
SCabacCtx* pCtx = &pSlice->sCabacCtx;
|
SCabacCtx* pCtx = &pSlice->sCabacCtx;
|
||||||
memcpy (pCtx, &pDss->sStoredCabac, sizeof (SCabacCtx));
|
memcpy (pCtx, &pDss->sStoredCabac, sizeof (SCabacCtx));
|
||||||
pSlice->uiLastMbQp = pDss->uiLastMbQp;
|
pSlice->uiLastMbQp = pDss->uiLastMbQp;
|
||||||
|
@ -493,13 +493,12 @@ int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encodin
|
|||||||
|
|
||||||
SWelsMD sMd;
|
SWelsMD sMd;
|
||||||
int32_t iEncReturn = ENC_RETURN_SUCCESS;
|
int32_t iEncReturn = ENC_RETURN_SUCCESS;
|
||||||
SBitStringAux* pBs = pSlice->pSliceBsa;
|
|
||||||
SDynamicSlicingStack sDss;
|
SDynamicSlicingStack sDss;
|
||||||
if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
|
if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
|
||||||
WelsInitSliceCabac (pEncCtx, pSlice);
|
WelsInitSliceCabac (pEncCtx, pSlice);
|
||||||
}
|
}
|
||||||
for (; ;) {
|
for (; ;) {
|
||||||
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, 0);
|
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, 0);
|
||||||
iCurMbIdx = iNextMbIdx;
|
iCurMbIdx = iNextMbIdx;
|
||||||
pCurMb = &pMbList[ iCurMbIdx ];
|
pCurMb = &pMbList[ iCurMbIdx ];
|
||||||
|
|
||||||
@ -514,7 +513,7 @@ TRY_REENCODING:
|
|||||||
|
|
||||||
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
||||||
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
||||||
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
||||||
goto TRY_REENCODING;
|
goto TRY_REENCODING;
|
||||||
}
|
}
|
||||||
@ -567,7 +566,7 @@ int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd +
|
|||||||
iCurMbIdx = iNextMbIdx;
|
iCurMbIdx = iNextMbIdx;
|
||||||
pCurMb = &pMbList[ iCurMbIdx ];
|
pCurMb = &pMbList[ iCurMbIdx ];
|
||||||
|
|
||||||
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, 0);
|
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, 0);
|
||||||
pEncCtx->pFuncList->pfRc.pfWelsRcMbInit (pEncCtx, pCurMb, pSlice);
|
pEncCtx->pFuncList->pfRc.pfWelsRcMbInit (pEncCtx, pCurMb, pSlice);
|
||||||
// if already reaches the largest number of slices, set QPs to the upper bound
|
// if already reaches the largest number of slices, set QPs to the upper bound
|
||||||
if (pSlice->bDynamicSlicingSliceSizeCtrlFlag) {
|
if (pSlice->bDynamicSlicingSliceSizeCtrlFlag) {
|
||||||
@ -583,7 +582,7 @@ TRY_REENCODING:
|
|||||||
|
|
||||||
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
||||||
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
||||||
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
||||||
goto TRY_REENCODING;
|
goto TRY_REENCODING;
|
||||||
}
|
}
|
||||||
@ -593,7 +592,7 @@ TRY_REENCODING:
|
|||||||
sDss.iCurrentPos = BsGetBitsPos (pBs);
|
sDss.iCurrentPos = BsGetBitsPos (pBs);
|
||||||
|
|
||||||
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) { //islice
|
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) { //islice
|
||||||
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
||||||
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
||||||
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
||||||
@ -954,7 +953,7 @@ int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd,
|
|||||||
}
|
}
|
||||||
pSlice->iMbSkipRun = 0;
|
pSlice->iMbSkipRun = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, pSlice->iMbSkipRun);
|
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, pSlice->iMbSkipRun);
|
||||||
//point to current pMb
|
//point to current pMb
|
||||||
iCurMbIdx = iNextMbIdx;
|
iCurMbIdx = iNextMbIdx;
|
||||||
pCurMb = &pMbList[ iCurMbIdx ];
|
pCurMb = &pMbList[ iCurMbIdx ];
|
||||||
@ -985,7 +984,7 @@ TRY_REENCODING:
|
|||||||
|
|
||||||
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
||||||
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
||||||
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
||||||
goto TRY_REENCODING;
|
goto TRY_REENCODING;
|
||||||
}
|
}
|
||||||
@ -1050,7 +1049,7 @@ int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice,
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
//DYNAMIC_SLICING_ONE_THREAD - MultiD
|
//DYNAMIC_SLICING_ONE_THREAD - MultiD
|
||||||
//stack pBs pointer
|
//stack pBs pointer
|
||||||
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, pSlice->iMbSkipRun);
|
pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, pSlice->iMbSkipRun);
|
||||||
|
|
||||||
//point to current pMb
|
//point to current pMb
|
||||||
iCurMbIdx = iNextMbIdx;
|
iCurMbIdx = iNextMbIdx;
|
||||||
@ -1091,7 +1090,7 @@ TRY_REENCODING:
|
|||||||
|
|
||||||
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
|
||||||
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
|
||||||
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
|
||||||
goto TRY_REENCODING;
|
goto TRY_REENCODING;
|
||||||
}
|
}
|
||||||
@ -1102,7 +1101,7 @@ TRY_REENCODING:
|
|||||||
//DYNAMIC_SLICING_ONE_THREAD - MultiD
|
//DYNAMIC_SLICING_ONE_THREAD - MultiD
|
||||||
sDss.iCurrentPos = BsGetBitsPos (pBs);
|
sDss.iCurrentPos = BsGetBitsPos (pBs);
|
||||||
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) {
|
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) {
|
||||||
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
|
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
||||||
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
||||||
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
||||||
|
Loading…
Reference in New Issue
Block a user