From patchwork Wed Jun 5 21:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 49606 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9185:0:b0:460:55fa:d5ed with SMTP id s5csp30433vqg; Wed, 5 Jun 2024 14:14:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUM8cYDC3VJn7gjcaebgM9BGx0gUzs5qHq4PfL3a2Huzr2g+KsCiiVfQdgeoDHT9HrNy6qFPxzAWxlljwsP4Gw68I3YT6FFJSzJ4Q== X-Google-Smtp-Source: AGHT+IHvvxG6UHgqp8YSCkwGYD0gfOfsBGCBhI2uzzahtEMzK4cJdalRfI+B2m/aYkDwwWBmL5Jw X-Received: by 2002:a50:cd18:0:b0:578:6959:9d36 with SMTP id 4fb4d7f45d1cf-57a8b5231ccmr2237094a12.0.1717622042513; Wed, 05 Jun 2024 14:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717622042; cv=none; d=google.com; s=arc-20160816; b=iM44EMsGu6K+WI1NanqY316fbOX0GBCo80JReAcU91sLu5bsc2l9t+iPlJ5P38FfHo ChIMDnIUz6DyCVJXCZ6sMBOUTqxAFLDwiZCxe2Si6nENmShIdjgGjbQgLvEPA98GfR5+ aMiEhGxw20Z42X47xTV8WSI30jjkzk897eTzOiRJtVFimHGIk1csOnJE57HM8RKqiK8i QelmaDdeq5DOj66R/cFMqpodOArwSiGWGwr9deRpge4oxiYlSvPAfrSff8dSMKAhih/d ACDf7DMhN/3EmQwIuBdt/vnfEp0PrnhYZmJAjIZ8UU1VTPulm1Mz2LneX8w8nZ6L2Xt7 yurA== 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:delivered-to; bh=+V806LbSjOjoMuJ1qp2ffgRuWTDz0RxfWRrRHJe/7L4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Na0eTSNBuDWDk77BtAHByjQjW66NZ8vAy4FhQg6oCJmAVRvFcUMhKOTYOgT61oPlJm Sz4JOTTXTpAga9CyYdvI8qTh8UqWVOahPRGGj0IqskOynj83uWopVSPB9j2AeKQyGZKr 3fVlgFIM/ANS4gWhBx+Rac4stjX3LHCDFC3+lO3gccKpkgPD8ENBAuNv+dIUzskGQuQ6 6f1/B2V68GiXcAJV1F8Rhn2Yu40qRu8ZFd7ETOpa610ho6wckcq83Xn3fA7+1u94clP6 FjLksTsChJQ4GilAr3E+QaBUCb/3V5rMPMw0ap9MMvory5qDU0sA38Gd707aVAVNd5Mv 04VA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="XE/6yVyE"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-57a589ebb8fsi4367734a12.139.2024.06.05.14.14.02; Wed, 05 Jun 2024 14:14:02 -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=@gmail.com header.s=20230601 header.b="XE/6yVyE"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DCB968D51E; Thu, 6 Jun 2024 00:13:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5782A68D51E for ; Thu, 6 Jun 2024 00:13:52 +0300 (EEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7025ca8bebcso227253b3a.3 for ; Wed, 05 Jun 2024 14:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717622030; x=1718226830; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=XXzBSay5ILUR4boWuVkdaGEaTPE4WCbZnZABymIZn7E=; b=XE/6yVyEgHZc1HzR8+oaIcH1n7cp0H34lwFoN7svMoV8Jw/9wQMQfa+x44vOevn3JY QGJoenl8JOjbqNwcjKtGK7GJECJYF7quN9CMKjkZVJLRjhJn5/dyrQXHjnYfq10gHN9L 1C9hVrEr0sh4lCMSMh50N8dtRIp811S01pcsiRKUlUb3bwQ9puiLRk5D4IgggmtRGlqh JTw7p+CwrEgVs2OjghKs8q/lu6O6YcUMxfA365kLiLjEMv13YKsqSh1wyeS+jpPHyiL/ deJ1wxXO735CeuJjM0rNyLYJX5LnbUC6CyH8YHQhMyCSqMaAaGMl/XiewBPI8kct3DVD WiKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622030; x=1718226830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XXzBSay5ILUR4boWuVkdaGEaTPE4WCbZnZABymIZn7E=; b=ZusgpS+M6phlwQGnxeTbd8zigwk0sUDci9HYFSTEgqcmRgOyGE+WryvowCtTZjE/ax TXWi3kscxNiir/obNENl2RkLb5j3Ai7wU/oz5o5257bB7mH4YBtIGeLLigh8yXGEvDxc HVyFvBXmwdXrTo1WheHG2Lz1ukydpmmuEDD9xpXmWt6BSXpNSreZJ7bvGdffbxtopc3r WbXCAA5BBQAlLl4QB7SfQlT8VeeRnxzkieYc8r5ra4t6lTIRbweL2nFRJN5JC8u/dD// F48PEC8Zm9pbdS7rJHZc106JEjqRWumhzpWPi3eLTo90CCKoiacldLz9D1HJnbvgoUGR Cvqg== X-Gm-Message-State: AOJu0YxVCkzElE8wfhwnJEDp3QRtKYgn8nN9AkYfGGWmqVtluaJ3m1Dw GOmcmGdwRJHAUWkpZqCYqlXjTMHqfTSEMoSA2xe1zaVH34pDFi785wyprA== X-Received: by 2002:a05:6a00:2e1b:b0:6eb:6:6b72 with SMTP id d2e1a72fcca58-703e5a7c2e5mr4031899b3a.25.1717622029914; Wed, 05 Jun 2024 14:13:49 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702425e20f8sm9044588b3a.86.2024.06.05.14.13.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:13:49 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jun 2024 18:13:29 -0300 Message-ID: <20240605211329.3435-1-jamrial@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm/sw_rgb: test rgb32/rgb32_1 to yuv 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: hwD4Wb71zLWo Test all four pixel formats, but only bench the two native endian ones for a given target. Signed-off-by: James Almer --- tests/checkasm/sw_rgb.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c index b51d0836c3..378412e9d2 100644 --- a/tests/checkasm/sw_rgb.c +++ b/tests/checkasm/sw_rgb.c @@ -187,11 +187,16 @@ static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; static const enum AVPixelFormat rgb_formats[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, + AV_PIX_FMT_RGBA, + AV_PIX_FMT_BGRA, + AV_PIX_FMT_ABGR, + AV_PIX_FMT_ARGB, }; static void check_rgb_to_y(struct SwsContext *ctx) { - LOCAL_ALIGNED_32(uint8_t, src, [MAX_LINE_SIZE * 3]); + LOCAL_ALIGNED_32(uint8_t, src24, [MAX_LINE_SIZE * 3]); + LOCAL_ALIGNED_32(uint8_t, src32, [MAX_LINE_SIZE * 4]); LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]); LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]); @@ -199,7 +204,8 @@ static void check_rgb_to_y(struct SwsContext *ctx) const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *rgb2yuv, void *opq); - randomize_buffers(src, MAX_LINE_SIZE * 3); + randomize_buffers(src24, MAX_LINE_SIZE * 3); + randomize_buffers(src32, MAX_LINE_SIZE * 4); for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]); @@ -211,6 +217,7 @@ static void check_rgb_to_y(struct SwsContext *ctx) int w = input_sizes[j]; if (check_func(ctx->lumToYV12, "%s_to_y_%d", desc->name, w)) { + const uint8_t *src = desc->nb_components == 3 ? src24 : src32; memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2); memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2); @@ -220,7 +227,10 @@ static void check_rgb_to_y(struct SwsContext *ctx) if (memcmp(dst0_y, dst1_y, w * 2)) fail(); - bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); + if (desc->nb_components == 3 || + // only bench native endian formats + (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1)) + bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); } } } @@ -228,7 +238,8 @@ static void check_rgb_to_y(struct SwsContext *ctx) static void check_rgb_to_uv(struct SwsContext *ctx) { - LOCAL_ALIGNED_32(uint8_t, src, [MAX_LINE_SIZE * 3]); + LOCAL_ALIGNED_32(uint8_t, src24, [MAX_LINE_SIZE * 3]); + LOCAL_ALIGNED_32(uint8_t, src32, [MAX_LINE_SIZE * 4]); LOCAL_ALIGNED_32(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]); LOCAL_ALIGNED_32(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]); LOCAL_ALIGNED_32(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]); @@ -238,7 +249,8 @@ static void check_rgb_to_uv(struct SwsContext *ctx) const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal, void *opq); - randomize_buffers(src, MAX_LINE_SIZE * 3); + randomize_buffers(src24, MAX_LINE_SIZE * 3); + randomize_buffers(src32, MAX_LINE_SIZE * 4); for (int i = 0; i < 2 * FF_ARRAY_ELEMS(rgb_formats); i++) { enum AVPixelFormat src_fmt = rgb_formats[i / 2]; @@ -255,6 +267,7 @@ static void check_rgb_to_uv(struct SwsContext *ctx) if (check_func(ctx->chrToYV12, "%s_to_uv%s_%d", desc->name, ctx->chrSrcHSubSample ? "_half" : "", input_sizes[j])) { + const uint8_t *src = desc->nb_components == 3 ? src24 : src32; memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2); memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2); memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2); @@ -266,7 +279,10 @@ static void check_rgb_to_uv(struct SwsContext *ctx) if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2)) fail(); - bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); + if (desc->nb_components == 3 || + // only bench native endian formats + (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1)) + bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); } } }