History

avfilter/vf_v360: improve sg output format

Paul B Mahol committed 6 years ago

Commit 7931e761 parent b5dd9641 file · +6 −4Browse files

Unified · Split

libavfilter/vf_v360.c+6−4
@@ -1696,11 +1696,13 @@ static int stereographic_to_xyz(const V360Context *s, · 1695 unmodified lines
16961696 {
16971697 const float x = ((2.f * i + 1.f) / width - 1.f) * s->flat_range[0];
16981698 const float y = ((2.f * j + 1.f) / height - 1.f) * s->flat_range[1];
1699− const float xy = x * x + y * y;
1699+ const float r = hypotf(x, y);
1700+ const float theta = atanf(r) * 2.f;
1701+ const float sin_theta = sinf(theta);
17001702
1701− vec[0] = 2.f * x / (1.f + xy);
1702− vec[1] = (-1.f + xy) / (1.f + xy);
1703− vec[2] = 2.f * y / (1.f + xy);
1703+ vec[0] = x / r * sin_theta;
1704+ vec[1] = -y / r * sin_theta;
1705+ vec[2] = -cosf(theta);
17041706
17051707 normalize_vector(vec);
17061708

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