]> git.sesse.net Git - ffmpeg/commitdiff
tests/audiomatch: removes a warning when compiling tests/audiomatch
authorSteven Liu <lq@chinaffmpeg.org>
Mon, 19 Oct 2020 06:05:36 +0000 (14:05 +0800)
committerliuqi05 <liuqi05@kuaishou.com>
Mon, 26 Oct 2020 03:20:17 +0000 (11:20 +0800)
the warning message:
warning: using floating point absolute value function
'fabs' when argument is of integer type
use FFABS to set the absolute value.

Signed-off-by: liuqi05 <liuqi05@kuaishou.com>
tests/audiomatch.c

index d44c4070e072fa5357ab6462034748a9deffddd7..bb9deca6241ecb34bd2863711f1dd79345bc98a6 100644 (file)
@@ -24,6 +24,7 @@
 
 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
+#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
 
 static int64_t fsize(FILE *f) {
     int64_t end, pos = ftell(f);
@@ -101,9 +102,9 @@ int main(int argc, char **argv) {
             int j = pos + i;
             c += signal[i] * data[j];
         }
-        if (fabs(c) > sigamp * 0.94)
-            maxshift = FFMIN(maxshift, fabs(pos)+32);
-        if (fabs(c) > fabs(bestc)) {
+        if (FFABS(c) > sigamp * 0.94)
+            maxshift = FFMIN(maxshift, FFABS(pos)+32);
+        if (FFABS(c) > FFABS(bestc)) {
             bestc = c;
             bestpos = pos;
         }