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 16CCE402CE for ; Mon, 17 Oct 2022 13:08:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5861E68BD13; Mon, 17 Oct 2022 16:08:28 +0300 (EEST) 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-Google-Smtp-Source: AMsMyM4xCLaCnwTkHm6bDbxcgzyFZnV1m376Zik1HF+z7WbaBOusA38h4YAnaW7V/6mgU/RwW5HYWw== 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 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: 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(); -- 2.37.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".