[FFmpeg-devel] [PATCH] avfilter/vf_scale: store pointer offsets in a local variable before adding them
James Almer
jamrial at gmail.com
Thu Apr 29 19:24:53 EEST 2021
Fixes -Wint-in-bool-context warnings.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavfilter/vf_scale.c | 6 ++++--
1 file 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];
--
2.31.1
More information about the ffmpeg-devel
mailing list