From patchwork Fri Dec 22 09:49:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 45281 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp953378pzh; Fri, 22 Dec 2023 01:50:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJ5ejYnzCwrhcbMW2b49zOWuQEfa3HgkVnzisF/t+6Kr5YJaLnDEbsE0YaVrXZH1ohO234 X-Received: by 2002:a17:906:e0d9:b0:a23:4939:17df with SMTP id gl25-20020a170906e0d900b00a23493917dfmr1212596ejb.1.1703238603502; Fri, 22 Dec 2023 01:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703238603; cv=none; d=google.com; s=arc-20160816; b=Z8osW8jzven7OydRiDdxRX765Eo7fNlqYlpIIp0iG3bJ/OJEVso8oZlSi/m+yBxXjO lFdZjIynvDpYdS83a5oqRRAfEZIc5ONJ3Se/oS+xbIFQFHXTXslDCwua0qaik5fAz96S 6R120nrLeu7o7HUMMLTnLJc4LSE+a26A7Kwai9cZiye0Sg9PwYwRQoXmcxecql/Fhf5F XuopQx7Ny4TkJWAYlqoZ9aTtygW/DMfgIoTNgETDWlbTaXKG3oc9kq7f5z/zJYl1v27P jpChIsqyiBLUpTV8VdOZxAW8EKDIu76JYMZMho444O5vKlWPU4we6NV3a3vznCTO8lBp iBBw== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=BmEAdDR52DGu1F0egdviSwxHCpcpzHOF/M+wqKaotz8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=q6DXVjS+3c/YPc7D5TWFa0qacDLLR5SB59nBS0jLz/ZGe6MLf/+dkpI1vaEtOuZ4u8 IN/kknYLhsqOr8YRqmJv0qooucaqjH5LMMKxLwlmuEfpdIr6VvoSmmJ46fGNp5vG7dAs JSOnwb0bCrPTgXUWdLlTQ7ezjYuQrvGwn/zTfgdoTC31FgWP2UwihYtJy3Z/ueoFyC77 ff2yaK/wVQ+yeWSy2D4lAqHSjNseXGzTAzCPLEVCHFRVxSCPZnL+SuaukARZEAaIKlq5 ji5QMcP+PQDZmZuiyG1FxwUI2VKmGcJN/QfGuQ7TZM6gEhDDuE/AQixeZW3lUphy3E9m o3ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=UFvPqO9M; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m3-20020a1709060d8300b009d3ccd17620si1709602eji.806.2023.12.22.01.50.03; Fri, 22 Dec 2023 01:50:03 -0800 (PST) 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=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=UFvPqO9M; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57F2368D2B3; Fri, 22 Dec 2023 11:50:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEFC568D184 for ; Fri, 22 Dec 2023 11:49:53 +0200 (EET) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-50e3295978aso2168967e87.1 for ; Fri, 22 Dec 2023 01:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1703238593; x=1703843393; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=p6m7NAvFCoXBKTSyZfTtVgabr/PNJTdPSQZQjIfqjn4=; b=UFvPqO9M+hyUxEme2LwElYYB7+NWQCfeTdCT0LLE7aTn9BVQ/TWewsqfj9p0e2p7AC OJ2ZGTWdlXQYVeFz+59bfC4+XlnvoyzKpuKL/eV4tU3t4CM3p7Ns0RcjAE6rg5RFwfG/ DMZQWs5iYIf43ZESQF87XtDFUQRC5f1DuIbdgIp/I7d5P9DmstTv/PpEOK0J8GMJc6N0 YBUSWuigxs7hYKCVRrQLJgshzmKRRwbf8PuMfrGyWfQd6rNvAzgJaMJvimnukK4owqdr 3I/ueJc3+Ot02vCBaTU704tvHukA6/DrpNX/MrXuMi3pvUf0hoI9su+ZkGyKp+FkwKLo c5JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703238593; x=1703843393; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p6m7NAvFCoXBKTSyZfTtVgabr/PNJTdPSQZQjIfqjn4=; b=h8HRrrYPZ/fVg4OsPG2ASnAVofY3OGs3Xr3qyry3T+XR0GaJYxi1c/7SLqI5hJBGhQ rO0V9GulGK7WXCjgH+r6mrxS80iiaQM6yo/s8jt2Dq+hTfCiSE50GTVReP45/NbdKSeg qgItfy1abBvjX5VDA1FLV+3vss79JAEBoX2kiJD/Q+sQCsJMGgiKCCmHGP1sgjSjl+Y0 x3Bk1W1nMIzeONLaU/Jh/rnAalwmyXTHv5hzMtzLpUmDo8Afl03uLtxJ3+dLxE3/Eu/y zPwicUbOkh2AsUA3kiLOesUdACuTkRYCHEcqJFmgUlvVYLNDvI2lgi+OTJ32P3JJel4b ZDnA== X-Gm-Message-State: AOJu0YwvOBnQiet5P0SzdSlhS2mJOuOLCtVUtPPf1juNL2kcIXiOkzMQ spWR+KsGnXcBE6l9dEQZtCJViSR8L0T0ZGegD81HXmBZ4fSc X-Received: by 2002:a05:6512:474:b0:50e:6910:496e with SMTP id x20-20020a056512047400b0050e6910496emr408510lfd.28.1703238592676; Fri, 22 Dec 2023 01:49:52 -0800 (PST) Received: from localhost (host-97-144.parnet.fi. [77.234.97.144]) by smtp.gmail.com with ESMTPSA id b9-20020a056512070900b0050cc8bda3a6sm499698lfs.238.2023.12.22.01.49.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Dec 2023 01:49:52 -0800 (PST) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Dec 2023 11:49:51 +0200 Message-Id: <20231222094951.95249-1-martin@martin.st> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm: Fix the takdsp tests 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: Wj1E2E5wF5HV For memcpy and memcmp, we need to multiply by the element size, otherwise we're copying and comparing only a fraction of the buffer. For decorrelate_sr, the buffer p1 is the one that is mutated; copy and check p1 instead of p2. For decorrelate_sm, both buffers are mutated, so copy and check both of them. For decorrelate_sm, the memcpy initialization of p1 and p1_2 was reversed - p1 is filled with randomize, but then memcpy copies from p1_2 to p1. As p1_2 is uninitialized at this point, clang concluded that the copy was bogus and omitted it entirely, triggering failures in this test on x86 (where there was an existing assembly implementation to test). --- tests/checkasm/takdsp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/checkasm/takdsp.c b/tests/checkasm/takdsp.c index 495b7242c5..3aecee1f72 100644 --- a/tests/checkasm/takdsp.c +++ b/tests/checkasm/takdsp.c @@ -44,12 +44,12 @@ static void test_decorrelate_ls(TAKDSPContext *s) { randomize(p1, BUF_SIZE); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); + memcpy(p2_2, p2, BUF_SIZE * sizeof(*p2)); call_ref(p1, p2, BUF_SIZE); call_new(p1, p2_2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p2, p2_2, BUF_SIZE * sizeof(*p2)) != 0) { fail(); } @@ -65,17 +65,17 @@ static void test_decorrelate_sr(TAKDSPContext *s) { if (check_func(s->decorrelate_sr, "decorrelate_sr")) { LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]); + LOCAL_ALIGNED_32(int32_t, p1_2, [BUF_SIZE]); LOCAL_ALIGNED_32(int32_t, p2, [BUF_SIZE]); - LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]); randomize(p1, BUF_SIZE); + memcpy(p1_2, p1, BUF_SIZE * sizeof(*p1)); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); call_ref(p1, p2, BUF_SIZE); - call_new(p1, p2_2, BUF_SIZE); + call_new(p1_2, p2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p1, p1_2, BUF_SIZE * sizeof(*p1)) != 0) { fail(); } @@ -96,14 +96,15 @@ static void test_decorrelate_sm(TAKDSPContext *s) { LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]); randomize(p1, BUF_SIZE); - memcpy(p1, p1_2, BUF_SIZE); + memcpy(p1_2, p1, BUF_SIZE * sizeof(*p1)); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); + memcpy(p2_2, p2, BUF_SIZE * sizeof(*p2)); call_ref(p1, p2, BUF_SIZE); call_new(p1_2, p2_2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p1, p1_2, BUF_SIZE * sizeof(*p1)) != 0 || + memcmp(p2, p2_2, BUF_SIZE * sizeof(*p2)) != 0) { fail(); }