aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-09-09 18:03:17 +0200
committerPaul B Mahol <onemda@gmail.com>2019-09-09 18:03:17 +0200
commit0c9e01011b549f088d5afd06a82bcbffc589bcf9 (patch)
tree8c27ff2f368d249d95ad4279cd01fa68760b6d6b
parent799c07e5c864878b1705b2b6bd06dddd23dfab2a (diff)
downloadffmpeg-0c9e01011b549f088d5afd06a82bcbffc589bcf9.tar.gz
avfilter/vf_v360: add guards against NaNs
Also normalize vector after rotation, it might be needed, otherwise one can get NaNs.
-rw-r--r--libavfilter/vf_v360.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 4d59316bf6..01f0562728 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -33,6 +33,8 @@
* 5) Remap input frame to output frame using precalculated data
*/
+#include <math.h>
+
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
@@ -2319,12 +2321,16 @@ static int config_output(AVFilterLink *outlink)
out_transform(s, j, i, height, width, vec);
else
out_transform(s, i, j, width, height, vec);
+ av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2]));
rotate(rot_mat, vec);
+ av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2]));
+ normalize_vector(vec);
mirror(output_mirror_modifier, vec);
if (s->in_transpose)
in_transform(s, vec, in_height, in_width, r_tmp.v, r_tmp.u, &du, &dv);
else
in_transform(s, vec, in_width, in_height, r_tmp.u, r_tmp.v, &du, &dv);
+ av_assert1(!isnan(du) && !isnan(dv));
calculate_kernel(du, dv, &r_tmp, u, v, ker);
}
}