modify return value check inside decoder
This commit is contained in:
parent
13586a3dfc
commit
9cb4f4e8e2
@ -129,6 +129,7 @@ ERR_INFO_INVALID_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4,
|
||||
ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE,
|
||||
ERR_INFO_INVALID_DBLOCKING_IDC,
|
||||
ERR_INFO_INVALID_MB_TYPE,
|
||||
ERR_INFO_INVALID_MB_SKIP_RUN,
|
||||
ERR_INFO_INVALID_SPS_ID,
|
||||
ERR_INFO_INVALID_PPS_ID,
|
||||
ERR_INFO_INVALID_SUB_MB_TYPE,
|
||||
@ -199,6 +200,16 @@ ERR_CABAC_NO_BS_TO_READ,
|
||||
ERR_CABAC_UNEXPECTED_VALUE,
|
||||
//for scaling list
|
||||
ERR_SCALING_LIST_DELTA_SCALE,
|
||||
//logic error related to multi-layer
|
||||
ERR_INFO_WIDTH_MISMATCH,
|
||||
//reconstruction error
|
||||
ERR_INFO_MB_RECON_FAIL,
|
||||
ERR_INFO_MB_NUM_EXCEED_FAIL,
|
||||
ERR_INFO_BS_INCOMPLETE,
|
||||
ERR_INFO_MB_NUM_INADEQUATE,
|
||||
//parse only error
|
||||
ERR_INFO_PARSEONLY_PENDING,
|
||||
ERR_INFO_PARSEONLY_ERROR,
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -782,7 +782,7 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) {
|
||||
@ -915,6 +915,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
|
||||
int32_t iSpsId;
|
||||
uint32_t uiCode;
|
||||
int32_t iCode;
|
||||
int32_t iRet = ERR_NONE;
|
||||
bool bConstraintSetFlags[6] = { false };
|
||||
const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType);
|
||||
|
||||
@ -1207,8 +1208,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
|
||||
}
|
||||
// Check if SPS SVC extension applicated
|
||||
if (kbUseSubsetFlag && (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc)) {
|
||||
if (DecodeSpsSvcExt (pCtx, pSubsetSps, pBs) != ERR_NONE) {
|
||||
return -1;
|
||||
if ((iRet = DecodeSpsSvcExt (pCtx, pSubsetSps, pBs)) != ERR_NONE) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //svc_vui_parameters_present_flag
|
||||
@ -1271,7 +1272,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
|
||||
pCtx->bSpsAvailFlags[iSpsId] = true;
|
||||
pCtx->bSpsExistAheadFlag = true;
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1301,7 +1302,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
||||
WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //pic_parameter_set_id
|
||||
uiPpsId = uiCode;
|
||||
if (uiPpsId >= MAX_PPS_COUNT) {
|
||||
return ERR_INFO_PPS_ID_OVERFLOW;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_PPS_ID_OVERFLOW);
|
||||
}
|
||||
pPps = &sTempPps;
|
||||
memset (pPps, 0, sizeof (SPps));
|
||||
@ -1311,7 +1312,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
||||
pPps->iSpsId = uiCode;
|
||||
|
||||
if (pPps->iSpsId >= MAX_SPS_COUNT) {
|
||||
return ERR_INFO_SPS_ID_OVERFLOW;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
|
||||
}
|
||||
|
||||
WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //entropy_coding_mode_flag
|
||||
@ -1323,7 +1324,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
||||
pPps->uiNumSliceGroups = NUM_SLICE_GROUPS_OFFSET + uiCode;
|
||||
|
||||
if (pPps->uiNumSliceGroups > MAX_SLICEGROUP_IDS) {
|
||||
return ERR_INFO_INVALID_SLICEGROUP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_SLICEGROUP);
|
||||
}
|
||||
|
||||
if (pPps->uiNumSliceGroups > 1) {
|
||||
@ -1354,7 +1355,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
||||
|
||||
if (pPps->uiNumRefIdxL0Active > MAX_REF_PIC_COUNT ||
|
||||
pPps->uiNumRefIdxL1Active > MAX_REF_PIC_COUNT) {
|
||||
return ERR_INFO_REF_COUNT_OVERFLOW;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_REF_COUNT_OVERFLOW);
|
||||
}
|
||||
|
||||
WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //weighted_pred_flag
|
||||
|
@ -107,7 +107,7 @@ int32_t Read32BitsCabac (PWelsCabacDecEngine pDecEngine, uint32_t& uiValue, int3
|
||||
iNumBitsRead = 0;
|
||||
uiValue = 0;
|
||||
if (iLeftBytes <= 0) {
|
||||
return ERR_CABAC_NO_BS_TO_READ;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_NO_BS_TO_READ);
|
||||
}
|
||||
switch (iLeftBytes) {
|
||||
case 3:
|
||||
@ -275,7 +275,7 @@ int32_t DecodeExpBypassCabac (PWelsCabacDecEngine pDecEngine, int32_t iCount, ui
|
||||
}
|
||||
} while (uiCode != 0 && iCount != 16);
|
||||
if (iCount == 16) {
|
||||
return ERR_CABAC_UNEXPECTED_VALUE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_UNEXPECTED_VALUE);
|
||||
}
|
||||
|
||||
while (iCount--) {
|
||||
|
@ -70,7 +70,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
|
||||
PDeblockingFilterMbFunc pDeblockMb;
|
||||
|
||||
if (!pCtx->bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) {
|
||||
return -1;
|
||||
return ERR_INFO_WIDTH_MISMATCH;
|
||||
}
|
||||
|
||||
iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;
|
||||
@ -96,7 +96,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
|
||||
"WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",
|
||||
pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType);
|
||||
|
||||
return -1;
|
||||
return ERR_INFO_MB_RECON_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
|
||||
"WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d",
|
||||
pCtx->iTotalNumMbRec, iTotalMbTargetLayer);
|
||||
|
||||
return -1;
|
||||
return ERR_INFO_MB_NUM_EXCEED_FAIL;
|
||||
}
|
||||
|
||||
if (pSliceHeader->pPps->uiNumSliceGroups > 1) {
|
||||
@ -132,22 +132,22 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
|
||||
pCtx->pDec->iHeightInPixel = iCurLayerHeight;
|
||||
|
||||
if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE))
|
||||
return 0;
|
||||
return ERR_NONE; //no error but just ignore the type unsupported
|
||||
|
||||
if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
|
||||
pDeblockMb = WelsDeblockingMb;
|
||||
|
||||
if (1 == pSliceHeader->uiDisableDeblockingFilterIdc
|
||||
|| pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice <= 0) {
|
||||
return 0;//NO_SUPPORTED_FILTER_IDX
|
||||
return ERR_NONE;//NO_SUPPORTED_FILTER_IDX
|
||||
} else {
|
||||
WelsDeblockingFilterSlice (pCtx, pDeblockMb);
|
||||
}
|
||||
// any other filter_idc not supported here, 7/22/2010
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer,
|
||||
@ -191,7 +191,7 @@ int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLa
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
|
||||
int32_t iMbX = pCurLayer->iMbX;
|
||||
@ -210,7 +210,7 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
|
||||
|
||||
pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
|
||||
pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx) {
|
||||
@ -265,7 +265,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC
|
||||
WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx);
|
||||
RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
if (IS_INTRA8x8 (pCurLayer->pMbType[iMbXy])) {
|
||||
@ -275,7 +275,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC
|
||||
if (IS_INTRA4x4 (pCurLayer->pMbType[iMbXy]))
|
||||
RecI4x4Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
|
||||
@ -292,14 +292,14 @@ int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
|
||||
|
||||
GetInterPred (pDstY, pDstCb, pDstCr, pCtx);
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) {
|
||||
PDqLayer pCurLayer = pCtx->pCurDqLayer;
|
||||
if (MB_TYPE_INTRA_PCM == pCurLayer->pMbType[pCurLayer->iMbXyIndex]) {
|
||||
//already decoded and reconstructed when parsing
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
} else if (IS_INTRA (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) {
|
||||
WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1);
|
||||
} else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB
|
||||
@ -311,10 +311,10 @@ int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) {
|
||||
} else {
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetMbConstruction():::::Unknown MB type: %d",
|
||||
pCurLayer->pMbType[pCurLayer->iMbXyIndex]);
|
||||
return -1;
|
||||
return ERR_INFO_MB_RECON_FAIL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void WelsChromaDcIdct (int16_t* pBlock) {
|
||||
@ -445,7 +445,7 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
|
||||
|
||||
iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i, false);
|
||||
if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) {
|
||||
return ERR_INFO_INVALID_I4x4_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE);
|
||||
}
|
||||
|
||||
pCurDqLayer->pIntra4x4FinalMode[iMbXy][g_kuiScan4[i]] = iFinalMode;
|
||||
@ -465,20 +465,20 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
|
||||
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
|
||||
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
|
||||
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
|
||||
} else {
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
|
||||
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
|
||||
}
|
||||
|
||||
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|
||||
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
@ -529,7 +529,7 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
|
||||
iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i << 2, true);
|
||||
|
||||
if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) {
|
||||
return ERR_INFO_INVALID_I4x4_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
@ -545,20 +545,20 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
|
||||
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
|
||||
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
|
||||
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
|
||||
} else {
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
|
||||
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
|
||||
}
|
||||
|
||||
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|
||||
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
|
||||
return ERR_NONE;
|
||||
@ -574,7 +574,7 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva
|
||||
|
||||
if (CheckIntra16x16PredMode (uiNeighAvail,
|
||||
&pCurDqLayer->pIntraPredMode[iMbXy][7])) { //invalid iPredMode, must stop decoding
|
||||
return ERR_INFO_INVALID_I16x16_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
|
||||
}
|
||||
if (pCtx->pSps->uiChromaFormatIdc == 0)
|
||||
return ERR_NONE;
|
||||
@ -582,19 +582,19 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva
|
||||
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
|
||||
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
|
||||
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
|
||||
} else {
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
|
||||
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
|
||||
}
|
||||
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|
||||
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
|
||||
return ERR_NONE;
|
||||
@ -622,10 +622,10 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui
|
||||
GetNeighborAvailMbType (&sNeighAvail, pCurLayer);
|
||||
WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType));
|
||||
if (uiMbType > 25) {
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
} else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17
|
||||
&& uiMbType <= 24))) {
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
} else if (25 == uiMbType) { //I_PCM
|
||||
WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
|
||||
pSlice->iLastDeltaQp = 0;
|
||||
@ -688,7 +688,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui
|
||||
int32_t iQpDelta, iId8x8, iId4x4;
|
||||
WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
|
||||
if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range
|
||||
return ERR_INFO_INVALID_QP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
|
||||
}
|
||||
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
|
||||
pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
|
||||
@ -841,9 +841,9 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv
|
||||
} else { //Intra mode
|
||||
uiMbType -= 5;
|
||||
if (uiMbType > 25)
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
|
||||
if (25 == uiMbType) { //I_PCM
|
||||
WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
|
||||
@ -922,7 +922,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv
|
||||
|
||||
WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
|
||||
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
|
||||
return ERR_INFO_INVALID_QP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
|
||||
}
|
||||
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
|
||||
pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
|
||||
@ -1276,6 +1276,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
const int32_t iMbXy = pCurLayer->iMbXyIndex;
|
||||
int8_t* pNzc = pCurLayer->pNzc[iMbXy];
|
||||
int32_t i;
|
||||
int32_t iRet = ERR_NONE;
|
||||
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
|
||||
uint32_t uiCode;
|
||||
int32_t iCode;
|
||||
@ -1291,9 +1292,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType
|
||||
uiMbType = uiCode;
|
||||
if (uiMbType > 25)
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
|
||||
if (25 == uiMbType) {
|
||||
int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
|
||||
@ -1345,7 +1346,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
memset (pCurLayer->pChromaQp[iMbXy], 0, sizeof (pCurLayer->pChromaQp[iMbXy]));
|
||||
memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16
|
||||
WELS_READ_VERIFY (InitReadBits (pBs, 0));
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
} else if (0 == uiMbType) { //reference to JM
|
||||
ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);
|
||||
pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4;
|
||||
@ -1369,9 +1370,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
uiCbp = uiCode;
|
||||
//G.9.1 Alternative parsing process for coded pBlock pattern
|
||||
if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
|
||||
return ERR_INFO_INVALID_CBP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
|
||||
if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
|
||||
return ERR_INFO_INVALID_CBP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
|
||||
|
||||
if (pCtx->pSps->uiChromaFormatIdc)
|
||||
uiCbp = g_kuiIntra4x4CbpTable[uiCbp];
|
||||
@ -1416,7 +1417,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
iQpDelta = iCode;
|
||||
|
||||
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
|
||||
return ERR_INFO_INVALID_QP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
|
||||
}
|
||||
|
||||
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
|
||||
@ -1432,17 +1433,17 @@ 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], pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC,
|
||||
pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
//step2: Luma AC
|
||||
if (uiCbpL) {
|
||||
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), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = 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),
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
}
|
||||
ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
|
||||
@ -1457,10 +1458,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
if (uiCbpL & (1 << iId8x8)) {
|
||||
int32_t iIndex = (iId8x8 << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;
|
||||
if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
|
||||
g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4,
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1479,10 +1480,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
int32_t iIndex = (iId8x8 << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
//Luma (DC and AC decoding together)
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,
|
||||
LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
|
||||
g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1503,10 +1504,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
if (1 == uiCbpC || 2 == uiCbpC) {
|
||||
for (i = 0; i < 2; i++) { //Cb Cr
|
||||
iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
|
||||
16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
|
||||
pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1517,10 +1517,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
|
||||
int32_t iIndex = 16 + (i << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
|
||||
1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
|
||||
pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1533,7 +1533,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
|
||||
BsEndCavlc (pBs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
|
||||
@ -1572,9 +1572,9 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
||||
"WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.",
|
||||
(int64_t) iUsedBits, pBs->iBits);
|
||||
return -1;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE);
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
@ -1593,6 +1593,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
const int32_t iMbXy = pCurLayer->iMbXyIndex;
|
||||
int8_t* pNzc = pCurLayer->pNzc[iMbXy];
|
||||
int32_t i;
|
||||
int32_t iRet = ERR_NONE;
|
||||
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
|
||||
uint32_t uiCode;
|
||||
int32_t iCode;
|
||||
@ -1609,8 +1610,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
pCurLayer->pMbType[iMbXy] = g_ksInterMbTypeInfo[uiMbType].iType;
|
||||
WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurLayer);
|
||||
|
||||
if (ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
|
||||
if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) {
|
||||
@ -1624,14 +1625,14 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
|
||||
} else {
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "residual_pred_flag = 1 not supported.");
|
||||
return -1;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP);
|
||||
}
|
||||
} else { //intra MB type
|
||||
uiMbType -= 5;
|
||||
if (uiMbType > 25)
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
|
||||
return ERR_INFO_INVALID_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
|
||||
|
||||
if (25 == uiMbType) {
|
||||
int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
|
||||
@ -1689,7 +1690,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
ST32A4 (&pNzc[16], 0x10101010);
|
||||
ST32A4 (&pNzc[20], 0x10101010);
|
||||
WELS_READ_VERIFY (InitReadBits (pBs, 0));
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
} else {
|
||||
if (0 == uiMbType) {
|
||||
ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);
|
||||
@ -1717,8 +1718,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0;
|
||||
uiCbpL = pCurLayer->pCbp[iMbXy] & 15;
|
||||
WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
|
||||
if (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) {
|
||||
return -1;
|
||||
if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) != ERR_NONE) {
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1729,9 +1730,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
uiCbp = uiCode;
|
||||
{
|
||||
if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
|
||||
return ERR_INFO_INVALID_CBP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
|
||||
if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
|
||||
return ERR_INFO_INVALID_CBP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
|
||||
if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurLayer->pMbType[iMbXy]) {
|
||||
|
||||
uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp];
|
||||
@ -1779,7 +1780,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
iQpDelta = iCode;
|
||||
|
||||
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
|
||||
return ERR_INFO_INVALID_QP;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
|
||||
}
|
||||
|
||||
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
|
||||
@ -1794,17 +1795,17 @@ 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], pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC,
|
||||
pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
//step2: Luma AC
|
||||
if (uiCbpL) {
|
||||
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), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = 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),
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
}
|
||||
ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
|
||||
@ -1819,10 +1820,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
if (uiCbpL & (1 << iId8x8)) {
|
||||
int32_t iIndex = (iId8x8 << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;
|
||||
if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
|
||||
g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4,
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1842,10 +1843,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
int32_t iIndex = (iId8x8 << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
//Luma (DC and AC decoding together)
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, iMbResProperty,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
|
||||
g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
|
||||
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1871,10 +1872,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
else
|
||||
iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
|
||||
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
|
||||
16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
|
||||
pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty,
|
||||
pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1889,10 +1889,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
|
||||
int32_t iIndex = 16 + (i << 2);
|
||||
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
|
||||
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
|
||||
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
|
||||
iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
|
||||
return -1;//abnormal
|
||||
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
|
||||
1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
|
||||
pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
|
||||
return iRet;//abnormal
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
@ -1905,7 +1905,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
|
||||
BsEndCavlc (pBs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
|
||||
@ -1928,7 +1928,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run
|
||||
pSlice->iMbSkipRun = uiCode;
|
||||
if (-1 == pSlice->iMbSkipRun) {
|
||||
return -1;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_SKIP_RUN);
|
||||
}
|
||||
}
|
||||
if (pSlice->iMbSkipRun--) {
|
||||
@ -1995,9 +1995,9 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
||||
"WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.",
|
||||
(int64_t) iUsedBits, pBs->iBits);
|
||||
return -1;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE);
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) {
|
||||
|
@ -64,7 +64,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
|
||||
PPicBuff pPicBuf = NULL;
|
||||
int32_t iPicIdx = 0;
|
||||
if (kiSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
}
|
||||
|
||||
CMemoryAlign* pMa = pCtx->pMemAlign;
|
||||
@ -72,7 +72,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
|
||||
pPicBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
|
||||
|
||||
if (NULL == pPicBuf) {
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pPicBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiSize * sizeof (PPicture), "PPicture*");
|
||||
@ -80,7 +80,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
|
||||
if (NULL == pPicBuf->ppPic) {
|
||||
pPicBuf->iCapacity = 0;
|
||||
DestroyPicBuff (&pPicBuf, pMa);
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (iPicIdx = 0; iPicIdx < kiSize; ++ iPicIdx) {
|
||||
@ -89,7 +89,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
|
||||
// init capacity first for free memory
|
||||
pPicBuf->iCapacity = iPicIdx;
|
||||
DestroyPicBuff (&pPicBuf, pMa);
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
pPicBuf->ppPic[iPicIdx] = pPic;
|
||||
}
|
||||
@ -99,7 +99,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
|
||||
pPicBuf->iCurrentIdx = 0;
|
||||
* ppPicBuf = pPicBuf;
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
|
||||
@ -108,14 +108,14 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
PPicBuff pPicNewBuf = NULL;
|
||||
int32_t iPicIdx = 0;
|
||||
if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
}
|
||||
|
||||
CMemoryAlign* pMa = pCtx->pMemAlign;
|
||||
pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
|
||||
|
||||
if (NULL == pPicNewBuf) {
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
|
||||
@ -123,7 +123,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
if (NULL == pPicNewBuf->ppPic) {
|
||||
pPicNewBuf->iCapacity = 0;
|
||||
DestroyPicBuff (&pPicNewBuf, pMa);
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// increase new PicBuf
|
||||
@ -133,7 +133,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
// Set maximum capacity as the new malloc memory at the tail
|
||||
pPicNewBuf->iCapacity = iPicIdx;
|
||||
DestroyPicBuff (&pPicNewBuf, pMa);
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
pPicNewBuf->ppPic[iPicIdx] = pPic;
|
||||
}
|
||||
@ -162,7 +162,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
pPicOldBuf->iCurrentIdx = 0;
|
||||
pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
|
||||
pPicOldBuf = NULL;
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
|
||||
@ -171,7 +171,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
PPicBuff pPicNewBuf = NULL;
|
||||
int32_t iPicIdx = 0;
|
||||
if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
}
|
||||
|
||||
CMemoryAlign* pMa = pCtx->pMemAlign;
|
||||
@ -179,7 +179,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
|
||||
|
||||
if (NULL == pPicNewBuf) {
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
|
||||
@ -187,7 +187,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
if (NULL == pPicNewBuf->ppPic) {
|
||||
pPicNewBuf->iCapacity = 0;
|
||||
DestroyPicBuff (&pPicNewBuf, pMa);
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
int32_t iPrevPicIdx = -1;
|
||||
@ -239,7 +239,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
|
||||
pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
|
||||
pPicOldBuf = NULL;
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) {
|
||||
@ -523,7 +523,7 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) {
|
||||
*/
|
||||
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
|
||||
if (NULL == pCtx || NULL == kpParam)
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
|
||||
memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
|
||||
if ((pCtx->pParam->eEcActiveIdc > ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
|
||||
@ -549,7 +549,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
|
||||
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "eVideoType: %d", pCtx->eVideoType);
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -133,7 +133,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
pCtx->pDec->bIsComplete = false;
|
||||
pCtx->bFrameFinish = false; //current frame not finished
|
||||
pCtx->iErrorCode |= dsFramePending;
|
||||
return -1;
|
||||
return ERR_INFO_PARSEONLY_PENDING;
|
||||
//pCtx->pParserBsInfo->iNalNum = 0;
|
||||
}
|
||||
} else { //error
|
||||
@ -141,9 +141,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
pCtx->pParserBsInfo->iNalNum = 0;
|
||||
pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
|
||||
pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
|
||||
return -1;
|
||||
return ERR_INFO_PARSEONLY_ERROR;
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
|
||||
@ -152,7 +152,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
|
||||
bFrameCompleteFlag = false; //return later after output buffer is done
|
||||
if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice
|
||||
return -1;
|
||||
return ERR_INFO_MB_NUM_INADEQUATE;
|
||||
} else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag
|
||||
&& (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done
|
||||
pCtx->pDec->bIsComplete = true;
|
||||
@ -193,7 +193,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
if (pDstInfo->iBufferStatus == 0) {
|
||||
if (!bFrameCompleteFlag)
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
return -1;
|
||||
return ERR_INFO_MB_NUM_INADEQUATE;
|
||||
}
|
||||
if (pCtx->bFreezeOutput) {
|
||||
pDstInfo->iBufferStatus = 0;
|
||||
@ -206,7 +206,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum;
|
||||
UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0);
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
inline bool CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) {
|
||||
@ -971,7 +971,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
|
||||
if (pSliceHead->uiDisableDeblockingFilterIdc > 6) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING, "disable_deblock_filter_idc (%d) out of range [0, 6]",
|
||||
pSliceHead->uiDisableDeblockingFilterIdc);
|
||||
return ERR_INFO_INVALID_DBLOCKING_IDC;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
|
||||
}
|
||||
if (pSliceHead->uiDisableDeblockingFilterIdc != 1) {
|
||||
WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_alpha_c0_offset_div2
|
||||
@ -1018,7 +1018,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
|
||||
if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) {
|
||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]",
|
||||
pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc);
|
||||
return ERR_INFO_INVALID_DBLOCKING_IDC;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
|
||||
}
|
||||
if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc != 1) {
|
||||
WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //inter_layer_slice_alpha_c0_offset_div2
|
||||
@ -1298,7 +1298,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
||||
"pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
|
||||
pCtx->sMb.pResidualPredFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
|
||||
"pCtx->sMb.pResidualPredFlag[]");
|
||||
//pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) pMa->WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]");
|
||||
pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
|
||||
int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");
|
||||
|
||||
@ -1314,6 +1313,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
||||
(NULL == pCtx->sMb.pMv[i][0]) ||
|
||||
(NULL == pCtx->sMb.pRefIndex[i][0]) ||
|
||||
(NULL == pCtx->sMb.pLumaQp[i]) ||
|
||||
(NULL == pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[i]) ||
|
||||
(NULL == pCtx->sMb.pTransformSize8x8Flag[i]) ||
|
||||
(NULL == pCtx->sMb.pChromaQp[i]) ||
|
||||
(NULL == pCtx->sMb.pMvd[i][0]) ||
|
||||
(NULL == pCtx->sMb.pCbfDc[i]) ||
|
||||
@ -1322,6 +1323,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
||||
(NULL == pCtx->sMb.pScaledTCoeff[i]) ||
|
||||
(NULL == pCtx->sMb.pIntraPredMode[i]) ||
|
||||
(NULL == pCtx->sMb.pIntra4x4FinalMode[i]) ||
|
||||
(NULL == pCtx->sMb.pIntraNxNAvailFlag[i]) ||
|
||||
(NULL == pCtx->sMb.pChromaPredMode[i]) ||
|
||||
(NULL == pCtx->sMb.pCbp[i]) ||
|
||||
(NULL == pCtx->sMb.pSubMbType[i]) ||
|
||||
@ -2007,7 +2009,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
|
||||
return iErr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) {
|
||||
@ -2251,7 +2253,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
||||
#else
|
||||
pCtx->bReferenceLostAtT0Flag = true;
|
||||
#endif
|
||||
return ERR_INFO_REFERENCE_PIC_LOST;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_REFERENCE_PIC_LOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2290,9 +2292,9 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
||||
}
|
||||
|
||||
if (bReconstructSlice) {
|
||||
if (WelsDecodeConstructSlice (pCtx, pNalCur)) {
|
||||
if ((iRet = WelsDecodeConstructSlice (pCtx, pNalCur)) != ERR_NONE) {
|
||||
pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false
|
||||
return -1;
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
if (bAllRefComplete && pCtx->eSliceType != I_SLICE) {
|
||||
@ -2479,6 +2481,8 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) {
|
||||
}
|
||||
iRealMbIdx = (pCtx->pPps->uiNumSliceGroups > 1) ? FmoNextMb (pCtx->pFmo, iRealMbIdx) :
|
||||
(pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice + iMbIdx);
|
||||
if (iRealMbIdx == -1) //caused by abnormal return of FmoNextMb()
|
||||
return false;
|
||||
}
|
||||
return bAllRefComplete;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ void DoMbECMvCopy (PWelsDecoderContext pCtx, PPicture pDec, PPicture pRef, int32
|
||||
iMVs[1] = iFullMVy - (iMbYInPix << 2);
|
||||
BaseMC (pMCRefMem, iMbXInPix, iMbYInPix, &pCtx->sMcFunc, 16, 16, iMVs);
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
void GetAvilInfoFromCorrectMb (PWelsDecoderContext pCtx) {
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "fmo.h"
|
||||
#include "memory_align.h"
|
||||
#include "error_code.h"
|
||||
|
||||
namespace WelsDec {
|
||||
|
||||
@ -56,10 +57,11 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
|
||||
int32_t iMbNum = 0;
|
||||
int32_t i = 0;
|
||||
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps))
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps))
|
||||
uiNumSliceGroups = pPps->uiNumSliceGroups;
|
||||
iMbNum = pFmo->iCountMbNum;
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || uiNumSliceGroups > MAX_SLICEGROUP_IDS))
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0
|
||||
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
|
||||
|
||||
do {
|
||||
uint8_t uiGroup = 0;
|
||||
@ -75,7 +77,7 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
|
||||
} while (uiGroup < uiNumSliceGroups && i < iMbNum);
|
||||
} while (i < iMbNum);
|
||||
|
||||
return 0; // well here
|
||||
return ERR_NONE; // well here
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -91,18 +93,18 @@ static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const in
|
||||
uint32_t uiNumSliceGroups = 0;
|
||||
int32_t iMbNum = 0;
|
||||
int32_t i = 0;
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps))
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps))
|
||||
uiNumSliceGroups = pPps->uiNumSliceGroups;
|
||||
iMbNum = pFmo->iCountMbNum;
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0
|
||||
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0
|
||||
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
|
||||
|
||||
do {
|
||||
pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups);
|
||||
++ i;
|
||||
} while (i < iMbNum);
|
||||
|
||||
return 0; // well here
|
||||
return ERR_NONE; // well here
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -122,18 +124,18 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
|
||||
bool bResolutionChanged = false;
|
||||
|
||||
// the cases we would not like
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == kpPps))
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == kpPps))
|
||||
|
||||
iNumMb = pFmo->iCountMbNum;
|
||||
|
||||
iNumMb = kiMbWidth * kiMbHeight;
|
||||
|
||||
if (0 == iNumMb)
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
|
||||
pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");
|
||||
pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
|
||||
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory
|
||||
WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pFmo->pMbAllocMap)) // out of memory
|
||||
|
||||
pFmo->iCountMbNum = iNumMb;
|
||||
|
||||
@ -142,7 +144,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
|
||||
|
||||
pFmo->iSliceGroupCount = 1;
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
if (bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType)
|
||||
@ -163,7 +165,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
|
||||
iErr = 1;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
return ERR_INFO_UNSUPPORTED_FMOTYPE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
*****************************************************************************/
|
||||
#include "memmgr_nal_unit.h"
|
||||
#include "memory_align.h"
|
||||
#include "error_code.h"
|
||||
|
||||
namespace WelsDec {
|
||||
|
||||
@ -52,7 +53,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
|
||||
const uint32_t kuiCountSize = (kuiSizeAu + kuiSizeNalUnitPtr + kuiSize * kuiSizeNalUnit) * sizeof (uint8_t);
|
||||
|
||||
if (kuiSize == 0)
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
|
||||
if (*ppAu != NULL) {
|
||||
MemFreeNalList (ppAu, pMa);
|
||||
@ -60,7 +61,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
|
||||
|
||||
pBase = (uint8_t*)pMa->WelsMallocz (kuiCountSize, "Access Unit");
|
||||
if (pBase == NULL)
|
||||
return 1;
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
pPtr = pBase;
|
||||
*ppAu = (PAccessUnit)pPtr;
|
||||
pPtr += kuiSizeAu;
|
||||
@ -79,7 +80,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
|
||||
(*ppAu)->uiEndPos = 0;
|
||||
(*ppAu)->bCompletedAuFlag = false;
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t MemFreeNalList (PAccessUnit* ppAu, CMemoryAlign* pMa) {
|
||||
@ -90,19 +91,19 @@ int32_t MemFreeNalList (PAccessUnit* ppAu, CMemoryAlign* pMa) {
|
||||
*ppAu = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int32_t kiExpSize, CMemoryAlign* pMa) {
|
||||
if (kiExpSize <= kiOrgSize)
|
||||
return 1;
|
||||
return ERR_INFO_INVALID_PARAM;
|
||||
else {
|
||||
PAccessUnit pTmp = NULL;
|
||||
int32_t iIdx = 0;
|
||||
|
||||
if (MemInitNalList (&pTmp, kiExpSize, pMa)) // request new list with expanding
|
||||
return 1;
|
||||
int32_t iRet = ERR_NONE;
|
||||
if ((iRet = MemInitNalList (&pTmp, kiExpSize, pMa)) != ERR_NONE) // request new list with expanding
|
||||
return iRet;
|
||||
|
||||
do {
|
||||
memcpy (pTmp->pNalUnitsList[iIdx], (*ppAu)->pNalUnitsList[iIdx], sizeof (SNalUnit)); //confirmed_safe_unsafe_usage
|
||||
@ -117,7 +118,7 @@ int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int
|
||||
|
||||
MemFreeNalList (ppAu, pMa); // free old list
|
||||
*ppAu = pTmp;
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
|
||||
iRef[0] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[0]]
|
||||
@ -427,7 +427,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
|
||||
iRef[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[i]]
|
||||
@ -457,7 +457,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
|
||||
iRef[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[i]]
|
||||
@ -485,7 +485,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
|
||||
for (i = 0; i < 4; i++) {
|
||||
WELS_READ_VERIFY (ParseSubMBTypeCabac (pCtx, pNeighAvail, uiSubMbType));
|
||||
if (uiSubMbType >= 4) { //invalid sub_mb_type
|
||||
return ERR_INFO_INVALID_SUB_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_SUB_MB_TYPE);
|
||||
}
|
||||
pCurDqLayer->pSubMbType[iMbXy][i] = g_ksInterSubMbTypeInfo[uiSubMbType].iType;
|
||||
pSubPartCount[i] = g_ksInterSubMbTypeInfo[uiSubMbType].iPartCount;
|
||||
@ -505,7 +505,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
|
||||
pRefIdx[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[pRefIdx[i]]
|
||||
@ -973,7 +973,7 @@ int32_t ParseIPCMInfoCabac (PWelsDecoderContext pCtx) {
|
||||
RestoreCabacDecEngineToBS (pCabacDecEngine, pBsAux);
|
||||
intX_t iBytesLeft = pBsAux->pEndBuf - pBsAux->pCurBuf;
|
||||
if (iBytesLeft < 384) {
|
||||
return ERR_CABAC_NO_BS_TO_READ;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_NO_BS_TO_READ);
|
||||
}
|
||||
pPtrSrc = pBsAux->pCurBuf;
|
||||
for (i = 0; i < 16; i++) { //luma
|
||||
|
@ -518,12 +518,12 @@ int32_t CheckIntra16x16PredMode (uint8_t uiSampleAvail, int8_t* pMode) {
|
||||
int32_t iTopAvail = uiSampleAvail & 0x01;
|
||||
|
||||
if ((*pMode < 0) || (*pMode > MAX_PRED_MODE_ID_I16x16)) {
|
||||
return ERR_INFO_INVALID_I16x16_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
|
||||
}
|
||||
|
||||
if (I16_PRED_DC == *pMode) {
|
||||
if (iLeftAvail && iTopAvail) {
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
} else if (iLeftAvail) {
|
||||
*pMode = I16_PRED_DC_L;
|
||||
} else if (iTopAvail) {
|
||||
@ -534,10 +534,10 @@ int32_t CheckIntra16x16PredMode (uint8_t uiSampleAvail, int8_t* pMode) {
|
||||
} else {
|
||||
bool bModeAvail = CHECK_I16_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
|
||||
if (0 == bModeAvail) {
|
||||
return ERR_INFO_INVALID_I16x16_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -548,7 +548,7 @@ int32_t CheckIntraChromaPredMode (uint8_t uiSampleAvail, int8_t* pMode) {
|
||||
|
||||
if (C_PRED_DC == *pMode) {
|
||||
if (iLeftAvail && iTopAvail) {
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
} else if (iLeftAvail) {
|
||||
*pMode = C_PRED_DC_L;
|
||||
} else if (iTopAvail) {
|
||||
@ -559,10 +559,10 @@ int32_t CheckIntraChromaPredMode (uint8_t uiSampleAvail, int8_t* pMode) {
|
||||
} else {
|
||||
bool bModeAvail = CHECK_CHROMA_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
|
||||
if (0 == bModeAvail) {
|
||||
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIndex, bool b8x8) {
|
||||
@ -576,7 +576,7 @@ int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIn
|
||||
int8_t iFinalMode;
|
||||
|
||||
if ((*pMode < 0) || (*pMode > MAX_PRED_MODE_ID_I4x4)) {
|
||||
return ERR_INVALID_INTRA4X4_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE);
|
||||
}
|
||||
|
||||
if (I4_PRED_DC == *pMode) {
|
||||
@ -592,7 +592,7 @@ int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIn
|
||||
} else {
|
||||
bool bModeAvail = CHECK_I4_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
|
||||
if (0 == bModeAvail) {
|
||||
return ERR_INVALID_INTRA4X4_MODE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE);
|
||||
}
|
||||
|
||||
iFinalMode = *pMode;
|
||||
@ -848,13 +848,13 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
|
||||
}
|
||||
if (0 == uiTotalCoeff) {
|
||||
pBs->iIndex += iUsedBits;
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
if ((uiTrailingOnes > 3) || (uiTotalCoeff > 16)) { /////////////////check uiTrailingOnes and uiTotalCoeff
|
||||
return ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES);
|
||||
}
|
||||
if ((i = CavlcGetLevelVal (iLevel, &sReadBitsCache, uiTotalCoeff, uiTrailingOnes)) == -1) {
|
||||
return ERR_INFO_CAVLC_INVALID_LEVEL;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_LEVEL);
|
||||
}
|
||||
iUsedBits += i;
|
||||
if (uiTotalCoeff < iMaxNumCoeff) {
|
||||
@ -864,10 +864,10 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
|
||||
}
|
||||
|
||||
if ((iZerosLeft < 0) || ((iZerosLeft + uiTotalCoeff) > iMaxNumCoeff)) {
|
||||
return ERR_INFO_CAVLC_INVALID_ZERO_LEFT;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_ZERO_LEFT);
|
||||
}
|
||||
if ((i = CavlcGetRunBefore (iRun, &sReadBitsCache, uiTotalCoeff, pVlcTable, iZerosLeft)) == -1) {
|
||||
return ERR_INFO_CAVLC_INVALID_RUN_BEFORE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_RUN_BEFORE);
|
||||
}
|
||||
iUsedBits += i;
|
||||
pBs->iIndex += iUsedBits;
|
||||
@ -898,7 +898,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCache, PBitStringAux pBs, int32_t iIndex,
|
||||
@ -951,13 +951,13 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
|
||||
}
|
||||
if (0 == uiTotalCoeff) {
|
||||
pBs->iIndex += iUsedBits;
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
if ((uiTrailingOnes > 3) || (uiTotalCoeff > 16)) { /////////////////check uiTrailingOnes and uiTotalCoeff
|
||||
return ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES);
|
||||
}
|
||||
if ((i = CavlcGetLevelVal (iLevel, &sReadBitsCache, uiTotalCoeff, uiTrailingOnes)) == -1) {
|
||||
return ERR_INFO_CAVLC_INVALID_LEVEL;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_LEVEL);
|
||||
}
|
||||
iUsedBits += i;
|
||||
if (uiTotalCoeff < iMaxNumCoeff) {
|
||||
@ -967,10 +967,10 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
|
||||
}
|
||||
|
||||
if ((iZerosLeft < 0) || ((iZerosLeft + uiTotalCoeff) > iMaxNumCoeff)) {
|
||||
return ERR_INFO_CAVLC_INVALID_ZERO_LEFT;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_ZERO_LEFT);
|
||||
}
|
||||
if ((i = CavlcGetRunBefore (iRun, &sReadBitsCache, uiTotalCoeff, pVlcTable, iZerosLeft)) == -1) {
|
||||
return ERR_INFO_CAVLC_INVALID_RUN_BEFORE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_RUN_BEFORE);
|
||||
}
|
||||
iUsedBits += i;
|
||||
pBs->iIndex += iUsedBits;
|
||||
@ -985,7 +985,7 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
|
||||
: ((iLevel[i] * kpDequantCoeff[j] + (1 << (5 - uiQp / 6))) >> (6 - uiQp / 6));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30],
|
||||
@ -1026,7 +1026,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
iRefIdx = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx]
|
||||
@ -1067,7 +1067,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
iRefIdx[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
|
||||
@ -1104,7 +1104,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
iRefIdx[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
|
||||
@ -1142,7 +1142,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //sub_mb_type[ mbPartIdx ]
|
||||
uiSubMbType = uiCode;
|
||||
if (uiSubMbType >= 4) { //invalid uiSubMbType
|
||||
return ERR_INFO_INVALID_SUB_MB_TYPE;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_SUB_MB_TYPE);
|
||||
}
|
||||
pCurDqLayer->pSubMbType[iMbXy][i] = g_ksInterSubMbTypeInfo[uiSubMbType].iType;
|
||||
iSubPartCount[i] = g_ksInterSubMbTypeInfo[uiSubMbType].iPartCount;
|
||||
@ -1176,7 +1176,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
iRefIdx[i] = 0;
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
} else {
|
||||
return ERR_INFO_INVALID_REF_INDEX;
|
||||
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
|
||||
}
|
||||
}
|
||||
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
|
||||
@ -1245,7 +1245,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
} // namespace WelsDec
|
||||
|
Loading…
Reference in New Issue
Block a user