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

Function genSourceData

test/cv/ImageProcessTest.cpp:21–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19using namespace MNN::Express;
20
21static std::vector<uint8_t> genSourceData(int h, int w, int bpp) {
22 std::vector<uint8_t> source(h * w * bpp);
23 for (int y = 0; y < h; ++y) {
24 auto pixelY = source.data() + w * y * bpp;
25 int magicY = ((h - y) * (h - y)) % 79;
26 for (int x = 0; x < w; ++x) {
27 auto pixelX = pixelY + x * bpp;
28 int magicX = (x * x) % 113;
29 for (int p = 0; p < bpp; ++p) {
30 int magic = (magicX + magicY + p * p * p) % 255;
31 pixelX[p] = magic;
32 }
33 }
34 }
35 return source;
36}
37
38// format in {YUV_NV21, YUV_NV12, YUV_I420}
39// dstFormat in {RGBA, BGRA, RGB, BGR, GRAY}

Callers 15

runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected