Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "J. Dekker" <jdek@itanimul.li>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] checkasm: improve hevc_sao test
Date: Tue, 17 May 2022 13:54:29 +0200
Message-ID: <20220517115429.2020-1-jdek@itanimul.li> (raw)
In-Reply-To: <5625a69f-a280-df32-7e1d-304511bd055@martin.st>

The HEVC decoder can call these functions with smaller widths than the
functions themselves are designed to operate on so we should only check
the relevant output

Signed-off-by: J. Dekker <jdek@itanimul.li>
---
 tests/checkasm/hevc_sao.c | 51 ++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/tests/checkasm/hevc_sao.c b/tests/checkasm/hevc_sao.c
index 6b750758e2..72cdb87dd1 100644
--- a/tests/checkasm/hevc_sao.c
+++ b/tests/checkasm/hevc_sao.c
@@ -78,20 +78,26 @@ static void check_sao_band(HEVCDSPContext h, int bit_depth)
 
     for (i = 0; i <= 4; i++) {
         int block_size = sao_size[i];
+        int prev_size = i > 0 ? sao_size[i - 1] : 0;
         ptrdiff_t stride = PIXEL_STRIDE*SIZEOF_PIXEL;
         declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride,
                           int16_t *sao_offset_val, int sao_left_class, int width, int height);
 
-        randomize_buffers(src0, src1, BUF_SIZE);
-        randomize_buffers2(offset_val, OFFSET_LENGTH);
-        memset(dst0, 0, BUF_SIZE);
-        memset(dst1, 0, BUF_SIZE);
-
-        if (check_func(h.sao_band_filter[i], "hevc_sao_band_%dx%d_%d", block_size, block_size, bit_depth)) {
-            call_ref(dst0, src0, stride, stride, offset_val, left_class, block_size, block_size);
-            call_new(dst1, src1, stride, stride, offset_val, left_class, block_size, block_size);
-            if (memcmp(dst0, dst1, BUF_SIZE))
-                fail();
+        if (check_func(h.sao_band_filter[i], "hevc_sao_band_%d_%d", block_size, bit_depth)) {
+
+            for (int w = prev_size + 4; w <= block_size; w += 4) {
+                randomize_buffers(src0, src1, BUF_SIZE);
+                randomize_buffers2(offset_val, OFFSET_LENGTH);
+                memset(dst0, 0, BUF_SIZE);
+                memset(dst1, 0, BUF_SIZE);
+
+                call_ref(dst0, src0, stride, stride, offset_val, left_class, w, block_size);
+                call_new(dst1, src1, stride, stride, offset_val, left_class, w, block_size);
+                for (int j = 0; j < block_size; j++) {
+                    if (memcmp(dst0 + j*MAX_PB_SIZE*2, dst1 + j*MAX_PB_SIZE*2, w))
+                        fail();
+                }
+            }
             bench_new(dst1, src1, stride, stride, offset_val, left_class, block_size, block_size);
         }
     }
@@ -109,21 +115,26 @@ static void check_sao_edge(HEVCDSPContext h, int bit_depth)
 
     for (i = 0; i <= 4; i++) {
         int block_size = sao_size[i];
+        int prev_size = i > 0 ? sao_size[i - 1] : 0;
         ptrdiff_t stride = PIXEL_STRIDE*SIZEOF_PIXEL;
         int offset = (AV_INPUT_BUFFER_PADDING_SIZE + PIXEL_STRIDE)*SIZEOF_PIXEL;
         declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
                           int16_t *sao_offset_val, int eo, int width, int height);
 
-        randomize_buffers(src0, src1, BUF_SIZE);
-        randomize_buffers2(offset_val, OFFSET_LENGTH);
-        memset(dst0, 0, BUF_SIZE);
-        memset(dst1, 0, BUF_SIZE);
-
-        if (check_func(h.sao_edge_filter[i], "hevc_sao_edge_%dx%d_%d", block_size, block_size, bit_depth)) {
-            call_ref(dst0, src0 + offset, stride, offset_val, eo, block_size, block_size);
-            call_new(dst1, src1 + offset, stride, offset_val, eo, block_size, block_size);
-            if (memcmp(dst0, dst1, BUF_SIZE))
-                fail();
+        for (int w = prev_size + 4; w <= block_size; w += 4) {
+            randomize_buffers(src0, src1, BUF_SIZE);
+            randomize_buffers2(offset_val, OFFSET_LENGTH);
+            memset(dst0, 0, BUF_SIZE);
+            memset(dst1, 0, BUF_SIZE);
+
+            if (check_func(h.sao_edge_filter[i], "hevc_sao_edge_%d_%d", block_size, bit_depth)) {
+                call_ref(dst0, src0 + offset, stride, offset_val, eo, w, block_size);
+                call_new(dst1, src1 + offset, stride, offset_val, eo, w, block_size);
+                for (int j = 0; j < block_size; j++) {
+                    if (memcmp(dst0 + j*MAX_PB_SIZE*2, dst1 + j*MAX_PB_SIZE*2, w))
+                        fail();
+                }
+            }
             bench_new(dst1, src1 + offset, stride, offset_val, eo, block_size, block_size);
         }
     }
-- 
2.32.0 (Apple Git-132)

_______________________________________________
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".

  parent reply	other threads:[~2022-05-17 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 13:42 [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: fix hevc sao band filter J. Dekker
2022-04-28 13:42 ` [FFmpeg-devel] [PATCH 2/3] lavc/aarch64: add hevc sao edge 16x16 J. Dekker
2022-04-28 13:42 ` [FFmpeg-devel] [PATCH 3/3] lavc/aarch64: add hevc sao edge 8x8 J. Dekker
2022-04-28 19:50   ` Martin Storsjö
2022-05-17 11:53     ` J. Dekker
2022-05-17 11:54     ` J. Dekker [this message]
2022-05-24 20:27       ` [FFmpeg-devel] [PATCH] checkasm: improve hevc_sao test Martin Storsjö
2022-05-25  7:21         ` J. Dekker
2022-05-25  7:40           ` Martin Storsjö
2022-04-28 13:43 ` [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: fix hevc sao band filter J. Dekker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220517115429.2020-1-jdek@itanimul.li \
    --to=jdek@itanimul.li \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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