ref: 338a448946e3af26732e7c08ae2b1d04df2a455a
parent: d04c7b93473afad575104ab8130a3fd16c236858
author: huili2 <huili2@cisco.com>
date: Mon Jul 6 09:46:32 EDT 2015
modify sub_mb_type to be faster, and fix a function nam typo
--- a/codec/encoder/core/inc/svc_enc_macroblock.h
+++ b/codec/encoder/core/inc/svc_enc_macroblock.h
@@ -50,7 +50,7 @@
/*************************mb_layer() syntax and generated********************************/
/*mb_layer():*/
Mb_Type uiMbType; // including MB detailed partition type, number and type of reference list
-Mb_Type uiSubMbType[4]; // sub MB types
+uint8_t uiSubMbType[4]; // sub MB types
int32_t iMbXY; // offset position of MB top left point based
int16_t iMbX; // position of MB in horizontal axis [0..32767]
int16_t iMbY; // position of MB in vertical axis [0..32767]
--- a/codec/encoder/core/inc/wels_common_basis.h
+++ b/codec/encoder/core/inc/wels_common_basis.h
@@ -55,7 +55,7 @@
iMvY = _v0.iMvY - _v1.iMvY;
return (*this);
};
- SMVUnitXY& sAssginMv (const SMVUnitXY& _v0) {
+ SMVUnitXY& sAssignMv (const SMVUnitXY& _v0) {
iMvX = _v0.iMvX;
iMvY = _v0.iMvY;
return (*this);
--- a/codec/encoder/core/src/svc_base_layer_md.cpp
+++ b/codec/encoder/core/src/svc_base_layer_md.cpp
@@ -1247,7 +1247,7 @@
if (iCost < iBestCost) {
int32_t iCostPart;
pCurMb->uiMbType = MB_TYPE_8x8;
- pCurMb->uiSubMbType[0] = pCurMb->uiSubMbType[1] = pCurMb->uiSubMbType[2] = pCurMb->uiSubMbType[3] = SUB_MB_TYPE_8x8;
+ memset (pCurMb->uiSubMbType, SUB_MB_TYPE_8x8, 4);
// WelsLog( pEncCtx, WELS_LOG_INFO, "WelsMdP16x8, p_ref[0]= 0x%p", pMbCache->SPicData.pRefMb[0]);
iCostPart = WelsMdP16x8 (pEncCtx->pFuncList, pCurDqLayer, pWelsMd, pSlice);
@@ -1309,7 +1309,7 @@
if (iCostP8x8 < iBestCost) {
iBestCost = iCostP8x8;
pCurMb->uiMbType = MB_TYPE_8x8;
- pCurMb->uiSubMbType[0] = pCurMb->uiSubMbType[1] = pCurMb->uiSubMbType[2] = pCurMb->uiSubMbType[3] = SUB_MB_TYPE_8x8;
+ memset (pCurMb->uiSubMbType, SUB_MB_TYPE_8x8, 4);
}
break;
@@ -1318,7 +1318,7 @@
if (iCostP8x8 < iBestCost) {
iBestCost = iCostP8x8;
pCurMb->uiMbType = MB_TYPE_8x8;
- pCurMb->uiSubMbType[0] = pCurMb->uiSubMbType[1] = pCurMb->uiSubMbType[2] = pCurMb->uiSubMbType[3] = SUB_MB_TYPE_8x8;
+ memset (pCurMb->uiSubMbType, SUB_MB_TYPE_8x8, 4);
iCostP16x8 = WelsMdP16x8 (pEncCtx->pFuncList, pCurDqLayer, pWelsMd, pSlice);
if (iCostP16x8 <= iBestCost) {
--- a/codec/encoder/core/src/svc_mode_decision.cpp
+++ b/codec/encoder/core/src/svc_mode_decision.cpp
@@ -622,7 +622,7 @@
if (iCostP8x8 < iBestCost) {
iBestCost = iCostP8x8;
pCurMb->uiMbType = MB_TYPE_8x8;
- pCurMb->uiSubMbType[0] = pCurMb->uiSubMbType[1] = pCurMb->uiSubMbType[2] = pCurMb->uiSubMbType[3] = SUB_MB_TYPE_8x8;
+ memset (pCurMb->uiSubMbType, SUB_MB_TYPE_8x8, 4);
#if 0 //Disable for sub8x8 modes for now
iBestCost = 0;
//reset neighbor info for sub8x8
--- a/codec/encoder/core/src/svc_set_mb_syn_cabac.cpp
+++ b/codec/encoder/core/src/svc_set_mb_syn_cabac.cpp
@@ -347,14 +347,14 @@
sMvdLeft.iMvX = sMvdLeft.iMvY = sMvdTop.iMvX = sMvdTop.iMvY = 0;
sMvd.sDeltaMv (sCurMv, sPredMv);
if ((i4x4ScanIdx < 4) && (uiNeighborAvail & TOP_MB_POS)) { //top row blocks
- sMvdTop.sAssginMv ((pCurMb - iMbWidth)->sMvd[i4x4ScanIdx + 12]);
+ sMvdTop.sAssignMv ((pCurMb - iMbWidth)->sMvd[i4x4ScanIdx + 12]);
} else if (i4x4ScanIdx >= 4) {
- sMvdTop.sAssginMv (pCurMb->sMvd[i4x4ScanIdx - 4]);
+ sMvdTop.sAssignMv (pCurMb->sMvd[i4x4ScanIdx - 4]);
}
if ((! (i4x4ScanIdx & 0x03)) && (uiNeighborAvail & LEFT_MB_POS)) { //left column blocks
- sMvdLeft.sAssginMv ((pCurMb - 1)->sMvd[i4x4ScanIdx + 3]);
+ sMvdLeft.sAssignMv ((pCurMb - 1)->sMvd[i4x4ScanIdx + 3]);
} else if (i4x4ScanIdx & 0x03) {
- sMvdLeft.sAssginMv (pCurMb->sMvd[i4x4ScanIdx - 1]);
+ sMvdLeft.sAssignMv (pCurMb->sMvd[i4x4ScanIdx - 1]);
}
iAbsMvd0 = WELS_ABS (sMvdLeft.iMvX) + WELS_ABS (sMvdTop.iMvX);
@@ -390,16 +390,16 @@
i4x4ScanIdx = g_kuiMbCountScan4Idx[i8x8Idx << 2];
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, kiMbWidth, pCurMb->sMv[i4x4ScanIdx], pMbCache->sMbMvp[i4x4ScanIdx],
i4x4ScanIdx);
- pCurMb->sMvd[ i4x4ScanIdx].sAssginMv (sMvd);
- pCurMb->sMvd[1 + i4x4ScanIdx].sAssginMv (sMvd);
- pCurMb->sMvd[4 + i4x4ScanIdx].sAssginMv (sMvd);
- pCurMb->sMvd[5 + i4x4ScanIdx].sAssginMv (sMvd);
+ pCurMb->sMvd[ i4x4ScanIdx].sAssignMv (sMvd);
+ pCurMb->sMvd[1 + i4x4ScanIdx].sAssignMv (sMvd);
+ pCurMb->sMvd[4 + i4x4ScanIdx].sAssignMv (sMvd);
+ pCurMb->sMvd[5 + i4x4ScanIdx].sAssignMv (sMvd);
} else if (SUB_MB_TYPE_4x4 == uiSubMbType) {
for (int32_t i4x4Idx = 0; i4x4Idx < 4; ++i4x4Idx) {
i4x4ScanIdx = g_kuiMbCountScan4Idx[ (i8x8Idx << 2) + i4x4Idx];
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, kiMbWidth, pCurMb->sMv[i4x4ScanIdx], pMbCache->sMbMvp[i4x4ScanIdx],
i4x4ScanIdx);
- pCurMb->sMvd[i4x4ScanIdx].sAssginMv (sMvd);
+ pCurMb->sMvd[i4x4ScanIdx].sAssignMv (sMvd);
}
} else if (SUB_MB_TYPE_8x4 == uiSubMbType) {
for (int32_t i8x4Idx = 0; i8x4Idx < 2; ++i8x4Idx) {
@@ -406,8 +406,8 @@
i4x4ScanIdx = g_kuiMbCountScan4Idx[ (i8x8Idx << 2) + (i8x4Idx << 1)];
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, kiMbWidth, pCurMb->sMv[i4x4ScanIdx], pMbCache->sMbMvp[i4x4ScanIdx],
i4x4ScanIdx);
- pCurMb->sMvd[ i4x4ScanIdx].sAssginMv (sMvd);
- pCurMb->sMvd[1 + i4x4ScanIdx].sAssginMv (sMvd);
+ pCurMb->sMvd[ i4x4ScanIdx].sAssignMv (sMvd);
+ pCurMb->sMvd[1 + i4x4ScanIdx].sAssignMv (sMvd);
}
} else if (SUB_MB_TYPE_4x8 == uiSubMbType) {
for (int32_t i4x8Idx = 0; i4x8Idx < 2; ++i4x8Idx) {
@@ -414,8 +414,8 @@
i4x4ScanIdx = g_kuiMbCountScan4Idx[ (i8x8Idx << 2) + i4x8Idx];
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, kiMbWidth, pCurMb->sMv[i4x4ScanIdx], pMbCache->sMbMvp[i4x4ScanIdx],
i4x4ScanIdx);
- pCurMb->sMvd[ i4x4ScanIdx].sAssginMv (sMvd);
- pCurMb->sMvd[4 + i4x4ScanIdx].sAssginMv (sMvd);
+ pCurMb->sMvd[ i4x4ScanIdx].sAssignMv (sMvd);
+ pCurMb->sMvd[4 + i4x4ScanIdx].sAssignMv (sMvd);
}
}
}
@@ -663,7 +663,7 @@
WelsCabacMbIntraChromaPredMode (pCabacCtx, pCurMb, pMbCache, iMbWidth);
sMvd.iMvX = sMvd.iMvY = 0;
for (i = 0; i < 16; ++i) {
- pCurMb->sMvd[i].sAssginMv (sMvd);
+ pCurMb->sMvd[i].sAssignMv (sMvd);
}
} else if (uiMbType == MB_TYPE_16x16) {
@@ -674,7 +674,7 @@
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
for (i = 0; i < 16; ++i) {
- pCurMb->sMvd[i].sAssginMv (sMvd);
+ pCurMb->sMvd[i].sAssignMv (sMvd);
}
} else if (uiMbType == MB_TYPE_16x8) {
@@ -684,11 +684,11 @@
}
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth , pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
for (i = 0; i < 8; ++i) {
- pCurMb->sMvd[i].sAssginMv (sMvd);
+ pCurMb->sMvd[i].sAssignMv (sMvd);
}
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[8], pMbCache->sMbMvp[1], 8);
for (i = 8; i < 16; ++i) {
- pCurMb->sMvd[i].sAssginMv (sMvd);
+ pCurMb->sMvd[i].sAssignMv (sMvd);
}
} else if (uiMbType == MB_TYPE_8x16) {
if (uiNumRefIdxL0Active > 0) {
@@ -697,13 +697,13 @@
}
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
for (i = 0; i < 16; i += 4) {
- pCurMb->sMvd[i ].sAssginMv (sMvd);
- pCurMb->sMvd[i + 1].sAssginMv (sMvd);
+ pCurMb->sMvd[i ].sAssignMv (sMvd);
+ pCurMb->sMvd[i + 1].sAssignMv (sMvd);
}
sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[2], pMbCache->sMbMvp[1], 2);
for (i = 0; i < 16; i += 4) {
- pCurMb->sMvd[i + 2].sAssginMv (sMvd);
- pCurMb->sMvd[i + 3].sAssginMv (sMvd);
+ pCurMb->sMvd[i + 2].sAssignMv (sMvd);
+ pCurMb->sMvd[i + 3].sAssignMv (sMvd);
}
} else if ((uiMbType == MB_TYPE_8x8) || (uiMbType == MB_TYPE_8x8_REF0)) {
//write sub_mb_type