]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_v360: fix hfov/vfov calculation from dfov for sg projection
authorPaul B Mahol <onemda@gmail.com>
Wed, 25 Mar 2020 12:38:01 +0000 (13:38 +0100)
committerPaul B Mahol <onemda@gmail.com>
Wed, 25 Mar 2020 12:38:41 +0000 (13:38 +0100)
libavfilter/vf_v360.c

index ae94354212075e097f0f61bea715f1f7cd157f78..fe0c9f3c4df504e731e35cbb05011016f4a0f07b 100644 (file)
@@ -3542,6 +3542,15 @@ static int allocate_plane(V360Context *s, int sizeof_uv, int sizeof_ker, int siz
 static void fov_from_dfov(int format, float d_fov, float w, float h, float *h_fov, float *v_fov)
 {
     switch (format) {
+    case STEREOGRAPHIC:
+        {
+            const float d = 0.5f * hypotf(w, h);
+            const float l = d / (tanf(d_fov * M_PI / 720.f));
+
+            *h_fov = 2.f * atan2f(w * 0.5f, l) * 360.f / M_PI;
+            *v_fov = 2.f * atan2f(h * 0.5f, l) * 360.f / M_PI;
+        }
+        break;
     case FISHEYE:
         {
             const float d = 0.5f * hypotf(w, h);