| 921 | } |
| 922 | |
| 923 | void MNNSamplerNV21Copy(const unsigned char* source, unsigned char* dest, MNN::CV::Point* points, size_t sta, |
| 924 | size_t count, size_t capacity, size_t iw, size_t ih, size_t yStride) { |
| 925 | MNN::CV::Point curPoints; |
| 926 | curPoints.fX = points[0].fX; |
| 927 | curPoints.fY = points[0].fY; |
| 928 | float xMax = iw - 1; |
| 929 | float yMax = ih - 1; |
| 930 | int y = (int)roundf(__clamp(curPoints.fY, 0, yMax)); |
| 931 | int x = (int)roundf(__clamp(curPoints.fX, 0, xMax)); |
| 932 | int stride = (int)yStride; |
| 933 | int hstride = (int)yStride; |
| 934 | if (yStride == 0) { |
| 935 | stride = (int)iw; |
| 936 | hstride = (((int)iw + 1) / 2) * 2; |
| 937 | } |
| 938 | |
| 939 | int sourcePosY = y * stride + x; |
| 940 | int sourcePosUV = (int)stride * (int)ih + (y / 2) * hstride + (x / 2) * 2; |
| 941 | |
| 942 | ::memcpy(dest + sta, source + sourcePosY, count); |
| 943 | ::memcpy(dest + (capacity) + (sta / 2) * 2, source + sourcePosUV, ((count + 1) / 2) * 2); |
| 944 | } |
| 945 | |
| 946 | void MNNSamplerNV21Nearest(const unsigned char* source, unsigned char* dest, MNN::CV::Point* points, size_t sta, |
| 947 | size_t count, size_t capacity, size_t iw, size_t ih, size_t yStride) { |
no test coverage detected