History

avfilter/vf_v360: fix mercator_to_xyz()

Paul B Mahol committed 7 years ago

Commit a8925d21 parent b4d2bea1 file · +8 −7Browse files

Unified · Split

libavfilter/vf_v360.c+8−7
@@ -1589,17 +1589,18 @@ static void mercator_to_xyz(const V360Context *s, · 1588 unmodified lines
1589 int i, int j, int width, int height,1589 int i, int j, int width, int height,
1590 float *vec)1590 float *vec)
1591{1591{
1592 const float phi = ((2.f * i) / width - 1.f) * M_PI;1592 const float phi = ((2.f * i) / width - 1.f) * M_PI + M_PI_2;
1593 const float theta = atanf(sinhf(((2.f * j) / height - 1.f) * 2.f * M_PI));1593 const float y = ((2.f * j) / height - 1.f) * M_PI;
1594 const float div = expf(2.f * y) + 1.f;
1594 1595
1595 const float sin_phi = sinf(phi);1596 const float sin_phi = sinf(phi);
1596 const float cos_phi = cosf(phi);1597 const float cos_phi = cosf(phi);
1597 const float sin_theta = sinf(theta);1598 const float sin_theta = -2.f * expf(y) / div;
1598 const float cos_theta = cosf(theta);1599 const float cos_theta = -(expf(2.f * y) - 1.f) / div;
1599 1600
1600 vec[0] = cos_theta * sin_phi;1601 vec[0] = sin_theta * cos_phi;
1601 vec[1] = -sin_theta;1602 vec[1] = cos_theta;
1602 vec[2] = -cos_theta * cos_phi;1603 vec[2] = sin_theta * sin_phi;
1603}1604}
1604 1605
1605/**1606/**

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