diff mbox series

[FFmpeg-devel] avfilter/vf_scale: store pointer offsets in a local variable before adding them

Message ID 20210429162453.58605-1-jamrial@gmail.com
State Accepted
Commit 92769f260da8bf38956212cc6a26f98bcf80c6c7
Headers show
Series [FFmpeg-devel] avfilter/vf_scale: store pointer offsets in a local variable before adding them | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer April 29, 2021, 4:24 p.m. UTC
Fixes -Wint-in-bool-context warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/vf_scale.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

James Almer April 30, 2021, 8:25 p.m. UTC | #1
On 4/29/2021 1:24 PM, James Almer wrote:
> Fixes -Wint-in-bool-context warnings.
> 
> Signed-off-by: James Almer <jamrial@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];

Will apply.
diff mbox series

Patch

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