[FFmpeg-devel] [PATCH] avutil/softfloat: move av_sincos_sf() back to header

James Almer jamrial at gmail.com
Thu Jul 23 03:13:28 CEST 2015


Fixes compilation of host tool aacps_fixed_tablegen

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/Makefile    |  1 -
 libavutil/softfloat.c | 49 -------------------------------------------------
 libavutil/softfloat.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 70f8bae..1fc876a 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -126,7 +126,6 @@ OBJS = adler32.o                                                        \
        samplefmt.o                                                      \
        sha.o                                                            \
        sha512.o                                                         \
-       softfloat.o                                                      \
        stereo3d.o                                                       \
        threadmessage.o                                                  \
        time.o                                                           \
diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c
index 28bea58..afce358 100644
--- a/libavutil/softfloat.c
+++ b/libavutil/softfloat.c
@@ -23,55 +23,6 @@
 #include "common.h"
 #include "log.h"
 
-void av_sincos_sf(int a, int *s, int *c)
-{
-    int idx, sign;
-    int sv, cv;
-    int st, ct;
-
-    idx = a >> 26;
-    sign = (idx << 27) >> 31;
-    cv = av_costbl_1_sf[idx & 0xf];
-    cv = (cv ^ sign) - sign;
-
-    idx -= 8;
-    sign = (idx << 27) >> 31;
-    sv = av_costbl_1_sf[idx & 0xf];
-    sv = (sv ^ sign) - sign;
-
-    idx = a >> 21;
-    ct = av_costbl_2_sf[idx & 0x1f];
-    st = av_sintbl_2_sf[idx & 0x1f];
-
-    idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
-
-    sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
-
-    cv = idx;
-
-    idx = a >> 16;
-    ct = av_costbl_3_sf[idx & 0x1f];
-    st = av_sintbl_3_sf[idx & 0x1f];
-
-    idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
-
-    sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
-    cv = idx;
-
-    idx = a >> 11;
-
-    ct = (int)(((int64_t)av_costbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) +
-                (int64_t)av_costbl_4_sf[(idx & 0x1f)+1]*(a & 0x7ff) +
-                0x400) >> 11);
-    st = (int)(((int64_t)av_sintbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) +
-                (int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) +
-                0x400) >> 11);
-
-    *c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x20000000) >> 30);
-
-    *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
-}
-
 #ifdef TEST
 #include <stdio.h>
 
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 642a675..00ff4a1 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -189,6 +189,53 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
 /**
  * Rounding-to-nearest used.
  */
-void av_sincos_sf(int a, int *s, int *c);
+static av_unused void av_sincos_sf(int a, int *s, int *c)
+{
+    int idx, sign;
+    int sv, cv;
+    int st, ct;
+
+    idx = a >> 26;
+    sign = (idx << 27) >> 31;
+    cv = av_costbl_1_sf[idx & 0xf];
+    cv = (cv ^ sign) - sign;
+
+    idx -= 8;
+    sign = (idx << 27) >> 31;
+    sv = av_costbl_1_sf[idx & 0xf];
+    sv = (sv ^ sign) - sign;
+
+    idx = a >> 21;
+    ct = av_costbl_2_sf[idx & 0x1f];
+    st = av_sintbl_2_sf[idx & 0x1f];
+
+    idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
+
+    sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
+
+    cv = idx;
+
+    idx = a >> 16;
+    ct = av_costbl_3_sf[idx & 0x1f];
+    st = av_sintbl_3_sf[idx & 0x1f];
+
+    idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
+
+    sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
+    cv = idx;
+
+    idx = a >> 11;
+
+    ct = (int)(((int64_t)av_costbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) +
+                (int64_t)av_costbl_4_sf[(idx & 0x1f)+1]*(a & 0x7ff) +
+                0x400) >> 11);
+    st = (int)(((int64_t)av_sintbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) +
+                (int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) +
+                0x400) >> 11);
+
+    *c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x20000000) >> 30);
+
+    *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
+}
 
 #endif /* AVUTIL_SOFTFLOAT_H */
-- 
2.4.5



More information about the ffmpeg-devel mailing list