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
16431643 const float l = hypotf(x, y);
16441644
16451645 if (l <= 1.f) {
1646− const float phi = atan2f(x, y);
1647− const float theta = 2.f * asinf(l);
1646+ const float z = 2.f * l * sqrtf(1.f - l * l);
16481647
1649− const float sin_phi = sinf(phi);
1650− const float cos_phi = cosf(phi);
1651− const float sin_theta = sinf(theta);
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;
1648+ vec[0] = z * x / (l > 0.f ? l : 1.f);
1649+ vec[1] = -z * y / (l > 0.f ? l : 1.f);
1650+ vec[2] = -1.f + 2.f * l * l;
16571651 } else {
16581652 vec[0] = 0.f;
16591653 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