From patchwork Mon Oct 17 13:07:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hubert Mazur X-Patchwork-Id: 38763 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1584540pzb; Mon, 17 Oct 2022 06:08:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zAb1SH5dRxkzuQGCBFzkcrS5irhmFAASLQdCB6MvdTXHXBhyAI7KV2g1zlnf9fudgDhGR X-Received: by 2002:a05:6402:2686:b0:45d:82c0:c2b6 with SMTP id w6-20020a056402268600b0045d82c0c2b6mr5789926edd.390.1666012126275; Mon, 17 Oct 2022 06:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666012126; cv=none; d=google.com; s=arc-20160816; b=agdF58kip7MBBpozT6Fk390rq8iBcYVzCH9f5mujSRUtaZNuSO6BEn8wShvjsNfZ6w ig+ird3O87Pelj3JulI3xgQN/fBYkgAjpjvOdHFGS2BrTC5DX2vJ0M3kUe8fjjUYDH8D j5e+Rt0mGGHunWI692xl88Z2BTYf6DJM55NbRscwH80gOKoDSvWc8v9gzU7yrPf4wDsE ewd/uPwFU6SB3n48e96juaz/g5HJsMQR7DKX+DEguY9Xx+de/Rh5vGCL02+v+dcYGi75 gVaOoLfbpZI//jWZll74H39hp08BC/pYENrDjEwGElCLas3SrSj7VddA0vEoKemEdoUM m1kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=v+KlX61JTRlrUe5gf7J3nwBnxosrb5Uzc2RQxOaFPfk=; b=gwgH5qyNi4qjwCdrwLWcYf07UPiY9NZfIHzSmCtdMFCvmc2dRtuQ4ezHmntb5mpRds TTaDf6xeoVNY4WMg+ZmRS54tDz0XNimRlJmPYZhz9mvoKA0mYOJ395LFbny6SwknwQyA FW46qnr/7awpqyw3JxNvLUiIqvhvZ7Tj/8o80o5Uw1zt8w6nemM8TmNx1Xru3xGZHczZ udD07qU9RN9mR6ynzJDP8ZnKUxgs9JQ77O7d2GXg3oWvTCBRMgNlDr2VwQmRs4z6j/Of uUD0a7dPvZNN1mfyKd2fF5u7rnEhRPi2axTPIowqmjxeTXkWnWpbBhhCAorCT18YvQvB hGlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@semihalf.com header.s=google header.b=lsooud3t; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sc12-20020a1709078a0c00b0078da9130dc8si9923491ejc.164.2022.10.17.06.08.45; Mon, 17 Oct 2022 06:08:46 -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=@semihalf.com header.s=google header.b=lsooud3t; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 94D9568BD10; Mon, 17 Oct 2022 16:08:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2BB3B68BCFE for ; Mon, 17 Oct 2022 16:08:20 +0300 (EEST) Received: by mail-wm1-f47.google.com with SMTP id n9so8604069wms.1 for ; Mon, 17 Oct 2022 06:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HMJ/dB3W+aJT6xEOVd3elsu9wDdmB00a430IhEwETvg=; b=lsooud3tcyunmt+kTgc4JYFoLO1MUe5MHer7jPdw8YtoV9XWfKwKAP3eoLyBS8KkwF JJThpIZNi6r2ejdHnENTKjl6I5bfUvKPsY4msi+qE8sksYKgN2+jbbrXKn4JdXFogHJ1 TZBkRmEzdWxaEmhDnoGgvcT0B0ugCzER/U62Hsjd0n7nvptnGKPB0pwq21fYZZkHngpA DAsAzqurCPW0qYvxXmahPUUOARDxF7LxYwDvlX7qZNSt8aJg2iPYRKKud0ofUgh3jwpl mJmn/jk6oQpWUY2ZrVrz3KbQo7USAP/7nUhzxRPPrET/SxkPOMk0IoRMUwlU3SSDKmtG bjqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HMJ/dB3W+aJT6xEOVd3elsu9wDdmB00a430IhEwETvg=; b=WAKHALoHv3/G+KXMf2fke7LcXOJJzVx4HFNgiKJnyK8L0RUSz8WxLc+7IXbhCIL1rA Au44924emqlgTvR+FJLy3aCLRTWUZWXzUnGdTSxnTTUr3hQrenf6jhtqGavRP4DToanl ZUnYiBnxrjj+7wDrWb1vEEot76xFlZIb/3KXY29pj17pAV5qc7leoA9BJJYHH/8dsXJ6 h26YCudSq/33zRVEVh3+ZBN3SxKuFwZ6BavXy83hMzHuSWADnzAm47cgqrtoHJayFP30 hkkY1yrqdwgRfXFydGYsV62/RKGmVXW3c04r+52oQf5L40Cv1GFh4nBdlTMwdS1Sj9pa QZYg== X-Gm-Message-State: ACrzQf3OB+uN9vuMxGHo1QivHKLHye/+HnzK0kQKbddYD06/LWdS/gVa DWBL+TErVj9GAPnAhghcUGvcDNKCvjUHnoDD X-Received: by 2002:a05:600c:3213:b0:3c6:cab8:dac4 with SMTP id r19-20020a05600c321300b003c6cab8dac4mr19502211wmp.160.1666012099208; Mon, 17 Oct 2022 06:08:19 -0700 (PDT) Received: from ip-172-31-3-164.eu-west-1.compute.internal (ec2-54-154-193-154.eu-west-1.compute.amazonaws.com. [54.154.193.154]) by smtp.gmail.com with ESMTPSA id t18-20020a5d6a52000000b0022af865810esm8297237wrw.75.2022.10.17.06.08.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2022 06:08:18 -0700 (PDT) From: Hubert Mazur To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Oct 2022 13:07:13 +0000 Message-Id: <20221017130715.30896-3-hum@semihalf.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221017130715.30896-1-hum@semihalf.com> References: <20221017130715.30896-1-hum@semihalf.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] tests/sw_scale: Add test cases for input sizes 16 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: gjb@semihalf.com, upstream@semihalf.com, jswinney@amazon.com, Hubert Mazur , martin@martin.st, mw@semihalf.com, spop@amazon.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZMDC7YwW9+0f Previously test cases handled only input sizes equal to 8. Add support for input size 16 which is used by scaling routines hscale16To15 and hscale16To19. Pass SwsContext pointer to each function as some of them make use of it. Signed-off-by: Hubert Mazur --- tests/checkasm/sw_scale.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index 3b8dd310ec..2e4b698f88 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -262,23 +262,31 @@ static void check_hscale(void) #define FILTER_SIZES 6 static const int filter_sizes[FILTER_SIZES] = { 4, 8, 12, 16, 32, 40 }; -#define HSCALE_PAIRS 2 +#define HSCALE_PAIRS 4 static const int hscale_pairs[HSCALE_PAIRS][2] = { { 8, 14 }, { 8, 18 }, + { 16, 14 }, + { 16, 18 } }; +#define DST_WIDTH(x) ( (x) == (14) ? sizeof(int16_t) : sizeof(int32_t)) #define LARGEST_INPUT_SIZE 512 #define INPUT_SIZES 6 static const int input_sizes[INPUT_SIZES] = {8, 24, 128, 144, 256, 512}; int i, j, fsi, hpi, width, dstWi; struct SwsContext *ctx; + void *(*_dst)[2]; + void *_src; // padded LOCAL_ALIGNED_32(uint8_t, src, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 4)]); - LOCAL_ALIGNED_32(uint32_t, dst0, [SRC_PIXELS]); - LOCAL_ALIGNED_32(uint32_t, dst1, [SRC_PIXELS]); + LOCAL_ALIGNED_32(uint16_t, src1, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 4)]); + LOCAL_ALIGNED_32(int16_t, dst_ref_16, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int16_t, dst_new_16, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int32_t, dst_ref_32, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int32_t, dst_new_32, [SRC_PIXELS]); // padded LOCAL_ALIGNED_32(int16_t, filter, [SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH]); @@ -286,6 +294,9 @@ static void check_hscale(void) LOCAL_ALIGNED_32(int16_t, filterAvx2, [SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH]); LOCAL_ALIGNED_32(int32_t, filterPosAvx, [SRC_PIXELS]); + void *_dst_16[2] = {dst_ref_16, dst_new_16}; + void *_dst_32[2] = {dst_ref_32, dst_new_32}; + // The dst parameter here is either int16_t or int32_t but we use void* to // just cover both cases. declare_func_emms(AV_CPU_FLAG_MMX, void, void *c, void *dst, int dstW, @@ -297,6 +308,7 @@ static void check_hscale(void) fail(); randomize_buffers(src, SRC_PIXELS + MAX_FILTER_WIDTH - 1); + randomize_buffers(src1, SRC_PIXELS + MAX_FILTER_WIDTH - 1); for (hpi = 0; hpi < HSCALE_PAIRS; hpi++) { for (fsi = 0; fsi < FILTER_SIZES; fsi++) { @@ -306,6 +318,8 @@ static void check_hscale(void) ctx->srcBpc = hscale_pairs[hpi][0]; ctx->dstBpc = hscale_pairs[hpi][1]; ctx->hLumFilterSize = ctx->hChrFilterSize = width; + _src = ctx->srcBpc == 8 ? (void *)src : (void *)src1; + _dst = ctx->dstBpc == 14 ? (void*)_dst_16 : (void*)_dst_32; for (i = 0; i < SRC_PIXELS; i++) { filterPos[i] = i; @@ -343,14 +357,15 @@ static void check_hscale(void) ff_shuffle_filter_coefficients(ctx, filterPosAvx, width, filterAvx2, ctx->dstW); if (check_func(ctx->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", ctx->srcBpc, ctx->dstBpc + 1, width, ctx->dstW)) { - memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0])); - memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0])); + memset((*_dst)[0], 0, SRC_PIXELS * DST_WIDTH(ctx->dstBpc)); + memset((*_dst)[1], 0, SRC_PIXELS * DST_WIDTH(ctx->dstBpc)); + + call_ref(ctx, (*_dst)[0], ctx->dstW, src, filter, filterPos, width); + call_new(ctx, (*_dst)[1], ctx->dstW, src, filterAvx2, filterPosAvx, width); - call_ref(NULL, dst0, ctx->dstW, src, filter, filterPos, width); - call_new(NULL, dst1, ctx->dstW, src, filterAvx2, filterPosAvx, width); - if (memcmp(dst0, dst1, ctx->dstW * sizeof(dst0[0]))) + if (memcmp((*_dst)[0], (*_dst)[1], ctx->dstW * DST_WIDTH(ctx->dstBpc))) fail(); - bench_new(NULL, dst0, ctx->dstW, src, filter, filterPosAvx, width); + bench_new(ctx, (*_dst)[1], ctx->dstW, _src, filter, filterPosAvx, width); } } } @@ -358,6 +373,8 @@ static void check_hscale(void) sws_freeContext(ctx); } +#undef DST_WIDTH + void checkasm_check_sw_scale(void) { check_hscale();