History

avfilter/vf_v360: simplify ball_to_xyz() calculations

Paul B Mahol committed 7 years ago

Commit 34046bc1 parent ecaef691 file · +4 −10Browse files

Unified · Split

libavfilter/vf_v360.c+4−10
@@ -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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t