Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -2083,11 +2083,12 @@ static void xyz_to_dfisheye(const V360Context *s, · 2082 unmodified lines | |||
| 2083 | const float ew = width / 2.f; | 2083 | const float ew = width / 2.f; |
| 2084 | const float eh = height; | 2084 | const float eh = height; |
| 2085 | 2085 | ||
| 2086 | const float phi = atan2f(-vec[1], -vec[0]) * s->input_mirror_modifier[0]; | 2086 | const float h = hypotf(vec[0], vec[1]); |
| 2087 | const float theta = acosf(fabsf(vec[2])) / M_PI * s->input_mirror_modifier[1]; | 2087 | const float lh = h > 0.f ? h : 1.f; |
| 2088 | const float theta = acosf(fabsf(vec[2])) / M_PI; | ||
| 2088 | 2089 | ||
| 2089 | float uf = (theta * cosf(phi) * scale + 0.5f) * ew; | 2090 | float uf = (theta * (-vec[0] / lh) * s->input_mirror_modifier[0] * scale + 0.5f) * ew; |
| 2090 | float vf = (theta * sinf(phi) * scale + 0.5f) * eh; | 2091 | float vf = (theta * (-vec[1] / lh) * s->input_mirror_modifier[1] * scale + 0.5f) * eh; |
| 2091 | 2092 | ||
| 2092 | int ui, vi; | 2093 | int ui, vi; |
| 2093 | int u_shift; | 2094 | int u_shift; |