diff mbox series

[FFmpeg-devel] avcodec/bonk: Actually clip when using av_clip()

Message ID AS8P250MB0744441203E03AC5A5E8FC2C8F449@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 8d12f3de1401f10d93319ffdc46b01de9eba4285
Headers show
Series [FFmpeg-devel] avcodec/bonk: Actually clip when using av_clip() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 12, 2022, 12:20 p.m. UTC
Also fixes a "statement with no effect [-Wunused-value]"
warning from GCC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/bonk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Sept. 12, 2022, 12:21 p.m. UTC | #1
On 9/12/2022 9:20 AM, Andreas Rheinhardt wrote:
> Also fixes a "statement with no effect [-Wunused-value]"
> warning from GCC.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>   libavcodec/bonk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> index f3d797d588..409694f710 100644
> --- a/libavcodec/bonk.c
> +++ b/libavcodec/bonk.c
> @@ -280,7 +280,7 @@ static int predictor_calc_error(int *k, int *state, int order, int error)
>       }
>   
>       // don't drift too far, to avoid overflows
> -    av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
> +    x = av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
>   
>       state[0] = x;

LGTM, but this decoder needs a test to ensure it's actually doing the 
right thing.
Paul B Mahol Sept. 12, 2022, 7:20 p.m. UTC | #2
On 9/12/22, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
> Also fixes a "statement with no effect [-Wunused-value]"
> warning from GCC.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/bonk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> index f3d797d588..409694f710 100644
> --- a/libavcodec/bonk.c
> +++ b/libavcodec/bonk.c
> @@ -280,7 +280,7 @@ static int predictor_calc_error(int *k, int *state, int
> order, int error)
>      }
>
>      // don't drift too far, to avoid overflows
> -    av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
> +    x = av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
>
>      state[0] = x;
>

LGTM

> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
index f3d797d588..409694f710 100644
--- a/libavcodec/bonk.c
+++ b/libavcodec/bonk.c
@@ -280,7 +280,7 @@  static int predictor_calc_error(int *k, int *state, int order, int error)
     }
 
     // don't drift too far, to avoid overflows
-    av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
+    x = av_clip(x, -(SAMPLE_FACTOR << 16), SAMPLE_FACTOR << 16);
 
     state[0] = x;