diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-03-25 15:38:01 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-03-25 15:38:41 +0300 |
commit | 0b4389753035c9a69116ea4a4a8caee213ed7c24 (patch) | |
tree | 968d00a92d9f41afdfe4484444144fea1d5c7e7d /libavfilter | |
parent | e5d25d1147b4b213fa414247717281862d1e9d71 (diff) |
avfilter/vf_v360: fix hfov/vfov calculation from dfov for sg projection
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_v360.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index ae94354212..fe0c9f3c4d 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -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); |