X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=test_util.cpp;h=cc0280119aaab6c2c7984f91cb8cdf169aad4b99;hp=3aecd54463a9c6213e53e22dcbf26122ae64ff68;hb=85526f893719c3267cbfe653cf0095fc1288f49d;hpb=3140175e3160e75d659e596e420afffb596e3c2c 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); +}