| 797 | #endif |
| 798 | } |
| 799 | void MNNSamplerNearest(const unsigned char* source, unsigned char* dest, MNN::CV::Point* points, size_t sta, size_t count, |
| 800 | size_t iw, size_t ih, size_t yStride, int bpp) { |
| 801 | dest = dest + bpp * sta; |
| 802 | MNN::CV::Point curPoints; |
| 803 | curPoints.fX = points[0].fX; |
| 804 | curPoints.fY = points[0].fY; |
| 805 | float dy = points[1].fY; |
| 806 | float dx = points[1].fX; |
| 807 | float xMax = iw - 1; |
| 808 | float yMax = ih - 1; |
| 809 | for (int i = 0; i < count; ++i) { |
| 810 | int y = (int)roundf(__clamp(curPoints.fY, 0, yMax)); |
| 811 | int x = (int)roundf(__clamp(curPoints.fX, 0, xMax)); |
| 812 | curPoints.fY += dy; |
| 813 | curPoints.fX += dx; |
| 814 | auto sourcePos = y * yStride + bpp * x; |
| 815 | for (int j = 0; j < bpp; ++j) { |
| 816 | dest[bpp * i + j] = source[sourcePos + j]; |
| 817 | } |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | void MNNSamplerC4Nearest(const unsigned char* source, unsigned char* dest, MNN::CV::Point* points, size_t sta, |
| 822 | size_t count, size_t capacity, size_t iw, size_t ih, size_t yStride) { |
no test coverage detected