Commit 8f3df1dd authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_v360: improve interpolation for equirect input at poles

parent be82dc17
...@@ -639,6 +639,22 @@ static inline int reflecty(int y, int h) ...@@ -639,6 +639,22 @@ static inline int reflecty(int y, int h)
return y; return y;
} }
/**
* 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. * Reflect x operation.
* *
...@@ -1745,8 +1761,8 @@ static int xyz_to_equirect(const V360Context *s, ...@@ -1745,8 +1761,8 @@ static int xyz_to_equirect(const V360Context *s,
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
us[i][j] = mod(ui + j - 1, width); us[i][j] = ereflectx(ui + j - 1, vi + i - 1, width, height);
vs[i][j] = av_clip(vi + i - 1, 0, height - 1); vs[i][j] = reflecty(vi + i - 1, height);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment