From patchwork Wed Nov 15 07:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 6091 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4265533jah; Tue, 14 Nov 2017 23:45:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMbFvmklbz9C0STaLpl9L/hrCi9HY2zTF83pstrO4AHmfirnr7E7FDZsAEd6avFD4QMcO6mw X-Received: by 10.28.128.73 with SMTP id b70mr8417847wmd.53.1510731940717; Tue, 14 Nov 2017 23:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510731940; cv=none; d=google.com; s=arc-20160816; b=W7VOuwAtWHqxUfNi7TsDaj6eEOawbZy1weKk3B8RC9IyiexBT735iSdryaX93b+xWp B2tlX20+uBB05h40+BWVPfXmxHgsXGeP9RBbCDrvZKkmq5Qf6LxNLITnpNhZo8NKF1FJ UhYkvmz7vohcd49Of4UtORw8UbWGSMDJ/ZVc35MxpbJ9CIBco4kLb88IMllu/E9MvuCe JgVIUH4NJLMFlS/fR1dnb9T6n6tIW8gRt2TtQtBYhx39D/bIiLD1LN9uMoST5z6XV1J8 WuxNpSUFiwdJaPaPbTz8K11Rf6U0YNABE3Bdtx+9SJ20zudQbjyjwu8+X7RBzUeWq+mf LJtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:date:to:from :delivered-to:arc-authentication-results; bh=h9gUbefvXoK4tgAGzsTNKviMG2dTaTjh2n2agwkyw0k=; b=OwK3Z0hD/2bqeWx/OIrvVe4wG67yFG5aw1WQzVJm7b+hhhpHp/QGB0u8+taHNTuHav CqvUojaIgV8f1x/zwUL1Blf0YowBpZ8gPKw/KpF8/jPVIJrYxSlAlXKmgo7lxaO/llzc m4B1chWk2hLtKRDWbENy2yCB3merBKpDo9VzhEGr+qtA9Dh4Av74A6enuQCiyYoMT7/b hDKlsZR2Leiq3zifzxXc+7mgbN/wlDp3Y3ekND0wS1l61zT2FjjVtrKxZxiX2VSNo1+0 p44Yy1e/I+GEufLZ4P0ZagphZFrMKK3+VhkDnIqHpj2fkqLAiWaoWy2mFvHfSLSjMiDD Js2g== 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 n10si17284288wrh.355.2017.11.14.23.45.40; Tue, 14 Nov 2017 23:45:40 -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 64CF468A0DB; Wed, 15 Nov 2017 09:45:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC2A868A08E for ; Wed, 15 Nov 2017 09:45:15 +0200 (EET) X-QQ-mid: bizesmtp15t1510731913tsd4859y Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Wed, 15 Nov 2017 15:45:13 +0800 (CST) X-QQ-SSF: 01100000004000F0FI80000A0000000 X-QQ-FEAT: IBShUBz8YqTDP4U1Z39QxsPDSYtJtApvdAF5eGGssFOciLkqbeGpnowCozbjf p/DKmDFdiWLGAdCWENSO1AIgR3XnnkhwGgxKKOq/fp2zgas0Xd0OtHfQ/S1vzQnZBKON/YT HO2fSbn4OE3ePphkMVw1CYivrVfwU4OgEpCzRqblYoY830plkW9ThsdRJbK4mlVO+Q3xh7d Bwcy/pk0NsRke6OZmCCJVgFGjn5/vi2FRtlLK79R/6kHTSrkgsWL+7rtQPYK52ee+CXaDnb HEMkPzaHlLtphkO1jgpS4UX0hiqkTdsa54hg== X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Nov 2017 15:45:11 +0800 Message-Id: <20171115074511.25580-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 10/11] avformat/utils: use FFABS to instead of fabs 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 Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Steven Liu --- libavformat/utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 87887063be..c2c9afbbfd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3359,7 +3359,7 @@ void ff_rfps_calculate(AVFormatContext *ic) && st->r_frame_rate.num && st->info->rfps_duration_sum && st->info->codec_info_duration <= 0 && st->info->duration_count > 2 - && fabs(1.0 / (av_q2d(st->r_frame_rate) * av_q2d(st->time_base)) - st->info->rfps_duration_sum / (double)st->info->duration_count) <= 1.0 + && FFABS(1.0 / (av_q2d(st->r_frame_rate) * av_q2d(st->time_base)) - st->info->rfps_duration_sum / (double)st->info->duration_count) <= 1.0 ) { av_log(ic, AV_LOG_DEBUG, "Setting avg frame rate based on r frame rate\n"); st->avg_frame_rate = st->r_frame_rate; @@ -3921,7 +3921,7 @@ FF_ENABLE_DEPRECATION_WARNINGS * within 1% of the original estimate. */ for (j = 0; j < MAX_STD_TIMEBASES; j++) { AVRational std_fps = { get_std_framerate(j), 12 * 1001 }; - double error = fabs(av_q2d(st->avg_frame_rate) / + double error = FFABS(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1); if (error < best_error) { @@ -3930,7 +3930,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } if (ic->internal->prefer_codec_framerate && codec_frame_rate.num > 0 && codec_frame_rate.den > 0) { - error = fabs(av_q2d(codec_frame_rate) / + error = FFABS(av_q2d(codec_frame_rate) / av_q2d(std_fps) - 1); if (error < best_error) { best_error = error; @@ -4953,7 +4953,7 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f if (st->internal->avctx->ticks_per_frame > 1) { if ( codec_fr.num > 0 && codec_fr.den > 0 && - (fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1)) + (fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && FFABS(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1)) fr = codec_fr; }