clean and comment some API. move the SKIP mv pred location remove the unused buffer in intra construction.
Unified · Split
| @@ -94,6 +94,7 @@ class ISVCDecoder { · 93 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | /* |
| 96 | 96 | * src must be 4 byte aligned, recommend 16 byte aligned. the available src size must be multiple of 4. |
| 97 | + * this API does not work for now!! This is for future use to support non-I420 color format output. | |
| 97 | 98 | */ |
| 98 | 99 | virtual DECODING_STATE DecodeFrameEx (const unsigned char* pSrc, |
| 99 | 100 | const int iSrcLen, |
| @@ -91,10 +91,9 @@ typedef enum { · 90 unmodified lines | ||
| 91 | 91 | ENCODER_OPTION_CURRENT_PATH |
| 92 | 92 | } ENCODER_OPTION; |
| 93 | 93 | |
| 94 | −/* Option types introduced in SVC decoder application */ | |
| 94 | +/* Option types introduced in decoder application */ | |
| 95 | 95 | typedef enum { |
| 96 | 96 | DECODER_OPTION_DATAFORMAT = 0, /* Set color space of decoding output frame */ |
| 97 | − DECODER_OPTION_TRUNCATED_MODE, /* Used in decoding bitstream of non integrated frame, only truncated working mode is supported by tune, so skip it */ | |
| 98 | 97 | DECODER_OPTION_END_OF_STREAM, /* Indicate bitstream of the final frame to be decoded */ |
| 99 | 98 | DECODER_OPTION_VCL_NAL, //feedback whether or not have VCL NAL in current AU for application layer |
| 100 | 99 | DECODER_OPTION_TEMPORAL_ID, //feedback temporal id for application layer |
| @@ -71,10 +71,17 @@ void_t UpdateP8x16MotionInfo (PDqLayer pCurDqLayer, int16_t iMotionVector[LIST_A · 70 unmodified lines | ||
| 71 | 71 | int8_t iRefIndex[LIST_A][30], |
| 72 | 72 | int32_t iPartIdx, int8_t iRef, int16_t iMVs[2]); |
| 73 | 73 | |
| 74 | +/*! | |
| 75 | + * \brief get the motion predictor for skip mode | |
| 76 | + * \param | |
| 77 | + * \param output iMvp[] | |
| 78 | + */ | |
| 79 | +void_t PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]); | |
| 80 | + | |
| 74 | 81 | /*! |
| 75 | 82 | * \brief get the motion predictor for 4*4 or 8*8 or 16*16 block |
| 76 | 83 | * \param |
| 77 | − * \param output mvp_x and mvp_y | |
| 84 | + * \param output iMvp[] | |
| 78 | 85 | */ |
| 79 | 86 | void_t PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30], |
| 80 | 87 | int32_t iPartIdx, int32_t iPartWidth, int8_t iRef, int16_t iMVP[2]); |
| @@ -143,7 +143,6 @@ void_t WelsFillCacheConstrain1Intra4x4 (PNeighAvail pNeighAvail, uint8_t* pNonZe · 142 unmodified lines | ||
| 143 | 143 | void_t WelsFillCacheInter (PNeighAvail pNeighAvail, uint8_t* pNonZeroCount, |
| 144 | 144 | int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], PDqLayer pCurLayer); |
| 145 | 145 | |
| 146 | −void_t PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]); | |
| 147 | 146 | |
| 148 | 147 | /*! |
| 149 | 148 | * \brief check iPredMode for intra16x16 eligible or not |
| @@ -155,14 +155,6 @@ SI_SLICE = 4, · 154 unmodified lines | ||
| 155 | 155 | UNKNOWN_SLICE = 5 |
| 156 | 156 | } ESliceType; |
| 157 | 157 | |
| 158 | −/* Slice Types in scalable extension */ | |
| 159 | −typedef uint8_t SliceTypeExt; | |
| 160 | −enum { | |
| 161 | −EP_SLICE = 0, // EP_SLICE: 0, 5 | |
| 162 | −EB_SLICE = 1, // EB_SLICE: 1, 6 | |
| 163 | −EI_SLICE = 2 // EI_SLICE: 2, 7 | |
| 164 | −}; | |
| 165 | − | |
| 166 | 158 | /* List Index */ |
| 167 | 159 | typedef uint8_t ListIndex; |
| 168 | 160 | enum { |
| @@ -247,27 +247,17 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 246 unmodified lines | ||
| 247 | 247 | //seems IPCM should not enter this path |
| 248 | 248 | int32_t iMbXy = pCurLayer->iMbXyIndex; |
| 249 | 249 | |
| 250 | − FORCE_STACK_ALIGN_1D (int16_t, pTempScaledTCoeff, MB_COEFF_LIST_SIZE, 16); | |
| 251 | − | |
| 252 | − memcpy (pTempScaledTCoeff, pCurLayer->pScaledTCoeff[iMbXy], 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0])); | |
| 253 | − | |
| 254 | 250 | WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer); |
| 255 | 251 | |
| 256 | 252 | if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) { |
| 257 | − int32_t i, j; | |
| 258 | − // really need? | |
| 259 | − for (i = 0; i < 16; i++) { | |
| 260 | − j = g_kuiLumaDcZigzagScan[i]; | |
| 261 | − pTempScaledTCoeff[j] = pCurLayer->pScaledTCoeff[iMbXy][j]; | |
| 262 | − } | |
| 263 | − WelsLumaDcDequantIdct (pTempScaledTCoeff, pCurLayer->pLumaQp[iMbXy]); | |
| 264 | − RecI16x16Mb (iMbXy, pCtx, pTempScaledTCoeff, pCurLayer); | |
| 253 | + WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy]); | |
| 254 | + RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); | |
| 265 | 255 | |
| 266 | 256 | return 0; |
| 267 | 257 | } |
| 268 | 258 | |
| 269 | 259 | if (IS_INTRA4x4 (pCurLayer->pMbType[iMbXy])) |
| 270 | − RecI4x4Mb (iMbXy, pCtx, pTempScaledTCoeff, pCurLayer); | |
| 260 | + RecI4x4Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); | |
| 271 | 261 | |
| 272 | 262 | return 0; |
| 273 | 263 | } |
| @@ -628,17 +628,6 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 627 unmodified lines | ||
| 628 | 628 | pSliceHead->uiRefCount[1] = pPps->uiNumRefIdxL1Active; |
| 629 | 629 | if (kbExtensionFlag) { |
| 630 | 630 | uiQualityId = pNalHeaderExt->uiQualityId; |
| 631 | − if (BASE_QUALITY_ID == uiQualityId && (EP_SLICE == uiSliceType || EB_SLICE == uiSliceType)) { | |
| 632 | − const bool_t kbBipredFlag = (EB_SLICE == uiSliceType); | |
| 633 | − if (kbBipredFlag) { | |
| 634 | − WelsLog (pCtx, WELS_LOG_WARNING, "ParseSliceHeaderSyntaxs(): kbBipredFlag = 1 not supported.\n"); | |
| 635 | − return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_BIPRED); | |
| 636 | − } | |
| 637 | − pSliceHead->bNumRefIdxActiveOverrideFlag = !!BsGetOneBit (pBs); | |
| 638 | − if (pSliceHead->bNumRefIdxActiveOverrideFlag) { | |
| 639 | − pSliceHead->uiRefCount[0] = 1 + BsGetUe (pBs); | |
| 640 | − } | |
| 641 | − } | |
| 642 | 631 | } else if (uiSliceType == P_SLICE || uiSliceType == SP_SLICE || uiSliceType == B_SLICE) { |
| 643 | 632 | const bool_t kbBipredFlag = (B_SLICE == uiSliceType); |
| 644 | 633 | if (kbBipredFlag) { |
| @@ -43,6 +43,155 @@ · 42 unmodified lines | ||
| 43 | 43 | #include "mb_cache.h" |
| 44 | 44 | |
| 45 | 45 | namespace WelsDec { |
| 46 | +void_t PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]) { | |
| 47 | + bool_t bTopAvail, bLeftTopAvail, bRightTopAvail, bLeftAvail; | |
| 48 | + | |
| 49 | + int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc; | |
| 50 | + int32_t iLeftTopType, iRightTopType, iTopType, iLeftType; | |
| 51 | + int32_t iCurX, iCurY, iCurXy, iLeftXy, iTopXy, iLeftTopXy, iRightTopXy; | |
| 52 | + | |
| 53 | + int8_t iLeftRef; | |
| 54 | + int8_t iTopRef; | |
| 55 | + int8_t iRightTopRef; | |
| 56 | + int8_t iLeftTopRef; | |
| 57 | + int8_t iDiagonalRef; | |
| 58 | + int8_t iMatchRef; | |
| 59 | + int16_t iMvA[2], iMvB[2], iMvC[2], iMvD[2]; | |
| 60 | + | |
| 61 | + iCurXy = pCurLayer->iMbXyIndex; | |
| 62 | + iCurX = pCurLayer->iMbX; | |
| 63 | + iCurY = pCurLayer->iMbY; | |
| 64 | + iCurSliceIdc = pCurLayer->pSliceIdc[iCurXy]; | |
| 65 | + | |
| 66 | + if (iCurX != 0) { | |
| 67 | + iLeftXy = iCurXy - 1; | |
| 68 | + iLeftSliceIdc = pCurLayer->pSliceIdc[iLeftXy]; | |
| 69 | + bLeftAvail = (iLeftSliceIdc == iCurSliceIdc); | |
| 70 | + } else { | |
| 71 | + bLeftAvail = 0; | |
| 72 | + bLeftTopAvail = 0; | |
| 73 | + } | |
| 74 | + | |
| 75 | + if (iCurY != 0) { | |
| 76 | + iTopXy = iCurXy - pCurLayer->iMbWidth; | |
| 77 | + iTopSliceIdc = pCurLayer->pSliceIdc[iTopXy]; | |
| 78 | + bTopAvail = (iTopSliceIdc == iCurSliceIdc); | |
| 79 | + if (iCurX != 0) { | |
| 80 | + iLeftTopXy = iTopXy - 1; | |
| 81 | + iLeftTopSliceIdc = pCurLayer->pSliceIdc[iLeftTopXy]; | |
| 82 | + bLeftTopAvail = (iLeftTopSliceIdc == iCurSliceIdc); | |
| 83 | + } else { | |
| 84 | + bLeftTopAvail = 0; | |
| 85 | + } | |
| 86 | + if (iCurX != (pCurLayer->iMbWidth - 1)) { | |
| 87 | + iRightTopXy = iTopXy + 1; | |
| 88 | + iRightTopSliceIdc = pCurLayer->pSliceIdc[iRightTopXy]; | |
| 89 | + bRightTopAvail = (iRightTopSliceIdc == iCurSliceIdc); | |
| 90 | + } else { | |
| 91 | + bRightTopAvail = 0; | |
| 92 | + } | |
| 93 | + } else { | |
| 94 | + bTopAvail = 0; | |
| 95 | + bLeftTopAvail = 0; | |
| 96 | + bRightTopAvail = 0; | |
| 97 | + } | |
| 98 | + | |
| 99 | + iLeftType = ((iCurX != 0 && bLeftAvail) ? pCurLayer->pMbType[iLeftXy] : 0); | |
| 100 | + iTopType = ((iCurY != 0 && bTopAvail) ? pCurLayer->pMbType[iTopXy] : 0); | |
| 101 | + iLeftTopType = ((iCurX != 0 && iCurY != 0 && bLeftTopAvail) | |
| 102 | + ? pCurLayer->pMbType[iLeftTopXy] : 0); | |
| 103 | + iRightTopType = ((iCurX != pCurLayer->iMbWidth - 1 && iCurY != 0 && bRightTopAvail) | |
| 104 | + ? pCurLayer->pMbType[iRightTopXy] : 0); | |
| 105 | + | |
| 106 | + /*get neb mv&iRefIdxArray*/ | |
| 107 | + /*left*/ | |
| 108 | + if (bLeftAvail && IS_INTER (iLeftType)) { | |
| 109 | + ST32 (iMvA, LD32 (pCurLayer->pMv[0][iLeftXy][3])); | |
| 110 | + iLeftRef = pCurLayer->pRefIndex[0][iLeftXy][3]; | |
| 111 | + } else { | |
| 112 | + ST32 (iMvA, 0); | |
| 113 | + if (0 == bLeftAvail) { //not available | |
| 114 | + iLeftRef = REF_NOT_AVAIL; | |
| 115 | + } else { //available but is intra mb type | |
| 116 | + iLeftRef = REF_NOT_IN_LIST; | |
| 117 | + } | |
| 118 | + } | |
| 119 | + if (REF_NOT_AVAIL == iLeftRef || | |
| 120 | + (0 == iLeftRef && 0 == * (int32_t*)iMvA)) { | |
| 121 | + ST32 (iMvp, 0); | |
| 122 | + return; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /*top*/ | |
| 126 | + if (bTopAvail && IS_INTER (iTopType)) { | |
| 127 | + ST32 (iMvB, LD32 (pCurLayer->pMv[0][iTopXy][12])); | |
| 128 | + iTopRef = pCurLayer->pRefIndex[0][iTopXy][12]; | |
| 129 | + } else { | |
| 130 | + ST32 (iMvB, 0); | |
| 131 | + if (0 == bTopAvail) { //not available | |
| 132 | + iTopRef = REF_NOT_AVAIL; | |
| 133 | + } else { //available but is intra mb type | |
| 134 | + iTopRef = REF_NOT_IN_LIST; | |
| 135 | + } | |
| 136 | + } | |
| 137 | + if (REF_NOT_AVAIL == iTopRef || | |
| 138 | + (0 == iTopRef && 0 == * (int32_t*)iMvB)) { | |
| 139 | + ST32 (iMvp, 0); | |
| 140 | + return; | |
| 141 | + } | |
| 142 | + | |
| 143 | + /*right_top*/ | |
| 144 | + if (bRightTopAvail && IS_INTER (iRightTopType)) { | |
| 145 | + ST32 (iMvC, LD32 (pCurLayer->pMv[0][iRightTopXy][12])); | |
| 146 | + iRightTopRef = pCurLayer->pRefIndex[0][iRightTopXy][12]; | |
| 147 | + } else { | |
| 148 | + ST32 (iMvC, 0); | |
| 149 | + if (0 == bRightTopAvail) { //not available | |
| 150 | + iRightTopRef = REF_NOT_AVAIL; | |
| 151 | + } else { //available but is intra mb type | |
| 152 | + iRightTopRef = REF_NOT_IN_LIST; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | + /*left_top*/ | |
| 157 | + if (bLeftTopAvail && IS_INTER (iLeftTopType)) { | |
| 158 | + ST32 (iMvD, LD32 (pCurLayer->pMv[0][iLeftTopXy][15])); | |
| 159 | + iLeftTopRef = pCurLayer->pRefIndex[0][iLeftTopXy][15]; | |
| 160 | + } else { | |
| 161 | + ST32 (iMvD, 0); | |
| 162 | + if (0 == bLeftTopAvail) { //not available | |
| 163 | + iLeftTopRef = REF_NOT_AVAIL; | |
| 164 | + } else { //available but is intra mb type | |
| 165 | + iLeftTopRef = REF_NOT_IN_LIST; | |
| 166 | + } | |
| 167 | + } | |
| 168 | + | |
| 169 | + iDiagonalRef = iRightTopRef; | |
| 170 | + if (REF_NOT_AVAIL == iDiagonalRef) { | |
| 171 | + iDiagonalRef = iLeftTopRef; | |
| 172 | + * (int32_t*)iMvC = * (int32_t*)iMvD; | |
| 173 | + } | |
| 174 | + | |
| 175 | + if (REF_NOT_AVAIL == iTopRef && REF_NOT_AVAIL == iDiagonalRef && iLeftRef >= REF_NOT_IN_LIST) { | |
| 176 | + ST32 (iMvp, LD32 (iMvA)); | |
| 177 | + return; | |
| 178 | + } | |
| 179 | + | |
| 180 | + iMatchRef = (0 == iLeftRef) + (0 == iTopRef) + (0 == iDiagonalRef); | |
| 181 | + if (1 == iMatchRef) { | |
| 182 | + if (0 == iLeftRef) { | |
| 183 | + ST32 (iMvp, LD32 (iMvA)); | |
| 184 | + } else if (0 == iTopRef) { | |
| 185 | + ST32 (iMvp, LD32 (iMvB)); | |
| 186 | + } else { | |
| 187 | + ST32 (iMvp, LD32 (iMvC)); | |
| 188 | + } | |
| 189 | + } else { | |
| 190 | + iMvp[0] = WelsMedian (iMvA[0], iMvB[0], iMvC[0]); | |
| 191 | + iMvp[1] = WelsMedian (iMvA[1], iMvB[1], iMvC[1]); | |
| 192 | + } | |
| 193 | +} | |
| 194 | + | |
| 46 | 195 | |
| 47 | 196 | //basic iMVs prediction unit for iMVs partition width (4, 2, 1) |
| 48 | 197 | void_t PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30], |
| @@ -52,155 +52,6 @@ · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | namespace WelsDec { |
| 54 | 54 | |
| 55 | −void_t PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]) { | |
| 56 | − bool_t bTopAvail, bLeftTopAvail, bRightTopAvail, bLeftAvail; | |
| 57 | − | |
| 58 | − int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc; | |
| 59 | − int32_t iLeftTopType, iRightTopType, iTopType, iLeftType; | |
| 60 | − int32_t iCurX, iCurY, iCurXy, iLeftXy, iTopXy, iLeftTopXy, iRightTopXy; | |
| 61 | − | |
| 62 | − int8_t iLeftRef; | |
| 63 | − int8_t iTopRef; | |
| 64 | − int8_t iRightTopRef; | |
| 65 | − int8_t iLeftTopRef; | |
| 66 | − int8_t iDiagonalRef; | |
| 67 | − int8_t iMatchRef; | |
| 68 | − int16_t iMvA[2], iMvB[2], iMvC[2], iMvD[2]; | |
| 69 | − | |
| 70 | − iCurXy = pCurLayer->iMbXyIndex; | |
| 71 | − iCurX = pCurLayer->iMbX; | |
| 72 | − iCurY = pCurLayer->iMbY; | |
| 73 | − iCurSliceIdc = pCurLayer->pSliceIdc[iCurXy]; | |
| 74 | − | |
| 75 | − if (iCurX != 0) { | |
| 76 | − iLeftXy = iCurXy - 1; | |
| 77 | − iLeftSliceIdc = pCurLayer->pSliceIdc[iLeftXy]; | |
| 78 | − bLeftAvail = (iLeftSliceIdc == iCurSliceIdc); | |
| 79 | − } else { | |
| 80 | − bLeftAvail = 0; | |
| 81 | − bLeftTopAvail = 0; | |
| 82 | − } | |
| 83 | − | |
| 84 | − if (iCurY != 0) { | |
| 85 | − iTopXy = iCurXy - pCurLayer->iMbWidth; | |
| 86 | − iTopSliceIdc = pCurLayer->pSliceIdc[iTopXy]; | |
| 87 | − bTopAvail = (iTopSliceIdc == iCurSliceIdc); | |
| 88 | − if (iCurX != 0) { | |
| 89 | − iLeftTopXy = iTopXy - 1; | |
| 90 | − iLeftTopSliceIdc = pCurLayer->pSliceIdc[iLeftTopXy]; | |
| 91 | − bLeftTopAvail = (iLeftTopSliceIdc == iCurSliceIdc); | |
| 92 | − } else { | |
| 93 | − bLeftTopAvail = 0; | |
| 94 | − } | |
| 95 | − if (iCurX != (pCurLayer->iMbWidth - 1)) { | |
| 96 | − iRightTopXy = iTopXy + 1; | |
| 97 | − iRightTopSliceIdc = pCurLayer->pSliceIdc[iRightTopXy]; | |
| 98 | − bRightTopAvail = (iRightTopSliceIdc == iCurSliceIdc); | |
| 99 | − } else { | |
| 100 | − bRightTopAvail = 0; | |
| 101 | − } | |
| 102 | − } else { | |
| 103 | − bTopAvail = 0; | |
| 104 | − bLeftTopAvail = 0; | |
| 105 | − bRightTopAvail = 0; | |
| 106 | − } | |
| 107 | − | |
| 108 | − iLeftType = ((iCurX != 0 && bLeftAvail) ? pCurLayer->pMbType[iLeftXy] : 0); | |
| 109 | − iTopType = ((iCurY != 0 && bTopAvail) ? pCurLayer->pMbType[iTopXy] : 0); | |
| 110 | − iLeftTopType = ((iCurX != 0 && iCurY != 0 && bLeftTopAvail) | |
| 111 | − ? pCurLayer->pMbType[iLeftTopXy] : 0); | |
| 112 | − iRightTopType = ((iCurX != pCurLayer->iMbWidth - 1 && iCurY != 0 && bRightTopAvail) | |
| 113 | − ? pCurLayer->pMbType[iRightTopXy] : 0); | |
| 114 | − | |
| 115 | − /*get neb mv&iRefIdxArray*/ | |
| 116 | − /*left*/ | |
| 117 | − if (bLeftAvail && IS_INTER (iLeftType)) { | |
| 118 | − ST32 (iMvA, LD32 (pCurLayer->pMv[0][iLeftXy][3])); | |
| 119 | − iLeftRef = pCurLayer->pRefIndex[0][iLeftXy][3]; | |
| 120 | − } else { | |
| 121 | − ST32 (iMvA, 0); | |
| 122 | − if (0 == bLeftAvail) { //not available | |
| 123 | − iLeftRef = REF_NOT_AVAIL; | |
| 124 | − } else { //available but is intra mb type | |
| 125 | − iLeftRef = REF_NOT_IN_LIST; | |
| 126 | − } | |
| 127 | − } | |
| 128 | − if (REF_NOT_AVAIL == iLeftRef || | |
| 129 | − (0 == iLeftRef && 0 == * (int32_t*)iMvA)) { | |
| 130 | − ST32 (iMvp, 0); | |
| 131 | − return; | |
| 132 | − } | |
| 133 | − | |
| 134 | − /*top*/ | |
| 135 | − if (bTopAvail && IS_INTER (iTopType)) { | |
| 136 | − ST32 (iMvB, LD32 (pCurLayer->pMv[0][iTopXy][12])); | |
| 137 | − iTopRef = pCurLayer->pRefIndex[0][iTopXy][12]; | |
| 138 | − } else { | |
| 139 | − ST32 (iMvB, 0); | |
| 140 | − if (0 == bTopAvail) { //not available | |
| 141 | − iTopRef = REF_NOT_AVAIL; | |
| 142 | − } else { //available but is intra mb type | |
| 143 | − iTopRef = REF_NOT_IN_LIST; | |
| 144 | − } | |
| 145 | − } | |
| 146 | − if (REF_NOT_AVAIL == iTopRef || | |
| 147 | − (0 == iTopRef && 0 == * (int32_t*)iMvB)) { | |
| 148 | − ST32 (iMvp, 0); | |
| 149 | − return; | |
| 150 | − } | |
| 151 | − | |
| 152 | − /*right_top*/ | |
| 153 | − if (bRightTopAvail && IS_INTER (iRightTopType)) { | |
| 154 | − ST32 (iMvC, LD32 (pCurLayer->pMv[0][iRightTopXy][12])); | |
| 155 | − iRightTopRef = pCurLayer->pRefIndex[0][iRightTopXy][12]; | |
| 156 | − } else { | |
| 157 | − ST32 (iMvC, 0); | |
| 158 | − if (0 == bRightTopAvail) { //not available | |
| 159 | − iRightTopRef = REF_NOT_AVAIL; | |
| 160 | − } else { //available but is intra mb type | |
| 161 | − iRightTopRef = REF_NOT_IN_LIST; | |
| 162 | − } | |
| 163 | − } | |
| 164 | − | |
| 165 | − /*left_top*/ | |
| 166 | − if (bLeftTopAvail && IS_INTER (iLeftTopType)) { | |
| 167 | − ST32 (iMvD, LD32 (pCurLayer->pMv[0][iLeftTopXy][15])); | |
| 168 | − iLeftTopRef = pCurLayer->pRefIndex[0][iLeftTopXy][15]; | |
| 169 | − } else { | |
| 170 | − ST32 (iMvD, 0); | |
| 171 | − if (0 == bLeftTopAvail) { //not available | |
| 172 | − iLeftTopRef = REF_NOT_AVAIL; | |
| 173 | − } else { //available but is intra mb type | |
| 174 | − iLeftTopRef = REF_NOT_IN_LIST; | |
| 175 | − } | |
| 176 | − } | |
| 177 | − | |
| 178 | − iDiagonalRef = iRightTopRef; | |
| 179 | − if (REF_NOT_AVAIL == iDiagonalRef) { | |
| 180 | − iDiagonalRef = iLeftTopRef; | |
| 181 | − * (int32_t*)iMvC = * (int32_t*)iMvD; | |
| 182 | − } | |
| 183 | − | |
| 184 | − if (REF_NOT_AVAIL == iTopRef && REF_NOT_AVAIL == iDiagonalRef && iLeftRef >= REF_NOT_IN_LIST) { | |
| 185 | − ST32 (iMvp, LD32 (iMvA)); | |
| 186 | − return; | |
| 187 | − } | |
| 188 | − | |
| 189 | − iMatchRef = (0 == iLeftRef) + (0 == iTopRef) + (0 == iDiagonalRef); | |
| 190 | − if (1 == iMatchRef) { | |
| 191 | − if (0 == iLeftRef) { | |
| 192 | − ST32 (iMvp, LD32 (iMvA)); | |
| 193 | − } else if (0 == iTopRef) { | |
| 194 | − ST32 (iMvp, LD32 (iMvB)); | |
| 195 | − } else { | |
| 196 | − ST32 (iMvp, LD32 (iMvC)); | |
| 197 | − } | |
| 198 | − } else { | |
| 199 | − iMvp[0] = WelsMedian (iMvA[0], iMvB[0], iMvC[0]); | |
| 200 | − iMvp[1] = WelsMedian (iMvA[1], iMvB[1], iMvC[1]); | |
| 201 | − } | |
| 202 | −} | |
| 203 | − | |
| 204 | 55 | void_t GetNeighborAvailMbType (PNeighAvail pNeighAvail, PDqLayer pCurLayer) { |
| 205 | 56 | int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc; |
| 206 | 57 | int32_t iCurXy, iTopXy, iLeftXy, iLeftTopXy, iRightTopXy; |