ref: b77b68ffa0948490134d93913b3b7bad5b67d976
parent: 54a194ce664c22f2d492b838439acd61ef6c18a7
author: huade <huashi@cisco.com>
date: Thu Nov 19 12:18:03 EST 2015
change input parameters for UpdateMbNeighbourInfoForNextSlice etc.
--- a/codec/encoder/core/inc/svc_enc_slice_segment.h
+++ b/codec/encoder/core/inc/svc_enc_slice_segment.h
@@ -142,12 +142,12 @@
/*!
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
*
- * \param pSliceCtx SSlice context
- * \param kiMbXY MB xy index
+ * \param pCurDq current layer info
+ * \param kiMbXY MB xy index
*
* \return uiSliceIdc - successful; (uint8_t)(-1) - failed;
*/
-uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
+uint16_t WelsMbToSliceIdc (SDqLayer* pCurDq, const int32_t kiMbXY);
/*!
* \brief Get first mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
@@ -162,12 +162,12 @@
/*!
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
*
- * \param pSliceCtx SSlice context
- * \param kiMbXY MB xy index
+ * \param pCurDq current layer info
+ * \param kiMbXY MB xy index
*
* \return next_mb - successful; -1 - failed;
*/
-int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
+int32_t WelsGetNextMbOfSlice (SDqLayer* pCurDq, const int32_t kiMbXY);
/*!
* \brief Get previous mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
--- a/codec/encoder/core/inc/svc_encode_slice.h
+++ b/codec/encoder/core/inc/svc_encode_slice.h
@@ -87,7 +87,7 @@
void WelsInitSliceEncodingFuncs (uint32_t uiCpuFlag);
-void UpdateMbNeighbourInfoForNextSlice (SSliceCtx* pSliceCtx,
+void UpdateMbNeighbourInfoForNextSlice (SDqLayer* pCurDq,
SMB* pMbList,
const int32_t kiNextSliceFirstMbIdx,
const int32_t kiLastMbIdxInPartition);
--- a/codec/encoder/core/src/deblocking.cpp
+++ b/codec/encoder/core/src/deblocking.cpp
@@ -691,7 +691,6 @@
}
void DeblockingFilterSliceAvcbase (SDqLayer* pCurDq, SWelsFuncPtrList* pFunc, const int32_t kiSliceIdx) {
- SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
SMB* pMbList = pCurDq->sMbDataP;
SSliceHeaderExt* sSliceHeaderExt = &pCurDq->sLayerInfo.pSliceInLayer[kiSliceIdx].sSliceHeaderExt;
SMB* pCurrentMbBlock;
@@ -731,7 +730,7 @@
DeblockingMbAvcbase (pFunc, pCurrentMbBlock, &pFilter);
++iNumMbFiltered;
- iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx);
+ iNextMbIdx = WelsGetNextMbOfSlice (pCurDq, iCurMbIdx);
//whether all of MB in current slice filtered or not
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbFiltered >= kiTotalNumMb) {
break;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -764,7 +764,6 @@
int32_t iMbHeight = pLayer->iMbHeight;
int32_t iIdx;
int32_t iMbNum = iMbWidth * iMbHeight;
- SSliceCtx* pSliceCtx = &pLayer->sSliceEncCtx;
uint32_t uiNeighborAvail;
const int32_t kiOffset = (kiDlayerId & 0x01) * kiMaxMbNum;
SMVUnitXY (*pLayerMvUnitBlock4x4)[MB_BLOCK4x4_NUM] = (SMVUnitXY (*)[MB_BLOCK4x4_NUM]) (
@@ -784,18 +783,18 @@
pList[iIdx].iMbY = pEnc->pStrideTab->pMbIndexY[kiDlayerId][iIdx];
pList[iIdx].iMbXY = iIdx;
- uiSliceIdc = WelsMbToSliceIdc (pSliceCtx, iIdx);
+ uiSliceIdc = WelsMbToSliceIdc (pLayer, iIdx);
iLeftXY = iIdx - 1;
iTopXY = iIdx - iMbWidth;
iLeftTopXY = iTopXY - 1;
iRightTopXY = iTopXY + 1;
- bLeft = (pList[iIdx].iMbX > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftXY));
- bTop = (pList[iIdx].iMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iTopXY));
+ bLeft = (pList[iIdx].iMbX > 0) && (uiSliceIdc == WelsMbToSliceIdc (pLayer, iLeftXY));
+ bTop = (pList[iIdx].iMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pLayer, iTopXY));
bLeftTop = (pList[iIdx].iMbX > 0) && (pList[iIdx].iMbY > 0) && (uiSliceIdc ==
- WelsMbToSliceIdc (pSliceCtx, iLeftTopXY));
+ WelsMbToSliceIdc (pLayer, iLeftTopXY));
bRightTop = (pList[iIdx].iMbX < (iMbWidth - 1)) && (pList[iIdx].iMbY > 0) && (uiSliceIdc ==
- WelsMbToSliceIdc (pSliceCtx, iRightTopXY));
+ WelsMbToSliceIdc (pLayer, iRightTopXY));
uiNeighborAvail = 0;
if (bLeft) {
@@ -2682,7 +2681,8 @@
return fDlp->uiCodingIdx2TemporalId[kiCodingIdx];
}
-void DynslcUpdateMbNeighbourInfoListForAllSlices (SSliceCtx* pSliceCtx, SMB* pMbList) {
+void DynslcUpdateMbNeighbourInfoListForAllSlices (SDqLayer* pCurDq, SMB* pMbList) {
+ SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
const int32_t kiMbWidth = pSliceCtx->iMbWidth;
const int32_t kiEndMbInSlice = pSliceCtx->iMbNumInFrame - 1;
int32_t iIdx = 0;
@@ -2700,7 +2700,7 @@
uint16_t uiSliceIdc;
int32_t iLeftXY, iTopXY, iLeftTopXY, iRightTopXY;
- uiSliceIdc = WelsMbToSliceIdc (pSliceCtx, kiMbXY);
+ uiSliceIdc = WelsMbToSliceIdc (pCurDq, kiMbXY);
pMb->uiSliceIdc = uiSliceIdc;
iLeftXY = kiMbXY - 1;
iTopXY = kiMbXY - kiMbWidth;
@@ -2707,10 +2707,10 @@
iLeftTopXY = iTopXY - 1;
iRightTopXY = iTopXY + 1;
- bLeft = (kiMbX > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftXY));
- bTop = (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iTopXY));
- bLeftTop = (kiMbX > 0) && (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftTopXY));
- bRightTop = (kiMbX < (kiMbWidth - 1)) && (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iRightTopXY));
+ bLeft = (kiMbX > 0) && (uiSliceIdc == WelsMbToSliceIdc (pCurDq, iLeftXY));
+ bTop = (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pCurDq, iTopXY));
+ bLeftTop = (kiMbX > 0) && (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pCurDq, iLeftTopXY));
+ bRightTop = (kiMbX < (kiMbWidth - 1)) && (kiMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pCurDq, iRightTopXY));
if (bLeft) {
uiNeighborAvailFlag |= LEFT_MB_POS;
@@ -2744,10 +2744,8 @@
void WelsInitCurrentQBLayerMltslc (sWelsEncCtx* pCtx) {
//pData init
SDqLayer* pCurDq = pCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = &(pCurDq->sSliceEncCtx);
-
//mb_neighbor
- DynslcUpdateMbNeighbourInfoListForAllSlices (pSliceCtx, pCurDq->sMbDataP);
+ DynslcUpdateMbNeighbourInfoListForAllSlices (pCurDq, pCurDq->sMbDataP);
}
void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) {
--- a/codec/encoder/core/src/svc_enc_slice_segment.cpp
+++ b/codec/encoder/core/src/svc_enc_slice_segment.cpp
@@ -69,20 +69,22 @@
*/
int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq,const SSliceArgument* kpSliceArgument) {
SSliceCtx* pSliceSeg = &pCurDq->sSliceEncCtx;
+ int32_t iSliceIdx = 0;
if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode)
return 1;
if ((SM_RASTER_SLICE == pSliceSeg->uiSliceMode) && (0 == kpSliceArgument->uiSliceMbNum[0])) {
const int32_t kiMbWidth = pSliceSeg->iMbWidth;
- int32_t iSliceNum = pSliceSeg->iSliceNumInFrame, uiSliceIdx = 0;
+ int32_t iSliceNum = pSliceSeg->iSliceNumInFrame;
- while (uiSliceIdx < iSliceNum) {
- const int32_t kiFirstMb = uiSliceIdx * kiMbWidth;
- pSliceSeg->pCountMbNumInSlice[uiSliceIdx] = kiMbWidth;
- pSliceSeg->pFirstMbInSlice[uiSliceIdx] = kiFirstMb;
- WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap + kiFirstMb, uiSliceIdx,
+ iSliceIdx = 0;
+ while (iSliceIdx < iSliceNum) {
+ const int32_t kiFirstMb = iSliceIdx * kiMbWidth;
+ pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiMbWidth;
+ pSliceSeg->pFirstMbInSlice[iSliceIdx] = kiFirstMb;
+ WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap + kiFirstMb, iSliceIdx,
kiMbWidth, sizeof(uint16_t));
- ++ uiSliceIdx;
+ ++ iSliceIdx;
}
return 0;
@@ -91,9 +93,9 @@
const int32_t* kpSlicesAssignList = (int32_t*) & (kpSliceArgument->uiSliceMbNum[0]);
const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
const int32_t kiCountSliceNumInFrame = pSliceSeg->iSliceNumInFrame;
- uint16_t iSliceIdx = 0;
int32_t iMbIdx = 0;
+ iSliceIdx = 0;
do {
const int32_t kiCurRunLength = kpSlicesAssignList[iSliceIdx];
int32_t iRunIdx = 0;
@@ -111,9 +113,10 @@
++ iSliceIdx;
} while (iSliceIdx < kiCountSliceNumInFrame && iMbIdx < kiCountNumMbInFrame);
} else if (SM_SIZELIMITED_SLICE == pSliceSeg->uiSliceMode) {
- int32_t iSliceIdx = 0;
const int32_t kiMaxSliceNum = pSliceSeg->iMaxSliceNumConstraint;
const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
+
+ iSliceIdx = 0;
do {
pSliceSeg->pFirstMbInSlice[iSliceIdx] = 0;
pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiCountNumMbInFrame;
@@ -562,12 +565,16 @@
/*!
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
*
- * \param pSliceCtx SSlice context
- * \param kiMbXY MB xy index
+ * \param pCurDq current layer info
+ * \param kiMbXY MB xy index
*
* \return uiSliceIdc - successful; -1 - failed;
*/
-uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
+uint16_t WelsMbToSliceIdc (SDqLayer* pCurDq, const int32_t kiMbXY) {
+ if (NULL == pCurDq)
+ return (uint16_t) (-1);
+
+ SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
if (NULL != pSliceCtx && kiMbXY < pSliceCtx->iMbNumInFrame && kiMbXY >= 0)
return pSliceCtx->pOverallMbMap[ kiMbXY ];
return (uint16_t) (-1);
@@ -588,14 +595,14 @@
/*!
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
*
- * \param pSliceCtx SSlice context
- * \param kiMbXY MB xy index
+ * \param pCurDq current layer info
+ * \param kiMbXY MB xy index
*
* \return next_mb - successful; -1 - failed;
*/
-int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
- if (NULL != pSliceCtx) {
- SSliceCtx* pSliceSeg = pSliceCtx;
+int32_t WelsGetNextMbOfSlice (SDqLayer* pCurDq, const int32_t kiMbXY) {
+ if (NULL != pCurDq) {
+ SSliceCtx* pSliceSeg = &pCurDq->sSliceEncCtx;
if (NULL == pSliceSeg || kiMbXY < 0 || kiMbXY >= pSliceSeg->iMbNumInFrame)
return -1;
if (SM_SINGLE_SLICE == pSliceSeg->uiSliceMode) {
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -483,8 +483,7 @@
//second. lower than highest Dependency Layer, and for every Dependency Layer with one quality layer(single layer)
int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encoding
SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = &pCurLayer->sSliceEncCtx;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
SSliceHeaderExt* pSliceHdExt = &pSlice->sSliceHeaderExt;
SMB* pMbList = pCurLayer->sMbDataP;
SMB* pCurMb = NULL;
@@ -533,7 +532,7 @@
pEncCtx->pFuncList->pfRc.pfWelsRcMbInfoUpdate (pEncCtx, pCurMb, sMd.iCostLuma, pSlice);
++iNumMbCoded;
- iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx);
+ iNextMbIdx = WelsGetNextMbOfSlice (pCurLayer, iCurMbIdx);
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
break;
}
@@ -615,7 +614,7 @@
++iNumMbCoded;
- iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx);
+ iNextMbIdx = WelsGetNextMbOfSlice (pCurLayer, iCurMbIdx);
//whether all of MB in current pSlice encoded or not
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
pSliceCtx->pCountMbNumInSlice[kiSliceIdx] = iCurMbIdx - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];
@@ -759,10 +758,11 @@
}
//pFunc: UpdateMbNeighbourInfoForNextSlice()
-void UpdateMbNeighbourInfoForNextSlice (SSliceCtx* pSliceCtx,
+void UpdateMbNeighbourInfoForNextSlice (SDqLayer* pCurDq,
SMB* pMbList,
const int32_t kiFirstMbIdxOfNextSlice,
const int32_t kiLastMbIdxInPartition) {
+ SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
const int32_t kiMbWidth = pSliceCtx->iMbWidth;
int32_t iIdx = kiFirstMbIdxOfNextSlice;
int32_t iNextSliceFirstMbIdxRowStart = ((kiFirstMbIdxOfNextSlice % kiMbWidth) ? 1 : 0);
@@ -781,7 +781,7 @@
bool bLeftTop;
bool bRightTop;
int32_t iLeftXY, iTopXY, iLeftTopXY, iRightTopXY;
- const uint16_t kuiSliceIdc = WelsMbToSliceIdc (pSliceCtx, kiMbXY);
+ const uint16_t kuiSliceIdc = WelsMbToSliceIdc (pCurDq, kiMbXY);
pMb->uiSliceIdc = kuiSliceIdc;
iLeftXY = kiMbXY - 1;
@@ -789,10 +789,10 @@
iLeftTopXY = iTopXY - 1;
iRightTopXY = iTopXY + 1;
- bLeft = (kiMbX > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftXY));
- bTop = (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iTopXY));
- bLeftTop = (kiMbX > 0) && (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftTopXY));
- bRightTop = (kiMbX < (kiMbWidth - 1)) && (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iRightTopXY));
+ bLeft = (kiMbX > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pCurDq, iLeftXY));
+ bTop = (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pCurDq, iTopXY));
+ bLeftTop = (kiMbX > 0) && (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pCurDq, iLeftTopXY));
+ bRightTop = (kiMbX < (kiMbWidth - 1)) && (kiMbY > 0) && (kuiSliceIdc == WelsMbToSliceIdc (pCurDq, iRightTopXY));
if (bLeft) {
uiNeighborAvailFlag |= LEFT_MB_POS;
@@ -848,7 +848,7 @@
(kiLastMbIdxInPartition - iFirstMbIdxOfNextSlice + 1), sizeof (uint16_t));
//DYNAMIC_SLICING_ONE_THREAD: update pMbList slice_neighbor_info
- UpdateMbNeighbourInfoForNextSlice (pSliceCtx, pMbList, iFirstMbIdxOfNextSlice, kiLastMbIdxInPartition);
+ UpdateMbNeighbourInfoForNextSlice (pCurLayer, pMbList, iFirstMbIdxOfNextSlice, kiLastMbIdxInPartition);
}
bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
@@ -942,7 +942,6 @@
SWelsMD* pMd = (SWelsMD*)pWelsMd;
SBitStringAux* pBs = pSlice->pSliceBsa;
SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = &pCurLayer->sSliceEncCtx;
SMbCache* pMbCache = &pSlice->sMbCacheInfo;
SMB* pMbList = pCurLayer->sMbDataP;
SMB* pCurMb = NULL;
@@ -1013,7 +1012,7 @@
/*judge if all pMb in cur pSlice has been encoded*/
++ iNumMbCoded;
- iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx);
+ iNextMbIdx = WelsGetNextMbOfSlice (pCurLayer, iCurMbIdx);
//whether all of MB in current pSlice encoded or not
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
break;
@@ -1130,7 +1129,7 @@
/*judge if all pMb in cur pSlice has been encoded*/
++ iNumMbCoded;
- iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx);
+ iNextMbIdx = WelsGetNextMbOfSlice (pCurLayer, iCurMbIdx);
//whether all of MB in current pSlice encoded or not
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] =