1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_v360: add guards against NaNs

Also normalize vector after rotation, it might be needed,
otherwise one can get NaNs.
This commit is contained in:
Paul B Mahol 2019-09-09 18:03:17 +02:00
parent 799c07e5c8
commit 0c9e01011b

View File

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