MCPcopy Create free account
hub / github.com/alibaba/MNN / MNNSamplerNearest

Function MNNSamplerNearest

source/backend/cpu/compute/ImageProcessFunction.cpp:799–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797#endif
798}
799void 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
821void 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) {

Callers 4

MNNSamplerC4NearestFunction · 0.85
MNNSamplerC1NearestFunction · 0.85
MNNSamplerC3NearestFunction · 0.85
MNNSamplerNV21NearestFunction · 0.85

Calls 1

__clampFunction · 0.70

Tested by

no test coverage detected