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-21 17:21:36 +0300
committerPaul B Mahol <onemda@gmail.com>2019-09-21 17:31:32 +0300
commit34046bcd5ff68401a98b46a0bcb1790175a63e5f (patch)
tree067545cacb0f473d8c5a99639a900048dedf2be6 /libavfilter
parentecaef69fbb1ed011a14624d944113e32a17d7780 (diff)
avfilter/vf_v360: simplify ball_to_xyz() calculations
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_v360.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 1a0fe90909..ea4c2003ec 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -1643,17 +1643,11 @@ static void ball_to_xyz(const V360Context *s,
const float l = hypotf(x, y);
if (l <= 1.f) {
- const float phi = atan2f(x, y);
- const float theta = 2.f * asinf(l);
+ const float z = 2.f * l * sqrtf(1.f - l * l);
- const float sin_phi = sinf(phi);
- const float cos_phi = cosf(phi);
- const float sin_theta = sinf(theta);
- const float cos_theta = cosf(theta);
-
- vec[0] = sin_theta * sin_phi;
- vec[1] = -sin_theta * cos_phi;
- vec[2] = -cos_theta;
+ vec[0] = z * x / (l > 0.f ? l : 1.f);
+ vec[1] = -z * y / (l > 0.f ? l : 1.f);
+ vec[2] = -1.f + 2.f * l * l;
} else {
vec[0] = 0.f;
vec[1] = -1.f;