Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-09-11 16:00:12 +0300
committerPaul B Mahol <onemda@gmail.com>2019-09-11 16:12:56 +0300
commitcb41c2af92f26338bc4b732e4891d3bff0f0b169 (patch)
tree4ea02168635320d09b88873a9ff739acf6a4203e /libavfilter/vf_v360.c
parent944d76a3e056c26bfa2b6459ec1888f0676a37f2 (diff)
avfilter/vf_v360: really fix FoV selection
Big thanks to Michael Koch for providing actual formula.
Diffstat (limited to 'libavfilter/vf_v360.c')
-rw-r--r--libavfilter/vf_v360.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 794f6212a3..3edea5510f 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -1410,8 +1410,11 @@ static void stereographic_to_xyz(const V360Context *s,
int i, int j, int width, int height,
float *vec)
{
- const float x = ((2.f * i) / width - 1.f) * (s->h_fov / 180.f);
- const float y = ((2.f * j) / height - 1.f) * (s->v_fov / 180.f);
+ const float h_angle = tan(FFMIN(s->h_fov, 359.f) * M_PI / 720.f);
+ const float v_angle = tan(FFMIN(s->v_fov, 359.f) * M_PI / 720.f);
+
+ const float x = ((2.f * i) / width - 1.f) * h_angle;
+ const float y = ((2.f * j) / height - 1.f) * v_angle;
const float xy = x * x + y * y;
vec[0] = 2.f * x / (1.f + xy);