From patchwork Thu Aug 5 08:26:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 29280 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp193547ioh; Thu, 5 Aug 2021 01:27:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG8SxsifFDFvG7U68up6rw1LmjJOCJHelc00sKEqhQCS/4hKlJ4PDW+KLB8lK+StbAslsp X-Received: by 2002:a05:6402:b82:: with SMTP id cf2mr4931281edb.71.1628152044152; Thu, 05 Aug 2021 01:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628152044; cv=none; d=google.com; s=arc-20160816; b=Hxq5cZ3zswc4i+bjdr4YgdjwPICSg3PuJkSl5nXcfSs1Dm8YJwqC3ahCCNowIwfahR czLk5xs/8N9t5tuwUMWQQBfVTI7aiLon2dNkct3rpRbhhSgdcWqV3TfvOqopgMrn6jSf tvwQahYn9K4zRKuIQj5MemQpZbYrslJYLntP0S9gpk06n2nUjI3kBhal5iOL+ftil/gS PXhjahXn6aESOVsjHwiiSW87L4FquKYkBKzPjKWt0GTzIInzmvnPbYlSYKc3HuDc0VfY CDgOiR5zTWodEQWpSLxAoY5InkfF7xM+Zuom8G5SQeUJt4jPnbDY8ulgnVI+emEnBk75 d/hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-signature:delivered-to; bh=l9tyvMzAeF0Sbw11uK/LfN6gZHCIuVmRMVfVx6gCu0E=; b=wQGhcFLPdrsXYxQ5RLABgNqjBaJgDEijO77NvdPOA81OFwHki4wuEi2Ed+J9S9N4Dv m27D1rWrMyIxya482qB6wvhCYRRSExGWx7/JBPdthox7pYiH8vrYXcpmjA2gvnVuZn0T dhZBFfePDm6TZHaE6GiO8efUzl74moZDcaNSGrcxSRiTO/cZWY7AzJpvb6X4a4A/U9N+ h4V1zGdwftYOK1I0oDJILxN5MXOLDmlLN6Yrkm9VFOkHjtQDDMrjcOHWv13JohUZ1w6n 9WgmQzAyVGH61mHVDCfBFRAVhhDHn4/3pndpE9D7KkaqsV6v+LqppOaQPB6aqDWjVsUs YAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=S+0DEvA+; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=YHU49zcL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p11si5167064ejo.734.2021.08.05.01.27.23; Thu, 05 Aug 2021 01:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=S+0DEvA+; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=YHU49zcL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2F5D68A348; Thu, 5 Aug 2021 11:27:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 73B536802FF for ; Thu, 5 Aug 2021 11:26:55 +0300 (EEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9BAAE5C014F for ; Thu, 5 Aug 2021 04:26:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 05 Aug 2021 04:26:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=N7MhHDkojZOvM XdsKVjHyJ5mNPZkV+fMPM16akuuzIk=; b=S+0DEvA+P5aM3ZpLrsWEnC+cTZpuy mnHRjOfVrqaDA7VZBwc35XVtqQ6urIlCtF3ueEBdW8D6YCYRoqzdJeKwEt/UFgu8 zLcUu4b2JswBAR0FHyll1wxWd7KqFdRM5n6Gemcwq+dLVuoMhngQMBkxcnJzOb7c EcqCKAWVvf7D80aLha5MG9sHRv2LpQOK8pTq7jJZ6NAuvl180iRa+xtixWbambmd VGEUzFc5s0dSXJ/T8llOKdXLHawrnNl6EU3AeMKuCN0o34KHmmEDXrIZAnpkxIeG vI6fBMKSB+ZTJvMGn3lEt7GfwVHZKdtCZZHlwkzzit6nyPo5o/rZmQs2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=N7MhHDkojZOvMXdsKVjHyJ5mNPZkV+fMPM16akuuzIk=; b=YHU49zcL +X1Ji44ysKV6SC3T7khx3KLFwlv49uK2XFwt+YnQnxMC/ubwgD0E7cyeZcaAfh2k 7wDcvXQLmtrtxyApn26y2wzgFpKHz/eju0XtfutHV8VSPH+JgGllWqxHBTZBiZoR PayKCSdlpwbMUncHVfqn2YxyjAiMUOVIHjsfudFbso8uSQV1X6O9CTFPwBGSLA55 XRoUTDI82XdfAMrk4+wW+hTPm8TFhU3I0ZPJWm1oa/NICalTuyNQ05rVT+ko9Epg VowiR5WFODP62a6FwWbQ34C7fZZjlG25/7qNVuOL7nHSljS3cz8RB7Fb5u/4Z8q5 XhBg9CQq6lcP9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieelgddtgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeegvdfhffduudegheevieekieeffefgveffke dtheekieefhfevueetueefhfetteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 5 Aug 2021 04:26:53 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Aug 2021 10:26:50 +0200 Message-Id: <20210805082650.32639-3-jdek@itanimul.li> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210805082650.32639-1-jdek@itanimul.li> References: <20210805082650.32639-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] checkasm: add hevc_deblock tests 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yHEucK/irfRr Signed-off-by: J. Dekker --- 0001-checkasm-add-hevc_deblock-tests.patch | 186 +++++++++++++++++++++ tests/checkasm/Makefile | 2 +- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/hevc_deblock.c | 126 ++++++++++++++ tests/fate/checkasm.mak | 1 + 6 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 0001-checkasm-add-hevc_deblock-tests.patch create mode 100644 tests/checkasm/hevc_deblock.c diff --git a/0001-checkasm-add-hevc_deblock-tests.patch b/0001-checkasm-add-hevc_deblock-tests.patch new file mode 100644 index 0000000000..29441e53f6 --- /dev/null +++ b/0001-checkasm-add-hevc_deblock-tests.patch @@ -0,0 +1,186 @@ +From a8b2d2259cb8ca5e30b2efae8aa8813eaa768615 Mon Sep 17 00:00:00 2001 +From: "J. Dekker" +Date: Mon, 28 Jun 2021 04:46:49 +0200 +Subject: [PATCH] checkasm: add hevc_deblock tests + +Signed-off-by: J. Dekker +--- + tests/checkasm/Makefile | 2 +- + tests/checkasm/checkasm.c | 1 + + tests/checkasm/checkasm.h | 1 + + tests/checkasm/hevc_deblock.c | 126 ++++++++++++++++++++++++++++++++++ + 4 files changed, 129 insertions(+), 1 deletion(-) + create mode 100644 tests/checkasm/hevc_deblock.c + +diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile +index 4ef5fa87da..481a96e36e 100644 +--- a/tests/checkasm/Makefile ++++ b/tests/checkasm/Makefile +@@ -24,7 +24,7 @@ AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuvdsp.o + AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o + AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o + AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o +-AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_idct.o hevc_sao.o hevc_pel.o ++AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o + AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o + AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o + AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o +diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c +index eb9e2cd677..1fe67007cc 100644 +--- a/tests/checkasm/checkasm.c ++++ b/tests/checkasm/checkasm.c +@@ -115,6 +115,7 @@ static const struct { + #endif + #if CONFIG_HEVC_DECODER + { "hevc_add_res", checkasm_check_hevc_add_res }, ++ { "hevc_deblock", checkasm_check_hevc_deblock }, + { "hevc_idct", checkasm_check_hevc_idct }, + { "hevc_qpel", checkasm_check_hevc_qpel }, + { "hevc_qpel_uni", checkasm_check_hevc_qpel_uni }, +diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h +index b747ed1986..8ecb4f0cf0 100644 +--- a/tests/checkasm/checkasm.h ++++ b/tests/checkasm/checkasm.h +@@ -60,6 +60,7 @@ void checkasm_check_h264dsp(void); + void checkasm_check_h264pred(void); + void checkasm_check_h264qpel(void); + void checkasm_check_hevc_add_res(void); ++void checkasm_check_hevc_deblock(void); + void checkasm_check_hevc_idct(void); + void checkasm_check_hevc_qpel(void); + void checkasm_check_hevc_qpel_uni(void); +diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c +new file mode 100644 +index 0000000000..98f612921b +--- /dev/null ++++ b/tests/checkasm/hevc_deblock.c +@@ -0,0 +1,126 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with FFmpeg; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++#include ++ ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem_internal.h" ++ ++#include "libavcodec/avcodec.h" ++#include "libavcodec/hevcdsp.h" ++ ++#include "checkasm.h" ++ ++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_OFFSET (BUF_STRIDE * BUF_LINES) ++#define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2) ++ ++#define randomize_buffers(buf0, buf1, size) \ ++ do { \ ++ uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \ ++ int k; \ ++ for (k = 0; k < size; k += 4) { \ ++ uint32_t r = rnd() & mask; \ ++ AV_WN32A(buf0 + k, r); \ ++ AV_WN32A(buf1 + k, r); \ ++ } \ ++ } while (0) ++ ++ ++static void check_deblock_luma(HEVCDSPContext h, int bit_depth) ++{ ++ int32_t tc[2] = { 1, 1 }; ++ uint8_t no_p[2] = { 0, 0 }; ++ uint8_t no_q[2] = { 0, 0 }; ++ int beta = rnd() & (0x40 - 1); ++ LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]); ++ LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]); ++ ++ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int beta, int32_t *tc, uint8_t *no_p, uint8_t *no_q); ++ ++ randomize_buffers(buf0, buf1, BUF_SIZE); ++ if (check_func(h.hevc_h_loop_filter_luma, "hevc_h_loop_filter_luma_%d", bit_depth)) { ++ call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ call_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ if (memcmp(buf0, buf1, BUF_SIZE)) ++ fail(); ++ bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ } ++ ++ randomize_buffers(buf0, buf1, BUF_SIZE); ++ if (check_func(h.hevc_v_loop_filter_luma, "hevc_v_loop_filter_luma_%d", bit_depth)) { ++ call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ call_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ if (memcmp(buf0, buf1, BUF_SIZE)) ++ fail(); ++ bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); ++ } ++} ++ ++static void check_deblock_chroma(HEVCDSPContext h, int bit_depth) ++{ ++ int32_t tc[2] = { 1, 1 }; ++ 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_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q); ++ ++ randomize_buffers(buf0, buf1, BUF_SIZE); ++ if (check_func(h.hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma_%d", bit_depth)) { ++ call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ if (memcmp(buf0, buf1, BUF_SIZE)) ++ fail(); ++ bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ } ++ ++ randomize_buffers(buf0, buf1, BUF_SIZE); ++ if (check_func(h.hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma_%d", bit_depth)) { ++ call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ if (memcmp(buf0, buf1, BUF_SIZE)) ++ fail(); ++ bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); ++ } ++} ++ ++void checkasm_check_hevc_deblock(void) ++{ ++ int bit_depth; ++ ++ for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { ++ HEVCDSPContext h; ++ ++ ff_hevc_dsp_init(&h, bit_depth); ++ check_deblock_luma(h, bit_depth); ++ } ++ report("deblock_luma"); ++ ++ 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("deblock_chroma"); ++} +-- +2.30.1 (Apple Git-130) + diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 41222c3827..862142d8e6 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -25,7 +25,7 @@ AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuvdsp.o AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o -AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_idct.o hevc_sao.o hevc_pel.o +AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 154c4a5c01..a1e8c4d92e 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -118,6 +118,7 @@ static const struct { #endif #if CONFIG_HEVC_DECODER { "hevc_add_res", checkasm_check_hevc_add_res }, + { "hevc_deblock", checkasm_check_hevc_deblock }, { "hevc_idct", checkasm_check_hevc_idct }, { "hevc_pel", checkasm_check_hevc_pel }, { "hevc_sao", checkasm_check_hevc_sao }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index ac2f22af05..386ecbf69a 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -61,6 +61,7 @@ void checkasm_check_h264dsp(void); void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_hevc_add_res(void); +void checkasm_check_hevc_deblock(void); void checkasm_check_hevc_idct(void); void checkasm_check_hevc_pel(void); void checkasm_check_hevc_sao(void); diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c new file mode 100644 index 0000000000..98f612921b --- /dev/null +++ b/tests/checkasm/hevc_deblock.c @@ -0,0 +1,126 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "libavutil/intreadwrite.h" +#include "libavutil/mem_internal.h" + +#include "libavcodec/avcodec.h" +#include "libavcodec/hevcdsp.h" + +#include "checkasm.h" + +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_OFFSET (BUF_STRIDE * BUF_LINES) +#define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2) + +#define randomize_buffers(buf0, buf1, size) \ + do { \ + uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \ + int k; \ + for (k = 0; k < size; k += 4) { \ + uint32_t r = rnd() & mask; \ + AV_WN32A(buf0 + k, r); \ + AV_WN32A(buf1 + k, r); \ + } \ + } while (0) + + +static void check_deblock_luma(HEVCDSPContext h, int bit_depth) +{ + int32_t tc[2] = { 1, 1 }; + uint8_t no_p[2] = { 0, 0 }; + uint8_t no_q[2] = { 0, 0 }; + int beta = rnd() & (0x40 - 1); + LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]); + + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int beta, int32_t *tc, uint8_t *no_p, uint8_t *no_q); + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_h_loop_filter_luma, "hevc_h_loop_filter_luma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + } + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_v_loop_filter_luma, "hevc_v_loop_filter_luma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, beta, tc, no_p, no_q); + } +} + +static void check_deblock_chroma(HEVCDSPContext h, int bit_depth) +{ + int32_t tc[2] = { 1, 1 }; + 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_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q); + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + } + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + } +} + +void checkasm_check_hevc_deblock(void) +{ + int bit_depth; + + for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { + HEVCDSPContext h; + + ff_hevc_dsp_init(&h, bit_depth); + check_deblock_luma(h, bit_depth); + } + report("deblock_luma"); + + 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("deblock_chroma"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 449f8f89f9..a300caad08 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -16,6 +16,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-h264pred \ fate-checkasm-h264qpel \ fate-checkasm-hevc_add_res \ + fate-checkasm-hevc_deblock \ fate-checkasm-hevc_idct \ fate-checkasm-hevc_pel \ fate-checkasm-hevc_sao \