aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_scale.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-04-29 13:14:06 -0300
committerJames Almer <jamrial@gmail.com>2021-04-30 19:35:56 -0300
commit92769f260da8bf38956212cc6a26f98bcf80c6c7 (patch)
treed59b5c786ad24832bd74977da0d8ce99024e51d5 /libavfilter/vf_scale.c
parentfb5e2d71127ccae19c3f80ec363bb67d1871cb74 (diff)
downloadffmpeg-92769f260da8bf38956212cc6a26f98bcf80c6c7.tar.gz
avfilter/vf_scale: store the offset in a local variable before adding it
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/vf_scale.c')
-rw-r--r--libavfilter/vf_scale.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index d95a8ad48a..759499395f 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -632,10 +632,12 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s
for (i=0; i<4; i++) {
int vsub= ((i+1)&2) ? scale->vsub : 0;
+ ptrdiff_t in_offset = ((y>>vsub)+field) * cur_pic->linesize[i];
+ ptrdiff_t out_offset = field * out_buf->linesize[i];
in_stride[i] = cur_pic->linesize[i] * mul;
out_stride[i] = out_buf->linesize[i] * mul;
- in[i] = FF_PTR_ADD(cur_pic->data[i], ((y>>vsub)+field) * cur_pic->linesize[i]);
- out[i] = FF_PTR_ADD(out_buf->data[i], field * out_buf->linesize[i]);
+ in[i] = FF_PTR_ADD(cur_pic->data[i], in_offset);
+ out[i] = FF_PTR_ADD(out_buf->data[i], out_offset);
}
if (scale->input_is_pal)
in[1] = cur_pic->data[1];