[FFmpeg-devel] [PATCH 10/11] avformat/utils: use FFABS to instead of fabs

Steven Liu lq at chinaffmpeg.org
Wed Nov 15 09:45:11 EET 2017


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 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;
     }
 
-- 
2.11.0 (Apple Git-81)





More information about the ffmpeg-devel mailing list