History

avfilter/vf_v360: simplify xyz_to_ball() calculations

Paul B Mahol committed 7 years ago

Commit ecaef691 parent b8dfc101 file · +4 −3Browse files

Unified · Split

libavfilter/vf_v360.c+4−3
@@ -1603,12 +1603,13 @@ static void xyz_to_ball(const V360Context *s, · 1602 unmodified lines
1603 uint16_t us[4][4], uint16_t vs[4][4], float *du, float *dv)1603 uint16_t us[4][4], uint16_t vs[4][4], float *du, float *dv)
1604{1604{
1605 const float l = hypotf(vec[0], vec[1]);1605 const float l = hypotf(vec[0], vec[1]);
1606 const float r = sinf(acosf(-vec[2]) * 0.5f);1606 const float r = sqrtf(1.f + vec[2]) / M_SQRT2;
1607 float uf, vf;1607 float uf, vf;
1608 int ui, vi;1608 int ui, vi;
1609 1609
1610 uf = (1.f - r * vec[0] * s->input_mirror_modifier[0] / l) * width / 2.f;1610 uf = (1.f + r * vec[0] * s->input_mirror_modifier[0] / (l > 0.f ? l : 1.f)) * width * 0.5f;
1611 vf = (1.f + r * vec[1] * s->input_mirror_modifier[1] / l) * height / 2.f;1611 vf = (1.f - r * vec[1] * s->input_mirror_modifier[1] / (l > 0.f ? l : 1.f)) * height * 0.5f;
1612
1612 ui = floorf(uf);1613 ui = floorf(uf);
1613 vi = floorf(vf);1614 vi = floorf(vf);
1614 1615

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