clean and comment some API. move the SKIP mv pred location remove the unused buffer in intra construction.
Showing the changes to codec/decoder/core/src/parse_mb_syn_cavlc.cpp (1 of 9 files). Show all
Unified · Split
| @@ -52,155 +52,6 @@ · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | namespace WelsDec { | 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 | void_t GetNeighborAvailMbType (PNeighAvail pNeighAvail, PDqLayer pCurLayer) { | 55 | void_t GetNeighborAvailMbType (PNeighAvail pNeighAvail, PDqLayer pCurLayer) { |
| 205 | int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc; | 56 | int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc; |
| 206 | int32_t iCurXy, iTopXy, iLeftXy, iLeftTopXy, iRightTopXy; | 57 | int32_t iCurXy, iTopXy, iLeftXy, iLeftTopXy, iRightTopXy; |