| 30 | // --- Helper: gradient RGBA test image --- |
| 31 | |
| 32 | static std::vector<uint8_t> gradientRGBA(int w, int h) |
| 33 | { |
| 34 | std::vector<uint8_t> data(w * h * 4); |
| 35 | for (int y = 0; y < h; ++y) |
| 36 | { |
| 37 | for (int x = 0; x < w; ++x) |
| 38 | { |
| 39 | int i = y * w + x; |
| 40 | data[i * 4 + 0] = static_cast<uint8_t>(x * 255 / (w - 1)); |
| 41 | data[i * 4 + 1] = static_cast<uint8_t>(y * 255 / (h - 1)); |
| 42 | data[i * 4 + 2] = static_cast<uint8_t>((x + y) * 255 / (w + h - 2)); |
| 43 | data[i * 4 + 3] = 255; |
| 44 | } |
| 45 | } |
| 46 | return data; |
| 47 | } |
| 48 | |
| 49 | // --- Helper: compute PSNR between two RGBA buffers --- |
| 50 | |