<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 16, 2017 at 5:28 PM, Paul Kocialkowski <span dir="ltr"><<a href="mailto:paul.kocialkowski@linux.intel.com" target="_blank">paul.kocialkowski@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div><div class="h5"><br>
On Thu, 2017-06-15 at 21:08 -0700, <a href="mailto:chihchung@google.com">chihchung@google.com</a> wrote:<br>
> Paul Kocialkowski於 2017年6月15日星期四 UTC+8下午9時57分09秒寫道:<br>
> > Hi,<br>
> ><br>
> > So far, there are two ways of testing for pixel-perfect frames using the<br>
> > Chamelium that are in IGT. The first one grabs a full frame from the<br>
> > Chamelium<br>
> > and compares it pixel-to-pixel with the cairo reference, which works well<br>
> > for<br>
> > DP/HDMI.<br>
> ><br>
> > For VGA, this is probably not the case (because the link is analogue). In<br>
> > that<br>
> > case, I will look into implementing some fuzzy testing, probably inspired<br>
> > by<br>
> > what piglit (probably) does to compare output frames with references.<br>
> ><br>
> > For pixel-perfect testing, grabbing a full frame and testing it with memcmp<br>
> > comes with a significant time penalty (about 2 seconds for 1080p). The<br>
> > Chamelium<br>
> > also provides a CRC mechanism that is faster and does not require retrieving<br>
> > the<br>
> > frame, that IGT currently also supports. It compares the CRC calculated by<br>
> > the<br>
> > Chamelium (implemented in the HDL) with a hardcoded reference value.<br>
> ><br>
> > This approach currently fails for me (the values I get don't match the<br>
> > hardcoded<br>
> > reference). There are reasons why it is not really reasonable: fonts<br>
> > rendering<br>
> > may change between machines (e.g. use of anti-aliasing) and cairo version<br>
> > changes could introduce slight rendering changes too (not to mention changes<br>
> > in<br>
> > the test pattern itself). So instead of comparing the CRC with a hardcoded<br>
> > reference value, I think it would make a lot more sense to actually<br>
> > calculate<br>
> > the CRC based on the cairo image that is the actual reference (and that we<br>
> > should assume may change between runs/machines).<br>
> ><br>
> > I am currently looking into the CRC calculation mechanism used by the<br>
> > Chamelium<br>
> > and trying to reproduce it in C code. Is this a known algorithm for which a<br>
> > reference/optimized implementation exists, or something custom that the<br>
> > folks<br>
> > over at Google came up with?<br>
> ><br>
> > Any thoughts, comments or suggestions?<br>
><br>
> I feel bad about the stupid hash algorithm I came up with, but here is the<br>
> document:<br>
> <a href="https://docs.google.com/document/d/1_HjEMA8fBoHkUbpUZq-OXtITfiomCb1HBKN07T-POl" rel="noreferrer" target="_blank">https://docs.google.com/<wbr>document/d/1_<wbr>HjEMA8fBoHkUbpUZq-<wbr>OXtITfiomCb1HBKN07T-POl</a><br>
> Y/edit#heading=h.jqek3kkh9qjm<br>
> You can also ask it to hash just part of the frame instead of the whole frame<br>
> (i.e. cropping before hashing).<br>
<br>
</div></div>Thanks for the link to the relevant documentation! I have been following it<br>
closely and came up with the following implementation, which does not produce<br>
the same result. Would you have any idea of what I'm doing wrong?<br>
<br>
That function is called with m = 4 and k = { 0, 1, 2, 3 }. I am using a single-<br>
color-frame and the 4 hash16 I get from the Chamelium are identical. They are<br>
however different from the 4 (also identical) that I get from :<br>
<br>
int hash16(unsigned char *buffer, int width, int height, int k, int m)<br>
{<br>
unsigned char r, g, b;<br>
long int sum = 0;<br>
int count = 0;<br>
int index;<br>
int hash;<br>
int value;<br>
int i;<br>
<br>
for (i=0; i < width * height; i++) {<br>
if ((i % m) != k)<br>
continue;<br>
<br>
index = i * 3;<br>
<br>
r = buffer[index + 0];<br>
g = buffer[index + 1];<br>
b = buffer[index + 2];<br>
<br>
value = r | (g << 8) | (b << 16);<br>
sum += ++count * value;<br></blockquote><div><br></div><div>Maybe this multiplication overflows?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
hash = ((sum >> 48) ^ (sum >> 32) ^ (sum >> 16) ^ (sum >> 0)) & 0xffff;<br>
<br>
return hash;<br>
}<br>
<br>
I am certain that the r, g, b values are correct.<br>
<br>
Thanks!<br>
<span class=""><br>
--<br>
Paul Kocialkowski <<a href="mailto:paul.kocialkowski@linux.intel.com">paul.kocialkowski@linux.<wbr>intel.com</a>><br>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo<br>
<br>
</span><span class="">--<br>
N.B. This list is shared with folks outside Google so please make sure no confidential information is being discussed.<br>
---<br>
You received this message because you are subscribed to a topic in the Google Groups "chamelium-external" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/a/google.com/d/topic/chamelium-external/ITCjBMJHfGM/unsubscribe" rel="noreferrer" target="_blank">https://groups.google.com/a/<wbr>google.com/d/topic/chamelium-<wbr>external/ITCjBMJHfGM/<wbr>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:chamelium-external%2Bunsubscribe@google.com">chamelium-external+<wbr>unsubscribe@google.com</a>.<br>
To post to this group, send email to <a href="mailto:chamelium-external@google.com">chamelium-external@google.com</a>.<br>
</span>To view this discussion on the web visit <a href="https://groups.google.com/a/google.com/d/msgid/chamelium-external/1497605300.1451.9.camel%40linux.intel.com" rel="noreferrer" target="_blank">https://groups.google.com/a/<wbr>google.com/d/msgid/chamelium-<wbr>external/1497605300.1451.9.<wbr>camel%40linux.intel.com</a>.<br>
</blockquote></div><br></div></div>