]> git.sesse.net Git - movit/commitdiff
Add a variant of expect_equal() for uint8s.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 5 Nov 2012 20:36:43 +0000 (21:36 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 5 Nov 2012 20:36:45 +0000 (21:36 +0100)
test_util.cpp
test_util.h

index 3aecd54463a9c6213e53e22dcbf26122ae64ff68..cc0280119aaab6c2c7984f91cb8cdf169aad4b99 100644 (file)
@@ -181,3 +181,18 @@ void expect_equal(const float *ref, const float *result, unsigned width, unsigne
                }
        }
 }
+
+void expect_equal(const unsigned char *ref, const unsigned char *result, unsigned width, unsigned height, unsigned largest_difference_limit, float rms_limit)
+{
+       float *ref_float = new float[width * height];
+       float *result_float = new float[width * height];
+
+       for (unsigned y = 0; y < height; ++y) {
+               for (unsigned x = 0; x < width; ++x) {
+                       ref_float[y * width + x] = ref[y * width + x];
+                       result_float[y * width + x] = result[y * width + x];
+               }
+       }
+
+       expect_equal(ref_float, result_float, width, height, largest_difference_limit, rms_limit);
+}
index 412acadd912f3423d8df35c4bbeff552636cd441..67e975da50644d483d13a2f08a7bd5970fdb611a 100644 (file)
@@ -27,5 +27,6 @@ private:
 };
 
 void expect_equal(const float *ref, const float *result, unsigned width, unsigned height, float largest_difference_limit = 1.5 / 255.0, float rms_limit = 0.2 / 255.0);
+void expect_equal(const unsigned char *ref, const unsigned char *result, unsigned width, unsigned height, unsigned largest_difference_limit = 1, float rms_limit = 0.2);
 
 #endif  // !defined(_TEST_UTIL_H)