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

Function MNNSamplerNV21Copy

source/backend/cpu/compute/ImageProcessFunction.cpp:923–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921}
922
923void 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
946void 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) {

Callers 1

MNNSamplerNV12CopyFunction · 0.85

Calls 1

__clampFunction · 0.70

Tested by

no test coverage detected