From patchwork Thu Dec 12 09:47:16 2019 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: 16749 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3AEE1449405 for ; Thu, 12 Dec 2019 11:47:25 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 234D768A995; Thu, 12 Dec 2019 11:47:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9BF9368A0C5 for ; Thu, 12 Dec 2019 11:47:18 +0200 (EET) Received: by mail-lj1-f170.google.com with SMTP id r19so1540165ljg.3 for ; Thu, 12 Dec 2019 01:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=JfhiPklEdkUTKUy9uiKT8IZIhzIPZLQtAckznm7ySAI=; b=e/Ta/My8BpskwPKkZzWKs8LhaCuJ28jch9B+2Cxy0pn65+s9MJb0U/TbMkpul+w7Yz S3NZLbSDOhXRi+X6QiIo7OkPRzoFwvP4SKYTVQ8B2RLUpjWWO6kwBdVRZgSNDxjevQNw 6tkBGCAFjM2oxMpNn3FVYme/YpG6IuXGU6QQR/CuYLE3WYa+VhiH4AckhNASf8iblJ3i 9OtuIFSkHY13PTp8Lb1llpcRoHI2auW37C7e3E7oI6Q1exM4qdafIDd7hBqqRf+kmuF7 ZJWA5BqSSW4l+Sg8d4MKa+z7DdTYqpB6ugAt8LeO7SXd6X8ChjIhUynVupP6jS0eEIxk MSfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=JfhiPklEdkUTKUy9uiKT8IZIhzIPZLQtAckznm7ySAI=; b=AoyYZr1IXOj763AQyi8hShIynsrNjMASdOzTlVFnB+zDK0qcBTKXQuCwjUQlAqkAri tizTiVmltfyh6YvC5mfejAkIlbYdME9ZJ2dHdwY+QMRflMHbtpEDQp8cM98a1f/I5QJR XoYtLXgHjQTAa6yu9cgDiA1fLjLqHD5E8SYvEvajbY8eSejzHZ8ywBc4Yg80RsheYr6w RadUzXTLcVJ6CoTlSDEG+hytWVVOlSIzutxs32lbnGWWPj/uqPTsH99iJUGfxLoouVP+ Zxfhgz9yI4dxwOdP89eltJtj1bEqrDDp9CwbakHZfsFWS1nkJkCtVtfh6PLd4UNUKzvs NA+Q== X-Gm-Message-State: APjAAAUptR6K1xVNYffSxS80U0artixg5Hu8qxCEvmbF/Al3oMTj+3pN 140zJvBVGB6kdQL4XyYf0EmYumHAqE4= X-Google-Smtp-Source: APXvYqz4vi0z8CDMmq97cKo5XhYtKMKq4C2HH8Sc4gvwCA5Gl8/ShmXRdHtkQ9w73gEIpXGN54lsBQ== X-Received: by 2002:a2e:9b52:: with SMTP id o18mr5087689ljj.205.1576144037738; Thu, 12 Dec 2019 01:47:17 -0800 (PST) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id z26sm2615508lfq.69.2019.12.12.01.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 01:47:17 -0800 (PST) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Dec 2019 11:47:16 +0200 Message-Id: <20191212094716.17320-1-martin@martin.st> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCHv2] checkasm: af_afir: Use a dynamic tolerance depending on values X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" As the values generated by av_bmg_get can be arbitrarily large (only the stddev is specified), we can't use a fixed tolerance. Calculate a dynamic tolerance (like in float_dsp from 38f966b2222db), based on the individual steps of the calculation. This fixes running this test with certain seeds, when built with clang for mingw/x86_32. --- Fixed one typo in the expression. --- tests/checkasm/af_afir.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/af_afir.c b/tests/checkasm/af_afir.c index e3fb76e8e0..8d1f815469 100644 --- a/tests/checkasm/af_afir.c +++ b/tests/checkasm/af_afir.c @@ -53,7 +53,19 @@ static void test_fcmul_add(const float *src0, const float *src1, const float *sr call_ref(cdst, src1, src2, LEN); call_new(odst, src1, src2, LEN); for (i = 0; i <= LEN*2; i++) { - if (!float_near_abs_eps(cdst[i], odst[i], 6.2e-05)) { + int idx = i & ~1; + float cre = src2[idx]; + float cim = src2[idx + 1]; + float tre = src1[idx]; + float tim = src1[idx + 1]; + double t = fabs(src0[i]) + + fabs(tre) + fabs(tim) + fabs(cre) + fabs(cim) + + fabs(tre * cre) + fabs(tim * cim) + + fabs(tre * cim) + fabs(tim * cre) + + fabs(tre * cre - tim * cim) + + fabs(tre * cim + tim * cre) + + fabs(cdst[i]) + 1.0; + if (!float_near_abs_eps(cdst[i], odst[i], t * 2 * FLT_EPSILON)) { fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n", i, cdst[i], odst[i], cdst[i] - odst[i]); fail();