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/4] checkasm/vvc_alf: only check the valid filter and classify sizes
@ 2024-06-22  4:21 Nuo Mi
  0 siblings, 0 replies; only message in thread
From: Nuo Mi @ 2024-06-22  4:21 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: benjamin.bross, Nuo Mi

---
 tests/checkasm/vvc_alf.c | 61 ++++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c
index 84b0f9da15..902757aff1 100644
--- a/tests/checkasm/vvc_alf.c
+++ b/tests/checkasm/vvc_alf.c
@@ -90,35 +90,41 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth)
     randomize_buffers2(filter, LUMA_PARAMS_SIZE, 1);
     randomize_buffers2(clip, LUMA_PARAMS_SIZE, 0);
 
-    for (int h = 4; h <= MAX_CTU_SIZE; h += 8) {
-        for (int w = 4; w <= MAX_CTU_SIZE; w += 8) {
+    for (int h = 4; h <= MAX_CTU_SIZE; h += 4) {
+        for (int w = 4; w <= MAX_CTU_SIZE; w += 4) {
             const int ctu_size = MAX_CTU_SIZE;
-            if (check_func(c->alf.filter[LUMA], "vvc_alf_filter_luma_%dx%d_%d", w, h, bit_depth)) {
-                const int vb_pos = ctu_size - ALF_VB_POS_ABOVE_LUMA;
-                memset(dst0, 0, DST_BUF_SIZE);
-                memset(dst1, 0, DST_BUF_SIZE);
-                call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
-                call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
-                for (int i = 0; i < h; i++) {
-                    if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, w * SIZEOF_PIXEL))
-                        fail();
+            //Both picture size and virtual boundaries are 8-aligned. For luma, we only need to check 8-aligned sizes.
+            if (!(w % 8) && !(h % 8)) {
+                if (check_func(c->alf.filter[LUMA], "vvc_alf_filter_luma_%dx%d_%d", w, h, bit_depth)) {
+                    const int vb_pos = ctu_size - ALF_VB_POS_ABOVE_LUMA;
+                    memset(dst0, 0, DST_BUF_SIZE);
+                    memset(dst1, 0, DST_BUF_SIZE);
+                    call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
+                    call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
+                    for (int i = 0; i < h; i++) {
+                        if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, w * SIZEOF_PIXEL))
+                            fail();
+                    }
+                    // Bench only square sizes, and ones with dimensions being a power of two.
+                    if (w == h && (w & (w - 1)) == 0)
+                        bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
                 }
-                // Bench only square sizes, and ones with dimensions being a power of two.
-                if (w == h && (w & (w - 1)) == 0)
-                    bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
             }
-            if (check_func(c->alf.filter[CHROMA], "vvc_alf_filter_chroma_%dx%d_%d", w, h, bit_depth)) {
-                const int vb_pos = ctu_size - ALF_VB_POS_ABOVE_CHROMA;
-                memset(dst0, 0, DST_BUF_SIZE);
-                memset(dst1, 0, DST_BUF_SIZE);
-                call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
-                call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
-                for (int i = 0; i < h; i++) {
-                    if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, w * SIZEOF_PIXEL))
-                        fail();
+            //For chroma, once it exceeds 64, it's not a 4:2:0 format, so we only need to check 8-aligned sizes as well.
+            if ((w <= 64 || !(w % 8)) && (h <= 64 || !(h % 8))) {
+                if (check_func(c->alf.filter[CHROMA], "vvc_alf_filter_chroma_%dx%d_%d", w, h, bit_depth)) {
+                    const int vb_pos = ctu_size - ALF_VB_POS_ABOVE_CHROMA;
+                    memset(dst0, 0, DST_BUF_SIZE);
+                    memset(dst1, 0, DST_BUF_SIZE);
+                    call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
+                    call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
+                    for (int i = 0; i < h; i++) {
+                        if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, w * SIZEOF_PIXEL))
+                            fail();
+                    }
+                    if (w == h && (w & (w - 1)) == 0)
+                        bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
                 }
-                if (w == h && (w & (w - 1)) == 0)
-                    bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
             }
         }
     }
@@ -142,8 +148,9 @@ static void check_alf_classify(VVCDSPContext *c, const int bit_depth)
 
     randomize_buffers(src0, src1, SRC_BUF_SIZE);
 
-    for (int h = 4; h <= MAX_CTU_SIZE; h += 8) {
-        for (int w = 4; w <= MAX_CTU_SIZE; w += 8) {
+    //Both picture size and virtual boundaries are 8-aligned. Classify is luma only, we only need to check 8-aligned sizes.
+    for (int h = 8; h <= MAX_CTU_SIZE; h += 8) {
+        for (int w = 8; w <= MAX_CTU_SIZE; w += 8) {
             const int id_size = w * h / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE * sizeof(int);
             const int vb_pos  = MAX_CTU_SIZE - ALF_BLOCK_SIZE;
             if (check_func(c->alf.classify, "vvc_alf_classify_%dx%d_%d", w, h, bit_depth)) {
-- 
2.34.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] only message in thread

only message in thread, other threads:[~2024-06-22  4:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-22  4:21 [FFmpeg-devel] [PATCH 1/4] checkasm/vvc_alf: only check the valid filter and classify sizes Nuo Mi

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