Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -1643,17 +1643,11 @@ static void ball_to_xyz(const V360Context *s, · 1642 unmodified lines | |||
| 1643 | const float l = hypotf(x, y); | 1643 | const float l = hypotf(x, y); |
| 1644 | 1644 | ||
| 1645 | if (l <= 1.f) { | 1645 | if (l <= 1.f) { |
| 1646 | const float phi = atan2f(x, y); | 1646 | const float z = 2.f * l * sqrtf(1.f - l * l); |
| 1647 | const float theta = 2.f * asinf(l); | ||
| 1648 | 1647 | ||
| 1649 | const float sin_phi = sinf(phi); | 1648 | vec[0] = z * x / (l > 0.f ? l : 1.f); |
| 1650 | const float cos_phi = cosf(phi); | 1649 | vec[1] = -z * y / (l > 0.f ? l : 1.f); |
| 1651 | const float sin_theta = sinf(theta); | 1650 | vec[2] = -1.f + 2.f * l * l; |
| 1652 | const float cos_theta = cosf(theta); | ||
| 1653 | |||
| 1654 | vec[0] = sin_theta * sin_phi; | ||
| 1655 | vec[1] = -sin_theta * cos_phi; | ||
| 1656 | vec[2] = -cos_theta; | ||
| 1657 | } else { | 1651 | } else { |
| 1658 | vec[0] = 0.f; | 1652 | vec[0] = 0.f; |
| 1659 | vec[1] = -1.f; | 1653 | vec[1] = -1.f; |