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 DD64149589 for ; Mon, 13 May 2024 12:31:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BD07968D66F; Mon, 13 May 2024 15:31:41 +0300 (EEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01olkn2063.outbound.protection.outlook.com [40.92.99.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB85168D2DE for ; Mon, 13 May 2024 15:31:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LWOq05oJeHc1rWSyt8VyWqkCPQQOahFv3RnEx6nNCOwWBBJFNz9QCj2EEhCiSeYJpLGrMHYogVNL/jcteENavQaB4Y7tYr0NgjXKZ8f6lgXrqDAtML+lXVd6pIo8/3Cjurif+Z/RXMhxe+N0YuPJU7gvxO3UTazwCLbeXSwgRyUSfYnDSi/VusKw6w5u6aG0jrnsAiqD7366ITe8EpXg59szC6+HXAl5OZ2C7U4kR1BE1dFSSVjpj3GAZLQTG2oMZ1/uU3JHNP4YeIQvXluAOBFd2w5m0S+MaU5qFcAbLgRwRttIWOVTEVhF7ZgaMDWguF8UhDAZwND9M1f5i7tfjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wjZEVh5c7ojxPWy8F0RpTar9hV7fnE7se+JABHRomQc=; b=FQ7PagVvhRDA1JDF+KBZZvR0Hf6XI/ukcqku3z64st6FPFFRUwFR8wbWwJe2L7DX6K+b8LBqnJyMVu4ZFYj5ZLaGlczYx5P1STAReEfdPe1MHNEYv45Q4JcWpXmm/j2gs8gGgA8ZEsbApDG5Mn/AmzNFaeCv0RBVpm7ve0FZedHOyu5Oi4E/8nCyX/5qzmNRzRJFnMjpnw5/RkWiAhLLmhFu03Uvu1jSRM0/21hc7xx/FmDphPOtNOd7P4C3HysdccrbaGQsyFXps+zGxQVzhr4CGlvwsX3jdk3Arb3P4eYxZtBswieTOFoO88lTEm+7BeqIKy77xhuMVp+gSu8Wgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wjZEVh5c7ojxPWy8F0RpTar9hV7fnE7se+JABHRomQc=; b=qDGuKndS35SJZqWAUYfwXzCul+NJ7z0dl3ag/Kz4Mj7R5sk7gUYuIGYEQ+tB1nPXXjDWZS2CLS+P5HzYyUqFwamztGglKImGLWzCt++Vp83KeQyx2vSKK6cYa5OBQUukGFrxQyP2Px9BD7Tq9sbGJG9K8jmLad8rqMrVEk8PcIcrhKUXdBbPZEUakX9MLsijVBwQfZCMYME/EfvUsuc/V/KtYnKwTtwT2L2/L3HR1d1cqDZIuwUkh96RNtT2NiMuF9BFMYadPX6ov4LudyavpG2YsNewxxscAqvabAHVlu0LJAzUJcRAILrbrdYdTU5U477HOoeCedad8O8hZ2qPqw== Received: from OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:186::5) by TYCP286MB1706.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:187::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 12:31:24 +0000 Received: from OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM ([fe80::451b:2fa4:87f7:14a9]) by OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM ([fe80::451b:2fa4:87f7:14a9%6]) with mapi id 15.20.7544.052; Mon, 13 May 2024 12:31:24 +0000 From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 May 2024 20:31:04 +0800 Message-ID: X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20240513123106.232-1-toqsxw@outlook.com> References: <20240513123106.232-1-toqsxw@outlook.com> X-TMN: [PKCbXDZYnQaU01iz1BBN+3hqp4SRPSFT] X-ClientProxiedBy: SG3P274CA0019.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::31) To OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:186::5) X-Microsoft-Original-Message-ID: <20240513123106.232-2-toqsxw@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2173:EE_|TYCP286MB1706:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c4fed87-11bc-4388-8c90-08dc73489a37 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: En1H++TPgpW4ybS5fJi1oGkQYokncA26nuMcEcSZ6xE4S4FdvW7nnFVzgqWzZtc8BYIhRnE/nGYTfrhTb+eE35cd6zzNb5wqyO44LRTrq5Qq896kOjNNKqce4YCZXFi8oNu5di1VrNSgY277t4XMCBTw/ABNGs44NhctnyFRwWNlIZpmRaSncgI0gNH7MqXCOz0xF5VDi6ev6Hhmn3GZrcRQ5GKFQSSbb19JttjD5EB5F8lCs9WPMmECxdmXn7qaKnEcePh0a1Y04OdCYP4pCJVy9L2BASNKFcXY6RB+SMu5rm380bPNU/s1AUc/saLGY5yappRIsBQaQEdKyiVoTIwEglCRD8++a66rt/8FUNFLgj+KpgztrTmfCSG+YDRBj7TcmVUouxNoO+dlg4rHERZq692vP7R9e76qJYN9RHS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f9ZA59EYMow7Ifn6j?= =?us-ascii?Q?WtBYkPHo/luWAINgmqikG4ei2wiOJ5N9R/vkgYxvZB3vbUOGXdDSqzMejBDW?= =?us-ascii?Q?CxKBs+ZhOdEoAKXf5FCdzX6UsTSfNrlTmrgkJ33nWvfY7T25y70oF3jhk68R?= =?us-ascii?Q?emSxh+3Sc7j0rXQfAfOAi8oFcLJzvJ2B/JZ9F8c7bsDbXHEMCUGsSv5lNUdf?= =?us-ascii?Q?bMvjN1irGIzuGqZcc2PwUknJm1RcDcHySY7t7RoNO6aCyCJ8wXjVV0AksxyN?= =?us-ascii?Q?BJQAkFICY4mEHHH5uubhK4blSooxYajGjrFwaQlJFCZa40xIPz+l1XZqYBKA?= =?us-ascii?Q?EO3Jsz3MakILA0+0aChnMc6SMZoi0bRWVVHi6fzyuIYl6ti+ht5OueVmRo/o?= =?us-ascii?Q?r6ds89/5Y1RNF3WSLV4R7IWQdtksftZT/s5fLhztkBuzmgFsQ7kOCNgOhXer?= =?us-ascii?Q?X1OQSaO5URMOcaogFtsZXAz2VyFIEudjD91cZzX7wGzgAzMZyhJtkBS3EdVm?= =?us-ascii?Q?I3rhHNecSQlyy1bE2nABt6TW9A43iLVnRdmOWXutfR9sTl8VSv8AB109l1zq?= =?us-ascii?Q?9thtkr8vMBvKc06Cic5Fw71o0yqCxMNk6X7udSdCadXbMNzpPsyigbl8gJ8?= =?us-ascii?Q?=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4fed87-11bc-4388-8c90-08dc73489a37 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 12:31:24.3977 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB1706 Subject: [FFmpeg-devel] [PATCH v3 2/4] tests/checkasm: add checkasm_check_vvc_alf and check_alf_filter 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: Wu Jianhua 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: From: Wu Jianhua Signed-off-by: Wu Jianhua --- tests/checkasm/Makefile | 2 +- tests/checkasm/checkasm.c | 3 +- tests/checkasm/checkasm.h | 1 + tests/checkasm/vvc_alf.c | 133 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 tests/checkasm/vvc_alf.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index b5bb885201..92624aab0a 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -43,7 +43,7 @@ AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o AVCODECOBJS-$(CONFIG_VORBIS_DECODER) += vorbisdsp.o AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o -AVCODECOBJS-$(CONFIG_VVC_DECODER) += vvc_mc.o +AVCODECOBJS-$(CONFIG_VVC_DECODER) += vvc_alf.o vvc_mc.o CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 04f94f9d09..ffc89882b1 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -204,7 +204,8 @@ static const struct { { "vorbisdsp", checkasm_check_vorbisdsp }, #endif #if CONFIG_VVC_DECODER - { "vvc_mc", checkasm_check_vvc_mc }, + { "vvc_alf", checkasm_check_vvc_alf }, + { "vvc_mc", checkasm_check_vvc_mc }, #endif #endif #if CONFIG_AVFILTER diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 8807a37a43..07fcc751ff 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -134,6 +134,7 @@ void checkasm_check_vp8dsp(void); void checkasm_check_vp9dsp(void); void checkasm_check_videodsp(void); void checkasm_check_vorbisdsp(void); +void checkasm_check_vvc_alf(void); void checkasm_check_vvc_mc(void); struct CheckasmPerf; diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c new file mode 100644 index 0000000000..10469e1528 --- /dev/null +++ b/tests/checkasm/vvc_alf.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2023-2024 Nuo Mi + * Copyright (c) 2023-2024 Wu Jianhua + * + * 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 "checkasm.h" +#include "libavcodec/vvc/ctu.h" +#include "libavcodec/vvc/data.h" +#include "libavcodec/vvc/dsp.h" + +#include "libavutil/common.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mem_internal.h" + +static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff }; + +#define SIZEOF_PIXEL ((bit_depth + 7) / 8) +#define SRC_PIXEL_STRIDE (MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE) +#define DST_PIXEL_STRIDE (SRC_PIXEL_STRIDE + 4) +#define SRC_BUF_SIZE (SRC_PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2) //+3 * 2 for top and bottom row, *2 for high bit depth +#define DST_BUF_SIZE (DST_PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2) +#define LUMA_PARAMS_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE * ALF_NUM_COEFF_LUMA) + +#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) + +#define randomize_buffers2(buf, size, filter) \ + do { \ + int k; \ + if (filter) { \ + for (k = 0; k < size; k++) { \ + int8_t r = rnd(); \ + buf[k] = r; \ + } \ + } else { \ + for (k = 0; k < size; k++) { \ + int r = rnd() % FF_ARRAY_ELEMS(clip_set); \ + buf[k] = clip_set[r]; \ + } \ + } \ + } while (0) + +static void check_alf_filter(VVCDSPContext *c, const int bit_depth) +{ + LOCAL_ALIGNED_32(uint8_t, dst0, [DST_BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, dst1, [DST_BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); + int16_t filter[LUMA_PARAMS_SIZE]; + int16_t clip[LUMA_PARAMS_SIZE]; + + const int16_t clip_set[] = { + 1 << bit_depth, 1 << (bit_depth - 3), 1 << (bit_depth - 5), 1 << (bit_depth - 7) + }; + + ptrdiff_t src_stride = SRC_PIXEL_STRIDE * SIZEOF_PIXEL; + ptrdiff_t dst_stride = DST_PIXEL_STRIDE * SIZEOF_PIXEL; + int offset = (3 * SRC_PIXEL_STRIDE + 3) * SIZEOF_PIXEL; + + declare_func_emms(AV_CPU_FLAG_AVX2, void, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, ptrdiff_t src_stride, + int width, int height, const int16_t *filter, const int16_t *clip, const int vb_pos); + + randomize_buffers(src0, src1, SRC_BUF_SIZE); + randomize_buffers2(filter, LUMA_PARAMS_SIZE, 1); + randomize_buffers2(clip, LUMA_PARAMS_SIZE, 0); + + 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(); + } + 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(); + } + bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos); + } + } + } +} + +void checkasm_check_vvc_alf(void) +{ + int bit_depth; + VVCDSPContext h; + for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { + ff_vvc_dsp_init(&h, bit_depth); + check_alf_filter(&h, bit_depth); + } + report("alf_filter"); +} -- 2.44.0.windows.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".