diff mbox series

[FFmpeg-devel,24/25] avfilter/af_headphone: Remove pointless additions

Message ID 20200908211856.16290-24-andreas.rheinhardt@gmail.com
State Accepted
Commit 7b841cf6b706055164d5db3f2b901ed32e8092af
Headers show
Series [FFmpeg-devel,01/25] avfilter/af_headphone: Don't use uninitialized buffer in log message | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 8, 2020, 9:18 p.m. UTC
buffer_length is a power-of-two and modulo is buffer_length - 1, so that
buffer_length & modulo is zero.

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

Comments

Paul B Mahol Sept. 9, 2020, 1:33 a.m. UTC | #1
On Tue, Sep 08, 2020 at 11:18:55PM +0200, Andreas Rheinhardt wrote:
> buffer_length is a power-of-two and modulo is buffer_length - 1, so that
> buffer_length & modulo is zero.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/af_headphone.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

fine
diff mbox series

Patch

diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 8db546adbf..03ef88c4a4 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -178,7 +178,7 @@  static int headphone_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
                 continue;
             }
 
-            read = (wr - (ir_len - 1) + buffer_length) & modulo;
+            read = (wr - (ir_len - 1)) & modulo;
 
             if (read + ir_len < buffer_length) {
                 memcpy(temp_src, bptr + read, ir_len * sizeof(*temp_src));