History

avfilter/vf_v360: fix various artifacts with cubemaps

Paul B Mahol committed 7 years ago

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

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_v360.c+12−12
@@ -1073,8 +1073,8 @@ static void cube3x2_to_xyz(const V360Context *s, · 1072 unmodified lines
1073 const int ewi = ceilf(ew * (u_face + 1)) - u_shift;1073 const int ewi = ceilf(ew * (u_face + 1)) - u_shift;
1074 const int ehi = ceilf(eh * (v_face + 1)) - v_shift;1074 const int ehi = ceilf(eh * (v_face + 1)) - v_shift;
1075 1075
1076 const float uf = 2.f * (i - u_shift) / ewi - 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) / ehi - 1.f;1077 const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f;
1078 1078
1079 cube_to_xyz(s, uf, vf, face, vec);1079 cube_to_xyz(s, uf, vf, face, vec);
1080}1080}
@@ -1114,8 +1114,8 @@ static void xyz_to_cube3x2(const V360Context *s, · 33 unmodified lines
1114 ewi = ceilf(ew * (u_face + 1)) - ceilf(ew * u_face);1114 ewi = ceilf(ew * (u_face + 1)) - ceilf(ew * u_face);
1115 ehi = ceilf(eh * (v_face + 1)) - ceilf(eh * v_face);1115 ehi = ceilf(eh * (v_face + 1)) - ceilf(eh * v_face);
1116 1116
1117 uf = 0.5f * ewi * (uf + 1.f);1117 uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1118 vf = 0.5f * ehi * (vf + 1.f);1118 vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
1119 1119
1120 ui = floorf(uf);1120 ui = floorf(uf);
1121 vi = floorf(vf);1121 vi = floorf(vf);
@@ -1188,8 +1188,8 @@ static void cube1x6_to_xyz(const V360Context *s, · 66 unmodified lines
1188 const int v_shift = ceilf(eh * face);1188 const int v_shift = ceilf(eh * face);
1189 const int ehi = ceilf(eh * (face + 1)) - v_shift;1189 const int ehi = ceilf(eh * (face + 1)) - v_shift;
1190 1190
1191 const float uf = 2.f * i / ew - 1.f;1191 const float uf = 2.f * (i + 0.5f) / ew - 1.f;
1192 const float vf = 2.f * (j - v_shift) / ehi - 1.f;1192 const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f;
1193 1193
1194 cube_to_xyz(s, uf, vf, face, vec);1194 cube_to_xyz(s, uf, vf, face, vec);
1195}1195}
@@ -1216,8 +1216,8 @@ static void cube6x1_to_xyz(const V360Context *s, · 20 unmodified lines
1216 const int u_shift = ceilf(ew * face);1216 const int u_shift = ceilf(ew * face);
1217 const int ewi = ceilf(ew * (face + 1)) - u_shift;1217 const int ewi = ceilf(ew * (face + 1)) - u_shift;
1218 1218
1219 const float uf = 2.f * (i - u_shift) / ewi - 1.f;1219 const float uf = 2.f * (i - u_shift + 0.5f) / ewi - 1.f;
1220 const float vf = 2.f * j / eh - 1.f;1220 const float vf = 2.f * (j + 0.5f) / eh - 1.f;
1221 1221
1222 cube_to_xyz(s, uf, vf, face, vec);1222 cube_to_xyz(s, uf, vf, face, vec);
1223}1223}
@@ -1253,8 +1253,8 @@ static void xyz_to_cube1x6(const V360Context *s, · 29 unmodified lines
1253 face = s->in_cubemap_face_order[direction];1253 face = s->in_cubemap_face_order[direction];
1254 ehi = ceilf(eh * (face + 1)) - ceilf(eh * face);1254 ehi = ceilf(eh * (face + 1)) - ceilf(eh * face);
1255 1255
1256 uf = 0.5f * ewi * (uf + 1.f);1256 uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1257 vf = 0.5f * ehi * (vf + 1.f);1257 vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
1258 1258
1259 ui = floorf(uf);1259 ui = floorf(uf);
1260 vi = floorf(vf);1260 vi = floorf(vf);
@@ -1329,8 +1329,8 @@ static void xyz_to_cube6x1(const V360Context *s, · 68 unmodified lines
1329 face = s->in_cubemap_face_order[direction];1329 face = s->in_cubemap_face_order[direction];
1330 ewi = ceilf(ew * (face + 1)) - ceilf(ew * face);1330 ewi = ceilf(ew * (face + 1)) - ceilf(ew * face);
1331 1331
1332 uf = 0.5f * ewi * (uf + 1.f);1332 uf = 0.5f * ewi * (uf + 1.f) - 0.5f;
1333 vf = 0.5f * ehi * (vf + 1.f);1333 vf = 0.5f * ehi * (vf + 1.f) - 0.5f;
1334 1334
1335 ui = floorf(uf);1335 ui = floorf(uf);
1336 vi = floorf(vf);1336 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