[FFmpeg-cvslog] avfilter/vf_v360: add guards against NaNs

Paul B Mahol git at videolan.org
Mon Sep 9 19:07:31 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Sep  9 18:03:17 2019 +0200| [0c9e01011b549f088d5afd06a82bcbffc589bcf9] | committer: Paul B Mahol

avfilter/vf_v360: add guards against NaNs

Also normalize vector after rotation, it might be needed,
otherwise one can get NaNs.

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

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

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);
             }
         }



More information about the ffmpeg-cvslog mailing list