History

avfilter/vf_v360: improve interpolation for equirect input at poles

Paul B Mahol committed 6 years ago

Commit 8f3df1d1 parent be82dc11 file · +18 −2Browse files

Unified · Split

libavfilter/vf_v360.c+18−2
@@ -639,6 +639,22 @@ static inline int reflecty(int y, int h) · 638 unmodified lines
639639 return y;
640640 }
641641
642+/**
643+ * Reflect x operation for equirect.
644+ *
645+ * @param x input horizontal position
646+ * @param y input vertical position
647+ * @param w input width
648+ * @param h input height
649+ */
650+static inline int ereflectx(int x, int y, int w, int h)
651+{
652+ if (y < 0 || y >= h)
653+ x += w / 2;
654+
655+ return mod(x, w);
656+}
657+
642658 /**
643659 * Reflect x operation.
644660 *
@@ -1745,8 +1761,8 @@ static int xyz_to_equirect(const V360Context *s, · 1100 unmodified lines
17451761
17461762 for (int i = 0; i < 4; i++) {
17471763 for (int j = 0; j < 4; j++) {
1748− us[i][j] = mod(ui + j - 1, width);
1749− vs[i][j] = av_clip(vi + i - 1, 0, height - 1);
1764+ us[i][j] = ereflectx(ui + j - 1, vi + i - 1, width, height);
1765+ vs[i][j] = reflecty(vi + i - 1, height);
17501766 }
17511767 }
17521768

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