[FFmpeg-cvslog] avfilter/vf_v360: call tanf() once

Paul B Mahol git at videolan.org
Sat Sep 14 20:56:11 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 14 13:33:24 2019 +0200| [f78abca0c2851c743cbe077be9c905ebbc0ce1e8] | committer: Paul B Mahol

avfilter/vf_v360: call tanf() once

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

 libavfilter/vf_v360.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 98cef5902e..923ccd6339 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -2142,11 +2142,11 @@ static int allocate_plane(V360Context *s, int sizeof_uv, int sizeof_ker, int p)
 
 static void fov_from_dfov(V360Context *s, float w, float h)
 {
-    const float d_angle = 0.5 * FFMIN(s->d_fov, 359.f) * M_PI / 180.f;
+    const float da = tanf(0.5 * FFMIN(s->d_fov, 359.f) * M_PI / 180.f);
     const float d = hypotf(w, h);
 
-    s->h_fov = atan2f(tanf(d_angle) * w, d) * 360.f / M_PI;
-    s->v_fov = atan2f(tanf(d_angle) * h, d) * 360.f / M_PI;
+    s->h_fov = atan2f(da * w, d) * 360.f / M_PI;
+    s->v_fov = atan2f(da * h, d) * 360.f / M_PI;
 
     if (s->h_fov < 0.f)
         s->h_fov += 360.f;



More information about the ffmpeg-cvslog mailing list