[FFmpeg-devel] [PATCH 1/2] checkasm: sw_scale: Fix the difference printing for approximate functions
Martin Storsjö
martin at martin.st
Wed Aug 17 23:31:46 EEST 2022
Don't stop directly at the first differing pixel, but find the
one that differs by more than the expected accuracy.
Also print the failing value in check_yuv2yuvX.
Signed-off-by: Martin Storsjö <martin at martin.st>
---
tests/checkasm/sw_scale.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index cbe4460a99..d72506ed86 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -77,10 +77,10 @@ static void print_data(uint8_t *p, size_t len, size_t offset)
}
}
-static size_t show_differences(uint8_t *a, uint8_t *b, size_t len)
+static size_t show_differences(uint8_t *a, uint8_t *b, size_t len, int accuracy)
{
for (size_t i = 0; i < len; i++) {
- if (a[i] != b[i]) {
+ if (abs(a[i] - b[i]) > accuracy) {
size_t offset_of_mismatch = i;
size_t offset;
if (i >= 8) i-=8;
@@ -141,7 +141,7 @@ static void check_yuv2yuv1(int accurate)
if (cmp_off_by_n(dst0, dst1, dstW * sizeof(dst0[0]), accurate ? 0 : 2)) {
fail();
printf("failed: yuv2yuv1_%d_%di_%s\n", offset, dstW, accurate_str);
- fail_offset = show_differences(dst0, dst1, LARGEST_INPUT_SIZE * sizeof(dst0[0]));
+ fail_offset = show_differences(dst0, dst1, LARGEST_INPUT_SIZE * sizeof(dst0[0]), accurate ? 0 : 2);
printf("failing values: src: 0x%04x dither: 0x%02x dst-c: %02x dst-asm: %02x\n",
(int) src_pixels[fail_offset],
(int) dither[(fail_offset + fail_offset) & 7],
@@ -169,6 +169,7 @@ static void check_yuv2yuvX(int accurate)
static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
const int INPUT_SIZES = sizeof(input_sizes)/sizeof(input_sizes[0]);
const char *accurate_str = (accurate) ? "accurate" : "approximate";
+ size_t fail_offset;
declare_func_emms(AV_CPU_FLAG_MMX, void, const int16_t *filter,
int filterSize, const int16_t **src, uint8_t *dest,
@@ -224,7 +225,12 @@ static void check_yuv2yuvX(int accurate)
if (cmp_off_by_n(dst0, dst1, LARGEST_INPUT_SIZE * sizeof(dst0[0]), accurate ? 0 : 2)) {
fail();
printf("failed: yuv2yuvX_%d_%d_%d_%s\n", filter_sizes[fsi], osi, dstW, accurate_str);
- show_differences(dst0, dst1, LARGEST_INPUT_SIZE * sizeof(dst0[0]));
+ fail_offset = show_differences(dst0, dst1, LARGEST_INPUT_SIZE * sizeof(dst0[0]), accurate ? 0 : 2);
+ printf("failing values: src: 0x%04x dither: 0x%02x dst-c: %02x dst-asm: %02x\n",
+ (int) src_pixels[fail_offset],
+ (int) dither[(fail_offset + osi) & 7],
+ (int) dst0[fail_offset],
+ (int) dst1[fail_offset]);
}
if(dstW == LARGEST_INPUT_SIZE)
bench_new((const int16_t*)vFilterData, filter_sizes[fsi], src, dst1, dstW - osi, dither, osi);
--
2.25.1
More information about the ffmpeg-devel
mailing list