Hi Geert, On 14/12/17 08:52, Geert Uytterhoeven wrote: > Hi Kieran, > > On Thu, Dec 14, 2017 at 12:10 AM, Kieran Bingham <kbingham@xxxxxxxxxx> wrote: >> From: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx> >> >> Provide a means to compare two identically sized framebuffers. >> >> This basic implementation expects the two buffers to have the same >> formats and sizes, and will return zero for identical frames, or a >> positive float representing and average difference otherwise. > > an > >> --- a/kms++util/src/verification.cpp >> +++ b/kms++util/src/verification.cpp >> @@ -18,4 +18,35 @@ void save_raw_frame(IFramebuffer& fb, const char *filename) >> os->write((char*)fb.map(i), fb.size(i)); >> } >> >> +float compare_framebuffers(IFramebuffer& a, IFramebuffer& b) >> +{ > >> + // This expects a frame to be identical, including non-visible data. >> + for (i = 0; i < a.size(0) && i < b.size(0); i++) >> + diff += abs(pa[i] - pb[i]); > > I think it's better to use "diff += abs(pa[i] - pb[i]) * abs(pa[i] - pb[i])", > to penalize larger differences. > > See also https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio Ah yes of course - an excellent suggestion! Thanks. >> + >> + return diff / pixels; >> +} > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > -- -- Kieran