avutil/softfloat: fix av_sincos_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/389/head
Michael Niedermayer 2 years ago
parent fe167bae96
commit d84677abd8
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 2
      libavutil/softfloat.h
  2. 2
      libavutil/tests/softfloat.c

@ -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);
}

@ -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));
}

Loading…
Cancel
Save