diff mbox series

[FFmpeg-devel,1/2] avcodec/mpegaudioenc_template: fix invalid shift of sample

Message ID 20200123120312.10077-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/mpegaudioenc_template: fix invalid shift of sample
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. 23, 2020, 12:03 p.m. UTC
Fixes: Ticket8010

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mpegaudioenc_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Feb. 27, 2020, 8:31 p.m. UTC | #1
On Thu, Jan 23, 2020 at 01:03:11PM +0100, Michael Niedermayer wrote:
> Fixes: Ticket8010
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mpegaudioenc_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 93363fe1d2..12f7a098e6 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -701,7 +701,7 @@  static void encode_frame(MpegAudioContext *s,
 
                                 /* normalize to P bits */
                                 if (shift < 0)
-                                    q1 = sample << (-shift);
+                                    q1 = sample * (1 << -shift);
                                 else
                                     q1 = sample >> shift;
                                 q1 = (q1 * mult) >> P;