From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 494F04BA85 for ; Wed, 26 Nov 2025 15:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764170856; h=date : to : message-id : mime-version : content-type : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : from; bh=//BNAOgbSE2nFD33OL9skUlo5YLTLtW6v4pYgqK/9kw=; b=ItsXpYbbZPz9galu7D72ghO3aitQU2pX3oKCEs83WzVKZW+tYmuHlsAR3V/RgLhr+/HHj q8SeBgVw6I6WI3h1QE3hNAJ90UKkCWZIDG8Jt38ns3+m6Ogn3249jcZXxLQoPkb5X3mxBX8 cDY+DEx4Ju8LODlDLvSdUDRrQBtJWmutx1qV2QGS4GjihWgq00NpvUC7ioqEIf3+WiNhZmi gcSI+Dg+ICTVgHGIHTay4oTYd1086rMhUQ6FyR9YHnX35rQHjq6n0UmBaD48KZwURtBRzXU 2xBA3aTZN6C/ZHVzJ4NfriJzLLP6ajj5Bv4k6kWOKDuSyT+9efKo0ZsqFilA== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7D45B69017A; Wed, 26 Nov 2025 17:27:36 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1764170841; b=o3Ohp6AA0xqSfxdbNdxvRFy/0dhYEsPczZfb/PlPjCrqyGw/7xOXyokPwluuL1Wjkb6V4 DPo3d8+1+r3SV+yLmpOlYVZZaiMkj8nCoShyO+flDYXK9gd/TX4wJyFJk7YPEJtYFTLKjE/ 4Dpea9+QjqQE5dicr7pSkrYztg+QhWhprLdHNx35UeLzUPwsycyCg2WtxTcBnzUoD8VxY36 z2llNUXiOUCV6H58eNvaDafltlyjeFbsAse2dFqrIJXkY5KKeOmpov0tbRRFQI/8GkIBIRp YWZQLX/jLvme808gUX8duxeNzkWSLuRq6Q9hJ/trDsiMoawxASFCvYIIozrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1764170841; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=r3VL4IdTeuGJdjfpUWFqeGfMHck7oTMGqr9D35M0eVY=; b=CbeQEasdoe3rnpJ5AVAPXN3sB2n7ac9w34Gzrbb3POzdjVUYwQ3rJP/S4gnNWHhxnbkKL J/oBitS0e/0FFQy7BSVBrPbjD4CwEQTr+XvFYTw3eBEKvZVMatJR8junsm2DHfTl4qklVP8 FYIPKaPRo8Skea4SiElLN+pVZelpZGPO0TMCcRg9lzSv5XLMtCylzmsPwt9vgrCkn1dpTLW nee1s4eO334l29Kfx4gqWwc0gIFHzkWhVMuQfnTIpOb89Au2+2+pkYMEHqH0Yo71BGhGFh8 Y2wef1CPAJLuwbbWYilfEXH23TvjYDTOMSraPKDTeVmX3ve0tKPQGRA5KjsA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=fail; arc=none; dmarc=fail header.from=arm.com policy.dmarc=none Authentication-Results: ffmpeg.org; dkim=fail; arc=none (Message is not ARC signed); dmarc=fail (Used From Domain Record) header.from=arm.com policy.dmarc=none Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id E338069017F for ; Wed, 26 Nov 2025 17:26:58 +0200 (EET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 879EE168F; Wed, 26 Nov 2025 07:26:50 -0800 (PST) Received: from spark-6072 (spark-6072.cambridge.arm.com [10.1.200.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 96A983F66E; Wed, 26 Nov 2025 07:26:57 -0800 (PST) Date: Wed, 26 Nov 2025 15:26:49 +0000 To: ffmpeg-devel@ffmpeg.org Message-ID: <5t7rnpclwv5yk6lww2nn7g4xrhx6dh2h2p3y5rst5bsszulpzv@v2kgebsnprhy> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="crppybi2ruamsljp" Content-Disposition: inline Message-ID-Hash: 3MPM2ENHAO3QQZ7UPATANJXHBNX7LEP7 X-Message-ID-Hash: 3MPM2ENHAO3QQZ7UPATANJXHBNX7LEP7 X-MailFrom: SRS0=tbAF=6C=arm.com=Arpad.Panyik@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH 2/3] checkasm: Add xyz12Torgb48le test List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Arpad Panyik via ffmpeg-devel Cc: nd@arm.com, Arpad Panyik Archived-At: List-Archive: List-Post: --crppybi2ruamsljp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Add checkasm coverage for the XYZ12LE to RGB48LE path via the ctx->xyz12Torgb48 hook. Integrate the test into the build and runner, exercise a variety of widths/heights, compare against the C reference, and benchmark when width is multiple of 4. This improves test coverage for the new function pointer in preparation for architecture-specific implementations in subsequent commits. Signed-off-by: Arpad Panyik --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/sw_xyz2rgb.c | 112 ++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 tests/checkasm/sw_xyz2rgb.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 6636bc7774..6d2e2b6e22 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -80,6 +80,7 @@ SWSCALEOBJS += sw_gbrp.o \ sw_range_convert.o \ sw_rgb.o \ sw_scale.o \ + sw_xyz2rgb.o \ sw_yuv2rgb.o \ sw_yuv2yuv.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 20d8f19757..e9251bfb35 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -324,6 +324,7 @@ static const struct { { "sw_range_convert", checkasm_check_sw_range_convert }, { "sw_rgb", checkasm_check_sw_rgb }, { "sw_scale", checkasm_check_sw_scale }, + { "sw_xyz2rgb", checkasm_check_sw_xyz2rgb }, { "sw_yuv2rgb", checkasm_check_sw_yuv2rgb }, { "sw_yuv2yuv", checkasm_check_sw_yuv2yuv }, { "sw_ops", checkasm_check_sw_ops }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 45cd23cac4..9935b37d7d 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -138,6 +138,7 @@ void checkasm_check_sw_gbrp(void); void checkasm_check_sw_range_convert(void); void checkasm_check_sw_rgb(void); void checkasm_check_sw_scale(void); +void checkasm_check_sw_xyz2rgb(void); void checkasm_check_sw_yuv2rgb(void); void checkasm_check_sw_yuv2yuv(void); void checkasm_check_sw_ops(void); diff --git a/tests/checkasm/sw_xyz2rgb.c b/tests/checkasm/sw_xyz2rgb.c new file mode 100644 index 0000000000..82e6f94983 --- /dev/null +++ b/tests/checkasm/sw_xyz2rgb.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2025 Arpad Panyik + * + * 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 "libavutil/pixdesc.h" +#include "libavutil/pixfmt.h" + +#include "libswscale/swscale.h" +#include "libswscale/swscale_internal.h" + +#include "checkasm.h" + +#define NUM_LINES 4 +#define MAX_LINE_SIZE 1920 + +#define randomize_buffers(buf, size) \ + do { \ + for (int j = 0; j < size; j += 4) \ + AV_WN32(buf + j, rnd()); \ + } while (0) + +static void check_xyz12Torgb48le(void) +{ + const int src_pix_fmt = AV_PIX_FMT_XYZ12LE; + const int dst_pix_fmt = AV_PIX_FMT_RGB48LE; + const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt); + const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); + + static const int input_sizes[] = {1, 2, 3, 4, 5, 6, 7, 8, 16, 17, 21, 31, 32, + 64, 128, 256, 512, 1024, MAX_LINE_SIZE}; + + declare_func(void, const SwsContext *, uint8_t *, int, const uint8_t *, + int, int, int); + + LOCAL_ALIGNED_8(uint8_t, src, [6 * MAX_LINE_SIZE * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, dst_ref, [6 * MAX_LINE_SIZE * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, dst_new, [6 * MAX_LINE_SIZE * NUM_LINES]); + + randomize_buffers(src, MAX_LINE_SIZE * NUM_LINES); + + for (int height = 1; height <= NUM_LINES; height++) { + for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { + SwsContext *sws; + SwsInternal *c; + int log_level; + int width = input_sizes[isi]; + const int srcStride = 6 * MAX_LINE_SIZE; + const int dstStride = 6 * MAX_LINE_SIZE; + + // Override log level to prevent spamming of the message: + // "No accelerated colorspace conversion found from %s to %s" + log_level = av_log_get_level(); + av_log_set_level(AV_LOG_ERROR); + sws = sws_getContext(width, height, src_pix_fmt, + width, height, dst_pix_fmt, + 0, NULL, NULL, NULL); + av_log_set_level(log_level); + if (!sws) + fail(); + + c = sws_internal(sws); + if (check_func(c->xyz12Torgb48, "%s_%s_%dx%d", src_desc->name, + dst_desc->name, width, height)) { + memset(dst_ref, 0xFF, MAX_LINE_SIZE * NUM_LINES); + memset(dst_new, 0xFF, MAX_LINE_SIZE * NUM_LINES); + + call_ref((const SwsContext*)c, dst_ref, dstStride, src, + srcStride, width, height); + call_new((const SwsContext*)c, dst_new, dstStride, src, + srcStride, width, height); + + if (memcmp(dst_ref, dst_new, MAX_LINE_SIZE * NUM_LINES)) + fail(); + + if (!(width & 3) && height == NUM_LINES) { + bench_new((const SwsContext*)c, dst_new, dstStride, + src, srcStride, width, height); + } + } + sws_freeContext(sws); + } + } +} + +#undef NUM_LINES +#undef MAX_LINE_SIZE + +void checkasm_check_sw_xyz2rgb(void) +{ + check_xyz12Torgb48le(); + report("xyz12Torgb48le"); +} -- 2.43.0 --crppybi2ruamsljp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-checkasm-Add-xyz12Torgb48le-test.patch" >>From 40b5ca592c9cdbe41edb14621e397f28e0bc6fd2 Mon Sep 17 00:00:00 2001 From: Arpad Panyik Date: Wed, 26 Nov 2025 09:27:51 +0000 Subject: [PATCH 2/3] checkasm: Add xyz12Torgb48le test Add checkasm coverage for the XYZ12LE to RGB48LE path via the ctx->xyz12Torgb48 hook. Integrate the test into the build and runner, exercise a variety of widths/heights, compare against the C reference, and benchmark when width is multiple of 4. This improves test coverage for the new function pointer in preparation for architecture-specific implementations in subsequent commits. Signed-off-by: Arpad Panyik --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/sw_xyz2rgb.c | 112 ++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 tests/checkasm/sw_xyz2rgb.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 6636bc7774..6d2e2b6e22 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -80,6 +80,7 @@ SWSCALEOBJS += sw_gbrp.o \ sw_range_convert.o \ sw_rgb.o \ sw_scale.o \ + sw_xyz2rgb.o \ sw_yuv2rgb.o \ sw_yuv2yuv.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 20d8f19757..e9251bfb35 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -324,6 +324,7 @@ static const struct { { "sw_range_convert", checkasm_check_sw_range_convert }, { "sw_rgb", checkasm_check_sw_rgb }, { "sw_scale", checkasm_check_sw_scale }, + { "sw_xyz2rgb", checkasm_check_sw_xyz2rgb }, { "sw_yuv2rgb", checkasm_check_sw_yuv2rgb }, { "sw_yuv2yuv", checkasm_check_sw_yuv2yuv }, { "sw_ops", checkasm_check_sw_ops }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 45cd23cac4..9935b37d7d 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -138,6 +138,7 @@ void checkasm_check_sw_gbrp(void); void checkasm_check_sw_range_convert(void); void checkasm_check_sw_rgb(void); void checkasm_check_sw_scale(void); +void checkasm_check_sw_xyz2rgb(void); void checkasm_check_sw_yuv2rgb(void); void checkasm_check_sw_yuv2yuv(void); void checkasm_check_sw_ops(void); diff --git a/tests/checkasm/sw_xyz2rgb.c b/tests/checkasm/sw_xyz2rgb.c new file mode 100644 index 0000000000..82e6f94983 --- /dev/null +++ b/tests/checkasm/sw_xyz2rgb.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2025 Arpad Panyik + * + * 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 "libavutil/pixdesc.h" +#include "libavutil/pixfmt.h" + +#include "libswscale/swscale.h" +#include "libswscale/swscale_internal.h" + +#include "checkasm.h" + +#define NUM_LINES 4 +#define MAX_LINE_SIZE 1920 + +#define randomize_buffers(buf, size) \ + do { \ + for (int j = 0; j < size; j += 4) \ + AV_WN32(buf + j, rnd()); \ + } while (0) + +static void check_xyz12Torgb48le(void) +{ + const int src_pix_fmt = AV_PIX_FMT_XYZ12LE; + const int dst_pix_fmt = AV_PIX_FMT_RGB48LE; + const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt); + const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); + + static const int input_sizes[] = {1, 2, 3, 4, 5, 6, 7, 8, 16, 17, 21, 31, 32, + 64, 128, 256, 512, 1024, MAX_LINE_SIZE}; + + declare_func(void, const SwsContext *, uint8_t *, int, const uint8_t *, + int, int, int); + + LOCAL_ALIGNED_8(uint8_t, src, [6 * MAX_LINE_SIZE * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, dst_ref, [6 * MAX_LINE_SIZE * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, dst_new, [6 * MAX_LINE_SIZE * NUM_LINES]); + + randomize_buffers(src, MAX_LINE_SIZE * NUM_LINES); + + for (int height = 1; height <= NUM_LINES; height++) { + for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { + SwsContext *sws; + SwsInternal *c; + int log_level; + int width = input_sizes[isi]; + const int srcStride = 6 * MAX_LINE_SIZE; + const int dstStride = 6 * MAX_LINE_SIZE; + + // Override log level to prevent spamming of the message: + // "No accelerated colorspace conversion found from %s to %s" + log_level = av_log_get_level(); + av_log_set_level(AV_LOG_ERROR); + sws = sws_getContext(width, height, src_pix_fmt, + width, height, dst_pix_fmt, + 0, NULL, NULL, NULL); + av_log_set_level(log_level); + if (!sws) + fail(); + + c = sws_internal(sws); + if (check_func(c->xyz12Torgb48, "%s_%s_%dx%d", src_desc->name, + dst_desc->name, width, height)) { + memset(dst_ref, 0xFF, MAX_LINE_SIZE * NUM_LINES); + memset(dst_new, 0xFF, MAX_LINE_SIZE * NUM_LINES); + + call_ref((const SwsContext*)c, dst_ref, dstStride, src, + srcStride, width, height); + call_new((const SwsContext*)c, dst_new, dstStride, src, + srcStride, width, height); + + if (memcmp(dst_ref, dst_new, MAX_LINE_SIZE * NUM_LINES)) + fail(); + + if (!(width & 3) && height == NUM_LINES) { + bench_new((const SwsContext*)c, dst_new, dstStride, + src, srcStride, width, height); + } + } + sws_freeContext(sws); + } + } +} + +#undef NUM_LINES +#undef MAX_LINE_SIZE + +void checkasm_check_sw_xyz2rgb(void) +{ + check_xyz12Torgb48le(); + report("xyz12Torgb48le"); +} -- 2.43.0 --crppybi2ruamsljp Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org --crppybi2ruamsljp--