[FFmpeg-cvslog] avcodec/ffv1enc: Eliminate fabs()

Michael Niedermayer git at videolan.org
Sun Apr 27 06:06:13 EEST 2025


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Apr 23 00:06:39 2025 +0200| [fb36f170deb24c5639199518a95e2384dfccef70] | committer: Michael Niedermayer

avcodec/ffv1enc: Eliminate fabs()

Fixes: warning: using floating point absolute value function 'fabs' when argument is of integer type
No change in output
Changing variables to float worsens compression significantly

Found-by: ePirat
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb36f170deb24c5639199518a95e2384dfccef70
---

 libavcodec/ffv1enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 75e40771b6..6ab648fd80 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1441,7 +1441,7 @@ static void encode_float32_remap(FFV1Context *f, FFV1SliceContext *sc,
                         cost = FFMAX((delta + mul/2)  / mul, 1);
                         float score = 1;
                         if (mul > 1) {
-                            score *= (fabs(delta - cost*mul)+1);
+                            score *= (FFABS(delta - cost*mul)+1);
                             if (mul_count > 1)
                                 score *= score;
                         }



More information about the ffmpeg-cvslog mailing list