remove BASE_MB related code
This commit is contained in:
parent
8492aac917
commit
b1f596fd69
@ -186,7 +186,6 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable,
|
||||
int32_t iResidualProperty,
|
||||
/*short *tCoeffLevel,*/
|
||||
int16_t* pTCoeff,
|
||||
int32_t iMbMode,
|
||||
uint8_t uiQp,
|
||||
PWelsDecoderContext pCtx);
|
||||
|
||||
|
@ -95,11 +95,4 @@
|
||||
#define MAX_ACCESS_UNIT_CAPACITY 1048576 // Maximal AU capacity in bytes: (1<<20) = 1024 KB predefined
|
||||
#define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
|
||||
|
||||
enum {
|
||||
BASE_MB = 0,
|
||||
NON_AVC_REWRITE_ENHANCE_MB = 1,
|
||||
AVC_REWRITE_ENHANCE_MB = 2
|
||||
|
||||
};
|
||||
|
||||
#endif//WELS_CONSTANCE_H__
|
||||
|
@ -453,7 +453,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
int32_t iMbX = pCurLayer->iMbX;
|
||||
int32_t iMbY = pCurLayer->iMbY;
|
||||
int32_t iMbXy = pCurLayer->iMbXyIndex;
|
||||
int32_t iNMbMode, i;
|
||||
int32_t i;
|
||||
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
|
||||
uint32_t uiCode;
|
||||
int32_t iCode;
|
||||
@ -551,8 +551,6 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
iNMbMode = BASE_MB;
|
||||
|
||||
memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
|
||||
@ -601,7 +599,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
|
||||
//step1: Luma DC
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16,
|
||||
g_kuiLumaDcZigzagScan, I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
g_kuiLumaDcZigzagScan, I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
//step2: Luma AC
|
||||
@ -609,7 +607,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
}
|
||||
@ -626,7 +624,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
//Luma (DC and AC decoding together)
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,
|
||||
LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
@ -648,7 +646,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
for (i = 0; i < 2; i++) { //Cb Cr
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
|
||||
16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
|
||||
iNMbMode, pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
}
|
||||
@ -661,7 +659,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), iNMbMode, pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
@ -721,7 +719,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
int32_t iMbY = pCurLayer->iMbY;
|
||||
int32_t iMbXy = pCurLayer->iMbXyIndex;
|
||||
|
||||
int32_t iNMbMode, i;
|
||||
int32_t i;
|
||||
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
|
||||
uint32_t uiCode;
|
||||
int32_t iCode;
|
||||
@ -749,7 +747,6 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
}
|
||||
|
||||
if (pCurLayer->pResidualPredFlag[iMbXy] == 0) {
|
||||
iNMbMode = BASE_MB;
|
||||
pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
|
||||
} else {
|
||||
WelsLog (pCtx, WELS_LOG_WARNING, "residual_pred_flag = 1 not supported.\n");
|
||||
@ -826,7 +823,6 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
if (pCtx->pParseIntra4x4ModeFunc (&sNeighAvail, pIntraPredMode, pBs, pCurLayer)) {
|
||||
return -1;
|
||||
}
|
||||
iNMbMode = BASE_MB;
|
||||
} else { //I_PCM exclude, we can ignore it
|
||||
pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;
|
||||
pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;
|
||||
@ -837,7 +833,6 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
if (pCtx->pParseIntra16x16ModeFunc (&sNeighAvail, pBs, pCurLayer)) {
|
||||
return -1;
|
||||
}
|
||||
iNMbMode = BASE_MB;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -860,22 +855,20 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
uiCbpL = pCurLayer->pCbp[iMbXy] & 15;
|
||||
}
|
||||
|
||||
if (iNMbMode == BASE_MB) {
|
||||
pCtx->sBlockFunc.pWelsBlockZero16x16Func (pCurLayer->pScaledTCoeff[iMbXy], 16);
|
||||
pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256, 8);
|
||||
pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256 + 64, 8);
|
||||
pCtx->sBlockFunc.pWelsBlockZero16x16Func (pCurLayer->pScaledTCoeff[iMbXy], 16);
|
||||
pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256, 8);
|
||||
pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256 + 64, 8);
|
||||
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][12], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][16], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][20], 0);
|
||||
if (pCurLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurLayer->pMbType[iMbXy]) && !IS_I_BL (pCurLayer->pMbType[iMbXy])) {
|
||||
pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
|
||||
pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
|
||||
pSliceHeader->pPps->iChromaQpIndexOffset, 0, 51)];
|
||||
}
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][12], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][16], 0);
|
||||
ST32 (&pCurLayer->pNzc[iMbXy][20], 0);
|
||||
if (pCurLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurLayer->pMbType[iMbXy]) && !IS_I_BL (pCurLayer->pMbType[iMbXy])) {
|
||||
pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
|
||||
pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
|
||||
pSliceHeader->pPps->iChromaQpIndexOffset, 0, 51)];
|
||||
}
|
||||
|
||||
if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
|
||||
@ -910,7 +903,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
|
||||
//step1: Luma DC
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan,
|
||||
I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
//step2: Luma AC
|
||||
@ -918,7 +911,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
}
|
||||
@ -935,7 +928,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
//Luma (DC and AC decoding together)
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), iNMbMode, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
@ -958,7 +951,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
for (i = 0; i < 2; i++) { //Cb Cr
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
|
||||
16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
|
||||
iNMbMode, pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
}
|
||||
@ -971,7 +964,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), iNMbMode, pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
|
@ -662,7 +662,7 @@ static int32_t CavlcGetRunBefore (int32_t iRun[16], SReadBitsCache* pBitsCache,
|
||||
|
||||
int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCache, PBitStringAux pBs, int32_t iIndex,
|
||||
int32_t iMaxNumCoeff,
|
||||
const uint8_t* kpZigzagTable, int32_t iResidualProperty, int16_t* pTCoeff, int32_t iMbMode, uint8_t uiQp,
|
||||
const uint8_t* kpZigzagTable, int32_t iResidualProperty, int16_t* pTCoeff, uint8_t uiQp,
|
||||
PWelsDecoderContext pCtx) {
|
||||
int32_t iLevel[16], iZerosLeft, iCoeffNum;
|
||||
int32_t iRun[16] = {0};
|
||||
@ -740,18 +740,12 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
|
||||
|
||||
if (iResidualProperty == CHROMA_DC) {
|
||||
//chroma dc scaling process, is kpDequantCoeff[0]? LevelScale(qPdc%6,0,0))<<(qPdc/6-6), the transform is done at construction.
|
||||
switch (iMbMode) {
|
||||
case BASE_MB:
|
||||
for (i = uiTotalCoeff - 1; i >= 0; --i) {
|
||||
//FIXME merge into rundecode?
|
||||
int32_t j;
|
||||
iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
|
||||
j = kpZigzagTable[ iCoeffNum ];
|
||||
pTCoeff[j] = iLevel[i] * kpDequantCoeff[0];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
for (i = uiTotalCoeff - 1; i >= 0; --i) {
|
||||
//FIXME merge into rundecode?
|
||||
int32_t j;
|
||||
iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
|
||||
j = kpZigzagTable[ iCoeffNum ];
|
||||
pTCoeff[j] = iLevel[i] * kpDequantCoeff[0];
|
||||
}
|
||||
} else if (iResidualProperty == I16_LUMA_DC) { //DC coefficent, only call in Intra_16x16, base_mode_flag = 0
|
||||
for (i = uiTotalCoeff - 1; i >= 0; --i) { //FIXME merge into rundecode?
|
||||
@ -761,17 +755,11 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
|
||||
pTCoeff[j] = iLevel[i];
|
||||
}
|
||||
} else {
|
||||
switch (iMbMode) {
|
||||
case BASE_MB:
|
||||
for (i = uiTotalCoeff - 1; i >= 0; --i) { //FIXME merge into rundecode?
|
||||
int32_t j;
|
||||
iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
|
||||
j = kpZigzagTable[ iCoeffNum ];
|
||||
pTCoeff[j] = iLevel[i] * kpDequantCoeff[j & 0x07];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
for (i = uiTotalCoeff - 1; i >= 0; --i) { //FIXME merge into rundecode?
|
||||
int32_t j;
|
||||
iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
|
||||
j = kpZigzagTable[ iCoeffNum ];
|
||||
pTCoeff[j] = iLevel[i] * kpDequantCoeff[j & 0x07];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,12 +175,6 @@ enum {
|
||||
SUC_AU_IDX = 1 // index symbol for successive access unit
|
||||
};
|
||||
|
||||
enum {
|
||||
BASE_MB = 0,
|
||||
AVC_REWRITE_ENHANCE_MB = 1,
|
||||
NON_AVC_REWRITE_ENHANCE_MB = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
ENC_RETURN_SUCCESS = 0,
|
||||
ENC_RETURN_MEMALLOCERR = 0x01, //will free memory and uninit
|
||||
|
Loading…
x
Reference in New Issue
Block a user