diff mbox

[FFmpeg-devel,2/2] lavfi/vf_thumbnail_cuda: fix operator precedence bug

Message ID 20190730075143.40520-2-rodger.combs@gmail.com
State Accepted
Commit a0c19707811cb5b4e6df089317dda65dd6a0240b
Headers show

Commit Message

Rodger Combs July 30, 2019, 7:51 a.m. UTC
Discovered via a warning when building with clang
---
 libavfilter/vf_thumbnail_cuda.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philip Langdale July 30, 2019, 8:18 a.m. UTC | #1
On 2019-07-30 15:51, Rodger Combs wrote:
> Discovered via a warning when building with clang
> ---
>  libavfilter/vf_thumbnail_cuda.cu | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_thumbnail_cuda.cu 
> b/libavfilter/vf_thumbnail_cuda.cu
> index c73e49fbc6..d4d4d791f6 100644
> --- a/libavfilter/vf_thumbnail_cuda.cu
> +++ b/libavfilter/vf_thumbnail_cuda.cu
> @@ -71,7 +71,7 @@ __global__ void
> Thumbnail_ushort2(cudaTextureObject_t ushort2_tex,
>      {
>          ushort2 pixel = tex2D<ushort2>(ushort2_tex, x, y);
>          atomicAdd(&histogram[(pixel.x + 128) >> 8], 1);
> -        atomicAdd(&histogram[256 + (pixel.y + 128) >> 8], 1);
> +        atomicAdd(&histogram[256 + ((pixel.y + 128) >> 8)], 1);
>      }
>  }

LGTM

--phil
Timo Rothenpieler July 30, 2019, 1:17 p.m. UTC | #2
applied
diff mbox

Patch

diff --git a/libavfilter/vf_thumbnail_cuda.cu b/libavfilter/vf_thumbnail_cuda.cu
index c73e49fbc6..d4d4d791f6 100644
--- a/libavfilter/vf_thumbnail_cuda.cu
+++ b/libavfilter/vf_thumbnail_cuda.cu
@@ -71,7 +71,7 @@  __global__ void Thumbnail_ushort2(cudaTextureObject_t ushort2_tex,
     {
         ushort2 pixel = tex2D<ushort2>(ushort2_tex, x, y);
         atomicAdd(&histogram[(pixel.x + 128) >> 8], 1);
-        atomicAdd(&histogram[256 + (pixel.y + 128) >> 8], 1);
+        atomicAdd(&histogram[256 + ((pixel.y + 128) >> 8)], 1);
     }
 }