| 489 | } |
| 490 | |
| 491 | static vec4F avg_image(const imagef& src) |
| 492 | { |
| 493 | vec4F avg(0.0f); |
| 494 | |
| 495 | for (uint32_t y = 0; y < src.get_height(); y++) |
| 496 | { |
| 497 | for (uint32_t x = 0; x < src.get_width(); x++) |
| 498 | { |
| 499 | const vec4F& s = src(x, y); |
| 500 | |
| 501 | avg += vec4F(s[0], s[1], s[2], s[3]); |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | avg /= static_cast<float>(src.get_total_pixels()); |
| 506 | |
| 507 | return avg; |
| 508 | } |
| 509 | |
| 510 | // Reference: https://ece.uwaterloo.ca/~z70wang/research/ssim/index.html |
| 511 | vec4F compute_ssim(const imagef& a, const imagef& b) |
no test coverage detected