From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3011D48482 for ; Tue, 5 Dec 2023 11:42:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CFBE168C482; Tue, 5 Dec 2023 13:42:25 +0200 (EET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02A0168BDB6 for ; Tue, 5 Dec 2023 13:42:19 +0200 (EET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AAE835C0099; Tue, 5 Dec 2023 06:42:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 05 Dec 2023 06:42:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1701776538; x=1701862938; bh=VByahtKMan vxOVX52nxs5YDDebHc7HHj+z9UTlywiWk=; b=IlVlxLFE9IN0BgclWPU8qfm/Lf EbKJqJY1uUiGa35SZOIc1sxucFNWVqCDj5TLaEfjN8SPOjlD2L/0oWKTtn6gy3wf SSXXSucMmDT1GMhFU0kIDR1JIamp1Vs6Tj7iGzZqxwMk4iLafWtV7sInoMbzFXiQ i4q1aan/KAdEsQ/ZvA78eZ9BRE0dRdMOrKfCPd0c1pV2lScuAc3CIH+4fd9d4fer t3dZ0GsRrBCsQeQ5k2qe3DcCukXyYWCXB+9EThvZfjGcS1HdSEMBbUbefrYEbDJb 9DPCbJrDdCRJrV5JREv6tojBlxzE0yH40XqZYpRlTBC89qrK4rp02S5QqAKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701776538; x=1701862938; bh=VByahtKManvxO VX52nxs5YDDebHc7HHj+z9UTlywiWk=; b=wRFusQnvrb4x+QHlfXt/MmwJF8Xct NnN+M22wo72dCHC4FwrhxDfuKjlcoft+MoXQEjKmDnBp+fZxUvdb1LUnzk20NYzz UUrpw5EJx/aVlYKxfKS8RAPn4a/8bmpka2h9l0GVofimeJIqo7ZRwHhixExf1JSv JV02eBxVcR2GMlvbud94CCVQJGzGXK0EdVMrbK1kKrUHnn9Tebr385nCdcxDBP3C FiScrbvnhFZYFMZEkDa+hZuCi9okDe775uCplqANfI45T4rsbV8MTf3YHhvjWVcG AVQ6zlmMztAsfyjkb4B7Oc4OPdZoJTglbUyU86x2GghFtg0b1KVj44u5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejkedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeejtefhhfefhfehveefleejleffkeekkeeuvd duffekudejgfdtffehleelhfdvueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Dec 2023 06:42:17 -0500 (EST) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Tue, 5 Dec 2023 12:41:46 +0100 Message-Id: <20231205114146.7936-1-jdek@itanimul.li> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm/hevc_deblock: add luma test X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: martin@martin.st Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: J. Dekker --- tests/checkasm/hevc_deblock.c | 110 ++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 4 deletions(-) Yes, this only supports 8bit. 10/12bit should be trivial, will add if this looks reasonable (I checked code paths using gdb, and as far as I can tell it does test all three). Tested on known good x86 asm. diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c index 66fc8d5646..3f970a470a 100644 --- a/tests/checkasm/hevc_deblock.c +++ b/tests/checkasm/hevc_deblock.c @@ -29,8 +29,8 @@ static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff }; #define SIZEOF_PIXEL ((bit_depth + 7) / 8) -#define BUF_STRIDE (8 * 2) -#define BUF_LINES (8) +#define BUF_STRIDE (16 * 2) +#define BUF_LINES (16) #define BUF_OFFSET (BUF_STRIDE * BUF_LINES) #define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2) @@ -88,14 +88,116 @@ static void check_deblock_chroma(HEVCDSPContext *h, int bit_depth) } } +// line zero +#define P3 buf[-4 * xstride] +#define P2 buf[-3 * xstride] +#define P1 buf[-2 * xstride] +#define P0 buf[-1 * xstride] +#define Q0 buf[0 * xstride] +#define Q1 buf[1 * xstride] +#define Q2 buf[2 * xstride] +#define Q3 buf[3 * xstride] + +// line three. used only for deblocking decision +#define TP3 buf[-4 * xstride + 3 * ystride] +#define TP2 buf[-3 * xstride + 3 * ystride] +#define TP1 buf[-2 * xstride + 3 * ystride] +#define TP0 buf[-1 * xstride + 3 * ystride] +#define TQ0 buf[0 * xstride + 3 * ystride] +#define TQ1 buf[1 * xstride + 3 * ystride] +#define TQ2 buf[2 * xstride + 3 * ystride] +#define TQ3 buf[3 * xstride + 3 * ystride] + +static void randomize_luma_buffers(int type, uint8_t *buf, ptrdiff_t xstride, ptrdiff_t ystride) +{ + int i; + buf += BUF_OFFSET; + switch (type) { + case 0: // strong + for (i = 0; i < 16; i++) { + P3 = P2 = P1 = P0 = 64; + Q0 = Q1 = Q2 = Q3 = 80; + buf += ystride; + } + break; + case 1: // weak + for (i = 0; i < 16; i++) { + P3 = P2 = 60; P1 = P0 = 64; + Q0 = Q1 = 74; Q2 = Q3 = 80; + buf += ystride; + } + break; + case 2: // none + for (i = 0; i < 16; i++) { + for (int j = -8; j < 8; j++) { + buf[j * xstride + i * ystride] = rnd(); + } + } + break; + } +} + +static void check_deblock_luma(HEVCDSPContext *h, int bit_depth) +{ + const char *type; + const char *types[3] = { "strong", "normal", "skip" }; + int beta; + int32_t tc[2] = { 0, 0 }; + // no_p, no_q can only be { 0,0 } for the simpler assembly (non *_c + // variant) functions, see deblocking_filter_CTB() in hevc_filter.c + uint8_t no_p[2] = { 0, 0 }; + uint8_t no_q[2] = { 0, 0 }; + LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]); + + declare_func(void, uint8_t *pix, ptrdiff_t stride, int beta, int32_t *tc, uint8_t *no_p, uint8_t *no_q); + + for (int j = 0; j < 3; j++) { + beta = (j == 3) ? 0 : 32; // beta easy way to turn off filtering + type = types[j]; + + // see betatable[] in hevc_filter.c + tc[0] = (rnd() & 63) + (rnd() & 1); + tc[1] = (rnd() & 63) + (rnd() & 1); + + if (check_func(h->hevc_h_loop_filter_luma, "hevc_h_loop_filter_luma%d_%s", bit_depth, type)) { + for (int i = 0; i < 4; i++) { + randomize_luma_buffers(j, buf0, 16, 1); + memcpy(buf1, buf0, BUF_SIZE); + + call_ref(buf0 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + } + bench_new(buf1 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + } + + if (check_func(h->hevc_v_loop_filter_luma, "hevc_v_loop_filter_luma%d_%s", bit_depth, type)) { + for (int i = 0; i < 4; i++) { + randomize_luma_buffers(j, buf0, 1, 16); + memcpy(buf1, buf0, BUF_SIZE); + + call_ref(buf0 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + } + bench_new(buf1 + BUF_OFFSET, 16, beta, tc, no_p, no_q); + } + } +} + void checkasm_check_hevc_deblock(void) { + HEVCDSPContext h; int bit_depth; - for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { - HEVCDSPContext h; ff_hevc_dsp_init(&h, bit_depth); check_deblock_chroma(&h, bit_depth); } report("chroma"); + ff_hevc_dsp_init(&h, 8); + check_deblock_luma(&h, 8); + report("luma"); } -- 2.40.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".