From: Steinar H. Gunderson Date: Mon, 5 Nov 2012 20:36:43 +0000 (+0100) Subject: Add a variant of expect_equal() for uint8s. X-Git-Tag: 1.0~206 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=85526f893719c3267cbfe653cf0095fc1288f49d;ds=sidebyside Add a variant of expect_equal() for uint8s. --- diff --git a/test_util.cpp b/test_util.cpp index 3aecd54..cc02801 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -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); +} diff --git a/test_util.h b/test_util.h index 412acad..67e975d 100644 --- a/test_util.h +++ b/test_util.h @@ -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)