]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_v360: add partial size setup for flat
authorPaul B Mahol <onemda@gmail.com>
Sat, 29 Feb 2020 19:22:37 +0000 (20:22 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 29 Feb 2020 19:22:37 +0000 (20:22 +0100)
Other part of size is calculated from both available horizontal
and vertical FOV and given one size component.

libavfilter/vf_v360.c

index 3c73ad32f7b5c57b059774532a79404802d01a43..fc799f18c2e557caa0924b11f649f5b8eb72f0c6 100644 (file)
@@ -3790,7 +3790,15 @@ static int config_output(AVFilterLink *outlink)
     }
 
     // Override resolution with user values if specified
-    if (s->width > 0 && s->height > 0) {
+    if (s->width > 0 && s->height <= 0 && s->h_fov > 0.f && s->v_fov > 0.f &&
+        s->out == FLAT && s->d_fov == 0.f) {
+        w = s->width;
+        h = w / tanf(s->h_fov * M_PI / 360.f) * tanf(s->v_fov * M_PI / 360.f);
+    } else if (s->width <= 0 && s->height > 0 && s->h_fov > 0.f && s->v_fov > 0.f &&
+        s->out == FLAT && s->d_fov == 0.f) {
+        h = s->height;
+        w = h / tanf(s->v_fov * M_PI / 360.f) * tanf(s->h_fov * M_PI / 360.f);
+    } else if (s->width > 0 && s->height > 0) {
         w = s->width;
         h = s->height;
     } else if (s->width > 0 || s->height > 0) {