From: José Fonseca Date: Tue, 8 Feb 2011 16:23:56 +0000 (+0000) Subject: Ignore alpha channel. X-Git-Tag: 2.0_alpha^2~1216 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73ed1d851fbe611d42cc8a4650ed142bb596a877;p=tools%2Fapitrace.git Ignore alpha channel. Until we are able to pick a visual that matches the traces. --- diff --git a/TODO b/TODO index 0a516f0..fe722dd 100644 --- a/TODO +++ b/TODO @@ -13,6 +13,8 @@ * Allow clamping to a GL version or a number of extensions. +* Match the traced visuals (which will imply abandoning GLUT) + * Trace multiple threads * GetCurrentThreadId() * pthread_self() diff --git a/image.cpp b/image.cpp index 9fd1dc8..a42a78d 100644 --- a/image.cpp +++ b/image.cpp @@ -286,9 +286,13 @@ double Image::compare(Image &ref) unsigned long long error = 0; for (unsigned y = 0; y < height; ++y) { - for (unsigned x = 0; x < width*4; ++x) { - int delta = pSrc[x] - pRef[x]; - error += delta*delta; + for (unsigned x = 0; x < width; ++x) { + // FIXME: Ignore alpha channel until we are able to pick a visual + // that matches the traces + for (unsigned c = 0; c < 3; ++c) { + int delta = pSrc[x*4 + c] - pRef[x*4 + c]; + error += delta*delta; + } } pSrc += stride(); @@ -296,7 +300,7 @@ double Image::compare(Image &ref) } double numerator = error*2 + 1; - double denominator = height*width*4ULL*255ULL*255ULL*2; + double denominator = height*width*3ULL*255ULL*255ULL*2; double quotient = numerator/denominator; // Precision in bits