]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_v360: improve equirect_to_xyz() quality
authorPaul B Mahol <onemda@gmail.com>
Sun, 23 Feb 2020 17:15:06 +0000 (18:15 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 23 Feb 2020 17:15:06 +0000 (18:15 +0100)
libavfilter/vf_v360.c

index de79fcdcf25494293ff78ff1028807fb59c179c6..dee632c25828c9e3154fdff6f4601df4470d7b59 100644 (file)
@@ -1561,8 +1561,8 @@ static int equirect_to_xyz(const V360Context *s,
                            int i, int j, int width, int height,
                            float *vec)
 {
-    const float phi   = ((2.f * i) / width  - 1.f) * M_PI;
-    const float theta = ((2.f * j) / height - 1.f) * M_PI_2;
+    const float phi   = ((2.f * i + 0.5f) / width  - 1.f) * M_PI;
+    const float theta = ((2.f * j + 0.5f) / height - 1.f) * M_PI_2;
 
     const float sin_phi   = sinf(phi);
     const float cos_phi   = cosf(phi);