MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / compare

Function compare

Source/Tools/ImageCompare/ImageCompare.cpp:236–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234
235template<typename Metric>
236double compare(const Image& imageA, const Image& imageB, bool alpha, float* errorMap)
237{
238 Metric metric;
239 double sum = 0.0;
240 const float* a = imageA.getData();
241 const float* b = imageB.getData();
242 size_t count = imageA.getWidth() * imageA.getHeight();
243 for (size_t i = 0; i < count; ++i)
244 {
245 double error = metric(a, b, alpha ? 4 : 3);
246 if (errorMap)
247 *errorMap++ = float(error);
248 sum += error;
249 a += 4;
250 b += 4;
251 }
252 return sum / count;
253}
254
255struct ErrorMetric
256{

Callers 1

createBinaryMessageFunction · 0.85

Calls 3

getWidthMethod · 0.80
getHeightMethod · 0.80
getDataMethod · 0.45

Tested by 1

createBinaryMessageFunction · 0.68