[FFmpeg-cvslog] avfilter/vf_scale: store the offset in a local variable before adding it

James Almer git at videolan.org
Sat May 1 01:38:16 EEST 2021


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Apr 29 13:14:06 2021 -0300| [92769f260da8bf38956212cc6a26f98bcf80c6c7] | committer: James Almer

avfilter/vf_scale: store the offset in a local variable before adding it

Signed-off-by: James Almer <jamrial at gmail.com>

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

 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];



More information about the ffmpeg-cvslog mailing list