Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -1589,17 +1589,18 @@ static void mercator_to_xyz(const V360Context *s, · 1588 unmodified lines | ||
| 1589 | 1589 | int i, int j, int width, int height, |
| 1590 | 1590 | float *vec) |
| 1591 | 1591 | { |
| 1592 | − const float phi = ((2.f * i) / width - 1.f) * M_PI; | |
| 1593 | − const float theta = atanf(sinhf(((2.f * j) / height - 1.f) * 2.f * M_PI)); | |
| 1592 | + const float phi = ((2.f * i) / width - 1.f) * M_PI + M_PI_2; | |
| 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 | 1596 | const float sin_phi = sinf(phi); |
| 1596 | 1597 | const float cos_phi = cosf(phi); |
| 1597 | − const float sin_theta = sinf(theta); | |
| 1598 | − const float cos_theta = cosf(theta); | |
| 1598 | + const float sin_theta = -2.f * expf(y) / div; | |
| 1599 | + const float cos_theta = -(expf(2.f * y) - 1.f) / div; | |
| 1599 | 1600 | |
| 1600 | − vec[0] = cos_theta * sin_phi; | |
| 1601 | − vec[1] = -sin_theta; | |
| 1602 | − vec[2] = -cos_theta * cos_phi; | |
| 1601 | + vec[0] = sin_theta * cos_phi; | |
| 1602 | + vec[1] = cos_theta; | |
| 1603 | + vec[2] = sin_theta * sin_phi; | |
| 1603 | 1604 | } |
| 1604 | 1605 | |
| 1605 | 1606 | /** |