Showing the changes to codec/decoder/core/src/mc.cpp (1 of 225 files). Show all
Unified · Split
| @@ -46,711 +46,624 @@ · 45 unmodified lines | ||
| 46 | 46 | namespace WelsDec { |
| 47 | 47 | |
| 48 | 48 | /*------------------weight for chroma fraction pixel interpolation------------------*/ |
| 49 | −//iA = (8 - dx) * (8 - dy); | |
| 50 | −//iB = dx * (8 - dy); | |
| 49 | +//iA = (8 - dx) * (8 - dy); | |
| 50 | +//iB = dx * (8 - dy); | |
| 51 | 51 | //iC = (8 - dx) * dy; |
| 52 | 52 | //iD = dx * dy |
| 53 | −static const uint8_t g_kuiABCD[8][8][4] = //g_kA[dy][dx], g_kB[dy][dx], g_kC[dy][dx], g_kD[dy][dx] | |
| 54 | −{ | |
| 55 | − { | |
| 56 | − {64, 0, 0, 0},{56, 8, 0, 0},{48, 16, 0, 0},{40, 24, 0, 0}, | |
| 57 | − {32, 32, 0, 0},{24, 40, 0, 0},{16, 48, 0, 0},{8, 56, 0, 0} | |
| 58 | − }, | |
| 59 | − { | |
| 60 | − {56, 0, 8, 0},{49, 7, 7, 1},{42, 14, 6, 2},{35, 21, 5, 3}, | |
| 61 | − {28, 28, 4, 4},{21, 35, 3, 5},{14, 42, 2, 6},{7, 49, 1, 7} | |
| 62 | − }, | |
| 63 | − { | |
| 64 | − {48, 0, 16, 0},{42, 6, 14, 2},{36, 12, 12, 4},{30, 18, 10, 6}, | |
| 65 | − {24, 24, 8, 8},{18, 30, 6, 10},{12, 36, 4, 12},{6, 42, 2, 14} | |
| 66 | − }, | |
| 67 | − { | |
| 68 | − {40, 0, 24, 0},{35, 5, 21, 3},{30, 10, 18, 6},{25, 15, 15, 9}, | |
| 69 | − {20, 20, 12, 12},{15, 25, 9, 15},{10, 30, 6, 18},{5, 35, 3, 21} | |
| 70 | − }, | |
| 71 | − { | |
| 72 | − {32, 0, 32, 0},{28, 4, 28, 4},{24, 8, 24, 8},{20, 12, 20, 12}, | |
| 73 | − {16, 16, 16, 16},{12, 20, 12, 20},{8, 24, 8, 24},{4, 28, 4, 28} | |
| 74 | − }, | |
| 75 | − { | |
| 76 | − {24, 0, 40, 0},{21, 3, 35, 5},{18, 6, 30, 10},{15, 9, 25, 15}, | |
| 77 | − {12, 12, 20, 20},{9, 15, 15, 25},{6, 18, 10, 30},{3, 21, 5, 35} | |
| 78 | − }, | |
| 79 | − { | |
| 80 | − {16, 0, 48, 0},{14, 2, 42, 6},{12, 4, 36, 12},{10, 6, 30, 18}, | |
| 81 | − {8, 8, 24, 24},{6, 10, 18, 30},{4, 12, 12, 36},{2, 14, 6, 42} | |
| 82 | − }, | |
| 83 | − { | |
| 84 | − {8, 0, 56, 0},{7, 1, 49, 7},{6, 2, 42, 14},{5, 3, 35, 21}, | |
| 85 | − {4, 4, 28, 28},{3, 5, 21, 35},{2, 6, 14, 42},{1, 7, 7, 49} | |
| 86 | − } | |
| 53 | +static const uint8_t g_kuiABCD[8][8][4] = { //g_kA[dy][dx], g_kB[dy][dx], g_kC[dy][dx], g_kD[dy][dx] | |
| 54 | + { | |
| 55 | + {64, 0, 0, 0}, {56, 8, 0, 0}, {48, 16, 0, 0}, {40, 24, 0, 0}, | |
| 56 | + {32, 32, 0, 0}, {24, 40, 0, 0}, {16, 48, 0, 0}, {8, 56, 0, 0} | |
| 57 | + }, | |
| 58 | + { | |
| 59 | + {56, 0, 8, 0}, {49, 7, 7, 1}, {42, 14, 6, 2}, {35, 21, 5, 3}, | |
| 60 | + {28, 28, 4, 4}, {21, 35, 3, 5}, {14, 42, 2, 6}, {7, 49, 1, 7} | |
| 61 | + }, | |
| 62 | + { | |
| 63 | + {48, 0, 16, 0}, {42, 6, 14, 2}, {36, 12, 12, 4}, {30, 18, 10, 6}, | |
| 64 | + {24, 24, 8, 8}, {18, 30, 6, 10}, {12, 36, 4, 12}, {6, 42, 2, 14} | |
| 65 | + }, | |
| 66 | + { | |
| 67 | + {40, 0, 24, 0}, {35, 5, 21, 3}, {30, 10, 18, 6}, {25, 15, 15, 9}, | |
| 68 | + {20, 20, 12, 12}, {15, 25, 9, 15}, {10, 30, 6, 18}, {5, 35, 3, 21} | |
| 69 | + }, | |
| 70 | + { | |
| 71 | + {32, 0, 32, 0}, {28, 4, 28, 4}, {24, 8, 24, 8}, {20, 12, 20, 12}, | |
| 72 | + {16, 16, 16, 16}, {12, 20, 12, 20}, {8, 24, 8, 24}, {4, 28, 4, 28} | |
| 73 | + }, | |
| 74 | + { | |
| 75 | + {24, 0, 40, 0}, {21, 3, 35, 5}, {18, 6, 30, 10}, {15, 9, 25, 15}, | |
| 76 | + {12, 12, 20, 20}, {9, 15, 15, 25}, {6, 18, 10, 30}, {3, 21, 5, 35} | |
| 77 | + }, | |
| 78 | + { | |
| 79 | + {16, 0, 48, 0}, {14, 2, 42, 6}, {12, 4, 36, 12}, {10, 6, 30, 18}, | |
| 80 | + {8, 8, 24, 24}, {6, 10, 18, 30}, {4, 12, 12, 36}, {2, 14, 6, 42} | |
| 81 | + }, | |
| 82 | + { | |
| 83 | + {8, 0, 56, 0}, {7, 1, 49, 7}, {6, 2, 42, 14}, {5, 3, 35, 21}, | |
| 84 | + {4, 4, 28, 28}, {3, 5, 21, 35}, {2, 6, 14, 42}, {1, 7, 7, 49} | |
| 85 | + } | |
| 87 | 86 | }; |
| 88 | 87 | |
| 89 | −typedef void_t (*PWelsMcWidthHeightFunc)(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight); | |
| 88 | +typedef void_t (*PWelsMcWidthHeightFunc) (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 89 | + int32_t iWidth, int32_t iHeight); | |
| 90 | 90 | |
| 91 | 91 | //***************************************************************************// |
| 92 | 92 | // C code implementation // |
| 93 | 93 | //***************************************************************************// |
| 94 | −static inline void_t McCopyWidthEq2_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) | |
| 95 | −{ | |
| 96 | − int32_t i; | |
| 97 | − for (i = 0; i < iHeight; i++)// iWidth == 2 only for chroma | |
| 98 | − { | |
| 99 | − ST16(pDst, LD16(pSrc)); | |
| 100 | − pDst += iDstStride; | |
| 101 | − pSrc += iSrcStride; | |
| 102 | − } | |
| 103 | −} | |
| 104 | − | |
| 105 | −static inline void_t McCopyWidthEq4_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) | |
| 106 | −{ | |
| 107 | − int32_t i; | |
| 108 | − for (i = 0; i < iHeight; i++) | |
| 109 | − { | |
| 110 | − ST32(pDst, LD32(pSrc)); | |
| 111 | − pDst += iDstStride; | |
| 112 | − pSrc += iSrcStride; | |
| 113 | − } | |
| 114 | −} | |
| 115 | − | |
| 116 | −static inline void_t McCopyWidthEq8_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) | |
| 117 | −{ | |
| 118 | − int32_t i; | |
| 119 | − for (i = 0; i < iHeight; i++) | |
| 120 | − { | |
| 121 | − ST64(pDst, LD64(pSrc)); | |
| 122 | − pDst += iDstStride; | |
| 123 | − pSrc += iSrcStride; | |
| 124 | − } | |
| 125 | −} | |
| 126 | − | |
| 127 | −static inline void_t McCopyWidthEq16_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) | |
| 128 | −{ | |
| 129 | − int32_t i; | |
| 130 | − for (i = 0; i < iHeight; i++) | |
| 131 | − { | |
| 132 | − ST64(pDst , LD64(pSrc)); | |
| 133 | − ST64(pDst+8, LD64(pSrc+8)); | |
| 134 | − pDst += iDstStride; | |
| 135 | − pSrc += iSrcStride; | |
| 136 | − } | |
| 94 | +static inline void_t McCopyWidthEq2_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 95 | + int32_t iHeight) { | |
| 96 | + int32_t i; | |
| 97 | + for (i = 0; i < iHeight; i++) { // iWidth == 2 only for chroma | |
| 98 | + ST16 (pDst, LD16 (pSrc)); | |
| 99 | + pDst += iDstStride; | |
| 100 | + pSrc += iSrcStride; | |
| 101 | + } | |
| 102 | +} | |
| 103 | + | |
| 104 | +static inline void_t McCopyWidthEq4_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 105 | + int32_t iHeight) { | |
| 106 | + int32_t i; | |
| 107 | + for (i = 0; i < iHeight; i++) { | |
| 108 | + ST32 (pDst, LD32 (pSrc)); | |
| 109 | + pDst += iDstStride; | |
| 110 | + pSrc += iSrcStride; | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |
| 114 | +static inline void_t McCopyWidthEq8_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 115 | + int32_t iHeight) { | |
| 116 | + int32_t i; | |
| 117 | + for (i = 0; i < iHeight; i++) { | |
| 118 | + ST64 (pDst, LD64 (pSrc)); | |
| 119 | + pDst += iDstStride; | |
| 120 | + pSrc += iSrcStride; | |
| 121 | + } | |
| 122 | +} | |
| 123 | + | |
| 124 | +static inline void_t McCopyWidthEq16_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 125 | + int32_t iHeight) { | |
| 126 | + int32_t i; | |
| 127 | + for (i = 0; i < iHeight; i++) { | |
| 128 | + ST64 (pDst , LD64 (pSrc)); | |
| 129 | + ST64 (pDst + 8, LD64 (pSrc + 8)); | |
| 130 | + pDst += iDstStride; | |
| 131 | + pSrc += iSrcStride; | |
| 132 | + } | |
| 137 | 133 | } |
| 138 | 134 | |
| 139 | 135 | //--------------------Luma sample MC------------------// |
| 140 | 136 | |
| 141 | −static inline int32_t HorFilterInput16bit_c(int16_t* pSrc) | |
| 142 | −{ | |
| 143 | − int32_t iPix05 = pSrc[-2] + pSrc[3]; | |
| 144 | − int32_t iPix14 = pSrc[-1] + pSrc[2]; | |
| 145 | − int32_t iPix23 = pSrc[ 0] + pSrc[1]; | |
| 146 | − | |
| 147 | − return (iPix05 - ((iPix14<<2)+iPix14) + (iPix23<<4) + (iPix23<<2)); | |
| 148 | −} | |
| 149 | −// h: iOffset=1 / v: iOffset=iSrcStride | |
| 150 | −static inline int32_t FilterInput8bitWithStride_c(uint8_t* pSrc, const int32_t kiOffset) | |
| 151 | −{ | |
| 152 | − const int32_t kiOffset1 = kiOffset; | |
| 153 | − const int32_t kiOffset2 = (kiOffset << 1); | |
| 154 | − const int32_t kiOffset3 = kiOffset + kiOffset2; | |
| 155 | − const uint32_t kuiPix05 = *(pSrc - kiOffset2) + *(pSrc + kiOffset3); | |
| 156 | − const uint32_t kuiPix14 = *(pSrc - kiOffset1) + *(pSrc + kiOffset2); | |
| 157 | − const uint32_t kuiPix23 = *(pSrc ) + *(pSrc + kiOffset1); | |
| 137 | +static inline int32_t HorFilterInput16bit_c (int16_t* pSrc) { | |
| 138 | + int32_t iPix05 = pSrc[-2] + pSrc[3]; | |
| 139 | + int32_t iPix14 = pSrc[-1] + pSrc[2]; | |
| 140 | + int32_t iPix23 = pSrc[ 0] + pSrc[1]; | |
| 158 | 141 | |
| 159 | − return (kuiPix05 - ((kuiPix14<<2)+kuiPix14) + (kuiPix23<<4) + (kuiPix23<<2)); | |
| 142 | + return (iPix05 - ((iPix14 << 2) + iPix14) + (iPix23 << 4) + (iPix23 << 2)); | |
| 160 | 143 | } |
| 161 | − | |
| 162 | −static inline void_t PixelAvg_c(uint8_t* pDst, int32_t iDstStride, uint8_t* pSrcA, int32_t iSrcAStride, | |
| 163 | − uint8_t* pSrcB, int32_t iSrcBStride, int32_t iWidth, int32_t iHeight) | |
| 164 | −{ | |
| 165 | − int32_t i, j; | |
| 166 | − for (i = 0; i < iHeight; i++) | |
| 167 | − { | |
| 168 | − for (j = 0; j < iWidth; j++) | |
| 169 | − { | |
| 170 | − pDst[j] = (pSrcA[j] + pSrcB[j] + 1) >> 1; | |
| 171 | − } | |
| 172 | − pDst += iDstStride; | |
| 173 | − pSrcA += iSrcAStride; | |
| 174 | − pSrcB += iSrcBStride; | |
| 175 | − } | |
| 176 | −} | |
| 177 | −static inline void_t McCopy_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 178 | −{ | |
| 179 | − if (iWidth == 16) | |
| 180 | − McCopyWidthEq16_c(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 181 | − else if(iWidth == 8) | |
| 182 | − McCopyWidthEq8_c(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 183 | − else if(iWidth == 4) | |
| 184 | − McCopyWidthEq4_c(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 185 | − else //here iWidth == 2 | |
| 186 | − McCopyWidthEq2_c(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 187 | −} | |
| 188 | − | |
| 189 | −static inline void_t McHorVer20_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 190 | −{ | |
| 191 | − int32_t i, j; | |
| 192 | − for (i = 0; i < iHeight; i++) | |
| 193 | − { | |
| 194 | − for (j = 0; j < iWidth; j++) | |
| 195 | − { | |
| 196 | − pDst[j] = WELS_CLIP1((FilterInput8bitWithStride_c(pSrc+j,1)+16)>>5); | |
| 197 | − } | |
| 198 | − pDst += iDstStride; | |
| 199 | − pSrc += iSrcStride; | |
| 200 | − } | |
| 201 | −} | |
| 202 | − | |
| 203 | −static inline void_t McHorVer02_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 204 | −{ | |
| 205 | − int32_t i, j; | |
| 206 | − for (i = 0; i < iHeight; i++) | |
| 207 | − { | |
| 208 | − for (j = 0; j < iWidth; j++) | |
| 209 | − { | |
| 210 | − pDst[j] = WELS_CLIP1((FilterInput8bitWithStride_c(pSrc+j, iSrcStride)+16)>>5); | |
| 211 | − } | |
| 212 | − pDst += iDstStride; | |
| 213 | − pSrc += iSrcStride; | |
| 214 | − } | |
| 215 | −} | |
| 216 | − | |
| 217 | −static inline void_t McHorVer22_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 218 | −{ | |
| 219 | − int16_t iTmp[16+5] = {0}; //16 | |
| 220 | − int32_t i, j, k; | |
| 221 | − | |
| 222 | − for (i = 0; i < iHeight; i++) | |
| 223 | − { | |
| 224 | − for (j = 0; j < iWidth + 5; j++) | |
| 225 | − { | |
| 226 | − iTmp[j] = FilterInput8bitWithStride_c(pSrc-2+j, iSrcStride); | |
| 227 | − } | |
| 228 | − for (k = 0; k < iWidth; k++) | |
| 229 | − { | |
| 230 | − pDst[k] = WELS_CLIP1((HorFilterInput16bit_c(&iTmp[2+k])+512)>>10); | |
| 231 | − } | |
| 232 | − pSrc += iSrcStride; | |
| 233 | − pDst += iDstStride; | |
| 234 | − } | |
| 235 | −} | |
| 236 | − | |
| 237 | −/////////////////////luma MC////////////////////////// | |
| 238 | −static inline void_t McHorVer01_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 239 | −{ | |
| 240 | − uint8_t uiTmp[256] = { 0 }; | |
| 241 | − McHorVer02_c(pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 242 | − PixelAvg_c(pDst, iDstStride, pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 243 | −} | |
| 244 | −static inline void_t McHorVer03_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 245 | −{ | |
| 246 | − uint8_t uiTmp[256] = { 0 }; | |
| 247 | − McHorVer02_c(pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 248 | − PixelAvg_c(pDst, iDstStride, pSrc+iSrcStride, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 249 | −} | |
| 250 | −static inline void_t McHorVer10_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 251 | −{ | |
| 252 | − uint8_t uiTmp[256] = { 0 }; | |
| 253 | − McHorVer20_c(pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 254 | − PixelAvg_c(pDst, iDstStride, pSrc, iSrcStride, uiTmp, 16,iWidth, iHeight); | |
| 255 | −} | |
| 256 | −static inline void_t McHorVer11_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 257 | −{ | |
| 258 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 259 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 260 | − McHorVer20_c(pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 261 | − McHorVer02_c(pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 262 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 263 | −} | |
| 264 | −static inline void_t McHorVer12_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 265 | −{ | |
| 266 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 267 | − uint8_t uiCtrTmp[256] = { 0 }; | |
| 268 | − McHorVer02_c(pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 269 | − McHorVer22_c(pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 270 | − PixelAvg_c(pDst, iDstStride, uiVerTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 271 | −} | |
| 272 | −static inline void_t McHorVer13_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 273 | −{ | |
| 274 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 275 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 276 | − McHorVer20_c(pSrc+iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 277 | − McHorVer02_c(pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 278 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 279 | −} | |
| 280 | −static inline void_t McHorVer21_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 281 | −{ | |
| 282 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 283 | − uint8_t uiCtrTmp[256] = { 0 }; | |
| 284 | − McHorVer20_c(pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 285 | − McHorVer22_c(pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 286 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 287 | −} | |
| 288 | −static inline void_t McHorVer23_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 289 | −{ | |
| 290 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 291 | − uint8_t uiCtrTmp[256] = { 0 }; | |
| 292 | − McHorVer20_c(pSrc+iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 293 | − McHorVer22_c(pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 294 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 295 | −} | |
| 296 | −static inline void_t McHorVer30_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 297 | −{ | |
| 298 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 299 | − McHorVer20_c(pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 300 | − PixelAvg_c(pDst, iDstStride, pSrc+1, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 301 | −} | |
| 302 | −static inline void_t McHorVer31_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 303 | −{ | |
| 304 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 305 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 306 | − McHorVer20_c(pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 307 | − McHorVer02_c(pSrc+1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 308 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 309 | −} | |
| 310 | −static inline void_t McHorVer32_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 311 | −{ | |
| 312 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 313 | − uint8_t uiCtrTmp[256] = { 0 }; | |
| 314 | − McHorVer02_c(pSrc+1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 315 | − McHorVer22_c(pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 316 | − PixelAvg_c(pDst, iDstStride, uiVerTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 317 | −} | |
| 318 | −static inline void_t McHorVer33_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 319 | −{ | |
| 320 | − uint8_t uiHorTmp[256] = { 0 }; | |
| 321 | − uint8_t uiVerTmp[256] = { 0 }; | |
| 322 | − McHorVer20_c(pSrc+iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 323 | − McHorVer02_c(pSrc+1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 324 | − PixelAvg_c(pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 325 | −} | |
| 326 | − | |
| 327 | −void_t McLuma_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 328 | − int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 329 | − //pSrc has been added the offset of mv | |
| 330 | −{ | |
| 331 | − PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = //[x][y] | |
| 332 | − { | |
| 333 | − {McCopy_c, McHorVer01_c, McHorVer02_c, McHorVer03_c}, | |
| 334 | − {McHorVer10_c, McHorVer11_c, McHorVer12_c, McHorVer13_c}, | |
| 335 | − {McHorVer20_c, McHorVer21_c, McHorVer22_c, McHorVer23_c}, | |
| 336 | − {McHorVer30_c, McHorVer31_c, McHorVer32_c, McHorVer33_c}, | |
| 337 | − }; | |
| 338 | − | |
| 339 | − pWelsMcFunc[iMvX&0x03][iMvY&0x03](pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 340 | −} | |
| 341 | − | |
| 342 | −static inline void_t McChromaWithFragMv_c( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight ) | |
| 343 | −{ | |
| 344 | − int32_t i, j; | |
| 345 | − int32_t iA, iB, iC, iD; | |
| 346 | − uint8_t* pSrcNext = pSrc + iSrcStride; | |
| 347 | − const uint32_t kuiABCD = *((uint32_t *)g_kuiABCD[iMvY&0x07][iMvX&0x07]); | |
| 348 | − iA = (kuiABCD ) & 0xff; | |
| 349 | − iB = (kuiABCD >> 8) & 0xff; | |
| 350 | − iC = (kuiABCD >> 16) & 0xff; | |
| 351 | − iD = (kuiABCD >> 24) & 0xff; | |
| 352 | − for (i = 0; i < iHeight; i++) | |
| 353 | − { | |
| 354 | − for (j = 0; j < iWidth; j++) | |
| 355 | − { | |
| 356 | − pDst[j] = (iA * pSrc[j] + iB * pSrc[j+1] + iC * pSrcNext[j] + iD * pSrcNext[j+1] + 32) >> 6; | |
| 357 | − } | |
| 358 | − pDst += iDstStride; | |
| 359 | − pSrc = pSrcNext; | |
| 360 | − pSrcNext += iSrcStride; | |
| 361 | − } | |
| 362 | −} | |
| 363 | − | |
| 364 | −void_t McChroma_c(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 365 | − int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 366 | − //pSrc has been added the offset of mv | |
| 367 | −{ | |
| 368 | − const int32_t kiD8x = iMvX&0x07; | |
| 369 | − const int32_t kiD8y = iMvY&0x07; | |
| 370 | − if (0 == kiD8x && 0 == kiD8y) | |
| 371 | − McCopy_c(pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 372 | − else | |
| 373 | − McChromaWithFragMv_c(pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight); | |
| 144 | +// h: iOffset=1 / v: iOffset=iSrcStride | |
| 145 | +static inline int32_t FilterInput8bitWithStride_c (uint8_t* pSrc, const int32_t kiOffset) { | |
| 146 | + const int32_t kiOffset1 = kiOffset; | |
| 147 | + const int32_t kiOffset2 = (kiOffset << 1); | |
| 148 | + const int32_t kiOffset3 = kiOffset + kiOffset2; | |
| 149 | + const uint32_t kuiPix05 = * (pSrc - kiOffset2) + * (pSrc + kiOffset3); | |
| 150 | + const uint32_t kuiPix14 = * (pSrc - kiOffset1) + * (pSrc + kiOffset2); | |
| 151 | + const uint32_t kuiPix23 = * (pSrc) + * (pSrc + kiOffset1); | |
| 152 | + | |
| 153 | + return (kuiPix05 - ((kuiPix14 << 2) + kuiPix14) + (kuiPix23 << 4) + (kuiPix23 << 2)); | |
| 154 | +} | |
| 155 | + | |
| 156 | +static inline void_t PixelAvg_c (uint8_t* pDst, int32_t iDstStride, uint8_t* pSrcA, int32_t iSrcAStride, | |
| 157 | + uint8_t* pSrcB, int32_t iSrcBStride, int32_t iWidth, int32_t iHeight) { | |
| 158 | + int32_t i, j; | |
| 159 | + for (i = 0; i < iHeight; i++) { | |
| 160 | + for (j = 0; j < iWidth; j++) { | |
| 161 | + pDst[j] = (pSrcA[j] + pSrcB[j] + 1) >> 1; | |
| 162 | + } | |
| 163 | + pDst += iDstStride; | |
| 164 | + pSrcA += iSrcAStride; | |
| 165 | + pSrcB += iSrcBStride; | |
| 166 | + } | |
| 167 | +} | |
| 168 | +static inline void_t McCopy_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 169 | + int32_t iHeight) { | |
| 170 | + if (iWidth == 16) | |
| 171 | + McCopyWidthEq16_c (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 172 | + else if (iWidth == 8) | |
| 173 | + McCopyWidthEq8_c (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 174 | + else if (iWidth == 4) | |
| 175 | + McCopyWidthEq4_c (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 176 | + else //here iWidth == 2 | |
| 177 | + McCopyWidthEq2_c (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 178 | +} | |
| 179 | + | |
| 180 | +static inline void_t McHorVer20_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 181 | + int32_t iHeight) { | |
| 182 | + int32_t i, j; | |
| 183 | + for (i = 0; i < iHeight; i++) { | |
| 184 | + for (j = 0; j < iWidth; j++) { | |
| 185 | + pDst[j] = WELS_CLIP1 ((FilterInput8bitWithStride_c (pSrc + j, 1) + 16) >> 5); | |
| 186 | + } | |
| 187 | + pDst += iDstStride; | |
| 188 | + pSrc += iSrcStride; | |
| 189 | + } | |
| 190 | +} | |
| 191 | + | |
| 192 | +static inline void_t McHorVer02_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 193 | + int32_t iHeight) { | |
| 194 | + int32_t i, j; | |
| 195 | + for (i = 0; i < iHeight; i++) { | |
| 196 | + for (j = 0; j < iWidth; j++) { | |
| 197 | + pDst[j] = WELS_CLIP1 ((FilterInput8bitWithStride_c (pSrc + j, iSrcStride) + 16) >> 5); | |
| 198 | + } | |
| 199 | + pDst += iDstStride; | |
| 200 | + pSrc += iSrcStride; | |
| 201 | + } | |
| 202 | +} | |
| 203 | + | |
| 204 | +static inline void_t McHorVer22_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 205 | + int32_t iHeight) { | |
| 206 | + int16_t iTmp[16 + 5] = {0}; //16 | |
| 207 | + int32_t i, j, k; | |
| 208 | + | |
| 209 | + for (i = 0; i < iHeight; i++) { | |
| 210 | + for (j = 0; j < iWidth + 5; j++) { | |
| 211 | + iTmp[j] = FilterInput8bitWithStride_c (pSrc - 2 + j, iSrcStride); | |
| 212 | + } | |
| 213 | + for (k = 0; k < iWidth; k++) { | |
| 214 | + pDst[k] = WELS_CLIP1 ((HorFilterInput16bit_c (&iTmp[2 + k]) + 512) >> 10); | |
| 215 | + } | |
| 216 | + pSrc += iSrcStride; | |
| 217 | + pDst += iDstStride; | |
| 218 | + } | |
| 219 | +} | |
| 220 | + | |
| 221 | +/////////////////////luma MC////////////////////////// | |
| 222 | +static inline void_t McHorVer01_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 223 | + int32_t iHeight) { | |
| 224 | + uint8_t uiTmp[256] = { 0 }; | |
| 225 | + McHorVer02_c (pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 226 | + PixelAvg_c (pDst, iDstStride, pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 227 | +} | |
| 228 | +static inline void_t McHorVer03_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 229 | + int32_t iHeight) { | |
| 230 | + uint8_t uiTmp[256] = { 0 }; | |
| 231 | + McHorVer02_c (pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 232 | + PixelAvg_c (pDst, iDstStride, pSrc + iSrcStride, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 233 | +} | |
| 234 | +static inline void_t McHorVer10_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 235 | + int32_t iHeight) { | |
| 236 | + uint8_t uiTmp[256] = { 0 }; | |
| 237 | + McHorVer20_c (pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 238 | + PixelAvg_c (pDst, iDstStride, pSrc, iSrcStride, uiTmp, 16, iWidth, iHeight); | |
| 239 | +} | |
| 240 | +static inline void_t McHorVer11_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 241 | + int32_t iHeight) { | |
| 242 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 243 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 244 | + McHorVer20_c (pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 245 | + McHorVer02_c (pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 246 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 247 | +} | |
| 248 | +static inline void_t McHorVer12_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 249 | + int32_t iHeight) { | |
| 250 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 251 | + uint8_t uiCtrTmp[256] = { 0 }; | |
| 252 | + McHorVer02_c (pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 253 | + McHorVer22_c (pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 254 | + PixelAvg_c (pDst, iDstStride, uiVerTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 255 | +} | |
| 256 | +static inline void_t McHorVer13_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 257 | + int32_t iHeight) { | |
| 258 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 259 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 260 | + McHorVer20_c (pSrc + iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 261 | + McHorVer02_c (pSrc, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 262 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 263 | +} | |
| 264 | +static inline void_t McHorVer21_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 265 | + int32_t iHeight) { | |
| 266 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 267 | + uint8_t uiCtrTmp[256] = { 0 }; | |
| 268 | + McHorVer20_c (pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 269 | + McHorVer22_c (pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 270 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 271 | +} | |
| 272 | +static inline void_t McHorVer23_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 273 | + int32_t iHeight) { | |
| 274 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 275 | + uint8_t uiCtrTmp[256] = { 0 }; | |
| 276 | + McHorVer20_c (pSrc + iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 277 | + McHorVer22_c (pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 278 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 279 | +} | |
| 280 | +static inline void_t McHorVer30_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 281 | + int32_t iHeight) { | |
| 282 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 283 | + McHorVer20_c (pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 284 | + PixelAvg_c (pDst, iDstStride, pSrc + 1, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 285 | +} | |
| 286 | +static inline void_t McHorVer31_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 287 | + int32_t iHeight) { | |
| 288 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 289 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 290 | + McHorVer20_c (pSrc, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 291 | + McHorVer02_c (pSrc + 1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 292 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 293 | +} | |
| 294 | +static inline void_t McHorVer32_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 295 | + int32_t iHeight) { | |
| 296 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 297 | + uint8_t uiCtrTmp[256] = { 0 }; | |
| 298 | + McHorVer02_c (pSrc + 1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 299 | + McHorVer22_c (pSrc, iSrcStride, uiCtrTmp, 16, iWidth, iHeight); | |
| 300 | + PixelAvg_c (pDst, iDstStride, uiVerTmp, 16, uiCtrTmp, 16, iWidth, iHeight); | |
| 301 | +} | |
| 302 | +static inline void_t McHorVer33_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 303 | + int32_t iHeight) { | |
| 304 | + uint8_t uiHorTmp[256] = { 0 }; | |
| 305 | + uint8_t uiVerTmp[256] = { 0 }; | |
| 306 | + McHorVer20_c (pSrc + iSrcStride, iSrcStride, uiHorTmp, 16, iWidth, iHeight); | |
| 307 | + McHorVer02_c (pSrc + 1, iSrcStride, uiVerTmp, 16, iWidth, iHeight); | |
| 308 | + PixelAvg_c (pDst, iDstStride, uiHorTmp, 16, uiVerTmp, 16, iWidth, iHeight); | |
| 309 | +} | |
| 310 | + | |
| 311 | +void_t McLuma_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 312 | + int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 313 | +//pSrc has been added the offset of mv | |
| 314 | +{ | |
| 315 | + PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y] | |
| 316 | + {McCopy_c, McHorVer01_c, McHorVer02_c, McHorVer03_c}, | |
| 317 | + {McHorVer10_c, McHorVer11_c, McHorVer12_c, McHorVer13_c}, | |
| 318 | + {McHorVer20_c, McHorVer21_c, McHorVer22_c, McHorVer23_c}, | |
| 319 | + {McHorVer30_c, McHorVer31_c, McHorVer32_c, McHorVer33_c}, | |
| 320 | + }; | |
| 321 | + | |
| 322 | + pWelsMcFunc[iMvX & 0x03][iMvY & 0x03] (pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 323 | +} | |
| 324 | + | |
| 325 | +static inline void_t McChromaWithFragMv_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 326 | + int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) { | |
| 327 | + int32_t i, j; | |
| 328 | + int32_t iA, iB, iC, iD; | |
| 329 | + uint8_t* pSrcNext = pSrc + iSrcStride; | |
| 330 | + const uint32_t kuiABCD = * ((uint32_t*)g_kuiABCD[iMvY & 0x07][iMvX & 0x07]); | |
| 331 | + iA = (kuiABCD) & 0xff; | |
| 332 | + iB = (kuiABCD >> 8) & 0xff; | |
| 333 | + iC = (kuiABCD >> 16) & 0xff; | |
| 334 | + iD = (kuiABCD >> 24) & 0xff; | |
| 335 | + for (i = 0; i < iHeight; i++) { | |
| 336 | + for (j = 0; j < iWidth; j++) { | |
| 337 | + pDst[j] = (iA * pSrc[j] + iB * pSrc[j + 1] + iC * pSrcNext[j] + iD * pSrcNext[j + 1] + 32) >> 6; | |
| 338 | + } | |
| 339 | + pDst += iDstStride; | |
| 340 | + pSrc = pSrcNext; | |
| 341 | + pSrcNext += iSrcStride; | |
| 342 | + } | |
| 343 | +} | |
| 344 | + | |
| 345 | +void_t McChroma_c (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 346 | + int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 347 | +//pSrc has been added the offset of mv | |
| 348 | +{ | |
| 349 | + const int32_t kiD8x = iMvX & 0x07; | |
| 350 | + const int32_t kiD8y = iMvY & 0x07; | |
| 351 | + if (0 == kiD8x && 0 == kiD8y) | |
| 352 | + McCopy_c (pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 353 | + else | |
| 354 | + McChromaWithFragMv_c (pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight); | |
| 374 | 355 | } |
| 375 | 356 | |
| 376 | 357 | #if defined(X86_ASM) |
| 377 | 358 | //***************************************************************************// |
| 378 | 359 | // SSE2 implement // |
| 379 | 360 | //***************************************************************************// |
| 380 | −static inline void_t McHorVer22WidthEq8_sse2( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) | |
| 381 | −{ | |
| 382 | − ENFORCE_STACK_ALIGN_2D(int16_t, iTap, 21, 8, 16) | |
| 383 | − McHorVer22Width8HorFirst_sse2(pSrc-2, iSrcStride, (uint8_t *)iTap,16,iHeight+5); | |
| 384 | − McHorVer22VerLast_sse2((uint8_t *)iTap,16, pDst, iDstStride, 8, iHeight); | |
| 385 | −} | |
| 386 | − | |
| 387 | −static inline void_t McHorVer02WidthEq16_sse2( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) | |
| 388 | −{ | |
| 389 | − McHorVer02WidthEq8_sse2( pSrc, iSrcStride, pDst, iDstStride, iHeight ); | |
| 390 | − McHorVer02WidthEq8_sse2( &pSrc[8], iSrcStride, &pDst[8], iDstStride, iHeight ); | |
| 391 | −} | |
| 392 | − | |
| 393 | −static inline void_t McHorVer22WidthEq16_sse2( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) | |
| 394 | −{ | |
| 395 | − McHorVer22WidthEq8_sse2( pSrc, iSrcStride, pDst, iDstStride, iHeight ); | |
| 396 | − McHorVer22WidthEq8_sse2( &pSrc[8], iSrcStride, &pDst[8], iDstStride, iHeight ); | |
| 397 | −} | |
| 398 | − | |
| 399 | −static inline void_t McCopy_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 400 | −{ | |
| 401 | − if (iWidth == 16) | |
| 402 | − McCopyWidthEq16_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 403 | − else if(iWidth == 8) | |
| 404 | − McCopyWidthEq8_mmx(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 405 | − else if(iWidth ==4) | |
| 406 | − McCopyWidthEq4_mmx(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 407 | − else | |
| 408 | − McCopyWidthEq2_c(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 409 | −} | |
| 410 | − | |
| 411 | −static inline void_t McHorVer20_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 412 | −{ | |
| 413 | − if (iWidth == 16) | |
| 414 | − McHorVer20WidthEq16_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 415 | − else if(iWidth == 8) | |
| 416 | − McHorVer20WidthEq8_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 417 | − else | |
| 418 | − McHorVer20WidthEq4_mmx(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 419 | −} | |
| 420 | − | |
| 421 | −static inline void_t McHorVer02_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 422 | −{ | |
| 423 | − if (iWidth == 16) | |
| 424 | − McHorVer02WidthEq16_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 425 | − else if(iWidth == 8) | |
| 426 | − McHorVer02WidthEq8_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 427 | − else | |
| 428 | − McHorVer02_c(pSrc,iSrcStride,pDst,iDstStride, 4, iHeight); | |
| 429 | −} | |
| 430 | − | |
| 431 | −static inline void_t McHorVer22_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 432 | −{ | |
| 433 | − if (iWidth == 16) | |
| 434 | − McHorVer22WidthEq16_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 435 | − else if(iWidth == 8) | |
| 436 | − McHorVer22WidthEq8_sse2(pSrc,iSrcStride,pDst,iDstStride,iHeight); | |
| 437 | − else | |
| 438 | − McHorVer22_c(pSrc,iSrcStride,pDst,iDstStride,4, iHeight); | |
| 439 | −} | |
| 440 | − | |
| 441 | −static inline void_t McHorVer01_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 442 | −{ | |
| 443 | − FORCE_STACK_ALIGN_1D( uint8_t, pTmp, 256, 16 ); | |
| 444 | − if (iWidth == 16) | |
| 445 | − { | |
| 446 | − McHorVer02WidthEq16_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 447 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 448 | − } | |
| 449 | − else if(iWidth == 8) | |
| 450 | − { | |
| 451 | − McHorVer02WidthEq8_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 452 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 453 | − } | |
| 454 | − else | |
| 455 | − { | |
| 456 | − McHorVer02_c(pSrc, iSrcStride, pTmp, 16, 4, iHeight); | |
| 457 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 458 | − } | |
| 459 | −} | |
| 460 | −static inline void_t McHorVer03_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 461 | −{ | |
| 462 | − FORCE_STACK_ALIGN_1D( uint8_t, pTmp, 256, 16 ); | |
| 463 | − if (iWidth == 16) | |
| 464 | − { | |
| 465 | − McHorVer02WidthEq16_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 466 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 467 | − } | |
| 468 | − else if(iWidth == 8) | |
| 469 | − { | |
| 470 | − McHorVer02WidthEq8_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 471 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 472 | − } | |
| 473 | − else | |
| 474 | − { | |
| 475 | − McHorVer02_c(pSrc, iSrcStride, pTmp, 16, 4, iHeight); | |
| 476 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 477 | − } | |
| 478 | −} | |
| 479 | −static inline void_t McHorVer10_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 480 | −{ | |
| 481 | − FORCE_STACK_ALIGN_1D( uint8_t, pTmp, 256, 16 ); | |
| 482 | − if (iWidth == 16) | |
| 483 | − { | |
| 484 | − McHorVer20WidthEq16_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 485 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 486 | − } | |
| 487 | − else if(iWidth == 8) | |
| 488 | − { | |
| 489 | − McHorVer20WidthEq8_sse2(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 490 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 491 | − } | |
| 492 | − else | |
| 493 | − { | |
| 494 | − McHorVer20WidthEq4_mmx(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 495 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 496 | − } | |
| 497 | −} | |
| 498 | −static inline void_t McHorVer11_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 499 | −{ | |
| 500 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 501 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 502 | − if (iWidth == 16) | |
| 503 | − { | |
| 504 | − McHorVer20WidthEq16_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 505 | − McHorVer02WidthEq16_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 506 | − PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 507 | − } | |
| 508 | − else if(iWidth == 8) | |
| 509 | − { | |
| 510 | − McHorVer20WidthEq8_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 511 | − McHorVer02WidthEq8_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 512 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 513 | − } | |
| 514 | − else | |
| 515 | − { | |
| 516 | − McHorVer20WidthEq4_mmx(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 517 | − McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 518 | − PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 519 | − } | |
| 520 | −} | |
| 521 | −static inline void_t McHorVer12_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 522 | −{ | |
| 523 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 524 | − FORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 ); | |
| 525 | − if (iWidth == 16) | |
| 526 | − { | |
| 527 | − McHorVer02WidthEq16_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 528 | − McHorVer22WidthEq16_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 529 | − PixelAvgWidthEq16_sse2 (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 530 | − } | |
| 531 | − else if(iWidth == 8) | |
| 532 | − { | |
| 533 | − McHorVer02WidthEq8_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 534 | − McHorVer22WidthEq8_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 535 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 536 | − } | |
| 537 | − else | |
| 538 | − { | |
| 539 | − McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 540 | − McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 541 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 542 | − } | |
| 543 | −} | |
| 544 | −static inline void_t McHorVer13_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 545 | −{ | |
| 546 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 547 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 548 | − if (iWidth ==16) | |
| 549 | − { | |
| 550 | − McHorVer20WidthEq16_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 551 | − McHorVer02WidthEq16_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 552 | − PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 553 | − } | |
| 554 | − else if(iWidth == 8) | |
| 555 | − { | |
| 556 | − McHorVer20WidthEq8_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 557 | − McHorVer02WidthEq8_sse2(pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 558 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 559 | − } | |
| 560 | − else | |
| 561 | − { | |
| 562 | − McHorVer20WidthEq4_mmx(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 563 | − McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4 ,iHeight); | |
| 564 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 565 | − } | |
| 566 | −} | |
| 567 | −static inline void_t McHorVer21_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 568 | −{ | |
| 569 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 570 | − FORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 ); | |
| 571 | − if (iWidth == 16) | |
| 572 | − { | |
| 573 | − McHorVer20WidthEq16_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 574 | − McHorVer22WidthEq16_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 575 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 576 | − } | |
| 577 | − else if(iWidth == 8) | |
| 578 | − { | |
| 579 | − McHorVer20WidthEq8_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 580 | − McHorVer22WidthEq8_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 581 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 582 | − } | |
| 583 | − else | |
| 584 | − { | |
| 585 | − McHorVer20WidthEq4_mmx(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 586 | − McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 587 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 588 | − } | |
| 589 | −} | |
| 590 | −static inline void_t McHorVer23_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 591 | −{ | |
| 592 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 593 | − FORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 ); | |
| 594 | − if (iWidth == 16) | |
| 595 | − { | |
| 596 | − McHorVer20WidthEq16_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 597 | − McHorVer22WidthEq16_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 598 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 599 | − } | |
| 600 | − else if(iWidth == 8) | |
| 601 | − { | |
| 602 | − McHorVer20WidthEq8_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 603 | − McHorVer22WidthEq8_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 604 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 605 | − } | |
| 606 | − else | |
| 607 | − { | |
| 608 | − McHorVer20WidthEq4_mmx(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 609 | − McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 610 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 611 | − } | |
| 612 | −} | |
| 613 | −static inline void_t McHorVer30_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 614 | −{ | |
| 615 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 616 | − if (iWidth == 16) | |
| 617 | − { | |
| 618 | − McHorVer20WidthEq16_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 619 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pSrc+1, iSrcStride, pHorTmp, 16, iHeight); | |
| 620 | − } | |
| 621 | − else if(iWidth == 8) | |
| 622 | − { | |
| 623 | − McHorVer20WidthEq8_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 624 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pSrc+1, iSrcStride, pHorTmp, 16, iHeight); | |
| 625 | − } | |
| 626 | − else | |
| 627 | − { | |
| 628 | − McHorVer20WidthEq4_mmx(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 629 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pSrc+1, iSrcStride, pHorTmp, 16, iHeight); | |
| 630 | − } | |
| 631 | −} | |
| 632 | −static inline void_t McHorVer31_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 633 | −{ | |
| 634 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 635 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 636 | − if (iWidth == 16) | |
| 637 | − { | |
| 638 | − McHorVer20WidthEq16_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 639 | − McHorVer02WidthEq16_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 640 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 641 | − } | |
| 642 | − else if(iWidth == 8) | |
| 643 | − { | |
| 644 | − McHorVer20WidthEq8_sse2(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 645 | − McHorVer02WidthEq8_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 646 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 647 | − } | |
| 648 | − else | |
| 649 | − { | |
| 650 | − McHorVer20WidthEq4_mmx(pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 651 | − McHorVer02_c(pSrc+1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 652 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 653 | − } | |
| 654 | −} | |
| 655 | −static inline void_t McHorVer32_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 656 | −{ | |
| 657 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 658 | − FORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 ); | |
| 659 | − if (iWidth ==16) | |
| 660 | − { | |
| 661 | − McHorVer02WidthEq16_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 662 | − McHorVer22WidthEq16_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 663 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 664 | − } | |
| 665 | − else if(iWidth == 8) | |
| 666 | − { | |
| 667 | − McHorVer02WidthEq8_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 668 | − McHorVer22WidthEq8_sse2(pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 669 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 670 | − } | |
| 671 | − else | |
| 672 | − { | |
| 673 | − McHorVer02_c(pSrc+1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 674 | − McHorVer22_c(pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 675 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 676 | − } | |
| 677 | −} | |
| 678 | −static inline void_t McHorVer33_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight) | |
| 679 | −{ | |
| 680 | − FORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 ); | |
| 681 | − FORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 ); | |
| 682 | − if (iWidth == 16) | |
| 683 | − { | |
| 684 | − McHorVer20WidthEq16_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 685 | − McHorVer02WidthEq16_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 686 | − PixelAvgWidthEq16_sse2(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 687 | − } | |
| 688 | − else if(iWidth == 8) | |
| 689 | − { | |
| 690 | − McHorVer20WidthEq8_sse2(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 691 | − McHorVer02WidthEq8_sse2(pSrc+1, iSrcStride, pVerTmp, 16, iHeight); | |
| 692 | − PixelAvgWidthEq8_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 693 | − } | |
| 694 | − else | |
| 695 | − { | |
| 696 | − McHorVer20WidthEq4_mmx(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 697 | − McHorVer02_c (pSrc+1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 698 | − PixelAvgWidthEq4_mmx(pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 699 | − } | |
| 700 | −} | |
| 701 | − | |
| 702 | −void_t McLuma_sse2(uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 703 | − int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 704 | − //pSrc has been added the offset of mv | |
| 705 | −{ | |
| 706 | − PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = //[x][y] | |
| 707 | − { | |
| 708 | − {McCopy_sse2, McHorVer01_sse2, McHorVer02_sse2, McHorVer03_sse2}, | |
| 709 | − {McHorVer10_sse2, McHorVer11_sse2, McHorVer12_sse2, McHorVer13_sse2}, | |
| 710 | − {McHorVer20_sse2, McHorVer21_sse2, McHorVer22_sse2, McHorVer23_sse2}, | |
| 711 | − {McHorVer30_sse2, McHorVer31_sse2, McHorVer32_sse2, McHorVer33_sse2}, | |
| 712 | − }; | |
| 713 | − | |
| 714 | − pWelsMcFunc[iMvX&0x03][iMvY&0x03](pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 715 | −} | |
| 716 | − | |
| 717 | −void_t McChroma_sse2( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, | |
| 718 | − int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight ) | |
| 719 | −{ | |
| 720 | − static const PMcChromaWidthExtFunc kpMcChromaWidthFuncs[2] = | |
| 721 | − { | |
| 722 | − McChromaWidthEq4_mmx, | |
| 723 | − McChromaWidthEq8_sse2 | |
| 724 | − }; | |
| 725 | − const int32_t kiD8x = iMvX&0x07; | |
| 726 | − const int32_t kiD8y = iMvY&0x07; | |
| 727 | − if (kiD8x ==0 && kiD8y ==0) | |
| 728 | − { | |
| 729 | − McCopy_sse2(pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 730 | − return; | |
| 731 | − } | |
| 732 | − if (iWidth != 2) | |
| 733 | − { | |
| 734 | − kpMcChromaWidthFuncs[iWidth>>3](pSrc, iSrcStride, pDst, iDstStride, g_kuiABCD[kiD8y][kiD8x], iHeight); | |
| 735 | − } | |
| 736 | − else | |
| 737 | − McChromaWithFragMv_c(pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight); | |
| 361 | +static inline void_t McHorVer22WidthEq8_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 362 | + int32_t iHeight) { | |
| 363 | + ENFORCE_STACK_ALIGN_2D (int16_t, iTap, 21, 8, 16) | |
| 364 | + McHorVer22Width8HorFirst_sse2 (pSrc - 2, iSrcStride, (uint8_t*)iTap, 16, iHeight + 5); | |
| 365 | + McHorVer22VerLast_sse2 ((uint8_t*)iTap, 16, pDst, iDstStride, 8, iHeight); | |
| 366 | +} | |
| 367 | + | |
| 368 | +static inline void_t McHorVer02WidthEq16_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 369 | + int32_t iHeight) { | |
| 370 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 371 | + McHorVer02WidthEq8_sse2 (&pSrc[8], iSrcStride, &pDst[8], iDstStride, iHeight); | |
| 372 | +} | |
| 373 | + | |
| 374 | +static inline void_t McHorVer22WidthEq16_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 375 | + int32_t iHeight) { | |
| 376 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 377 | + McHorVer22WidthEq8_sse2 (&pSrc[8], iSrcStride, &pDst[8], iDstStride, iHeight); | |
| 378 | +} | |
| 379 | + | |
| 380 | +static inline void_t McCopy_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iWidth, | |
| 381 | + int32_t iHeight) { | |
| 382 | + if (iWidth == 16) | |
| 383 | + McCopyWidthEq16_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 384 | + else if (iWidth == 8) | |
| 385 | + McCopyWidthEq8_mmx (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 386 | + else if (iWidth == 4) | |
| 387 | + McCopyWidthEq4_mmx (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 388 | + else | |
| 389 | + McCopyWidthEq2_c (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 390 | +} | |
| 391 | + | |
| 392 | +static inline void_t McHorVer20_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 393 | + int32_t iWidth, int32_t iHeight) { | |
| 394 | + if (iWidth == 16) | |
| 395 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 396 | + else if (iWidth == 8) | |
| 397 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 398 | + else | |
| 399 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 400 | +} | |
| 401 | + | |
| 402 | +static inline void_t McHorVer02_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 403 | + int32_t iWidth, int32_t iHeight) { | |
| 404 | + if (iWidth == 16) | |
| 405 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 406 | + else if (iWidth == 8) | |
| 407 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 408 | + else | |
| 409 | + McHorVer02_c (pSrc, iSrcStride, pDst, iDstStride, 4, iHeight); | |
| 410 | +} | |
| 411 | + | |
| 412 | +static inline void_t McHorVer22_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 413 | + int32_t iWidth, int32_t iHeight) { | |
| 414 | + if (iWidth == 16) | |
| 415 | + McHorVer22WidthEq16_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 416 | + else if (iWidth == 8) | |
| 417 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 418 | + else | |
| 419 | + McHorVer22_c (pSrc, iSrcStride, pDst, iDstStride, 4, iHeight); | |
| 420 | +} | |
| 421 | + | |
| 422 | +static inline void_t McHorVer01_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 423 | + int32_t iWidth, int32_t iHeight) { | |
| 424 | + FORCE_STACK_ALIGN_1D (uint8_t, pTmp, 256, 16); | |
| 425 | + if (iWidth == 16) { | |
| 426 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 427 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 428 | + } else if (iWidth == 8) { | |
| 429 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 430 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 431 | + } else { | |
| 432 | + McHorVer02_c (pSrc, iSrcStride, pTmp, 16, 4, iHeight); | |
| 433 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 434 | + } | |
| 435 | +} | |
| 436 | +static inline void_t McHorVer03_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 437 | + int32_t iWidth, int32_t iHeight) { | |
| 438 | + FORCE_STACK_ALIGN_1D (uint8_t, pTmp, 256, 16); | |
| 439 | + if (iWidth == 16) { | |
| 440 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 441 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pSrc + iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 442 | + } else if (iWidth == 8) { | |
| 443 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 444 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pSrc + iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 445 | + } else { | |
| 446 | + McHorVer02_c (pSrc, iSrcStride, pTmp, 16, 4, iHeight); | |
| 447 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pSrc + iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 448 | + } | |
| 449 | +} | |
| 450 | +static inline void_t McHorVer10_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 451 | + int32_t iWidth, int32_t iHeight) { | |
| 452 | + FORCE_STACK_ALIGN_1D (uint8_t, pTmp, 256, 16); | |
| 453 | + if (iWidth == 16) { | |
| 454 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 455 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 456 | + } else if (iWidth == 8) { | |
| 457 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 458 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 459 | + } else { | |
| 460 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 461 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 462 | + } | |
| 463 | +} | |
| 464 | +static inline void_t McHorVer11_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 465 | + int32_t iWidth, int32_t iHeight) { | |
| 466 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 467 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 468 | + if (iWidth == 16) { | |
| 469 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 470 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 471 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 472 | + } else if (iWidth == 8) { | |
| 473 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 474 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 475 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 476 | + } else { | |
| 477 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 478 | + McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 479 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 480 | + } | |
| 481 | +} | |
| 482 | +static inline void_t McHorVer12_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 483 | + int32_t iWidth, int32_t iHeight) { | |
| 484 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 485 | + FORCE_STACK_ALIGN_1D (uint8_t, pCtrTmp, 256, 16); | |
| 486 | + if (iWidth == 16) { | |
| 487 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 488 | + McHorVer22WidthEq16_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 489 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 490 | + } else if (iWidth == 8) { | |
| 491 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 492 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 493 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 494 | + } else { | |
| 495 | + McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 496 | + McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 497 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 498 | + } | |
| 499 | +} | |
| 500 | +static inline void_t McHorVer13_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 501 | + int32_t iWidth, int32_t iHeight) { | |
| 502 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 503 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 504 | + if (iWidth == 16) { | |
| 505 | + McHorVer20WidthEq16_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 506 | + McHorVer02WidthEq16_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 507 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 508 | + } else if (iWidth == 8) { | |
| 509 | + McHorVer20WidthEq8_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 510 | + McHorVer02WidthEq8_sse2 (pSrc, iSrcStride, pVerTmp, 16, iHeight); | |
| 511 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 512 | + } else { | |
| 513 | + McHorVer20WidthEq4_mmx (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 514 | + McHorVer02_c (pSrc, iSrcStride, pVerTmp, 16, 4 , iHeight); | |
| 515 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 516 | + } | |
| 517 | +} | |
| 518 | +static inline void_t McHorVer21_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 519 | + int32_t iWidth, int32_t iHeight) { | |
| 520 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 521 | + FORCE_STACK_ALIGN_1D (uint8_t, pCtrTmp, 256, 16); | |
| 522 | + if (iWidth == 16) { | |
| 523 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 524 | + McHorVer22WidthEq16_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 525 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 526 | + } else if (iWidth == 8) { | |
| 527 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 528 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 529 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 530 | + } else { | |
| 531 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 532 | + McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 533 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 534 | + } | |
| 535 | +} | |
| 536 | +static inline void_t McHorVer23_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 537 | + int32_t iWidth, int32_t iHeight) { | |
| 538 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 539 | + FORCE_STACK_ALIGN_1D (uint8_t, pCtrTmp, 256, 16); | |
| 540 | + if (iWidth == 16) { | |
| 541 | + McHorVer20WidthEq16_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 542 | + McHorVer22WidthEq16_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 543 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 544 | + } else if (iWidth == 8) { | |
| 545 | + McHorVer20WidthEq8_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 546 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 547 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 548 | + } else { | |
| 549 | + McHorVer20WidthEq4_mmx (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 550 | + McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 551 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pCtrTmp, 16, iHeight); | |
| 552 | + } | |
| 553 | +} | |
| 554 | +static inline void_t McHorVer30_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 555 | + int32_t iWidth, int32_t iHeight) { | |
| 556 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 557 | + if (iWidth == 16) { | |
| 558 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 559 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pSrc + 1, iSrcStride, pHorTmp, 16, iHeight); | |
| 560 | + } else if (iWidth == 8) { | |
| 561 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 562 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pSrc + 1, iSrcStride, pHorTmp, 16, iHeight); | |
| 563 | + } else { | |
| 564 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 565 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pSrc + 1, iSrcStride, pHorTmp, 16, iHeight); | |
| 566 | + } | |
| 567 | +} | |
| 568 | +static inline void_t McHorVer31_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 569 | + int32_t iWidth, int32_t iHeight) { | |
| 570 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 571 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 572 | + if (iWidth == 16) { | |
| 573 | + McHorVer20WidthEq16_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 574 | + McHorVer02WidthEq16_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 575 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 576 | + } else if (iWidth == 8) { | |
| 577 | + McHorVer20WidthEq8_sse2 (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 578 | + McHorVer02WidthEq8_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 579 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 580 | + } else { | |
| 581 | + McHorVer20WidthEq4_mmx (pSrc, iSrcStride, pHorTmp, 16, iHeight); | |
| 582 | + McHorVer02_c (pSrc + 1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 583 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 584 | + } | |
| 585 | +} | |
| 586 | +static inline void_t McHorVer32_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 587 | + int32_t iWidth, int32_t iHeight) { | |
| 588 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 589 | + FORCE_STACK_ALIGN_1D (uint8_t, pCtrTmp, 256, 16); | |
| 590 | + if (iWidth == 16) { | |
| 591 | + McHorVer02WidthEq16_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 592 | + McHorVer22WidthEq16_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 593 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 594 | + } else if (iWidth == 8) { | |
| 595 | + McHorVer02WidthEq8_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 596 | + McHorVer22WidthEq8_sse2 (pSrc, iSrcStride, pCtrTmp, 16, iHeight); | |
| 597 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 598 | + } else { | |
| 599 | + McHorVer02_c (pSrc + 1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 600 | + McHorVer22_c (pSrc, iSrcStride, pCtrTmp, 16, 4, iHeight); | |
| 601 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pVerTmp, 16, pCtrTmp, 16, iHeight); | |
| 602 | + } | |
| 603 | +} | |
| 604 | +static inline void_t McHorVer33_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 605 | + int32_t iWidth, int32_t iHeight) { | |
| 606 | + FORCE_STACK_ALIGN_1D (uint8_t, pHorTmp, 256, 16); | |
| 607 | + FORCE_STACK_ALIGN_1D (uint8_t, pVerTmp, 256, 16); | |
| 608 | + if (iWidth == 16) { | |
| 609 | + McHorVer20WidthEq16_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 610 | + McHorVer02WidthEq16_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 611 | + PixelAvgWidthEq16_sse2 (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 612 | + } else if (iWidth == 8) { | |
| 613 | + McHorVer20WidthEq8_sse2 (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 614 | + McHorVer02WidthEq8_sse2 (pSrc + 1, iSrcStride, pVerTmp, 16, iHeight); | |
| 615 | + PixelAvgWidthEq8_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 616 | + } else { | |
| 617 | + McHorVer20WidthEq4_mmx (pSrc + iSrcStride, iSrcStride, pHorTmp, 16, iHeight); | |
| 618 | + McHorVer02_c (pSrc + 1, iSrcStride, pVerTmp, 16, 4, iHeight); | |
| 619 | + PixelAvgWidthEq4_mmx (pDst, iDstStride, pHorTmp, 16, pVerTmp, 16, iHeight); | |
| 620 | + } | |
| 621 | +} | |
| 622 | + | |
| 623 | +void_t McLuma_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 624 | + int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) | |
| 625 | +//pSrc has been added the offset of mv | |
| 626 | +{ | |
| 627 | + PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = { //[x][y] | |
| 628 | + {McCopy_sse2, McHorVer01_sse2, McHorVer02_sse2, McHorVer03_sse2}, | |
| 629 | + {McHorVer10_sse2, McHorVer11_sse2, McHorVer12_sse2, McHorVer13_sse2}, | |
| 630 | + {McHorVer20_sse2, McHorVer21_sse2, McHorVer22_sse2, McHorVer23_sse2}, | |
| 631 | + {McHorVer30_sse2, McHorVer31_sse2, McHorVer32_sse2, McHorVer33_sse2}, | |
| 632 | + }; | |
| 633 | + | |
| 634 | + pWelsMcFunc[iMvX & 0x03][iMvY & 0x03] (pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 635 | +} | |
| 636 | + | |
| 637 | +void_t McChroma_sse2 (uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 638 | + int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) { | |
| 639 | + static const PMcChromaWidthExtFunc kpMcChromaWidthFuncs[2] = { | |
| 640 | + McChromaWidthEq4_mmx, | |
| 641 | + McChromaWidthEq8_sse2 | |
| 642 | + }; | |
| 643 | + const int32_t kiD8x = iMvX & 0x07; | |
| 644 | + const int32_t kiD8y = iMvY & 0x07; | |
| 645 | + if (kiD8x == 0 && kiD8y == 0) { | |
| 646 | + McCopy_sse2 (pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight); | |
| 647 | + return; | |
| 648 | + } | |
| 649 | + if (iWidth != 2) { | |
| 650 | + kpMcChromaWidthFuncs[iWidth >> 3] (pSrc, iSrcStride, pDst, iDstStride, g_kuiABCD[kiD8y][kiD8x], iHeight); | |
| 651 | + } else | |
| 652 | + McChromaWithFragMv_c (pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight); | |
| 738 | 653 | } |
| 739 | 654 | |
| 740 | 655 | |
| 741 | 656 | #endif //X86_ASM |
| 742 | 657 | |
| 743 | −void_t InitMcFunc(SMcFunc *pMcFunc, int32_t iCpu) | |
| 744 | −{ | |
| 745 | − pMcFunc->pMcLumaFunc = McLuma_c; | |
| 746 | − pMcFunc->pMcChromaFunc = McChroma_c; | |
| 747 | − | |
| 658 | +void_t InitMcFunc (SMcFunc* pMcFunc, int32_t iCpu) { | |
| 659 | + pMcFunc->pMcLumaFunc = McLuma_c; | |
| 660 | + pMcFunc->pMcChromaFunc = McChroma_c; | |
| 661 | + | |
| 748 | 662 | #if defined (X86_ASM) |
| 749 | − if ( iCpu & WELS_CPU_SSE2 ) | |
| 750 | − { | |
| 751 | − pMcFunc->pMcLumaFunc = McLuma_sse2; | |
| 752 | − pMcFunc->pMcChromaFunc = McChroma_sse2; | |
| 753 | − } | |
| 663 | + if (iCpu & WELS_CPU_SSE2) { | |
| 664 | + pMcFunc->pMcLumaFunc = McLuma_sse2; | |
| 665 | + pMcFunc->pMcChromaFunc = McChroma_sse2; | |
| 666 | + } | |
| 754 | 667 | #endif //(X86_ASM) |
| 755 | 668 | } |
| 756 | 669 | |