MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / avg_image

Function avg_image

example_transcoding/utils.cpp:491–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491static 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
511vec4F compute_ssim(const imagef& a, const imagef& b)

Callers 1

compute_ssimFunction · 0.70

Calls 3

get_heightMethod · 0.45
get_widthMethod · 0.45
get_total_pixelsMethod · 0.45

Tested by

no test coverage detected