| 1064 | } |
| 1065 | |
| 1066 | int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], |
| 1067 | PBitStringAux pBs) { |
| 1068 | PSlice pSlice = &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer; |
| 1069 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1070 | PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0]; |
| 1071 | int32_t iRefCount[2]; |
| 1072 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 1073 | int32_t i, j; |
| 1074 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 1075 | int32_t iMotionPredFlag[4]; |
| 1076 | int16_t iMv[2]; |
| 1077 | uint32_t uiCode; |
| 1078 | int32_t iCode; |
| 1079 | int16_t iMinVmv = pSliceHeader->pSps->pSLevelLimits->iMinVmv; |
| 1080 | int16_t iMaxVmv = pSliceHeader->pSps->pSLevelLimits->iMaxVmv; |
| 1081 | iMotionPredFlag[0] = iMotionPredFlag[1] = iMotionPredFlag[2] = iMotionPredFlag[3] = |
| 1082 | pSlice->sSliceHeaderExt.bDefaultMotionPredFlag; |
| 1083 | iRefCount[0] = pSliceHeader->uiRefCount[0]; |
| 1084 | iRefCount[1] = pSliceHeader->uiRefCount[1]; |
| 1085 | |
| 1086 | bool bIsPending = GetThreadCount (pCtx) > 1; |
| 1087 | |
| 1088 | switch (pCurDqLayer->pDec->pMbType[iMbXy]) { |
| 1089 | case MB_TYPE_16x16: { |
| 1090 | int32_t iRefIdx = 0; |
| 1091 | if (pSlice->sSliceHeaderExt.bAdaptiveMotionPredFlag) { |
| 1092 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //motion_prediction_flag_l0[ mbPartIdx ] |
| 1093 | iMotionPredFlag[0] = uiCode; |
| 1094 | } |
| 1095 | if (iMotionPredFlag[0] == 0) { |
| 1096 | WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //motion_prediction_flag_l1[ mbPartIdx ] |
| 1097 | iRefIdx = uiCode; |
| 1098 | // Security check: iRefIdx should be in range 0 to num_ref_idx_l0_active_minus1, includsive |
| 1099 | // ref to standard section 7.4.5.1. iRefCount[0] is 1 + num_ref_idx_l0_active_minus1. |
| 1100 | if ((iRefIdx < 0) || (iRefIdx >= iRefCount[0]) || (ppRefPic[iRefIdx] == NULL)) { //error ref_idx |
| 1101 | pCtx->bMbRefConcealed = true; |
| 1102 | if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) { |
| 1103 | iRefIdx = 0; |
| 1104 | pCtx->iErrorCode |= dsBitstreamError; |
| 1105 | } else { |
| 1106 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX); |
| 1107 | } |
| 1108 | } |
| 1109 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx] |
| 1110 | && (ppRefPic[iRefIdx]->bIsComplete || bIsPending)); |
| 1111 | } else { |
| 1112 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "inter parse: iMotionPredFlag = 1 not supported. "); |
| 1113 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP); |
| 1114 | } |
| 1115 | PredMv (iMvArray, iRefIdxArray, LIST_0, 0, 4, iRefIdx, iMv); |
| 1116 | |
| 1117 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mvd_l0[ mbPartIdx ][ 0 ][ compIdx ] |
| 1118 | iMv[0] += iCode; |
| 1119 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mvd_l1[ mbPartIdx ][ 0 ][ compIdx ] |
| 1120 | iMv[1] += iCode; |
| 1121 | WELS_CHECK_SE_BOTH_WARNING (iMv[1], iMinVmv, iMaxVmv, "vertical mv"); |
| 1122 | UpdateP16x16MotionInfo (pCurDqLayer, LIST_0, iRefIdx, iMv); |
| 1123 | } |
no test coverage detected