Message ID | 20210319094204.926251-1-daniel.playfair.cal@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] vf_v360: fix visibility test for fisheye projection | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Fri, Mar 19, 2021 at 20:42:04 +1100, Daniel Playfair Cal wrote: > - const int visible = hypotf(uf, vf) <= 0.5f; > + const int visible = -0.5 < uf && uf < 0.5 && -0.5 < vf && vf < 0.5; Please avoid double constants in float expressions, they propagate the whole calculation to a double. I.e. use "0.5f" instead of "0.5". (Also in one of your other patches.) Cheers, Moritz
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 94473cd5b3..602e0e2d72 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.5 < uf && uf < 0.5 && -0.5 < vf && vf < 0.5; int ui, vi; uf = (uf + 0.5f) * width;
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@gmail.com> --- libavfilter/vf_v360.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)