diff mbox series

[FFmpeg-devel,2/3] swscale/swscale: Fix several invalid shifts related to vChrDrop

Message ID 20200121221454.17655-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] swscale/input: Fix several invalid shifts related to rgb2yuv constants
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 21, 2020, 10:14 p.m. UTC
Fixes: Invalid shifts
Fixes: #8166

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/swscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Jan. 22, 2020, 4:53 a.m. UTC | #1
On Tue, Jan 21, 2020 at 11:24 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: Invalid shifts
> Fixes: #8166
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libswscale/swscale.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index 4ecfa88ff7..8436f056d4 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -295,8 +295,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
>          srcStride[2] =
>          srcStride[3] = srcStride[0];
>      }
> -    srcStride[1] <<= c->vChrDrop;
> -    srcStride[2] <<= c->vChrDrop;
> +    srcStride[1] *= 1 << c->vChrDrop;
> +    srcStride[2] *= 1 << c->vChrDrop;
>
> Also fixes the filter-crop_scale_vflip FATE-test.
I presume the multiplication here can't overflow, so LGTM.

- Andreas
Michael Niedermayer Jan. 22, 2020, 2:35 p.m. UTC | #2
On Wed, Jan 22, 2020 at 05:53:15AM +0100, Andreas Rheinhardt wrote:
> On Tue, Jan 21, 2020 at 11:24 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Fixes: Invalid shifts
> > Fixes: #8166
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libswscale/swscale.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > index 4ecfa88ff7..8436f056d4 100644
> > --- a/libswscale/swscale.c
> > +++ b/libswscale/swscale.c
> > @@ -295,8 +295,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
> >          srcStride[2] =
> >          srcStride[3] = srcStride[0];
> >      }
> > -    srcStride[1] <<= c->vChrDrop;
> > -    srcStride[2] <<= c->vChrDrop;
> > +    srcStride[1] *= 1 << c->vChrDrop;
> > +    srcStride[2] *= 1 << c->vChrDrop;
> >
> > Also fixes the filter-crop_scale_vflip FATE-test.
> I presume the multiplication here can't overflow, so LGTM.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4ecfa88ff7..8436f056d4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -295,8 +295,8 @@  static int swscale(SwsContext *c, const uint8_t *src[],
         srcStride[2] =
         srcStride[3] = srcStride[0];
     }
-    srcStride[1] <<= c->vChrDrop;
-    srcStride[2] <<= c->vChrDrop;
+    srcStride[1] *= 1 << c->vChrDrop;
+    srcStride[2] *= 1 << c->vChrDrop;
 
     DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
                   src[0], srcStride[0], src[1], srcStride[1],