From patchwork Tue Dec 12 21:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 45094 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp3878764pzf; Tue, 12 Dec 2023 13:02:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJvq0SbhcGSC9S4hvYfTaz1EUchV5XNirZI6uTgkE3AsYlLp+LvW0mXu1rLwOxbAoyvokM X-Received: by 2002:a17:906:10d1:b0:a17:4585:456c with SMTP id v17-20020a17090610d100b00a174585456cmr3588514ejv.0.1702414978543; Tue, 12 Dec 2023 13:02:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702414978; cv=none; d=google.com; s=arc-20160816; b=dcgUU96IpV972MvLJlGCv4E1+JtRcoJNzupMDWguSDmopUEbv04sxae0llyaEutUrX b+6Ri3lipLG6oyqrSRMf7OFIHYtSwg8SN1KaB06M4H6Ez4ibiX4T+V8lhC3BFWopsoO+ ODByrYEHrZp0d8ftvXYHrJIjoXEM87noY8QXF46MfpqOQ11XhUx7o5xtr9sgaZjbWW7O 7CP7EzP7qU668UJgXAfjZTRfQg/c+dwocHjx49h8cnOqi5fJtozfN2raAwMeEuU5ot3K txhuOA8ewYk9LnSl1lOTPGpXJtA1o/x359gkMflxLbT/2EAAiQ+7UmXLf3QELbo3hqLZ Xvfw== 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 :delivered-to; bh=5lDd/PbGMg1+kjhAIKGocpOJkINkhtgbMP5kfZO7Xhw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=pSiBRZQn9fxTC+5k31+IhCCve7G5Aj33u0obLLidiMchValGcP2JUv3xNQHGt6obhm gulYVfyJpR+hVSWiIpaE2EfOl0f9ax3JXGhcn16qQNtTVlneQOZXQ1zhjZnDHtqpYxob K3rlteUT/F0ThcrSaaRIJQEY+AreZcn5HXPPJSQIbjY9XbH8Qme/PgWeAyKyFkIOlv3q hIJCN8KiaF/Z9XxLJTaAKGbnF+OJF2/5Wu7CA9G8oG6UZTtwIrG7kCTXcO6Z42FN0LyM nzPn8Mefuh7LRGMejm22/5wBpfyOE5BVI17Ut2dd5QPvffPkYnsKfNjeGy7jGlWbHEdG ZRnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 b26-20020a170906039a00b00a18f4244c01si4673512eja.45.2023.12.12.13.02.50; Tue, 12 Dec 2023 13:02:58 -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; 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 A6B7568D116; Tue, 12 Dec 2023 23:02:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4535768CF82 for ; Tue, 12 Dec 2023 23:02:41 +0200 (EET) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id ADB8CC00A2 for ; Tue, 12 Dec 2023 23:02:40 +0200 (EET) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Dec 2023 23:02:39 +0200 Message-ID: <20231212210240.19886-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] checkasm/lpc: test compute_autocorr 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: 5kn66YduNuIt --- tests/checkasm/lpc.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/tests/checkasm/lpc.c b/tests/checkasm/lpc.c index 592e34c03d..4d84defec3 100644 --- a/tests/checkasm/lpc.c +++ b/tests/checkasm/lpc.c @@ -57,10 +57,41 @@ static void test_window(int len) bench_new(src, len, dst1); } +static void test_compute_autocorr(ptrdiff_t len, int lag) +{ + LOCAL_ALIGNED(16, double, src, [5000]); + LOCAL_ALIGNED(16, double, dst0, [MAX_LPC_ORDER + 1]); + LOCAL_ALIGNED(16, double, dst1, [MAX_LPC_ORDER + 1]); + + declare_func(void, const double *in, ptrdiff_t len, int lag, double *out); + + av_assert0(lag >= 0 && lag <= MAX_LPC_ORDER); + + for (size_t i = 0; i < len; i++) { + src[i] = (double)rnd() / (double)UINT_MAX; + } + + call_ref(src, len, lag, dst0); + call_new(src, len, lag, dst1); + + for (size_t i = 0; i < lag; i++) { + if (!double_near_abs_eps(dst0[i], dst1[i], EPS)) { + fprintf(stderr, "%zu: %- .12f - %- .12f = % .12g\n", + i, dst0[i], dst1[i], dst0[i] - dst1[i]); + fail(); + break; + } + } + + bench_new(src, len, lag, dst1); +} + void checkasm_check_lpc(void) { LPCContext ctx; - int len = rnd() % 5000; + int len = 2000 + (rnd() % 3000); + static const int lags[] = { 10, 30, 32 }; + ff_lpc_init(&ctx, 32, 16, FF_LPC_TYPE_DEFAULT); if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_even")) { @@ -72,6 +103,13 @@ void checkasm_check_lpc(void) test_window(len | 1); } report("apply_welch_window_odd"); - ff_lpc_end(&ctx); + + for (size_t i = 0; i < FF_ARRAY_ELEMS(lags); i++) { + ff_lpc_init(&ctx, 32, lags[i], FF_LPC_TYPE_DEFAULT); + if (check_func(ctx.lpc_compute_autocorr, "autocorr_%d", lags[i])) + test_compute_autocorr(len, lags[i]); + report("compute_autocorr_%d", lags[i]); + ff_lpc_end(&ctx); + } }