diff mbox series

[FFmpeg-devel,3/3] avutil/softfloat: fix av_sincos_sf()

Message ID 20230619230424.30270-3-michael@niedermayer.cc
State Accepted
Commit d84677abd8ffb8ca8ad94eced6d9e03928f35d79
Headers show
Series [FFmpeg-devel,1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Michael Niedermayer June 19, 2023, 11:04 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavutil/softfloat.h       | 2 +-
 libavutil/tests/softfloat.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer June 23, 2023, 12:04 a.m. UTC | #1
On Tue, Jun 20, 2023 at 01:04:24AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavutil/softfloat.h       | 2 +-
>  libavutil/tests/softfloat.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index a651406f74..1520027ddc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -281,7 +281,7 @@  static av_unused void av_sincos_sf(int a, int *s, int *c)
                 (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);
+    *c = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
 
     *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
 }
diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c
index c06de44933..a2e628fe81 100644
--- a/libavutil/tests/softfloat.c
+++ b/libavutil/tests/softfloat.c
@@ -148,7 +148,7 @@  int main(void){
         av_sincos_sf(i*(1ULL<<32)/36/4, &s, &c);
         errs = (double)s/ (1<<30) - sin(i*M_PI/36);
         errc = (double)c/ (1<<30) - cos(i*M_PI/36);
-        if (fabs(errs) > 0.00000002 || fabs(errc) >0.001) {
+        if (fabs(errs) > 0.000000004 || fabs(errc) >0.000000004) {
             printf("sincos FAIL %d %f %f %f %f\n", i, (float)s/ (1<<30), (float)c/ (1<<30), sin(i*M_PI/36), cos(i*M_PI/36));
         }