History

avfilter/vf_v360: fix various artifacts with cubemaps

Paul B Mahol committed 7 years ago

Commit bc894341 parent 048c7121 file · +12 −12Browse files

Unified · Split

libavfilter/vf_v360.c+12−12
@@ -1073,8 +1073,8 @@ static void cube3x2_to_xyz(const V360Context *s, · 1072 unmodified lines
10731073 const int ewi = ceilf(ew * (u_face + 1)) - u_shift;
10741074 const int ehi = ceilf(eh * (v_face + 1)) - v_shift;
10751075
1076− const float uf = 2.f * (i - u_shift) / ewi - 1.f;
1077− const float vf = 2.f * (j - v_shift) / ehi - 1.f;
1076+ const float uf = 2.f * (i - u_shift + 0.5f) / ewi - 1.f;
1077+ const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f;
10781078
10791079 cube_to_xyz(s, uf, vf, face, vec);
10801080 }
@@ -1114,8 +1114,8 @@ static void xyz_to_cube3x2(const V360Context *s, · 33 unmodified lines
11141114 ewi = ceilf(ew * (u_face + 1)) - ceilf(ew * u_face);
11151115 ehi = ceilf(eh * (v_face + 1)) - ceilf(eh * v_face);
11161116
1117− uf = 0.5f * ewi * (uf + 1.f);
1118− vf = 0.5f * ehi * (vf + 1.f);
1117+ uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1118+ vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
11191119
11201120 ui = floorf(uf);
11211121 vi = floorf(vf);
@@ -1188,8 +1188,8 @@ static void cube1x6_to_xyz(const V360Context *s, · 66 unmodified lines
11881188 const int v_shift = ceilf(eh * face);
11891189 const int ehi = ceilf(eh * (face + 1)) - v_shift;
11901190
1191− const float uf = 2.f * i / ew - 1.f;
1192− const float vf = 2.f * (j - v_shift) / ehi - 1.f;
1191+ const float uf = 2.f * (i + 0.5f) / ew - 1.f;
1192+ const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f;
11931193
11941194 cube_to_xyz(s, uf, vf, face, vec);
11951195 }
@@ -1216,8 +1216,8 @@ static void cube6x1_to_xyz(const V360Context *s, · 20 unmodified lines
12161216 const int u_shift = ceilf(ew * face);
12171217 const int ewi = ceilf(ew * (face + 1)) - u_shift;
12181218
1219− const float uf = 2.f * (i - u_shift) / ewi - 1.f;
1220− const float vf = 2.f * j / eh - 1.f;
1219+ const float uf = 2.f * (i - u_shift + 0.5f) / ewi - 1.f;
1220+ const float vf = 2.f * (j + 0.5f) / eh - 1.f;
12211221
12221222 cube_to_xyz(s, uf, vf, face, vec);
12231223 }
@@ -1253,8 +1253,8 @@ static void xyz_to_cube1x6(const V360Context *s, · 29 unmodified lines
12531253 face = s->in_cubemap_face_order[direction];
12541254 ehi = ceilf(eh * (face + 1)) - ceilf(eh * face);
12551255
1256− uf = 0.5f * ewi * (uf + 1.f);
1257− vf = 0.5f * ehi * (vf + 1.f);
1256+ uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1257+ vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
12581258
12591259 ui = floorf(uf);
12601260 vi = floorf(vf);
@@ -1329,8 +1329,8 @@ static void xyz_to_cube6x1(const V360Context *s, · 68 unmodified lines
13291329 face = s->in_cubemap_face_order[direction];
13301330 ewi = ceilf(ew * (face + 1)) - ceilf(ew * face);
13311331
1332− uf = 0.5f * ewi * (uf + 1.f);
1333− vf = 0.5f * ehi * (vf + 1.f);
1332+ uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1333+ vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
13341334
13351335 ui = floorf(uf);
13361336 vi = floorf(vf);

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