summaryrefslogtreecommitdiff
path: root/libavfilter/vf_lenscorrection.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-13 23:28:16 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-13 23:29:39 +0200
commit19587c9332f5be4f6bc6d7b2b8ef3fd21dfeaa01 (patch)
treeb326b3647a1f34c2efc12bb806cb60cd84c635f3 /libavfilter/vf_lenscorrection.c
parent07050d7bdc32d82e53ee5bb727f5882323d00dba (diff)
avfilter/vf_lenscorrection: fix division by zero
Fixes #8265
Diffstat (limited to 'libavfilter/vf_lenscorrection.c')
-rw-r--r--libavfilter/vf_lenscorrection.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c
index b5400a2f37..ac3c490821 100644
--- a/libavfilter/vf_lenscorrection.c
+++ b/libavfilter/vf_lenscorrection.c
@@ -155,10 +155,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
for (plane = 0; plane < rect->nb_planes; ++plane) {
int hsub = plane == 1 || plane == 2 ? rect->hsub : 0;
int vsub = plane == 1 || plane == 2 ? rect->vsub : 0;
- int hdiv = 1 << hsub;
- int vdiv = 1 << vsub;
- int w = rect->width / hdiv;
- int h = rect->height / vdiv;
+ int w = AV_CEIL_RSHIFT(rect->width, hsub);
+ int h = AV_CEIL_RSHIFT(rect->height, vsub);
int xcenter = rect->cx * w;
int ycenter = rect->cy * h;
int k1 = rect->k1 * (1<<24);