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] checkasm/h264dsp: add chroma_mc checkasm test
@ 2023-05-18 14:21 Lynne
       [not found] ` <NVjEACm--3-9@lynne.ee-NVjEEFt----9>
  0 siblings, 1 reply; 2+ messages in thread
From: Lynne @ 2023-05-18 14:21 UTC (permalink / raw)
  To: Ffmpeg Devel

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

Checks all variants of put_h264_chroma and avg_h264_chroma.

Patch attached.


[-- Attachment #2: 0001-checkasm-h264dsp-add-chroma_mc-checkasm-test.patch --]
[-- Type: text/x-diff, Size: 3585 bytes --]

From 001abdaa534ccb601aa8ee1431c04e33913401a2 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Thu, 18 May 2023 16:18:16 +0200
Subject: [PATCH] checkasm/h264dsp: add chroma_mc checkasm test

Checks all variants of put_h264_chroma and avg_h264_chroma.
---
 tests/checkasm/h264dsp.c | 45 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index 3c95f9d74d..e1f8e21ca2 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -22,6 +22,7 @@
 #include "checkasm.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/h264dsp.h"
+#include "libavcodec/h264chroma.h"
 #include "libavcodec/h264data.h"
 #include "libavcodec/h264_parse.h"
 #include "libavutil/common.h"
@@ -440,6 +441,47 @@ static void check_loop_filter_intra(void)
     }
 }
 
+static void check_chroma_mc(void)
+{
+    H264ChromaContext h;
+    LOCAL_ALIGNED_32(uint8_t, src,  [16 * 18 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst0, [16 * 18 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst1, [16 * 18 * 2]);
+
+    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src,
+                      ptrdiff_t stride, int h, int x, int y);
+
+    memset(src, 3, 16*18*2);
+
+    for (int bit_depth = 8; bit_depth <= 10; bit_depth++) {
+        ff_h264chroma_init(&h, bit_depth);
+        for (int size = 0; size < 4; size++) {
+
+#define CHECK_CHROMA_MC(name)                                                                         \
+            do {                                                                                      \
+                if (check_func(h.name## _pixels_tab[size], #name "_mc%d_%d", 1 << size, bit_depth)) { \
+                    for (int x = 0; x < 2; x++) {                                                     \
+                        for (int y = 0; y < 2; y++) {                                                 \
+                            memcpy(dst0, src, 16 * 16 * SIZEOF_PIXEL);                                \
+                            memcpy(dst1, src, 16 * 16 * SIZEOF_PIXEL);                                \
+                            call_ref(dst0, src, 16 * SIZEOF_PIXEL, 16, x, y);                         \
+                            call_new(dst1, src, 16 * SIZEOF_PIXEL, 16, x, y);                         \
+                            if (memcmp(dst0, dst1, 16 * 16 * SIZEOF_PIXEL)) {                         \
+                                fprintf(stderr, #name ": x:%i, y:%i\n", x, y);                        \
+                                fail();                                                               \
+                            }                                                                         \
+                            bench_new(dst1, src, 16 * SIZEOF_PIXEL, 16, x, y);                        \
+                        }                                                                             \
+                    }                                                                                 \
+                }                                                                                     \
+            } while (0)
+
+            CHECK_CHROMA_MC(put_h264_chroma);
+            CHECK_CHROMA_MC(avg_h264_chroma);
+        }
+    }
+}
+
 void checkasm_check_h264dsp(void)
 {
     check_idct();
@@ -451,4 +493,7 @@ void checkasm_check_h264dsp(void)
 
     check_loop_filter_intra();
     report("loop_filter_intra");
+
+    check_chroma_mc();
+    report("chroma_mc");
 }
-- 
2.40.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] checkasm/h264dsp: add chroma_mc checkasm test
       [not found] ` <NVjEACm--3-9@lynne.ee-NVjEEFt----9>
@ 2023-05-20 18:36   ` Lynne
  0 siblings, 0 replies; 2+ messages in thread
From: Lynne @ 2023-05-20 18:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

May 18, 2023, 16:21 by dev@lynne.ee:

> Checks all variants of put_h264_chroma and avg_h264_chroma.
>
> Patch attached.
>

Pushed a better and more correct version.
_______________________________________________
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:[~2023-05-20 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-18 14:21 [FFmpeg-devel] [PATCH] checkasm/h264dsp: add chroma_mc checkasm test Lynne
     [not found] ` <NVjEACm--3-9@lynne.ee-NVjEEFt----9>
2023-05-20 18:36   ` Lynne

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