[FFmpeg-devel] [PATCH v2] vf_v360: fix visibility test for fisheye projection

Daniel Playfair Cal daniel.playfair.cal at gmail.com
Fri Mar 19 13:48:47 EET 2021


Previously the visibility test referred to a circle in the input. This
changes it so that it refers accurately to the entire area in the input.

Signed-off-by: Daniel Playfair Cal <daniel.playfair.cal at gmail.com>
---
This version avoids using double literals

 libavfilter/vf_v360.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 94473cd5b3..3ac2b914eb 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -2887,7 +2887,7 @@ static int xyz_to_fisheye(const V360Context *s,
     float uf = vec[0] / lh * phi / s->iflat_range[0];
     float vf = vec[1] / lh * phi / s->iflat_range[1];
 
-    const int visible = hypotf(uf, vf) <= 0.5f;
+    const int visible = -0.5f < uf && uf < 0.5f && -0.5f < vf && vf < 0.5f;
     int ui, vi;
 
     uf = (uf + 0.5f) * width;
-- 
2.31.0



More information about the ffmpeg-devel mailing list