summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-02-29 22:27:11 +0100
committerPaul B Mahol <onemda@gmail.com>2020-02-29 22:35:02 +0100
commit8f3df1dd4d0eb8cdc59af9cb77b213630bf6af8b (patch)
tree5b0ca01e73ccfcc5ebcf7f181c40463420147f1b /libavfilter
parentbe82dc175bb8386c3fafc1ea9814bacdb8126eb0 (diff)
downloadffmpeg-8f3df1dd4d0eb8cdc59af9cb77b213630bf6af8b.tar.gz
avfilter/vf_v360: improve interpolation for equirect input at poles
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_v360.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index fc799f18c2..b6195a01f6 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -640,6 +640,22 @@ static inline int reflecty(int y, int h)
}
/**
+ * Reflect x operation for equirect.
+ *
+ * @param x input horizontal position
+ * @param y input vertical position
+ * @param w input width
+ * @param h input height
+ */
+static inline int ereflectx(int x, int y, int w, int h)
+{
+ if (y < 0 || y >= h)
+ x += w / 2;
+
+ return mod(x, w);
+}
+
+/**
* Reflect x operation.
*
* @param x input horizontal position
@@ -1745,8 +1761,8 @@ static int xyz_to_equirect(const V360Context *s,
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- us[i][j] = mod(ui + j - 1, width);
- vs[i][j] = av_clip(vi + i - 1, 0, height - 1);
+ us[i][j] = ereflectx(ui + j - 1, vi + i - 1, width, height);
+ vs[i][j] = reflecty(vi + i - 1, height);
}
}