Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] checkasm: sw_scale: Fix the difference printing for approximate functions
@ 2022-08-17 20:31 Martin Storsjö
  2022-08-17 20:31 ` [FFmpeg-devel] [PATCH 2/2] checkasm: sw_scale: Reduce range of test data in the yuv2yuvX test to get closer to real data Martin Storsjö
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Storsjö @ 2022-08-17 20:31 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Martin Storsjö, Alan Kelly

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@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-18  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 20:31 [FFmpeg-devel] [PATCH 1/2] checkasm: sw_scale: Fix the difference printing for approximate functions Martin Storsjö
2022-08-17 20:31 ` [FFmpeg-devel] [PATCH 2/2] checkasm: sw_scale: Reduce range of test data in the yuv2yuvX test to get closer to real data Martin Storsjö
2022-08-17 20:49   ` Ronald S. Bultje
2022-08-18  7:22     ` Martin Storsjö

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git