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/blockdsp: add fill_block test
@ 2024-04-29  7:09 flow gg
  2024-04-30  1:17 ` flow gg
  0 siblings, 1 reply; 2+ messages in thread
From: flow gg @ 2024-04-29  7:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-checkasm-blockdsp-add-fill_block-test.patch --]
[-- Type: text/x-patch, Size: 2107 bytes --]

From 0c196a37cb4036d8c618c06c02a011b910cc56ce Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Mon, 29 Apr 2024 14:18:23 +0800
Subject: [PATCH 1/2] checkasm/blockdsp: add fill_block test

---
 tests/checkasm/blockdsp.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index 22a2f79455..355e111d43 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -29,6 +29,11 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
 
+typedef struct {
+    const char *name;
+    int size;
+} test;
+
 #define randomize_buffers(size)             \
     do {                                    \
         int i;                              \
@@ -52,6 +57,31 @@ do {                                                                \
     }                                                               \
 } while (0)
 
+static void check_fill(BlockDSPContext *h){
+    const test tests[] = {
+        {"fill_block_tab[0]", 16},
+        {"fill_block_tab[1]", 8},
+    };
+    const int n = 16;
+
+    LOCAL_ALIGNED_32(uint8_t, buf0, [16 * 32]);
+    LOCAL_ALIGNED_32(uint8_t, buf1, [16 * 32]);
+
+    for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) {
+        declare_func(void, uint8_t *block, uint8_t value,
+                     ptrdiff_t line_size, int h);
+        if (check_func(h->fill_block_tab[t], "blockdsp.%s", tests[t].name)) {
+            uint8_t value = rnd();
+            randomize_buffers(tests[t].size);
+            call_ref(buf0, value, 16, n);
+            call_new(buf1, value, 16, n);
+            if (memcmp(buf0, buf1, sizeof(*buf0) * tests[t].size * n))
+                fail();
+            bench_new(buf0, value, 16, n);
+        }
+    }
+}
+
 void checkasm_check_blockdsp(void)
 {
     LOCAL_ALIGNED_32(uint16_t, buf0, [6 * 8 * 8]);
@@ -64,5 +94,7 @@ void checkasm_check_blockdsp(void)
     check_clear(clear_block,  8 * 8);
     check_clear(clear_blocks, 8 * 8 * 6);
 
+    check_fill(&h);
+
     report("blockdsp");
 }
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] checkasm/blockdsp: add fill_block test
  2024-04-29  7:09 [FFmpeg-devel] [PATCH 1/2] checkasm/blockdsp: add fill_block test flow gg
@ 2024-04-30  1:17 ` flow gg
  0 siblings, 0 replies; 2+ messages in thread
From: flow gg @ 2024-04-30  1:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

Since there is no 8x16, not test 8x16, and updated it in the reply

flow gg <hlefthleft@gmail.com> 于2024年4月29日周一 15:09写道:

>
>

[-- Attachment #2: 0001-checkasm-blockdsp-add-fill_block-test.patch --]
[-- Type: text/x-patch, Size: 2098 bytes --]

From fc7c28cb78e0c90880f31c0b8d6f2fc16d0fe581 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Mon, 29 Apr 2024 14:18:23 +0800
Subject: [PATCH 1/2] checkasm/blockdsp: add fill_block test

---
 tests/checkasm/blockdsp.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index 22a2f79455..19d69b8687 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -29,6 +29,11 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
 
+typedef struct {
+    const char *name;
+    int size;
+} test;
+
 #define randomize_buffers(size)             \
     do {                                    \
         int i;                              \
@@ -52,6 +57,30 @@ do {                                                                \
     }                                                               \
 } while (0)
 
+static void check_fill(BlockDSPContext *h){
+    const test tests[] = {
+        {"fill_block_tab[0]", 16},
+        {"fill_block_tab[1]", 8},
+    };
+    LOCAL_ALIGNED_32(uint8_t, buf0, [16 * 16]);
+    LOCAL_ALIGNED_32(uint8_t, buf1, [16 * 16]);
+
+    for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) {
+        int n = tests[t].size;
+        declare_func(void, uint8_t *block, uint8_t value,
+                     ptrdiff_t line_size, int h);
+        if (check_func(h->fill_block_tab[t], "blockdsp.%s", tests[t].name)) {
+            uint8_t value = rnd();
+            randomize_buffers(tests[t].size);
+            call_ref(buf0, value, n, n);
+            call_new(buf1, value, n, n);
+            if (memcmp(buf0, buf1, sizeof(*buf0) * n * n))
+                fail();
+            bench_new(buf0, value, n, n);
+        }
+    }
+}
+
 void checkasm_check_blockdsp(void)
 {
     LOCAL_ALIGNED_32(uint16_t, buf0, [6 * 8 * 8]);
@@ -64,5 +93,7 @@ void checkasm_check_blockdsp(void)
     check_clear(clear_block,  8 * 8);
     check_clear(clear_blocks, 8 * 8 * 6);
 
+    check_fill(&h);
+
     report("blockdsp");
 }
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2024-04-30  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-29  7:09 [FFmpeg-devel] [PATCH 1/2] checkasm/blockdsp: add fill_block test flow gg
2024-04-30  1:17 ` flow gg

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