From patchwork Tue Aug 27 00:03:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 51155 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b38f:0:b0:48e:c0f8:d0de with SMTP id r15csp79792vqn; Mon, 26 Aug 2024 17:03:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWTo7+4XPH4ZvTKC5ec8ni6Gn1HGEgx3V/LpRRevomLZt2qDt1iEBXRrXsF13OZcgd6cn7SE4Y41d7HDpcp4vll@gmail.com X-Google-Smtp-Source: AGHT+IH1AHAYQnDowOt7X47iMMfMQj0h6dqkrvGm4lOPAd59As0zOTdos+Ms6jSffMLkXLahUnFa X-Received: by 2002:a05:6402:510f:b0:5be:ead2:db86 with SMTP id 4fb4d7f45d1cf-5c0ba299700mr611783a12.5.1724717035669; Mon, 26 Aug 2024 17:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724717035; cv=none; d=google.com; s=arc-20240605; b=VmNczjp0xOt1Hiq8NyzyySCJIU8bgevhhe/pp6uum0MBJY/Yr4VJvOt40Oial5lJZR 5Yfti/QMM5gFpR4JPRttqJliFaJuKtftumSu14zzxI7R/9dfegllnwuUsKHg/23dt2Hu LUZ/1fXSyEn5/edgOPrs3Hg2BiFDIWhv3b1bVNUvF4rxROW7TGPTi9g4EprgZ7y3aBWK AyKDdlF4+RkaOVzatdPj0k3Qv1oda5HDpdfLpSM/Oa5rgbbbtCI1pldw4l427s6XnoWv FvpTEgs1QeMACrYNfswZoK/MBnnvmolP2YuIN4GI/9LIgDscz/LVAdgId0Rjsz0hGSiP H1sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc: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=LNFbvwkGGoC6Y3uVl3fyuZt6JfH3DnK2opLrkPdqEOY=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=BUwdk2f6P61e+UzeAqCA9Z9RT+tmyUds6T093Kf5PuBmTWfIVzJ8lgaPUWp3Uvhul1 nkGXPLX32oMZQ4KTDPxBDt2zeMV710mtROQKlwl6UxIpjKkUiXi/25ETF7PFt6YHNUB9 DSPAXEKP1VzGgKHySyrQ2BxJbrSXO50G9yM2PxPn6nlsFpKivd9o8zBlw7dyGiAfjXVp 44WIIeUUEq4LwcHZNY9jVxQRHXLPhlgSrDAjNPdIBBJzZN4BaQ0bHGG0oAnzGZJ2XZLP 9EnW8XNLd9vs5AXQfeRHbUkwwrxhLVJkI9vlVf3KkUJXHoe7fXWwOX3iKExFDI6EvUMk N22A==; dara=google.com 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 4fb4d7f45d1cf-5c0bb1c8495si428349a12.110.2024.08.26.17.03.55; Mon, 26 Aug 2024 17:03:55 -0700 (PDT) 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 D6A0568DCD3; Tue, 27 Aug 2024 03:03:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D755F68D718 for ; Tue, 27 Aug 2024 03:03:45 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id AC825EAD51; Tue, 27 Aug 2024 02:03:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qNBRmJvObV_Q; Tue, 27 Aug 2024 02:03:44 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D06D8EAD42; Tue, 27 Aug 2024 02:03:43 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 27 Aug 2024 02:03:37 +0200 Message-ID: <20240827000341.21853-1-cus@passwd.hu> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avutil/timestamp: avoid using INFINITY for log10 result in av_ts_make_time_string2 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yN3V4qH7n6W9 Using INFINITY can cause issues with -ffast-math, and since we only use this value to decide the formatting, we can just as easily use 0 for log10 of zero. Signed-off-by: Marton Balint --- libavutil/timestamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c index 6c231a517d..be4540d4c8 100644 --- a/libavutil/timestamp.c +++ b/libavutil/timestamp.c @@ -24,7 +24,7 @@ char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); } else { double val = av_q2d(tb) * ts; - double log = (fpclassify(val) == FP_ZERO ? -INFINITY : floor(log10(fabs(val)))); + double log = (fpclassify(val) == FP_ZERO ? 0 : floor(log10(fabs(val)))); int precision = (isfinite(log) && log < 0) ? -log + 5 : 6; int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision, val); last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1;