From patchwork Mon Dec 11 20:41:03 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: 45079 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp3185091pzf; Mon, 11 Dec 2023 12:41:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/wgJRkHjnAl/nmFP8TdhHQqRN3QGGjrepYPPp+fqQfNlZFPVhoD24dC9hauPPRE965IH7 X-Received: by 2002:a05:6512:39cc:b0:50b:ec63:8cf with SMTP id k12-20020a05651239cc00b0050bec6308cfmr3423605lfu.21.1702327275068; Mon, 11 Dec 2023 12:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702327275; cv=none; d=google.com; s=arc-20160816; b=FDOJ19WvRxMYpEG+1MSSBIqI1Mxf0tE8tWnhH3SQ9M/+1aL/v7e5UPcFgrSS1iFxMa DyTbiAcLBIvzk8nJBvjPjCeZBjWZZI5ZjOC7w42hE8vi2MgU+jRgNOTTy/j44qBInz6s K6+cd/4sK1L+E3Hmang6xOorOU4NmHvTPnpbPI6QCR3thi5x6NdMHmPxv8rt0D3sB2M3 LEoVlFbyr7xy6VkY18qiDSFtw6GW2Zj24ELk8ka4Wh/osXkslYeUA8WTQbBM8ChY+gwz Yk65rtL6xWeyeF1eBHzAcH4KZn+vJD+u2huo4vnTvMTcY8r1sHsVUsYvqQVidXbnGdzb TO+Q== 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=yg59Qi3/p9uQTeWaHUGztA7mcJudj/O0+A2BLSxUAUk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=wX8qXJIHM/sBVYQB2/9scrUjNDvijozWzdpIgFBAxq4vfrJ9DOX84B1GTi6r6UUp2p Dv+PpX6vQq9VVkKuCr6o+xAso1wLSzcjkGFDoGAQsX5jXGQWnKf8zbLAlZcPwUqy9HCO utWgqW/vs1bSVjYKqBQK2ZsNzobO0p0MlyjNxkx+XyLRF3OeBPjiegL+KJ5ZRjfHQxkR u7/Jhv66xAt2IOgAfRHjZ2P49D52HVK9F/ENxNsjbT64r7KiDVX8jBYoySC67vCpuyJN ZvNT7ws4yH3UmvLlZAMk12YMT9wgGwWi+zkbGYUnw9818Oes89BS8YL6nF5ify/TZPw6 7r+A== 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 lw21-20020a170906bcd500b00a1d639f7bdasi3767565ejb.543.2023.12.11.12.41.14; Mon, 11 Dec 2023 12:41:15 -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 1CB6A68D1EE; Mon, 11 Dec 2023 22:41:11 +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 89D2368D1BE for ; Mon, 11 Dec 2023 22:41:04 +0200 (EET) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id EC6CBC0069 for ; Mon, 11 Dec 2023 22:41:03 +0200 (EET) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Dec 2023 22:41:03 +0200 Message-ID: <20231211204103.33927-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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: VSRzeIaRn6o6 --- tests/checkasm/lpc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/checkasm/lpc.c b/tests/checkasm/lpc.c index 592e34c03d..8e92a9e1b4 100644 --- a/tests/checkasm/lpc.c +++ b/tests/checkasm/lpc.c @@ -57,10 +57,40 @@ static void test_window(int len) bench_new(src, len, dst1); } +static void test_compute_autocorr(int lag) +{ + LOCAL_ALIGNED(16, double, src, [5000]); + LOCAL_ALIGNED(16, double, dst0, [32]); + LOCAL_ALIGNED(16, double, dst1, [32]); + const size_t len = 5000; + + declare_func(void, const double *in, ptrdiff_t len, int lag, double *out); + + 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; + 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")) { @@ -73,5 +103,11 @@ void checkasm_check_lpc(void) } report("apply_welch_window_odd"); + for (size_t i = 0; i < FF_ARRAY_ELEMS(lags); i++) { + if (check_func(ctx.lpc_compute_autocorr, "autocorr_%d", lags[i])) + test_compute_autocorr(lags[i]); + report("compute_autocorr_%d", lags[i]); + } + ff_lpc_end(&ctx); }