[FFmpeg-cvslog] avfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height

Paul B Mahol git at videolan.org
Sun Apr 11 11:18:25 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Apr 11 10:09:48 2021 +0200| [e917cd9828f63aba27a5647c012d62a85bf0c977] | committer: Paul B Mahol

avfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height

Based on patch by Daniel Playfair Cal.

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

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

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 87105dbe92..053ea8868e 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -4078,18 +4078,18 @@ static void fov_from_dfov(int format, float d_fov, float w, float h, float *h_fo
         break;
     case DUAL_FISHEYE:
         {
-            const float d = 0.5f * hypotf(w * 0.5f, h);
+            const float d = hypotf(w * 0.5f, h);
 
-            *h_fov = d / w * 2.f * d_fov;
-            *v_fov = d / h * d_fov;
+            *h_fov = 0.5f * w / d * d_fov;
+            *v_fov =        h / d * d_fov;
         }
         break;
     case FISHEYE:
         {
-            const float d = 0.5f * hypotf(w, h);
+            const float d = hypotf(w, h);
 
-            *h_fov = d / w * d_fov;
-            *v_fov = d / h * d_fov;
+            *h_fov = w / d * d_fov;
+            *v_fov = h / d * d_fov;
         }
         break;
     case FLAT:



More information about the ffmpeg-cvslog mailing list