| 19 | using namespace MNN::Express; |
| 20 | |
| 21 | static 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} |