[FFmpeg-cvslog] avfilter/vf_v360: fix scaling to give proper results

Paul B Mahol git at videolan.org
Sat Oct 9 17:59:54 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Oct  9 16:24:58 2021 +0200| [57b14879b93992181ad029297d4045a73d8f5f89] | committer: Paul B Mahol

avfilter/vf_v360: fix scaling to give proper results

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57b14879b93992181ad029297d4045a73d8f5f89
---

 libavfilter/vf_v360.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index cc075cd39f..1a813c1f14 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -1375,7 +1375,7 @@ static void process_cube_coordinates(const V360Context *s,
 
 static av_always_inline float scale(float x, float s)
 {
-    return (0.5f * x + 0.5f) * s - 0.5f;
+    return (0.5f * x + 0.5f) * (s - 1.f);
 }
 
 static av_always_inline float rescale(int x, float s)
@@ -3423,7 +3423,7 @@ static int dfisheye_to_xyz(const V360Context *s,
                            int i, int j, int width, int height,
                            float *vec)
 {
-    const float ew = width / 2.f;
+    const float ew = width * 0.5f;
     const float eh = height;
 
     const int ei = i >= ew ? i - ew : i;
@@ -3464,7 +3464,7 @@ static int xyz_to_dfisheye(const V360Context *s,
                            const float *vec, int width, int height,
                            int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)
 {
-    const float ew = width / 2.f;
+    const float ew = (width - 1) * 0.5f;
     const float eh = height;
 
     const float h     = hypotf(vec[0], vec[1]);



More information about the ffmpeg-cvslog mailing list