From patchwork Sun Jan 28 03:01:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 45862 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8786:b0:199:de12:6fa6 with SMTP id ph6csp832785pzb; Sat, 27 Jan 2024 19:01:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdLO6H94y1wujBykuihAO0i57XcjDmmMMoirGzJvLIYE5YARO8YLQDkeLEpcIFufQflVQ0 X-Received: by 2002:adf:a1c5:0:b0:337:c58a:ac91 with SMTP id v5-20020adfa1c5000000b00337c58aac91mr2525462wrv.1.1706410913688; Sat, 27 Jan 2024 19:01:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706410913; cv=none; d=google.com; s=arc-20160816; b=BWKhrLWO1AiVR9lnsbHFVdWPCqBToGexWZ1AIKa7vPhE2zQEYOTD962LtV4LKivsK0 lE1piB+FOsTaptqSlbUfOeygb/gPwXUnM7wxgBv+DQC9/9fp/jfyaQ2KEA0u8bkEhM7B rXcyrdQIXSDO0tPYeWV4EyWHhyTHN9zeKppCBldg8ZZlyz3OQkdFJvT6zj3yALRLrURb daJtgf6iBzbVXLs6uNOzDAv6AtFWnr0FtGs1VaS0rHChYdU3EBGAh1XPAEjWEK1Xb/I0 2pyDnlrEbIxGRRb+RxMMuUgr/hdYENx0CQOrqoUQWUFGyHsdpoC3ikDpvSgvy9mSbq8t WRJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=il/HzhqtEKIDIlzkmVVzR64HYVfjS9csrstD0w4Kk8U=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=UGOl7eWGpoYe3LxklkxVeDR1e77qguCcm/KmMou3BY2PAp0l9qhTlzagf+IyChHlxF 34hY/bfAq5HeD10757X87+oL86Z/tzbzHK6kP+9Qk7TkA+GS9ZaiWPbyV93dkZzTvkI/ EqOFq43x7FsEv0SL2CNXUdOotAKcQGgaq4MDvEu0S9y2N569qwsCpPYG9rl+gUSTJyCo jX3bwoR0n7fgE6mTMfUkgM/8ncnDyN2vdt+JDmW8BOGliTHk/0xel5qII7y8MWv7Wvtf TJluc8q3xEAymVUkMydfWBuUHOxu6eQqncjQ0NsJhI3n4vU++Dc0mvBDcc2mufi2866r 1eQQ== 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 k26-20020a170906579a00b00a2a3d352161si2108197ejq.561.2024.01.27.19.01.53; Sat, 27 Jan 2024 19:01:53 -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 4F92A68CD88; Sun, 28 Jan 2024 05:01:49 +0200 (EET) 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 4641E68CD88 for ; Sun, 28 Jan 2024 05:01:42 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id ED093E9CD7; Sun, 28 Jan 2024 04:01:40 +0100 (CET) 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 r_vIWnIZPvpj; Sun, 28 Jan 2024 04:01:39 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 93E98E9CBF; Sun, 28 Jan 2024 04:01:39 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jan 2024 04:01:34 +0100 Message-Id: <20240128030136.5585-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avutil/rational: increase av_d2q precision 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: CbRtGu9D6GWw Fixes parsing small timebases from expressions (where the expression API converts the result to double), like in this command line: ffprobe -f lavfi -i testsrc=d=1,settb=1/2000000000 -show_streams -show_entries stream=time_base Before the patch timebase was parsed as 1/1999999999. Signed-off-by: Marton Balint --- libavutil/rational.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/rational.c b/libavutil/rational.c index eb148ddb12..329fbf3302 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -114,7 +114,7 @@ AVRational av_d2q(double d, int max) return (AVRational) { d < 0 ? -1 : 1, 0 }; frexp(d, &exponent); exponent = FFMAX(exponent-1, 0); - den = 1LL << (61 - exponent); + den = 1LL << (62 - exponent); // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64, // see Ticket2713 for affected gcc/glibc versions av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max);