mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-03 06:53:23 +02:00
avfilter/vf_v360: simplify ball_to_xyz() calculations
This commit is contained in:
parent
ecaef69fbb
commit
34046bcd5f
@ -1643,17 +1643,11 @@ static void ball_to_xyz(const V360Context *s,
|
|||||||
const float l = hypotf(x, y);
|
const float l = hypotf(x, y);
|
||||||
|
|
||||||
if (l <= 1.f) {
|
if (l <= 1.f) {
|
||||||
const float phi = atan2f(x, y);
|
const float z = 2.f * l * sqrtf(1.f - l * l);
|
||||||
const float theta = 2.f * asinf(l);
|
|
||||||
|
|
||||||
const float sin_phi = sinf(phi);
|
vec[0] = z * x / (l > 0.f ? l : 1.f);
|
||||||
const float cos_phi = cosf(phi);
|
vec[1] = -z * y / (l > 0.f ? l : 1.f);
|
||||||
const float sin_theta = sinf(theta);
|
vec[2] = -1.f + 2.f * l * l;
|
||||||
const float cos_theta = cosf(theta);
|
|
||||||
|
|
||||||
vec[0] = sin_theta * sin_phi;
|
|
||||||
vec[1] = -sin_theta * cos_phi;
|
|
||||||
vec[2] = -cos_theta;
|
|
||||||
} else {
|
} else {
|
||||||
vec[0] = 0.f;
|
vec[0] = 0.f;
|
||||||
vec[1] = -1.f;
|
vec[1] = -1.f;
|
||||||
|
Loading…
Reference in New Issue
Block a user